/* ==================================================================
   Noordster — themed skin (light + dark)
   ------------------------------------------------------------------
   Minimalist black & white. Every colour resolves through a token so
   the whole page flips via [data-theme="dark"] on <html>. Light is the
   default; the toggle in the nav (and the OS preference) selects dark.
   Headers in Lora (serif), body in Inter.
   ================================================================== */

/* -- Tokens -------------------------------------------------------- */
:root {
  color-scheme: light;

  --bg:      #ffffff;          /* page background */
  --ink:     #0a0a0a;          /* primary text */
  --mute:    #565656;          /* secondary text */
  --line:    #000000;          /* hairline borders on cards/buttons */
  --surface: #ffffff;          /* cards, panels, modal */
  --visual-bg: #ffffff;        /* modal illustration panel (kept light both themes) */

  --btn-bg:       #000000;     /* primary button fill */
  --btn-fg:       #ffffff;     /* primary button text */
  --btn-bg-hover: #222222;

  --hairline:        rgba(0, 0, 0, 0.14);   /* subtle dividers (nav border, footer top) */
  --hairline-strong: rgba(0, 0, 0, 0.2);
  --glass:      rgba(255, 255, 255, 0.82);  /* scrolled nav / hint glass */
  --glass-foot: rgba(255, 255, 255, 0.75);  /* footer glass */

  /* Soft "cloud" plate behind headings so they read over the field */
  --plate-1: rgba(255, 255, 255, 0.75);
  --plate-2: rgba(255, 255, 255, 0.5);
  --plate-3: rgba(255, 255, 255, 0.34);
  --plate-4: rgba(255, 255, 255, 0.2);
  --plate-5: rgba(255, 255, 255, 0.1);

  --logo-h: clamp(50px, 5vw, 68px);          /* logo scales with viewport */
  --nav-pad-y: 20px;                          /* constant breathing room above/below the logo */
  --nav-h: calc(var(--logo-h) + var(--nav-pad-y) * 2);  /* bar height follows the logo */
  --pad:   clamp(20px, 3vw, 40px);
  --maxw:  1160px;

  --sans:  "Inter", system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --serif: "Lora", Georgia, "Times New Roman", serif;
  --mono:  "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
}

:root[data-theme="dark"] {
  color-scheme: dark;

  --bg:      #0d0e10;
  --ink:     #f2f2f0;
  --mute:    #a2a2a6;
  --line:    #f2f2f0;
  --surface: #17191c;
  --visual-bg: #ffffff;

  --btn-bg:       #f2f2f0;
  --btn-fg:       #0d0e10;
  --btn-bg-hover: #d8d8d4;

  --hairline:        rgba(255, 255, 255, 0.16);
  --hairline-strong: rgba(255, 255, 255, 0.28);
  --glass:      rgba(18, 20, 23, 0.82);
  --glass-foot: rgba(18, 20, 23, 0.72);

  --plate-1: rgba(13, 14, 16, 0.82);
  --plate-2: rgba(13, 14, 16, 0.55);
  --plate-3: rgba(13, 14, 16, 0.4);
  --plate-4: rgba(13, 14, 16, 0.22);
  --plate-5: rgba(13, 14, 16, 0.1);
}

/* -- Base ---------------------------------------------------------- */
* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  background: var(--bg); color: var(--ink);
  font-family: var(--sans); -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
/* Smooth the flip between themes for the solid surfaces */
body, .panel, .feature-card, .steps, .stat-row, .cta-band, .modal, .foot {
  transition: background-color .25s ease, border-color .25s ease, color .25s ease;
}
a:focus-visible, button:focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; }

/* -- Background field + scroll veil -------------------------------- */
#field { position: fixed; inset: 0; display: block; z-index: 0; }
#veil {
  position: fixed; inset: 0; z-index: 1; pointer-events: none;
  background: var(--bg); opacity: 0; will-change: opacity;
}
.page { position: relative; z-index: 2; }

