/* ============================================================
   Brosvision — 2026 redesign
   Minimalist, type-driven, dark & light theme (light-dark()).
   ============================================================ */

/* ---------- Fonts ---------- */
@font-face {
  font-family: 'Space Grotesk';
  font-style: normal;
  font-weight: 300 700;
  font-display: swap;
  src: url('/assets/fonts/space-grotesk-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Space Grotesk';
  font-style: normal;
  font-weight: 300 700;
  font-display: swap;
  src: url('/assets/fonts/space-grotesk-latin-ext.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

/* ---------- Tokens ---------- */
:root {
  /* raw colors */
  --bg-l: #f7f6f3;
  --bg-d: #101013;
  --surface-l: #ffffff;
  --surface-d: #17171b;
  --text-l: #17171a;
  --text-d: #ececee;
  --muted-l: #6a6a70;
  --muted-d: #9b9ba3;
  --line-l: #e2e1dc;
  --line-d: #29292f;
  --accent-l: #b5e11e;   /* lime on light: used as fill behind dark text */
  --accent-d: #c8f542;   /* lime on dark */
  --accent-text-l: #55700a; /* readable lime-olive for text on light bg */
  --accent-text-d: #c8f542;
  --accent-ink: #131503; /* text on accent fill */

  --bg: var(--bg-l);
  --surface: var(--surface-l);
  --text: var(--text-l);
  --muted: var(--muted-l);
  --line: var(--line-l);
  --accent: var(--accent-l);
  --accent-text: var(--accent-text-l);
  --invert: 0;

  @media (prefers-color-scheme: dark) {
    --bg: var(--bg-d);
    --surface: var(--surface-d);
    --text: var(--text-d);
    --muted: var(--muted-d);
    --line: var(--line-d);
    --accent: var(--accent-d);
    --accent-text: var(--accent-text-d);
    --invert: 1;
  }

  @supports (color: light-dark(#fff, #000)) {
    --bg: light-dark(var(--bg-l), var(--bg-d));
    --surface: light-dark(var(--surface-l), var(--surface-d));
    --text: light-dark(var(--text-l), var(--text-d));
    --muted: light-dark(var(--muted-l), var(--muted-d));
    --line: light-dark(var(--line-l), var(--line-d));
    --accent: light-dark(var(--accent-l), var(--accent-d));
    --accent-text: light-dark(var(--accent-text-l), var(--accent-text-d));
  }

  --font: 'Space Grotesk', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --container: 74rem;
  --radius: 14px;
  --radius-lg: 22px;
  --pad: clamp(1.25rem, 4vw, 2.5rem);
  --section: clamp(4.5rem, 10vw, 8.5rem);

  color-scheme: light dark;
  accent-color: var(--accent);
}

/* pinned themes (set by the toggle via class on <html>) */
:root.light { color-scheme: light; --invert: 0; }
:root.dark  { color-scheme: dark;  --invert: 1; }
@supports not (color: light-dark(#fff, #000)) {
  :root.light {
    --bg: var(--bg-l); --surface: var(--surface-l); --text: var(--text-l);
    --muted: var(--muted-l); --line: var(--line-l);
    --accent: var(--accent-l); --accent-text: var(--accent-text-l);
  }
  :root.dark {
    --bg: var(--bg-d); --surface: var(--surface-d); --text: var(--text-d);
    --muted: var(--muted-d); --line: var(--line-d);
    --accent: var(--accent-d); --accent-text: var(--accent-text-d);
  }
}

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

html {
  scrollbar-color: color-mix(in oklab, var(--text) 30%, transparent) transparent;
  scrollbar-gutter: stable;
}

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

img, svg, video { display: block; max-width: 100%; height: auto; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
::selection { background: var(--accent); color: var(--accent-ink); }

/* MPA cross-document transitions (progressive enhancement) */
@view-transition { navigation: auto; }
@media (prefers-reduced-motion: reduce) {
  ::view-transition-group(*), ::view-transition-old(*), ::view-transition-new(*) { animation: none !important; }
}

h1, h2, h3, h4 { font-weight: 500; line-height: 1.08; letter-spacing: -0.02em; text-wrap: balance; }

.container { max-width: var(--container); margin-inline: auto; padding-inline: var(--pad); }

/* invertible monochrome artwork (logo, client logos) */
.invertible { filter: invert(var(--invert)); }
/* white logo: stays white in dark mode, flips to black in light mode */
.logo-mark { filter: invert(calc(1 - var(--invert))); }

/* ---------- Typography helpers ---------- */
.display-1 { font-size: clamp(2.6rem, 7.5vw, 5.6rem); }
.display-2 { font-size: clamp(2rem, 4.6vw, 3.4rem); }
.display-3 { font-size: clamp(1.4rem, 2.6vw, 2rem); }

.kicker {
  display: inline-flex; align-items: center; gap: .6rem;
  font-size: .8rem; font-weight: 500; letter-spacing: .14em; text-transform: uppercase;
  color: var(--muted);
}
.kicker::before {
  content: ''; width: .55rem; height: .55rem; border-radius: 50%;
  background: var(--accent); flex: none;
}

.lead { font-size: clamp(1.05rem, 1.6vw, 1.25rem); color: var(--muted); max-width: 46rem; }

em, .accent-word {
  font-style: normal;
  color: var(--accent-text);
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: .55rem;
  padding: .85rem 1.6rem; border-radius: 999px;
  font-weight: 500; font-size: 1rem; line-height: 1;
  border: 1px solid transparent;
  transition: transform .18s ease, background-color .18s ease, border-color .18s ease, color .18s ease;
}
.btn:active { transform: scale(.97); }
.btn-primary { background: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { background: color-mix(in oklab, var(--accent) 88%, var(--text)); }
.btn-ghost { border-color: var(--line); }
.btn-ghost:hover { border-color: var(--text); }
.btn .arrow { transition: translate .18s ease; }
.btn:hover .arrow { translate: 3px 0; }

/* ---------- Header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in oklab, var(--bg) 82%, transparent);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}
.header-inner {
  display: flex; align-items: center; justify-content: space-between;
  gap: 1rem; height: 4.25rem;
}
.brand { display: inline-flex; align-items: center; gap: .65rem; font-weight: 600; font-size: 1.15rem; letter-spacing: -0.02em; }
.brand img { width: 30px; height: auto; }

.main-nav { display: flex; align-items: center; gap: 1.7rem; }
.main-nav a {
  font-size: .95rem; color: var(--muted);
  transition: color .15s ease;
}
.main-nav a:hover, .main-nav a[aria-current="page"] { color: var(--text); }
.main-nav a[aria-current="page"] { font-weight: 500; }

.header-tools { display: flex; align-items: center; gap: .4rem; }
.tool-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 2.4rem; height: 2.4rem; border-radius: 50%;
  border: 1px solid var(--line);
  color: var(--muted);
  transition: border-color .15s ease, color .15s ease;
}
.tool-btn:hover { border-color: var(--text); color: var(--text); }
.lang-switch { width: auto; padding-inline: .8rem; font-size: .85rem; font-weight: 500; text-transform: uppercase; letter-spacing: .06em; }

/* theme toggle icons */
.icon-sun, .icon-moon { width: 17px; height: 17px; }
.icon-sun { display: none; }
@media (prefers-color-scheme: dark) { :root:not(.light) .icon-sun { display: block; } :root:not(.light) .icon-moon { display: none; } }
:root.dark .icon-sun { display: block; }
:root.dark .icon-moon { display: none; }

/* mobile nav */
.nav-toggle { display: none; }
@media (max-width: 860px) {
  .main-nav {
    position: fixed; inset: 4.25rem 0 auto 0; z-index: 40;
    flex-direction: column; align-items: flex-start; gap: 0;
    background: var(--bg);
    border-bottom: 1px solid var(--line);
    padding: .5rem var(--pad) 1.5rem;
    display: none;
  }
  .main-nav.open { display: flex; }
  .main-nav a { width: 100%; padding: .8rem 0; font-size: 1.25rem; color: var(--text); border-bottom: 1px solid var(--line); }
  .main-nav a:last-child { border-bottom: 0; }
  .nav-toggle { display: inline-flex; }
}

/* ---------- Hero ---------- */
.hero { padding-block: var(--section); position: relative; isolation: isolate; }
main { overflow-x: clip; }
/* animated 3D dot-wave (src/js/hero3d.js), full-bleed behind the hero text */
.hero-bg {
  position: absolute; z-index: -1; inset-block: 0; left: 50%;
  width: 100vw; height: 100%; translate: -50% 0;
  pointer-events: none;
  opacity: 0; transition: opacity 1.4s ease;
  mask-image: linear-gradient(to bottom, transparent, #000 25%, #000 75%, transparent);
}
.hero-bg.on { opacity: 1; }
.hero h1 { margin-block: 1.4rem 1.6rem; }
/* full-contrast text + bg-colored halo so the lead stays readable over the dot-wave */
.hero .lead {
  margin-bottom: 2.2rem;
  color: color-mix(in srgb, var(--text) 88%, transparent);
  text-shadow: 0 0 .6em var(--bg), 0 0 1.2em var(--bg);
}
.hero-actions { display: flex; flex-wrap: wrap; gap: .8rem; }

/* client strip */
.clients-strip {
  border-block: 1px solid var(--line);
  padding-block: 1.9rem;
}
.clients-inner {
  display: flex; align-items: center; justify-content: space-between;
  gap: clamp(1.5rem, 4vw, 3.5rem); flex-wrap: wrap;
}
.clients-inner .kicker { flex: none; }
.client-logos { display: flex; align-items: center; gap: clamp(1.6rem, 4vw, 3.2rem); flex-wrap: wrap; }
.client-logos img {
  height: 32px; width: auto;
  opacity: .6;
  transition: opacity .2s ease;
}
.client-logos img:hover { opacity: 1; }

/* ---------- Sections ---------- */
.section { padding-block: var(--section); }
.section-head { display: flex; align-items: end; justify-content: space-between; gap: 1.5rem; margin-bottom: clamp(2rem, 5vw, 3.5rem); }
.section-head h2 { margin-top: .9rem; }
.section-head .more { flex: none; margin-bottom: .4rem; }
.more {
  display: inline-flex; align-items: center; gap: .45rem;
  font-size: .95rem; font-weight: 500; color: var(--muted);
  transition: color .15s ease;
}
.more:hover { color: var(--text); }
.more .arrow { transition: translate .18s ease; }
.more:hover .arrow { translate: 3px 0; }

/* ---------- Service list (home) ---------- */
.service-rows { border-top: 1px solid var(--line); }
.service-row {
  display: grid; grid-template-columns: 4rem 1fr auto; align-items: center; gap: 1.2rem;
  padding-block: 1.6rem; border-bottom: 1px solid var(--line);
  transition: padding-inline-start .2s ease;
}
.service-row:hover { padding-inline-start: .6rem; }
.service-row .num { font-size: .85rem; color: var(--muted); font-weight: 500; }
.service-row h3 { font-size: clamp(1.3rem, 2.6vw, 1.9rem); font-weight: 500; }
.service-row p { color: var(--muted); font-size: .95rem; margin-top: .3rem; max-width: 38rem; }
.service-row .arrow {
  font-size: 1.4rem; color: var(--muted);
  transition: translate .2s ease, color .2s ease;
}
.service-row:hover .arrow { translate: 4px 0; color: var(--accent-text); }
@media (max-width: 640px) {
  .service-row { grid-template-columns: 2.6rem 1fr auto; gap: .8rem; }
}

/* ---------- Cards ---------- */
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: clamp(1.2rem, 3vw, 2.2rem); }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: clamp(1.2rem, 3vw, 2rem); }
@media (max-width: 860px) { .grid-2, .grid-3 { grid-template-columns: 1fr; } }
@media (min-width: 861px) and (max-width: 1080px) { .grid-3 { grid-template-columns: repeat(2, 1fr); } }

.card { display: block; }
.card-media {
  overflow: hidden; border-radius: var(--radius-lg);
  aspect-ratio: 4 / 3;
  background: var(--surface);
  border: 1px solid var(--line);
}
.card-media img {
  width: 100%; height: 100%; object-fit: cover;
  transition: transform .5s cubic-bezier(.2, .7, .2, 1);
}
.card:hover .card-media img { transform: scale(1.04); }
.card-body { padding-block: 1rem .4rem; }
.card-meta { display: flex; gap: .8rem; align-items: center; font-size: .82rem; color: var(--muted); letter-spacing: .04em; text-transform: uppercase; }
.card h3 { font-size: 1.25rem; margin-top: .45rem; transition: color .15s ease; }
.card:hover h3 { color: var(--accent-text); }

.chip {
  display: inline-block; padding: .2rem .7rem; border-radius: 999px;
  border: 1px solid var(--line); font-size: .78rem; letter-spacing: .05em; text-transform: uppercase;
  color: var(--muted); background: var(--surface);
}

/* ---------- Stats band ---------- */
.stats {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 1px;
  background: var(--line); border-block: 1px solid var(--line);
}
.stat { background: var(--bg); padding: clamp(1.6rem, 3.5vw, 2.6rem) var(--pad); }
.stat .n { font-size: clamp(2.2rem, 5vw, 3.6rem); font-weight: 500; letter-spacing: -0.03em; color: var(--accent-text); }
.stat .label { color: var(--muted); font-size: .95rem; margin-top: .3rem; }
@media (max-width: 720px) { .stats { grid-template-columns: repeat(2, 1fr); } }

/* ---------- CTA ---------- */
.cta {
  border-radius: var(--radius-lg);
  background: var(--surface);
  border: 1px solid var(--line);
  padding: clamp(2.5rem, 6vw, 5rem);
  text-align: center;
}
.cta h2 { font-size: clamp(2rem, 5vw, 3.6rem); margin-bottom: 1rem; }
.cta p { color: var(--muted); max-width: 34rem; margin-inline: auto; margin-bottom: 2rem; }

/* ---------- Page hero (inner pages) ---------- */
.page-hero { padding-block: calc(var(--section) * .8) clamp(2.5rem, 6vw, 4rem); }
.page-hero h1 { margin-block: 1.2rem 1.2rem; }

/* ---------- Project detail ---------- */
.project-meta {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(9rem, 1fr)); gap: 1.4rem;
  padding-block: 1.6rem; border-block: 1px solid var(--line); margin-block: 2rem;
  align-items: center;
}
.project-meta .k { font-size: .78rem; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); margin-bottom: .25rem; }
.project-meta .v { font-weight: 500; }

.media-frame { border-radius: var(--radius-lg); overflow: hidden; border: 1px solid var(--line); }
.media-frame img { width: 100%; }

/* ---------- Prose (rich text) ---------- */
.prose { max-width: 44rem; }
.prose > * + * { margin-top: 1.1em; }
.prose h2 { font-size: 1.7rem; margin-top: 2em; }
.prose h3 { font-size: 1.3rem; margin-top: 1.8em; }
.prose p, .prose li { color: color-mix(in oklab, var(--text) 88%, var(--muted)); }
.prose ul, .prose ol { padding-inline-start: 1.3em; }
.prose li + li { margin-top: .45em; }
.prose li::marker { color: var(--accent-text); }
.prose a { color: var(--accent-text); text-decoration: underline; text-underline-offset: 3px; }
.prose img { border-radius: var(--radius); }
.prose figure { margin-block: 1.6em; }
.prose blockquote { border-inline-start: 3px solid var(--accent); padding-inline-start: 1.2em; color: var(--muted); }
.prose strong { font-weight: 600; }
.prose br:first-child { display: none; }

.article-hero { margin-block: clamp(1.5rem, 4vw, 3rem); }
.article-layout { display: grid; grid-template-columns: 1fr; justify-items: center; }
.article-layout .prose { width: 100%; }

/* ---------- Benefit / process blocks (services) ---------- */
.feature-card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg);
  padding: clamp(1.4rem, 3vw, 2rem);
}
.feature-card h3 { font-size: 1.15rem; margin-bottom: .55rem; }
.feature-card p { color: var(--muted); font-size: .97rem; }

.steps { counter-reset: step; border-top: 1px solid var(--line); }
.step {
  display: grid; grid-template-columns: 3.4rem 1fr; gap: 1.2rem;
  padding-block: 1.5rem; border-bottom: 1px solid var(--line);
}
.step::before {
  counter-increment: step;
  content: counter(step, decimal-leading-zero);
  font-size: .9rem; font-weight: 500; color: var(--accent-text); padding-top: .3rem;
}
.step h3 { font-size: 1.15rem; margin-bottom: .35rem; }
.step p { color: var(--muted); font-size: .97rem; max-width: 40rem; }

/* FAQ */
.faq details { border-bottom: 1px solid var(--line); }
.faq details:first-of-type { border-top: 1px solid var(--line); }
.faq summary {
  cursor: pointer; list-style: none;
  display: flex; justify-content: space-between; align-items: center; gap: 1rem;
  padding-block: 1.2rem; font-weight: 500; font-size: 1.1rem;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: '+'; font-size: 1.5rem; font-weight: 300; color: var(--muted); transition: rotate .2s ease; }
.faq details[open] summary::after { rotate: 45deg; }
.faq .a { padding-bottom: 1.3rem; color: var(--muted); max-width: 44rem; }

/* ---------- Prev / next ---------- */
.pager { display: grid; grid-template-columns: 1fr 1fr; gap: 1px; background: var(--line); border-block: 1px solid var(--line); }
.pager a { background: var(--bg); padding: 1.6rem var(--pad); transition: background .2s ease; }
.pager a:hover { background: var(--surface); }
.pager .dir { font-size: .78rem; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); }
.pager .t { font-weight: 500; font-size: 1.15rem; margin-top: .3rem; }
.pager a:last-child { text-align: end; }
@media (max-width: 640px) { .pager { grid-template-columns: 1fr; } }

/* ---------- About ---------- */
.about-blocks { display: grid; gap: 1px; background: var(--line); border-block: 1px solid var(--line); }
.about-block { background: var(--bg); display: grid; grid-template-columns: minmax(10rem, 18rem) 1fr; gap: 1.5rem; padding-block: 2.2rem; }
.about-block h2 { font-size: 1.35rem; }
.about-block p { color: var(--muted); max-width: 44rem; }
@media (max-width: 720px) { .about-block { grid-template-columns: 1fr; gap: .6rem; } }

/* ---------- Contact ---------- */
.contact-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: clamp(1.2rem, 3vw, 2rem); }
@media (max-width: 900px) { .contact-grid { grid-template-columns: 1fr; } }
.contact-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: clamp(1.5rem, 3vw, 2.2rem); }
.contact-card h2 { font-size: 1.05rem; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); font-weight: 500; margin-bottom: 1.1rem; }
.contact-card p { margin-bottom: .4rem; }
.contact-card .big { font-size: clamp(1.2rem, 2.4vw, 1.6rem); font-weight: 500; display: block; margin-bottom: .6rem; }
.contact-card .big:hover { color: var(--accent-text); }
.contact-card .muted { color: var(--muted); font-size: .95rem; }

