/* Theme: Heidi Health palette (sand / bark / forest / grey accent) and type (General Sans + editorial serif + IBM Plex Mono). */
:root {
  --cream: #fcfaf8;
  --sand-50: #f9f4f1;
  --sand-75: #f6efea;
  --sand-100: #f6ece4;
  --sand-200: #f0dfd1;
  --sand-300: #ecd7c6;
  --studio: #e9dfd5;
  /* Dark palette ("bark" ramp). Default is dark grey; <html data-palette="black"> or "plum" switches it
     (overrides below). js/main.js reads the same attribute for the 3D backdrop and shadows. */
  --ink-rgb: 37, 37, 40;
  --scrim-rgb: 30, 30, 33;
  --stage-dark-top: #2e2e32;
  --stage-dark-bottom: #1d1d20;
  --bark-900: #252528;
  --deep: #0e0e0f; /* loader + contact backgrounds: true black on the grey and black palettes */
  --bark-800: #3c3c40;
  --bark-700: #4f4f53;
  --bark-600: #636367;
  --bark-500: #7d7d82;
  --bark-300: #b4b4b8;
  --bark-200: #d2d2d5;
  --forest-800: #194b22;
  --forest-700: #2b6433;
  --forest-600: #407648;
  /* accent: primary buttons, active states and highlights (was Heidi's yellow #fbf582) */
  --accent: #e2e2e4;
  --accent-hover: #d3d3d6;
  --sky: #b9cfff;

  --line: rgba(var(--ink-rgb), .12);
  --line-dark: rgba(249, 244, 241, .14);

  /* "Exposure" is Heidi's licensed headline face; Newsreader is the free stand-in until it's licensed. */
  --serif: "Exposure", "Newsreader", Georgia, serif;
  --sans: "General Sans", system-ui, -apple-system, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, Menlo, monospace;
  --gut: 4vw;
  --ease: cubic-bezier(.7, 0, .2, 1);
  --card-h: 360px;
  --radius: 12px;
  --h-section: clamp(1.9rem, 3.6vw, 3.9rem); /* every section heading after the hero */
}
:root[data-palette="black"] {
  --ink-rgb: 14, 14, 15;
  --scrim-rgb: 10, 10, 11;
  --stage-dark-top: #1b1b1d;
  --stage-dark-bottom: #0a0a0b;
  --bark-900: #0e0e0f;
  --bark-800: #2a2a2c;
  --bark-700: #47474a;
}
:root[data-palette="plum"] {
  --deep: #28030f;
  --ink-rgb: 40, 3, 15;
  --scrim-rgb: 30, 3, 12;
  --stage-dark-top: #2e0614;
  --stage-dark-bottom: #160109;
  --bark-900: #28030f;
  --bark-800: #4c2934;
  --bark-700: #5b3e47;
  --bark-600: #755760;
  --bark-500: #8a7078;
  --bark-300: #c39da8;
  --bark-200: #d4c4c9;
}

