/* ==========================================================================
   /record/ : the guided self-record flow. Layered on site.css (tokens, .btn, .card...)
   and oralhistory.css (.oh-form, .choice, .oh-notice, .oh-progress, .oh-refcode...).
   Designed at 360px first for contributors in their 70s and 80s: one thing per screen,
   large type, 48px+ targets (the Record button is 100px+), strong contrast, and every
   state named in words as well as colour. Motion respects prefers-reduced-motion.
   ========================================================================== */

/* An email address or phone number never breaks across lines. */
.oh-nowrap { white-space: nowrap; }
/* "Topic: ... · Question 2 of 6" above each question: "Question 2 of 6" never splits, and on a
   phone it gets its own line instead of trailing a separator. */
.rec-where__n { white-space: nowrap; }
@media (max-width: 600px) {
  .rec-where__sep { display: none; }
  .rec-where__n { display: block; }
}

/* Show the app only when JavaScript modules run (class set by an inline script) */
.rec-app { display: none; }
.oh-js .rec-app { display: block; }
.oh-js .rec-nojs { display: none; }

/* Page head + progress ---------------------------------------------------- */
.rec-head { background: var(--paper-2); border-bottom: 1px solid var(--line); padding: var(--sp-5) 0 var(--sp-4); }
.rec-head__title { font-size: clamp(1.6rem, 1.25rem + 1.6vw, 2.25rem); margin: 0; }
.rec-head .container, .rec-app.container, .rec-nojs.container { max-width: 800px; }

