/* Bundled fonts (SIL Open Font License, see fonts/OFL-*.txt). No requests leave the extension. */
@font-face { font-family: "Fraunces"; src: url("fonts/Fraunces.woff2") format("woff2"); font-weight: 500 700; font-style: normal; font-display: swap; }
@font-face { font-family: "DM Sans"; src: url("fonts/DMSans.woff2") format("woff2"); font-weight: 400 700; font-style: normal; font-display: swap; }

/* Perch — direction A ("Warm"). Screen is cozy; print is plain black and white.
   Accessibility: all sizes in rem so they follow the browser's text-size setting.
   Type scale: 13px minimum (tags) · 14px secondary · 16px body · headings 18–38px.
   Colors: every text/background pair ≥ 4.5:1 (large text and icons ≥ 3:1), light and dark. */
:root {
  --bg: #FBF6EE;
  --card: #FFFFFF;
  --ink: #2E2924;
  --muted: #766959;   /* ≥4.5:1 on every light surface */
  --faint: #B5A893;   /* decorative only: hover borders, never text */
  --control: #8C7F6F; /* checkbox outlines, ≥3:1 */
  --line: #EDE3D4;
  --soft: #F6EFE4;
  --accent: #E0795A;      /* brand orange: logo, decorative edges only */
  --accent-ink: #B8502E;  /* same hue, accessible: icons, orange text, buttons (≥4.5:1) */
  --on-accent: #FFFFFF;   /* text on --accent-ink buttons */
  --good: #2F7566;
  --flag: #F2B33D;
  --warm-bg: #FFF5DD;
  --warm-line: #F4E2B5;
  --warm-ink: #7A5300;
  --shadow: 0 1px 0 var(--line), 0 12px 30px -18px rgba(80, 50, 20, .25);
  --serif: Fraunces, Georgia, serif;
  --sans: "DM Sans", -apple-system, "Segoe UI", Helvetica, Arial, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #1C1915; --card: #26221D; --ink: #F3ECE2; --muted: #A89A88; --faint: #7D705F; --control: #958775; --accent-ink: #EE916F; --good: #4FA48F; --line: #3A332B; --soft: #2F2A24;
    --warm-bg: #3A2F17; --warm-line: #57461F; --warm-ink: #F2C66B; --shadow: none; --on-accent: #1C1915;
  }
}
:root[data-theme="dark"] {
  --bg: #1C1915; --card: #26221D; --ink: #F3ECE2; --muted: #A89A88; --faint: #7D705F; --control: #958775; --accent-ink: #EE916F; --good: #4FA48F; --line: #3A332B; --soft: #2F2A24;
  --warm-bg: #3A2F17; --warm-line: #57461F; --warm-ink: #F2C66B; --shadow: none; --on-accent: #1C1915;
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 1rem/1.5 var(--sans); -webkit-font-smoothing: antialiased; }
a { color: inherit; }
button, select, input { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; }
.link:disabled { color: var(--muted); text-decoration: none; }
main { max-width: 1100px; margin: 0 auto; padding: 0 20px 80px; }

.btn { border: none; background: var(--accent-ink); color: var(--on-accent); padding: 9px 16px; border-radius: 12px; font-weight: 700; font-size: 0.875rem; }
.btn:hover { filter: brightness(.95); }
.btn.small { padding: 6px 12px; border-radius: 10px; font-size: 0.875rem; }
.link { border: none; background: none; padding: 0; color: var(--accent-ink); font-weight: 500; text-decoration: underline; text-underline-offset: 2px; }

/* ---- splash / setup ---- */
.splash { min-height: 70vh; display: grid; place-content: center; justify-items: center; gap: 14px; color: var(--muted); }
.splash .logo-mark { width: 64px; height: 64px; animation: bob 1.6s ease-in-out infinite; }
@keyframes bob { 50% { transform: translateY(-6px); } }
@media (prefers-reduced-motion: reduce) { .splash .logo-mark { animation: none; } }
.setup { max-width: 520px; margin: 70px auto; padding: 0 20px; }
.setup h1 { font-family: var(--serif); font-size: 2rem; line-height: 1.15; letter-spacing: -.5px; margin: 26px 0 10px; }
.setup p { color: var(--muted); }
.setup label { font-weight: 500; font-size: 0.875rem; }
.setup input { width: 100%; padding: 11px 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--card); margin: 6px 0 14px; }
.setup .fine { font-size: 0.875rem; margin-top: 22px; }
.setup .demo-link { font-size: 0.9375rem; margin-top: 18px; }

