/* KRYSENTIS landing — styles.css (v2 — light in crystal)
   Tokens come from tokens.css (loaded first). A bright turquoise field painted
   once on <body>; the 3D canvas and the parallax stacks only add light. Copy
   sits either bare on the field (ink / ink-soft, both ≥ 4.5:1 on every stop)
   or inside white glass panels (ink / ink-muted). One violet: the h1 word. */

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

html {
  scroll-behavior: smooth;
  scroll-padding-top: 96px;
  -webkit-text-size-adjust: 100%;
  background: var(--field-1);               /* overscroll colour */
}

body {
  margin: 0;
  min-height: 100vh;
  /* the field (tokens.css --grad-field): lightest at the very top, vivid
     turquoise by the hero's lower half, deepest mid-page, lifting again toward
     contact — light entering and leaving the crystal. */
  background: var(--grad-field);
  color: var(--ink);
  font: 400 var(--fs-base) / var(--lh-normal) var(--font-body);
  font-feature-settings: "ss01", "cv11";
  overflow-x: clip;
  -webkit-font-smoothing: antialiased;
}

::selection { background: var(--selection-bg); color: var(--ink); }

img { max-width: 100%; height: auto; display: block; }
sub { font-size: 0.72em; line-height: 0; vertical-align: -0.2em; }
ul, ol { list-style: none; margin: 0; padding: 0; }
p { margin: 0; }
a { color: inherit; text-decoration: none; }

h1, h2, h3 {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 600;
  letter-spacing: var(--ls-display);
  text-wrap: balance;
  color: var(--ink);
}
h2 { font-size: clamp(2rem, 1.4rem + 2.4vw, 3rem); line-height: 1.08; max-width: 22ch; }
h3 { font-size: var(--fs-lg); line-height: 1.25; }

:focus-visible { outline: none; box-shadow: var(--focus-ring); border-radius: var(--r-sm); }

.visually-hidden {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap;
}

.skip {
  position: fixed; top: 12px; left: 12px; z-index: var(--z-overlay);
  padding: 10px 14px; background: var(--glass-strong); color: var(--ink);
  border: 1px solid var(--line-strong); border-radius: var(--r-md);
  transform: translateY(-200%);
}
.skip:focus-visible { transform: none; }

.wrap {
  width: min(100% - 2 * var(--gutter), var(--content-max));
  margin-inline: auto;
}
@media (min-width: 768px) {
  .wrap { width: min(100% - 2 * var(--gutter-desktop), var(--content-max)); }
}

.mono {
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  letter-spacing: var(--ls-eyebrow);
  text-transform: uppercase;
}
/* Small caps on the bare field use ink-soft (4.68:1 on field-3); inside glass
   the labels take the deep-turquoise accent. */
.eyebrow, .label {
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  font-weight: 500;
  letter-spacing: var(--ls-eyebrow);
  text-transform: uppercase;
  color: var(--ink-soft);
}
.label { margin-bottom: var(--sp-3); }
.panel .label, .card .label { color: var(--accent); }

/* the one violet: crystal core -> deep turquoise, on the h1 word only */
.grad {
  font-style: normal;
  background: var(--grad-word);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.lede {
  margin-top: var(--sp-5);
  max-width: var(--prose-max);
  font-size: var(--fs-md);
  color: var(--ink-soft);
}

/* ---------- background canvas + CSS fallback ---------- */
#bg {
  position: fixed; inset: 0; z-index: var(--z-bg3d);
  width: 100%; height: 100%; display: block;
  pointer-events: none;
}
body.no-webgl #bg { display: none; }
/* Without WebGL the crystal is a still of light: one white bloom where the
   cluster would hang and a fainter one low on the left. No violet here — at
   fallback size the core would read as a smudge, not a crystal. */
body.no-webgl::before {
  content: ""; position: fixed; inset: 0; z-index: var(--z-bg3d); pointer-events: none;
  background:
    radial-gradient(9% 30% at 66% 38%, rgba(255, 255, 255, 0.92), transparent 70%),
    radial-gradient(7% 18% at 72% 46%, rgba(255, 255, 255, 0.80), transparent 70%),
    radial-gradient(30% 44% at 67% 42%, rgba(255, 255, 255, 0.34), transparent 72%),
    radial-gradient(36% 30% at 18% 86%, rgba(255, 255, 255, 0.26), transparent 70%);
}
main, .footer { position: relative; z-index: var(--z-content); }