/* Chinese, Japanese and Korean: matching CJK faces behind the Latin ones, looser tracking (tight Latin tracking crowds CJK glyphs) */
/* CJK uses fonts built into each OS (Apple / Windows / Android), never a web-font service, so it works in mainland China */
:root:lang(zh) { --serif: "Exposure", "Newsreader", "Songti SC", "STSong", "SimSun", "Noto Serif SC", serif; --sans: "General Sans", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", system-ui, sans-serif; }
:root:lang(ja) { --serif: "Exposure", "Newsreader", "Hiragino Mincho ProN", "Yu Mincho", "Noto Serif JP", serif; --sans: "General Sans", "Hiragino Sans", "Yu Gothic", "Meiryo", "Noto Sans JP", system-ui, sans-serif; }
:root:lang(ko) { --serif: "Exposure", "Newsreader", "AppleMyungjo", "Batang", "Noto Serif KR", serif; --sans: "General Sans", "Apple SD Gothic Neo", "Malgun Gothic", "Noto Sans KR", system-ui, sans-serif; }
:root:is(:lang(zh), :lang(ja), :lang(ko)) :is(.h2, .hero-title, .statement, .prod-name, .contact-title, .lead, .svc-big, .stats4 dt) { letter-spacing: -.01em; line-height: 1.25; }
:root:is(:lang(zh), :lang(ja), :lang(ko)) .mono { letter-spacing: .02em; }
:root:is(:lang(zh), :lang(ja), :lang(ko)) .hero-title { font-size: clamp(2.2rem, 4.2vw, 5.4rem); }
:root:lang(ko) body { word-break: keep-all; }
:root:lang(ja) body { line-break: strict; }

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; overflow-x: clip; }
html.lenis, html.lenis body { height: auto; }
.lenis.lenis-smooth { scroll-behavior: auto !important; }
body {
  margin: 0;
  background: var(--cream);
  color: var(--bark-900);
  font: 450 16px/1.4 var(--sans);
  letter-spacing: -.01em;
  -webkit-font-smoothing: antialiased;
  overflow-x: clip;
}
body.is-loading { overflow: hidden; }
a { color: inherit; text-decoration: none; }
h1, h2, h3, p, dl, dd, ol, ul { margin: 0; padding: 0; }
ol, ul { list-style: none; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
address { font-style: normal; }

.mono { font-family: var(--mono); font-size: 11px; font-weight: 500; letter-spacing: .06em; text-transform: uppercase; line-height: 1.4; }
.wrap { padding: 0 var(--gut); }
.label { display: flex; gap: 12px; align-items: center; color: var(--bark-500); }
.label span:first-child { padding: 3px 8px; border-radius: 6px; background: var(--sand-200); color: var(--bark-800); }
.h2 { font-family: var(--serif); font-size: var(--h-section); line-height: 1.06; letter-spacing: -.045em; font-weight: 400; }
.lead { font-size: clamp(1.1rem, 1.45vw, 1.35rem); line-height: 1.4; letter-spacing: -.015em; }
.muted { color: var(--bark-500); }

.line { display: block; overflow: hidden; padding-bottom: .1em; margin-bottom: -.1em; }
.char, .word { display: inline-block; will-change: transform; }

/* ---------- Layers */
/* 3D layers use the stable large viewport (100lvh), so Safari's sliding address bar never resizes them */
#backdrop { position: fixed; left: 0; top: 0; width: 100vw; height: 100vh; height: 100lvh; z-index: 0; background: var(--cream); pointer-events: none; }
/* Hero card mask: page-coloured paint with a rounded hole, drawn over the canvas (same layer, later in the DOM).
   Clipping the WebGL canvas itself with clip-path flickers on iOS Safari; plain box-shadow paint doesn't. */
#card-frame { position: fixed; left: 0; top: 0; width: 100vw; height: 100vh; height: 100lvh; z-index: 1; pointer-events: none; overflow: hidden; }
#card-hole {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
  width: 0; height: 0; border-radius: 20px; box-shadow: 0 0 0 200vmax var(--cream);
}
#stage-card {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
  width: 0; height: 0; border-radius: 20px;
  background: linear-gradient(180deg, #efe6dd, #e2d4c7);
}
/* Plum layer cross-fades with scroll (--stage-dark, 0 → 1) between the light and dark chapters, so the colour never snaps */
#stage-card::after { content: ""; position: absolute; inset: 0; border-radius: inherit; background: linear-gradient(180deg, var(--stage-dark-top), var(--stage-dark-bottom)); opacity: var(--stage-dark, 0); }
.products::before { opacity: calc(1 - var(--stage-dark, 0)); }
.path::before { opacity: var(--stage-dark, 0); }
/* feather the text-backing shades so section edges never show as hard lines while chapters hand over */
.inside::before, .path::before, .products::before {
  -webkit-mask-image: linear-gradient(180deg, transparent 0, #000 12vh, #000 calc(100% - 12vh), transparent 100%);
  mask-image: linear-gradient(180deg, transparent 0, #000 12vh, #000 calc(100% - 12vh), transparent 100%);
}
#gl { position: fixed; left: 0; top: 0; width: 100vw; height: 100vh; height: 100lvh; z-index: 1; pointer-events: none; display: block; }
main { position: relative; z-index: 2; }

/* ---------- Loader */
#loader {
  position: fixed; inset: 0; z-index: 100; background: var(--deep); color: var(--sand-50);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px;
}
.loader-num { font-family: var(--serif); font-variant-numeric: lining-nums tabular-nums; font-size: clamp(2.4rem, 5.5vw, 4.8rem); line-height: 1; letter-spacing: -.05em; font-weight: 400; display: flex; align-items: flex-start; }
.loader-num small { font-family: var(--sans); font-size: .22em; margin: .25em 0 0 .2em; color: var(--accent); letter-spacing: 0; }
.loader-bar { width: min(150px, 40vw); height: 2px; background: var(--bark-800); overflow: hidden; border-radius: 2px; }
.loader-bar i { display: block; height: 100%; background: var(--accent); transform-origin: left; transform: scaleX(0); }

/* ---------- Nav (colour follows the section underneath) */
.nav {
  position: fixed; top: 0; left: 0; right: 0; z-index: 10;
  display: flex; align-items: center; justify-content: space-between; gap: 24px;
  padding: 18px calc(var(--gut) + 120px) 18px var(--gut);
  color: var(--bark-900); transition: color .4s;
}
body[data-theme="dark"] .nav { color: var(--sand-50); }
.logo { display: flex; align-items: center; gap: 10px; }
.logo b { font-family: var(--serif); font-size: 30px; letter-spacing: -.05em; font-weight: 400; }
.logo .mono { font-size: 9px; line-height: 1.15; opacity: .75; }
.nav-links {
  display: flex; gap: 4px; font-size: 15px; font-weight: 500;
  padding: 5px; border-radius: var(--radius);
  background: rgba(252, 250, 248, .78); color: var(--bark-900);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  box-shadow: 0 1px 0 rgba(var(--ink-rgb), .04), 0 8px 24px -12px rgba(var(--ink-rgb), .18);
}
.nav-links a { padding: 7px 12px; border-radius: 8px; transition: background .3s; }
@media (hover: hover) { .nav-links a:hover { background: var(--sand-100); } }
.nav-links a[aria-current] { background: var(--bark-900); color: var(--sand-50); }
.nav-cta { position: fixed; top: 18px; right: var(--gut); z-index: 11; }
/* language menu */
.lang { position: relative; }
.lang-btn { display: inline-flex; align-items: center; gap: 6px; padding: 8px 10px; border-radius: 8px; font-weight: 600; transition: background .3s; }
.lang-btn i { font-style: normal; font-size: 9px; opacity: .7; }
.lang-btn:hover, .lang-btn[aria-expanded="true"] { background: rgba(252, 250, 248, .14); }
body[data-theme="light"] .lang-btn:hover, body[data-theme="light"] .lang-btn[aria-expanded="true"] { background: var(--sand-100); }
.lang-menu {
  position: absolute; top: calc(100% + 6px); right: 0; min-width: 150px; padding: 6px; border-radius: var(--radius);
  background: var(--cream); color: var(--bark-900); box-shadow: 0 1px 0 rgba(var(--ink-rgb), .04), 0 16px 40px -14px rgba(var(--ink-rgb), .35);
}
.lang-menu[hidden] { display: none; }
.lang-menu a { display: block; padding: 9px 12px; border-radius: 8px; font: 500 15px/1.2 var(--sans); letter-spacing: -.01em; text-transform: none; }
.lang-menu a:hover { background: var(--sand-100); }
.lang-menu a[aria-current="true"] { background: var(--sand-200); }

/* ---------- Buttons (rolling label) */
.btn {
  display: inline-flex; align-items: center; gap: 10px; height: 44px; padding: 0 18px;
  border-radius: 10px; font: 500 15px/1 var(--sans); letter-spacing: -.01em;
  transition: background .3s, color .3s, box-shadow .3s; will-change: transform;
}
.btn i { font-style: normal; font-size: 13px; transition: transform .5s var(--ease); }
.btn:hover i { transform: translateX(3px); }
.btn-roll { display: block; height: 1.2em; line-height: 1.2em; overflow: hidden; }
.btn-roll span { display: block; transition: transform .55s var(--ease); }
.btn:hover .btn-roll span { transform: translateY(-100%); }
.btn--accent { background: var(--accent); color: var(--bark-900); }
.btn--accent:hover { background: var(--accent-hover); }
.btn--dark { background: var(--bark-900); color: var(--sand-50); }
.btn--ghost { background: transparent; color: var(--bark-900); box-shadow: inset 0 0 0 1px var(--bark-200); }
.btn--ghost:hover { background: var(--sand-100); }
.btn--sm { height: 40px; padding: 0 16px; font-size: 14px; }
.btn--lg { height: 56px; padding: 0 26px; font-size: 17px; }

/* ---------- 01 Hero */
.hero { position: relative; height: 100vh; height: 100svh; overflow: hidden; }
.hero-kicker { position: absolute; left: 50%; top: calc(50% - var(--card-h) / 2 - 34px); transform: translateX(-50%); color: var(--bark-500); white-space: nowrap; }
.hero-title { font-family: var(--serif); font-weight: 400; font-size: clamp(2.6rem, 5vw, 6.2rem); line-height: 1.05; letter-spacing: -.05em; }
.hero-word { position: absolute; top: 50%; margin-top: -.55em; white-space: nowrap; }
.hero-word--l { left: var(--gut); }
.hero-word--r { right: var(--gut); }
.hero-foot { position: absolute; left: var(--gut); right: var(--gut); bottom: 30px; display: grid; grid-template-columns: minmax(0, 32ch) auto 1fr; gap: 28px; align-items: end; }
.hero-sub { font-size: 16px; line-height: 1.4; color: var(--bark-700); }
.hero-sub b { color: var(--bark-900); font-weight: 600; }
.ctas { display: flex; gap: 10px; }
.scroll-hint { justify-self: end; color: var(--bark-500); }
.scroll-hint i { display: inline-block; font-style: normal; animation: nudge 1.6s var(--ease) infinite; }
@keyframes nudge { 50% { transform: translateY(4px); } }

/* 3D chapters: light studio (inside, products) and dark plasma (path) */
.stage-light { color: var(--bark-900); }
.stage-dark { color: var(--sand-50); }
.stage-dark .label { color: var(--bark-300); }
.stage-dark .label span:first-child { background: var(--bark-800); color: var(--sand-100); }
.inside::before, .path::before, .products::before {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(90deg, rgba(239,230,221,.92) 0%, rgba(239,230,221,.62) 32%, rgba(239,230,221,0) 58%);
}
.path::before { background: linear-gradient(90deg, rgba(var(--scrim-rgb),.85) 0%, rgba(var(--scrim-rgb),.55) 32%, rgba(var(--scrim-rgb),0) 58%); }

/* ---------- 02 Inside */
.inside { position: relative; height: 100vh; }
.inside-copy { position: absolute; top: 15vh; left: var(--gut); width: min(46vw, 760px); }
.statement { margin-top: 26px; font-family: var(--serif); font-size: clamp(1.35rem, 2.2vw, 2.5rem); line-height: 1.14; letter-spacing: -.035em; font-weight: 400; }
.callouts { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; margin-top: 7vh; }
.callout { display: grid; gap: 6px; padding-top: 14px; border-top: 1px solid var(--line); }
.callout .mono { color: var(--forest-700); }
.callout b { font-weight: 500; font-size: 18px; letter-spacing: -.02em; line-height: 1.15; }
.callout span:last-child { color: var(--bark-600); font-size: 13px; line-height: 1.35; }
.inside-stats { position: absolute; left: var(--gut); right: var(--gut); bottom: 30px; display: grid; grid-template-columns: repeat(4, 1fr); border-top: 1px solid var(--line); }
.inside-stats div { padding: 18px 18px 0 0; }
.inside-stats dt { font-family: var(--serif); font-size: clamp(1.3rem, 2vw, 2rem); letter-spacing: -.04em; font-weight: 400; }
.inside-stats dd { color: var(--bark-500); margin-top: 4px; }

/* ---------- 03 Path */
.path { position: relative; height: 100vh; }
.path-head { position: absolute; top: 14vh; left: var(--gut); }
.path-head .h2 { margin-top: 20px; }
/* starts below the two-line heading with a little breathing room, so it tracks --h-section */
.steps { position: absolute; left: var(--gut); top: calc(14vh + 20px + var(--h-section) * 2.3 + 32px); width: min(30vw, 420px); }
.step { display: grid; grid-template-columns: 36px 1fr; padding: 12px 0; border-top: 1px solid var(--line-dark); opacity: .4; transition: opacity .5s; }
.step .idx, .step .role { color: var(--bark-300); }
.step .idx { padding-top: 3px; }
.step h3 { font-weight: 500; font-size: 18px; letter-spacing: -.02em; }
.step p { color: var(--bark-300); font-size: 14px; line-height: 1.35; max-height: 0; overflow: hidden; transition: max-height .6s var(--ease), margin .6s var(--ease); }
.step.is-on { opacity: 1; }
.step.is-on .idx, .step.is-on .role { color: var(--accent); }
.step.is-on p { max-height: 4em; margin-top: 4px; }
.track { position: absolute; left: var(--gut); right: var(--gut); bottom: 34px; }
.track-line { height: 2px; border-radius: 2px; background: var(--bark-800); position: relative; }
.track-fill { position: absolute; inset: 0; background: var(--accent); transform-origin: left; transform: scaleX(0); box-shadow: 0 0 12px rgba(226,226,228,.6); border-radius: 2px; }
.track-nodes { display: flex; justify-content: space-between; margin-top: 10px; color: var(--bark-300); }
.track-nodes span.is-on { color: var(--accent); }

#tags { position: fixed; inset: 0; z-index: 3; pointer-events: none; opacity: 0; }
.dev-tag {
  position: absolute; left: 0; top: 0; display: flex; align-items: center; gap: 8px;
  font: 500 10px/1 var(--mono); letter-spacing: .06em; text-transform: uppercase; color: var(--sand-100);
  padding: 7px 11px 7px 9px; border-radius: 8px; background: rgba(var(--ink-rgb),.72);
  box-shadow: inset 0 0 0 1px var(--line-dark); white-space: nowrap; will-change: transform;
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); transition: background .4s, color .4s;
}
.dev-tag i { width: 6px; height: 6px; border-radius: 50%; background: var(--bark-500); transition: background .4s; }
.dev-tag.is-on { background: var(--accent); color: var(--bark-900); box-shadow: none; }
.dev-tag.is-on i { background: var(--forest-700); }