/* -- Nav ----------------------------------------------------------- */
.nav {
  position: fixed; top: 0; left: 0; right: 0; z-index: 10;
  height: var(--nav-h);
  display: flex; align-items: center; justify-content: space-between; gap: 24px;
  padding: 0 var(--pad);
  transition: background .3s ease, border-color .3s ease;
  border-bottom: 1px solid transparent;
}
.nav.scrolled {
  background: var(--glass);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  border-bottom-color: var(--hairline);
}
.brand { display: flex; align-items: center; text-decoration: none; }
/* 2x larger. Transparent PNG (black marks on alpha), so the glass nav and the
   ascii field show through cleanly — no white box. The field still flows around
   this element (see field.js `avoid`), keeping the mark uncluttered. In dark
   mode the black marks are inverted to white. */
.brand-logo {
  display: block; height: var(--logo-h); width: auto;
  transition: filter .25s ease;
}
:root[data-theme="dark"] .brand-logo { filter: invert(1); }

.nav-actions { display: flex; align-items: center; gap: 14px; }
nav.links { display: flex; align-items: center; gap: 26px; }
nav.links a {
  font-family: var(--mono); font-size: 12px; letter-spacing: 0.14em;
  text-transform: uppercase; color: var(--mute); text-decoration: none;
  transition: color .2s ease;
}
nav.links a:hover, nav.links a:focus-visible { color: var(--ink); }

/* primary nav button — solid ink */
.btn-top {
  font-family: var(--sans); font-weight: 600; font-size: 12px; letter-spacing: 0.08em;
  text-transform: uppercase; color: var(--btn-fg); background: var(--btn-bg);
  border: 1px solid var(--btn-bg); padding: 10px 16px; border-radius: 2px;
  cursor: pointer; transition: background .2s ease, color .2s ease, border-color .2s ease; text-decoration: none;
}
.btn-top:hover, .btn-top:focus-visible { background: var(--btn-bg-hover); border-color: var(--btn-bg-hover); }

/* theme toggle — square button matching the nav button's border/height */
.theme-toggle {
  display: inline-flex; align-items: center; justify-content: center;
  width: 40px; height: 40px; flex: none;
  border: 1px solid var(--line); border-radius: 2px;
  background: var(--surface); color: var(--ink); cursor: pointer;
  transition: background .2s ease, color .2s ease, border-color .2s ease;
}
.theme-toggle:hover, .theme-toggle:focus-visible { background: var(--ink); color: var(--bg); }
.theme-toggle svg { width: 18px; height: 18px; display: block; }
.theme-toggle .icon-sun { display: none; }
.theme-toggle .icon-moon { display: block; }
:root[data-theme="dark"] .theme-toggle .icon-sun { display: block; }
:root[data-theme="dark"] .theme-toggle .icon-moon { display: none; }

/* -- Layout primitives --------------------------------------------- */
.section { position: relative; padding: clamp(72px, 12vh, 140px) var(--pad); }
.container { width: 100%; max-width: var(--maxw); margin: 0 auto; }

/* Section headings sit on a soft "cloud" plate: a rounded core behind the text
   that fades outward through layered shadows (gradient opacity) so it blends
   into the field. inline-block so it hugs the text. Cheap — a few shadows on
   one element, not a per-glyph text-shadow. */
