/* Biolinq SHINE showcase — Visualistics
   Brand: Grain (the wordmark's typeface), white on black, and the
   black → indigo → clay-orange gradient from visualistics.io. */

@font-face {
  font-family: "Grain";
  src: url("fonts/Grain-Light.woff2") format("woff2");
  font-weight: 300; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "Grain";
  src: url("fonts/Grain-Regular.woff2") format("woff2");
  font-weight: 400; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "Grain";
  src: url("fonts/Grain-SemiBold.woff2") format("woff2");
  font-weight: 600; font-style: normal; font-display: swap;
}

:root {
  --font: "Grain", "Helvetica Neue", Helvetica, Arial, sans-serif;
  --black: #000;
  --white: #fff;
  --cream: #fbf3ec;
  --muted: rgba(255, 255, 255, 0.5);
  --faint: rgba(255, 255, 255, 0.14);

  /* visualistics.io gradient stops */
  --indigo-deep: #12103f;
  --indigo: #33309b;
  --violet: #4a44b8;
  --mauve: #8a5f88;
  --rose: #ab6a70;
  --clay: #e07a4d;
  --orange: #ef7a52;

  --edge: clamp(20px, 2.5vw, 48px);
  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
}

* { box-sizing: border-box; }

html { background: var(--black); }

