/* =========================================================
   Martinsen Digital — styles.css
   Merkevare: kullsort + elfenben + salvie-aksent
   Typografi: Montserrat (overskrifter) / Inter (brødtekst)
   ========================================================= */

:root {
  /* Fargepalett fra styleguide */
  --coal: #111514;       /* Kullsort */
  --ivory: #F7F7F5;      /* Elfenben */
  --warm-gray: #D8D3CC;  /* Varm grå */
  --stone: #B9B3AC;      /* Stein */
  --sage: #8B9783;       /* Salvie */
  --steel: #7F858A;      /* Stålgrå */

  --sage-dark: #6f7c68;
  --coal-soft: #1b201f;

  --text: var(--coal);
  --text-muted: #5b605f;
  --line: rgba(17, 21, 20, 0.10);

  /* Typografi */
  --font-head: "Montserrat", system-ui, sans-serif;
  --font-body: "Inter", system-ui, sans-serif;

  --maxw: 1180px;
  --radius: 14px;
  --radius-lg: 22px;
  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
  --shadow: 0 18px 50px -28px rgba(17, 21, 20, 0.45);
}

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }

html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }

body {
  font-family: var(--font-body);
  color: var(--text);
  background: var(--ivory);
  line-height: 1.65;
  font-size: 1.05rem;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

img, svg { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
ul { list-style: none; padding: 0; }

h1, h2, h3 {
  font-family: var(--font-head);
  font-weight: 600;
  line-height: 1.12;
  letter-spacing: -0.01em;
}

::selection { background: var(--sage); color: var(--ivory); }

/* ---------- Layout ---------- */
.container {
  width: 100%;
  max-width: var(--maxw);
  margin-inline: auto;
  padding-inline: clamp(1.25rem, 4vw, 2.5rem);
}

.section { padding-block: clamp(4.5rem, 9vw, 8rem); }

.eyebrow {
  font-family: var(--font-head);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.22em;
  font-size: 0.74rem;
  color: var(--sage-dark);
  margin-bottom: 1rem;
}

.section-head { max-width: 640px; margin-bottom: clamp(2.5rem, 5vw, 4rem); }
.section-head h2 { font-size: clamp(1.9rem, 4vw, 2.9rem); margin-bottom: 1rem; }
.section-intro { color: var(--text-muted); font-size: 1.08rem; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  font-family: var(--font-head);
  font-weight: 600;
  font-size: 0.95rem;
  letter-spacing: 0.01em;
  padding: 0.95rem 1.6rem;
  border-radius: 999px;
  border: 1.5px solid transparent;
  cursor: pointer;
  transition: transform 0.25s var(--ease), background 0.25s var(--ease),
              color 0.25s var(--ease), border-color 0.25s var(--ease),
              box-shadow 0.25s var(--ease);
  white-space: nowrap;
}
.btn:hover { transform: translateY(-2px); }
.btn:active { transform: translateY(0); }

.btn-dark { background: var(--coal); color: var(--ivory); }
.btn-dark:hover { background: var(--coal-soft); box-shadow: var(--shadow); }

.btn-light { background: var(--ivory); color: var(--coal); }
.btn-light:hover { background: #fff; }

.btn-ghost { background: transparent; color: var(--coal); border-color: rgba(17,21,20,0.22); }
.btn-ghost:hover { border-color: var(--coal); background: rgba(17,21,20,0.04); }

.btn-pill {
  background: var(--coal); color: var(--ivory);
  padding: 0.7rem 1.3rem; font-size: 0.9rem;
}
.btn-pill:hover { background: var(--sage-dark); }

.btn-full { width: 100%; }

.link-arrow {
  font-family: var(--font-head);
  font-weight: 600;
  color: var(--sage-dark);
  display: inline-flex;
  gap: 0.4rem;
  transition: gap 0.25s var(--ease), color 0.25s var(--ease);
}
.link-arrow:hover { gap: 0.75rem; color: var(--coal); }

/* ---------- Header ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(247, 247, 245, 0.72);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid transparent;
  transition: border-color 0.3s var(--ease), background 0.3s var(--ease);
}
.site-header.scrolled { border-color: var(--line); background: rgba(247, 247, 245, 0.9); }

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 76px;
}

.brand { display: inline-flex; align-items: center; gap: 0.7rem; color: var(--coal); }
.brand-mark { display: inline-block; width: 46px; color: var(--coal); }
.brand-mark svg, .brand-mark img,
.about-mark img { width: 100%; height: auto; display: block; }
.brand-mark--sm { width: 40px; }

.brand-text { display: flex; flex-direction: column; line-height: 1; }
.brand-name {
  font-family: var(--font-head); font-weight: 700;
  letter-spacing: 0.16em; font-size: 0.95rem;
}
.brand-sub {
  font-family: var(--font-head); font-weight: 500;
  letter-spacing: 0.42em; font-size: 0.6rem; color: var(--steel);
  margin-top: 2px; padding-left: 2px;
}

.nav { display: flex; align-items: center; gap: 2rem; }
.nav a:not(.btn) {
  font-family: var(--font-head); font-weight: 500; font-size: 0.95rem;
  color: var(--coal); position: relative; padding: 0.25rem 0;
}
.nav a:not(.btn)::after {
  content: ""; position: absolute; left: 0; bottom: -2px;
  width: 0; height: 2px; background: var(--sage);
  transition: width 0.28s var(--ease);
}
.nav a:not(.btn):hover::after { width: 100%; }

/* Mobile nav toggle */
.nav-toggle {
  display: none;
  flex-direction: column;
  gap: 5px;
  background: none; border: none; cursor: pointer;
  padding: 8px; margin-right: -8px;
}
.nav-toggle span {
  width: 26px; height: 2px; background: var(--coal);
  transition: transform 0.3s var(--ease), opacity 0.3s var(--ease);
}
.nav-toggle[aria-expanded="true"] span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-toggle[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.nav-toggle[aria-expanded="true"] span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

.mobile-nav {
  display: none;
  flex-direction: column;
  gap: 0.5rem;
  padding: 0 clamp(1.25rem, 4vw, 2.5rem) 1.5rem;
  border-bottom: 1px solid var(--line);
  background: rgba(247, 247, 245, 0.96);
}
.mobile-nav.open { display: flex; }
.mobile-nav a:not(.btn) {
  font-family: var(--font-head); font-weight: 500; padding: 0.7rem 0;
  border-bottom: 1px solid var(--line);
}
.mobile-nav .btn { margin-top: 0.75rem; }

/* ---------- Hero ---------- */
.hero { position: relative; overflow: hidden; padding-block: clamp(4rem, 11vw, 9rem); }
.hero-lines {
  position: absolute; inset: 0; pointer-events: none; z-index: 0;
  background-image: repeating-linear-gradient(
    -45deg, rgba(139,151,131,0.16) 0 1px, transparent 1px 16px);
  -webkit-mask-image: radial-gradient(120% 90% at 85% 0%, #000 0%, transparent 62%);
  mask-image: radial-gradient(120% 90% at 85% 0%, #000 0%, transparent 62%);
}
.hero-inner { position: relative; z-index: 1; max-width: 860px; }

.hero-title {
  font-size: clamp(2.6rem, 7vw, 5rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 1.5rem;
}
.hero-title .accent { color: var(--sage-dark); }

.hero-lead {
  font-size: clamp(1.1rem, 2vw, 1.3rem);
  color: var(--text-muted);
  max-width: 620px;
  margin-bottom: 2.25rem;
}

.hero-actions { display: flex; flex-wrap: wrap; gap: 1rem; margin-bottom: 3.5rem; }

.hero-stats {
  display: grid;
  grid-template-columns: repeat(3, auto);
  gap: clamp(1.5rem, 5vw, 3.5rem);
  justify-content: start;
  padding-top: 2.5rem;
  border-top: 1px solid var(--line);
  max-width: 640px;
}
.stat-num {
  display: block;
  font-family: var(--font-head); font-weight: 700;
  font-size: clamp(1.6rem, 3.5vw, 2.4rem);
  color: var(--coal); line-height: 1;
}
.stat-label { font-size: 0.86rem; color: var(--text-muted); margin-top: 0.4rem; display: block; }

/* ---------- Trust strip ---------- */
.trust { background: var(--coal); color: var(--ivory); }
.trust-inner { padding-block: 1.2rem; text-align: center; }
.trust p {
  font-family: var(--font-head); font-weight: 500;
  letter-spacing: 0.18em; text-transform: uppercase;
  font-size: clamp(0.7rem, 1.6vw, 0.85rem); color: var(--warm-gray);
}

/* ---------- Services ---------- */
.services { background: var(--ivory); }
.service-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
  gap: 1.25rem;
}
.service-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 2rem 1.9rem;
  transition: transform 0.3s var(--ease), box-shadow 0.3s var(--ease),
              border-color 0.3s var(--ease);
}
.service-card:hover {
  transform: translateY(-5px);
  box-shadow: var(--shadow);
  border-color: transparent;
}
.service-icon {
  display: inline-flex;
  width: 52px; height: 52px;
  align-items: center; justify-content: center;
  border-radius: 14px;
  background: rgba(139,151,131,0.14);
  color: var(--sage-dark);
  margin-bottom: 1.4rem;
}
.service-icon svg { width: 26px; height: 26px; }
.service-card h3 { font-size: 1.3rem; margin-bottom: 0.55rem; }
.service-card p { color: var(--text-muted); font-size: 0.98rem; }

.service-card--cta {
  background: var(--coal);
  color: var(--ivory);
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.service-card--cta h3 { color: var(--ivory); }
.service-card--cta p { color: var(--warm-gray); margin-bottom: 1.1rem; }
.service-card--cta .link-arrow { color: var(--sage); }
.service-card--cta .link-arrow:hover { color: #fff; }

/* ---------- Portfolio / work ---------- */
.work { background: #fff; }
.work-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 2rem;
}
.work-card { display: flex; flex-direction: column; }
.work-media {
  display: block;
  overflow: hidden;
  border-radius: var(--radius-lg);
  border: 1px solid var(--line);
  background: var(--ivory);
  aspect-ratio: 1000 / 625;
  box-shadow: var(--shadow);
}
.work-media img {
  width: 100%; height: 100%;
  object-fit: cover; object-position: top center;
  display: block;
  transition: transform 0.6s var(--ease);
}
.work-card:hover .work-media img { transform: scale(1.04); }
.work-body { padding-top: 1.25rem; }
.work-tag {
  font-family: var(--font-head); font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.14em;
  font-size: 0.7rem; color: var(--sage-dark);
}
.work-body h3 { font-size: 1.35rem; margin: 0.45rem 0 0.5rem; }
.work-body p { color: var(--text-muted); font-size: 0.98rem; margin-bottom: 0.9rem; }

/* ---------- Process ---------- */
.process { background: var(--warm-gray); }
.steps {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1.5rem;
  counter-reset: step;
}
.step {
  position: relative;
  padding: 2rem 1.75rem;
  background: rgba(247,247,245,0.55);
  border-radius: var(--radius);
  border-top: 3px solid var(--sage);
}
.step-num {
  font-family: var(--font-head); font-weight: 700;
  font-size: 2.4rem; color: var(--stone); line-height: 1;
  display: block; margin-bottom: 0.9rem;
}
.step h3 { font-size: 1.25rem; margin-bottom: 0.5rem; }
.step p { color: var(--text-muted); font-size: 0.96rem; }

/* ---------- About ---------- */
.about { background: var(--ivory); }
.about-grid {
  display: grid;
  grid-template-columns: 1.2fr 0.9fr;
  gap: clamp(2rem, 5vw, 4.5rem);
  align-items: center;
}
.about-text h2 { font-size: clamp(1.9rem, 4vw, 2.9rem); margin-bottom: 1.25rem; }
.about-text p { color: var(--text-muted); margin-bottom: 1.1rem; }
.about-points { margin-top: 1.5rem; display: grid; gap: 0.75rem; }
.about-points li {
  position: relative; padding-left: 1.9rem;
  font-family: var(--font-head); font-weight: 500; font-size: 0.98rem;
}
.about-points li::before {
  content: ""; position: absolute; left: 0; top: 0.55em;
  width: 18px; height: 2px; background: var(--sage);
}

.about-card {
  position: relative;
  background: var(--coal);
  color: var(--ivory);
  border-radius: var(--radius-lg);
  padding: clamp(2.2rem, 4vw, 3rem);
  overflow: hidden;
  box-shadow: var(--shadow);
}
.about-card::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background-image: repeating-linear-gradient(
    -45deg, rgba(247,247,245,0.06) 0 1px, transparent 1px 14px);
  -webkit-mask-image: radial-gradient(90% 80% at 100% 100%, #000, transparent 70%);
  mask-image: radial-gradient(90% 80% at 100% 100%, #000, transparent 70%);
}
.about-mark { display: inline-block; position: relative; width: 78px; margin-bottom: 1.5rem; }
.about-card blockquote {
  position: relative;
  font-family: var(--font-head); font-weight: 600;
  font-size: clamp(1.4rem, 2.6vw, 1.85rem);
  line-height: 1.25; letter-spacing: -0.01em;
}
.about-card-sub { position: relative; color: var(--warm-gray); margin-top: 1.1rem; font-size: 0.95rem; }

/* ---------- CTA band ---------- */
.cta-band {
  background: var(--sage);
  color: var(--coal);
}
.cta-inner { text-align: center; padding-block: clamp(3.5rem, 7vw, 6rem); max-width: 720px; margin-inline: auto; }
.cta-inner h2 { font-size: clamp(1.9rem, 4.5vw, 3rem); margin-bottom: 1rem; }
.cta-inner p { font-size: 1.1rem; margin-bottom: 2rem; color: rgba(17,21,20,0.8); }

/* ---------- Contact ---------- */
.contact { background: var(--ivory); }
.contact-grid {
  display: grid;
  grid-template-columns: 0.95fr 1.05fr;
  gap: clamp(2.5rem, 6vw, 5rem);
}
.contact-info h2 { font-size: clamp(1.9rem, 4vw, 2.8rem); margin-bottom: 1rem; }
.contact-list { margin-top: 2.25rem; display: grid; gap: 1.4rem; }
.contact-list li { display: flex; flex-direction: column; gap: 0.2rem; }
.contact-label {
  font-family: var(--font-head); font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.16em;
  font-size: 0.72rem; color: var(--steel);
}
.contact-list a, .contact-list span:not(.contact-label) {
  font-size: 1.1rem; font-family: var(--font-head); font-weight: 500;
}
.contact-list a { transition: color 0.2s var(--ease); }
.contact-list a:hover { color: var(--sage-dark); }

/* Contact (uten skjema) */
.contact-simple { max-width: 620px; }
.contact-actions { display: flex; flex-wrap: wrap; gap: 1rem; margin-top: 2.25rem; }

/* Form */
.contact-form {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: clamp(1.75rem, 3.5vw, 2.5rem);
  display: grid;
  gap: 1.1rem;
  box-shadow: var(--shadow);
}
.field { display: grid; gap: 0.4rem; }
.field label {
  font-family: var(--font-head); font-weight: 500; font-size: 0.9rem;
}
.optional { color: var(--steel); font-weight: 400; }
.field input, .field textarea {
  font-family: var(--font-body); font-size: 1rem;
  padding: 0.85rem 1rem;
  border: 1.5px solid var(--line);
  border-radius: 10px;
  background: var(--ivory);
  color: var(--coal);
  transition: border-color 0.2s var(--ease), background 0.2s var(--ease);
  resize: vertical;
}
.field input:focus, .field textarea:focus {
  outline: none;
  border-color: var(--sage);
  background: #fff;
}
.field input.invalid, .field textarea.invalid { border-color: #b4564f; }

.form-status { font-size: 0.92rem; min-height: 1.2em; }
.form-status.success { color: var(--sage-dark); font-weight: 500; }
.form-status.error { color: #b4564f; }

/* ---------- Footer ---------- */
.site-footer { background: var(--coal); color: var(--warm-gray); }
.footer-inner {
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr;
  gap: 2.5rem;
  padding-block: clamp(3rem, 6vw, 4.5rem);
}
.footer-brand .brand-mark { color: var(--ivory); margin-bottom: 1rem; }
.footer-name {
  font-family: var(--font-head); font-weight: 500;
  letter-spacing: 0.16em; color: var(--ivory); font-size: 1rem;
}
.footer-name strong { font-weight: 700; }
.footer-tag { margin-top: 0.9rem; color: var(--steel); max-width: 320px; font-size: 0.95rem; }

.footer-nav, .footer-contact { display: grid; gap: 0.7rem; align-content: start; }
.footer-nav a, .footer-contact a {
  font-size: 0.96rem; transition: color 0.2s var(--ease);
}
.footer-nav a:hover, .footer-contact a:hover { color: var(--ivory); }

.footer-bottom {
  display: flex; justify-content: space-between; flex-wrap: wrap; gap: 0.5rem;
  padding-block: 1.5rem;
  border-top: 1px solid rgba(247,247,245,0.1);
  font-size: 0.85rem; color: var(--steel);
}

/* ---------- Reveal animation ---------- */
.reveal {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.7s var(--ease), transform 0.7s var(--ease);
}
.reveal.in { opacity: 1; transform: none; }

/* ---------- Page hero (subpages) ---------- */
.page-hero {
  position: relative;
  overflow: hidden;
  padding-block: clamp(3rem, 7vw, 5.5rem);
  border-bottom: 1px solid var(--line);
}
.page-hero > .container { position: relative; z-index: 1; max-width: 760px; }
.page-hero h1 {
  font-size: clamp(2.2rem, 5.5vw, 3.6rem);
  letter-spacing: -0.02em;
  margin-bottom: 1rem;
}
.page-hero .hero-lead { margin-bottom: 0; }

/* Active nav state */
.nav a[aria-current="page"]:not(.btn) { color: var(--sage-dark); }
.nav a[aria-current="page"]:not(.btn)::after { width: 100%; }
.mobile-nav a[aria-current="page"]:not(.btn) { color: var(--sage-dark); }

/* Home: alt section + service teaser */
.section--alt { background: var(--warm-gray); }
.service-mini { display: flex; flex-wrap: wrap; gap: 0.75rem; }
.service-mini li {
  font-family: var(--font-head); font-weight: 600; font-size: 0.95rem;
  padding: 0.6rem 1.2rem;
  border-radius: 999px;
  background: rgba(247, 247, 245, 0.75);
  border: 1px solid var(--line);
}
.section-cta { margin-top: 2.5rem; }

/* ---------- Responsive ---------- */
@media (max-width: 880px) {
  .nav { display: none; }
  .nav-toggle { display: flex; }
  .about-grid { grid-template-columns: 1fr; }
  .contact-grid { grid-template-columns: 1fr; }
  .footer-inner { grid-template-columns: 1fr; gap: 2rem; }
}

@media (max-width: 520px) {
  body { font-size: 1rem; }
  .hero-stats { grid-template-columns: 1fr; gap: 1.25rem; }
  .hero-actions .btn { width: 100%; }
}

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .reveal { opacity: 1; transform: none; transition: none; }
  .btn:hover, .service-card:hover { transform: none; }
}