/* ---------- glass ---------- */
.panel, .card {
  background: var(--glass);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-glass);
  -webkit-backdrop-filter: blur(var(--glass-blur));
  backdrop-filter: blur(var(--glass-blur));
}
.panel {
  padding: clamp(20px, 2.2vw + 8px, 40px);
  border-radius: var(--r-xl);
}
@media (max-width: 640px) {
  :root { --glass-blur: 12px; }
}

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 48px; padding: 0 var(--sp-5);
  border-radius: var(--r-pill);
  font: 500 var(--fs-sm) / 1 var(--font-body);
  letter-spacing: 0.01em;
  white-space: nowrap;
  transition: transform var(--d-fast) var(--ease-standard),
              border-color var(--d-fast) var(--ease-standard),
              background-color var(--d-fast) var(--ease-standard);
}
.btn--primary {
  color: var(--ink-inverse);
  background: var(--ink);
  border: 1px solid var(--ink);
  font-weight: 600;
}
.btn--primary:hover { background: var(--accent); border-color: var(--accent); }
.btn--ghost {
  color: var(--ink);
  border: 1px solid var(--line-strong);
  background: var(--glass);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
}
.btn--ghost:hover { border-color: var(--ink); background: var(--glass-strong); }
.btn:hover { transform: translateY(-2px); }
.btn:active { transform: none; }
.btn--sm { min-height: 40px; padding-inline: var(--sp-4); }

/* ---------- nav ---------- */
.nav {
  position: fixed; inset: 0 0 auto 0; z-index: var(--z-nav);
  transition: background-color var(--d-base) var(--ease-standard),
              border-color var(--d-base) var(--ease-standard);
  border-bottom: 1px solid transparent;
}
.nav.is-scrolled, .nav.is-open {
  background: var(--glass-strong);
  -webkit-backdrop-filter: blur(16px);
  backdrop-filter: blur(16px);
  border-bottom-color: var(--line);
}
.nav__in {
  display: flex; align-items: center; justify-content: space-between;
  min-height: 72px;
}
.nav__brand {
  display: inline-flex; align-items: center; gap: var(--sp-3);
  font-family: var(--font-display); font-weight: 600; letter-spacing: 0.12em;
  font-size: var(--fs-sm);
  color: var(--ink);
}
/* The mark is a white glyph: on the light field it sits on an ink disc. */
.nav__brand img { width: 32px; height: 32px; padding: 4px; border-radius: 50%; background: var(--ink); }
.nav__menu { display: flex; align-items: center; gap: var(--sp-6); }
.nav__menu > a:not(.btn) {
  position: relative;
  color: var(--ink-soft);
  font-size: var(--fs-sm); font-weight: 500;
  padding: var(--sp-2) 0;
  transition: color var(--d-fast) var(--ease-standard);
}
.nav__menu > a:not(.btn):hover,
.nav__menu > a[aria-current="true"] { color: var(--ink); }
.nav__menu > a:not(.btn)[aria-current="true"]::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: 0;
  height: 1px; background: var(--ink);
}
.nav__toggle {
  display: none;
  min-height: 40px; padding: 0 var(--sp-4);
  background: var(--glass); border: 1px solid var(--line-strong); border-radius: var(--r-pill);
  color: var(--ink); font: 500 var(--fs-sm) / 1 var(--font-body); cursor: pointer;
}
@media (max-width: 899px) {
  .nav__toggle { display: inline-flex; align-items: center; }
  /* Open state: a full-height sheet under the bar; the page beneath is dimmed
     and scroll-locked (body.nav-open, set by app.js) so nothing competes. */
  .nav__menu {
    display: none;
    /* absolute, not fixed: the bar's backdrop-filter makes it the containing block */
    position: absolute; left: 0; right: 0; top: 100%;
    height: calc(100vh - 72px); height: calc(100dvh - 72px);
    flex-direction: column; align-items: stretch; gap: 0;
    padding: var(--sp-4) var(--gutter) var(--sp-7);
    background: var(--field-0);
    overflow-y: auto;
  }
  .nav.is-open .nav__menu { display: flex; }
  .nav__menu > a:not(.btn) {
    padding: var(--sp-5) 0;
    border-bottom: 1px solid var(--line);
    font-family: var(--font-display); font-size: var(--fs-lg); font-weight: 500;
  }
  .nav__menu > a:not(.btn)[aria-current="true"]::after { display: none; }
  .nav__menu > .btn { margin-top: auto; align-self: flex-start; min-height: 48px; }
  body.nav-open { overflow: hidden; }
  body.nav-open main, body.nav-open .footer { opacity: 0.25; }
}

