/* About Time: calm, large and easy to read for tired carers on any phone.
   Brand: black, white and Hitesh Daudia red (#C00100). Black for actions, red only as a highlight. */
@font-face {
  font-family: "Plus Jakarta Sans"; src: url(fonts/plus-jakarta-sans-latin-wght-normal.woff2) format("woff2");
  font-weight: 200 800; font-display: swap;
}
:root {
  --bg: #f7f5f3;
  --surface: #ffffff;
  --ink: #111111;
  --muted: #565656;
  --line: #e4e1de;
  --accent: #111111;      /* buttons and focus borders */
  --accent-ink: #ffffff;
  --accent-soft: #f3f1ef;
  --red: #c00100;         /* brand highlight */
  --red-text: #c00100;    /* red used for small words */
  --red-soft: #fbe5e3;    /* light tint behind a selected choice */
  --warn-soft: #fbf1dc;
  --warn: #7a5300;
  --bad: #c00100;
  --good: #1e6b3a;
  --focus: #f2b705;
  --shadow: 0 10px 30px rgb(0 0 0 / .06);
  --radius: 20px;
  --font: "Plus Jakarta Sans", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0b0b0b; --surface: #171717; --ink: #f2f2f2; --muted: #ababab; --line: #2e2e2e;
    --accent: #ffffff; --accent-ink: #111111; --accent-soft: #222222;
    --red: #c00100; --red-text: #f2f2f2; --red-soft: #3a1513; /* the logo red is too dark to read as small words on black, so small words go white; shapes stay logo red */
    --warn-soft: #3a2f14; --warn: #e8c56b; --bad: #ff6b61; --good: #79cf96;
    --shadow: 0 10px 30px rgb(0 0 0 / .5);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 18px/1.55 var(--font);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
.wrap {
  max-width: 720px; margin: 0 auto;
  padding-left: max(18px, env(safe-area-inset-left, 0px));
  padding-right: max(18px, env(safe-area-inset-right, 0px));
}
h1, h2, h3 { line-height: 1.2; text-wrap: balance; margin: 0; }
h1 { font-size: 1.75rem; }
h2 { font-size: 1.35rem; }
h3 { font-size: 1.05rem; }
p { margin: 0; }
a { color: var(--accent); }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }

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

.top { background: var(--surface); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5; padding-top: env(safe-area-inset-top, 0px); }
.top-inner { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-block: 12px; }
.brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); font-weight: 700; font-size: 1.1rem; }
.brand svg { width: 30px; height: 30px; }
.brand circle { fill: var(--accent); }
.brand path { stroke: var(--accent-ink); stroke-width: 6; fill: none; stroke-linecap: round; stroke-linejoin: round; }
.progress { height: 5px; background: var(--line); }
.progress span { display: block; height: 100%; width: 0; background: var(--accent); transition: width .3s ease; }

main { padding-block: 28px 40px; display: grid; gap: 22px; outline: none; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; display: grid; gap: 16px; }
.lede { font-size: 1.1rem; color: var(--muted); }
.eyebrow { font-size: .85rem; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--accent); }
.muted { color: var(--muted); }
.small { font-size: .9rem; }
ul.ticks { margin: 0; padding: 0; list-style: none; display: grid; gap: 10px; }
ul.ticks li { padding-left: 32px; position: relative; }
ul.ticks li::before { content: ""; position: absolute; left: 4px; top: .45em; width: 14px; height: 8px; border-left: 3px solid var(--accent); border-bottom: 3px solid var(--accent); transform: rotate(-45deg); }

.btn {
  font: inherit; font-weight: 600; border-radius: 12px; padding: 14px 20px; min-height: 52px;
  border: 2px solid var(--line); background: var(--surface); color: var(--ink); cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; text-decoration: none;
}
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.big { width: 100%; font-size: 1.1rem; }
.btn:disabled { opacity: .6; cursor: wait; }
.linkish { background: none; border: 0; color: var(--accent); font: inherit; text-decoration: underline; cursor: pointer; padding: 0; }
.row { display: flex; gap: 12px; flex-wrap: wrap; }
.row > .btn { flex: 1 1 160px; }
.nav { display: flex; gap: 12px; }
.nav .btn { flex: 1; }

label { display: grid; gap: 6px; font-weight: 600; }
label .hint { font-weight: 400; color: var(--muted); font-size: .95rem; }
input[type=text], input[type=email], input[type=date], input[type=month], select, textarea {
  font: inherit; color: var(--ink); background: var(--bg); width: 100%;
  border: 2px solid var(--line); border-radius: 12px; padding: 12px 14px;
}
textarea { min-height: 190px; resize: vertical; line-height: 1.5; }
textarea.short { min-height: 120px; }
input:focus, select:focus, textarea:focus { border-color: var(--accent); outline: none; box-shadow: 0 0 0 3px var(--accent-soft); }