.section-head {
  display: inline-block; position: relative; isolation: isolate;
  max-width: 640px; margin-bottom: clamp(36px, 5vw, 56px);
}
.section-head::before {
  content: ""; position: absolute; z-index: -1;
  inset: -3px -10px;                    /* near-opaque core hugs the text closely */
  background: var(--plate-1); border-radius: 22px;
  box-shadow:                           /* airier: gentle, many-step fade reaching farther out */
    0 0 18px 4px var(--plate-1),
    0 0 44px 16px var(--plate-2),
    0 0 84px 34px var(--plate-3),
    0 0 140px 58px var(--plate-4),
    0 0 220px 96px var(--plate-5);
}
.section-head h2 {
  font-family: var(--serif); font-weight: 400;
  font-size: clamp(28px, 3.6vw, 44px); line-height: 1.08;
  letter-spacing: -0.01em; text-wrap: balance;
}
.section-head p { font-size: 16px; line-height: 1.6; color: var(--mute); max-width: 56ch; margin-top: 16px; }
.section-head p b { color: var(--ink); font-weight: 600; }

/* -- Shared bits --------------------------------------------------- */
.eyebrow {
  font-family: var(--mono); font-size: 11px; letter-spacing: 0.34em;
  text-transform: uppercase; color: var(--mute);
  display: flex; align-items: center; gap: 12px;
}
.eyebrow::before { content: ""; width: 26px; height: 1px; background: var(--ink); opacity: 0.7; }

/* -- Hero panel (surface card, hairline border, no shadow) --------- */
.panel {
  width: clamp(460px, 48vw, 620px);
  background: var(--surface); color: var(--ink);
  border: 1px solid var(--line); border-radius: 2px;
  padding: 40px 40px 34px;
  display: grid; gap: 22px;
}
.panel h1 {
  font-family: var(--serif); font-weight: 400;
  font-size: clamp(32px, 3.6vw, 46px); line-height: 1.05;
  letter-spacing: -0.01em; text-wrap: balance; color: var(--ink);
}
.panel .sub { font-size: 16px; line-height: 1.5; color: var(--mute); max-width: 40ch; margin-top: -4px; }
.panel .sub b { color: var(--ink); font-weight: 600; }

/* -- Buttons ------------------------------------------------------- */
.cta-row { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
.cta {
  font-family: var(--sans); font-weight: 600; font-size: 14px; letter-spacing: 0.02em;
  text-decoration: none; padding: 13px 22px; border-radius: 2px;
  display: inline-flex; align-items: center; gap: 10px;
  transition: transform .15s ease, background .2s ease, color .2s ease, border-color .2s ease;
}
.cta.primary { background: var(--btn-bg); color: var(--btn-fg); border: 1px solid var(--btn-bg); }
.cta.primary:hover, .cta.primary:focus-visible { transform: translateY(-2px); background: var(--btn-bg-hover); border-color: var(--btn-bg-hover); }
.cta.ghost, .cta.ghost-dark { background: var(--surface); color: var(--ink); border: 1px solid var(--line); }
.cta.ghost:hover, .cta.ghost:focus-visible,
.cta.ghost-dark:hover, .cta.ghost-dark:focus-visible { background: var(--ink); color: var(--bg); }
.cta .arrow { transition: transform .2s ease; }
.cta:hover .arrow { transform: translateX(4px); }

/* "Read more" shows as a ghost button on desktop; the scroll-cue variant is
   mobile-only (see the 640px query). */
.read-more .rm-scroll { display: none; }

/* -- Trusted-by ---------------------------------------------------- */
.trust { display: grid; gap: 10px; padding-top: 22px; border-top: 1px solid var(--line); }
.trust .cap { font-family: var(--mono); font-size: 10px; letter-spacing: 0.26em; text-transform: uppercase; color: var(--mute); }
.trust .tags { display: flex; flex-wrap: wrap; gap: 8px 10px; align-items: center; }
.trust .tag {
  font-family: var(--mono); font-size: 11px; letter-spacing: 0.16em; text-transform: uppercase;
  color: var(--ink); border: 1px solid var(--line); border-radius: 2px; padding: 5px 10px;
}

/* -- Feature cards (surface, hairline border) ---------------------- */
/* Each card spans shared rows (heading, body, footer) via subgrid, so headings
   line up and bodies start on the same line across all cards. */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  grid-auto-rows: auto;
  column-gap: clamp(16px, 2vw, 24px);
  row-gap: 16px;
}
.feature-card {
  background: var(--surface); color: var(--ink);
  border: 1px solid var(--line); border-radius: 2px;
  padding: clamp(26px, 2.4vw, 34px);
  display: grid; grid-template-rows: subgrid; grid-row: span 3;  /* heading · body · footer */
  transition: transform .2s ease, background-color .25s ease, border-color .25s ease;
}
.feature-card:hover { transform: translateY(-3px); }
.feature-card h3 {
  font-family: var(--serif); font-weight: 400;
  font-size: clamp(22px, 2.1vw, 28px); line-height: 1.12;
  letter-spacing: -0.01em; text-wrap: balance;
}
.feature-card p { font-size: 15px; line-height: 1.5; color: var(--mute); }
.feature-card p b { color: var(--ink); font-weight: 600; }
.feature-card .fc-link {
  margin-top: auto; padding-top: 4px;
  font-family: var(--mono); font-size: 12px; letter-spacing: 0.06em;
  color: var(--ink); text-decoration: none; display: inline-flex; align-items: center; gap: 8px;
}
.feature-card .fc-link:hover { color: var(--mute); }
.feature-card .fc-link .arrow { transition: transform .2s ease; }
.feature-card .fc-link:hover .arrow { transform: translateX(4px); }