/* ---------- hero ---------- */
.hero {
  position: relative;
  min-height: min(100svh, 960px);
  display: flex; align-items: center;
  padding: 128px 0 clamp(72px, 10vw, 128px);
}
.hero__copy { max-width: 680px; }
/* Landscape viewports keep the cluster to the right of the copy (app.js scales
   heroOffsetX with the aspect ratio); between 768 and ~1300px the copy is capped
   so the two never meet. */
@media (min-width: 768px) and (orientation: landscape) {
  .hero__copy { max-width: min(680px, 58%); }
}
.hero h1 {
  margin-top: var(--sp-4);
  font-size: clamp(2.25rem, 1.5rem + 3.6vw, 4rem);
  line-height: var(--lh-tight);
  font-weight: 600;
}
.hero__line { display: block; }
.hero__sub {
  margin-top: var(--sp-5);
  max-width: 54ch;
  font-size: var(--fs-md);
  color: var(--ink-muted);                 /* hero field: >= 5.6:1 where the subhead sits (field-1 -> field-2) */
}
.hero__cta { display: flex; flex-wrap: wrap; gap: var(--sp-3); margin-top: var(--sp-6); }

/* Phones and portrait tablets: the copy takes the full column and the gap under
   the buttons is the crystal's place (heroScale / heroOffsetY in app.js; the
   same media query decides the framing there). */
@media (max-width: 767px), (max-width: 1023px) and (orientation: portrait) {
  .hero { align-items: flex-start; min-height: 0; padding: 96px 0 42vh; }
  .hero__cta { margin-top: var(--sp-5); }
  .hero__sub { font-size: var(--fs-base); }
  .hero__cta .btn { flex: 1 1 auto; }
  /* Without WebGL there is nothing to make room for: close the gap and put the
     still of light where the hero copy sits. */
  body.no-webgl .hero { padding-bottom: clamp(72px, 10vw, 128px); }
  body.no-webgl::before {
    background:
      radial-gradient(14% 7% at 50% 30%, var(--crystal-core-soft), transparent 70%),
      radial-gradient(60% 26% at 50% 28%, rgba(255, 255, 255, 0.66), transparent 70%),
      radial-gradient(90% 44% at 50% 30%, rgba(255, 255, 255, 0.30), transparent 72%);
  }
}

/* ---------- sections ---------- */
/* Sections stay transparent: the field is on <body>, the parallax stack
   (parallax.css) sits at z-index -1 inside each section, the glass panels
   below are the scrim where copy meets the vivid field. */
.section { padding-block: clamp(64px, 7vw, 112px); }
.section__head { margin-bottom: clamp(40px, 5vw, 72px); }
.section__head .eyebrow { margin-bottom: var(--sp-4); }

/* chain: horizontal timeline on desktop, vertical rail on mobile */
.chain { display: grid; grid-template-columns: repeat(6, 1fr); }
.chain li {
  position: relative;
  padding: var(--sp-6) var(--sp-5) 0 0;
  border-top: 1px solid var(--line-strong);
}
.chain li::before {
  content: ""; position: absolute; left: 0; top: -4px;
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 3px var(--crystal);
}
.chain__n { display: block; color: var(--accent); margin-bottom: var(--sp-3); }
.chain h3 { font-size: var(--fs-md); margin-bottom: var(--sp-3); }
.chain p { font-size: var(--fs-sm); color: var(--ink-muted); }
@media (max-width: 1099px) { .chain { grid-template-columns: repeat(3, 1fr); } .chain li { margin-bottom: var(--sp-7); } }
@media (max-width: 639px) {
  .chain { grid-template-columns: 1fr; }
  .chain li {
    margin: 0; padding: 0 0 var(--sp-7) var(--sp-5);
    border-top: 0; border-left: 1px solid var(--line-strong);
  }
  .chain li:last-child { padding-bottom: 0; }
  .chain li::before { left: -4px; top: 2px; }
}

