/* Look: a camera app. Near-black, warm cream type, one bright accent, round shapes.
   Sizes are in rem so the page follows the reader's own text-size setting. */
:root {
  color-scheme: dark;
  --accent: #ff6b4a;      /* set per campaign */
  --on-accent: #1a0d08;   /* text on the accent; picked in app.js to stay readable */
  --bg: #0b0b0c;
  --panel: #1b1b1e;
  --line: #3a3a40;
  --ink: #fff4e6;         /* warm cream */
  --soft: #b9b2a8;
  --paper: #fff4e6;       /* caption bubble */
  --paper-ink: #1d1410;
  --red: #ff4438;
  --error: #ff8f85;
  --target: 2.75rem;
}
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; background: var(--bg); }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  accent-color: var(--accent);
  font: 1.1875rem/1.5 system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  overflow-wrap: break-word;
}
[hidden] { display: none !important; }
.site-head { display: none; } /* only themes that have a site header show it */

#app {
  max-inline-size: 30rem;
  min-block-size: 100vh; min-block-size: 100dvh;
  margin-inline: auto;
  padding: max(1.75rem, env(safe-area-inset-top)) max(1.25rem, env(safe-area-inset-right)) max(1.5rem, env(safe-area-inset-bottom)) max(1.25rem, env(safe-area-inset-left));
  display: flex; flex-direction: column;
}
#app > section { flex: 1; display: flex; flex-direction: column; }
#app > section > form { flex: 1; display: flex; flex-direction: column; }
/* The main button sits at the bottom of the screen, where a thumb is. */
.push { margin-block-start: auto; padding-block-start: 1.5rem; }

h1 { font-size: 2.25rem; line-height: 1.1; letter-spacing: -0.02em; margin: 0 0 1rem; text-wrap: balance; }
h1:focus { outline: none; }
p { margin: 0 0 1.125rem; text-wrap: pretty; }
ul { margin: 0 0 1.5rem; padding-inline-start: 1.25rem; }
li { margin-block-end: 0.625rem; text-wrap: pretty; }
li::marker { color: var(--accent); }
.org { margin-block-end: 0.75rem; font-size: 1rem; font-weight: 700; color: var(--accent); }
.quiet { font-size: 1.0625rem; color: var(--soft); }
.error { margin: 0; color: var(--error); font-weight: 600; }
.error:not(:empty) { margin-block-end: 1rem; }
#s-welcome h1 { font-size: clamp(2.5rem, 1.6rem + 4.5vw, 3.25rem); }
.subtitle { margin: -0.375rem 0 1.125rem; font-size: 1.5rem; font-weight: 700; line-height: 1.2; text-wrap: balance; }

