/* StoryCorps 2026 brand: Montserrat for UI, Fraunces Black for headings; Teal buttons that turn Red
   on hover; Legacy Black on White. Text colors are only the AA-passing pairs (Teal and Green are
   never small text on white). A test utility: plain layout, few sizes, nothing decorative. */
:root {
  --red: #E00022;
  --teal: #1C8DA4;
  --yellow: #FFDE3D;
  --blue: #253597;
  --black: #262626;
  --gray: #D4D4D4;
  --warm-white: #F9F5EC;
  --white: #FFFFFF;
  --sans: "Montserrat", system-ui, -apple-system, "Segoe UI", sans-serif;
  --serif: "Fraunces", Georgia, serif;
  --radius: 10px;
  --gutter: 16px;
  --small: 15px;
}

* { box-sizing: border-box; }

/* Components set display; the hidden attribute must still win. */
[hidden] { display: none !important; }

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

body {
  margin: 0;
  background: var(--white);
  color: var(--black);
  font-family: var(--sans);
  font-weight: 500;
  font-size: 17px;
  line-height: 1.6;
}

a { color: var(--blue); text-underline-offset: 2px; }

::selection { background: var(--yellow); color: var(--black); }
input, textarea { caret-color: var(--blue); }
::placeholder { color: #767676; opacity: 1; }
table, .status-line, .item-meta, .steps { font-variant-numeric: tabular-nums; }

:focus-visible { outline: 3px solid var(--blue); outline-offset: 2px; }

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.icon { width: 20px; height: 20px; fill: currentColor; flex: none; }
.icon-down { transform: rotate(180deg); }

.skip {
  position: absolute;
  left: -9999px;
  top: 8px;
  background: var(--white);
  padding: 8px 12px;
  z-index: 10;
}
.skip:focus { left: 8px; }

/* Header */
.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 14px var(--gutter);
  border-bottom: 1px solid var(--gray);
}
.brand {
  font-family: var(--serif);
  font-weight: 900;
  font-size: 28px;
  line-height: 1.1;
  color: var(--red);
  text-decoration: none;
}
.brand-sub {
  display: inline-block;
  margin-left: 8px;
  font-family: var(--sans);
  font-weight: 800;
  font-size: 13px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--black);
  vertical-align: middle;
}
.who { display: flex; align-items: center; gap: 12px; font-size: var(--small); }

main {
  max-width: 820px;
  margin: 0 auto;
  padding: 24px var(--gutter) 64px;
}
main:focus { outline: none; }

h1, h2 {
  font-family: var(--serif);
  font-weight: 900;
  line-height: 1.1;
  margin: 0 0 16px;
}
h1 { font-size: clamp(30px, 6vw, 40px); }
h2 { font-size: 24px; }
h2.inline { display: inline; margin: 0; }
h3 { font-size: 17px; font-weight: 700; line-height: 1.45; margin: 0; }

.panel {
  background: var(--warm-white);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 24px;
}
.panel.narrow { max-width: 600px; margin: 24px auto; }
.panel p { max-width: 62ch; }
@media (max-width: 520px) { .panel { padding: 18px 16px; } }

.meta { margin: 0 0 12px; font-size: var(--small); }
.error { color: var(--red); font-weight: 700; margin: 8px 0 0; }
.back { margin: 0 0 16px; }
.lead { margin: 0 0 8px; max-width: 62ch; }

/* Form */
.field { margin: 0 0 20px; border: 0; padding: 0; }
label, legend { font-weight: 700; }
legend { padding: 0; margin-bottom: 4px; }
input[type="text"], textarea {
  display: block;
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  font: inherit;
  color: var(--black);
  background: var(--white);
  border: 2px solid var(--black);
  border-radius: 6px;
}
input[type="text"] { max-width: 320px; margin-top: 6px; }
input[aria-invalid="true"] { border-color: var(--red); }
.choices { display: flex; flex-wrap: wrap; gap: 0 24px; }
.choice, .check {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  font-weight: 500;
}
input[type="radio"], input[type="checkbox"] { width: 20px; height: 20px; accent-color: var(--blue); flex: none; }

