/* InkTether site. Colours come from brand/tokens.json. */

@font-face {
  font-family: "Outfit";
  src: url("/fonts/outfit-latin.woff2") format("woff2");
  font-weight: 500 700;
  font-display: swap;
}

:root {
  --ink: #151515;
  --paper: #fafaf8;
  --coral: #e5574a;
  --accent: #c23f31;
  --graphite: #5a5f66;
  --night: #141619;
  --mist: #a3a8af;
  --blue: #2f4bd9;
  --ochre: #d39b2a;
  --line: rgba(21, 21, 21, 0.1);
  --glass: rgba(250, 250, 248, 0.84);
  --display: "Outfit", ui-sans-serif, system-ui, sans-serif;
  --body: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --radius: 22px;
  --header: 4.5rem;
}

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

html {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--body);
  font-size: 100%;
  line-height: 1.55;
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: var(--header);
  overflow-x: clip;
}

body { margin: 0; min-width: 320px; overflow-x: hidden; }
img, svg { display: block; max-width: 100%; }
a { color: var(--accent); text-underline-offset: 0.18em; }
a:hover { color: var(--ink); }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; border-radius: 6px; }
.nowrap { white-space: nowrap; }

.skip {
  position: fixed; left: 1rem; top: -4rem; z-index: 50;
  padding: 0.7rem 1rem; border-radius: 12px; background: var(--ink); color: var(--paper);
  font-weight: 600; text-decoration: none; transition: top 0.2s;
}
.skip:focus { top: 1rem; }

h1, h2, h3 { font-family: var(--display); font-weight: 700; letter-spacing: -0.02em; margin: 0; }
h1 { font-size: clamp(2.9rem, 1.6rem + 5.2vw, 6.2rem); line-height: 0.95; letter-spacing: -0.035em; }
h2 { font-size: clamp(2rem, 1.3rem + 2.6vw, 3.4rem); line-height: 1.02; letter-spacing: -0.03em; }
h3 { font-size: 1.2rem; line-height: 1.2; }
p { margin: 0; }

/* ------------------------------------------------------------------ canvas */
#scene {
  position: fixed; left: 0; top: 0; width: 100%; height: 100vh; height: 100lvh;
  z-index: 0; display: block; outline: none;
  opacity: 0; transition: opacity 0.9s ease;
}
.is-ready #scene { opacity: 1; }
.no-webgl #scene { display: none; }

/* Under the content layer: panels stay clickable, and everywhere else the page
   lets pointer events fall through to the iPad. */
#drawzone {
  position: fixed; left: 0; top: 0; z-index: 1;
  touch-action: none; cursor: none; border-radius: 12px;
}
#drawzone[hidden] { display: none; }

.draw-hint {
  position: fixed; left: 0; top: 0; z-index: 6; pointer-events: none;
  margin-left: -4.6rem; margin-top: -2.4rem; width: 9.2rem; text-align: center;
  font: 700 0.95rem/1 var(--display); color: var(--paper);
  background: var(--ink); padding: 0.55rem 0.9rem; border-radius: 999px;
  box-shadow: 0 8px 20px rgba(21, 21, 21, 0.18);
  animation: hint-bob 1.6s ease-in-out infinite;
  transition: opacity 0.4s;
}
.draw-hint::after {
  content: ""; position: absolute; left: 50%; bottom: -6px; width: 12px; height: 12px;
  background: var(--ink); transform: translateX(-50%) rotate(45deg); border-radius: 2px;
}
.draw-hint.is-hidden, #drawzone[hidden] + .draw-hint, .no-webgl .draw-hint, .is-touch .draw-hint { opacity: 0; }

