/* ============================================================
   talktiles explained — the speaking tile, animated.
   Same identity as the talktiles app: midnight navy + coral arcs.
   System sans only, no serif or display faces anywhere.
   Light + dark via custom properties; both WCAG-AA legible.
   ============================================================ */

:root {
  /* dark (default) — mirrors the talktiles app */
  --bg:        #0E1A2B;   /* midnight navy */
  --bg2:       #0B1524;
  --tile:      #1B2C47;   /* deep slate tile face */
  --tile2:     #22345A;
  --line:      #2C3F5F;
  --ink:       #F4EFE6;   /* warm off-white */
  --ink-dim:   #B9C3D2;
  --coral:     #FF6B57;
  --coral-press:#E0503D;
  --coral-ink: #2A0E09;   /* text on coral (AA on #FF6B57) */
  --danger:    #FF7A66;

  /* Fitzgerald key stripes (muted) — mirrors the app's corpus */
  --fitz-people:     #C9A227;
  --fitz-action:     #6E8B5B;
  --fitz-descriptor: #5B7C99;
  --fitz-noun:       #C0703B;
  --fitz-social:     #C08497;
  --fitz-question:   #8A6FB0;
  --fitz-misc:       #8A9299;

  --sans: -apple-system, "Segoe UI", Roboto, "Noto Sans", system-ui, Helvetica, Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;

  --radius: 16px;
  --radius-sm: 10px;
  --wrap: 1080px;
  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
  --shadow: 0 16px 40px -26px rgba(0,0,0,0.8);
}

