/* ============================================================
   TTWM.world - holding site
   Design tokens lifted from the product:
   - black ground + Mokoto glitch display (chapter 1 epilogue)
   - teal #60d6b6 interactive accent (play button, reward UI)
   - coral #e6797e + violet + lime facet shards (cassette art)
   - cream cassette shell #e8d9bd family (tape assets)
   - Felix Clean brush script (tape labels), Courier (cassette legends)
   ============================================================ */

@font-face {
  font-family: 'Mokoto';
  src: url('/assets/fonts/mokoto.ttf') format('truetype');
  font-weight: normal;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Mokoto Glitch 1';
  src: url('/assets/fonts/mokoto-glitch1.ttf') format('truetype');
  font-display: swap;
}
@font-face {
  font-family: 'Mokoto Glitch 2';
  src: url('/assets/fonts/mokoto-glitch2.ttf') format('truetype');
  font-display: swap;
}
@font-face {
  font-family: 'Felix Clean';
  src: url('/assets/fonts/felix-clean.ttf') format('truetype');
  font-display: swap;
}

:root {
  --black: #0a0a0c;
  --panel: #16161c;
  --line: #2e2e38;
  --cream: #e8d9bd;
  --cream-bright: #f5ecd7;
  --mint: #60d6b6;
  --mint-ink: #0d1f14;
  --coral: #e6797e;
  --violet: #a08ac2;
  --text: #d9d2c4;
  --muted: #8a8494;
  --mono: 'Courier New', Courier, monospace;
  --body: system-ui, -apple-system, 'Segoe UI', sans-serif;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html {
  background: var(--black);
  scroll-behavior: smooth;
}

body {
  position: relative; /* containing block for the absolutely-positioned tape ribbon */
  background:
    radial-gradient(1200px 700px at 70% -10%, rgba(160, 138, 194, 0.08), transparent 60%),
    radial-gradient(900px 600px at 10% 40%, rgba(96, 214, 182, 0.05), transparent 55%),
    var(--black);
  color: var(--text);
  font-family: var(--body);
  font-size: 17px;
  line-height: 1.6;
  overflow-x: hidden;
  min-height: 100vh;
}

.mono { font-family: var(--mono); }
.script { font-family: 'Felix Clean', cursive; }

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

a { color: var(--mint); }
a:focus-visible, button:focus-visible, input:focus-visible {
  outline: 2px solid var(--mint);
  outline-offset: 3px;
}

/* ---------- ambient facet shards ---------- */
.shards { position: fixed; inset: 0; pointer-events: none; z-index: 0; }
.shard {
  position: absolute;
  width: 90px; height: 90px;
  opacity: 0.10;
  will-change: transform;
}
.shard.s1 { top: 12%; left: 6%; width: 70px; }
.shard.s2 { top: 30%; right: 8%; width: 110px; }
.shard.s3 { top: 55%; left: 12%; width: 60px; }
.shard.s4 { top: 72%; right: 14%; width: 80px; }
.shard.s5 { top: 90%; left: 40%; width: 100px; }

/* ---------- hero ---------- */
.hero {
  position: relative;
  z-index: 2;
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 48px 20px 16px;
  gap: 22px;
}

.eyebrow {
  font-size: 12px;
  letter-spacing: 0.35em;
  color: var(--muted);
  text-transform: uppercase;
}

.title {
  font-family: 'Mokoto', var(--body);
  font-weight: normal;
  color: var(--cream-bright);
  font-size: clamp(40px, 9vw, 96px);
  line-height: 1.02;
  letter-spacing: 0.06em;
  display: flex;
  flex-direction: column;
  text-wrap: balance;
}
.title .line { display: block; }

/* glitch flicker: JS briefly adds .glitching */
.title.glitching .line:first-child {
  font-family: 'Mokoto Glitch 1', 'Mokoto', var(--body);
  transform: translateX(-2px);
  color: var(--mint);
  text-shadow: 3px 0 var(--coral), -3px 0 rgba(160, 138, 194, 0.8);
}
.title.glitching .line:last-child {
  font-family: 'Mokoto Glitch 2', 'Mokoto', var(--body);
  transform: translateX(2px) skewX(-1deg);
  text-shadow: -3px 0 var(--mint), 3px 0 var(--coral);
}

.tagline {
  color: var(--muted);
  font-size: clamp(15px, 2.2vw, 19px);
  line-height: 1.55;
}

/* ---------- cassette ---------- */
.cassette-stage {
  width: min(560px, 92vw);
  margin-top: 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 26px;
}
#cassette {
  width: 100%;
  height: auto;
  filter: drop-shadow(0 24px 60px rgba(0, 0, 0, 0.65));
}
.label-script {
  font-family: 'Felix Clean', cursive;
  font-size: 44px;
  fill: #3a3428;
}
.label-mono {
  font-family: var(--mono);
  font-size: 17px;
  letter-spacing: 6px;
  fill: #8a7c5e;
}
.hub { will-change: transform; }