/* Touch screens: the iPad scrolls the page until Draw is tapped. */
.is-touch #drawzone { pointer-events: none; }
.is-touch.is-drawing #drawzone { pointer-events: auto; box-shadow: 0 0 0 3px var(--coral); }
.is-touch.is-drawing body { overscroll-behavior: none; }
.draw-toggle {
  position: fixed; left: 0; top: 0; z-index: 6; translate: -100% -100%;
  display: inline-flex; align-items: center; gap: 0.4rem; min-height: 2.75rem; padding: 0.55rem 1.05rem;
  border-radius: 999px; border: 2px solid var(--ink); background: var(--paper); color: var(--ink);
  font: 700 0.95rem var(--display); box-shadow: 0 8px 20px rgba(21, 21, 21, 0.16); cursor: pointer;
}
.draw-toggle::before { content: "✎"; color: var(--coral); }
.draw-toggle[aria-pressed="true"] { background: var(--ink); color: var(--paper); }
.draw-toggle[aria-pressed="true"]::before { content: "✓"; }
.draw-toggle[hidden] { display: none; }
.touch-only { display: none; }
.is-touch .touch-only { display: block; }
.pencil-glyph { color: var(--coral); }
@keyframes hint-bob { 50% { translate: 0 -6px; } }

/* ------------------------------------------------------------------ header */
.site-header {
  position: fixed; inset: 0 0 auto 0; z-index: 20; height: var(--header);
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: 0 clamp(1rem, 4vw, 3rem);
  background: rgba(250, 250, 248, 0.78);
  backdrop-filter: blur(12px) saturate(1.2); -webkit-backdrop-filter: blur(12px) saturate(1.2);
  border-bottom: 1px solid var(--line);
}
.brand img { width: clamp(140px, 16vw, 182px); height: auto; }
.site-header ul { display: flex; gap: clamp(0.6rem, 2.2vw, 1.8rem); list-style: none; margin: 0; padding: 0; }
.site-header nav a {
  display: inline-block; padding: 0.4rem 0.1rem; color: var(--ink); text-decoration: none;
  font: 600 0.98rem var(--display); background: linear-gradient(var(--coral), var(--coral)) 0 100% / 0 2px no-repeat;
  transition: background-size 0.25s ease;
}
.site-header nav a:hover { background-size: 100% 2px; }
@media (max-width: 34rem) {
  .site-header nav li:nth-child(n+3) { display: none; }
}