/* Card footer: its own subgrid row, holds the ghost "Read more" button. */
.feature-card .card-foot {
  align-self: end; margin-top: clamp(16px, 2vw, 22px);
  padding-top: clamp(16px, 2vw, 20px);
  display: flex;
}
.feature-card .card-cta { padding: 11px 18px; }
.arrow-ne { display: inline-block; transition: transform .2s ease; }
.card-cta:hover .arrow-ne { transform: translate(3px, -3px); }

/* -- Service detail modal ------------------------------------------ */
.modal-overlay {
  position: fixed; inset: 0; z-index: 100;
  display: flex; align-items: center; justify-content: center;
  padding: clamp(16px, 4vw, 44px);
  background: rgba(0, 0, 0, 0.55);
  -webkit-backdrop-filter: blur(2px); backdrop-filter: blur(2px);
}
.modal-overlay[hidden] { display: none; }
.modal {
  position: relative; background: var(--surface); color: var(--ink);
  border: 1px solid var(--line); border-radius: 3px;
  width: min(1060px, 100%); max-height: 90vh;
  display: flex; flex-direction: column; overflow: hidden;
}
/* Fixed to the modal frame (not the scrolling body), so it stays visible. */
.modal-close {
  position: absolute; top: 10px; right: 10px; z-index: 3;
  width: 40px; height: 40px; border-radius: 50%;
  background: var(--surface); border: none; cursor: pointer;
  font-size: 32px; line-height: 1; color: var(--ink);
  display: flex; align-items: center; justify-content: center;
}
.modal-close:hover { color: var(--mute); }
/* Body scrolls; the frame and close button stay put. */
.modal-body { display: grid; grid-template-columns: 1.15fr 1fr; overflow-y: auto; min-height: 0; }
.modal-text { padding: clamp(36px, 4.4vw, 64px); }
.modal-text h3 {
  font-family: var(--serif); font-weight: 400;
  font-size: clamp(24px, 2.8vw, 34px); line-height: 1.1;
  letter-spacing: -0.01em; margin-bottom: 14px; padding-right: 24px;
}
.modal-text p { font-size: 15px; line-height: 1.6; color: var(--mute); }
.modal-text .modal-lead { margin-top: 20px; color: var(--ink); font-weight: 600; }
.modal-text ul { margin-top: 12px; padding: 0; list-style: none; display: grid; gap: 10px; }
.modal-text li {
  position: relative; padding-left: 20px;
  font-size: 15px; line-height: 1.5; color: var(--mute);
}
.modal-text li::before { content: "\2014"; position: absolute; left: 0; color: var(--ink); }
/* Abstract line-art illustration panel — kept light in both themes so the
   black line-art stays visible. */
