/* Nia — Dusk
   Warm paper and coral. Cabinet Grotesk for headings, Satoshi for everything else.

   There are no accessibility "modes" in this file, by design. The reading comfort that used
   to hide behind a toggle — 18px body, 1.6 line height, open letterforms, generous spacing,
   bold instead of italics, one thing per screen — is simply how the app is built, for
   everyone. Nothing here announces what it is doing for anyone.

   Light is the default. Dark is complete: every surface, every state. The theme is set on
   <html> before first paint so there is no white flash. */

/* ---------- type ---------- */
@font-face { font-family: 'Satoshi'; src: url("../fonts/Satoshi-400.71a6023c087c.woff2") format('woff2'); font-weight: 400; font-display: swap; }
@font-face { font-family: 'Satoshi'; src: url("../fonts/Satoshi-500.cd790237ed63.woff2") format('woff2'); font-weight: 500; font-display: swap; }
@font-face { font-family: 'Satoshi'; src: url("../fonts/Satoshi-700.d4db658f4dd6.woff2") format('woff2'); font-weight: 700; font-display: swap; }
@font-face { font-family: 'Satoshi'; src: url("../fonts/Satoshi-900.d9749ed5ed84.woff2") format('woff2'); font-weight: 900; font-display: swap; }
@font-face { font-family: 'Cabinet Grotesk'; src: url("../fonts/CabinetGrotesk-700.859bd02cd6a8.woff2") format('woff2'); font-weight: 700; font-display: swap; }
@font-face { font-family: 'Cabinet Grotesk'; src: url("../fonts/CabinetGrotesk-800.191150578c85.woff2") format('woff2'); font-weight: 800; font-display: swap; }
@font-face { font-family: 'Cabinet Grotesk'; src: url("../fonts/CabinetGrotesk-900.4a40323635fb.woff2") format('woff2'); font-weight: 900; font-display: swap; }

/* ---------- tokens ---------- */
:root {
  --font-body: 'Satoshi', ui-sans-serif, system-ui, -apple-system, sans-serif;
  --font-display: 'Cabinet Grotesk', 'Satoshi', ui-sans-serif, system-ui, sans-serif;

  --bg: #FAF7F4;
  --surface: #FFFFFF;
  --surface-2: #F3EEE9;
  --sunken: #F0EAE4;
  --ink: #16130F;
  --ink-2: #4C453E;
  --ink-3: #7B726A;
  --line: #E4DCD3;
  --line-2: #D3C8BC;

  --accent: #E2562F;
  --accent-ink: #FFFFFF;
  --accent-soft: #FCEDE7;
  --accent-line: #F3C3B1;

  --second: #F5C563;
  --second-soft: #FDF3DF;

  --ok: #2F7D5C;
  --ok-soft: #E7F2EC;

  --radius: 16px;
  --radius-lg: 22px;
  --radius-sm: 10px;
  --shadow: 0 1px 2px rgba(22,19,15,.05), 0 6px 20px rgba(22,19,15,.05);
  --shadow-lift: 0 2px 6px rgba(22,19,15,.07), 0 16px 40px rgba(22,19,15,.09);

  --step: 18px;          /* body size — the floor, not a "large text" option */
  --tap: 48px;
  --tap-primary: 56px;
  --gutter: 16px;
  --bar: 64px;
}