/* ---------- 04 Products */
.products { position: relative; height: 100vh; }
.prod-top { position: absolute; top: 13vh; left: var(--gut); right: var(--gut); display: flex; justify-content: space-between; }
.prod-count { color: var(--bark-500); }
.prod-count span { color: var(--forest-700); }
.prod-panels { position: absolute; left: var(--gut); top: 21vh; width: min(40vw, 600px); }
.prod-panel { position: absolute; top: 0; left: 0; width: 100%; }
.mask { display: block; overflow: hidden; }
.mask .ln { display: block; }
.prod-panel .cat { color: var(--forest-700); }
.prod-name { font-family: var(--serif); font-size: clamp(2.4rem, 5.2vw, 5.8rem); line-height: 1; letter-spacing: -.055em; font-weight: 400; margin: 12px 0 20px; }
.prod-name .mask { padding-bottom: .1em; }
.prod-desc { color: var(--bark-700); font-size: 16px; line-height: 1.45; max-width: 46ch; }
.specs { display: grid; grid-template-columns: 1fr 1fr; gap: 0 24px; margin: 28px 0 22px; }
.specs div { padding: 12px 0; }
.specs dt { font-family: var(--serif); font-size: clamp(1.3rem, 1.9vw, 1.8rem); letter-spacing: -.035em; font-weight: 400; }
.specs dd { color: var(--bark-500); margin-top: 2px; }
.link { color: var(--bark-900); border-bottom: 1px solid var(--bark-300); padding-bottom: 4px; display: inline-block !important; }
.link:hover { color: var(--forest-700); border-color: var(--forest-700); }
.prod-note { position: absolute; right: var(--gut); bottom: 84px; width: 300px; text-align: right; color: var(--bark-500); text-transform: none; letter-spacing: 0; }
.prod-progress { position: absolute; left: var(--gut); right: var(--gut); bottom: 34px; height: 2px; border-radius: 2px; background: var(--bark-200); }
.prod-progress i { position: absolute; inset: 0; background: var(--forest-700); transform-origin: left; transform: scaleX(0); border-radius: 2px; }