/* Shown when the typed interview has been run before. */
.note {
  margin: 10px 0 0;
  max-width: 480px;
  padding: 8px 14px 4px;
  background: var(--white);
  border-radius: 6px;
  font-size: var(--small);
}
.note p { margin: 0; }
.note .check { min-height: 40px; }

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 10px 24px;
  border: 0;
  border-radius: 999px;
  background: var(--teal);
  color: var(--white);
  font: 700 20px/1.2 var(--sans);
  letter-spacing: 0.02em;
  text-decoration: none;
  cursor: pointer;
}
.btn:hover { background: var(--red); }
.btn:disabled { background: var(--gray); cursor: default; }
.btn-secondary {
  background: var(--white);
  color: var(--black);
  border: 2px solid var(--black);
  font-size: 17px;
}
.btn-secondary:hover { background: var(--black); color: var(--white); }
.btn-text {
  min-height: 44px;
  padding: 8px 4px;
  border: 0;
  background: none;
  font: inherit;
  font-weight: 700;
  color: var(--blue);
  text-decoration: underline;
  cursor: pointer;
}
.actions { margin: 16px 0 0; }
.signin-button { min-height: 44px; margin: 20px 0 0; }

/* Recent runs */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: var(--small); }
th, td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--gray); vertical-align: top; }
th { font-weight: 800; font-size: 13px; letter-spacing: 0.06em; text-transform: uppercase; }
td a { font-weight: 700; }

/* Status: always a word, never color alone */
.status {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 999px;
  font-weight: 700;
  font-size: 14px;
  white-space: nowrap;
}
.status-queued { background: var(--white); border: 1px solid var(--black); }
.status-running { background: var(--blue); color: var(--white); }
.status-done { background: var(--yellow); color: var(--black); }
.status-failed { background: var(--red); color: var(--white); }
.status-line { margin: 0; }
.error-line { font-weight: 700; }

/* Progress while a run is going */
.steps {
  list-style: none;
  margin: 16px 0 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 10px 24px;
}
.step { display: flex; align-items: center; gap: 8px; opacity: 0.75; }
.step-done, .step-current { opacity: 1; }
.step-current { font-weight: 700; }
.step-marker {
  display: inline-grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border: 2px solid var(--black);
  border-radius: 50%;
  flex: none;
}
.step-done .step-marker { background: var(--blue); border-color: var(--blue); color: var(--white); }
.step-done .step-marker .icon { width: 16px; height: 16px; }
.step-current .step-marker { border-color: var(--blue); }
.step-current .step-marker::after {
  content: "";
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--blue);
}
@media (max-width: 520px) { .steps { flex-direction: column; gap: 8px; } }

.log { margin-top: 12px; font-size: var(--small); }
.log summary { cursor: pointer; font-weight: 700; padding: 8px 0; }
.log pre {
  margin: 4px 0 0;
  padding: 12px;
  max-height: 320px;
  overflow-y: auto;
  background: var(--white);
  border: 1px solid var(--gray);
  border-radius: 6px;
  font-size: 12px;
  line-height: 1.5;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

/* Results: sections on the page, one card per playable item */
.result-section { margin-top: 32px; }
.result-section > h2 { margin-bottom: 12px; }
.stories { list-style: none; padding: 0; margin: 0; }
.stories > li + li { margin-top: 16px; }
.item {
  padding: 16px;
  border: 1px solid var(--gray);
  border-radius: var(--radius);
}
.item-meta { margin: 2px 0 10px; font-size: var(--small); }
.item audio { display: block; width: 100%; }
.download { font-weight: 700; }
/* The story's first words as transcribed: the narrators' words, set apart from the UI's. */
.opening { margin: 0 0 12px; max-width: 62ch; font-weight: 400; }
.left-out .opening { display: block; margin: 2px 0 0; }
.badge {
  display: inline-block;
  padding: 0 8px;
  border: 1px solid var(--black);
  border-radius: 4px;
  font-size: 13px;
  font-weight: 700;
}

.feedback {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
}
.vote {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 44px;
  padding: 6px 14px;
  border: 2px solid var(--black);
  border-radius: 999px;
  background: var(--white);
  color: var(--black);
  font: 700 var(--small) var(--sans);
  cursor: pointer;
}
.vote:hover { background: var(--warm-white); }
.vote[aria-pressed="true"] { background: var(--blue); border-color: var(--blue); color: var(--white); }
.saved { font-size: 14px; }
.feedback textarea { flex: 1 1 100%; resize: none; overflow: hidden; font-size: var(--small); font-weight: 400; }

.left-out-details summary { padding: 8px 0; }
.left-out { margin: 8px 0 0; padding-left: 20px; }
.left-out li + li { margin-top: 8px; }

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
}