/* Her colour. Five ordinary choices, offered the way any app offers a theme colour. */
:root[data-accent="amber"] { --accent:#C98A10; --accent-soft:#FBF1DC; --accent-line:#EBD3A0; }
:root[data-accent="sea"]   { --accent:#1C7C8C; --accent-soft:#E3F1F3; --accent-line:#A8D4DA; }
:root[data-accent="plum"]  { --accent:#8A4A9E; --accent-soft:#F4EAF7; --accent-line:#D9BDE3; }
:root[data-accent="ink"]   { --accent:#2F3A56; --accent-soft:#E9ECF3; --accent-line:#BFC7D8; }

:root[data-size="large"]  { --step: 20px; }
:root[data-size="xlarge"] { --step: 22px; }

/* ---------- dark ---------- */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg:#141210; --surface:#1E1B18; --surface-2:#262220; --sunken:#181513;
    --ink:#F2EDE7; --ink-2:#C3B9AF; --ink-3:#928779;
    --line:#302B27; --line-2:#3E3833;
    --accent:#FF7043; --accent-ink:#1A0D07; --accent-soft:#2E1C14; --accent-line:#4A2C1E;
    --second:#E8B44F; --second-soft:#2C2416;
    --ok:#5BB98C; --ok-soft:#16281F;
    --shadow: 0 1px 2px rgba(0,0,0,.35), 0 6px 20px rgba(0,0,0,.35);
    --shadow-lift: 0 2px 6px rgba(0,0,0,.4), 0 16px 40px rgba(0,0,0,.45);
  }
  :root:not([data-theme="light"])[data-accent="amber"] { --accent:#E8B44F; --accent-ink:#231A06; --accent-soft:#2C2416; --accent-line:#463A1E; }
  :root:not([data-theme="light"])[data-accent="sea"]   { --accent:#4FC2D2; --accent-ink:#06211F; --accent-soft:#12282C; --accent-line:#1E4148; }
  :root:not([data-theme="light"])[data-accent="plum"]  { --accent:#CF9BE0; --accent-ink:#1E0A26; --accent-soft:#271630; --accent-line:#432851; }
  :root:not([data-theme="light"])[data-accent="ink"]   { --accent:#9FB2DC; --accent-ink:#10162A; --accent-soft:#1A2034; --accent-line:#2C3550; }
}
:root[data-theme="dark"] {
  --bg:#141210; --surface:#1E1B18; --surface-2:#262220; --sunken:#181513;
  --ink:#F2EDE7; --ink-2:#C3B9AF; --ink-3:#928779;
  --line:#302B27; --line-2:#3E3833;
  --accent:#FF7043; --accent-ink:#1A0D07; --accent-soft:#2E1C14; --accent-line:#4A2C1E;
  --second:#E8B44F; --second-soft:#2C2416;
  --ok:#5BB98C; --ok-soft:#16281F;
  --shadow: 0 1px 2px rgba(0,0,0,.35), 0 6px 20px rgba(0,0,0,.35);
  --shadow-lift: 0 2px 6px rgba(0,0,0,.4), 0 16px 40px rgba(0,0,0,.45);
}
:root[data-theme="dark"][data-accent="amber"] { --accent:#E8B44F; --accent-ink:#231A06; --accent-soft:#2C2416; --accent-line:#463A1E; }
:root[data-theme="dark"][data-accent="sea"]   { --accent:#4FC2D2; --accent-ink:#06211F; --accent-soft:#12282C; --accent-line:#1E4148; }
:root[data-theme="dark"][data-accent="plum"]  { --accent:#CF9BE0; --accent-ink:#1E0A26; --accent-soft:#271630; --accent-line:#432851; }
:root[data-theme="dark"][data-accent="ink"]   { --accent:#9FB2DC; --accent-ink:#10162A; --accent-soft:#1A2034; --accent-line:#2C3550; }

/* ---------- base ---------- */
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: var(--step);
  line-height: 1.6;
  letter-spacing: .01em;
  -webkit-font-smoothing: antialiased;
  padding-bottom: calc(var(--bar) + env(safe-area-inset-bottom, 0px));
}
h1, h2, h3, .display {
  font-family: var(--font-display);
  font-weight: 800;
  line-height: 1.15;
  letter-spacing: -.02em;
  margin: 0 0 .4em;
}
h1 { font-size: 1.85rem; }
h2 { font-size: 1.3rem; }
h3 { font-size: 1.05rem; font-weight: 700; }
p { margin: 0 0 1em; max-width: 62ch; }
em, i { font-style: normal; font-weight: 700; }   /* italics are never used for emphasis */
a { color: var(--accent); text-decoration-thickness: 1.5px; text-underline-offset: 3px; }
small, .small { font-size: .82rem; color: var(--ink-3); letter-spacing: .015em; }
hr { border: 0; border-top: 1px solid var(--line); margin: 1.4rem 0; }

:where(a, button, input, select, textarea, [tabindex]):focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
  border-radius: 6px;
}

.wrap { max-width: 640px; margin: 0 auto; padding: 0 var(--gutter); }
.wrap-wide { max-width: 1040px; margin: 0 auto; padding: 0 var(--gutter); }
.stack > * + * { margin-top: var(--s, 14px); }
.row { display: flex; gap: 10px; align-items: center; }
.row-between { display: flex; gap: 10px; align-items: center; justify-content: space-between; }
.grow { flex: 1 1 auto; min-width: 0; }
.muted { color: var(--ink-3); }
.center { text-align: center; }

/* ---------- top bar ---------- */
.top {
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px; padding: 18px var(--gutter) 6px;
  max-width: 640px; margin: 0 auto;
}
.top .date { font-family: var(--font-display); font-weight: 800; font-size: 1.5rem; letter-spacing: -.02em; }

/* ---------- blocks strip ---------- */
.blocks { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.block {
  min-width: 34px; height: 34px; padding: 0 9px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 10px; background: var(--surface-2); border: 1px solid var(--line);
  font-weight: 700; font-size: .95rem; letter-spacing: .02em;
}
.block-named { width: auto; gap: 7px; }

/* ---------- cards ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow);
}
a.card, button.card { display: block; width: 100%; text-align: left; color: inherit; text-decoration: none; cursor: pointer; }
a.card:hover, button.card:hover { box-shadow: var(--shadow-lift); border-color: var(--line-2); }
.card-title { font-weight: 700; font-size: 1.05rem; line-height: 1.35; margin: 0 0 4px; }
.card-meta { font-size: .85rem; color: var(--ink-3); display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.card.is-done { opacity: .5; }
.card.is-next { border-color: var(--accent-line); box-shadow: 0 0 0 3px var(--accent-soft), var(--shadow); }

.chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 10px; border-radius: 999px;
  background: var(--surface-2); border: 1px solid var(--line);
  font-size: .78rem; font-weight: 500; letter-spacing: .02em; color: var(--ink-2);
  white-space: nowrap;
}
.chip-accent { background: var(--accent-soft); border-color: var(--accent-line); color: var(--accent); }
.chip-ok { background: var(--ok-soft); border-color: transparent; color: var(--ok); }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: var(--tap); padding: 0 20px;
  border-radius: 14px; border: 1px solid var(--line-2);
  background: var(--surface); color: var(--ink);
  font-family: inherit; font-size: 1rem; font-weight: 700; letter-spacing: .01em;
  cursor: pointer; text-decoration: none;
}
.btn:hover { background: var(--surface-2); }
.btn-primary {
  min-height: var(--tap-primary);
  background: var(--accent); border-color: var(--accent); color: var(--accent-ink);
  box-shadow: 0 2px 10px color-mix(in srgb, var(--accent) 30%, transparent);
}
.btn-primary:hover { background: color-mix(in srgb, var(--accent) 88%, black); }
.btn-block { display: flex; width: 100%; }
.btn-quiet { border-color: transparent; background: transparent; color: var(--ink-2); font-weight: 500; }
.btn-quiet:hover { background: var(--surface-2); }
.btn-sm { min-height: 38px; padding: 0 14px; font-size: .88rem; border-radius: 10px; }

/* ---------- forms ---------- */
label { display: block; font-weight: 700; font-size: .9rem; margin-bottom: 6px; }
input[type=text], input[type=email], input[type=password], input[type=url], input[type=number],
input[type=date], input[type=time], select, textarea {
  width: 100%; min-height: var(--tap); padding: 12px 14px;
  background: var(--surface); color: var(--ink);
  border: 1px solid var(--line-2); border-radius: 12px;
  font-family: inherit; font-size: 1rem; line-height: 1.5;
}
textarea { min-height: 120px; resize: vertical; }
input::placeholder, textarea::placeholder { color: var(--ink-3); }
input:disabled, select:disabled, textarea:disabled { background: var(--sunken); color: var(--ink-3); cursor: not-allowed; }
.field + .field { margin-top: 14px; }
.hint { font-size: .84rem; color: var(--ink-3); margin-top: 5px; }

.seg { display: flex; gap: 6px; flex-wrap: wrap; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg label {
  margin: 0; min-height: 42px; padding: 0 14px; display: inline-flex; align-items: center;
  border: 1px solid var(--line-2); border-radius: 999px; background: var(--surface);
  font-weight: 500; font-size: .9rem; cursor: pointer;
}
.seg input:checked + label { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 700; }
.seg input:focus-visible + label { outline: 3px solid var(--accent); outline-offset: 2px; }

.swatches { display: flex; gap: 10px; }
.swatch { width: 40px; height: 40px; border-radius: 999px; border: 2px solid var(--line-2); cursor: pointer; }
.swatch[aria-pressed="true"] { border-color: var(--ink); box-shadow: 0 0 0 3px var(--surface), 0 0 0 5px var(--ink); }

/* ---------- the teacher's own words ---------- */
.teacher {
  background: var(--sunken);
  border: 1px solid var(--line);
  border-left: 4px solid var(--second);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  white-space: pre-wrap;
  font-size: .96rem;
  line-height: 1.62;
}
.teacher-label {
  font-size: .78rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase;
  color: var(--ink-3); margin-bottom: 7px;
}

/* ---------- checklist ---------- */
.checks { list-style: none; margin: 0; padding: 0; }
.checks li { margin: 0 0 2px; }
.checks button {
  display: flex; align-items: flex-start; gap: 12px; width: 100%;
  min-height: var(--tap); padding: 10px 12px;
  background: transparent; border: 0; border-radius: 12px;
  font: inherit; color: inherit; text-align: left; cursor: pointer;
}
.checks button:hover { background: var(--surface-2); }
.checks .box {
  flex: 0 0 auto; width: 24px; height: 24px; margin-top: 2px;
  border: 2px solid var(--line-2); border-radius: 7px;
}
.checks [aria-pressed="true"] .box { background: var(--accent); border-color: var(--accent); }
.checks [aria-pressed="true"] .box::after {
  content: ""; display: block; width: 6px; height: 11px; margin: 1px auto 0;
  border: solid var(--accent-ink); border-width: 0 2.5px 2.5px 0; transform: rotate(45deg);
}
.checks [aria-pressed="true"] .txt { color: var(--ink-3); text-decoration: line-through; }

/* ---------- timer ---------- */
.timer { font-family: var(--font-display); font-weight: 800; font-size: 1.15rem; font-variant-numeric: tabular-nums; }

/* ---------- chat ---------- */
.thread { display: flex; flex-direction: column; gap: 12px; padding-bottom: 8px; }
.bubble { max-width: 90%; padding: 12px 15px; border-radius: 18px; }
.bubble-tutor { align-self: flex-start; background: var(--surface); border: 1px solid var(--line); border-bottom-left-radius: 6px; }
.bubble-her { align-self: flex-end; background: var(--accent); color: var(--accent-ink); border-bottom-right-radius: 6px; }
.bubble-her a { color: var(--accent-ink); }
.bubble p:last-child { margin-bottom: 0; }

.composer {
  position: fixed; left: 0; right: 0; bottom: calc(var(--bar) + env(safe-area-inset-bottom, 0px));
  background: var(--bg); border-top: 1px solid var(--line);
  padding: 10px var(--gutter);
}
.composer .inner { max-width: 640px; margin: 0 auto; display: flex; gap: 8px; align-items: flex-end; }
.composer textarea { min-height: var(--tap); max-height: 140px; border-radius: 22px; padding: 12px 16px; }
.icon-btn {
  flex: 0 0 auto; width: var(--tap); height: var(--tap);
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 999px; border: 1px solid var(--line-2); background: var(--surface);
  cursor: pointer; color: var(--ink-2);
}
.icon-btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }

/* ---------- bottom nav ---------- */
.tabs {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
  height: calc(var(--bar) + env(safe-area-inset-bottom, 0px));
  padding-bottom: env(safe-area-inset-bottom, 0px);
  display: flex; background: var(--surface); border-top: 1px solid var(--line);
}
.tabs a {
  flex: 1 1 0; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 3px; text-decoration: none; color: var(--ink-3); font-size: .72rem; font-weight: 500;
  letter-spacing: .02em; min-height: var(--tap);
}
.tabs a[aria-current="page"] { color: var(--accent); font-weight: 700; }
.tabs svg { width: 22px; height: 22px; }

/* ---------- end of the hour ---------- */
.done-state { text-align: center; padding: 48px 0 24px; }
.done-state .mark {
  width: 76px; height: 76px; margin: 0 auto 18px; border-radius: 999px;
  background: var(--accent-soft); border: 1px solid var(--accent-line);
  display: flex; align-items: center; justify-content: center; color: var(--accent);
}
.done-state h1 { font-size: 1.6rem; }

/* ---------- parent side ---------- */
.parent { padding-bottom: 40px; }
.parent body, body.parent { padding-bottom: 40px; }
.parent .panel {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px;
}
.parent h2 {
  font-size: .78rem; font-weight: 700; letter-spacing: .09em; text-transform: uppercase;
  color: var(--ink-3); font-family: var(--font-body);
}
.needs { border-left: 4px solid var(--accent); }
.needs li { padding: 10px 0; border-bottom: 1px solid var(--line); }
.needs li:last-child { border-bottom: 0; }

table.data { width: 100%; border-collapse: collapse; font-size: .92rem; }
table.data th {
  text-align: left; font-size: .74rem; letter-spacing: .07em; text-transform: uppercase;
  color: var(--ink-3); font-weight: 700; padding: 8px 10px; border-bottom: 1px solid var(--line-2);
}
table.data td { padding: 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
table.data td.num { text-align: right; font-variant-numeric: tabular-nums; }
table.data tr:last-child td { border-bottom: 0; }
.unknown { color: var(--ink-3); font-style: normal; }

.strip { display: flex; gap: 6px; }
.strip .d {
  flex: 1 1 0; text-align: center; padding: 9px 4px; border-radius: 10px;
  background: var(--sunken); border: 1px solid var(--line); font-size: .74rem;
}
.strip .d.on { background: var(--ok-soft); border-color: transparent; color: var(--ok); font-weight: 700; }
.strip .d.future { opacity: .45; }
.strip .d b { display: block; font-size: .92rem; font-family: var(--font-display); }

.nav-parent { display: flex; gap: 4px; overflow-x: auto; padding: 4px 0 14px; }
.nav-parent a {
  padding: 8px 14px; border-radius: 999px; text-decoration: none; white-space: nowrap;
  color: var(--ink-2); font-size: .9rem; font-weight: 500; border: 1px solid transparent;
}
.nav-parent a[aria-current="page"] { background: var(--surface); border-color: var(--line); color: var(--ink); font-weight: 700; }

.flash { padding: 12px 15px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface-2); margin-bottom: 14px; }
.flash-ok { background: var(--ok-soft); border-color: transparent; color: var(--ok); }
.flash-warn { background: var(--second-soft); border-color: transparent; }

/* ---------- print: the routine statement for the school ---------- */
@media print {
  :root { --bg:#fff; --surface:#fff; --surface-2:#fff; --sunken:#f6f4f1;
          --ink:#111; --ink-2:#333; --ink-3:#666; --line:#ddd; --line-2:#bbb; --accent:#333; }
  body { padding: 0; font-size: 11pt; }
  .tabs, .composer, .nav-parent, .no-print { display: none !important; }
  .panel, .card { box-shadow: none; border: 1px solid #ddd; break-inside: avoid; }
  a { color: #111; text-decoration: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

.section-label {
  font-family: var(--font-body);
  font-size: .78rem; font-weight: 700; letter-spacing: .09em; text-transform: uppercase;
  color: var(--ink-3); margin: 0;
}
details > summary { cursor: pointer; list-style: none; }
details > summary::-webkit-details-marker { display: none; }
details > summary::before { content: "▸ "; color: var(--ink-3); }
details[open] > summary::before { content: "▾ "; }

.milestone-box {
  flex: 0 0 auto; width: 22px; height: 22px; border-radius: 7px;
  border: 2px solid var(--line-2); background: transparent;
}
.milestone-box.is-done { background: var(--accent); border-color: var(--accent); }
.milestone-done { color: var(--ink-3); text-decoration: line-through; }

/* A dense table is the right shape for the parent's laptop and the wrong shape for a phone.
   The panel scrolls sideways rather than pushing the whole page wide. */
.parent .panel { overflow-x: auto; }
table.data { min-width: 100%; }

@media (max-width: 560px) {
  .nav-parent { margin: 0 calc(var(--gutter) * -1); padding-left: var(--gutter); padding-right: var(--gutter); }
  table.data th, table.data td { white-space: nowrap; }
  table.data td:first-child { white-space: normal; min-width: 150px; }
  .strip { gap: 3px; }
  .strip .d { padding: 7px 2px; font-size: .66rem; }
}