/* ---------- Light editorial sections */
.light { background: var(--sand-50); color: var(--bark-900); position: relative; }

/* 05 Company */
.company { padding: 0 0 16vh; border-radius: 24px 24px 0 0; }
.company-grid { display: grid; grid-template-columns: repeat(12, 1fr); gap: 0 24px; padding-top: 12vh; }
.company-grid .label { grid-column: 1 / -1; margin-bottom: 26px; }
.company-grid .h2 { grid-column: 1 / 9; }
.company-copy { grid-column: 8 / 13; margin-top: 8vh; display: grid; gap: 16px; color: var(--bark-800); }
.stats4 { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-top: 12vh; }
.stats4 div { background: var(--cream); border-radius: 16px; padding: 26px 24px 22px; min-height: 200px; display: flex; flex-direction: column; justify-content: space-between; box-shadow: inset 0 0 0 1px var(--line); }
.stats4 div:nth-child(3) { background: var(--accent); box-shadow: none; }
.stats4 dt { font-family: var(--serif); font-size: clamp(2.2rem, 3.8vw, 3.8rem); letter-spacing: -.05em; font-weight: 400; line-height: 1; }
.stats4 dd { color: var(--bark-600); }

/* 06 Service */
.service { padding: 6vh 0 18vh; }
.service-head { display: grid; gap: 26px; margin-bottom: 8vh; }
.svc-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.svc-card {
  background: var(--cream); border-radius: 16px; padding: 24px 24px 22px; min-height: 240px;
  display: flex; flex-direction: column; gap: 14px; box-shadow: inset 0 0 0 1px var(--line);
}
.svc-idx { color: var(--bark-500); }
.svc-big { margin-top: auto; font-family: var(--serif); font-variant-numeric: lining-nums; font-size: clamp(2.2rem, 3.6vw, 3.6rem); line-height: 1; letter-spacing: -.045em; font-weight: 400; display: flex; align-items: baseline; gap: .2em; }
.svc-big small { font-family: var(--sans); font-size: .32em; letter-spacing: -.01em; font-weight: 500; color: var(--bark-700); }
.svc-card p { color: var(--bark-700); font-size: 15px; line-height: 1.4; }

