/* ---------------------------------------------------------------
   4Subtitles — shared waitlist survey (bottom sheet + casting dialog)
   Include on any page:
     <link rel="stylesheet" href="/shared/survey.css">
     <script src="/shared/survey.js" defer></script>
   Self-contained: every rule is scoped under #fs-sheet / #fs-cast and
   carries its own tokens, so it renders the same on dark and light pages.
   survey.js sets --fs-sheet-h on :root (height of the collapsed sheet);
   pages pad their content with var(--fs-sheet-h, 0px).
---------------------------------------------------------------- */

.fs-scope {
  --font-display: "Iowan Old Style", "Palatino Nova", Palatino, "Book Antiqua", Georgia, "Times New Roman", serif;
  --font-body: "Seravek", "Gill Sans Nova", "Gill Sans", Ubuntu, Calibri, "DejaVu Sans", "Trebuchet MS", sans-serif;
  --font-mono: ui-monospace, "SF Mono", "Cascadia Code", Menlo, Consolas, "DejaVu Sans Mono", monospace;
  --surface: #0e1016;
  --ink: #f2efe6;
  --muted: #8b93a3;
  --faint: #5b616e;
  --line: #20242e;
  --accent: #ff7a50;
  --accent-2: #3cbcae;
  --live: #57c98a;
  --rec: #ff5b5b;
  color-scheme: dark;
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.4;
  color: var(--ink);
  text-align: start;
  letter-spacing: normal;
  text-transform: none;
  -webkit-font-smoothing: antialiased;
  cursor: auto;
}
.fs-scope :where(*), .fs-scope :where(*)::before, .fs-scope :where(*)::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}
.fs-scope [hidden] { display: none !important; }
.fs-scope :where(button) { font: inherit; color: inherit; }
.fs-scope :focus-visible { outline: 1.5px solid var(--accent); outline-offset: 3px; border-radius: 6px; }

/* =============================== bottom sheet =============================== */

#fs-sheet {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 2147483000;
  display: flex;
  flex-direction: column;
  align-items: center;
  pointer-events: none;
  -webkit-user-select: none;
  user-select: none;
}

#fs-sheet .fs-sh-card {
  pointer-events: auto;
  position: relative;
  width: min(760px, 100%);
  padding: 12px 54px calc(12px + env(safe-area-inset-bottom, 0px)) 20px;
  border: 1px solid transparent;
  border-bottom: 0;
  border-radius: 16px 16px 0 0;
  background:
    linear-gradient(var(--surface), var(--surface)) padding-box,
    linear-gradient(165deg,
      color-mix(in srgb, var(--accent) 34%, transparent),
      rgba(38,42,54,.8) 30%,
      rgba(38,42,54,.6) 70%,
      color-mix(in srgb, var(--accent-2) 22%, transparent)) border-box;
  box-shadow: 0 -22px 60px -28px rgba(0,0,0,.85);
}
/* motion only after the visitor acts — the sheet never moves on its own */
#fs-sheet.fs-acted .fs-sh-card,
#fs-sheet.fs-acted .fs-pill { animation: fs-rise .32s cubic-bezier(.2,.8,.2,1); }
#fs-sheet.fs-acted .fs-sh-step { animation: fs-step-in .26s ease; }

#fs-sheet .fs-sh-step {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px 14px;
}
#fs-sheet .fs-sh-lead {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 4px 12px;
  min-width: 0;
  flex: 1 1 260px;
}
#fs-sheet .fs-sh-k {
  font-family: var(--font-mono);
  font-size: .66em;
  letter-spacing: .26em;
  color: var(--accent);
  white-space: nowrap;
}
#fs-sheet .fs-sh-q {
  font-size: .95em;
  font-weight: 600;
  letter-spacing: .01em;
  color: var(--ink);
}
#fs-sheet #fs-sh-step2 { flex-direction: column; align-items: center; text-align: center; gap: 11px; padding-top: 4px; }
#fs-sheet .fs-sh-ask {
  font-size: .95em;
  font-weight: 600;
  letter-spacing: .01em;
  color: var(--ink);
  padding-bottom: 5px;
  background: linear-gradient(var(--accent), var(--accent)) no-repeat left bottom / 100% 2px;
}
#fs-sheet .fs-sh-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
#fs-sheet #fs-sh-step2 .fs-sh-chips { justify-content: center; }