body {
  margin: 0;
  background: var(--black);
  color: var(--white);
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

/* ── Brand bar ─────────────────────────────────────────────────── */
.bar {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: calc(var(--edge) + env(safe-area-inset-top, 0px)) var(--edge) 0;
  pointer-events: none;
  animation: fade 1.2s var(--ease) 0.2s both;
}
/* JS sets --logo-x: the offset that centres the logo on the title slide, easing to 0. */
.bar__mark {
  pointer-events: auto; display: block; line-height: 0;
  transform: translateX(var(--logo-x, 0px));
  will-change: transform;
}
.bar__mark img { width: clamp(104px, 9vw, 150px); height: auto; }

/* Client mark (Biolinq), a touch quieter than our own logo so it sits back. */
.bar__client {
  display: block;
  line-height: 0;
  opacity: calc(var(--dock-in, 0) * 0.85);
}
.bar__client img { width: clamp(63px, 5.35vw, 91px); height: auto; }
.shine {
  background: linear-gradient(100deg, var(--cream) 0%, #f3b89c 55%, var(--orange) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

/* ── Chapters: tall track + sticky stage ───────────────────────── */
.chapter {
  position: relative;
  /* --len is the track length in vh; longer = slower scene. */
  height: calc(var(--len) * 1vh);
}
.stage {
  position: sticky;
  top: 0;
  height: 100vh;
  height: 100svh;
  overflow: hidden;
  display: grid;
  place-items: center;
  --p: 0;
  --pan-dist: 64vh;   /* how far the camera tilts: phone starts just below the frame */
}

/* ── Rising brand glow ─────────────────────────────────────────── */
.glow {
  position: absolute;
  left: 50%;
  bottom: 0;
  width: max(160vw, 1400px);
  aspect-ratio: 2 / 1;
  border-radius: 50%;
  transform:
    translate(-50%, calc(62% - var(--glow, 0) * 22%))
    scale(calc(0.85 + var(--glow, 0) * 0.25));
  background: radial-gradient(
    closest-side,
    var(--orange) 0%,
    var(--clay) 14%,
    var(--rose) 26%,
    var(--mauve) 36%,
    var(--violet) 48%,
    var(--indigo) 60%,
    var(--indigo-deep) 76%,
    transparent 100%
  );
  opacity: calc(0.28 + var(--glow, 0) * 0.5);
  filter: blur(40px);
  pointer-events: none;
  will-change: transform, opacity;
  animation: glow-in 2.4s var(--ease) 0.1s both;
}

/* ── Intro copy ────────────────────────────────────────────────── */
.intro {
  position: relative;
  z-index: 2;
  width: min(100% - 2 * var(--edge), 1180px);
  text-align: center;
  /* Scroll-out: drifts up a little, softens out of focus and lingers as it fades. */
  transform: translateY(calc(var(--out, 0) * -14vh)) scale(calc(1 - var(--out, 0) * 0.06));
  opacity: calc(1 - var(--out, 0));
  filter: blur(calc(var(--out, 0) * 12px));
  will-change: transform, opacity, filter;
}

.eyebrow {
  margin: 0 0 clamp(20px, 2.4vw, 36px);
  font-size: clamp(11px, 0.9vw, 13px);
  font-weight: 400;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--muted);
  animation: rise 1.4s var(--ease) 0.35s both;
}
.eyebrow .dot { margin: 0 0.5em; opacity: 0.6; }

.title {
  margin: 0 auto;
  max-width: 13ch;
  font-weight: 600;
  font-size: clamp(40px, 7vw, 124px);
  line-height: 1;
  letter-spacing: -0.025em;
  text-wrap: balance;
}
.title .w {
  display: inline-block;
  animation: word 1.5s var(--ease) both;
  animation-delay: calc(0.45s + var(--i, 0) * 0.07s);
}
.title .nowrap { white-space: nowrap; }

/* "Biolinq SHINE" carries the light the glow will throw. */
.title .w:last-child {
  background: linear-gradient(100deg, var(--white) 0%, var(--cream) 40%, #f3b89c 75%, var(--orange) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.byline {
  margin: clamp(22px, 2.6vw, 40px) 0 0;
  font-size: clamp(14px, 1.15vw, 18px);
  font-weight: 400;
  color: var(--muted);
  animation: rise 1.4s var(--ease) 1.1s both;
}

/* ── Device: the rendered sequence ─────────────────────────────── */
.device {
  position: absolute;
  inset: 0;
  z-index: 1;
  opacity: var(--dev, 0);
  /* Enters from below the frame on the shared pan (starts fully out of view). */
  transform: translateY(calc((1 - var(--pan, 0)) * var(--pan-dist)));
  will-change: transform, opacity;
  pointer-events: none;
}
.device__canvas { display: block; width: 100%; height: 100%; }

/* Fallback only (no sequence yet): the flat screen, centred. */
.device__fallback {
  display: none;
  position: absolute;
  top: 50%; left: 50%;
  width: min(30vh, 62vw); height: auto;
  transform: translate(-50%, -50%);
  border-radius: 13% / 6%;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.08), 0 40px 120px rgba(74, 68, 184, 0.35);
}
.device.is-fallback .device__canvas { display: none; }
.device.is-fallback .device__fallback { display: block; }

/* ── Scroll cue ────────────────────────────────────────────────── */
.cue {
  position: absolute;
  z-index: 3;
  left: 50%;
  bottom: calc(clamp(28px, 4.5vh, 56px) + env(safe-area-inset-bottom, 0px));
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  opacity: calc(1 - var(--cue, 0));
  /* backwards, not both: a held end-state would override the scroll fade. */
  animation: fade 1.4s var(--ease) 1.6s backwards;
}
.cue__text {
  font-size: 11px;
  font-weight: 400;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.72);
  white-space: nowrap;
}
.cue__track {
  position: relative;
  width: 1px;
  height: clamp(40px, 6vh, 64px);
  background: var(--faint);
  overflow: hidden;
}
.cue__dot {
  position: absolute;
  left: 0;
  top: -40%;
  width: 1px;
  height: 40%;
  background: linear-gradient(to bottom, transparent, var(--white));
  animation: travel 2.2s cubic-bezier(0.65, 0, 0.35, 1) 2.2s infinite;
}

/* ── Motion ────────────────────────────────────────────────────── */
@keyframes rise {
  from { opacity: 0; transform: translateY(18px); }
  to   { opacity: 1; transform: none; }
}
@keyframes word {
  from { opacity: 0; transform: translateY(0.35em); filter: blur(8px); }
  to   { opacity: 1; transform: none; filter: blur(0); }
}
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes glow-in { from { opacity: 0; } }
@keyframes travel {
  0%   { top: -40%; }
  70%  { top: 100%; }
  100% { top: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  .intro { filter: none; }
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-delay: 0s !important; animation-iteration-count: 1 !important; }
}

/* ── Phones ────────────────────────────────────────────────────── */
@media (max-width: 640px) {
  .title { max-width: 11ch; }
  .glow { width: 260vw; filter: blur(28px); }
}

/* ── SHINE UI (flat, live) ─────────────────────────────────────── */
@font-face {
  font-family: "Zalando Expanded";
  src: url("fonts/ZalandoSansExpanded-VF.woff2") format("woff2");
  font-weight: 200 900; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "Zalando";
  src: url("fonts/ZalandoSans-VF.woff2") format("woff2");
  font-weight: 200 900; font-stretch: 75% 125%; font-style: normal; font-display: swap;
}
.shine-ui { display: block; width: 100%; height: auto; user-select: none; -webkit-user-select: none; }
.shine-ui text { font-kerning: normal; }
.shine-ui [class^="g-"] { transition: opacity 0.5s var(--ease); }
/* Focus: everything but the named part steps back. */
.shine-ui:where([data-focus]:not([data-focus=""])) :where([class^="g-"]) { opacity: 0.16; }
.shine-ui[data-focus~="ring"] .g-ring,
.shine-ui[data-focus~="ring"] .g-face,
.shine-ui[data-focus~="activity"] .g-activity,
.shine-ui[data-focus~="header"] .g-header,
.shine-ui[data-focus~="hands"] .g-hands,
.shine-ui[data-focus~="selector"] .g-selector,
.shine-ui[data-focus~="week"] .g-week,
.shine-ui[data-focus~="live"] .g-live,
.shine-ui[data-focus~="nav"] .g-nav { opacity: 1; }
.shine-ui.is-interactive { touch-action: none; cursor: default; }
.shine-ui.is-interactive .g-week [data-row],
.shine-ui.is-interactive .g-week text,
.shine-ui.is-interactive .g-nav [data-tab="0"],
.shine-ui.is-interactive .g-nav [data-tab="1"] { cursor: pointer; }
.shine-ui.is-interactive .g-ring, .shine-ui.is-interactive .g-selector { cursor: grab; }

:root {
  --ui-low: #F03A49; --ui-in-lo: #3366FF; --ui-in-hi: #5D85FF; --ui-high: #D9A92B; --ui-very-high: #F1C22E;
  --paper: #F3F1EE;                     /* the finale's white: warm, like the demo's backlit scrim */
  --ink: #111;
}

/* ── Flat phone (live UI in a slim device frame) ───────────────── */
.phone {
  position: relative;
  height: var(--phone-h, min(80vh, 760px));
  aspect-ratio: 402 / 874;
  border-radius: 14% / 6.45%;
  overflow: hidden;
  background: #000;
  box-shadow:
    0 0 0 calc(var(--phone-h, 80vh) * 0.011) #0B0B0C,
    0 0 0 calc(var(--phone-h, 80vh) * 0.011 + 1.5px) #3A3A3E,
    0 40px 120px -20px rgba(51, 102, 255, 0.28);
}
.phone .shine-ui { width: 100%; height: 100%; }

/* ── Tour ───────────────────────────────────────────────────────── */
/* Overlaps the end of the intro so the flat phone can fade in over the 3D one. */
.chapter--tour { margin-top: -200vh; z-index: 2; }
.stage--tour {
  display: block;
  background: rgba(0, 0, 0, var(--bg, 0));
  --phone-h: min(78vh, 740px);
}
.tour__phone {
  position: absolute;
  left: 50%; top: 50%;
  opacity: var(--po, 0);
  transform: translate(calc(-50% + var(--px, 0px)), calc(-50% + var(--py, 0px))) scale(var(--ps, 1));
  will-change: transform, opacity;
}

.step {
  position: absolute;
  top: 50%;
  width: min(36vw, 460px);
  opacity: var(--o, 0);
  transform: translateY(calc(-50% + (1 - var(--o, 0)) * var(--dir, 1) * 24px));
  pointer-events: none;
  will-change: transform, opacity;
}
.step[data-side="left"]  { left: max(var(--edge), calc(50% - 560px)); }
.step[data-side="right"] { right: max(var(--edge), calc(50% - 560px)); }
.step h2 {
  margin: 0 0 0.5em;
  font-size: clamp(30px, 3.4vw, 54px);
  font-weight: 600;
  line-height: 1.04;
  letter-spacing: -0.02em;
  text-wrap: balance;
}
.step p {
  margin: 0;
  font-size: clamp(16px, 1.2vw, 19px);
  line-height: 1.5;
  color: rgba(255, 255, 255, 0.66);
  text-wrap: pretty;
}
.kicker {
  margin: 0 0 18px !important;
  font-size: 12px !important;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.45) !important;
}
.step--statement {
  left: 50%;
  width: min(100% - 2 * var(--edge), 1000px);
  text-align: center;
  transform: translate(-50%, calc(-50% + (1 - var(--o, 0)) * var(--dir, 1) * 24px));
}
.step--statement h2 { font-size: clamp(34px, 5vw, 84px); line-height: 1.02; margin: 0; }