/* ------------------------------------------------------------------ stages */
main { position: relative; z-index: 2; pointer-events: none; }
main > * { pointer-events: none; }
main .panel, main .sheet { pointer-events: auto; }
.stage {
  min-height: 100vh; min-height: 100svh; display: flex; align-items: center;
  padding: calc(var(--header) + 2rem) clamp(1rem, 5vw, 4.5rem) 4rem;
  pointer-events: none;
}
.stage + .stage { min-height: 115vh; }
.panel { pointer-events: auto; max-width: 30rem; }
.panel-right { margin-left: auto; }
.panel-center { margin: 0 auto; text-align: center; }
.panel:not(.panel-hero) {
  background: var(--glass); backdrop-filter: blur(14px) saturate(1.2); -webkit-backdrop-filter: blur(14px) saturate(1.2);
  border: 1px solid var(--line); border-radius: var(--radius);
  padding: clamp(1.4rem, 3vw, 2.2rem);
  box-shadow: 0 24px 60px -30px rgba(21, 21, 21, 0.35);
}
.panel h2 { margin-bottom: 0.9rem; }
.panel p + p { margin-top: 0.9rem; }
.panel p { font-size: 1.08rem; color: #2c2f33; }
.note { font-size: 0.95rem !important; color: var(--graphite) !important; }

.kicker {
  display: flex; align-items: center; gap: 0.6rem; margin-bottom: 0.9rem;
  font: 700 0.8rem var(--display); letter-spacing: 0.12em; text-transform: uppercase; color: var(--graphite);
}
.kicker span {
  display: inline-grid; place-items: center; width: 2rem; height: 2rem; border-radius: 50%;
  background: var(--coral); color: var(--paper); letter-spacing: 0; font-size: 0.8rem;
}

/* Hero */
.hero { align-items: center; position: relative; }
.panel-hero { max-width: 40rem; position: relative; }
/* A soft pool of paper behind the hero text keeps it readable over the scene. */
.panel-hero::before {
  content: ""; position: absolute; inset: -18% -22% -18% -30%; z-index: -1; pointer-events: none;
  background: radial-gradient(closest-side, rgba(250, 250, 248, 0.94), rgba(250, 250, 248, 0.7) 60%, rgba(250, 250, 248, 0));
}
.status { display: flex; flex-wrap: wrap; align-items: center; gap: 0.6rem 0.8rem; margin-bottom: 1.5rem; color: var(--graphite); font-size: 0.98rem; }
.pill {
  display: inline-flex; align-items: center; gap: 0.5rem; padding: 0.35rem 0.8rem; border-radius: 999px;
  border: 1.5px solid var(--ink); font: 700 0.85rem var(--display); color: var(--ink); background: var(--paper);
}
.dot { width: 0.55rem; height: 0.55rem; border-radius: 50%; background: var(--coral); animation: pulse 1.6s ease-in-out infinite; }
@keyframes pulse { 50% { transform: scale(1.5); opacity: 0.55; } }

h1 .word { display: inline-block; animation: word-in 0.9s cubic-bezier(0.2, 1.4, 0.4, 1) both; }
h1 .word:nth-child(1) { animation-delay: 0.05s; }
h1 .word:nth-child(2) { animation-delay: 0.12s; }
h1 .word:nth-child(3) { animation-delay: 0.19s; }
h1 .word:nth-child(4) { animation-delay: 0.26s; }
h1 .word:nth-child(5) { animation-delay: 0.33s; }
h1 .word:nth-child(6) { animation-delay: 0.4s; }
@keyframes word-in { from { opacity: 0; transform: translateY(0.45em); } }

.scribble { position: relative; }
.underline {
  position: absolute; left: -2%; right: -2%; bottom: -0.12em; width: 104%; height: 0.32em; overflow: visible;
}
.underline path {
  fill: none; stroke: var(--coral); stroke-width: 7; stroke-linecap: round;
  stroke-dasharray: 340; animation: underline 1.1s 0.9s cubic-bezier(0.6, 0, 0.3, 1) both;
}
@keyframes underline { from { stroke-dashoffset: 340; } to { stroke-dashoffset: 0; } }

.lede { margin-top: 1.5rem; font-size: clamp(1.15rem, 1rem + 0.5vw, 1.4rem); color: #2c2f33; max-width: 30rem; }
.hero-actions { margin-top: 2rem; display: flex; flex-wrap: wrap; align-items: center; gap: 1rem 1.2rem; }
.try { font: 600 1rem var(--display); color: var(--graphite); }
.has-webgl .try::after { content: " →"; color: var(--coral); }
.no-webgl .try, html:not(.has-webgl) .try { display: none; }

.fallback-art { display: none; margin-top: 2rem; border-radius: var(--radius); border: 1px solid var(--line); }
.no-webgl .fallback-art { display: block; }

.scroll-cue {
  position: absolute; left: 50%; bottom: 1.6rem; transform: translateX(-50%);
  font: 700 0.75rem var(--display); letter-spacing: 0.16em; text-transform: uppercase; color: var(--graphite);
}
.scroll-cue span::after {
  content: ""; display: block; width: 2px; height: 2.2rem; margin: 0.5rem auto 0; background: var(--coral);
  transform-origin: top; animation: cue 1.8s ease-in-out infinite;
}
@keyframes cue { 0% { transform: scaleY(0); } 50% { transform: scaleY(1); } 100% { transform: scaleY(0); transform-origin: bottom; } }

/* Buttons */
.button {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem;
  min-height: 2.9rem; padding: 0.7rem 1.3rem; border-radius: 999px; border: 2px solid var(--accent);
  background: var(--accent); color: #fff; font: 700 1rem var(--display); text-decoration: none; cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s;
  box-shadow: 0 6px 0 -2px rgba(21, 21, 21, 0.9);
}
.button:hover { color: #fff; transform: translateY(-2px); box-shadow: 0 8px 0 -2px rgba(21, 21, 21, 0.9); }
.button:active { transform: translateY(2px); box-shadow: 0 2px 0 -2px rgba(21, 21, 21, 0.9); }
.button-quiet { background: var(--paper); color: var(--ink); border-color: var(--ink); }
.button-quiet:hover { color: var(--ink); background: #fff; }
.actions { display: flex; flex-wrap: wrap; gap: 0.8rem; margin-top: 1.4rem !important; }
.panel-center .actions { justify-content: center; }

/* ------------------------------------------------------------------ sheets */
.sheet {
  position: relative; padding: clamp(4rem, 9vw, 7rem) clamp(1rem, 5vw, 4.5rem);
  background: rgba(250, 250, 248, 0.88); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  border-top: 1px solid var(--line);
}
.wrap { max-width: 72rem; margin: 0 auto; }
.sheet h2 { margin-bottom: 2.2rem; max-width: 18ch; }
.sheet-card {
  background: var(--paper); border: 1.5px solid var(--ink); border-radius: var(--radius);
  padding: 1.4rem 1.5rem; box-shadow: 6px 6px 0 var(--ink);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.sheet-card:hover { transform: translate(-2px, -2px); box-shadow: 8px 8px 0 var(--coral); }
.sheet-card p, .sheet-card li { color: #34383d; }
.cards { list-style: none; margin: 0; padding: 0; display: grid; gap: 1.5rem; grid-template-columns: repeat(auto-fit, minmax(min(100%, 19rem), 1fr)); }
.cards h3 { margin-bottom: 0.6rem; }

.steps { list-style: none; counter-reset: step; margin: 0 0 2.4rem; padding: 0; display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(min(100%, 18rem), 1fr)); }
.steps li { counter-increment: step; position: relative; padding-left: 3.2rem; color: #34383d; }
.steps li::before {
  content: counter(step); position: absolute; left: 0; top: -0.1rem; width: 2.3rem; height: 2.3rem; border-radius: 50%;
  display: grid; place-items: center; border: 2px solid var(--ink); font: 700 1rem var(--display); background: var(--paper);
}
.steps strong { color: var(--ink); font-family: var(--display); }
.reqs { display: grid; gap: 1.5rem; grid-template-columns: repeat(auto-fit, minmax(min(100%, 15rem), 1fr)); }
.reqs h3 { margin-bottom: 0.6rem; }
.reqs ul { margin: 0; padding-left: 1.1rem; }
.reqs li::marker { color: var(--coral); }
.reqs li + li { margin-top: 0.35rem; }

.faq-grid { display: grid; gap: 2rem; grid-template-columns: minmax(0, 1fr) minmax(0, 1.6fr); align-items: start; }
@media (max-width: 52rem) { .faq-grid { grid-template-columns: 1fr; } }
.faq { display: grid; gap: 1rem; }
.faq details { padding: 0; }
.faq summary {
  cursor: pointer; list-style: none; padding: 1.1rem 3.2rem 1.1rem 1.4rem; position: relative;
  font: 700 1.1rem var(--display);
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after {
  content: "+"; position: absolute; right: 1.2rem; top: 50%; translate: 0 -50%; width: 1.8rem; height: 1.8rem;
  display: grid; place-items: center; border-radius: 50%; background: var(--coral); color: var(--paper); font-size: 1.2rem;
  transition: rotate 0.25s ease;
}
.faq details[open] summary::after { rotate: 45deg; }
.faq details p { padding: 0 1.4rem 1.3rem; }

/* Finale */
.finale { min-height: 120vh !important; align-items: flex-start; padding-top: calc(var(--header) + 3rem); }
.finale h2 { font-size: clamp(2.4rem, 1.4rem + 4vw, 4.6rem); }

/* ------------------------------------------------------------------ footer */
.site-footer { position: relative; z-index: 2; background: var(--night); color: var(--mist); padding: 3.5rem clamp(1rem, 5vw, 4.5rem); }
.footer-inner { display: grid; gap: 1.2rem; }
.site-footer a { color: #f16b5b; }
.site-footer a:hover { color: var(--paper); }
.legal { font-size: 0.85rem; display: grid; gap: 0.4rem; border-top: 1px solid rgba(250, 250, 248, 0.12); padding-top: 1.2rem; }

/* ------------------------------------------------------------------ small screens */
@media (max-aspect-ratio: 9/10) {
  .stage { align-items: flex-start; }
  .panel, .panel-right, .panel-center { margin: 0 auto; }
  .panel-hero { background: var(--glass); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); border-radius: var(--radius); padding: 1.2rem; }
  .stage + .stage { min-height: 125vh; }
  .scroll-cue { display: none; }
}

/* ------------------------------------------------------------------ calm mode */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .underline path { stroke-dashoffset: 0; }
}