.hint {
  font-size: 11px;
  letter-spacing: 0.35em;
  color: var(--muted);
  opacity: 0.85;
  transition: opacity 0.6s ease;
}
.hint-arrow { display: inline-block; animation: bob 2.2s ease-in-out infinite; }
@keyframes bob {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(4px); }
}
.hint.hidden { opacity: 0; }

/* ---------- tape ribbon ---------- */
.ribbon-wrap {
  position: absolute;
  z-index: 0;
  left: 50%;
  transform: translateX(-50%);
  width: min(720px, 96vw);
  /* top set by JS to start where the hero ends */
  top: 100svh;
  bottom: 0;
  overflow: hidden;
  pointer-events: none;
}
#ribbon { width: 100%; height: 100%; }

/* ---------- story fragments ---------- */
main { position: relative; z-index: 2; }

.frag {
  max-width: 560px;
  margin: 0 auto;
  padding: 22vh 24px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.frag-right { align-items: flex-end; text-align: right; }

.frag-index {
  font-size: 12px;
  letter-spacing: 0.3em;
  color: var(--mint);
  opacity: 0.75;
}
.frag-quote p {
  font-size: clamp(20px, 3.4vw, 28px);
  line-height: 1.5;
  color: var(--text);
  font-weight: 300;
  max-width: 26ch;
  text-wrap: balance;
}
.frag-note {
  font-size: 26px;
  color: var(--coral);
  opacity: 0.85;
  transform: rotate(-2deg);
}
.frag-right .frag-note { transform: rotate(2deg); }

/* ---------- chapter CTA ---------- */
.chapter {
  position: relative;
  max-width: 640px;
  margin: 0 auto;
  padding: 6vh 24px 15vh;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
}
.chapter-lead {
  font-size: clamp(14px, 1.9vw, 18px);
  color: var(--text);
  line-height: 1.6;
}
.chapter-lead .script {
  font-size: 1.4em;
  color: var(--coral);
  white-space: nowrap;
}
.chapter-lead-sub {
  font-size: clamp(15px, 2vw, 17px);
  color: var(--muted);
  margin-top: -6px;
}
.chapter-title {
  font-family: 'Mokoto', var(--body);
  font-weight: normal;
  font-size: clamp(30px, 6vw, 54px);
  letter-spacing: 0.1em;
  color: var(--cream-bright);
}
.chapter-copy {
  color: var(--muted);
  max-width: 46ch;
}
.play-cta {
  display: inline-flex;
  align-items: center;
  gap: 14px;
  margin-top: 8px;
  padding: 18px 40px;
  border-radius: 999px;
  background: var(--mint);
  color: var(--mint-ink);
  text-decoration: none;
  font-family: 'Mokoto', var(--body);
  font-size: 20px;
  letter-spacing: 0.14em;
  box-shadow: 0 10px 40px rgba(96, 214, 182, 0.35), 0 0 0 1px rgba(255, 255, 255, 0.2) inset;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.play-cta svg { width: 26px; height: 26px; }
.play-cta:hover {
  transform: scale(1.045);
  box-shadow: 0 14px 55px rgba(96, 214, 182, 0.5), 0 0 0 1px rgba(255, 255, 255, 0.3) inset;
}
.play-cta:active { transform: scale(0.98); }
.chapter-meta {
  font-size: 11px;
  letter-spacing: 0.3em;
  color: var(--muted);
}

/* ---------- the poster (the other way in) ---------- */
.poster {
  max-width: 880px;
  margin: 0 auto;
  padding: 14vh 24px 6vh;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 56px;
  flex-wrap: wrap;
}
.poster-frame {
  position: relative;
  flex: 0 1 300px;
  transform: rotate(-2.2deg);
}
.poster-frame img {
  display: block;
  width: 100%;
  height: auto;
  /* no added frame - the artwork carries its own off-white border */
  box-shadow: 0 26px 70px rgba(0, 0, 0, 0.6);
}
.poster-tape {
  position: absolute;
  width: 74px;
  height: 22px;
  background: rgba(232, 217, 189, 0.75);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
  z-index: 2;
}
.poster-tape.pt-1 { top: -10px; left: -24px; transform: rotate(-38deg); }
.poster-tape.pt-2 { bottom: -8px; right: -26px; transform: rotate(-42deg); }
.poster-copy {
  flex: 1 1 320px;
  max-width: 420px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.poster-title {
  font-family: 'Mokoto', var(--body);
  font-weight: normal;
  font-size: clamp(24px, 3.8vw, 33px);
  letter-spacing: 0.08em;
  line-height: 1.12;
  color: var(--cream-bright);
}
.poster-body { color: var(--muted); max-width: 44ch; }
.poster-note {
  font-size: 26px;
  color: var(--coral);
  transform: rotate(-1.5deg);
}
.poster-meta {
  font-size: 11px;
  letter-spacing: 0.25em;
  color: var(--mint);
  opacity: 0.8;
  margin-top: 14px;
}
@media (max-width: 700px) {
  .poster { gap: 40px; padding: 10vh 24px; }
  .poster-frame { flex-basis: 240px; }
  .poster-copy { text-align: center; align-items: center; }
}

/* ---------- signup ---------- */
.signup {
  padding: 14vh 24px 18vh;
  display: flex;
  justify-content: center;
}
.signup-card {
  width: min(560px, 100%);
  background: linear-gradient(180deg, #f7efdd, #ead9b8);
  border-radius: 16px;
  border: 2px solid #d8caa9;
  padding: 44px 40px 36px;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 14px;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.5);
  position: relative;
  overflow: hidden;
}
/* label stripes - like a cassette label card */
.signup-card::before {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 8px;
  background: linear-gradient(90deg, var(--mint) 0 25%, var(--coral) 25% 50%, var(--violet) 50% 75%, #e1be69 75% 100%);
}
.signup .eyebrow { color: #8a7c5e; }
.signup-title {
  font-family: 'Mokoto', var(--body);
  font-weight: normal;
  color: #2c2618;
  font-size: clamp(24px, 4.4vw, 34px);
  letter-spacing: 0.06em;
  line-height: 1.15;
}
.signup-copy {
  font-size: 30px;
  color: #a4552e;
  transform: rotate(-1.5deg);
}
#signup-form {
  display: flex;
  gap: 10px;
  margin-top: 10px;
}
#signup-form input[type="email"] {
  flex: 1;
  min-width: 0;
  padding: 14px 18px;
  border-radius: 10px;
  border: 2px solid #c9b590;
  background: #fffdf6;
  color: #2c2618;
  font-family: var(--mono);
  font-size: 15px;
}
#signup-form input[type="email"]::placeholder { color: #b0a181; }
#tapedeck { display: none; }
#signup-btn {
  padding: 14px 24px;
  border-radius: 10px;
  border: none;
  background: #d13b3b;
  color: #fff;
  font-family: var(--mono);
  font-weight: bold;
  font-size: 15px;
  letter-spacing: 0.08em;
  cursor: pointer;
  transition: transform 0.15s ease, background 0.2s ease;
}
#signup-btn:hover { background: #e04848; transform: scale(1.04); }
#signup-btn:active { transform: scale(0.97); }
#signup-btn:disabled { background: #b0a181; cursor: wait; transform: none; }
.signup-status {
  min-height: 1.2em;
  font-size: 13px;
  letter-spacing: 0.08em;
  color: #2c7a5e;
}
.signup-status.error { color: #b03434; }
.signup-legal {
  font-size: 10px;
  letter-spacing: 0.18em;
  color: #a4977a;
}
.signup-legal a {
  color: #8a7c5e;
  text-decoration: underline;
  text-underline-offset: 2px;
}
.signup-legal a:hover { color: #6e6047; }

/* ---------- footer ---------- */
footer {
  position: relative;
  z-index: 2;
  padding: 56px 24px 88px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  border-top: 1px solid var(--line);
}
.scrawl {
  width: 140px;
  height: auto;
  opacity: 0.9;
}
.footer-line { color: var(--muted); font-size: 15px; }
.footer-line a { color: var(--cream); }
/* the little reward - socials block above the footer */
.socials-reward {
  padding: 4vh 24px 12vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 16px;
}
.reward-copy {
  color: var(--muted);
  max-width: 44ch;
}
.reward-links {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px 14px;
  font-size: 15px;
  letter-spacing: 0.25em;
}
.reward-links a {
  color: var(--cream);
  text-decoration: none;
  padding: 6px 2px;
  border-bottom: 1px solid var(--line);
  transition: color 0.2s ease, border-color 0.2s ease;
}
.reward-links a:hover { color: var(--mint); border-color: var(--mint); }
.reward-links .sep { color: var(--line); font-size: 16px; }
.footer-meta {
  font-size: 11px;
  letter-spacing: 0.25em;
  color: var(--muted);
}
.footer-meta a { color: var(--muted); }

/* ---------- reveal on scroll (progressive enhancement: hidden only when JS runs) ---------- */
html.js [data-reveal] {
  opacity: 0;
  transform: translateY(28px);
  transition: opacity 0.9s ease, transform 0.9s ease;
}
html.js [data-reveal].revealed {
  opacity: 1;
  transform: none;
}


/* text protection: a soft dark halo so the tape reads as behind the words */
.frag-quote p,
.chapter-lead,
.chapter-lead-sub,
.chapter-copy,
.poster-body,
.reward-copy {
  text-shadow: 0 1px 14px rgba(10, 10, 12, 0.95), 0 0 26px rgba(10, 10, 12, 0.8);
}

/* ---------- motion safety ---------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  html.js [data-reveal] { opacity: 1; transform: none; transition: none; }
  .hint-arrow { animation: none; }
  .title.glitching .line { font-family: 'Mokoto', var(--body) !important; transform: none !important; text-shadow: none !important; color: var(--cream-bright) !important; }
}

/* ---------- static test mode (?static=1): everything visible, hero compact ---------- */
html.static-test [data-reveal] { opacity: 1 !important; transform: none !important; transition: none !important; }
html.static-test .hero { min-height: 620px; }
html.static-test { scroll-behavior: auto; }
html.static-test .frag { padding: 90px 24px; }
html.static-test .chapter { padding: 90px 24px; }
html.static-test .signup { padding: 90px 24px 120px; }

/* ---------- small screens ---------- */
@media (max-width: 560px) {
  .frag { padding: 16vh 22px; }
  #signup-form { flex-direction: column; }
  .label-script { font-size: 52px; }
}
