/* ============================================================
   Drawbridge — participant-facing styles
   Mobile-first, no framework
   ============================================================ */

:root {
  --color-bg:        #0d0d0d;
  --color-surface:   #161616;
  --color-border:    #303030;
  --color-text:      #f5f5f5;
  --color-muted:     #b8b8b8;
  --color-primary:   #f5f5f5;
  --color-primary-h: #d9d9d9;
  --color-accent:    #ffffff;
  --color-error:     #ff8a8a;
  --color-error-bg:  #2a1616;
  --color-success:   #bde5bd;
  --color-success-bg:#162216;

  --radius-sm: 6px;
  --radius:    10px;
  --radius-lg: 16px;

  --shadow-card: 0 8px 24px rgba(0,0,0,.35);

  --font: system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-story: Georgia, "Times New Roman", serif;

  --max-w: 600px;
}

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

html { font-size: 16px; -webkit-text-size-adjust: 100%; }

body {
  font-family: var(--font);
  background: var(--color-bg);
  color: var(--color-text);
  line-height: 1.6;
  min-height: 100dvh;
}

.sr-only {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}

.container {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 1.5rem 1rem;
}

/* ── Buttons ── */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: .4rem;
  padding: .6rem 1.4rem;
  border: none; border-radius: var(--radius-sm);
  font-size: .95rem; font-weight: 600;
  cursor: pointer; text-decoration: none;
  transition: background .15s, transform .1s;
  -webkit-tap-highlight-color: transparent;
}
.btn:active { transform: scale(.97); }

.btn-primary  { background: #f3f3f3; color: #111; }
.btn-primary:hover  { background: #dbdbdb; }
.btn-secondary { background: transparent; color: #f3f3f3; border: 1.5px solid #f3f3f3; }
.btn-secondary:hover { background: rgba(255,255,255,.08); }

.btn-large { padding: .85rem 2rem; font-size: 1.05rem; }
.btn-full  { width: 100%; }

.btn:disabled {
  opacity: .45; cursor: not-allowed; pointer-events: none;
}

/* ── Alerts ── */
.alert {
  padding: .75rem 1rem;
  border-radius: var(--radius-sm);
  margin-bottom: 1rem;
  font-size: .9rem;
}
.alert-error   { background: var(--color-error-bg);   color: var(--color-error);   border-left: 4px solid var(--color-error); }
.alert-success { background: var(--color-success-bg); color: var(--color-success); border-left: 4px solid var(--color-success); }

/* ── Form fields ── */
.field { margin-bottom: 1.25rem; }
.field label { display: block; font-weight: 600; margin-bottom: .35rem; font-size: .9rem; }

input[type="text"],
input[type="email"],
input[type="password"],
input[type="date"],
input[type="number"],
select,
textarea {
  width: 100%;
  padding: .6rem .8rem;
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-sm);
  font: inherit;
  font-size: .95rem;
  background: var(--color-surface);
  color: var(--color-text);
  transition: border-color .15s;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(255,255,255,.12);
}
textarea { resize: vertical; min-height: 80px; }

.hint { color: var(--color-muted); font-size: .875rem; margin-top: .25rem; }

/* ============================================================
   Welcome page
   ============================================================ */
.page-welcome .container { display: flex; align-items: center; justify-content: center; min-height: 100dvh; }

.welcome-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  padding: 2.5rem 2rem;
  text-align: center;
  max-width: 480px;
  width: 100%;
}

.study-title {
  font-size: clamp(1.6rem, 5vw, 2.2rem);
  font-family: var(--font-story);
  color: var(--color-text);
  margin-bottom: .25rem;
}

/* Full brand logo (white wordmark) on the participant landing pages */
.brand-lockup {
  display: block;
  width: 100%;
  max-width: 280px;
  height: auto;
  margin: 0 auto;
}
.brand-lockup-heading {         /* wraps the logo as the welcome-page <h1> */
  margin: 0 0 1.25rem;
  line-height: 0;
}
.brand-lockup--form {           /* logo above the class-code form heading */
  max-width: 220px;
  margin: 0 auto 1.5rem;
}
.study-subtitle {
  color: var(--color-muted);
  font-size: .95rem;
  margin-bottom: 1.75rem;
}
.consent-text {
  text-align: left;
  font-size: .9rem;
  color: var(--color-muted);
  margin-bottom: 2rem;
  border-top: 1px solid var(--color-border);
  border-bottom: 1px solid var(--color-border);
  padding: 1rem 0;
}
.consent-text p + p { margin-top: .6rem; }

.welcome-admin-link {
  margin-top: 1rem;
  font-size: .88rem;
  color: var(--color-muted);
}

.welcome-admin-link a {
  color: var(--color-muted);
  text-decoration: none;
  border-bottom: 1px solid transparent;
}

.welcome-admin-link a:hover {
  color: var(--color-text);
  border-bottom-color: currentColor;
}

/* ============================================================
   Class code page
   ============================================================ */
.form-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  padding: 2rem 1.5rem;
  max-width: 400px;
  margin: 2rem auto;
}
.form-card--wide { max-width: 560px; }
.form-card h1 { font-size: 1.4rem; margin-bottom: .5rem; }

