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

:root {
  --color-bg:        #faf8f4;
  --color-surface:   #ffffff;
  --color-border:    #e2ddd5;
  --color-text:      #1a1714;
  --color-muted:     #6b6560;
  --color-primary:   #2c4a7c;
  --color-primary-h: #1e3459;
  --color-accent:    #b85c2a;
  --color-error:     #c0392b;
  --color-error-bg:  #fdf0ee;
  --color-success:   #1e7a46;
  --color-success-bg:#edf7f1;

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

  --shadow-card: 0 2px 12px rgba(0,0,0,.08);

  --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: var(--color-primary);   color: #fff; }
.btn-primary:hover  { background: var(--color-primary-h); }
.btn-secondary { background: transparent; color: var(--color-primary); border: 2px solid var(--color-primary); }
.btn-secondary:hover { background: #eef2f9; }

.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(44,74,124,.15);
}
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-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-primary);
  margin-bottom: .25rem;
}
.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; }

/* ============================================================
   Class code page
   ============================================================ */
.form-card {
  background: var(--color-surface);
  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; }

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

.story-shell {
  display: flex; flex-direction: column;
  min-height: 100dvh;
}

.story-progress {
  height: 4px;
  background: var(--color-border);
}
.progress-bar {
  height: 100%;
  background: var(--color-primary);
  transition: width .4s ease;
}

.scene-card {
  flex: 1;
  padding: 1.25rem 1rem 1rem;
  max-width: var(--max-w);
  margin: 0 auto;
  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; }
.scene-title { font-size: 1.05rem; font-weight: 700; color: var(--color-primary); }

.scene-image-wrap {
  width: 100%;
  aspect-ratio: 16/9;
  background: #f0ece4;
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 1rem;
}
.scene-image {
  width: 100%; height: 100%;
  object-fit: cover;
}

.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-primary);
}

.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: var(--color-primary); }
.character-card.selected {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(44,74,124,.2);
  background: #f0f4fb;
}
.character-card:active { transform: scale(.97); }

.character-portrait {
  width: 72px; height: 72px;
  border-radius: 50%;
  overflow: hidden;
  background: #e8e4dc;
  display: flex; align-items: center; justify-content: center;
}
.character-portrait img { width: 100%; height: 100%; object-fit: cover; }

.character-portrait--other {
  background: var(--color-border);
}
.other-icon {
  font-size: 2rem; font-weight: 700;
  color: var(--color-muted);
}

.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: var(--color-primary);
  background: #f0f4fb;
}
.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: var(--color-primary);
  background: #f0f4fb;
}
.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: var(--color-primary);
  background: #f0f4fb;
  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: #eef2f9;
  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 styles in {% block head %}; nothing extra here.
   ============================================================ */
.page-legal .container { padding: 0; max-width: 100%; }