/* 07 Contact + footer */
.contact { background: var(--deep); color: var(--sand-50); padding: 16vh 0 0; position: relative; overflow: hidden; }
.contact .label { color: var(--bark-300); }
.contact .label span:first-child { background: var(--bark-800); color: var(--sand-100); }
.contact-title { font-family: var(--serif); font-size: var(--h-section); line-height: 1.06; letter-spacing: -.04em; font-weight: 400; margin: 24px 0 7vh; max-width: 20ch; }
.contact-grid { display: grid; grid-template-columns: 5fr 7fr; gap: 6vw; margin-bottom: 8vh; }
.contact-grid .lead { color: var(--bark-200); }
.crow { display: grid; grid-template-columns: 110px 1fr auto; gap: 20px; align-items: baseline; padding: 20px 0; border-top: 1px solid var(--line-dark); }
.crow:last-child { border-bottom: 1px solid var(--line-dark); }
.crow > .mono { color: var(--bark-300); }
.crow a, .crow address { font-size: clamp(1.1rem, 1.7vw, 1.6rem); letter-spacing: -.02em; line-height: 1.3; }
.crow address { font-size: 17px; color: var(--bark-200); }
.crow a:hover { color: var(--accent); }
.copy { color: var(--bark-300); padding: 8px 12px; border-radius: 8px; box-shadow: inset 0 0 0 1px var(--line-dark); transition: color .3s, box-shadow .3s, background .3s; }
.copy:hover, .copy.is-done { color: var(--bark-900); background: var(--accent); box-shadow: none; }
.footer { margin-top: 14vh; padding: 0 var(--gut) 28px; }
.foot-row { display: flex; justify-content: space-between; gap: 20px; flex-wrap: wrap; padding-top: 24px; border-top: 1px solid var(--line-dark); color: var(--bark-300); }
.foot-row nav { display: flex; gap: 20px; margin-left: auto; }
.foot-row a:hover { color: var(--accent); }

