/* ─────────────────────────────────────────────────────────────────────────
   FatFish Digital viewer chrome.
   Palette + typography mirrors fatfishdigital.co.uk so the static frame
   around the video reads as a continuation of the brand.
   ───────────────────────────────────────────────────────────────────── */
:root {
  /* Ink / text */
  --ink:      #12171B;     /* FatFish near-black */
  --ink-soft: #1B2128;
  --text:     #3A3F45;
  --slate:    #5E5950;     /* warm body grey */

  /* Surfaces */
  --bg:       #EDEAE8;     /* FatFish cream */
  --bg-hi:    #F5F2EF;
  --card:     #FFFFFF;

  /* Lines */
  --rule:      #D6D2CD;
  --rule-soft: #E2DED9;

  /* Accents */
  --accent:      #F08300;  /* FatFish orange */
  --accent-deep: #C16800;
  --good:        #3D6B4F;
  --warn:        #B5523A;

  /* Typography */
  --serif: "DM Serif Display", "Cormorant Garamond", "Freight Display Pro", Georgia, serif;
  --sans:  "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;

  color-scheme: light;
}

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* `display: flex/grid` on a styled element overrides the UA stylesheet's
   `display: none` for `[hidden]`. Force it back so .thanks / .empty stay
   hidden until the JS un-hides them. */
[hidden] { display: none !important; }

/* ───── Header ───── */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 28px;
  border-bottom: 1px solid var(--rule);
  background: var(--card);
  gap: 16px;
}
.brand-mark {
  display: inline-flex;
  align-items: center;
  gap: 14px;
  color: var(--ink);
  text-decoration: none;
}
.brand-wordmark {
  width: 96px;
  height: auto;
  display: block;
  color: var(--ink);
}
.brand-tag {
  display: inline-block;
  font-family: var(--serif);
  font-style: italic;
  font-size: 16px;
  color: var(--accent);
  padding-left: 14px;
  margin-left: 2px;
  border-left: 1px solid var(--rule);
  line-height: 1;
  position: relative;
  top: 1px;
}
.brand-mark:hover .brand-tag { color: var(--accent-deep); }
.meta {
  font-size: 13px;
  color: var(--slate);
  font-variant-numeric: tabular-nums;
  text-align: right;
  line-height: 1.4;
  max-width: 60%;
}
.meta strong {
  color: var(--ink);
  font-weight: 600;
}

/* ───── Stage ───── */
.stage {
  flex: 1;
  max-width: 1280px;
  width: 100%;
  margin: 0 auto;
  padding: 32px 28px 48px;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.player-wrap {
  position: relative;
  background: #000;
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 4px 32px rgba(18, 23, 27, 0.14);
  aspect-ratio: 16 / 9;
}
#player {
  width: 100%;
  height: 100%;
  display: block;
  background: #000;
}

/* ───── Progress strip below player ───── */
.progress-row {
  display: grid;
  grid-template-columns: 1fr 64px;
  gap: 16px;
  align-items: center;
  padding: 0 4px;
}
.progress-bar {
  height: 6px;
  background: var(--rule);
  border-radius: 3px;
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--accent) 0%, var(--ink) 100%);
  border-radius: 3px;
  transition: width 0.2s linear;
}
.progress-pct {
  font-family: ui-monospace, SFMono-Regular, "JetBrains Mono", monospace;
  font-size: 13px;
  font-weight: 600;
  color: var(--slate);
  text-align: right;
  font-variant-numeric: tabular-nums;
}