/* ============================================================
   Public share page
   ============================================================ */

/* ============================================================
   Story page
   ============================================================ */
.page-story .container { padding: 0; max-width: 100%; }

.story-shell {
  display: flex; flex-direction: column;
  min-height: 100dvh;
  background: var(--color-bg);
}

.story-progress {
  height: 4px;
  background: #222;
}
.progress-bar {
  height: 100%;
  background: #f2f2f2;
  transition: width .4s ease;
}

.scene-card {
  flex: 1;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  padding: 1.1rem 1rem 1rem;
  max-width: var(--max-w);
  margin: 1rem auto 0;
  width: 100%;
}

.scene-header {
  display: flex; align-items: baseline; gap: .6rem;
  margin-bottom: .75rem;
}
.scene-label { font-size: .75rem; color: var(--color-muted); white-space: nowrap; }

/* Picture is rendered at its native aspect (the new illustrations are
   ~3:2 landscape, e.g. 1489×1056). On any device we cap the height at
   50vh so the body text stays in view without scrolling. The wrap just
   centers the image; no fixed size, no aspect-ratio constraint, no
   crop — `object-fit: cover` is gone. */
.scene-image-wrap {
  width: 100%;
  margin-bottom: 1rem;
  display: flex;
  justify-content: center;
  align-items: center;
}
.scene-image {
  max-width: 100%;
  max-height: 50vh;
  width: auto;
  height: auto;
  display: block;
  border-radius: 12px;
  filter: contrast(1.02) grayscale(1);
}

.scene-text {
  font-family: var(--font-story);
  font-size: 1rem;
  line-height: 1.8;
  color: var(--color-text);
}
.scene-text p + p { margin-top: .75rem; }
.scene-text p:has(strong:only-child) {
  /* Spoken dialogue lines */
  font-style: italic;
  color: var(--color-muted);
}

.story-nav {
  display: flex; justify-content: space-between; align-items: center;
  padding: 1rem;
  border-top: 1px solid var(--color-border);
  background: var(--color-surface);
  position: sticky; bottom: 0;
}

/* ============================================================
   Choice page
   ============================================================ */
.choice-shell {
  padding: 1.5rem 1rem 2rem;
  max-width: 640px;
  margin: 0 auto;
}
.choice-question {
  font-size: clamp(1.15rem, 4vw, 1.5rem);
  font-family: var(--font-story);
  text-align: center;
  margin-bottom: 1.5rem;
  color: var(--color-text);
}

.character-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: .75rem;
  margin-bottom: 1.25rem;
}