.rec-stepper {
  list-style: none; margin: var(--sp-4) 0 0; padding: 0;
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--sp-2);
}
.rec-stepper li { display: flex; flex-direction: column; gap: 0.4rem; font-size: 0.9rem; font-weight: 600; color: var(--muted); line-height: 1.2; }
.rec-stepper li::before { content: ""; display: block; height: 8px; border-radius: 999px; background: var(--line); }
.rec-stepper li.is-done::before { background: var(--navy); }
.rec-stepper li.is-current::before { background: var(--gold); box-shadow: inset 0 0 0 1px #c99a00; }
.rec-stepper li.is-current { color: var(--navy); font-weight: 700; }
.rec-stepper__n { display: none; }

/* Body + steps ----------------------------------------------------------- */
.rec-body { padding-block: var(--sp-5) var(--sp-6); }
.rec-step__h { font-size: clamp(1.6rem, 1.3rem + 1.4vw, 2.1rem); line-height: 1.2; margin: 0 0 var(--sp-3); }
.rec-step .lede { color: var(--ink); font-size: var(--step-1); margin-bottom: var(--sp-5); }
.rec-step h3 { font-size: var(--step-2); }
.rec-app [tabindex="-1"]:focus { outline: none; }
.rec-app :focus-visible { outline: 3px solid var(--navy); outline-offset: 2px; box-shadow: 0 0 0 2px #fff, 0 0 0 7px var(--gold); }
.rec-storage-note { margin-bottom: var(--sp-5); }
.rec-storage-note p { margin: 0; }

.rec-facts { list-style: none; padding: 0; margin: 0 0 var(--sp-5); display: grid; gap: var(--sp-3); }
.rec-facts li { position: relative; padding-left: 2.1rem; font-size: var(--step-0); max-width: 60ch; }
.rec-facts li::before {
  content: ""; position: absolute; left: 0.35rem; top: 0.3em; width: 0.6rem; height: 1rem;
  border-right: 3px solid #1d7a46; border-bottom: 3px solid #1d7a46; transform: rotate(45deg);
}

.rec-ask { margin: var(--sp-5) 0; padding: var(--sp-5); background: var(--paper-2); border: 1px solid var(--line); border-radius: var(--radius-lg); }
.rec-ask__q { margin: 0; font-size: var(--step-2); }
.rec-aside { margin-top: var(--sp-5); }
.rec-back { margin: var(--sp-5) 0 0; }

/* Buttons and button rows ---------------------------------------------- */
.rec-app .btn { line-height: 1.25; text-align: center; justify-content: center; }
/* Buttons here change colour at once, never with a fade. A fade passes through in-between
   colours with too little contrast: the Next button turns from outline to filled the moment an
   answer is kept, and hover swaps an outline button's text and background. */
.rec-app .btn { transition: transform 0.15s var(--ease); }
.rec-app .btn-xl { min-height: 64px; }
/* Small phones, especially at the Larger text size: slimmer side padding keeps big labels on one line. */
@media (max-width: 420px) { .rec-app .btn-xl { padding-inline: var(--sp-4); } }
.rec-app .btn-link { min-height: 48px; font-size: var(--step-0); }
.rec-actions { display: flex; flex-wrap: wrap; gap: var(--sp-3); align-items: center; margin-top: var(--sp-4); }
.rec-actions--stack { flex-direction: column; align-items: stretch; }
.rec-actions--stack .btn-link { align-self: center; }
@media (max-width: 600px) {
  .rec-actions > .btn { width: 100%; }
}
@media (min-width: 601px) {
  .rec-actions--stack { flex-direction: row; flex-wrap: wrap; align-items: center; }
}

/* Choice lists (connection, topics) ------------------------------------- */
.rec-options { list-style: none; padding: 0; margin: 0 0 var(--sp-5); display: grid; gap: var(--sp-3); }
.rec-option {
  position: relative; display: grid; gap: 0.3rem; justify-items: start; width: 100%; min-height: 68px;
  text-align: left; padding: var(--sp-4) 3.25rem var(--sp-4) var(--sp-4); font: inherit; color: var(--ink);
  background: #fff; border: 2px solid var(--line); border-radius: var(--radius-lg); cursor: pointer;
  box-shadow: var(--shadow-1); transition: border-color 0.15s, box-shadow 0.15s;
}
.rec-option::after {
  content: ""; position: absolute; right: 1.35rem; top: 50%; width: 0.7rem; height: 0.7rem;
  border-top: 3px solid var(--navy); border-right: 3px solid var(--navy); transform: translateY(-50%) rotate(45deg);
}
.rec-option:hover { border-color: var(--navy); box-shadow: var(--shadow-2); }
.rec-option__title { font-weight: 700; color: var(--navy); font-size: var(--step-1); line-height: 1.3; }
.rec-option__desc { color: var(--muted); font-size: 1rem; line-height: 1.4; }
.rec-option__done { display: inline-flex; align-items: center; gap: 0.45rem; color: #155c34; font-weight: 700; font-size: 1rem; }
.rec-option--done { border-color: #b6dfc5; }
.rec-check { display: inline-block; width: 0.45rem; height: 0.85rem; border-right: 3px solid currentColor; border-bottom: 3px solid currentColor; transform: rotate(45deg) translate(-1px, -2px); flex: none; }

.rec-sendbar {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--sp-3) var(--sp-4);
  margin: 0 0 var(--sp-5); padding: var(--sp-4) var(--sp-5); background: var(--gold-soft); border: 1px solid #f0dfa0; border-radius: var(--radius-lg);
}
.rec-sendbar p { margin: 0; font-weight: 700; color: var(--navy); font-size: var(--step-0); }
@media (max-width: 600px) { .rec-sendbar .btn { width: 100%; } }

/* Prompt screen ---------------------------------------------------------- */
.rec-crumb { margin: 0 0 var(--sp-2); }
.rec-where { margin: 0 0 var(--sp-2); color: var(--muted); font-weight: 600; font-size: 1rem; }
.rec-question { font-size: clamp(1.6rem, 1.2rem + 2vw, 2.4rem); line-height: 1.25; margin-bottom: var(--sp-5); max-width: 32ch; }

.rec-history { margin: 0 0 var(--sp-5); background: var(--paper-2); border: 1px solid var(--line); border-radius: var(--radius-lg); }
.rec-history summary {
  display: flex; align-items: center; gap: var(--sp-3); min-height: 52px; padding: var(--sp-3) var(--sp-4);
  font-weight: 700; color: var(--navy); cursor: pointer; list-style: none; border-radius: var(--radius-lg);
}
.rec-history summary::-webkit-details-marker { display: none; }
.rec-history summary::before {
  content: "+"; display: inline-grid; place-items: center; width: 1.6rem; height: 1.6rem; flex: none;
  border-radius: 50%; background: var(--navy); color: #fff; font-size: 1.15rem; line-height: 1;
}
.rec-history[open] summary::before { content: "\2212"; }
.rec-history p { margin: 0; padding: 0 var(--sp-4) var(--sp-4); max-width: 62ch; }

.rec-panel {
  margin: 0 0 var(--sp-5); padding: var(--sp-5) var(--sp-4); background: #fff;
  border: 1px solid var(--line); border-radius: var(--radius-lg); box-shadow: var(--shadow-1);
}
@media (min-width: 601px) { .rec-panel { padding: var(--sp-6); } }
.rec-panel > * + * { margin-top: var(--sp-4); }
.rec-panel h3 { font-size: var(--step-2); margin: 0 0 var(--sp-2); }

.rec-main { text-align: center; }
.rec-hint { margin: var(--sp-4) auto 0; color: var(--muted); max-width: 40ch; }
.rec-hint--mic { color: var(--ink); background: var(--gold-soft); border-radius: var(--radius); padding: var(--sp-2) var(--sp-3); }

/* The Record button: unmistakable, 100px+ tall on phones, words change with the state */
.rec-button {
  display: flex; align-items: center; justify-content: center; gap: var(--sp-3);
  width: 100%; max-width: 460px; min-height: 104px; margin: 0 auto; padding: var(--sp-4);
  font: inherit; font-size: clamp(1.35rem, 1.15rem + 1vw, 1.65rem); font-weight: 700; line-height: 1.2;
  color: #fff; background: var(--navy); border: 3px solid var(--navy); border-radius: 999px;
  cursor: pointer; box-shadow: var(--shadow-2); transition: background 0.15s, border-color 0.15s, transform 0.15s var(--ease);
  -webkit-tap-highlight-color: transparent; touch-action: manipulation;
}
.rec-button:hover { background: var(--navy-90); }
.rec-button:active { transform: scale(0.98); }
.rec-button__icon {
  flex: none; width: 2.1rem; height: 2.1rem; border-radius: 50%;
  background: #ff3b47; box-shadow: 0 0 0 4px #fff;
}
.rec-button.is-recording { background: var(--red); border-color: var(--red); animation: rec-pulse 1.8s ease-out infinite; }
.rec-button.is-recording:hover { background: #8f000d; }
.rec-button.is-recording .rec-button__icon { width: 1.7rem; height: 1.7rem; border-radius: 5px; background: #fff; box-shadow: none; }
.rec-button[disabled] { cursor: progress; opacity: 0.8; }
/* On a phone at the Larger text size the label would wrap ("Start / recording"): cap it to the
   screen width, still about 24px bold. */
@media (max-width: 420px) {
  .rec-button { font-size: min(clamp(1.35rem, 1.15rem + 1vw, 1.65rem), 6.6vw); gap: var(--sp-2); padding-inline: var(--sp-3); }
}
@keyframes rec-pulse {
  0% { box-shadow: 0 0 0 0 rgba(180, 0, 16, 0.45); }
  70% { box-shadow: 0 0 0 18px rgba(180, 0, 16, 0); }
  100% { box-shadow: 0 0 0 0 rgba(180, 0, 16, 0); }
}

.rec-live { margin-bottom: var(--sp-5); }
.rec-live__status { margin: 0; color: var(--red); font-weight: 700; font-size: var(--step-1); text-transform: uppercase; letter-spacing: 0.06em; }
.rec-dot { display: inline-block; width: 0.8rem; height: 0.8rem; border-radius: 50%; background: var(--red); vertical-align: 0.05em; margin-right: 0.2rem; animation: rec-blink 1.2s steps(2, start) infinite; }
@keyframes rec-blink { to { visibility: hidden; } }
.rec-timer {
  display: block; margin-top: var(--sp-1); color: var(--navy); font-size: clamp(2.75rem, 2.2rem + 3vw, 3.75rem);
  font-weight: 700; letter-spacing: 0.04em; line-height: 1.1; font-variant-numeric: tabular-nums; text-transform: none;
}
.rec-meter {
  max-width: 460px; height: 22px; margin: var(--sp-4) auto var(--sp-3); overflow: hidden;
  background: var(--mist); border: 1px solid #d5d5e0; border-radius: 999px;
}
.rec-meter__bar {
  height: 100%; width: 100%; transform-origin: left center; transform: scaleX(0.02);
  background: linear-gradient(90deg, #1d7a46, #2fa866 70%, var(--gold)); transition: transform 90ms linear;
}
.rec-heard { min-height: 1.6em; margin: 0 auto; max-width: 40ch; font-weight: 600; font-size: var(--step-0); color: var(--muted); }
.rec-heard.is-heard { color: #155c34; }
.rec-heard.is-heard::before { content: ""; display: inline-block; width: 0.45rem; height: 0.85rem; margin-right: 0.6rem; border-right: 3px solid currentColor; border-bottom: 3px solid currentColor; transform: rotate(45deg) translate(-2px, -2px); }
.rec-heard.is-silent { color: #5c4700; background: var(--gold-soft); border: 1px solid #f0dfa0; border-radius: var(--radius); padding: var(--sp-2) var(--sp-3); }
.rec-live .oh-notice { margin-top: var(--sp-4); text-align: left; }
.rec-live .oh-notice p { margin: 0; }

/* Listen / keep / record again */
.rec-take .oh-notice p { margin: 0; }
.rec-take__text { margin: 0; }
.rec-play__icon {
  display: inline-block; width: 0; height: 0; flex: none;
  border-left: 0.85rem solid currentColor; border-top: 0.55rem solid transparent; border-bottom: 0.55rem solid transparent;
}
.rec-play.is-playing .rec-play__icon { width: 0.85rem; height: 1.05rem; border: 0; border-left: 0.3rem solid currentColor; border-right: 0.3rem solid currentColor; }
.rec-kept h3::before {
  content: ""; display: inline-block; width: 0.5rem; height: 0.95rem; margin-right: 0.7rem;
  border-right: 3px solid #1d7a46; border-bottom: 3px solid #1d7a46; transform: rotate(45deg) translate(-2px, -3px);
}
.rec-kept p { margin: 0; }
.rec-kept .rec-actions { margin-top: var(--sp-2); }

.rec-confirm { margin: 0 0 var(--sp-5); }
.rec-confirm h3, .rec-confirm h4 { margin: 0; font-size: var(--step-1); }
.rec-confirm p { margin: 0; }
.rec-confirm .rec-actions { margin-top: var(--sp-2); }

/* Previous / next */
.rec-nav { display: flex; flex-direction: column; gap: var(--sp-3); margin: 0 0 var(--sp-5); }
.rec-nav .btn { width: 100%; min-height: 56px; }
/* Side by side only where both labels fit on one line; on a phone they stack, full width. */
@media (min-width: 601px) {
  .rec-nav { flex-direction: row; }
  .rec-nav .btn { width: auto; flex: 0 1 auto; min-width: 220px; }
  .rec-nav__next { margin-left: auto; }
}

/* Microphone help + upload ---------------------------------------------- */
.rec-mic-help > p { margin: 0; }
.rec-howtos { display: grid; gap: var(--sp-3); margin-top: var(--sp-4); }
@media (min-width: 761px) { .rec-howtos { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.rec-howto { padding: var(--sp-4); background: var(--paper-2); border: 1px solid var(--line); border-radius: var(--radius-lg); }
.rec-howto h4 { font-family: var(--font-body); font-size: 1.05rem; margin: 0 0 var(--sp-2); }
.rec-howto ol { margin: 0; padding-left: 1.4rem; }
.rec-howto li { margin-bottom: var(--sp-1); }
.rec-mic-help__alt { font-family: var(--font-body); font-size: var(--step-1); margin: var(--sp-6) 0 var(--sp-3); }
.rec-mic-help .rec-ways { list-style: none; padding: 0; margin: 0; display: grid; gap: var(--sp-4); }
.rec-mic-help .rec-ways li { display: grid; gap: var(--sp-1); justify-items: start; }
.rec-ways__desc { color: var(--muted); font-size: 0.98rem; }
@media (max-width: 600px) { .rec-mic-help .rec-ways .btn { width: 100%; } .rec-mic-help .rec-ways li { justify-items: stretch; } }

.rec-upload { max-width: none; gap: var(--sp-4); }
.rec-upload h3 { margin: 0; }
.rec-upload__status { display: flex; align-items: center; gap: var(--sp-2); margin: 0; font-weight: 600; color: var(--navy); }
.rec-app input[type="file"] {
  width: 100%; min-height: 60px; padding: var(--sp-3); font: inherit; font-size: 1rem; color: var(--ink);
  background: #fff; border: 2px dashed #b9b9cc; border-radius: var(--radius); cursor: pointer;
}
.rec-app input[type="file"]::file-selector-button {
  font: inherit; font-weight: 700; color: var(--navy); background: var(--paper-2); cursor: pointer;
  border: 2px solid var(--navy); border-radius: 999px; padding: 0.6rem 1.1rem; margin-right: var(--sp-3); min-height: 44px;
}
.rec-app .field--error input[type="file"] { border-color: var(--red); }

/* Review ----------------------------------------------------------------- */
.rec-clips { list-style: none; padding: 0; margin: 0 0 var(--sp-5); display: grid; gap: var(--sp-4); }
.rec-clip { padding: var(--sp-4) var(--sp-4) var(--sp-3); background: #fff; border: 1px solid var(--line); border-radius: var(--radius-lg); box-shadow: var(--shadow-1); }
@media (min-width: 601px) { .rec-clip { padding: var(--sp-5) var(--sp-5) var(--sp-4); } }
.rec-clip__n { margin: 0 0 var(--sp-1); font-size: 0.85rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--red); }
.rec-clip__q { font-size: var(--step-1); line-height: 1.35; margin: 0 0 var(--sp-2); }
.rec-clip__meta { margin: 0; color: var(--muted); font-size: 0.98rem; }
.rec-clip .rec-actions { margin-top: var(--sp-3); }
.rec-clip .rec-confirm { margin: var(--sp-3) 0 0; }
.rec-clip__remove { color: var(--red); }

/* About you -------------------------------------------------------------- */
.rec-form { max-width: none; }
.rec-form .choice { min-height: 56px; }
.rec-consent { padding: var(--sp-4) var(--sp-5); background: var(--paper-2); border: 1px solid var(--line); border-radius: var(--radius-lg); }
.rec-consent h3 { font-size: var(--step-1); margin: 0 0 var(--sp-3); }
.rec-consent p { font-size: 1rem; }
.rec-consent p:last-child { margin-bottom: 0; }
.rec-photo { display: grid; gap: var(--sp-2); justify-items: start; }
.rec-photo img { max-width: 220px; max-height: 220px; object-fit: cover; border: 1px solid var(--line); border-radius: var(--radius); }
.rec-photo p { margin: 0; }
@media (max-width: 600px) { .rec-form .form-actions .btn { width: 100%; } }

/* Send + fallbacks ------------------------------------------------------- */
.rec-sending { display: grid; gap: var(--sp-3); }
.rec-sending__status { margin: 0; font-size: var(--step-1); font-weight: 700; color: var(--navy); }
.rec-sending .oh-progress { height: 22px; }
.rec-sending .oh-meta { margin: 0; }
.rec-subhead { font-size: var(--step-1); margin: var(--sp-6) 0 0; }
.rec-numbered { padding-left: 1.5rem; margin: 0 0 var(--sp-5); }
.rec-numbered li { margin-bottom: var(--sp-2); max-width: 60ch; }
.rec-downloads { list-style: none; padding: 0; margin: var(--sp-4) 0 0; display: grid; gap: var(--sp-3); }
.rec-downloads li { display: grid; gap: var(--sp-2); justify-items: start; padding: var(--sp-4); background: #fff; border: 1px solid var(--line); border-radius: var(--radius-lg); }
@media (max-width: 600px) { .rec-downloads li { justify-items: stretch; } }
.rec-download__icon { position: relative; display: inline-block; width: 1rem; height: 1.1rem; flex: none; border-bottom: 3px solid currentColor; }
.rec-download__icon::before { content: ""; position: absolute; left: 50%; top: 0; width: 3px; height: 0.7rem; margin-left: -1.5px; background: currentColor; }
.rec-download__icon::after { content: ""; position: absolute; left: 50%; top: 0.3rem; width: 0.45rem; height: 0.45rem; margin-left: -0.26rem; border-right: 3px solid currentColor; border-bottom: 3px solid currentColor; transform: rotate(45deg); }
.rec-download__meta { color: var(--muted); font-size: 0.98rem; }
.rec-fallback > .oh-meta { margin-top: var(--sp-4); }
.rec-manual-done { margin-top: var(--sp-6); padding-top: var(--sp-5); border-top: 1px solid var(--line); }
.rec-manual-done h3 { font-size: var(--step-1); margin: 0 0 var(--sp-2); }
.rec-manual-done .rec-confirm { margin-top: var(--sp-4); }
[data-send-failed] .oh-notice p { margin: 0; }
.rec-debug { display: grid; gap: var(--sp-2); justify-items: start; margin-top: var(--sp-5); }
.rec-debug .oh-meta { margin: 0; }
.rec-app .btn-sm { min-height: 44px; }

/* Thank you */
.rec-ref__label { margin: 0; font-weight: 700; color: var(--navy); }
.rec-app .oh-refcode { font-size: clamp(1.6rem, 1.2rem + 2vw, 2.4rem); margin: var(--sp-2) 0; }
[data-step="thanks"] h3 { font-size: var(--step-1); margin-top: var(--sp-6); }

/* Without JavaScript */
.rec-nojs .rec-ways { padding-left: 1.25rem; }
.rec-nojs .rec-ways li { margin-bottom: var(--sp-3); }
.rec-nojs .oh-notice p { margin: 0; }

/* Narrow phones: a little more room for the content */
@media (max-width: 420px) {
  .rec-head .container, .rec-app.container, .rec-nojs.container { padding-inline: var(--sp-4); }
  .rec-stepper li { font-size: 0.8rem; }
}

@media (prefers-reduced-motion: reduce) {
  .rec-button.is-recording { animation: none; box-shadow: 0 0 0 6px rgba(180, 0, 16, 0.25); }
  .rec-dot { animation: none; }
  .rec-meter__bar { transition: none; }
}

@media print {
  .rec-panel, .rec-nav, .rec-sendbar, .rec-stepper { display: none !important; }
}