.legend { list-style: none; margin: 28px 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 10px 22px; }
.legend li { display: flex; align-items: center; gap: 4px; font-size: 14px; color: rgba(255, 255, 255, 0.72); }
.legend li i:last-of-type { margin-right: 6px; }
.legend i { width: 4px; height: 16px; border-radius: 2px; background: var(--c); }

.days { list-style: none; margin: 26px 0 0; padding: 0; display: flex; gap: 10px; }
.days li {
  padding: 7px 14px; border-radius: 999px; font-size: 14px;
  border: 1px solid rgba(255, 255, 255, 0.16); color: rgba(255, 255, 255, 0.5);
  transition: background 0.3s, color 0.3s, border-color 0.3s;
}
.days li.on { background: rgba(240, 58, 73, 0.16); border-color: rgba(240, 58, 73, 0.6); color: #fff; }

/* ── Finale: the lights come up ────────────────────────────────── */
.stage--finale {
  background: color-mix(in srgb, var(--paper) calc(var(--light, 0) * 100%), #000);
  color: var(--ink);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: clamp(32px, 7vw, 120px);
  padding: 0 var(--edge);
  --phone-h: min(76vh, 720px);
}
.finale__copy {
  width: min(34vw, 420px);
  opacity: var(--fo, 0);
  transform: translateY(calc((1 - var(--fo, 0)) * 24px));
}
.finale__copy h2 { margin: 0 0 0.35em; font-size: clamp(44px, 6vw, 96px); font-weight: 600; letter-spacing: -0.03em; line-height: 1; }
.finale__copy p { margin: 0; font-size: clamp(16px, 1.2vw, 19px); line-height: 1.5; color: rgba(17, 17, 17, 0.62); }
.tried { list-style: none; margin: 30px 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 10px; }
.tried li {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 14px 8px 12px; border-radius: 999px; font-size: 14px;
  border: 1px solid rgba(17, 17, 17, 0.14); color: rgba(17, 17, 17, 0.6);
  transition: background 0.35s var(--ease), color 0.35s, border-color 0.35s;
}
.tried li::before {
  content: ""; width: 14px; height: 14px; border-radius: 50%;
  border: 1.5px solid currentColor; box-sizing: border-box; opacity: 0.6;
  transition: background 0.35s, border-color 0.35s;
}
.tried li.done { background: var(--ink); border-color: var(--ink); color: #fff; }
.tried li.done::before { background: var(--ui-in-lo); border-color: var(--ui-in-lo); opacity: 1; }
.finale__phone {
  opacity: var(--fo, 0);
  transform: translateY(calc((1 - var(--fo, 0)) * 40px));
}
.finale__phone .phone {
  box-shadow:
    0 0 0 calc(var(--phone-h) * 0.011) #0B0B0C,
    0 0 0 calc(var(--phone-h) * 0.011 + 1.5px) #2A2A2E,
    0 50px 100px -30px rgba(0, 0, 0, 0.45),
    0 20px 40px -20px rgba(0, 0, 0, 0.3);
}

/* The deck bar inverts as the lights come up. */
.bar img { filter: invert(var(--inv, 0)); transition: filter 0.2s linear; }

.foot {
  display: flex; justify-content: space-between; align-items: center; gap: 16px;
  padding: 28px var(--edge) calc(28px + env(safe-area-inset-bottom, 0px));
  background: var(--paper); color: rgba(17, 17, 17, 0.55); font-size: 13px;
}
.foot p { margin: 0; }
.foot a { color: inherit; text-decoration: none; }
.foot a:hover { color: var(--ink); }

/* ── Tour + finale on phones: phone on top, copy underneath ─────── */
@media (max-width: 760px) {
  .stage--tour { --phone-h: 54svh; }
  .step, .step[data-side] {
    left: 0; right: 0; top: auto; bottom: 0;
    width: auto;
    padding: 0 var(--edge) calc(28px + env(safe-area-inset-bottom, 0px));
    transform: translateY(calc((1 - var(--o, 0)) * var(--dir, 1) * 16px));
  }
  .step h2 { font-size: 26px; margin-bottom: 0.4em; }
  .step p { font-size: 15px; }
  .kicker { margin-bottom: 10px !important; }
  .legend { margin-top: 16px; gap: 8px 16px; }
  .days { margin-top: 14px; }
  .step--statement { top: 50%; bottom: auto; left: 50%; right: auto; padding: 0; transform: translate(-50%, calc(-50% + (1 - var(--o, 0)) * var(--dir, 1) * 16px)); }
  .step--statement h2 { font-size: 34px; }
  .stage--finale { flex-direction: column; justify-content: center; gap: 20px; --phone-h: 52svh; padding-top: 64px; }
  .finale__copy { width: auto; text-align: center; }
  .finale__copy h2 { font-size: 40px; }
  .finale__copy p { font-size: 14px; }
  .tried { justify-content: center; margin-top: 14px; gap: 6px; }
  .tried li { font-size: 12px; padding: 6px 10px 6px 9px; }
}