.character-card {
  display: flex; flex-direction: column; align-items: center;
  gap: .5rem;
  padding: 1rem .75rem;
  background: var(--color-surface);
  border: 2px solid var(--color-border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: border-color .15s, box-shadow .15s, transform .1s;
  -webkit-tap-highlight-color: transparent;
}
.character-card:hover { border-color: #8e8e8e; }
.character-card.selected,
.choice-option.is-selected {
  border-color: #f3f3f3;
  box-shadow: 0 0 0 2px rgba(255,255,255,.15);
  background: #1c1c1c;
}
.character-card:active { transform: scale(.97); }

/* All seven character portraits render at the exact same dimensions —
   width and height are pinned, aspect-ratio is locked, the box can't
   shrink inside its flex parent, and the image inside is scaled with
   object-fit:cover so any source-image dimension differences disappear. */
.character-portrait {
  flex: 0 0 auto;
  width:  100px;
  height: 100px;
  aspect-ratio: 1 / 1;
  border-radius: 12px;
  overflow: hidden;
  background: #0f0f0f;
  border: 1px solid var(--color-border);
  display: flex; align-items: center; justify-content: center;
}
.character-portrait img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.character-portrait--other {
  background: #0f0f0f;
}
.other-icon {
  font-size: 2rem; font-weight: 700;
  color: #f3f3f3;
}

.character-name {
  font-size: .8rem; font-weight: 600;
  text-align: center; line-height: 1.3;
}

.other-explain {
  margin-bottom: 1rem;
}
.other-explain label { font-size: .9rem; font-weight: 600; margin-bottom: .4rem; display: block; }

.choice-submit { text-align: center; margin-top: .5rem; }

/* ============================================================
   Certainty / Also-responsible
   ============================================================ */
.question-heading {
  font-size: clamp(1.1rem, 3.5vw, 1.4rem);
  font-family: var(--font-story);
  margin-bottom: .5rem;
}
.question-sub { color: var(--color-muted); font-size: .9rem; margin-bottom: 1.25rem; }

.radio-stack { display: flex; flex-direction: column; gap: .6rem; margin-bottom: 1.5rem; }

.radio-option {
  display: flex; align-items: flex-start; gap: .75rem;
  padding: .85rem 1rem;
  background: var(--color-surface);
  border: 2px solid var(--color-border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: border-color .15s;
}
.radio-option:has(input:checked) {
  border-color: #f3f3f3;
  background: #1b1b1b;
}
.radio-option input { margin-top: .25rem; flex-shrink: 0; accent-color: var(--color-primary); }

.radio-body { display: flex; flex-direction: column; gap: .2rem; }
.radio-label { font-weight: 600; font-size: .95rem; }
.radio-hint  { font-size: .82rem; color: var(--color-muted); }

/* Checkbox grid (also-responsible) */
.checkbox-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: .5rem;
  margin-bottom: 1.5rem;
}
.checkbox-option {
  display: flex; align-items: center; gap: .5rem;
  padding: .65rem .85rem;
  background: var(--color-surface);
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: .9rem;
}
.checkbox-option:has(input:checked) {
  border-color: #f3f3f3;
  background: #1b1b1b;
}
.checkbox-option input { accent-color: var(--color-primary); }

/* ============================================================
   Demographics
   ============================================================ */
.radio-row {
  display: flex; flex-wrap: wrap; gap: .4rem;
  margin-top: .35rem;
}
.pill-option {
  display: flex; align-items: center; gap: .35rem;
  padding: .4rem .85rem;
  border: 1.5px solid var(--color-border);
  border-radius: 999px;
  cursor: pointer;
  font-size: .875rem;
  background: var(--color-surface);
  transition: border-color .15s;
}
.pill-option:has(input:checked) {
  border-color: #f3f3f3;
  background: #1b1b1b;
  font-weight: 600;
}
.pill-option input { display: none; }

/* ============================================================
   Thank you / Already submitted
   ============================================================ */
.page-thankyou .container,
.page-already-submitted .container {
  display: flex; align-items: center; justify-content: center;
  min-height: 100dvh;
}

.end-card {
  text-align: center;
  max-width: 400px;
}
.end-icon {
  display: inline-flex; align-items: center; justify-content: center;
  width: 64px; height: 64px;
  border-radius: 50%;
  background: var(--color-success-bg);
  color: var(--color-success);
  font-size: 2rem; font-weight: 700;
  margin-bottom: 1.25rem;
}
.end-icon--info {
  background: #202020;
  color: var(--color-primary);
  font-style: italic;
}
.end-card h1 { font-size: 1.3rem; margin-bottom: .5rem; }
.end-card p  { color: var(--color-muted); }

/* ============================================================
   Site footer (legal links) — appears on every participant page
   ============================================================ */
.site-footer {
  margin-top: 2.5rem;
  padding: 1.25rem 1rem 1.5rem;
  border-top: 1px solid var(--color-border);
  text-align: center;
  font-size: .8rem;
  color: var(--color-muted);
}
.site-footer nav {
  display: flex; flex-wrap: wrap;
  align-items: center; justify-content: center;
  gap: .35rem .5rem;
  margin-bottom: .4rem;
}
.site-footer a {
  color: var(--color-muted);
  text-decoration: none;
}
.site-footer a:hover { color: var(--color-primary); text-decoration: underline; }
.site-footer__meta {
  font-size: .72rem;
  letter-spacing: .02em;
  opacity: .85;
}

/* On the immersive story page we tuck the footer under the sticky nav */
.page-story .site-footer { display: none; }

/* ============================================================
   Legal page (imprint.html) — uses base.html, but pulls its
   own scoped layout.
   ============================================================ */
.page-legal .container { padding: 0; max-width: 100%; }
.page-legal .site-footer {
  max-width: 960px;
  margin: 0 auto;
  padding-left: 1.25rem;
  padding-right: 1.25rem;
}

.legal-page {
  max-width: 960px;
  margin: 0 auto;
  padding: 2rem 1.25rem 3rem;
  color: var(--color-text);
}

.legal-header,
.legal-nav,
.legal-section,
.legal-footer {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
}

.legal-header {
  padding: 1.5rem 1.5rem 1.25rem;
  margin-bottom: 1rem;
}

.legal-header h1 {
  font-family: var(--font-story);
  font-size: clamp(1.8rem, 4vw, 2.4rem);
  line-height: 1.15;
  margin-bottom: .35rem;
  color: var(--color-text);
}

.legal-sub {
  color: var(--color-muted);
  font-size: .98rem;
}

.legal-nav {
  padding: 1.1rem 1.25rem;
  margin-bottom: 1rem;
}

.legal-nav strong {
  display: block;
  margin-bottom: .75rem;
  font-size: .85rem;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--color-muted);
}

.legal-nav__grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: .6rem;
}