#fs-sheet .fs-pchip {
  min-height: 38px;
  padding: 7px 14px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(255,255,255,.03);
  color: var(--muted);
  font-family: var(--font-body);
  font-size: .86em;
  line-height: 1.2;
  cursor: pointer;
  transition: border-color .16s ease, background .16s ease, color .16s ease, transform .16s ease;
}
#fs-sheet .fs-pchip:hover, #fs-sheet .fs-pchip:focus-visible {
  transform: translateY(-1px);
  border-color: color-mix(in srgb, var(--accent) 45%, var(--line));
  color: var(--ink);
}
#fs-sheet .fs-pchip[aria-pressed="true"] {
  border-color: var(--accent);
  background: rgba(255,122,80,.11);
  color: var(--ink);
}
#fs-sheet .fs-pchip .fs-yt { vertical-align: -1.5px; margin-inline-end: 1px; }

#fs-sheet .fs-sh-go {
  border: 0;
  background: none;
  color: var(--accent);
  font-family: var(--font-body);
  font-weight: 600;
  font-size: .9em;
  cursor: pointer;
  padding: 8px 12px;
  border-radius: 10px;
  transition: transform .16s ease;
}
#fs-sheet .fs-sh-go:hover, #fs-sheet .fs-sh-go:focus-visible { transform: translateY(-1px); text-decoration: underline dotted; text-underline-offset: 4px; }

#fs-sheet .fs-sh-x {
  position: absolute;
  top: 8px;
  inset-inline-end: 10px;
  width: 34px;
  height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid transparent;
  border-radius: 999px;
  background: none;
  color: var(--faint);
  font-family: var(--font-mono);
  font-size: 1.05em;
  line-height: 1;
  cursor: pointer;
  transition: color .15s ease, border-color .15s ease;
}
#fs-sheet .fs-sh-x:hover, #fs-sheet .fs-sh-x:focus-visible { color: var(--ink); border-color: var(--line); }

/* the small pill: dismissed ("waitlist") or done ("✓ you're on the waitlist") */
#fs-sheet .fs-pill {
  pointer-events: auto;
  display: inline-flex;
  align-items: center;
  gap: 9px;
  min-height: 34px;
  margin-bottom: calc(10px + env(safe-area-inset-bottom, 0px));
  padding: 7px 16px;
  border-radius: 999px;
  border: 1px solid color-mix(in srgb, var(--accent) 40%, var(--line));
  background: var(--surface);
  box-shadow: 0 10px 30px -14px rgba(0,0,0,.9);
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: .68em;
  letter-spacing: .18em;
  cursor: pointer;
  transition: color .16s ease, border-color .16s ease, transform .16s ease;
}
#fs-sheet .fs-pill:hover, #fs-sheet .fs-pill:focus-visible { color: var(--ink); transform: translateY(-1px); border-color: var(--accent); }
#fs-sheet .fs-pill .fs-pill-mark { color: var(--accent); letter-spacing: 0; }
#fs-sheet[data-state="done"] .fs-pill { border-color: color-mix(in srgb, var(--live) 50%, var(--line)); }
#fs-sheet[data-state="done"] .fs-pill .fs-pill-mark { color: var(--live); }

@media (max-width: 560px) {
  #fs-sheet .fs-sh-card { padding: 10px 46px calc(10px + env(safe-area-inset-bottom, 0px)) 14px; border-radius: 14px 14px 0 0; }
  #fs-sheet .fs-sh-lead { flex-basis: 100%; }
  #fs-sheet .fs-sh-q { font-size: .9em; }
  #fs-sheet .fs-sh-x { top: 6px; inset-inline-end: 6px; }
  #fs-sheet .fs-pchip { padding: 7px 12px; }
}
@media (pointer: coarse) {
  #fs-sheet .fs-pchip, #fs-sheet .fs-sh-go { min-height: 44px; }
  #fs-sheet .fs-sh-x { width: 44px; height: 44px; top: 2px; inset-inline-end: 2px; }
  #fs-sheet .fs-pill { min-height: 44px; }
}

/* ============================= casting dialog ============================= */

