/* talkoa.com landing page. The app's night sky, scrolled as a story. The two canvases behind the page
   are drawn by assets/js; everything here works without them. */

@font-face { font-family: "Poppins"; font-weight: 200; font-display: swap; src: url(../fonts/poppins-200.woff2) format("woff2"); }
@font-face { font-family: "Poppins"; font-weight: 300; font-display: swap; src: url(../fonts/poppins-300.woff2) format("woff2"); }
@font-face { font-family: "Poppins"; font-weight: 500; font-display: swap; src: url(../fonts/poppins-500.woff2) format("woff2"); }
@font-face { font-family: "Atkinson Hyperlegible"; font-weight: 400; font-display: swap; src: url(../fonts/atkinson-400.woff2) format("woff2"); }
@font-face { font-family: "Atkinson Hyperlegible"; font-weight: 700; font-display: swap; src: url(../fonts/atkinson-700.woff2) format("woff2"); }

:root {
  --bg: #000000;
  --ink: #F2F4F8;
  --muted: #98A0B3;
  --glow: #DCE8FF;
  --gold: #D9B46A;
  --danger: #FF7B80;
  --line: rgba(255, 255, 255, 0.16);
  --line-strong: rgba(255, 255, 255, 0.22);
  --surface: rgba(255, 255, 255, 0.06);
  --surface-2: rgba(255, 255, 255, 0.1);
  --display: "Poppins", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --body: "Atkinson Hyperlegible", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --ease-out: cubic-bezier(0.2, 0.8, 0.2, 1);
  --gutter: clamp(20px, 5vw, 64px);
  color-scheme: dark;
}

@view-transition { navigation: auto; }

* { box-sizing: border-box; }

html { background: var(--bg); }