/* ───── Completion card ───── */
.thanks {
  margin-top: 12px;
  padding: 28px 32px;
  background: var(--card);
  border: 1px solid var(--rule);
  border-left: 4px solid var(--accent);
  border-radius: 14px;
  display: flex;
  align-items: center;
  gap: 22px;
  animation: rise 0.4s ease-out;
}
.thanks-tick {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--accent);
  color: var(--card);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 26px;
  font-weight: 700;
}
.thanks-h {
  font-family: var(--serif);
  font-size: 26px;
  font-weight: 400;
  color: var(--ink);
  letter-spacing: -0.01em;
  line-height: 1.15;
}
.thanks-sub {
  font-size: 14px;
  color: var(--slate);
  margin-top: 4px;
  line-height: 1.5;
}
.thanks-sub em {
  font-family: var(--serif);
  font-style: italic;
  color: var(--accent);
  font-weight: 400;
}
.thanks > div:nth-child(2) { flex: 1; }
@keyframes rise {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ───── Empty state ───── */
.empty {
  margin: 60px auto;
  max-width: 560px;
  padding: 48px;
  text-align: center;
  background: var(--card);
  border: 1px dashed var(--rule);
  border-radius: 16px;
}
.empty-h {
  font-family: var(--serif);
  font-size: 26px;
  font-weight: 400;
  color: var(--ink);
  margin-bottom: 10px;
  letter-spacing: -0.01em;
}
.empty-sub {
  font-size: 14px;
  color: var(--slate);
  line-height: 1.6;
}
.empty code {
  background: var(--bg);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 13px;
}

/* ───── Footer ───── */
.page-footer {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  padding: 14px 28px;
  border-top: 1px solid var(--rule);
  font-size: 12px;
  color: var(--slate);
  background: var(--card);
  gap: 16px;
}
.footer-brand {
  font-family: var(--sans);
  letter-spacing: 0.02em;
}
.footer-brand a {
  color: var(--accent);
  text-decoration: none;
  font-weight: 600;
}
.footer-brand a:hover {
  color: var(--accent-deep);
  text-decoration: underline;
  text-underline-offset: 3px;
}
.footer-meta {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  font-family: ui-monospace, SFMono-Regular, monospace;
  font-size: 11px;
  color: var(--slate);
}
.status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-weight: 600;
}
.status::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--slate);
}
.status-idle::before    { background: #C9CCD2; }
.status-playing::before { background: var(--good); animation: pulse 1.6s ease-in-out infinite; }
.status-paused::before  { background: var(--accent); }
.status-ended::before   { background: var(--good); }
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50%      { opacity: 0.35; }
}
.tracked { opacity: 0.7; }

/* ─────────────────────────────────────────────────────────────────────────
   Interactive overlay — fires at a checkpoint, sits over the player,
   captures one of three input types (choice / scale / text).
   ───────────────────────────────────────────────────────────────────── */
.overlay-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(18, 23, 27, 0.78);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px;
  z-index: 50;
  opacity: 0;
  animation: overlayIn 0.3s ease-out forwards;
  /* Backdrop blocks click-through to the video element underneath */
}
@keyframes overlayIn { to { opacity: 1; } }

.overlay-card {
  width: 100%;
  max-width: 720px;
  max-height: calc(100% - 64px);
  overflow-y: auto;
  background: var(--card);
  border-radius: 16px;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.25);
  padding: 36px 40px;
  transform: translateY(12px);
  opacity: 0;
  animation: cardIn 0.45s 0.05s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}
@keyframes cardIn { to { transform: translateY(0); opacity: 1; } }

.overlay-tag {
  font-family: ui-monospace, SFMono-Regular, monospace;
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--accent);
  font-weight: 600;
  margin-bottom: 10px;
}
.overlay-question {
  font-family: var(--serif);
  font-size: 30px;
  font-weight: 400;
  line-height: 1.2;
  color: var(--ink);
  margin: 0 0 22px;
  letter-spacing: -0.015em;
}
.overlay-question em {
  font-style: italic;
  color: var(--accent);
  font-weight: 400;
}

/* ───── Choice prompt ───── */
.choice-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.choice-btn {
  width: 100%;
  text-align: left;
  background: var(--bg);
  border: 1.5px solid var(--rule);
  border-radius: 10px;
  padding: 16px 20px;
  font: inherit;
  font-size: 16px;
  font-weight: 500;
  color: var(--ink);
  cursor: pointer;
  transition: all 0.15s ease;
  display: flex;
  align-items: center;
  gap: 14px;
}
.choice-btn:hover:not(:disabled) {
  border-color: var(--accent);
  background: var(--card);
  transform: translateY(-1px);
}
.choice-btn.selected {
  border-color: var(--ink);
  background: var(--ink);
  color: var(--card);
}
.choice-btn.correct {
  border-color: var(--good);
  background: rgba(61, 107, 79, 0.08);
  color: var(--good);
}
.choice-btn.incorrect {
  border-color: var(--warn);
  background: rgba(181, 82, 58, 0.08);
  color: var(--warn);
}
.choice-btn:disabled { cursor: default; }
.choice-letter {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.06);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: ui-monospace, SFMono-Regular, monospace;
  font-size: 13px;
  font-weight: 700;
  flex: 0 0 auto;
}
.choice-btn.selected .choice-letter { background: rgba(255, 255, 255, 0.18); }
.choice-btn.correct .choice-letter { background: rgba(61, 107, 79, 0.18); }
.choice-btn.incorrect .choice-letter { background: rgba(181, 82, 58, 0.18); }