/* ---------- Footer ---------- */
.site-footer { border-top: 1px solid var(--line); margin-top: var(--section); }
.footer-grid {
  display: grid; grid-template-columns: 2fr 1fr 1fr 1.4fr; gap: 2rem;
  padding-block: clamp(2.5rem, 6vw, 4rem);
}
@media (max-width: 900px) { .footer-grid { grid-template-columns: 1fr 1fr; } }
@media (max-width: 560px) { .footer-grid { grid-template-columns: 1fr; } }
.footer-grid h2 { font-size: .8rem; text-transform: uppercase; letter-spacing: .12em; color: var(--muted); font-weight: 500; margin-bottom: 1rem; }
.footer-grid ul { list-style: none; padding: 0; display: grid; gap: .55rem; }
.footer-grid a { color: var(--muted); font-size: .97rem; transition: color .15s ease; }
.footer-grid a:hover { color: var(--text); }
.footer-brand p { color: var(--muted); max-width: 20rem; margin-top: 1rem; font-size: .97rem; }
.footer-brand .brand img { width: 34px; }
.footer-fine { color: var(--muted); font-size: .9rem; }
.footer-fine p + p { margin-top: .35rem; }
.footer-bottom {
  display: flex; flex-wrap: wrap; gap: 1rem; align-items: center; justify-content: space-between;
  border-top: 1px solid var(--line); padding-block: 1.4rem;
  color: var(--muted); font-size: .88rem;
}
.footer-bottom nav { display: flex; gap: 1.2rem; }
.footer-bottom a:hover { color: var(--text); }

/* ---------- Reveal animations (progressive enhancement) ---------- */
@media (prefers-reduced-motion: no-preference) {
  @supports (animation-timeline: view()) {
    [data-reveal] {
      animation: reveal-up both;
      animation-timeline: view();
      animation-range: entry 0% entry 42%;
    }
    @keyframes reveal-up {
      from { opacity: 0; transform: translateY(22px); }
      to { opacity: 1; transform: none; }
    }
  }
}

/* ---------- Utilities ---------- */
.mt-2 { margin-top: 2rem; }
.muted { color: var(--muted); }
.visually-hidden {
  position: absolute; width: 1px; height: 1px; margin: -1px;
  clip-path: inset(50%); overflow: hidden; white-space: nowrap;
}