dialog#fs-cast {
  width: min(580px, calc(100vw - 28px));
  max-width: none;
  max-height: min(86svh, 720px);
  margin: auto;
  border: 1px solid transparent;
  border-radius: 18px;
  background:
    linear-gradient(var(--surface), var(--surface)) padding-box,
    linear-gradient(165deg,
      color-mix(in srgb, var(--accent) 38%, transparent),
      rgba(38,42,54,.75) 32%,
      rgba(38,42,54,.55) 68%,
      color-mix(in srgb, var(--accent-2) 26%, transparent)) border-box;
  color: var(--ink);
  padding: 0;
  box-shadow:
    0 60px 140px -38px rgba(0,0,0,.95),
    0 0 60px -30px color-mix(in srgb, var(--accent) 35%, transparent),
    inset 0 1px 0 rgba(255,255,255,.05);
  overflow: hidden;
  position: fixed;
  inset: 0;
  -webkit-user-select: text;
  user-select: text;
}
dialog#fs-cast:not([open]) { display: none; }
dialog#fs-cast::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: .045;
  mix-blend-mode: soft-light;
  background-image: url("data:image/svg+xml,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20width='140'%20height='140'%3E%3Cfilter%20id='n'%3E%3CfeTurbulence%20type='fractalNoise'%20baseFrequency='0.9'%20numOctaves='2'%20stitchTiles='stitch'/%3E%3C/filter%3E%3Crect%20width='100%25'%20height='100%25'%20filter='url(%23n)'/%3E%3C/svg%3E");
}
dialog#fs-cast::backdrop {
  background: rgba(4,5,8,.66);
  -webkit-backdrop-filter: blur(10px) saturate(.8);
  backdrop-filter: blur(10px) saturate(.8);
}
dialog#fs-cast[open] { animation: fs-cast-in .5s cubic-bezier(.16, 1.28, .32, 1); }

#fs-cast .fs-cast-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 12px 10px 20px;
  border-bottom: 1px solid var(--line);
}
#fs-cast .fs-scene {
  font-family: var(--font-mono);
  font-size: .68em;
  letter-spacing: .3em;
  color: var(--muted);
}
#fs-cast .fs-dot { color: var(--accent); }
#fs-cast .fs-cast-x {
  border: 0;
  background: none;
  color: var(--faint);
  font-size: 1.1em;
  line-height: 1;
  min-width: 36px;
  min-height: 36px;
  padding: 4px 8px;
  cursor: pointer;
  border-radius: 8px;
  transition: color .15s ease;
}
#fs-cast .fs-cast-x:hover, #fs-cast .fs-cast-x:focus-visible { color: var(--ink); }

#fs-cast .fs-cast-body {
  padding: 24px 22px 26px;
  overflow-y: auto;
  max-height: calc(min(86svh, 720px) - 58px);
}
#fs-cast .fs-step { animation: fs-step-in .24s ease; }

#fs-cast .fs-kicker {
  font-family: var(--font-mono);
  font-size: .64em;
  letter-spacing: .34em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 10px;
}
#fs-cast .fs-big {
  font-family: var(--font-display);
  font-style: italic;
  font-weight: 500;
  font-size: clamp(24px, 5.4vw, 32px);
  line-height: 1.2;
  letter-spacing: .002em;
  margin-bottom: 10px;
  color: var(--ink);
}
#fs-cast .fs-sub {
  font-size: .93em;
  line-height: 1.55;
  color: var(--muted);
  max-width: 46ch;
}
#fs-cast .fs-sub b { color: var(--ink); font-weight: 600; }
#fs-cast .fs-ask {
  margin-top: 20px;
  font-size: .96em;
  font-weight: 650;
  color: var(--ink);
  letter-spacing: .01em;
}

#fs-cast .fs-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
  margin-top: 18px;
}
#fs-cast .fs-chip {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 9px 17px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: rgba(255,255,255,.025);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: .92em;
  line-height: 1.25;
  text-align: start;
  cursor: pointer;
  transition: border-color .15s ease, background .15s ease, transform .15s ease;
}
#fs-cast .fs-chip:hover, #fs-cast .fs-chip:focus-visible { border-color: color-mix(in srgb, var(--accent) 55%, var(--line)); transform: translateY(-1px); }
#fs-cast .fs-chip.fs-on {
  border-color: var(--accent);
  background: rgba(255,122,80,.13);
  color: var(--ink);
}
#fs-cast .fs-em { margin-inline-end: 7px; display: inline-flex; align-items: center; }
#fs-cast .fs-em .fs-brand-ic { vertical-align: middle; }
#fs-cast .fs-chip-more {
  font-size: 1.25em;
  line-height: 1;
  padding: 0;
  width: 46px;
  justify-content: center;
  color: var(--muted);
}
#fs-cast .fs-chip-more:hover { color: var(--accent); }

#fs-cast .fs-chip-group { display: flex; align-items: baseline; gap: 14px; margin-top: 12px; }
#fs-cast .fs-chip-group:first-of-type { margin-top: 20px; }
#fs-cast .fs-cg-label {
  flex: none;
  width: 76px;
  text-align: end;
  font-family: var(--font-mono);
  font-size: .62em;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--faint);
}
#fs-cast .fs-cg-chips { margin-top: 0; }