.modal-visual {
  background: var(--visual-bg); border-left: 1px solid var(--line); min-height: 260px;
  display: flex; align-items: center; justify-content: center;
  padding: clamp(28px, 3.4vw, 52px);
}
.modal-visual img { display: block; width: 100%; height: 100%; object-fit: contain; }

/* -- Process steps (bordered surface list card) -------------------- */
.steps {
  display: grid; background: var(--surface);
  border: 1px solid var(--line); border-radius: 3px;
  padding: 0 clamp(22px, 2.6vw, 34px);
  max-width: 760px;   /* box hugs the ~62ch text measure — no dead space on the right */
}
.step {
  display: grid; grid-template-columns: 56px 1fr; gap: clamp(16px, 3vw, 40px);
  padding: clamp(22px, 3vw, 32px) 0; border-top: 1px solid var(--line); align-items: baseline;
}
.step:first-child { border-top: none; }   /* dividers only between steps */
.step .n { font-family: var(--serif); font-weight: 400; font-size: clamp(22px, 2.2vw, 28px); line-height: 1.15; color: var(--ink); }
.step-body h3 { font-family: var(--serif); font-weight: 400; font-size: clamp(20px, 2vw, 25px); line-height: 1.15; margin-bottom: 8px; }
.step-body p { font-size: 15px; line-height: 1.55; color: var(--mute); max-width: 62ch; }

/* -- Stat row (bordered surface card) ------------------------------ */
.stat-row {
  display: grid; gap: clamp(20px, 3vw, 40px);
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  background: var(--surface); border: 1px solid var(--line); border-radius: 3px;
  padding: clamp(26px, 3vw, 38px) clamp(22px, 2.6vw, 34px);
}
.stat .num { font-family: var(--serif); font-weight: 400; line-height: 1; font-size: clamp(38px, 4.6vw, 58px); letter-spacing: -0.01em; }
.stat .label { margin-top: 12px; font-size: 14px; line-height: 1.45; color: var(--mute); }

/* -- About (founder intro) ----------------------------------------- */
.about {
  display: flex; flex-direction: row-reverse; align-items: center;
  justify-content: flex-end; gap: clamp(28px, 4vw, 56px); flex-wrap: wrap;
}
.about-photo {
  flex: none; width: clamp(150px, 18vw, 210px); aspect-ratio: 1;
  border-radius: 50%; object-fit: cover; object-position: 50% 30%;
  position: relative; z-index: 1;   /* sit above the text's soft glow, not under it */
}
/* Text sits on the same soft "cloud" plate as the section headings, so it stays
   readable over the ascii field. */
.about-body {
  flex: 0 1 auto; position: relative; isolation: isolate; max-width: 560px;
}
.about-body::before {
  content: ""; position: absolute; z-index: -1; inset: -8px -14px;
  background: var(--plate-1); border-radius: 22px;
  box-shadow:
    0 0 18px 4px var(--plate-1),
    0 0 44px 16px var(--plate-2),
    0 0 84px 34px var(--plate-3),
    0 0 140px 58px var(--plate-4),
    0 0 220px 96px var(--plate-5);
}
.about-body h2 {
  font-family: var(--serif); font-weight: 400;
  font-size: clamp(28px, 3.6vw, 44px); line-height: 1.08;
  letter-spacing: -0.01em; margin-bottom: 16px;
}
.about-body p { font-size: 16px; line-height: 1.6; color: var(--mute); max-width: 52ch; }

/* -- Closing CTA band ---------------------------------------------- */
.cta-band {
  border: 1px solid var(--line); background: var(--surface);
  padding: clamp(36px, 6vw, 64px);
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 28px;
}
.cta-band h2 {
  font-family: var(--serif); font-weight: 400;
  font-size: clamp(26px, 3vw, 38px); line-height: 1.08;
  letter-spacing: -0.01em; max-width: 18ch; text-wrap: balance;
}

