/* Baby time-change planner: calm bedtime theme (dusk slate + apricot) */
@font-face {
  font-family: "Nunito";
  src: url("fonts/nunito.woff2") format("woff2");
  font-weight: 200 1000;
  font-style: normal;
  font-display: swap;
}
:root {
  --bg: #eef2f7;
  --surface: #ffffff;
  --surface-2: #e4eaf2;
  --ink: #1b2635;
  --muted: #4a5668;
  --line: #cdd6e2;
  --accent: #2f4b73;
  --accent-ink: #ffffff;
  --peach: #f2a27e;
  --peach-ink: #9a4320;
  --peach-soft: #fde9de;
  --ok: #2d6e4a;
  --focus: #d9703f;
  --r: 12px;
  --r-card: 22px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #121924;
    --surface: #1b2432;
    --surface-2: #243041;
    --ink: #e7ecf3;
    --muted: #a9b4c4;
    --line: #33415a;
    --accent: #a8c2e6;
    --accent-ink: #121924;
    --peach: #f4ad8a;
    --peach-ink: #f6bd9f;
    --peach-soft: #3a2b27;
    --ok: #86d0a5;
    --focus: #f4ad8a;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 17px/1.6 "Nunito", ui-rounded, "SF Pro Rounded", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
h1, h2, h3 { line-height: 1.2; font-weight: 800; letter-spacing: -.01em; }
a { color: var(--accent); text-underline-offset: 3px; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 6px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.skip { position: absolute; left: -999px; top: 0; background: var(--surface); padding: 8px 12px; z-index: 10; }
.skip:focus { left: 8px; top: 8px; }
.wrap { max-width: 1200px; margin: 0 auto; padding: 0 16px; }
@media (min-width: 720px) { .wrap { padding: 0 32px; } }
[hidden] { display: none !important; }

/* ---------- header ---------- */
.topbar { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 14px 0; }
.brand { color: var(--ink); text-decoration: none; font-weight: 800; display: inline-flex; align-items: center; gap: 8px; min-height: 44px; white-space: nowrap; }
.topbar nav { display: flex; gap: 20px; }
.topbar nav a { color: var(--ink); text-decoration: none; font-weight: 700; display: inline-flex; align-items: center; min-height: 44px; white-space: nowrap; }
.topbar nav a:hover { color: var(--accent); text-decoration: underline; }
.hero { padding: 28px 0 32px; max-width: 46rem; }
.hero h1 { font-size: clamp(2rem, 5vw, 3rem); margin: 0 0 12px; }
.hero .lede { margin: 0; font-size: 1.15rem; color: var(--muted); }
.next-change { margin: 14px 0 0; font-weight: 700; color: var(--peach-ink); }
.crumbs { font-size: .95rem; margin: 0 0 10px; color: var(--muted); }

/* ---------- tool layout ---------- */
.tool { display: grid; gap: 32px; grid-template-columns: minmax(0, 1fr); align-items: start; }
@media (min-width: 1080px) { .tool { grid-template-columns: 370px minmax(0, 1fr); gap: 48px; } }

/* ---------- form ---------- */
.form { min-width: 0; }
fieldset.step { border: 0; margin: 0 0 28px; padding: 0; min-width: 0; }
legend { font-weight: 800; font-size: 1.25rem; padding: 0; margin-bottom: 12px; }
.fld { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.fld > span { font-size: .95rem; font-weight: 700; }
input[type=time], input[type=date], input[type=number], input[type=text], select {
  font: inherit; font-size: 16px; color: var(--ink); background: var(--surface); border: 1.5px solid var(--line);
  border-radius: var(--r); padding: 9px 12px; min-height: 46px; width: 100%; min-width: 0;
}
input:hover, select:hover { border-color: var(--accent); }
.row2, .row3 { display: grid; gap: 12px; grid-template-columns: 1fr 1fr; margin-top: 12px; }
.row3 { grid-template-columns: 1fr; }
.row2 > :only-child { grid-column: 1 / -1; }
@media (min-width: 640px) and (max-width: 1079px) { .row3 { grid-template-columns: repeat(3, 1fr); } }
.hint { color: var(--muted); font-size: .95rem; margin: 10px 0 0; }
.note { background: var(--peach-soft); border-radius: var(--r); padding: 10px 14px; margin: 12px 0 0; }
#jzinfo:empty { display: none; }

.seg { display: flex; gap: 4px; background: var(--surface-2); border-radius: var(--r); padding: 4px; }
.seg-opt { flex: 1 1 0; position: relative; }
.seg-opt input { position: absolute; opacity: 0; inset: 0; cursor: pointer; margin: 0; }
.seg-opt span { display: grid; place-items: center; text-align: center; padding: 8px 4px; min-height: 44px; border-radius: 9px; font-weight: 700; font-size: .92rem; cursor: pointer; line-height: 1.2; white-space: nowrap; }
.seg-opt input:checked + span { background: var(--surface); color: var(--ink); box-shadow: 0 1px 3px rgba(20, 30, 50, .18); }
.seg-opt input:focus-visible + span { outline: 3px solid var(--focus); outline-offset: 1px; }

.trlist { margin-top: 14px; }
.trhead { margin: 0 0 4px; font-weight: 700; font-size: .95rem; }
.tr { display: grid; grid-template-columns: auto 1fr auto; gap: 0 12px; align-items: center; padding: 8px 2px; min-height: 48px; border-bottom: 1px solid var(--line); cursor: pointer; }
.tr:last-child { border-bottom: 0; }
.tr input { width: 20px; height: 20px; accent-color: var(--accent); margin: 0; grid-row: span 2; }
.tr .trd { font-weight: 800; }
.tr .trk { grid-column: 2; color: var(--muted); font-size: .95rem; }
.tr .trt { grid-column: 3; grid-row: 1 / span 2; color: var(--muted); font-size: .95rem; font-variant-numeric: tabular-nums; }
.tr.past { opacity: .75; }

.linkbtn { font: inherit; font-weight: 700; color: var(--accent); background: none; border: 0; padding: 0; min-height: 44px; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
.sub { margin-top: 18px; }
.subhead { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.subhead h3 { font-size: 1.05rem; margin: 0; }
.item { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr) 44px; gap: 10px; align-items: end; margin-top: 8px; }
.item.meal { grid-template-columns: minmax(0, 1fr) 44px; }
.meals { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }
#agetip:empty + .linkbtn { padding: 0; }

.btn { font: inherit; font-weight: 800; border: 1.5px solid var(--accent); background: var(--accent); color: var(--accent-ink); border-radius: var(--r); padding: 9px 18px; min-height: 46px; cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; gap: 6px; }
.btn:hover:not(:disabled) { filter: brightness(1.1); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.ghost, .btn.small { background: transparent; color: var(--accent); }
.btn.small { padding: 6px 14px; font-size: .95rem; min-height: 44px; }
.btn.icon { width: 44px; min-height: 46px; padding: 0; justify-content: center; font-size: 1.4rem; line-height: 1; background: transparent; color: var(--muted); border-color: var(--line); }

.choices { display: grid; gap: 2px; }
.opt-card { display: flex; align-items: center; gap: 12px; padding: 8px 2px; min-height: 46px; cursor: pointer; font-weight: 700; }
.opt-card input { width: 20px; height: 20px; accent-color: var(--accent); margin: 0; flex: none; }

details.more { margin: 0 0 28px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
details.more > summary { cursor: pointer; font-weight: 800; padding: 12px 0; min-height: 48px; }
details.more[open] > summary { margin-bottom: 4px; }
details.more > .inner { padding-bottom: 18px; }
.form-end { margin: 0 0 8px; }
@media (min-width: 1080px) { .form-end { display: none; } }

/* ---------- result: the one card ---------- */
.result { background: var(--surface); border-radius: var(--r-card); padding: 24px; box-shadow: 0 1px 2px rgba(20, 30, 50, .05), 0 10px 30px rgba(20, 30, 50, .07); min-width: 0; }
@media (max-width: 639px) { .result { padding: 20px 14px; margin: 0 -4px; } }
.result h2 { margin: 0 0 10px; font-size: 1.6rem; }
.summary { font-size: 1.1rem; margin: 0 0 18px; max-width: 42rem; }
.summary.err { color: var(--muted); }
.actions { display: flex; flex-wrap: wrap; gap: 10px 14px; align-items: center; margin-top: 18px; }
.check { display: inline-flex; gap: 8px; align-items: center; min-height: 44px; cursor: pointer; }
.check input { width: 20px; height: 20px; accent-color: var(--accent); }
.copied { color: var(--ok); font-weight: 700; }
.tips-h { font-size: 1.1rem; margin: 26px 0 6px; }
.tips { margin: 0; padding-left: 1.2em; max-width: 42rem; }
.tips li { margin-bottom: 6px; }

#table { container-type: inline-size; }
table.plan { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.plan th { text-align: left; font-size: .95rem; font-weight: 800; padding: 8px 10px; border-bottom: 2px solid var(--ink); }
.plan td { padding: 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
.plan .tm { font-weight: 800; white-space: nowrap; font-size: 1.05rem; }
.plan .end { display: block; color: var(--muted); font-size: .9rem; white-space: nowrap; }
.plan .dayoff { display: inline-block; margin-left: 4px; font-size: .85rem; color: var(--peach-ink); font-weight: 800; white-space: nowrap; }
.plan .dt { font-weight: 800; white-space: nowrap; }
.plan .note-s { display: block; font-size: .9rem; color: var(--muted); }
.plan .note-s.strong { color: var(--peach-ink); font-weight: 700; }
.plan .done { color: var(--ok); font-weight: 800; }
.plan tr.base td { color: var(--muted); }
.plan tr.base .tm { font-weight: 600; }
.plan tr.change td { background: var(--peach-soft); }
.plan tr.change td:first-child { box-shadow: inset 4px 0 0 var(--peach); }
.plan .mi { display: inline-block; margin-right: 12px; }

/* day cards when the plan column is narrow */
@media screen {
  @container (max-width: 620px) {
    table.plan thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
    table.plan, .plan tbody { display: block; width: 100%; }
    .plan tr { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); border-bottom: 1px solid var(--line); padding: 6px 0 10px; }
    .plan td { display: block; border: 0; padding: 4px 8px 4px 0; min-width: 0; }
    .plan td::before { content: attr(data-label); display: block; font-size: .85rem; color: var(--muted); line-height: 1.3; }
    .plan td[data-label="Date"] { grid-column: 1 / -1; padding-top: 8px; }
    .plan td[data-label="Date"]::before { content: none; }
    .plan td[data-label="Date"] .dt { font-size: 1.05rem; }
    .plan td.meals-c { grid-column: 1 / -1; }
    .plan td.meals-c .mi { display: inline-block; margin-right: 14px; }
    .plan tr.change { background: var(--peach-soft); border-radius: var(--r); padding: 6px 12px 10px; margin: 6px 0; box-shadow: inset 4px 0 0 var(--peach); border-bottom: 0; }
    .plan tr.change td { background: none; }
    .plan tr.change td:first-child { box-shadow: none; }
  }
  @container (max-width: 300px) { .plan tr { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
}

/* ---------- article ---------- */
.content { max-width: 44rem; margin-top: 64px; }
.content h2 { font-size: 1.6rem; margin: 48px 0 10px; }
.content h2:first-child { margin-top: 0; }
.content details.ref { border-top: 1px solid var(--line); }
.content details.ref:last-of-type { border-bottom: 1px solid var(--line); }
.content details.ref > summary { cursor: pointer; font-weight: 800; padding: 12px 0; min-height: 48px; }
.content table { width: 100%; border-collapse: collapse; margin: 8px 0 14px; font-size: .95rem; font-variant-numeric: tabular-nums; }
.content th, .content td { border-bottom: 1px solid var(--line); padding: 8px 8px 8px 0; text-align: left; vertical-align: top; }
.content th { font-weight: 800; }
.faq details { border-top: 1px solid var(--line); }
.faq details:last-child { border-bottom: 1px solid var(--line); }
.faq summary { cursor: pointer; font-weight: 700; padding: 12px 0; min-height: 48px; }
.faq details p { margin-top: 0; }
.sources { padding-left: 1.2em; }
.sources li { font-size: .95rem; margin-bottom: 6px; word-break: break-word; }
.disclaimer { font-size: .95rem; color: var(--muted); margin-top: 32px; }

footer { margin-top: 72px; padding: 28px 0 40px; border-top: 1px solid var(--line); font-size: .95rem; color: var(--muted); }
footer p { margin: 4px 0; }
.foot-nav { display: flex; flex-wrap: wrap; gap: 4px 20px; margin-bottom: 10px; }
.foot-nav a { font-weight: 700; display: inline-flex; align-items: center; min-height: 44px; }
.sb-footer { display: grid; gap: 6px; }
.sb-footer p { margin: 0; line-height: 1.5; }
.sb-more a { display: inline-block; padding: 6px 0; }
.sb-footer a { color: var(--accent); }
@media (prefers-reduced-motion: no-preference) { html { scroll-behavior: smooth; } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition: none !important; animation: none !important; } }
.print-only { display: none; }

/* 404 */
.nf { max-width: 640px; }
.nf-links { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 14px; }

@media (max-width: 419px) { .topbar nav a[href="#faq"] { display: none; } }
@media (max-width: 379px) { .topbar { gap: 8px; } .brand, .topbar nav a { font-size: .94rem; } .brand svg { width: 22px; } }

/* ---------- print: one clean page with just the plan ---------- */
@media print {
  @page { size: auto; margin: 12mm; }
  :root { --bg: #fff; --surface: #fff; --ink: #000; --muted: #444; --line: #bbb; --peach-soft: #eee; --peach: #000; --peach-ink: #000; --ok: #000; }
  html, body { background: #fff !important; color: #000; font-size: 10pt; line-height: 1.35; }
  .topbar, .hero, .form, .content, footer, .no-print, .skip, .tips, .tips-h { display: none !important; }
  .wrap { max-width: none; padding: 0; }
  .tool { display: block; }
  .result { box-shadow: none; padding: 0; border-radius: 0; }
  .print-only { display: block; }
  .print-title { font-size: 9pt; color: #555; margin: 0 0 2px; }
  .result h2 { font-size: 15pt; margin: 0 0 6px; }
  .summary { font-size: 10.5pt; margin-bottom: 8px; }
  .plan th { font-size: 9pt; padding: 4px 6px; border-bottom: 1.5px solid #000; }
  .plan td { padding: 4px 6px; }
  .plan .tm { font-size: 10pt; }
  .plan .end { display: inline; font-size: 8.5pt; margin-left: 2px; }
  .plan .mi { display: inline; margin-right: 8px; }
  .plan tr.change td { background: #eee !important; font-weight: 600; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .plan tr.change td:first-child { box-shadow: inset 3px 0 0 #000; }
  .plan tr { break-inside: avoid; }
}
/* "Change plan options": the less-used inputs, with a one-line summary of what is set */
details.more > summary .more-s { display: block; font-weight: 400; color: var(--muted); font-size: .95rem; margin-top: 2px; }
details.more .sub.first { margin-top: 4px; }
details.more fieldset.step { margin: 18px 0 0; }
details.more fieldset.step legend { font-size: 1.05rem; margin-bottom: 8px; }