/* the full-language searcher */
#fs-cast .fs-lang-search { margin-top: 16px; display: flex; flex-direction: column; gap: 10px; }
#fs-cast .fs-lang-results {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 6px;
  max-height: 240px;
  overflow-y: auto;
  padding: 2px;
  scrollbar-width: thin;
}
#fs-cast .fs-lang-res {
  display: flex;
  align-items: center;
  gap: 9px;
  text-align: start;
  padding: 9px 12px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: rgba(255,255,255,.02);
  color: var(--ink);
  font-family: var(--font-body);
  cursor: pointer;
  transition: border-color .14s ease, background .14s ease;
}
#fs-cast .fs-lang-res:hover, #fs-cast .fs-lang-res:focus-visible { border-color: color-mix(in srgb, var(--accent) 50%, var(--line)); background: rgba(255,122,80,.08); }
#fs-cast .fs-lr-en { font-size: .9em; font-weight: 550; }
#fs-cast .fs-lr-na { font-size: .78em; color: var(--muted); margin-inline-start: auto; padding-inline-start: 8px; }
#fs-cast .fs-lr-none { color: var(--muted); font-size: .85em; padding: 10px 4px; }

#fs-cast .fs-other { margin-top: 14px; display: flex; gap: 9px; }

#fs-cast .fs-input,
#fs-cast .fs-ta {
  min-width: 0;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: rgba(255,255,255,.03);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: .95em;
  transition: border-color .15s ease;
}
#fs-cast .fs-input { flex: 1; min-height: 46px; padding: 11px 15px; width: 100%; }
#fs-cast .fs-ta { width: 100%; min-height: 92px; margin-top: 18px; padding: 12px 15px; line-height: 1.5; resize: vertical; }
#fs-cast .fs-input:focus, #fs-cast .fs-ta:focus { outline: none; border-color: var(--accent); }
#fs-cast .fs-input.fs-bad { border-color: var(--rec); animation: fs-shake .3s ease; }
#fs-cast .fs-input::placeholder, #fs-cast .fs-ta::placeholder { color: var(--faint); opacity: 1; }

#fs-cast .fs-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 22px;
  flex-wrap: wrap;
}
#fs-cast .fs-go {
  min-height: 46px;
  padding: 11px 26px;
  border-radius: 12px;
  border: 1px solid var(--accent);
  background: var(--accent);
  color: #14100c;
  font-family: var(--font-body);
  font-weight: 700;
  font-size: .95em;
  cursor: pointer;
  transition: transform .15s ease, box-shadow .15s ease, opacity .15s ease;
}
#fs-cast .fs-go:hover:not(:disabled), #fs-cast .fs-go:focus-visible { transform: translateY(-1px); box-shadow: 0 8px 26px -10px rgba(255,122,80,.6); }
#fs-cast .fs-go:disabled { opacity: .55; cursor: default; }
#fs-cast .fs-skip {
  border: 0;
  background: none;
  color: var(--faint);
  font-size: .85em;
  cursor: pointer;
  padding: 8px 10px;
  border-radius: 8px;
  transition: color .15s ease;
}
#fs-cast .fs-skip:hover { color: var(--muted); text-decoration: underline dotted; }

#fs-cast .fs-fine { margin-top: 16px; font-size: .74em; line-height: 1.6; color: var(--faint); }
#fs-cast .fs-err { margin-top: 12px; font-size: .82em; color: var(--rec); min-height: 1.2em; }
#fs-cast .fs-hp { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; }

@media (max-width: 560px) {
  #fs-cast .fs-chip-group { flex-direction: column; align-items: flex-start; gap: 8px; }
  #fs-cast .fs-cg-label { width: auto; text-align: start; }
}

/* Arabic-script, Indic and CJK labels: tracking breaks joining — keep it at 0 */
#fs-sheet.fs-notrack .fs-sh-k, #fs-sheet.fs-notrack .fs-pill, #fs-cast.fs-notrack .fs-kicker, #fs-cast.fs-notrack .fs-cg-label, #fs-cast.fs-notrack .fs-scene { letter-spacing: 0; }
#fs-sheet.fs-notrack .fs-sh-k, #fs-sheet.fs-notrack .fs-pill { font-family: var(--font-body); font-size: .76em; }

@keyframes fs-cast-in {
  from { opacity: 0; transform: translateY(26px) scale(.955); }
  to   { opacity: 1; transform: none; }
}
@keyframes fs-step-in {
  from { opacity: 0; transform: translateY(12px); filter: blur(7px); }
  to   { opacity: 1; transform: none; filter: none; }
}
@keyframes fs-rise {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: none; }
}
@keyframes fs-shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-5px); }
  75% { transform: translateX(5px); }
}

@media (prefers-reduced-motion: reduce) {
  .fs-scope, .fs-scope *, .fs-scope *::before, .fs-scope *::after { animation: none !important; transition: none !important; }
}