/* products: glass cards */
.cards {
  display: grid; gap: var(--sp-4);
  grid-template-columns: repeat(4, 1fr);
}
.card {
  padding: var(--sp-6) var(--sp-5);
  border-radius: var(--r-lg);
}
/* Cards are not links: no hover lift (that gesture belongs to .btn only). */
.card h3 { font-size: var(--fs-md); }
.card__tag { margin: var(--sp-3) 0 var(--sp-5); color: var(--accent); text-transform: none; letter-spacing: 0.06em; }
.card p:not(.card__tag) { font-size: var(--fs-sm); color: var(--ink-muted); }
@media (max-width: 1023px) { .cards { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 539px) { .cards { grid-template-columns: 1fr; } }

/* facility: facts row */
.facts {
  display: grid; gap: var(--sp-6) var(--sp-5);
  grid-template-columns: repeat(4, 1fr);
}
.facts li { padding-left: var(--sp-5); border-left: 1px solid var(--line-strong); }
.fact__v {
  display: block;
  font-family: var(--font-display); font-weight: 600;
  font-size: clamp(1.75rem, 1.25rem + 1.6vw, 2.5rem); line-height: 1; /* one step below the h2 */
  letter-spacing: var(--ls-display);
  color: var(--ink);
}
.fact__l { display: block; margin-top: var(--sp-3); font-size: var(--fs-sm); color: var(--ink-muted); max-width: 22ch; }
@media (max-width: 639px) { .facts { grid-template-columns: repeat(2, 1fr); } }

/* traceability: copy left, points right */
.split { display: grid; gap: var(--sp-8); grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); align-items: start; }
.split .section__head { margin-bottom: 0; }
.points li {
  padding: var(--sp-5) 0;
  border-top: 1px solid var(--line);
  color: var(--ink-muted);
}
.points li:first-child { border-top: 0; padding-top: 0; }
.points li:last-child { padding-bottom: 0; }
@media (max-width: 899px) { .split { grid-template-columns: 1fr; gap: var(--sp-7); } }

/* standards: 2 x 2 */
.standards {
  display: grid; gap: var(--sp-7) var(--sp-8);
  grid-template-columns: repeat(2, 1fr);
}
.standards li { padding-top: var(--sp-5); border-top: 1px solid var(--line-strong); }
.standards h3 { margin-bottom: var(--sp-3); }
.standards p { color: var(--ink-muted); }
@media (max-width: 767px) { .standards { grid-template-columns: 1fr; gap: var(--sp-6); } }

/* roadmap: a schedule, one row per phase */
.roadmap li {
  display: grid; gap: var(--sp-3) var(--sp-7);
  grid-template-columns: minmax(120px, 160px) minmax(0, 5fr) minmax(0, 8fr);
  padding: var(--sp-6) 0;
  border-top: 1px solid var(--line);
}
.roadmap li:first-child { border-top: 0; padding-top: 0; }
.roadmap li:last-child { padding-bottom: 0; }
.roadmap .label { margin: 0; padding-top: 6px; }
.roadmap p:not(.label) { color: var(--ink-muted); }
@media (max-width: 767px) {
  .roadmap li { grid-template-columns: 1fr; gap: var(--sp-2); }
  .roadmap .label { padding: 0; margin-bottom: var(--sp-1); }
}

/* team */
.team {
  display: grid; gap: var(--sp-6);
  grid-template-columns: repeat(4, 1fr);
}
.team li { padding-top: var(--sp-5); border-top: 1px solid var(--line-strong); }
.team h3 { font-size: var(--fs-md); margin-bottom: var(--sp-2); }
.team p:not(.label) { font-size: var(--fs-sm); color: var(--ink-muted); }
@media (max-width: 1023px) { .team { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 539px) { .team { grid-template-columns: 1fr; } }

/* contact */
.section--contact { padding-bottom: clamp(96px, 12vw, 192px); }
/* phones: the cluster fades out at the end of the scroll (bg3d exitFade); the
   extra room keeps its last trace clear of the footer rule. */
@media (max-width: 767px) { .section--contact { padding-bottom: calc(clamp(96px, 12vw, 192px) + 48px); } }
.contact { text-align: center; }
.contact .section__head { display: flex; flex-direction: column; align-items: center; }
.contact h2 { max-width: 18ch; }
.contact .lede { max-width: 56ch; }
.contact__actions { display: flex; flex-direction: column; align-items: center; gap: var(--sp-5); }
.contact__mail { color: var(--ink-soft); text-transform: none; letter-spacing: 0.04em; font-size: var(--fs-sm); }
.contact__mail:hover { color: var(--ink); }

/* footer */
.footer { border-top: 1px solid var(--line); }
.footer__in {
  display: flex; flex-wrap: wrap; justify-content: space-between; gap: var(--sp-3) var(--sp-6);
  padding: var(--sp-6) 0;
  font-size: var(--fs-sm); color: var(--ink-soft);
}
.footer__tag { font-family: var(--font-display); color: var(--ink); }

/* ---------- reveal on scroll ---------- */
.js [data-reveal] {
  opacity: 0;
  transform: translateY(16px);
  transition: opacity 600ms var(--ease-enter), transform 600ms var(--ease-enter);
  transition-delay: calc(var(--i, 0) * 70ms);
}
.js [data-reveal].in-view { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .js [data-reveal] { opacity: 1; transform: none; transition: none; }
  .btn, .nav { transition: none; }
  .btn:hover { transform: none; }
}