.answer-wrap { position: relative; }
.answer-wrap textarea { padding-bottom: 72px; }
.mic {
  position: absolute; right: 10px; bottom: 12px; min-height: 48px; padding: 10px 16px; border-radius: 999px;
  border: 2px solid var(--accent); background: var(--surface); color: var(--accent); font: inherit; font-weight: 600;
  display: inline-flex; align-items: center; gap: 8px; cursor: pointer;
}
.mic svg { width: 20px; height: 20px; }
.mic.on { background: var(--bad); border-color: var(--bad); color: #fff; }
.live { font-size: 1rem; color: var(--accent); font-weight: 600; }
.live:empty { display: none; }
.example { background: var(--accent-soft); border-radius: 12px; padding: 12px 14px; font-size: .95rem; }

fieldset { border: 0; padding: 0; margin: 0; display: grid; gap: 10px; }
legend { font-weight: 600; margin-bottom: 6px; padding: 0; }
.choices { display: flex; flex-wrap: wrap; gap: 10px; }
.choice { position: relative; }
.choice input { position: absolute; opacity: 0; inset: 0; }
.choice span { display: inline-block; padding: 12px 18px; border: 2px solid var(--line); border-radius: 999px; min-height: 48px; cursor: pointer; font-weight: 500; }
.choice input:checked + span { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.choice input:focus-visible + span { outline: 3px solid var(--focus); outline-offset: 2px; }
.check-line { display: flex; gap: 10px; align-items: center; font-weight: 500; }
.check-line input { width: 24px; height: 24px; accent-color: var(--accent); }

.notice { border-radius: 12px; padding: 14px 16px; background: var(--warn-soft); color: var(--ink); }
.notice strong { color: var(--warn); }
.error { border-radius: 12px; padding: 14px 16px; background: color-mix(in srgb, var(--bad) 12%, var(--surface)); border: 1px solid var(--bad); }
.ok { color: var(--good); font-weight: 600; }

.section-edit { display: grid; gap: 8px; }
.section-edit h3 { display: flex; gap: 10px; align-items: baseline; }
.section-edit h3 .num { color: var(--accent); font-variant-numeric: tabular-nums; }
.spinner { width: 28px; height: 28px; border-radius: 50%; border: 4px solid var(--line); border-top-color: var(--accent); animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation: none; } .progress span { transition: none; } }
.loading { display: flex; gap: 14px; align-items: center; }

.letter-list { display: grid; gap: 12px; }
details.letter { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; }
details.letter summary { cursor: pointer; font-weight: 700; font-size: 1.05rem; }
details.letter summary small { display: block; font-weight: 400; color: var(--muted); font-size: .9rem; }
details.letter[open] { display: grid; gap: 12px; }

dialog { border: 0; border-radius: var(--radius); padding: 24px; max-width: min(520px, calc(100vw - 32px)); background: var(--surface); color: var(--ink); display: none; }
dialog[open] { display: grid; gap: 14px; }
dialog::backdrop { background: rgb(0 0 0 / .45); }

.foot { padding-block: 24px 40px; border-top: 1px solid var(--line); color: var(--muted); font-size: .95rem; display: grid; gap: 10px; }
.foot-links { display: flex; gap: 18px; flex-wrap: wrap; }

/* ---------- Brand finish ---------- */
h1, h2, h3 { font-weight: 800; letter-spacing: -.02em; }
.brand .wm { display: inline-flex; align-items: center; font-weight: 800; font-size: 1.45rem; letter-spacing: -.035em; line-height: 1; }
.brand .wm svg { width: .74em; height: .74em; margin: 0 .03em; transform: translateY(.1em); }
.brand circle { fill: #c00100; stroke: #c00100; stroke-width: 8; }
.brand path { stroke: #ffffff; stroke-width: 10; stroke-linecap: round; fill: none; }
.by { display: inline-flex; align-items: center; gap: 8px; color: var(--muted); font-size: .85rem; text-decoration: none; }
.by img { width: 34px; height: 34px; border-radius: 6px; display: block; }
.progress span { background: var(--red); }
.card { border: 0; box-shadow: var(--shadow); }
.eyebrow { color: var(--red-text); }
ul.ticks li::before { border-color: var(--red); }
main > .card:has(.ticks) h1 { font-size: 2rem; }
main > .card:has(.ticks) h1::after { content: ""; display: block; width: 56px; height: 5px; background: var(--red); border-radius: 3px; margin-top: 14px; }
.btn { border-radius: 999px; border-width: 1.5px; }
input[type=text], input[type=email], input[type=date], input[type=month], select, textarea { border-width: 1.5px; border-radius: 14px; }
.mic { border: 0; background: var(--accent); color: var(--accent-ink); }
.mic svg { color: var(--red); }
.mic.on svg { color: #fff; }
.live { color: var(--ink); }
.example { background: var(--accent-soft); border-left: 4px solid var(--red); }
.section-edit h3 .num { color: var(--red); }
details.letter { border: 0; box-shadow: var(--shadow); }

/* "Listen": a small speaker button beside the question number; Speak stays the one big button */
.q-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.listen {
  flex: none; display: inline-flex; align-items: center; gap: 6px; min-height: 44px; padding: 6px 14px;
  border-radius: 999px; border: 1.5px solid var(--line); background: var(--surface); color: var(--ink);
  font: inherit; font-size: .95rem; font-weight: 600; cursor: pointer;
}
.listen svg { width: 20px; height: 20px; color: var(--red); flex: none; }
.listen[aria-pressed=true] { border-color: var(--red); color: var(--ink); }
.listen[aria-pressed=true] svg { animation: pulse 1.2s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .45; } }
.example strong { color: var(--red-text); }
.example.flash { animation: flash 1.6s ease-out 1; }
@keyframes flash { 0% { box-shadow: 0 0 0 3px var(--red); } 100% { box-shadow: 0 0 0 3px transparent; } }
@media (prefers-reduced-motion: reduce) { .listen svg, .example.flash { animation: none !important; } }

/* Selected choice: light red tint, red border and a tick, so it is obvious in day and night mode */
.choice input:checked + span { background: var(--red-soft); border-color: var(--red); color: var(--ink); font-weight: 700; }
.choice input:checked + span::before { content: "\2713  "; color: var(--red-text); font-weight: 800; }

.print-only { display: none; }
@media print {
  body { background: #fff; color: #000; font-size: 12pt; }
  .top, .foot, .no-print, dialog { display: none !important; }
  .print-only { display: block; }
  main { padding: 0; }
  .card { border: 0; padding: 0; box-shadow: none; }
  h1::after { display: none !important; }
  textarea { border: 0; padding: 0; min-height: 0; background: none; }
}