/* ---------- Responsive */
@media (max-width: 1024px) {
  .svc-grid { grid-template-columns: 1fr 1fr; }
  /* tablets: the pill stays in the header row, just tighter */
  .nav { gap: 12px; }
  .nav-links { font-size: 14px; gap: 2px; }
  .nav-links a { padding: 6px 9px; }
  .callouts { grid-template-columns: 1fr; gap: 10px; margin-top: 4vh; }
  .inside-stats { padding-right: 0; bottom: 88px; }
}

@media (max-width: 767px) {
  :root { --gut: 16px; }
  /* solid header bar on phones, so scrolling content never runs under the logo */
  .nav {
    padding-top: 12px; padding-bottom: 12px; min-height: 64px;
    background: rgba(252, 250, 248, .9);
    backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
    transition: color .4s, background .4s;
  }
  body[data-theme="dark"] .nav { background: rgba(var(--ink-rgb), .88); }
  .nav-cta { top: 12px; }
  /* phones: the section links drop to a second row under the logo, spanning the full bar (under the Contact button too) */
  .nav { flex-wrap: wrap; row-gap: 29px; }
  /* divider between the logo row and the links row, full bleed */
  .nav::after { content: ""; position: absolute; left: 0; right: 0; top: 64px; height: 1px; background: var(--line); transition: background .4s; }
  body[data-theme="dark"] .nav::after { background: var(--line-dark); }
  .nav-links {
    order: 3; flex: 0 0 calc(100% + 120px); margin-right: -120px;
    justify-content: space-between; gap: 0; padding: 3px;
    overflow-x: auto; scrollbar-width: none;
    background: var(--sand-100); box-shadow: none;
  }
  .nav-links::-webkit-scrollbar { display: none; }
  .nav-links a { flex: 1 0 auto; text-align: center; white-space: nowrap; padding: 7px 5px; font-size: 14px; }
  body[data-theme="dark"] .nav-links { background: rgba(252, 250, 248, .1); color: var(--sand-50); }
  body[data-theme="dark"] .nav-links a[aria-current] { background: var(--sand-50); color: var(--bark-900); }
  .hero-title { font-size: 14vw; }
  .hero-word { margin-top: 0; }
  /* --hero-dy (set in main.js) lowers the whole group so it's centred between the header and the buttons */
  .hero-word--l { top: auto; bottom: calc(50% + var(--card-h) / 2 + 8px - var(--hero-dy, 0px)); }
  .hero-word--r { top: calc(50% + var(--card-h) / 2 + 4px + var(--hero-dy, 0px)); }
  .hero-kicker { top: auto; bottom: calc(50% + var(--card-h) / 2 + 8px - var(--hero-dy, 0px) + var(--word-h, 15vw) + 14px); left: var(--gut); transform: none; }
  /* hero shares the 3D stage's large viewport so the card and its words line up; buttons stay above Safari's toolbar */
  .hero { height: 100vh; height: 100lvh; }
  .hero-foot { grid-template-columns: 1fr; bottom: 24px; bottom: calc(24px + 100lvh - 100svh); gap: 14px; }
  .hero-sub, .scroll-hint { display: none; }

  .products::before { background: linear-gradient(0deg, rgba(239,230,221,.95) 0%, rgba(239,230,221,.7) 45%, rgba(239,230,221,0) 70%); }
  .inside::before { background: linear-gradient(180deg, rgba(239,230,221,.92) 0%, rgba(239,230,221,0) 55%, rgba(239,230,221,.92) 100%); }
  .path::before { background: linear-gradient(0deg, rgba(var(--scrim-rgb),.9) 0%, rgba(var(--scrim-rgb),.6) 45%, rgba(var(--scrim-rgb),0) 70%); }

  .inside-copy { top: calc(11vh + 71px); width: auto; right: var(--gut); }
  .statement { font-size: 1.2rem; }
  .callouts { display: none; }
  /* bottom gap clears Safari's toolbar when it's showing (lvh − svh), plus breathing room */
  .inside-stats { grid-template-columns: 1fr 1fr; bottom: 48px; bottom: calc(48px + 100lvh - 100svh); text-align: center; row-gap: 6px; }
  .inside-stats div { padding: 12px 6px 0; }
  .inside-stats dt { font-size: 1.05rem; white-space: nowrap; }

  .path-head { top: calc(11vh + 71px); }
  .steps { top: auto; bottom: 90px; width: auto; right: var(--gut); }
  .step { display: none; border: 0; }
  .step.is-on { display: grid; }
  .track { right: var(--gut); bottom: 70px; }
  .track-nodes { font-size: 8px; }

  .prod-top { top: calc(11vh + 71px); }
  .prod-panels { top: auto; bottom: 100px; width: auto; right: var(--gut); height: 46vh; }
  .prod-panel { top: auto; bottom: 0; }
  .prod-panels { bottom: 90px; }
  .prod-name { font-size: 2.3rem; margin: 6px 0 10px; }
  .prod-desc { font-size: 14px; }
  /* keep every product's text block the same short height so it never climbs into the model */
  .prod-desc .ln { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
  .specs dt { font-size: 1.15rem; }
  .specs { margin: 14px 0 10px; }
  .specs div { padding: 8px 0; }
  .prod-note { display: none; }
  .prod-progress { right: var(--gut); bottom: 76px; }

  .company-grid { display: block; }
  .company-copy { margin-top: 5vh; }
  .stats4 { grid-template-columns: 1fr 1fr; margin-top: 6vh; }
  .stats4 div { min-height: 150px; padding: 18px; }
  .svc-grid { grid-template-columns: 1fr 1fr; }
  .svc-card { padding: 18px; min-height: 0; }
  .svc-card:last-child { grid-column: 1 / -1; }
  .svc-big { margin-top: 18px; }
  .contact-grid { grid-template-columns: 1fr; }
  .crow { grid-template-columns: 1fr; gap: 8px; }
  .copy { justify-self: start; }
}

@media (prefers-reduced-motion: reduce) {
  .scroll-hint i { animation: none; }
}

/* Touch devices: backdrop blur over a live WebGL canvas flickers in WebKit, so use solid fills instead */
@media (pointer: coarse), (max-width: 767px) {
  .nav, .nav-links, .dev-tag { -webkit-backdrop-filter: none; backdrop-filter: none; }
  .nav { background: rgba(252, 250, 248, .97); }
  body[data-theme="dark"] .nav { background: rgba(var(--ink-rgb), .97); }
  .dev-tag { background: rgba(var(--ink-rgb), .92); }
}

/* Phones: the logo row keeps a solid bar (down to the divider); below it, the links row is see-through,
   so it shows whatever is behind it. The links pill switches fill per section so it still stands out.
   Placed last so it beats the touch fallbacks above. */
@media (max-width: 767px) {
  body .nav, body[data-theme] .nav { background: transparent; }
  .nav::before { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 64px; z-index: -1; background: rgba(252, 250, 248, .97); transition: background .4s; }
  body[data-theme="dark"] .nav::before { background: rgba(var(--ink-rgb), .97); }
  body:is([data-section="inside"], [data-section="products"], [data-section="hero"][data-card-wide]) .nav-links { background: rgba(252, 250, 248, .85); }
  body:is([data-section="company"], [data-section="service"]) .nav-links { background: var(--sand-200); }
  .nav-links { transition: background .4s; }
}