/* Buttons: pills */
.btn {
  display: flex; align-items: center; justify-content: center; gap: 0.75rem;
  inline-size: 100%; min-block-size: 3.75rem; padding: 0.75rem 1.5rem; margin: 0 0 0.75rem;
  font: inherit; font-size: 1.25rem; font-weight: 700; text-align: center;
  color: var(--ink); background: var(--panel);
  border: 2px solid var(--line); border-radius: 999px; cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.btn.primary, .btn.rec { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.btn.stop { background: var(--paper); border-color: var(--paper); color: var(--paper-ink); justify-content: space-between; }
.btn:disabled { opacity: 0.55; cursor: default; }
.btn:focus-visible, .link:focus-visible, .shutter:focus-visible, input:focus-visible, textarea:focus-visible {
  outline: 3px solid var(--ink); outline-offset: 3px;
}
label.btn { position: relative; }
label.btn input { position: absolute; inline-size: 1px; block-size: 1px; opacity: 0; }
label.btn:focus-within { outline: 3px solid var(--ink); outline-offset: 3px; }
.btn.big { min-block-size: 4.75rem; font-size: 1.5rem; }
.link {
  display: block; min-block-size: var(--target); margin: 0 auto; padding: 0.5rem 0.75rem;
  background: none; border: 0; font: inherit; font-size: 1.0625rem; color: var(--ink);
  text-decoration: underline; cursor: pointer;
}

/* Forms */
.field { margin-block-end: 1.25rem; }
.field label { display: block; font-weight: 700; margin-block-end: 0.375rem; }
.field input, .field textarea {
  display: block; inline-size: 100%; min-block-size: 3.5rem; padding: 0.75rem 1rem;
  font: inherit; color: var(--ink); background: var(--panel);
  border: 2px solid var(--line); border-radius: 1rem;
}
.field input:user-invalid, .field input[aria-invalid="true"] { border-color: var(--error); }
fieldset { border: 0; padding: 0; margin: 0 0 1.25rem; min-inline-size: 0; }
legend { padding: 0; margin-block-end: 0.5rem; font-weight: 700; }
.choice {
  display: flex; align-items: flex-start; gap: 0.875rem;
  min-block-size: var(--target); padding-block: 0.75rem; cursor: pointer;
}
.choice input { flex: none; inline-size: 1.625rem; block-size: 1.625rem; margin: 0.0625rem 0 0; }
.choice:has(input:checked) { color: var(--accent); }
/* The permission checkbox is the one choice that gets a box. */
/* Yes / no questions before recording */
.yn { margin: 0 0 1.25rem; }
.yn .row { display: flex; gap: 1.5rem; }
.yn .choice { padding-block: 0.375rem; }
.optional { font-weight: 400; color: var(--soft); }
#consent-row { margin-block-end: 1rem; padding: 0.875rem 1rem; background: var(--panel); border: 2px solid var(--line); border-radius: 1rem; }
#consent-row:has(input:checked) { border-color: var(--accent); color: var(--ink); }

/* ---------- Recording: the camera fills the screen ---------- */
#s-question {
  position: fixed; inset: 0; z-index: 1; background: #000;
  display: flex; flex-direction: column; justify-content: space-between;
}
.stage { position: absolute; inset: 0; background: #000; }
.stage video { position: absolute; inset: 0; inline-size: 100%; block-size: 100%; object-fit: cover; background: #000; }
#live.mirror { transform: scaleX(-1); }
.cue {
  position: absolute; inset: 0; margin: 0; display: grid; place-items: center;
  color: #fff; font-size: 3.25rem; font-weight: 800; letter-spacing: -0.02em;
  background: rgba(0, 0, 0, 0.45);
}
.top, .bottom {
  position: relative; inline-size: 100%; max-inline-size: 32rem; margin-inline: auto;
  padding-inline: max(0.875rem, env(safe-area-inset-left)) max(0.875rem, env(safe-area-inset-right));
}
.top { padding-block-start: max(0.75rem, env(safe-area-inset-top)); }
.bottom { padding-block-end: max(1rem, env(safe-area-inset-bottom)); text-align: center; }

/* One bar per question, like a story */
.segs { display: flex; gap: 0.3rem; margin-block-end: 0.625rem; }
.segs i { flex: 1; block-size: 0.25rem; border-radius: 999px; background: rgba(255, 255, 255, 0.35); }
.segs i.on { background: #fff; }

/* The question, as a caption card over the picture */
.prompt { background: var(--paper); color: var(--paper-ink); border-radius: 1.25rem; padding: 0.75rem 1rem 0.875rem; }
.step { margin: 0 0 0.125rem; font-size: 0.875rem; font-weight: 700; color: #7a5a4a; }
.prompt h1 { margin: 0; font-size: clamp(1.125rem, 0.95rem + 1.1vw, 1.375rem); line-height: 1.25; letter-spacing: 0; text-wrap: pretty; }
#starter {
  display: inline-block; margin: 0.5rem 0 0; padding: 0.125rem 0.5rem;
  background: var(--accent); color: var(--on-accent); border-radius: 0.5rem;
  font-size: 1rem; font-weight: 600;
}

.tip, .status {
  inline-size: fit-content; max-inline-size: 100%; margin: 0 auto 0.625rem; padding: 0.375rem 0.875rem;
  border-radius: 1rem; font-size: 1rem;
}
.tip { color: #fff; background: rgba(0, 0, 0, 0.6); }
.status { color: var(--paper-ink); background: var(--paper); font-weight: 700; }
.tip:empty, .status:empty { display: none; }

/* Round shutter, like a phone camera */
.shutter {
  display: grid; place-items: center; inline-size: 5rem; block-size: 5rem; margin: 0 auto 0.375rem; padding: 0;
  background: rgba(0, 0, 0, 0.25); border: 0.3rem solid #fff; border-radius: 50%; cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.shutter span { inline-size: 3.5rem; block-size: 3.5rem; border-radius: 50%; background: var(--red); }
.shutter-label { margin: 0 0 0.25rem; color: #fff; font-weight: 700; text-shadow: 0 1px 2px rgba(0, 0, 0, 0.7); }
#s-question .link { color: #fff; text-shadow: 0 1px 2px rgba(0, 0, 0, 0.7); }
#s-question .btn { margin-block-end: 0.5rem; }

/* Sound level and clock inside the "I'm done" button */
.meter { display: inline-flex; align-items: flex-end; gap: 0.1875rem; block-size: 1.5rem; inline-size: 2rem; }
.meter i { flex: 1; block-size: 15%; background: currentColor; border-radius: 1px; opacity: 0.3; }
.meter i.on { opacity: 1; }
.meter i:nth-child(1).on { block-size: 30%; }
.meter i:nth-child(2).on { block-size: 50%; }
.meter i:nth-child(3).on { block-size: 70%; }
.meter i:nth-child(4).on { block-size: 85%; }
.meter i:nth-child(5).on { block-size: 100%; }
.timer { min-inline-size: 5.5rem; text-align: end; font-size: 1.0625rem; font-weight: 600; font-variant-numeric: tabular-nums; }

/* No picture (phone camera app, or voice only): the caption card stands alone. */
#s-question.nofeed { background: var(--bg); }
#s-question.nofeed .stage video { display: none; }
#s-question.nofeed .prompt h1 { font-size: 1.5rem; }
#s-question.nofeed .tip { background: none; color: var(--soft); }
/* Watching it back: the clip sits between the top and the buttons, uncropped. */
#s-question.reviewing { background: var(--bg); }
#s-question.reviewing .top { display: none; }
#s-question.reviewing .stage { position: relative; inset: auto; flex: 1; min-block-size: 0; margin: max(0.75rem, env(safe-area-inset-top)) 0.875rem 0.75rem; border-radius: 1.25rem; overflow: hidden; }
#s-question.reviewing #review { display: block; object-fit: contain; }
#s-question.reviewing .tip { background: none; color: var(--ink); }
#s-question.reviewing .link { color: var(--ink); text-shadow: none; }
#s-question.audio.reviewing .stage { flex: none; block-size: 5rem; margin-block-start: auto; }

/* Sending */
progress { display: block; inline-size: 100%; block-size: 1rem; margin-block-end: 0.875rem; }
.upnote { margin: 1rem 0 0; font-size: 1rem; color: var(--soft); text-align: center; }

@media (min-width: 44rem) {
  #app { padding-block-start: 3rem; }
}
@media (prefers-reduced-motion: no-preference) {
  .segs i, .meter i { transition: background-color 0.2s, block-size 0.08s; }
}