/* ───── Scale prompt ───── */
.scale-row {
  display: flex;
  gap: 8px;
  margin-bottom: 14px;
}
.scale-btn {
  flex: 1;
  aspect-ratio: 1;
  background: var(--bg);
  border: 1.5px solid var(--rule);
  border-radius: 8px;
  font: inherit;
  font-size: 18px;
  font-weight: 700;
  color: var(--ink);
  cursor: pointer;
  transition: all 0.15s ease;
}
.scale-btn:hover:not(:disabled) {
  border-color: var(--accent);
  transform: translateY(-1px);
}
.scale-btn.selected {
  border-color: var(--ink);
  background: var(--ink);
  color: var(--card);
}
.scale-labels {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--slate);
  margin-top: -4px;
}

/* ───── Text prompt ───── */
.text-input {
  width: 100%;
  min-height: 100px;
  padding: 14px 16px;
  border: 1.5px solid var(--rule);
  border-radius: 10px;
  font: inherit;
  font-size: 15px;
  line-height: 1.5;
  color: var(--ink);
  background: var(--bg);
  resize: vertical;
  box-sizing: border-box;
  font-family: inherit;
}
.text-input:focus {
  outline: none;
  border-color: var(--accent);
  background: var(--card);
}
.text-meta {
  display: flex;
  justify-content: flex-end;
  font-size: 11px;
  color: var(--slate);
  margin-top: 6px;
  font-family: ui-monospace, SFMono-Regular, monospace;
}

/* ───── Feedback strip (post-answer for choice) ───── */
.feedback {
  margin-top: 18px;
  padding: 14px 16px;
  border-radius: 10px;
  font-size: 14px;
  line-height: 1.5;
  background: rgba(18, 23, 27, 0.06);
  color: var(--ink);
  border-left: 3px solid var(--accent);
  opacity: 0;
  animation: fadeIn 0.25s 0.1s ease-out forwards;
}
.feedback.correct { background: rgba(61, 107, 79, 0.08); border-color: var(--good); }
.feedback.incorrect { background: rgba(181, 82, 58, 0.08); border-color: var(--warn); }
@keyframes fadeIn { to { opacity: 1; } }

/* ───── Footer actions ───── */
.overlay-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 24px;
}
.overlay-btn {
  background: var(--ink);
  color: var(--card);
  border: none;
  border-radius: 8px;
  padding: 11px 22px;
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.15s ease, background 0.15s ease;
}
.overlay-btn:hover:not(:disabled) { background: var(--ink-soft); }
.overlay-btn:disabled { opacity: 0.4; cursor: not-allowed; }
.overlay-btn.ghost {
  background: transparent;
  color: var(--slate);
  border: 1.5px solid var(--rule);
}
.overlay-btn.ghost:hover { color: var(--ink); border-color: var(--ink); }

/* ───── Email prompt ───── */
.email-input {
  width: 100%;
  height: 48px;
  padding: 0 16px;
  border: 1.5px solid var(--rule);
  border-radius: 10px;
  font: inherit;
  font-size: 16px;
  color: var(--ink);
  background: var(--bg);
  box-sizing: border-box;
}
.email-input:focus {
  outline: none;
  border-color: var(--accent);
  background: var(--card);
}

/* ───── Consent / acknowledgement checkbox row (reused by email + info) ───── */
.consent-row {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-top: 14px;
  font-size: 14px;
  line-height: 1.5;
  color: var(--slate);
  cursor: pointer;
  user-select: none;
}
.consent-row input[type="checkbox"] {
  width: 18px;
  height: 18px;
  margin: 1px 0 0 0;
  flex: 0 0 auto;
  accent-color: var(--ink);
  cursor: pointer;
}

/* ───── Info / disclosure body ───── */
.info-body {
  font-size: 15px;
  line-height: 1.6;
  color: var(--ink);
  background: var(--bg);
  padding: 18px 22px;
  border-radius: 10px;
  border-left: 3px solid var(--accent);
  white-space: pre-line;       /* preserve manifest line breaks */
  max-height: 320px;
  overflow-y: auto;
}

/* ───── Branch prompt — same choices, but no "Continue" button row ───── */
.branch-hint {
  margin-top: 14px;
  font-size: 12px;
  color: var(--slate);
  font-style: italic;
  text-align: right;
}