@media (prefers-color-scheme: light) {
  :root {
    --bg:        #FAF6EF;  /* warm paper */
    --bg2:       #F1EADF;
    --tile:      #FFFFFF;
    --tile2:     #FBF7F0;
    --line:      #16263E;  /* navy borders */
    --ink:       #16263E;  /* navy text */
    --ink-dim:   #45566E;  /* AA on paper (4.9:1) */
    --coral:     #C13B27;  /* darker coral: AA white-on and text-on-paper */
    --coral-press:#A83322;
    --coral-ink: #FFFFFF;
    --danger:    #C23E2C;
    --shadow: 0 14px 34px -26px rgba(22,38,62,0.4);
  }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.55;
  font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* ambient depth so flat navy never reads dead */
body::before {
  content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background:
    radial-gradient(900px 480px at 88% -10%, rgba(255,107,87,0.10), transparent 62%),
    radial-gradient(760px 420px at 4% 2%, rgba(255,107,87,0.05), transparent 60%);
}

h1, h2, h3 { margin: 0; font-weight: 800; letter-spacing: -0.02em; line-height: 1.12; }
p { margin: 0; }
code { font-family: var(--mono); font-size: 0.92em; background: color-mix(in srgb, var(--coral) 16%, transparent); color: var(--ink); padding: 1px 6px; border-radius: 6px; }
em { font-style: normal; color: var(--coral); font-weight: 600; }
strong { font-weight: 700; }
a { color: var(--coral); }

.skip-link {
  position: absolute; left: 12px; top: -60px;
  background: var(--coral); color: var(--coral-ink);
  padding: 10px 16px; border-radius: 10px; font-weight: 800;
  z-index: 200; transition: top 0.18s var(--ease); text-decoration: none;
}
.skip-link:focus { top: 12px; }

a:focus-visible, button:focus-visible {
  outline: 3px solid var(--coral);
  outline-offset: 3px;
  border-radius: 8px;
}

/* ============ BUTTONS ============ */
.btn {
  display: inline-flex; align-items: center; gap: 9px;
  font: inherit; font-weight: 800; letter-spacing: -0.01em;
  padding: 12px 20px; border-radius: 999px; text-decoration: none;
  border: 1px solid transparent; cursor: pointer; transition: transform 0.12s var(--ease), background 0.15s var(--ease);
}
.btn:active { transform: translateY(1px); }
.btn--cta { background: var(--coral); color: var(--coral-ink); }
.btn--cta:hover { background: var(--coral-press); }
.btn--ghost { background: transparent; color: var(--ink); border-color: var(--line); }
.btn--ghost:hover { border-color: var(--coral); }
.btn--big { font-size: 1.2rem; padding: 16px 30px; }

/* ============ TOP BAR ============ */
.top {
  position: sticky; top: 0; z-index: 60;
  background: color-mix(in srgb, var(--bg) 90%, transparent);
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.top__row {
  max-width: var(--wrap); margin: 0 auto;
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; padding: 10px 20px;
}
.brand { display: inline-flex; align-items: center; gap: 11px; text-decoration: none; color: var(--ink); }
.brand__mark { width: 34px; height: 34px; }
.brand__word { font-weight: 800; font-size: 1.14rem; letter-spacing: -0.02em; }
.brand__sub { color: var(--ink-dim); font-weight: 700; }
.top__cta { padding: 9px 16px; font-size: 0.95rem; }
@media (max-width: 560px) { .top__cta span, .brand__sub { display: none; } .top__cta { padding: 9px 14px; } }

/* ============ HERO ============ */
.hero { padding: clamp(48px, 8vw, 96px) 20px 40px; }
.hero__inner { max-width: 860px; margin: 0 auto; text-align: center; }
.eyebrow {
  display: inline-block; font-size: 0.86rem; font-weight: 800; letter-spacing: 0.08em;
  text-transform: uppercase; color: var(--coral); margin-bottom: 18px;
}
.hero h1 { font-size: clamp(2rem, 6vw, 3.4rem); font-weight: 800; }
.lede { margin: 22px auto 0; max-width: 46ch; font-size: clamp(1.05rem, 2.4vw, 1.28rem); color: var(--ink-dim); }

.hero__demo { margin: 44px auto 8px; display: flex; flex-direction: column; align-items: center; gap: 18px; }
.speechbubble {
  position: relative; font-weight: 700; font-size: 1.15rem;
  background: var(--tile); border: 1px solid var(--line); color: var(--ink);
  padding: 12px 22px; border-radius: 14px; box-shadow: var(--shadow);
  opacity: 0; transform: translateY(6px); animation: bubbleIn 0.5s var(--ease) 0.9s forwards;
}
.speechbubble::before {
  content: ""; position: absolute; top: -8px; left: 50%; margin-left: -8px;
  width: 16px; height: 16px; background: var(--tile);
  border-left: 1px solid var(--line); border-top: 1px solid var(--line);
  transform: rotate(45deg);
}
@keyframes bubbleIn { to { opacity: 1; transform: translateY(0); } }

.hero__cues { margin-top: 40px; display: flex; gap: 14px; justify-content: center; flex-wrap: wrap; }

/* ============ THE SPEAKING TILE (motif) ============ */
.demotile {
  position: relative;
  width: 168px; height: 168px; border-radius: 26px;
  background: var(--tile); border: 1.5px solid var(--line);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px;
  box-shadow: var(--shadow);
  animation: tilePulse 3.2s var(--ease) infinite;
}
.demotile--cta { width: 130px; height: 130px; animation-duration: 3.6s; }
.demotile__emoji { font-size: 3.4rem; line-height: 1; }
.demotile--cta .demotile__emoji { font-size: 2.7rem; }
.demotile__label { font-weight: 800; font-size: 1.1rem; letter-spacing: 0.01em; }
@keyframes tilePulse {
  0%, 62%, 100% { transform: scale(1); box-shadow: var(--shadow); }
  70% { transform: scale(0.97); box-shadow: 0 0 0 4px color-mix(in srgb, var(--coral) 45%, transparent), var(--shadow); }
}

/* coral sound-arcs radiating from the corner — the hallmark motion */
.arcs, .xtile__arcs {
  position: absolute; top: 14px; right: 14px; width: 42px; height: 42px; overflow: visible;
}
.arcs .arc, .xtile__arcs path {
  fill: none; stroke: var(--coral); stroke-width: 2.4; stroke-linecap: round;
}
.arcs .arc { transform-origin: 6px 12px; opacity: 0; }
.arc1 { animation: arc 3.2s var(--ease) infinite; }
.arc2 { animation: arc 3.2s var(--ease) 0.12s infinite; }
.arc3 { animation: arc 3.2s var(--ease) 0.24s infinite; }
.demotile--cta .arc1 { animation-duration: 3.6s; }
.demotile--cta .arc2 { animation-duration: 3.6s; }
.demotile--cta .arc3 { animation-duration: 3.6s; }
@keyframes arc {
  0%, 55% { opacity: 0; transform: scale(0.5); }
  70% { opacity: 1; transform: scale(1); }
  90%, 100% { opacity: 0; transform: scale(1.15); }
}

/* ============ SCENES ============ */
.scene { padding: clamp(56px, 9vw, 104px) 20px; border-top: 1px solid var(--line); }
.scene--alt { background: var(--bg2); }
.scene__inner { max-width: var(--wrap); margin: 0 auto; }
.scene__num {
  display: inline-block; font-family: var(--mono); font-size: 0.95rem; font-weight: 700;
  color: var(--coral); letter-spacing: 0.1em; margin-bottom: 12px;
}
.scene h2 { font-size: clamp(1.5rem, 4vw, 2.3rem); max-width: 20ch; }
.scene__body { margin-top: 18px; max-width: 60ch; font-size: 1.1rem; color: var(--ink-dim); }
.scene__body strong { color: var(--ink); }
.scene__figure { margin-top: 40px; }
.figcap { margin-top: 22px; max-width: 56ch; color: var(--ink-dim); font-size: 1rem; }

/* reveal-on-scroll (JS adds .in; graceful default = visible) */
.scene__figure, .scene h2, .scene__body { opacity: 1; }
.js .reveal { opacity: 0; transform: translateY(22px); transition: opacity 0.6s var(--ease), transform 0.6s var(--ease); }
.js .reveal.in { opacity: 1; transform: none; }

/* --- 01 problem: thought line --- */
.thoughtline {
  display: flex; align-items: center; gap: 20px; flex-wrap: wrap; justify-content: center;
  background: var(--tile); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 30px; box-shadow: var(--shadow);
}
.thought { display: flex; flex-direction: column; gap: 6px; min-width: 160px; }
.thought__head { font-size: 0.92rem; color: var(--ink-dim); font-weight: 600; }
.thought__word { font-size: 1.7rem; font-weight: 800; }
.thought__word--silent { color: var(--ink-dim); font-weight: 600; font-style: italic; }
.thought__gap { width: 120px; height: 40px; flex: 0 0 auto; }
.dashpath { animation: dashmove 1.4s linear infinite; }
@keyframes dashmove { to { stroke-dashoffset: -24; } }

/* --- 02 tiles that speak --- */
.tilerow { display: flex; gap: 18px; flex-wrap: wrap; justify-content: center; padding: 0; margin: 0; list-style: none; }
.xtile {
  position: relative; width: 148px; height: 148px; border-radius: 22px;
  background: var(--tile); border: 1.5px solid var(--line); color: var(--ink);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px;
  cursor: pointer; overflow: hidden; box-shadow: var(--shadow);
  transition: transform 0.12s var(--ease), border-color 0.15s var(--ease);
  font-family: inherit;
}
.xtile:hover { transform: translateY(-3px); border-color: var(--coral); }
.xtile.speaking { border-color: var(--coral); box-shadow: 0 0 0 3px color-mix(in srgb, var(--coral) 50%, transparent), var(--shadow); }
.xtile__stripe { position: absolute; left: 0; top: 0; bottom: 0; width: 6px; background: var(--fitz-misc); }
.xtile__emoji { font-size: 3rem; line-height: 1; }
.xtile__label { font-weight: 800; font-size: 1.02rem; }
.xtile__arcs { opacity: 0; }
.xtile.speaking .xtile__arcs { opacity: 1; }
.xtile.speaking .xtile__arcs path { animation: arc 1s var(--ease) infinite; transform-origin: 6px 12px; }
.xtile.speaking .xtile__arcs path:nth-child(2) { animation-delay: 0.1s; }
.xtile.speaking .xtile__arcs path:nth-child(3) { animation-delay: 0.2s; }
.tilecaption {
  margin-top: 16px; text-align: center; font-weight: 700; font-size: 1.1rem;
  color: var(--coral);
}

/* Fitzgerald stripe/swatch colours */
[data-fitz="people"]     { background: var(--fitz-people) !important; }
[data-fitz="action"]     { background: var(--fitz-action) !important; }
[data-fitz="descriptor"] { background: var(--fitz-descriptor) !important; }
[data-fitz="noun"]       { background: var(--fitz-noun) !important; }
[data-fitz="social"]     { background: var(--fitz-social) !important; }
[data-fitz="question"]   { background: var(--fitz-question) !important; }

/* --- 03 sentence strip --- */
.strip {
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  background: var(--tile); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 20px 22px; box-shadow: var(--shadow);
}
.strip__slots { display: flex; gap: 10px; flex-wrap: wrap; flex: 1; min-width: 220px; }
.strip__chip {
  padding: 12px 18px; border-radius: 12px; font-weight: 800; font-size: 1.1rem;
  background: var(--tile2); border: 1px solid var(--line); color: var(--ink);
  opacity: 0; transform: translateY(8px) scale(0.9);
}
.js .strip__chip { animation: none; }
.strip.play .strip__chip { animation: chipIn 0.4s var(--ease) forwards; }
.strip.play .strip__chip[data-i="0"] { animation-delay: 0.1s; }
.strip.play .strip__chip[data-i="1"] { animation-delay: 0.6s; }
.strip.play .strip__chip[data-i="2"] { animation-delay: 1.1s; }
.strip.play .strip__chip[data-i="3"] { animation-delay: 1.6s; }
@keyframes chipIn { to { opacity: 1; transform: none; } }
.strip__speak {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 12px 20px; border-radius: 999px; font-weight: 800;
  background: var(--coral); color: var(--coral-ink); white-space: nowrap;
}
.strip.play .strip__speak { animation: speakPop 0.5s var(--ease) 2.2s forwards; transform: scale(1); }
@keyframes speakPop { 0% { transform: scale(1); } 40% { transform: scale(1.1); } 100% { transform: scale(1); } }

/* --- 04 key list --- */
.keylist {
  list-style: none; margin: 0; padding: 0;
  display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px;
}
.keylist li {
  display: flex; align-items: center; gap: 12px;
  background: var(--tile); border: 1px solid var(--line); border-radius: var(--radius-sm);
  padding: 14px 16px;
}
.key__swatch { width: 22px; height: 22px; border-radius: 6px; flex: 0 0 auto; box-shadow: inset 0 0 0 1px rgba(0,0,0,0.2); }
.key__name { font-weight: 800; }
.key__eg { margin-left: auto; color: var(--ink-dim); font-size: 0.92rem; }

/* --- 05 privacy vault --- */
.scene--privacy { background: linear-gradient(180deg, var(--bg) 0%, var(--bg2) 100%); }
.vault {
  display: flex; align-items: stretch; gap: 0; flex-wrap: wrap;
  border-radius: var(--radius); overflow: hidden; border: 1px solid var(--line);
  box-shadow: var(--shadow);
}
.vault__inside { flex: 1 1 300px; background: var(--tile); padding: 26px; }
.vault__outside { flex: 1 1 200px; background: var(--bg2); padding: 26px; display: flex; flex-direction: column; gap: 14px; align-items: flex-start; justify-content: center; }
.vault__title { display: block; font-weight: 800; margin-bottom: 16px; }
.vault__title--dim { color: var(--ink-dim); }
.vault__chips { display: flex; flex-direction: column; gap: 10px; }
.vchip {
  align-self: flex-start; padding: 10px 16px; border-radius: 999px; font-weight: 700;
  background: var(--tile2); border: 1px solid var(--line);
}
.vchip--dim { opacity: 0.55; }
.vault__barrier {
  flex: 0 0 auto; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 8px; padding: 20px 24px; background: var(--bg);
  border-left: 2px dashed var(--danger); border-right: 2px dashed var(--danger);
}
.vault__arrow { width: 80px; height: 40px; }
.vault__arrow path { animation: nudge 1.6s var(--ease) infinite; }
@keyframes nudge { 0%, 100% { transform: translateX(0); } 50% { transform: translateX(4px); } }
.vault__block { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.vault__blocktext { font-weight: 800; font-size: 0.8rem; color: var(--danger); text-align: center; line-height: 1.3; }
.vault__blocktext small { font-family: var(--mono); font-size: 0.72rem; }

/* --- 06 features --- */
.feat { margin-top: 40px; display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 16px; }
.feat__card { background: var(--tile); border: 1px solid var(--line); border-radius: var(--radius); padding: 24px; }
.feat__ico { font-size: 1.7rem; display: block; margin-bottom: 12px; }
.feat__card h3 { font-size: 1.16rem; }
.feat__card p { margin-top: 8px; color: var(--ink-dim); font-size: 0.98rem; }

/* ============ CTA ============ */
.cta { padding: clamp(64px, 10vw, 120px) 20px; text-align: center; border-top: 1px solid var(--line); }
.cta__inner { max-width: 640px; margin: 0 auto; }
.cta__mark { display: flex; justify-content: center; margin-bottom: 30px; }
.cta h2 { font-size: clamp(1.8rem, 5vw, 2.8rem); }
.cta p { margin: 18px auto 0; max-width: 44ch; color: var(--ink-dim); font-size: 1.12rem; }
.cta .btn--big { margin-top: 34px; }
.cta__note { font-size: 0.9rem; margin-top: 16px; }

/* ============ FOOTER ============ */
.foot { border-top: 1px solid var(--line); background: var(--bg2); padding: 40px 20px; }
.foot__inner { max-width: var(--wrap); margin: 0 auto; }
.foot__disc { font-size: 0.9rem; color: var(--ink-dim); max-width: 80ch; }
.foot__disc strong { color: var(--ink); }
.foot__meta { margin-top: 18px; font-size: 0.88rem; color: var(--ink-dim); display: flex; gap: 10px; flex-wrap: wrap; }

/* ============ REDUCED MOTION ============ */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
  /* ensure everything that starts hidden ends visible & legible */
  .speechbubble { opacity: 1 !important; transform: none !important; }
  .strip__chip { opacity: 1 !important; transform: none !important; }
  .arcs .arc, .xtile__arcs path { opacity: 1 !important; }
  .js .reveal { opacity: 1 !important; transform: none !important; }
}

/* ============ PRINT ============ */
@media print {
  body::before, .top, .hero__cues, .top__cta { display: none !important; }
  body { background: #fff; color: #000; }
  .scene, .cta { border: none; page-break-inside: avoid; }
  .arcs, .xtile__arcs { display: none; }
  a { color: #000; text-decoration: underline; }
}