body {
  margin: 0;
  font: 400 17px/1.6 var(--body);
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* Without JavaScript, or without WebGL, a still sky stands in for the live one. */
.no-js body, .no-gl body { background: var(--bg) url(../img/sky-still.svg) center top / 1200px 1200px repeat; }
.no-js #sky, .no-js #stage { display: none; }

::selection { background: rgba(220, 232, 255, 0.28); color: #fff; }
:focus-visible { outline: 2px solid var(--glow); outline-offset: 3px; border-radius: 6px; }

#sky, #stage {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none;
}
#stage { z-index: 1; }
/* Arrival: black first, then the sky fades up. */
.js #sky, .js #stage { opacity: 0; transition: opacity 1.8s ease; }
.js.lit #sky, .js.lit #stage { opacity: 1; }
.vignette {
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background: radial-gradient(ellipse 85% 70% at 50% 42%, transparent 50%, rgba(0, 0, 0, 0.62) 100%);
}

.skip {
  position: absolute;
  left: 16px;
  top: -60px;
  z-index: 30;
  padding: 12px 16px;
  background: #000;
  color: var(--ink);
  border: 1px solid var(--line-strong);
  border-radius: 10px;
}
.skip:focus { top: 16px; }

/* Header */
.top {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px var(--gutter);
  padding-top: calc(10px + env(safe-area-inset-top));
  /* Copy scrolls under the header, so it needs a little night of its own. */
  padding-bottom: 34px;
  background: linear-gradient(#000 calc(100% - 34px), transparent);
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 48px;
  color: var(--ink);
  text-decoration: none;
  font: 500 13px/1 var(--display);
  letter-spacing: 0.3em;
  text-transform: uppercase;
}
.brand img { width: 34px; height: 34px; }
.top-nav { display: flex; gap: 6px; }
.top-nav a {
  display: inline-flex;
  align-items: center;
  min-height: 48px;
  padding: 0 12px;
  color: var(--muted);
  text-decoration: none;
  font: 500 12px/1 var(--display);
  letter-spacing: 0.18em;
  text-transform: uppercase;
  transition: color 0.3s;
}
.top-nav a:hover { color: var(--ink); }
@media (max-width: 599px) { .top-nav { display: none; } }

/* Scenes: each is taller than the screen, and its copy stays pinned while the sky plays. */
main { position: relative; z-index: 2; }
.scene { position: relative; min-height: 100vh; }
.js .scene { min-height: 190vh; min-height: 190svh; }
.js .scene.tall { min-height: 220vh; min-height: 220svh; }
.js .scene.hero { min-height: 170vh; min-height: 170svh; }
.js .scene.final { min-height: 130vh; min-height: 130svh; }

.pin {
  position: relative;
  display: flex;
  align-items: flex-end;
  min-height: 100vh;
  padding: 96px var(--gutter) 11vh;
}
.js .pin {
  position: sticky;
  top: 0;
  height: 100vh;
  height: 100svh;
  min-height: 0;
}
@media (min-width: 900px) {
  .pin { align-items: center; padding-bottom: 96px; }
  .copy { margin-right: auto; }
}

.copy {
  position: relative;
  width: 100%;
  max-width: 34rem;
}
@media (max-width: 899px) { .centred { text-align: center; margin: 0 auto; } }

/* The copy fades up as its scene arrives and out as it leaves, driven by --p from the scroll. */
.js .scene { --p: 0; }
.js .scene:not(.hero) .copy {
  opacity: min(var(--p) * 7, (1 - var(--p)) * 5, 1);
  transform: translateY(calc((0.5 - var(--p)) * 28px));
}
.js .scene.hero .copy { opacity: min((1 - var(--p)) * 3, 1); transform: translateY(calc(var(--p) * -40px)); }
.js .scene.final .copy { opacity: min(var(--p) * 7, 1); transform: none; }

/* A scene whose copy would not fit the screen scrolls normally instead of pinning, so nothing is ever
   cut off: the long scenes on a narrow screen, and any scene when the text is set very large. */
.js .scene.flow { min-height: 0; }
.js .scene.flow .pin { position: relative; height: auto; min-height: 100vh; min-height: 100svh; padding-top: 150px; }
.js .scene.flow .copy, .js .scene.hero.flow .copy { opacity: 1; transform: none; }
.js .scene.flow .copy::before { transform: scaleX(1); }
.js .scene.flow .word { --k: 1; }
@media (max-width: 599px) {
  .js .scene.tall { min-height: 0; }
  .js .scene.tall .pin { position: relative; height: auto; min-height: 100vh; min-height: 100svh; padding-top: 150px; }
  .js .scene.tall .copy { opacity: 1; transform: none; }
  .js .scene.tall .copy::before { transform: scaleX(1); }
  .js .word { --k: 1; }
}

/* A hairline above each scene's copy draws in as you scroll. */
.js .scene:not(.hero) .copy::before {
  content: "";
  position: absolute;
  left: 0;
  top: -28px;
  width: 100%;
  height: 1px;
  background: linear-gradient(90deg, rgba(220, 232, 255, 0.55), rgba(220, 232, 255, 0));
  transform: scaleX(min(var(--p) * 2.5, 1));
  transform-origin: left;
}
.js .centred::before { background: linear-gradient(90deg, rgba(220, 232, 255, 0), rgba(220, 232, 255, 0.55), rgba(220, 232, 255, 0)); transform-origin: center; }

.eyebrow {
  margin: 0 0 18px;
  font: 500 11px/1.3 var(--display);
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--muted);
}
.eyebrow.gold { color: var(--gold); }

.display {
  margin: 0 0 20px;
  font: 200 clamp(2.5rem, 1.6rem + 4.5vw, 4.75rem)/1.02 var(--display);
  letter-spacing: -0.02em;
  text-wrap: balance;
}
h2.display { font-size: clamp(2.1rem, 1.3rem + 3.6vw, 3.9rem); }

p { margin: 0 0 1em; }
.copy p:last-child { margin-bottom: 0; }
.lede { font-size: 1.1rem; color: var(--ink); }
.copy > p:not(.eyebrow):not(.lede):not(.fine) { color: #C9CFDB; }
.fine { font-size: 0.85rem; color: var(--muted); margin: 14px 0 0; }

/* Word-by-word reveal. The words are wrapped by JS; without it the headings simply show. */
.wd { display: inline-block; overflow: hidden; vertical-align: bottom; padding: 0 0.06em; margin: 0 -0.06em; }
.js .wd > span {
  display: inline-block;
  transform: translateY(105%);
  opacity: 0;
  filter: blur(6px);
  transition: transform 1s var(--ease-out) var(--d, 0s), opacity 0.8s ease var(--d, 0s), filter 1s ease var(--d, 0s);
}
.js .in .wd > span { transform: none; opacity: 1; filter: none; }
.js .reveal > :not(.display) {
  opacity: 0;
  transform: translateY(16px);
  transition: opacity 0.9s ease 0.5s, transform 1.1s var(--ease-out) 0.5s;
}
.js .reveal.in > :not(.display) { opacity: 1; transform: none; }
.js .reveal > :nth-child(3) { transition-delay: 0.7s; }
.js .reveal > :nth-child(4) { transition-delay: 0.85s; }
.js .reveal > :nth-child(5) { transition-delay: 1s; }
.js .reveal > :nth-child(6) { transition-delay: 1.15s; }

/* Buttons */
.actions { margin-top: 30px; }
.cta {
  --mx: 50%;
  --my: 50%;
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 56px;
  padding: 0 26px;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  background: rgba(255, 255, 255, 0.08);
  color: var(--ink);
  font: 500 13px/1.3 var(--display);
  letter-spacing: 0.12em;
  text-align: center;
  text-transform: uppercase;
  cursor: pointer;
  overflow: hidden;
  isolation: isolate;
  transition: transform 0.6s var(--ease-out), border-color 0.4s, background-color 0.4s, box-shadow 0.6s;
  -webkit-tap-highlight-color: transparent;
}
.cta::before {
  content: "";
  position: absolute;
  inset: -1px;
  z-index: -1;
  background: radial-gradient(120px 120px at var(--mx) var(--my), rgba(220, 232, 255, 0.28), transparent 70%);
  opacity: 0;
  transition: opacity 0.4s;
}
.cta:hover, .cta:focus-visible {
  border-color: rgba(220, 232, 255, 0.6);
  background: rgba(255, 255, 255, 0.12);
  box-shadow: 0 0 0 1px rgba(220, 232, 255, 0.1), 0 0 40px rgba(220, 232, 255, 0.18);
}
.cta:hover::before { opacity: 1; }
.cta:active { transform: scale(0.97); }

.scroll-hint {
  position: absolute;
  left: 50%;
  bottom: 28px;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  font: 500 10px/1 var(--display);
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--muted);
  opacity: min((1 - var(--p) * 6), 1);
}
.no-js .scroll-hint { display: none; }
@media (max-width: 599px) { .scroll-hint { left: var(--gutter); transform: none; align-items: flex-start; } }
.scroll-hint span { display: block; width: 1px; height: 44px; background: linear-gradient(180deg, transparent, var(--glow)); animation: hint 2.6s ease-in-out infinite; }
@keyframes hint { 0% { transform: scaleY(0); transform-origin: top; } 50% { transform: scaleY(1); transform-origin: top; } 51% { transform-origin: bottom; } 100% { transform: scaleY(0); transform-origin: bottom; } }

/* Call facts */
.facts {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
  margin: 28px 0 0;
  padding-top: 22px;
  border-top: 1px solid var(--line);
}
.facts dt { font: 300 1.05rem/1.2 var(--display); color: var(--glow); margin-bottom: 6px; }
.facts dd { margin: 0; font-size: 0.85rem; color: var(--muted); }
@media (max-width: 599px) {
  .facts { grid-template-columns: 1fr; gap: 10px; margin-top: 20px; padding-top: 16px; }
  .facts dt { font-size: 0.95rem; margin-bottom: 2px; }
  .facts dd { font-size: 0.8rem; }
}

/* Languages: each word drifts in as a star, in order, as the scene scrolls. */
.words { list-style: none; margin: 26px 0 0; padding: 0; display: grid; gap: 4px; }
.word {
  position: relative;
  display: flex;
  align-items: baseline;
  gap: 16px;
  padding: 10px 0 10px 28px;
  min-height: 48px;
}
.word::before {
  content: "";
  position: absolute;
  left: 4px;
  top: 50%;
  width: 6px;
  height: 6px;
  margin-top: -3px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 0 10px 2px rgba(220, 232, 255, 0.7), 0 0 26px 6px rgba(190, 208, 245, 0.25);
  animation: twinkle 3.2s ease-in-out infinite;
  animation-delay: calc(var(--i) * -0.7s);
}
.word .w { font: 300 clamp(1.5rem, 1.2rem + 1.4vw, 2.1rem)/1.15 var(--display); color: var(--ink); }
.word .l { font-size: 0.85rem; color: var(--muted); }
.js .word {
  --k: clamp(0, (var(--p) - 0.18 - var(--i) * 0.07) * 7, 1);
  opacity: var(--k);
  transform: translate(calc((1 - var(--k)) * 18px), calc((1 - var(--k)) * -14px));
}
@keyframes twinkle { 0%, 100% { opacity: 0.55; } 50% { opacity: 1; } }

/* Safety tiles */
.tiles {
  list-style: none;
  margin: 26px 0 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}
.tiles li {
  display: grid;
  gap: 6px;
  padding: 16px;
  border-radius: 16px;
  background: var(--surface);
  border: 1px solid var(--line);
}
.tiles .ico { width: 24px; height: 24px; fill: none; stroke: var(--glow); stroke-width: 1.4; stroke-linecap: round; stroke-linejoin: round; margin-bottom: 4px; }
.tiles span.ico { font: 500 12px/24px var(--display); letter-spacing: 0.05em; color: var(--glow); text-align: center; border: 1px solid rgba(220, 232, 255, 0.5); border-radius: 50%; }
.tiles strong { font: 300 1.05rem/1.25 var(--display); color: var(--ink); }
.tiles li > span:not(.ico) { font-size: 0.85rem; color: var(--muted); }
@media (max-width: 339px) { .tiles { grid-template-columns: 1fr; } }

/* Plus: the gold accent lives here only */
.ads { font-size: 0.95rem; margin-bottom: 36px; }
.plus h2.display { color: #FFF3D6; }
.benefits { list-style: none; margin: 0 0 20px; padding: 0; display: grid; gap: 2px; }
.benefits li {
  position: relative;
  padding: 11px 0 11px 28px;
  font: 300 1.15rem/1.3 var(--display);
  border-bottom: 1px solid rgba(217, 180, 106, 0.18);
}
.benefits li::before {
  content: "";
  position: absolute;
  left: 4px;
  top: 50%;
  width: 6px;
  height: 6px;
  margin-top: -3px;
  border-radius: 50%;
  background: #FFF3D6;
  box-shadow: 0 0 10px 2px rgba(217, 180, 106, 0.7), 0 0 22px 6px rgba(217, 180, 106, 0.25);
}
.plus .fine { color: #B8A47D; }

/* Footer */
.foot {
  position: relative;
  z-index: 2;
  padding: 72px var(--gutter) calc(88px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.78);
  display: grid;
  gap: 32px;
  color: var(--muted);
  font-size: 0.92rem;
}
.foot-brand p { margin: 10px 0 0; max-width: 32rem; }
.foot a { color: var(--muted); text-decoration: underline; text-decoration-color: transparent; text-underline-offset: 0.18em; transition: color 0.3s, text-decoration-color 0.3s; }
.foot a:hover { color: var(--ink); text-decoration-color: var(--glow); }
.foot-links { display: flex; flex-wrap: wrap; gap: 4px 20px; }
.foot-links a, .foot-brand a { display: inline-flex; align-items: center; min-height: 48px; }
.copyright { margin: 0; font-size: 0.82rem; }
@media (min-width: 900px) {
  .foot { grid-template-columns: 1fr 1fr; align-items: start; }
  .copyright { grid-column: 1 / -1; }
}

/* Floating controls: Tilt only appears where the browser needs a tap to allow it. */
.controls {
  position: fixed;
  right: calc(16px + env(safe-area-inset-right));
  bottom: calc(16px + env(safe-area-inset-bottom));
  z-index: 10;
  display: flex;
  gap: 8px;
}
.no-js .controls { display: none; }
/* On a phone the controls take the header's right side, where the nav is hidden, clear of the copy. */
@media (max-width: 599px) {
  .controls { top: calc(10px + env(safe-area-inset-top)); bottom: auto; right: 12px; }
  .controls button { padding: 0 14px; }
}
.controls button {
  min-width: 48px;
  min-height: 48px;
  padding: 0 16px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.6);
  color: var(--muted);
  font: 500 11px/1 var(--display);
  letter-spacing: 0.2em;
  text-transform: uppercase;
  cursor: pointer;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  transition: color 0.3s, border-color 0.3s;
}
.controls button:hover, .controls button[aria-pressed="true"] { color: var(--ink); border-color: rgba(220, 232, 255, 0.5); }
.controls button[aria-pressed="true"]::before { content: ""; display: inline-block; width: 6px; height: 6px; margin-right: 10px; border-radius: 50%; background: var(--glow); box-shadow: 0 0 8px var(--glow); vertical-align: middle; }

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(84px + env(safe-area-inset-bottom));
  z-index: 20;
  transform: translate(-50%, 12px);
  max-width: calc(100% - 40px);
  padding: 12px 18px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.75);
  color: var(--ink);
  font-size: 0.9rem;
  text-align: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.4s, transform 0.5s var(--ease-out);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* Reduced motion: a still sky, no transforms, only gentle fades. */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .js .wd > span { transform: none; filter: none; transition: opacity 0.5s ease; }
  .js .reveal > :not(.display) { transform: none; transition: opacity 0.5s ease; }
  .js .scene:not(.hero) .copy, .js .scene.hero .copy, .js .word { transform: none; }
  .scroll-hint span, .word::before { animation: none; }
  .cta { transition: none; }
  .toast { transition: opacity 0.3s; transform: translate(-50%, 0); }
}