/* ───── Form prompt (multi-field contact / submission) ───── */
.form-subhead {
  font-size: 15px;
  line-height: 1.55;
  color: var(--slate);
  margin: -10px 0 22px;
}
.form-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
  margin: 0;
}
@media (min-width: 520px) {
  .form-grid { grid-template-columns: 1fr 1fr; }
  /* textareas + last orphan row span both cols */
  .form-field:has(.form-textarea) { grid-column: 1 / -1; }
}
.form-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 13px;
}
.form-label {
  font-weight: 600;
  color: var(--ink);
  letter-spacing: 0.01em;
}
.form-req {
  color: var(--warn);
  font-weight: 700;
}
.form-input {
  width: 100%;
  height: 44px;
  padding: 0 14px;
  border: 1.5px solid var(--rule);
  border-radius: 10px;
  font: inherit;
  font-size: 15px;
  color: var(--ink);
  background: var(--bg);
  box-sizing: border-box;
  font-family: inherit;
}
.form-textarea {
  height: auto;
  min-height: 92px;
  padding: 12px 14px;
  line-height: 1.5;
  resize: vertical;
}
.form-input:focus {
  outline: none;
  border-color: var(--accent);
  background: var(--card);
}
.form-status {
  margin-top: 14px;
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 13px;
  line-height: 1.5;
  color: var(--slate);
  background: rgba(18, 23, 27, 0.04);
}
.form-status-err {
  color: var(--warn);
  background: rgba(181, 82, 58, 0.08);
  border-left: 3px solid var(--warn);
}

/* ───── Form success state ───── */
.form-success {
  text-align: center;
  padding: 12px 8px 4px;
  animation: fadeIn 0.3s ease-out;
}
.form-success-tick {
  width: 56px;
  height: 56px;
  margin: 0 auto 18px;
  border-radius: 50%;
  background: var(--accent);
  color: var(--card);
  display: grid;
  place-items: center;
  font-size: 28px;
  font-weight: 700;
  line-height: 1;
}
.form-success-h {
  font-family: var(--serif);
  font-size: 28px;
  font-weight: 400;
  color: var(--ink);
  margin-bottom: 10px;
  letter-spacing: -0.015em;
  line-height: 1.15;
}
.form-success-body {
  font-size: 15px;
  line-height: 1.55;
  color: var(--slate);
  max-width: 380px;
  margin: 0 auto;
}

/* ───── Source citation chip (non-blocking link-out during a story) ───── */
.source-chip {
  position: absolute;
  top: 16px;
  right: 16px;
  z-index: 5;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px 8px 14px;
  background: rgba(20, 23, 27, 0.86);
  color: #fff;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 500;
  line-height: 1;
  text-decoration: none;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25);
  opacity: 0;
  transform: translateY(-6px);
  animation: sourceChipIn 0.32s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  pointer-events: auto;
  user-select: none;
}
.source-chip:hover {
  background: rgba(20, 23, 27, 0.96);
  border-color: rgba(255, 255, 255, 0.16);
  transform: translateY(-7px);
  transition: background 0.15s ease, border-color 0.15s ease, transform 0.15s ease;
}
.source-chip-eyebrow {
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.55);
}
.source-chip-label {
  font-size: 13px;
  color: #fff;
  font-weight: 600;
  letter-spacing: 0.01em;
  max-width: 280px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.source-chip-arrow {
  width: 14px;
  height: 14px;
  color: rgba(255, 255, 255, 0.7);
  flex: 0 0 auto;
}
.source-chip.source-chip-out {
  animation: sourceChipOut 0.22s ease-in forwards;
}
@keyframes sourceChipIn {
  from { opacity: 0; transform: translateY(-6px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes sourceChipOut {
  from { opacity: 1; transform: translateY(0); }
  to   { opacity: 0; transform: translateY(-6px); }
}
@media (max-width: 640px) {
  .source-chip { top: 10px; right: 10px; padding: 6px 10px 6px 12px; }
  .source-chip-eyebrow { display: none; }
  .source-chip-label { max-width: 180px; font-size: 12px; }
}

/* ───── Progress indicator while waiting for next checkpoint ───── */
.cp-marker {
  position: absolute;
  bottom: 0;
  width: 2px;
  height: 6px;
  background: var(--accent);
  border-radius: 1px;
  pointer-events: none;
  /* Placed by JS at the appropriate position over the progress bar */
}