.legal-nav a,
.legal-contact a,
.legal-section a {
  color: var(--color-text);
  text-underline-offset: 2px;
}

.legal-nav a:hover,
.legal-contact a:hover,
.legal-section a:hover {
  color: var(--color-primary-h);
}

.legal-section {
  padding: 1.5rem;
  margin-bottom: 1rem;
}

.legal-section h2,
.legal-section h3,
.legal-section h4 {
  color: var(--color-text);
  line-height: 1.25;
}

.legal-section h2 {
  font-family: var(--font-story);
  font-size: 1.45rem;
  margin-bottom: 1rem;
}

.legal-section h3 {
  font-size: 1rem;
  margin: 1.3rem 0 .55rem;
}

.legal-section h4 {
  font-size: .95rem;
  margin: 1rem 0 .45rem;
  color: var(--color-primary);
}

.legal-section p,
.legal-section li {
  color: #e6e6e6;
  font-size: .97rem;
}

.legal-section p + p,
.legal-section p + ul,
.legal-section ul + p {
  margin-top: .85rem;
}

.legal-section ul {
  margin: .7rem 0 .2rem 1.2rem;
}

.legal-section li + li {
  margin-top: .45rem;
}

.legal-not-collected {
  list-style: circle;
}

.legal-contact {
  color: #e6e6e6;
}

.legal-contact p + p {
  margin-top: .8rem;
}

.legal-footer {
  padding: 1.15rem 1.25rem;
}

.legal-footer p {
  color: var(--color-muted);
  font-size: .92rem;
}

.legal-footer p + p {
  margin-top: .4rem;
}

.page-legal code {
  background: #242424;
  border: 1px solid #353535;
  color: #fafafa;
  padding: .08rem .35rem;
  border-radius: 5px;
}

@media (max-width: 640px) {

  .legal-page {
    padding: 1rem 1rem 2rem;
  }

  .legal-header,
  .legal-nav,
  .legal-section,
  .legal-footer {
    border-radius: var(--radius);
  }

  .legal-section,
  .legal-header,
  .legal-nav,
  .legal-footer {
    padding-left: 1rem;
    padding-right: 1rem;
  }
}

@media print {
  .print-hide,
  .site-footer {
    display: none !important;
  }
}

/* ============================================================
   Prolific completion code (thank-you / already-submitted)
   ============================================================ */
.completion-code-box {
  margin: 1.5rem auto;
  max-width: 360px;
  padding: 1.1rem 1rem 1.25rem;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  text-align: center;
}
.completion-code-box__label {
  font-size: .72rem;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--color-muted);
  margin-bottom: .5rem;
}
.completion-code-box__code {
  font-family: "SF Mono", "Fira Code", monospace;
  font-size: 1.4rem;
  font-weight: 700;
  letter-spacing: .04em;
  color: var(--color-text);
  background: var(--color-bg);
  border: 1px dashed var(--color-border);
  border-radius: var(--radius-sm);
  padding: .6rem .75rem;
  margin-bottom: .8rem;
  word-break: break-all;
}
.end-meta {
  margin-top: 1.2rem;
  color: var(--color-muted);
  font-size: .92rem;
}

/* ============================================================
   Scene illustration placeholder (until real images are wired up)
   ============================================================ */
.scene-image-placeholder {
  margin: 0 0 1rem 0;
  padding: 1rem 1rem 1.1rem;
  background: rgba(245, 245, 245, .04);
  border: 1.5px dashed var(--color-border);
  border-radius: var(--radius);
  color: var(--color-muted);
  font-size: .85rem;
  line-height: 1.55;
}
.scene-image-placeholder__label {
  display: inline-block;
  padding: .15rem .55rem;
  background: rgba(245, 245, 245, .08);
  border: 1px solid var(--color-border);
  border-radius: 999px;
  font-size: .68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--color-muted);
  margin-bottom: .55rem;
}
.scene-image-placeholder__desc {
  margin: 0;
  font-family: var(--font);
  color: var(--color-text);
  font-size: .85rem;
  line-height: 1.6;
  font-style: italic;
}