/* ---- nav ---- */
.nav { max-width: 1100px; margin: 0 auto; padding: 18px 20px 0; display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.logo { display: flex; align-items: center; gap: 9px; font-family: var(--serif); font-weight: 700; font-size: 1.625rem; letter-spacing: -.5px; margin-right: auto; }
.logo-mark { width: 32px; height: 32px; flex: none; }
.demo { font-family: var(--sans); font-size: 0.8125rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; background: var(--warm-bg); color: var(--warm-ink); padding: 2px 8px; border-radius: 999px; }
.kids { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { display: flex; align-items: center; gap: 7px; padding: 5px 13px; border-radius: 999px; background: var(--card); border: 1px solid var(--line); font-size: 0.875rem; font-weight: 500; }
.chip:has(.av) { padding-left: 5px; }
.chip.on { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.seg { display: flex; background: var(--soft); border-radius: 12px; padding: 3px; }
.seg button { border: none; background: transparent; padding: 6px 12px; border-radius: 9px; font-size: 0.875rem; color: var(--muted); }
.seg button.on { background: var(--card); color: var(--ink); font-weight: 500; box-shadow: 0 1px 2px rgba(0,0,0,.08); }
.av { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; background: var(--kid, var(--accent)); color: #fff; font-weight: 700; font-size: 0.875rem; flex: none; }
.av.big { width: 42px; height: 42px; font-size: 1.125rem; }

/* ---- hero + week strip ---- */
.hero { padding-top: 30px; }
.hero h1 { font-family: var(--serif); font-size: 2.375rem; line-height: 1.12; letter-spacing: -1px; margin: 0 0 6px; font-weight: 700; }
.hero h1 em { font-style: normal; color: var(--accent-ink); }
.hero .sub { color: var(--muted); margin: 0; }
.web-demo { background: #2E2924; color: #FBF6EE; text-align: center; font-size: 0.875rem; padding: 9px 16px; }
.web-demo a { color: #F2A285; font-weight: 700; margin-left: 4px; white-space: nowrap; }
.banner { margin: 20px 0 0; padding: 12px 16px; border-radius: 14px; background: var(--warm-bg); color: var(--warm-ink); border: 1px solid var(--warm-line); }

.week { display: grid; grid-template-columns: repeat(7, 1fr); gap: 8px; margin: 26px 0 28px; }
.day { position: relative; background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 10px 6px 12px; text-align: center; display: grid; justify-items: center; }
.day:not(:disabled):hover { border-color: var(--faint); }
.day.today { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.day.past { background: var(--soft); border-color: transparent; }
.day.past .n { color: var(--muted); }
.day .d { font-size: 0.8125rem; color: var(--muted); text-transform: uppercase; letter-spacing: .08em; }
.day.today .d { color: var(--bg); }
.day .n { font-family: var(--serif); font-size: 1.375rem; font-weight: 700; margin: 2px 0 6px; }
.dots { display: flex; justify-content: center; flex-wrap: wrap; gap: 4px; min-height: 8px; max-width: 64px; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--kid); }
.flag { position: absolute; top: -9px; right: -3px; background: var(--flag); color: #3A2A05; font-size: 0.8125rem; font-weight: 700; padding: 2px 7px; border-radius: 999px; }
.flag.maybe { background: var(--card); color: var(--warm-ink); border: 1.5px dashed var(--flag); }

/* ---- cards ---- */
.card, .tonight-card header > div, .item .txt, .note-card > div { min-width: 0; overflow-wrap: anywhere; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 22px; padding: 22px; box-shadow: var(--shadow); }
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 20rem), 1fr)); gap: 20px; }
.tonight-card header, .detail-h { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.tonight-card h3 { font-family: var(--serif); font-size: 1.375rem; margin: 0; }
.tonight-card header p { margin: 0; font-size: 0.875rem; color: var(--muted); }
.tonight-card { border-top: 5px solid var(--kid); }
.item { display: flex; gap: 12px; align-items: flex-start; padding: 11px 0; border-top: 1px dashed var(--line); cursor: pointer; }
.item .txt { display: grid; }
.item .t { font-weight: 500; }
.item .m { font-size: 0.875rem; color: var(--muted); }
.item.checked .t { text-decoration: line-through; color: var(--muted); }
.pts { margin-left: auto; font-size: 0.8125rem; color: var(--muted); background: var(--soft); padding: 2px 8px; border-radius: 999px; white-space: nowrap; }
.empty-small { color: var(--muted); padding: 10px 0; border-top: 1px dashed var(--line); margin: 0; }
.ico { width: 20px; height: 20px; flex: none; color: var(--accent-ink); margin-top: 1px; }
.ico.inline { width: 1em; height: 1em; vertical-align: -0.12em; margin: 0; }
.hero h1 .ico.inline { width: .8em; height: .8em; vertical-align: -0.02em; }
.note-card { margin: 12px 0 0; background: var(--warm-bg); border-radius: 14px; padding: 12px 14px; font-size: 0.875rem; display: flex; gap: 10px; }
.note-card b { color: var(--warm-ink); }
.note-card a { color: var(--warm-ink); font-weight: 500; }
.note-card.flat { margin: 6px 0 10px; }

/* round checkboxes */
.ck { appearance: none; -webkit-appearance: none; width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--control); flex: none; margin: 1px 0 0; position: relative; cursor: pointer; background: var(--card); transition: background .15s, border-color .15s; }
.ck:checked { background: var(--good); border-color: var(--good); }
.ck:checked::after { content: ""; position: absolute; left: 6px; top: 2px; width: 5px; height: 10px; border: solid #fff; border-width: 0 2px 2px 0; transform: rotate(45deg); }
.ck:focus-visible { outline: 2px solid var(--accent-ink); outline-offset: 2px; }

/* ---- detail (the printable list) ---- */
.detail { margin-top: 30px; border-left: 6px solid var(--kid); }
.detail h2.kid { font-family: var(--serif); font-size: 1.625rem; margin: 0; padding: 0; border: none; }
.detail .sub { color: var(--muted); margin: 0; font-size: 0.875rem; }
.mini { display: flex; flex-wrap: wrap; gap: 8px 28px; background: var(--soft); border-radius: 14px; padding: 12px 16px; margin: 6px 0 4px; font-size: 0.875rem; color: var(--muted); }
.mini b { display: block; font-family: var(--serif); font-size: 1.25rem; color: var(--ink); }
.detail h2 { font-family: var(--serif); font-size: 1.25rem; margin: 28px 0 6px; padding-bottom: 6px; border-bottom: 2px solid var(--ink); display: flex; justify-content: space-between; gap: 10px; }
.detail h2 span { font-family: var(--sans); font-weight: 400; color: var(--muted); font-size: 0.875rem; align-self: end; }
h3.night { font-size: 0.8125rem; margin: 16px 0 2px; color: var(--muted); text-transform: uppercase; letter-spacing: .07em; scroll-margin-top: 20px; }
h3.night.tonight { color: var(--accent-ink); }
table { width: 100%; border-collapse: collapse; }
td { padding: 8px 6px; border-bottom: 1px dashed var(--line); vertical-align: middle; }
td.box { width: 32px; }
td.box .ck { display: block; }
td.cls { width: 120px; color: var(--muted); font-size: 0.875rem; }
td.nm a { text-decoration: none; }
td.nm a:hover { text-decoration: underline; }
td.when { width: 150px; white-space: nowrap; color: var(--muted); font-size: 0.875rem; }
td.pts { width: 46px; text-align: right; white-space: nowrap; background: none; font-size: 0.875rem; color: var(--ink); }
td.plan { width: 112px; text-align: right; }
td.plan select { font-size: 0.8125rem; padding: 3px 4px; border: 1px solid var(--line); border-radius: 8px; background: var(--card); max-width: 108px; color: var(--muted); }
td.plan select.moved { border-color: var(--accent-ink); color: var(--accent-ink); }
tr.checked td.nm, tr.checked td.cls, tr.checked td.when, tr.checked td.pts { text-decoration: line-through; color: var(--muted); }
.pill { font-size: 0.8125rem; padding: 1px 7px; border-radius: 999px; background: var(--soft); color: var(--muted); margin-left: 4px; white-space: nowrap; }
.pill.ok { background: #E3F1EC; color: #2F7566; }
.pill.likely { background: var(--warm-bg); color: var(--warm-ink); }
.kind { font-weight: 700; }
.x { border: none; background: none; color: var(--muted); padding: 0 6px; font-size: 1.125rem; line-height: 1; }
.none { color: var(--muted); font-size: 0.875rem; padding: 6px 6px 2px; margin: 0; }
.note { color: var(--muted); font-size: 0.875rem; margin: 8px 0; }
.group-head td { background: var(--soft); font-weight: 700; font-size: 0.875rem; border-bottom: none; border-radius: 8px; }
.group-head td .tag { font-weight: 400; color: var(--muted); }
form.add { display: flex; flex-wrap: wrap; gap: 8px; margin: 14px 0 0; padding: 12px; background: var(--soft); border-radius: 14px; }
::placeholder { color: var(--muted); opacity: 1; }
form.add input { flex: 1 1 220px; padding: 7px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--card); }
form.add select { padding: 6px 8px; border: 1px solid var(--line); border-radius: 10px; background: var(--card); }
details { margin-top: 26px; }
details summary { cursor: pointer; font-family: var(--serif); font-weight: 700; font-size: 1.125rem; }
.foot { color: var(--muted); font-size: 0.875rem; margin: 26px 0 0; border-top: 1px dashed var(--line); padding-top: 10px; }
.empty { color: var(--muted); text-align: center; padding: 40px 0; }

/* ---- phone ---- */
@media (max-width: 44em) { /* em: also switches when the browser text size is larger */
  .hero h1 { font-size: 1.875rem; }
  .week { gap: 12px 4px; grid-template-columns: repeat(auto-fit, minmax(3.25rem, 1fr)); }
  .day { min-width: 0; }
  .day { padding: 8px 2px 10px; border-radius: 12px; }
  .day .n { font-size: 1.125rem; }
  .card { padding: 16px; border-radius: 18px; }
  .cards { grid-template-columns: 1fr; }
  main, .nav { padding-left: 16px; padding-right: 16px; }
  .detail { border-left-width: 4px; }
  .flag { font-size: 0.8125rem; padding: 0 5px; top: -10px; right: -4px; }
  /* Stack each table row so nothing scrolls sideways:
     [✓] Title
         Class
         Due date            pts
         Move to…                */
  table, tbody { display: block; }
  tr { display: grid; grid-template-columns: 30px 1fr auto; column-gap: 8px; padding: 8px 0; border-bottom: 1px dashed var(--line); }
  td { display: block; border: none; padding: 1px 0; width: auto !important; }
  td.box { grid-column: 1; grid-row: 1 / span 4; padding-top: 2px; }
  td.nm { grid-column: 2 / 4; grid-row: 1; }
  td.cls { grid-column: 2 / 4; grid-row: 2; }
  td.when { grid-column: 2; grid-row: 3; white-space: normal; }
  td.pts { grid-column: 3; grid-row: 3; }
  td.plan { grid-column: 2 / 4; grid-row: 4; text-align: left; padding-top: 4px; }
  td.plan select { max-width: none; }
  tr.group-head { display: block; padding: 0; border: none; margin-top: 8px; }
  tr.group-head td { padding: 6px 10px; }
}

/* ---- print: plain checklist, one kid per page ---- */
@media print {
  :root, :root[data-theme="dark"] {
    --bg: #fff; --card: #fff; --ink: #000; --muted: #555; --faint: #777; --line: #bbb; --soft: #f1f1f1;
    --accent: #000; --accent-ink: #000; --control: #000; --good: #000; --warm-bg: #fff; --warm-line: #999; --warm-ink: #000; --shadow: none;
  }
  .no-print, .screen-only, .nav, form.add, td.plan, .x { display: none !important; }
  body { font-size: 11pt; }
  main { max-width: none; padding: 0; }
  .card { border: none; border-radius: 0; padding: 0; box-shadow: none; }
  .detail { margin: 0; border-left: none; }
  .detail + .detail { break-before: page; }
  .detail-h .av { border: 1.5px solid #000; background: #fff; color: #000; }
  .mini { background: none; border: 1px solid #bbb; }
  tr, .mini, .note-card { break-inside: avoid; }
  h2, h3 { break-after: avoid; }
  .ck { border-radius: 3px; border: 1.5px solid #000; width: 15px; height: 15px; }
  .ck:checked { background: #000; }
  .ck:checked::after { left: 4px; top: 1px; width: 4px; height: 8px; }
  td { border-bottom: 1px solid #ccc; }
  .note-card { border: 1px solid #999; }
  .group-head td { background: #eee; }
  details { display: block; }
  details:not([open]) { display: none; }
}
