/* styles.css -- one calm, dark-friendly sheet for every page: the product
   (index.html), the health check, and the trust page. Colors come from
   prefers-color-scheme so all of them read well in both themes without any
   script involvement. The product page's state machine lives at the bottom:
   panels show or hide purely from body[data-state], so main.js has exactly
   one visibility write point and this sheet documents what is visible when. */

:root {
  color-scheme: light dark;
  --bg: #f7f7f5;
  --fg: #1c1c1a;
  --muted: #6b6b66;
  --card: #ffffff;
  --ok: #1a7f37;
  --fail: #b42318;
  --warn: #9a6700;
  --border: #e2e2de;
  --accent: #1f5eff;
  --accent-fg: #ffffff;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #141416;
    --fg: #e8e8e4;
    --muted: #9a9a94;
    --card: #1e1e21;
    --ok: #4ade80;
    --fail: #f87171;
    --warn: #fbbf24;
    --border: #2c2c30;
    --accent: #6491ff;
    --accent-fg: #10131c;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font: 16px/1.55 system-ui, -apple-system, "Segoe UI", sans-serif;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

main {
  max-width: 44rem;
  width: 100%;
  margin: 0 auto;
  padding: 3rem 1.25rem 2rem;
  flex: 1;
}

h1 { margin: 0 0 0.25rem; font-size: 1.6rem; }
h2 { font-size: 1.1rem; margin: 2rem 0 0.75rem; }
.tagline { margin: 0; color: var(--muted); }
.muted { color: var(--muted); }
.small { font-size: 0.85rem; }
.trust-line { margin: 0; color: var(--muted); }
.trust-line a { color: inherit; }
a { color: var(--accent); }

/* ------------------------------------------------------------- health page */

#status {
  list-style: none;
  margin: 0;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--card);
  overflow: hidden;
}

#status li {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.6rem 0.9rem;
  border-bottom: 1px solid var(--border);
}

#status li:last-child { border-bottom: none; }
#status .verdict { font-variant-numeric: tabular-nums; white-space: nowrap; }
#status .ok .verdict { color: var(--ok); }
#status .fail .verdict { color: var(--fail); }
#status .pending { color: var(--muted); }

/* -------------------------------------------------------------- trust page */

.prose h2 { margin-top: 1.75rem; }
.prose p, .prose li { max-width: 40rem; }
.backlink { margin-top: 2.5rem; }
.backlink a { color: var(--muted); }

/* ----------------------------------------------------------------- buttons */

button {
  font: inherit;
  color: var(--fg);
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.45rem 1rem;
  cursor: pointer;
}

button:hover:not(:disabled) { border-color: var(--muted); }
button:disabled { opacity: 0.5; cursor: default; }

button.primary {
  background: var(--accent);
  color: var(--accent-fg);
  border-color: transparent;
}

button.big { font-size: 1.15rem; padding: 0.7rem 2.2rem; }

button.danger { border-color: var(--fail); color: var(--fail); background: transparent; }

button.quiet { background: transparent; border-color: transparent; color: var(--muted); }
button.quiet:hover:not(:disabled) { color: var(--fg); }

/* ----------------------------------------------------------------- banners */

.banner {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--card);
  padding: 0.7rem 0.9rem;
  margin: 1.25rem 0 0;
}

.banner-error { border-color: var(--fail); }
.banner-warning { border-color: var(--warn); }
.banner-notice { border-color: var(--border); }
.banner-actions { display: inline-flex; gap: 0.5rem; margin-left: 0.75rem; }
[hidden] { display: none !important; }

/* ------------------------------------------------------------------ panels */

.panel { margin-top: 1.75rem; }

/* idle */
#record-button { display: block; margin: 0.5rem 0 1.25rem; }
.steps { margin: 0; padding-left: 1.25rem; color: var(--muted); }
.steps li { margin: 0.25rem 0; }

/* consent dialog */
dialog {
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--card);
  color: var(--fg);
  max-width: 26rem;
  padding: 1.25rem 1.5rem;
}
dialog::backdrop { background: rgba(0, 0, 0, 0.45); }
dialog h2 { margin-top: 0; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 0.6rem; margin-top: 1.25rem; }

/* downloading */
#download-progress { width: 100%; height: 0.8rem; accent-color: var(--accent); }

/* capturing header strip */
.cap-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--card);
  padding: 0.55rem 0.9rem;
}

#rec-dot {
  width: 0.7rem;
  height: 0.7rem;
  border-radius: 50%;
  background: var(--fail);
  flex: none;
  animation: rec-pulse 1.6s ease-in-out infinite;
}

@keyframes rec-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.35; }
}

@media (prefers-reduced-motion: reduce) {
  #rec-dot { animation: none; }
}

#cap-elapsed { font-variant-numeric: tabular-nums; }
#cap-source { color: var(--muted); flex: 1; min-width: 10rem; }
#cap-meter { flex: none; }
#wake-note { margin: 0.5rem 0 0; }

/* transcript: black committed paragraphs, grey growing partial line */
#transcript {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--card);
  padding: 0.9rem 1.1rem;
  max-height: 24rem;
  overflow-y: auto;
}

#transcript p { margin: 0 0 0.7rem; }
#transcript p:last-child { margin-bottom: 0; }
#transcript .stamp {
  color: var(--muted);
  font-size: 0.8rem;
  font-variant-numeric: tabular-nums;
}
#transcript .partial { color: var(--muted); }

/* review */
#review-summary { font-size: 1.1rem; }
.review-note { color: var(--muted); font-size: 0.9rem; }
.review-actions { display: flex; gap: 0.6rem; flex-wrap: wrap; margin-top: 1rem; }

/* ------------------------------------------------------------------ footer */

footer {
  max-width: 44rem;
  width: 100%;
  margin: 0 auto;
  padding: 1rem 1.25rem 1.5rem;
  display: flex;
  gap: 1.25rem;
}

footer a { color: var(--muted); font-size: 0.85rem; text-decoration: none; }
footer a:hover { text-decoration: underline; }

/* ----------------------------------------------- product page state machine
   idle -> consent -> downloading -> armed -> capturing -> review.
   The consent state keeps the idle panel visible beneath the modal dialog so
   the page does not blank out behind it. The transcript panel spans
   capturing AND review: the transcript is the product, so it stays on screen
   after Stop while the summary appears above it. */

.panel { display: none; }

body[data-state="idle"] #panel-idle,
body[data-state="consent"] #panel-idle,
body[data-state="downloading"] #panel-downloading,
body[data-state="armed"] #panel-armed,
body[data-state="capturing"] #panel-capturing,
body[data-state="capturing"] #panel-transcript,
body[data-state="review"] #panel-review,
body[data-state="review"] #panel-transcript {
  display: block;
}