/* -- Hero ---------------------------------------------------------- */
.hero {
  position: relative; min-height: 100svh;
  display: grid; grid-template-rows: 1fr auto;
  padding: calc(var(--nav-h) + 24px) var(--pad) var(--pad);
  pointer-events: none;
}
.hero a, .hero button { pointer-events: auto; }
.hero-row { align-self: end; display: flex; width: 100%; max-width: var(--maxw); margin-inline: auto; }

.statusbar { align-self: end; display: flex; justify-content: flex-end; width: 100%; max-width: var(--maxw); margin-inline: auto; }
.status { font-family: var(--mono); font-size: 11px; line-height: 1.7; letter-spacing: 0.06em; color: var(--mute); text-align: right; white-space: nowrap; }
.status .k { color: var(--ink); }
.status .v { color: var(--ink); }

.hint {
  position: fixed; z-index: 2; top: 46%; right: 8vw;
  font-family: var(--mono); font-size: 12px; letter-spacing: 0.2em; text-transform: uppercase;
  color: var(--mute); padding: 10px 16px; border: 1px solid var(--hairline-strong); border-radius: 2px;
  background: var(--glass);
  backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px);
  pointer-events: none; transition: opacity .6s ease;
}
.hint.gone { opacity: 0; }

/* -- Footer -------------------------------------------------------- */
.foot {
  position: relative; z-index: 2;
  padding: 32px var(--pad); border-top: 1px solid var(--hairline);
  font-family: var(--sans); font-size: 14px; letter-spacing: 0; color: var(--mute);
  display: flex; justify-content: space-between; flex-wrap: wrap; gap: 12px;
  background: var(--glass-foot);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
}
.foot a { color: inherit; text-decoration: none; border-bottom: 1px solid var(--hairline-strong); }
.foot a:hover { color: var(--ink); border-bottom-color: var(--ink); }

/* -- Responsive ---------------------------------------------------- */
@media (max-width: 860px) {
  nav.links { display: none; }
  .hint { display: none; }
  .statusbar { display: none; }
}
/* Stack the modal: illustration becomes a band above the text */
@media (max-width: 720px) {
  .modal-body { grid-template-columns: 1fr; grid-template-areas: "visual" "text"; }
  .modal-text { grid-area: text; }
  .modal-visual { grid-area: visual; min-height: 150px; border-left: none; border-bottom: 1px solid var(--line); }
}
@media (max-width: 640px) {
  .hero { padding: calc(var(--nav-h) + 16px) 16px 16px; }
  .hero-row { align-self: stretch; align-items: flex-end; }
  .panel { width: 100%; padding: 28px 24px 26px; gap: 18px; }
  .panel h1 { font-size: clamp(28px, 8vw, 36px); }
  .panel .sub { font-size: 15px; }
  .cta-row .cta { flex: 1 1 auto; justify-content: center; }
  .cta-band { flex-direction: column; align-items: flex-start; }

  /* Read more becomes a plain scroll cue: no border/fill, text with a down
     arrow beneath it. */
  .read-more.cta.ghost {
    border: none; background: none; padding: 10px 0 0;
    color: var(--mute); font-weight: 500;
  }
  .read-more.cta.ghost:hover, .read-more.cta.ghost:focus-visible {
    background: none; color: var(--ink);
  }
  .read-more .rm-full { display: none; }
  .read-more .rm-scroll {
    display: flex; flex-direction: column; align-items: center; gap: 4px;
    font-size: 14px; letter-spacing: 0.02em;
  }
  .read-more .rm-arrow { font-size: 18px; line-height: 1; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .hint { display: none; }
  .cta.primary:hover { transform: none; }
  .feature-card:hover { transform: none; }
}
