/*
 * ringo — calm, friendly, simple. One column, no dropdowns; plain
 * pages and links, and one gentle dialog.
 */

:root {
    --paper: #FAF9F6;
    --paper-deep: #F1EEE6;    /* the footer's band; soft ink is 4.5:1 on it */
    --ink: #2A2925;
    --ink-soft: #6F6C63;
    --accent: #5B7B6C;        /* sage */
    --accent-dark: #48624F;
    --accent-soft: #E9EFEA;
    --warn: #8F5A22;          /* warm, never alarm-red; 5.6:1 on paper */
    --warn-soft: #F6EBDD;
    --line: #E3E0D8;
    --line-strong: #8A867C;   /* input + quiet-button edges, 3.1:1 */
    --card: #FFFFFF;

    /* The garden's paper and the shelf's wood: warmer than the page,
       cousins of the landing plate's cream */
    --garden-paper: #FBF6EA;
    --garden-line: #E8DFCB;
    --garden-fade: #D6E2D8;
    --wood: #CDBB9F;
    --wood-dark: #B39F82;

    --space-1: 0.25rem;
    --space-2: 0.5rem;
    --space-3: 1rem;
    --space-4: 1.5rem;
    --space-5: 2.5rem;

    --radius: 8px;
}

body {
    background: var(--paper);
    color: var(--ink);
    font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
}

/* ---- layout ---- */

main {
    margin: 0 auto;
    padding: var(--space-4) var(--space-3) var(--space-5);
}

main.narrow { max-width: 46rem; }
main.wide { max-width: 64rem; }
/* A page that is one column of form (sign-up, log in, onboarding,
   feedback, and the term, vacation, kid, doing, and reshuffle forms)
   is only as wide as that column, so it sits centred under the
   header. */
main.column { max-width: calc(30rem + 2 * var(--space-3)); }

.site-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: var(--space-2) var(--space-3);
    max-width: 64rem;
    margin: 0 auto;
    padding: var(--space-3);
}

.wordmark {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    font-weight: 700;
    font-size: 1.25rem;
    color: var(--accent-dark);
    text-decoration: none;
    letter-spacing: 0.02em;
}

.wordmark img {
    width: 2.5rem;
    height: 2.5rem;
}

/* ---- the badge's tricks ----
   Under the cursor (or on focus) the badge does one of three tricks,
   picked at random by logo_trick.js: a hop and one flat turn, a hop
   and one turn on its vertical axis, or a bounce that settles. With
   no script it always does the flat turn. The word stays put. */
.wordmark .badge {
    position: relative;
    flex: none;
    width: 2.5rem;
    height: 2.5rem;
    transform-style: preserve-3d;
}

.wordmark .badge img {
    position: relative;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    transform: translateZ(3px);
}

/* A coin has an edge and a back. Two discs behind the picture, a
   little way back, give the vertical turn its thickness; they sit
   just inside the picture's rim so nothing shows at rest. */
.wordmark .badge::before,
.wordmark .badge::after {
    content: "";
    position: absolute;
    inset: 1px;
    border-radius: 50%;
    background: var(--accent);
}

.wordmark .badge::after {
    transform: translateZ(-3px) rotateY(180deg);
    backface-visibility: hidden;
}

/* A hop, then one unhurried flat turn */
@keyframes wordmark-spin {
    0% {
        transform: translateY(0) rotate(0);
        animation-timing-function: ease-out;
    }
    11% {
        transform: translateY(-0.4rem) rotate(0);
        animation-timing-function: ease-in;
    }
    22% {
        transform: translateY(0) rotate(0);
        animation-timing-function: ease-in-out;
    }
    100% { transform: translateY(0) rotate(360deg); }
}

/* A hop, then one turn on the vertical axis, seen in perspective */
@keyframes wordmark-flip {
    0% {
        transform: perspective(10rem) translateY(0) rotateY(0);
        animation-timing-function: ease-out;
    }
    11% {
        transform: perspective(10rem) translateY(-0.4rem) rotateY(0);
        animation-timing-function: ease-in;
    }
    22% {
        transform: perspective(10rem) translateY(0) rotateY(0);
        animation-timing-function: ease-in-out;
    }
    100% { transform: perspective(10rem) translateY(0) rotateY(360deg); }
}

/* A big bounce that dies down to a little one, then still. Each
   bounce is shorter in time as well as height, as a dropped ball is. */
@keyframes wordmark-bounce {
    0% { transform: translateY(0); animation-timing-function: ease-out; }
    20% { transform: translateY(-1rem); animation-timing-function: ease-in; }
    40% { transform: translateY(0); animation-timing-function: ease-out; }
    54% { transform: translateY(-0.5rem); animation-timing-function: ease-in; }
    68% { transform: translateY(0); animation-timing-function: ease-out; }
    78% { transform: translateY(-0.25rem); animation-timing-function: ease-in; }
    88% { transform: translateY(0); animation-timing-function: ease-out; }
    94% { transform: translateY(-0.1rem); animation-timing-function: ease-in; }
    100% { transform: translateY(0); }
}

/* Tricks are for a cursor that can hover: on a phone the badge keeps
   still (logo_trick.js checks the same thing). */
@media (hover: hover) and (pointer: fine) {
    .wordmark .badge[data-trick="spin"],
    .wordmark:not(.js-tricks):hover .badge,
    .wordmark:not(.js-tricks):focus-visible .badge {
        animation: wordmark-spin 1.2s both;
    }

    .wordmark .badge[data-trick="flip"] { animation: wordmark-flip 1.2s both; }
    .wordmark .badge[data-trick="bounce"] { animation: wordmark-bounce 1.4s both; }
}

/* When a schedule is made in place (generate.js) the badge cheers:
   its bounce, once, on any device — a phone included. */
.wordmark .badge[data-cheer] { animation: wordmark-bounce 1.4s both; }

@media (prefers-reduced-motion: reduce) {
    .wordmark .badge,
    .wordmark:hover .badge,
    .wordmark .badge[data-cheer],
    .wordmark:focus-visible .badge { animation: none; }
}

.site-header nav {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: var(--space-2);
}

.site-header nav form { margin: 0; }

.site-header nav .muted { padding: 0 var(--space-2); }

/* Nav items are placed, not underlined prose: quiet ink, a soft
 * sage pad under the cursor, and the Log out button stays the one
 * bordered thing on the row. */
.site-header nav a:not(.button) {
    color: var(--ink-soft);
    font-weight: 500;
    text-decoration: none;
    padding: var(--space-1) var(--space-2);
    border-radius: var(--radius);
}

.site-header nav a:not(.button):hover,
.site-header nav a:not(.button)[aria-current="page"] {
    color: var(--ink);
    background: var(--accent-soft);
}

/* The foot of every page: whose ringo is, where to write, and the
   policies. A band of deeper paper from edge to edge, so it reads as
   the page's foot rather than as more of the page; its contents keep
   the header's column. Screen only: it has no business on a printed
   schedule. */
.site-footer {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-rows: auto 1fr;
    gap: var(--space-2) var(--space-5);
    padding: var(--space-5)
        max(var(--space-3), calc(50% - 32rem + var(--space-3)));
    background: var(--paper-deep);
    border-top: 1px solid var(--line);
    font-size: 0.9rem;
    line-height: 1.5;
    color: var(--ink-soft);
}

.site-footer a { color: var(--accent-dark); }

.site-footer p { margin: 0; }

/* Whose ringo is. First in the footer, at the left in full ink, so
   it reads apart from the quieter things around it. */
.site-footer .site-footer-copyright {
    grid-column: 1;
    font-weight: 600;
    color: var(--ink);
}

/* The line that asks for a thought, on signed-in pages, under the
   copyright. */
.site-footer-feedback {
    grid-column: 1;
    max-width: 24rem;
}

/* Where to write and the policies: two labelled lists, side by side
   at the right. */
.site-footer-nav {
    grid-column: 2;
    grid-row: 1 / span 2;
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-4) var(--space-5);
}

/* The label's line is as tall as a line of the footer's text, so the
   labels and the copyright sit on one line. */
.site-footer .label {
    margin-bottom: var(--space-1);
    font-size: 0.72rem;
    line-height: 1.875;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.site-footer-links {
    margin: 0;
    padding: 0;
    list-style: none;
}

/* Placed links, not underlined prose; each a line tall enough for a
   thumb. */
.site-footer-links a {
    display: inline-block;
    padding: var(--space-1) 0;
    text-decoration: none;
}

.site-footer-links a:hover { text-decoration: underline; }

@media (max-width: 48rem) {
    .site-footer {
        grid-template-columns: minmax(0, 1fr);
        grid-template-rows: none;
        padding-block: var(--space-4);
    }

    .site-footer-nav {
        grid-column: 1;
        grid-row: auto;
        margin-top: var(--space-3);
    }
}

/* A short page still ends at the bottom of the window: the footer
   sits at the foot of the screen, not partway up it. */
@media screen {
    body {
        display: flex;
        flex-direction: column;
    }

    body > .site-header,
    body > .portal-sections,
    body > main {
        width: 100%;
    }

    body > main { flex: 1 0 auto; }
}

/* ---- type ---- */

h1 {
    font-size: 1.6rem;
    line-height: 1.25;
    margin-bottom: var(--space-3);
}

h2 {
    font-size: 1.15rem;
    margin-top: var(--space-5);
    margin-bottom: var(--space-3);
}

p { margin-bottom: var(--space-3); }

.muted { color: var(--ink-soft); }

/* Key facts under a page title (term dates, school days, a block's
 * summary) — labeled rows, not an afterthought of grey prose. */
.page-meta { margin-bottom: var(--space-4); }

.page-meta > p, .page-meta > div {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: var(--space-2);
    margin-bottom: var(--space-2);
}

.page-meta form { margin: 0; }

.page-meta .label {
    flex: none;
    min-width: 6.5rem;
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--ink-soft);
}

.day-pills {
    display: inline-flex;
    flex-wrap: wrap;
    gap: var(--space-1);
}

.day-pill {
    padding: 1px 10px;
    border-radius: 999px;
    border: 1px solid transparent;
    background: var(--accent-soft);
    color: var(--accent-dark);
    font-size: 0.8rem;
    font-weight: 600;
}

.day-pill.off {
    background: transparent;
    border-color: var(--line);
    color: var(--ink-soft);
    font-weight: 400;
}

.kid-chips {
    display: inline-flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: var(--space-1);
}

.kid-chip {
    padding: 1px 10px;
    border-radius: 999px;
    background: var(--accent-soft);
    color: var(--accent-dark);
    font-size: 0.8rem;
    font-weight: 400;
}

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
}

/* First tab stop on every page. Hidden until it has focus, then it
 * sits on top of the header as a plain button. */
.skip-link {
    position: absolute;
    left: var(--space-3);
    top: var(--space-2);
    z-index: 20;
    padding: var(--space-2) var(--space-3);
    background: var(--card);
    color: var(--ink);
    border: 1px solid var(--ink);
    border-radius: var(--radius);
    text-decoration: none;
    font-weight: 600;
    transform: translateY(-200%);
}

.skip-link:focus { transform: none; }

/* One focus ring for everything that takes keyboard focus. Ink on
 * paper, card, sage, or the generate gradient is always over 3:1. */
a:focus-visible, button:focus-visible, input:focus-visible,
select:focus-visible, textarea:focus-visible, summary:focus-visible,
[tabindex]:focus-visible {
    outline: 2px solid var(--ink);
    outline-offset: 2px;
}
.mission {
    font-size: 1.3rem;
    line-height: 1.5;
    color: var(--ink-soft);
    max-width: 34rem;
}

/* ---- links and buttons ----
 *
 * Links navigate; buttons act. Anything that changes state — or
 * deliberately leaves a form — is a button, never underlined text.
 */

a { color: var(--accent-dark); }
a:hover { color: var(--accent); }

.button, button[type="submit"] {
    display: inline-block;
    background: var(--accent);
    color: #fff;
    border: 1px solid transparent;
    border-radius: var(--radius);
    padding: var(--space-2) var(--space-4);
    text-decoration: none;
    font-weight: 600;
}

.button:hover, button[type="submit"]:hover {
    background: var(--accent-dark);
    color: #fff;
}

.button.secondary {
    background: transparent;
    color: var(--accent-dark);
    border-color: var(--accent);
}

.button.secondary:hover { background: var(--accent-soft); }

.button.quiet {
    background: var(--card);
    color: var(--ink);
    border-color: var(--line);
    font-weight: 400;
}

.button.quiet:hover {
    background: var(--accent-soft);
    color: var(--ink);
    border-color: var(--accent);
}

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

.button.danger:hover {
    background: var(--warn-soft);
    color: var(--warn);
}

.button.small {
    padding: var(--space-1) var(--space-3);
    font-size: 0.9rem;
}

/* The generate button is the payoff moment — everything on this
 * page feeds it. It gets depth, a lift under the cursor, and a
 * sheen that sweeps across on hover; still sage, never neon. */
.button.generate {
    position: relative;
    overflow: hidden;
    background: linear-gradient(135deg, var(--accent),
        var(--accent-dark));
    border: none;
    font-weight: 700;
    letter-spacing: 0.01em;
    box-shadow: 0 2px 8px rgba(72, 98, 79, 0.35);
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.button.generate::before {
    content: "✦ " / "";
}

.button.generate::after {
    content: "";
    position: absolute;
    top: 0;
    bottom: 0;
    left: -75%;
    width: 50%;
    background: linear-gradient(105deg, transparent,
        rgba(255, 255, 255, 0.35), transparent);
    transform: skewX(-20deg);
    transition: left 0.5s ease;
}

.button.generate:hover {
    background: linear-gradient(135deg, var(--accent),
        var(--accent-dark));
    transform: translateY(-1px);
    box-shadow: 0 5px 16px rgba(72, 98, 79, 0.45);
}

.button.generate:hover::after { left: 125%; }

.button.generate:active {
    transform: translateY(0);
    box-shadow: 0 1px 4px rgba(72, 98, 79, 0.35);
}

@media (prefers-reduced-motion: reduce) {
    .button.generate, .button.generate::after { transition: none; }
    .button.generate:hover { transform: none; }
}

/* While the server weaves a schedule (generate.js) the button says
 * so and its sheen keeps sweeping; a quiet button gets a sage one,
 * since white on white would show nothing. */
.button.weaving {
    position: relative;
    overflow: hidden;
    cursor: progress;
}

.button.weaving::after {
    content: "";
    position: absolute;
    top: 0;
    bottom: 0;
    left: -75%;
    width: 50%;
    background: linear-gradient(105deg, transparent,
        rgba(255, 255, 255, 0.35), transparent);
    transform: skewX(-20deg);
    animation: button-sheen 1.1s linear infinite;
}

.button.quiet.weaving::after {
    background: linear-gradient(105deg, transparent,
        rgba(91, 123, 108, 0.2), transparent);
}

@keyframes button-sheen {
    from { left: -75%; }
    to { left: 125%; }
}

@media (prefers-reduced-motion: reduce) {
    .button.weaving::after { animation: none; display: none; }
}

/* ---- forms ---- */

form.stack { max-width: 30rem; }

.field { margin-bottom: var(--space-4); }

/* Folded by form_deps.js when the choice it follows is not made */
.field[hidden] { display: none; }

.field label {
    display: block;
    font-weight: 600;
    margin-bottom: var(--space-1);
}

.field .optional {
    font-weight: 400;
    color: var(--ink-soft);
    font-size: 0.85rem;
}

input[type="text"], input[type="email"], input[type="password"],
input[type="url"], input[type="number"], input[type="date"], textarea,
select {
    width: 100%;
    background: var(--card);
    border: 1px solid var(--line-strong);
    border-radius: var(--radius);
    padding: var(--space-2) var(--space-3);
}

input:focus, textarea:focus, select:focus {
    outline: 2px solid var(--ink);
    outline-offset: 1px;
    border-color: var(--ink);
}

input[aria-invalid="true"], textarea[aria-invalid="true"] {
    border-color: var(--warn);
}

input[type="number"] { max-width: 8rem; }

.hint {
    color: var(--ink-soft);
    font-size: 0.85rem;
    margin: var(--space-1) 0 0;
}

.field-error {
    color: var(--warn);
    font-size: 0.9rem;
    margin: var(--space-1) 0 0;
}

.checkbox-row {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    margin-bottom: var(--space-2);
    font-weight: 400;
}

/* "Everyone" stands above the names it covers, ruled off so it reads
   as a shortcut rather than one more kid in the list. */
.checkbox-row.select-all {
    padding-bottom: var(--space-2);
    border-bottom: 1px solid var(--line);
    margin-bottom: var(--space-3);
    font-weight: 600;
}

/* Only one kid: whose schedule it is, stated — not a control with a
   single answer. */
.lone-choice {
    margin: 0;
    font-weight: 500;
}

.checkbox-grid {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2) var(--space-4);
    margin-bottom: var(--space-3);
}

fieldset {
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: var(--space-3) var(--space-4);
    margin-bottom: var(--space-4);
    background: var(--card);
}

legend {
    font-weight: 600;
    padding: 0 var(--space-2);
}

/* A fieldset that groups a couple of small controls under one word
   (Born: month + year) — grouped for assistive tech, but drawn as
   plain fields rather than a boxed section of the form. */
fieldset.plain {
    border: 0;
    padding: 0;
    background: none;
    margin-bottom: var(--space-2);
}

fieldset.plain legend {
    padding: 0;
    margin-bottom: var(--space-1);
}

.born-row {
    display: flex;
    align-items: flex-start;
    flex-wrap: wrap;
    gap: var(--space-3);
}

.born-row .field { margin-bottom: var(--space-2); }
.born-row .field:first-child { flex: 1 1 10rem; }
.born-row input[type="number"] { max-width: 6.5rem; }

.pace-row {
    display: flex;
    align-items: flex-end;
    flex-wrap: wrap;
    gap: var(--space-3);
}

.pace-row .field { margin-bottom: var(--space-2); }

/* ---- day picker ----
 *
 * Seven weekday toggles behind a fold ("select session days"). The
 * toggles borrow the day-pill look: ticked = a school-day pill,
 * unticked = the dimmed one, and a weekday the term has no school
 * on is disabled and fainter still. The checkbox itself is visually
 * hidden but stays in the tab order and shows a focus ring on its
 * pill.
 */

.pace-row .field:has(.day-picker) { flex-basis: 100%; }

/* The toggle text and the pills share a line when there's room */
.day-picker {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--space-2) var(--space-3);
}

.day-picker .disclosure {
    background: none;
    border: 0;
    padding: 0;
    font: inherit;
    color: var(--accent-dark);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
}

.day-picker .disclosure:hover { text-decoration: underline; }

.day-picker .chevron {
    display: inline-block;
    width: 0.5em;
    height: 0.5em;
    border-right: 2px solid currentColor;
    border-bottom: 2px solid currentColor;
    transform: rotate(-45deg);
    transition: transform 0.15s ease;
}

.day-picker [aria-expanded="true"] .chevron { transform: rotate(45deg); }

.day-toggles {
    display: inline-flex;
    flex-wrap: wrap;
    gap: var(--space-1);
}

/* Folded by session_days.js; the display rule above must not win */
.day-toggles[hidden] { display: none; }

.day-toggle { position: relative; }

.day-toggle input {
    position: absolute;
    opacity: 0;
    width: 1px;
    height: 1px;
    margin: 0;
}

.day-toggle .day-pill {
    display: inline-block;
    cursor: pointer;
    background: transparent;
    border-color: var(--line);
    color: var(--ink-soft);
    font-weight: 400;
}

.day-toggle input:checked + .day-pill {
    background: var(--accent-soft);
    border-color: transparent;
    color: var(--accent-dark);
    font-weight: 600;
}

.day-toggle input:disabled + .day-pill {
    cursor: not-allowed;
    border-style: dashed;
    opacity: 0.5;
}

.day-toggle input:focus-visible + .day-pill {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
    .day-picker .chevron { transition: none; }
}

/* ---- chapter rows ----
 *
 * A book's chapters typed as rows: chapter, title, pages, and a ×
 * to take one away, under a plain header line. "Add a chapter"
 * sits beneath the last row as a dashed, full-width invitation; the
 * count beside it keeps score. The buttons are hidden until
 * chapter_rows.js is running, so nothing looks live that isn't.
 *
 * A project's milestones are typed the same way — milestone, school
 * days, × — and share every rule here but the columns
 * (milestone_rows.js).
 */

.chapter-rows,
.milestone-rows { display: block; }

.chapter-rows [hidden],
.milestone-rows [hidden] { display: none; }

.chapter-head,
.chapter-row,
.milestone-head,
.milestone-row {
    display: grid;
    gap: var(--space-2);
    align-items: center;
}

.chapter-head,
.chapter-row {
    grid-template-columns: 7.5rem minmax(0, 1fr) 5.5rem 1.75rem;
}

.milestone-head,
.milestone-row {
    grid-template-columns: minmax(0, 1fr) 6.5rem 1.75rem;
}

.chapter-head,
.milestone-head {
    color: var(--ink-soft);
    font-size: 0.85rem;
    padding: 0 var(--space-1);
    margin-bottom: var(--space-1);
}

.chapter-head em {
    font-style: normal;
    font-size: 0.75rem;
}

.chapter-row-list,
.milestone-row-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.chapter-row,
.milestone-row { margin-bottom: var(--space-2); }

/* A long list (a course's 120 numbered lessons) scrolls in a box of
   its own, its column heads staying put, so the plan and the Save
   button beneath are not a dozen screens away. Thirty rows or fewer
   run down the page as they always have. The side padding leaves
   room for a focused box's outline, which the scroll would clip */
.chapter-scroll:has(.chapter-row:nth-child(31)) {
    max-height: 32rem;
    overflow-y: auto;
    padding: 0 4px 4px;
    margin: 0 -4px;
    border-bottom: 1px solid var(--line);
}

.chapter-scroll:has(.chapter-row:nth-child(31)) .chapter-head {
    position: sticky;
    top: 0;
    z-index: 1;
    background: var(--paper);
    padding-top: var(--space-1);
    padding-bottom: var(--space-1);
    margin-bottom: 0;
}

.chapter-row input,
.milestone-row input { min-width: 0; }

/* The column sets the width, not the general cap on number boxes */
.milestone-row input[type="number"] { max-width: none; }

.remove-chapter,
.remove-milestone {
    width: 1.75rem;
    height: 1.75rem;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: none;
    color: var(--ink-soft);
    font: inherit;
    font-size: 1.1rem;
    line-height: 1;
    cursor: pointer;
}

.remove-chapter:hover,
.remove-chapter:focus-visible,
.remove-milestone:hover,
.remove-milestone:focus-visible {
    background: var(--warn-soft);
    color: var(--warn);
}

.chapter-foot,
.milestone-foot {
    display: flex;
    align-items: center;
    gap: var(--space-3);
}

.add-chapter,
.add-milestone {
    flex: 1 1 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    padding: var(--space-2) var(--space-3);
    background: none;
    border: 1px dashed var(--line-strong);
    border-radius: var(--radius);
    color: var(--accent-dark);
    font: inherit;
    cursor: pointer;
}

.add-chapter .plus,
.add-milestone .plus {
    font-size: 1.25rem;
    line-height: 1;
}

.add-chapter:hover,
.add-chapter:focus-visible,
.add-milestone:hover,
.add-milestone:focus-visible {
    background: var(--accent-soft);
    border-color: var(--accent);
    border-style: solid;
}

.chapter-count,
.milestone-count {
    margin: 0;
    color: var(--ink-soft);
    font-size: 0.85rem;
    white-space: nowrap;
}

.chapter-count:empty,
.milestone-count:empty { display: none; }

.chapter-more { margin-top: var(--space-3); }

/* A freshly added row settles in from just below */
.chapter-row.is-new,
.milestone-row.is-new { animation: chapter-row-in 0.25s ease-out; }

@keyframes chapter-row-in {
    from { opacity: 0; transform: translateY(0.4rem); }
    to { opacity: 1; transform: none; }
}

@media (prefers-reduced-motion: reduce) {
    .chapter-row.is-new,
    .milestone-row.is-new { animation: none; }
}

/* On a phone the title gets the whole line to itself */
@media (max-width: 32rem) {
    .chapter-head { display: none; }

    .chapter-row {
        grid-template-columns: minmax(0, 1fr) 5.5rem 1.75rem;
        grid-template-areas:
            "label pages remove"
            "title title title";
        margin-bottom: var(--space-3);
    }

    .chapter-row input[name="chapter_label"] { grid-area: label; }
    .chapter-row input[name="chapter_title"] { grid-area: title; }
    .chapter-row input[name="chapter_pages"] { grid-area: pages; }
    .chapter-row .remove-chapter { grid-area: remove; }
}

.form-actions {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: var(--space-3);
    margin-top: var(--space-4);
}

/* On a phone two buttons often don't fit on one line. Each grows to
 * fill its line, so a pair that wraps becomes two buttons of the
 * form's width rather than two of different lengths, and a pair that
 * fits shares the line. */
@media (max-width: 32rem) {
    .form-actions > .button,
    .form-actions > button {
        flex: 1 1 auto;
        text-align: center;
    }
}

/* ---- flash + notices ---- */

.flash {
    background: var(--accent-soft);
    border: 1px solid var(--accent);
    border-radius: var(--radius);
    padding: var(--space-2) var(--space-3);
    margin-bottom: var(--space-4);
}

.notice {
    background: var(--warn-soft);
    border: 1px solid var(--warn);
    border-radius: var(--radius);
    padding: var(--space-2) var(--space-3);
    margin-bottom: var(--space-3);
}

/* A problem, as opposed to a heads-up: the heavier left edge says so
 * without relying on the amber alone. */
.notice-error {
    border-left-width: 6px;
    font-weight: 600;
}

/* On form pages, the opening paragraph and notices match the
   form's width (see form.stack) so the page reads as one column */
main:has(> form.stack) > .lede,
main:has(> form.stack) .flash,
main:has(> form.stack) .notice {
    max-width: 30rem;
}

.projection {
    border-radius: var(--radius);
    padding: var(--space-2) var(--space-3);
    margin: var(--space-2) 0;
    background: var(--accent-soft);
}

.projection.overflow { background: var(--warn-soft); }

/* ---- cards and lists ---- */

.card {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: var(--space-3) var(--space-4);
    margin-bottom: var(--space-3);
}

.card h3, .card h4 { margin-bottom: var(--space-1); }

/* Doings gathered under their subject on a term page: the subject is
   a quiet heading over its cards, which step down a level */
.subject-group { margin-bottom: var(--space-4); }

.subject-heading {
    color: var(--ink-soft);
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    margin: 0 0 var(--space-2);
}

/* A card's name reads the same whichever level its heading is */
.card h4 { font-size: 1.17rem; }

/* The thank-you after sending feedback: warm, a little roomier. */
.card.thanks {
    background: var(--accent-soft);
    border-color: var(--accent);
    padding: var(--space-4);
    margin-bottom: var(--space-4);
}

/* Opening paragraph on the feedback page: real copy, not a hint. */
.lede {
    max-width: 34rem;
    margin-bottom: var(--space-4);
}

/* Cards that follow an h1 directly (reschedule preview) head with h2 */
.card h2 {
    font-size: 1rem;
    margin: 0 0 var(--space-1);
}

.card .meta {
    color: var(--ink-soft);
    font-size: 0.9rem;
}

/* Stacked meta lines (born, notes, schedule) sit close, as one block */
.card .meta + .meta { margin-top: calc(var(--space-2) - var(--space-3)); }

.card-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-3);
    flex-wrap: wrap;
}

.inline-actions {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    flex-wrap: wrap;
}

.empty-state {
    background: var(--card);
    border: 1px dashed var(--line);
    border-radius: var(--radius);
    padding: var(--space-4);
    margin-bottom: var(--space-3);
    color: var(--ink-soft);
}

/* The dashboard before anything is planned: the page's one piece of
 * copy, so it reads in full ink, with its button on its own line. */
.empty-state.welcome { color: var(--ink); }
.empty-state.welcome p { max-width: 34rem; }
.empty-state.welcome p:last-child { margin-bottom: 0; }

/* Four kinds, laid out as a 2x2 so no card sits alone on a second
 * row. Cards stretch to the row so a longer blurb doesn't make one
 * card tower over its neighbour. */
.type-cards {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--space-3);
    margin-bottom: var(--space-4);
}

@media (max-width: 32rem) {
    .type-cards { grid-template-columns: minmax(0, 1fr); }
}

.type-card {
    display: flex;
    flex-direction: column;
    gap: var(--space-1);
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: var(--space-4);
    text-decoration: none;
    color: var(--ink);
}

.type-card:hover {
    border-color: var(--accent);
    background: var(--accent-soft);
    color: var(--ink);
}

.type-card strong {
    display: block;
    color: var(--accent-dark);
}

.type-card span {
    color: var(--ink-soft);
    font-size: 0.9rem;
    line-height: 1.45;
    max-width: 22rem;
}

/* ---- schedule views (serif for the printed feel) ---- */

.schedule-page main {
    font-family: Georgia, 'Iowan Old Style', 'Times New Roman', serif;
}

/* Title on its own line, nav always beneath it — whether the two
 * share a row would otherwise depend on how long the kid's name and
 * the week label happen to be, and the buttons would jump around
 * from week to week. */
.schedule-header {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: var(--space-2);
    margin-bottom: var(--space-3);
}

.schedule-header h1 { margin-bottom: 0; line-height: 1.15; }

/* Whose schedule it is sits above the week or month as a small label,
 * so the heading itself is just the stretch of time. */
.schedule-kid {
    display: block;
    margin-bottom: var(--space-1);
    font-family: system-ui, sans-serif;
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--accent-dark);
}

.schedule-nav {
    display: flex;
    gap: var(--space-2);
    align-items: center;
    flex-wrap: wrap;
    font-family: system-ui, sans-serif;
}

.day-card {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: var(--space-3) var(--space-4) var(--space-2);
    margin-bottom: var(--space-3);
}

/* Weekday, its date beside it in a quieter voice, the day's total at
 * the far end. */
.day-card h2 {
    display: flex;
    align-items: baseline;
    gap: var(--space-2);
    font-size: 1.15rem;
    margin: 0;
    padding-bottom: var(--space-2);
    border-bottom: 1px solid var(--line);
}

.day-card h2 .day-date {
    font-size: 0.9rem;
    font-weight: 400;
    color: var(--ink-soft);
}

.day-card h2 .day-total {
    margin-left: auto;
    font-family: system-ui, sans-serif;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--ink-soft);
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}

.day-card h2 .day-note {
    font-size: 0.85rem;
    color: var(--ink-soft);
    font-style: italic;
    font-weight: 400;
}

.day-card.missed-day { background: var(--paper); }
.day-card.missed-day .missed-label {
    color: var(--warn);
    margin: var(--space-2) 0;
}

/* A day off: the month view's colour, its tag and the vacation's
 * name where the lessons would be. */
.day-card.vacation-day {
    background: var(--accent-soft);
    border-color: transparent;
}

.vacation-label { margin: var(--space-2) 0; }

.vacation-tag {
    display: block;
    font-family: system-ui, sans-serif;
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--accent-dark);
}

.vacation-name {
    display: block;
    font-style: italic;
    color: var(--accent-dark);
    overflow-wrap: anywhere;
}

/* One doing per row: its name, what to do beneath it, and how long at
 * the right. */
.lesson-list li {
    display: flex;
    gap: var(--space-3);
    padding: var(--space-2) 0;
    align-items: baseline;
}

.lesson-list li + li { border-top: 1px solid var(--line); }

.lesson-list .lesson-main {
    display: flex;
    flex-direction: column;
    gap: 2px;
    flex: 1;
    min-width: 0;
}

.lesson-list .block-title { font-weight: 700; }

/* A doing's subject before its name: 'MATH · Saxon 7/6' */
.subject-label {
    color: var(--ink-soft);
    font-size: 0.72em;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.subject-label::after { content: " ·"; }

.lesson-list .lesson-detail {
    color: var(--ink-soft);
    font-size: 0.92rem;
    line-height: 1.45;
}

.lesson-list .minutes {
    font-family: system-ui, sans-serif;
    color: var(--ink-soft);
    font-size: 0.8rem;
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}

.no-lessons {
    color: var(--ink-soft);
    font-style: italic;
    margin: var(--space-2) 0;
}

/* A doing's landmarks — a project's milestones and the day it's due,
 * a book's quizzes and tests — carry a tag that says which one. The
 * days that close something (a test, a due day) are filled in. */
.landmark-tag {
    display: inline-block;
    margin-right: 0.6em;
    padding: 0.05em 0.6em;
    border: 1px solid var(--accent-dark);
    border-radius: 999px;
    color: var(--accent-dark);
    font-family: system-ui, sans-serif;
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    white-space: nowrap;
    vertical-align: 0.08em;
}

.lesson-due .landmark-tag,
.lesson-test .landmark-tag {
    background: var(--accent-dark);
    color: #fff;
}

/* The keep-or-push question on a reshuffle preview */
.due-dates .due-choice { margin-top: var(--space-3); }
.due-dates .due-choice legend { font-weight: 700; }
.due-dates .due-choice > .hint { margin-top: var(--space-2); }

/* A reschedule preview is a statement of what will happen, not a
 * to-do list — arrows, never checkboxes someone might try to tick. */
.move-list li {
    display: flex;
    gap: var(--space-2);
    padding: var(--space-1) 0;
    align-items: baseline;
}

.move-list li + li { border-top: 1px solid var(--line); }

.move-list li::before {
    content: "\2192" / ""; /* → */
    flex: none;
    color: var(--accent);
    font-weight: 700;
}

/* A schedule that predates some of its kid's doings says so right
 * on the card, and the Regenerate button stops being quiet. */
.needs-regen {
    color: var(--warn);
    font-size: 0.9rem;
    margin-bottom: 0;
}

/* A schedule made in place (generate.js): the line that would have
 * been the page's flash sits on the card instead, the card blooms
 * sage for a moment, and a few stars rise from the button. */
.woven {
    color: var(--accent-dark);
    font-size: 0.9rem;
    margin-bottom: 0;
    animation: woven-in 0.5s ease-out both;
}

.woven::before { content: "✦ " / ""; }

@keyframes woven-in {
    from { opacity: 0; transform: translateY(0.25rem); }
    to { opacity: 1; transform: none; }
}

.card.just-woven { animation: card-bloom 1.4s ease-out both; }

@keyframes card-bloom {
    0% { box-shadow: 0 0 0 0 rgba(91, 123, 108, 0); border-color: var(--line); }
    30% { box-shadow: 0 0 0 5px rgba(91, 123, 108, 0.22); border-color: var(--accent); }
    100% { box-shadow: 0 0 0 0 rgba(91, 123, 108, 0); border-color: var(--line); }
}

.card:has(> .sparks) { position: relative; }

.sparks {
    position: absolute;
    width: 0;
    height: 0;
    overflow: visible;
    pointer-events: none;
}

.sparks i {
    position: absolute;
    left: 0;
    top: 0;
    font-style: normal;
    font-size: var(--size, 0.8rem);
    line-height: 1;
    color: var(--accent);
    transform: translate(-50%, -50%) scale(0.3);
    opacity: 0;
    animation: spark-rise 1.3s ease-out var(--delay, 0ms) both;
}

@keyframes spark-rise {
    0% { opacity: 0; transform: translate(-50%, -50%) scale(0.3); }
    15% { opacity: 1; }
    65% { opacity: 1; }
    100% {
        opacity: 0;
        transform: translate(calc(-50% + var(--dx)), calc(-50% + var(--dy)))
            scale(1) rotate(70deg);
    }
}

@media (prefers-reduced-motion: reduce) {
    .woven, .card.just-woven { animation: none; }
    .sparks { display: none; }
}

/* ---- month grid ---- */

/* The wrap is a focusable, named region so keyboard users can scroll
 * it sideways with the arrow keys. It also carries the frame: a
 * collapsed table can't round its own corners. */
.month-grid-wrap {
    overflow-x: auto;
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--radius);
}

/* Seven columns each need room for a lesson. Below the minimum the
 * grid scrolls sideways inside its wrap instead of squeezing the
 * cells (phones); Mon–Thu stay in view, weekends are a swipe away. */
.month-grid {
    width: 100%;
    min-width: 52rem;
    table-layout: fixed;
}

/* A month with nothing on its weekends gives their room to the
 * school days. */
.month-grid.quiet-weekend .weekend-col { width: 7%; }

.month-grid th {
    font-family: system-ui, sans-serif;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--ink-soft);
    padding: var(--space-2);
    border-bottom: 1px solid var(--line);
}

/* height on a cell is a minimum: a full day still grows its row */
.month-grid td {
    vertical-align: top;
    border-top: 1px solid var(--line);
    border-left: 1px solid var(--line);
    padding: var(--space-2);
    height: 6.75rem;
    font-size: 0.8rem;
}

.month-grid td:first-child { border-left: 0; }
.month-grid tbody tr:first-child td { border-top: 0; }

.month-grid .cell-head {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: var(--space-1);
    margin-bottom: var(--space-1);
}

.month-grid .date-num { font-weight: 700; font-size: 0.9rem; }

.month-grid .cell-total {
    font-family: system-ui, sans-serif;
    font-size: 0.68rem;
    color: var(--ink-soft);
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}

/* One line per doing. Its name gives way first (ellipsis); what to do
 * — the chapter, the pages — stays whole. */
.month-grid .cell-items li {
    display: flex;
    align-items: baseline;
    gap: 0.35em;
    line-height: 1.55;
    white-space: nowrap;
}

.month-grid .cell-title {
    flex: 0 1 auto;
    min-width: 2.5em;
    overflow: hidden;
    text-overflow: ellipsis;
    font-weight: 700;
}

.month-grid .cell-detail {
    flex: 0 0 auto;
    max-width: 55%;
    overflow: hidden;
    text-overflow: ellipsis;
}

.month-grid .dot,
.chip {
    flex: none;
    box-sizing: border-box;
    width: 0.9rem;
    text-align: center;
}

.month-grid .dot { color: var(--accent); }
.month-grid .dot::before { content: "\2022"; }

/* A landmark's letter in place of the bullet: Q, T, M, D — the legend
 * under the grid spells them out. */
.chip {
    border: 1px solid var(--accent-dark);
    border-radius: 3px;
    color: var(--accent-dark);
    font-family: system-ui, sans-serif;
    font-size: 0.6rem;
    font-weight: 700;
    line-height: 1.4;
}

.lesson-due .chip,
.lesson-test .chip {
    background: var(--accent-dark);
    color: #fff;
}

.month-legend {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-1) var(--space-3);
    margin-top: var(--space-2);
    font-family: system-ui, sans-serif;
    font-size: 0.75rem;
    color: var(--ink-soft);
}

.month-legend .legend-entry {
    display: inline-flex;
    align-items: baseline;
    gap: 0.4em;
}

.month-grid .off { background: var(--paper); color: var(--ink-soft); }
.month-grid .missed { color: var(--warn); font-style: italic; }

.month-grid .vacation { background: var(--accent-soft); }

.month-grid .vacation .date-num { color: var(--accent-dark); }

/* ---- misc ---- */

.print-footer { display: none; }

/* ---- landing ----
 *
 * The one page that gets to be a little wondrous. The picture is a
 * storybook plate: it arrives slowly out of a soft cream halo, and
 * the words settle in beside it one line at a time. Everything else
 * on the page is still ringo — sage, paper, plain sentences.
 */

main.landing {
    padding-top: var(--space-4);
    padding-bottom: var(--space-5);
}

/* The header paints above the veil's overhang on narrow screens,
 * where the picture opens the page right under it. */
.landing-page .site-header {
    position: relative;
    z-index: 1;
}

.landing-hero {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(16rem, 24rem);
    gap: var(--space-5) clamp(var(--space-4), 6vw, 5rem);
    align-items: center;
    min-height: min(34rem, 72vh);
    padding-block: var(--space-4);
}

.landing-copy { max-width: 32rem; }

.landing-copy > .notice { margin-bottom: var(--space-4); }

/* A quiet label, letterspaced small caps in sage: where you are. */
.landing-eyebrow {
    font-size: 0.8rem;
    font-weight: 600;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--accent);
    margin-bottom: var(--space-3);
}

/* The title is set in the serif the printed schedule already uses,
 * three short sentences on three lines, the last one turning to
 * sage: the whole promise in a glance. */
.landing-title {
    font-family: Georgia, 'Iowan Old Style', 'Times New Roman', serif;
    font-weight: 400;
    font-size: clamp(2.4rem, 5.2vw, 3.6rem);
    line-height: 1.08;
    letter-spacing: -0.015em;
    color: var(--ink);
    margin-bottom: var(--space-4);
}

.landing-title span { display: block; }

.landing-title-turn {
    color: var(--accent-dark);
    font-style: italic;
}

.landing-copy .mission {
    font-size: 1.2rem;
    line-height: 1.55;
    max-width: 28rem;
    margin-bottom: var(--space-4);
    text-wrap: pretty;
}

.landing-actions {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: var(--space-3) var(--space-4);
    margin-top: var(--space-4);
}

.landing-cta {
    padding: calc(var(--space-2) + 0.2rem) calc(var(--space-4) + 0.25rem);
    font-size: 1.05rem;
    box-shadow: 0 2px 8px rgba(72, 98, 79, 0.25);
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.landing-cta:hover {
    transform: translateY(-1px);
    box-shadow: 0 5px 16px rgba(72, 98, 79, 0.35);
}

.landing-cta:active { transform: none; }

.landing-login {
    color: var(--ink-soft);
    font-weight: 500;
    text-decoration: none;
    border-bottom: 1px solid transparent;
    transition: color 0.15s ease, border-color 0.15s ease;
}

.landing-login:hover {
    color: var(--accent-dark);
    border-bottom-color: currentColor;
}

/* Under the button, what pressing it starts: a trial, and no card. */
.landing-trial {
    margin: var(--space-3) 0 0;
    font-size: 0.95rem;
    color: var(--ink-soft);
}

/* The plate. The halo behind the picture is the picture's own paper
 * colour let loose, so the drawing seems to sit in a pool of light
 * rather than in a box. */
.landing-plate {
    position: relative;
    margin: 0;
    justify-self: center;
    width: 100%;
    max-width: 24rem;
}

.landing-plate::before {
    content: "";
    position: absolute;
    inset: -14% -18%;
    background: radial-gradient(closest-side,
        rgba(243, 235, 213, 0.9) 0%,
        rgba(243, 235, 213, 0.55) 45%,
        rgba(243, 235, 213, 0) 100%);
    z-index: -1;
    pointer-events: none;
}

.landing-illustration {
    width: 100%;
    height: auto;
    border-radius: 14px;
    box-shadow:
        0 1px 2px rgba(42, 41, 37, 0.06),
        0 12px 32px -12px rgba(42, 41, 37, 0.25);
}

/* Arrival. The words rise into place one after another. The picture
 * is never animated itself (a large image on a moving compositor
 * layer never settled in Chrome); instead a paper-coloured veil lies
 * over it and, once JavaScript says the image has loaded, thins away
 * over a slow second and a half while the halo blooms underneath.
 * Without JavaScript the veil is never shown. */
@keyframes landing-rise {
    from { opacity: 0; transform: translateY(14px); }
    to   { opacity: 1; transform: none; }
}

.landing-copy {
    position: relative;   /* words stay above the veil's overhang */
    z-index: 1;
}

.landing-copy > * {
    animation: landing-rise 0.8s cubic-bezier(0.2, 0.7, 0.2, 1) both;
}

.landing-copy > :nth-child(1) { animation-delay: 0.1s; }
.landing-copy > :nth-child(2) { animation-delay: 0.22s; }
.landing-copy > :nth-child(3) { animation-delay: 0.34s; }
.landing-copy > :nth-child(4) { animation-delay: 0.46s; }
.landing-copy > :nth-child(5) { animation-delay: 0.58s; }
.landing-copy > :nth-child(6) { animation-delay: 0.7s; }

.landing-veil {
    display: none;
    position: absolute;
    inset: -22% -26%;     /* covers the halo and the shadow too */
    background: var(--paper);
    pointer-events: none;
}

.js .landing-veil {
    display: block;
    opacity: 1;
    transition: opacity 1.6s ease-out, visibility 0s linear 1.6s;
}

.js .landing-plate::before {
    transform: scale(0.85);
    transition: transform 2.2s cubic-bezier(0.2, 0.7, 0.2, 1);
}

.js .landing-plate.is-ready .landing-veil {
    opacity: 0;
    visibility: hidden;
}

.js .landing-plate.is-ready::before { transform: none; }

/* How it works: three numbered beats under a thin rule, the numerals
 * in the title's serif. */
.landing-how {
    margin-top: var(--space-5);
    padding-top: var(--space-4);
    border-top: 1px solid var(--line);
    animation: landing-rise 0.8s cubic-bezier(0.2, 0.7, 0.2, 1) 0.8s both;
}

.landing-how .landing-eyebrow { margin-bottom: var(--space-4); }

.landing-steps {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: var(--space-4) var(--space-5);
}

.landing-steps li {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    gap: var(--space-3);
    align-items: start;
}

.landing-steps p {
    line-height: 1.55;
    text-wrap: pretty;
}

.landing-step-number {
    font-family: Georgia, 'Iowan Old Style', 'Times New Roman', serif;
    font-style: italic;
    font-size: 1.6rem;
    line-height: 1;
    color: var(--accent);
    padding-top: 0.1rem;
    min-width: 1.2rem;
}

/* Pricing: what it costs and how to stop, as labeled rows under the
 * same thin rule. A long answer wraps beside its label, not under. */
.landing-pricing {
    margin-top: var(--space-5);
    padding-top: var(--space-4);
    border-top: 1px solid var(--line);
    animation: landing-rise 0.8s cubic-bezier(0.2, 0.7, 0.2, 1) 0.9s both;
}

.landing-pricing .landing-eyebrow { margin-bottom: var(--space-4); }

.landing-pricing .page-meta { margin-bottom: 0; }

.landing-pricing .page-meta > p {
    align-items: baseline;
    flex-wrap: nowrap;
    gap: var(--space-3);
    line-height: 1.55;
}

.landing-pricing .page-meta a { color: var(--accent-dark); }

@media (max-width: 52rem) {
    .landing-hero {
        grid-template-columns: minmax(0, 1fr);
        min-height: 0;
        gap: var(--space-4);
        padding-block: var(--space-3) var(--space-4);
    }

    /* On a phone the picture opens the page, as a storybook would. */
    .landing-plate {
        order: -1;
        max-width: 16rem;
        margin-bottom: var(--space-3);
    }

    .landing-copy { max-width: none; }

    .landing-steps { grid-template-columns: minmax(0, 1fr); }
}

@media (prefers-reduced-motion: reduce) {
    .landing-copy > *, .landing-how, .landing-pricing { animation: none; }
    .landing-cta, .landing-login { transition: none; }
    .landing-cta:hover { transform: none; }
    .js .landing-plate::before { transform: none; transition: none; }
    .js .landing-veil {
        transition: opacity 0.4s ease-out, visibility 0s linear 0.4s;
    }
}

.chapter-list li {
    display: flex;
    gap: var(--space-2);
    align-items: baseline;
    padding: var(--space-1) 0;
}

.chapter-list .pages { color: var(--ink-soft); margin-left: auto; }

/* ---- modal ----
 *
 * Gentle in-place guardrails. A modal informs and offers a choice;
 * it never traps — Dismiss, a click outside, or Escape all close it
 * and leave the user exactly where they were.
 */

dialog.modal {
    margin: auto;              /* reset.css zeroes margins; re-centre */
    background: var(--card);
    color: var(--ink);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: var(--space-4);
    /* On a phone it keeps the page's own gutter on each side rather
       than running edge to edge */
    max-width: min(26rem, calc(100% - 2 * var(--space-3)));
    box-shadow: 0 8px 24px rgba(42, 41, 37, 0.15);
    opacity: 0;
    transform: translateY(10px);
    transition: opacity 0.25s ease, transform 0.25s ease;
}

dialog.modal::backdrop { background: rgba(42, 41, 37, 0.35); }

dialog.modal.open { opacity: 1; transform: none; }

dialog.modal h2 {
    font-size: 1.15rem;
    margin: 0 0 var(--space-2);
}

dialog.modal p { color: var(--ink-soft); }

/* A modal that carries a short form: the fields sit under the
   explanation, and the actions row closes it out like any form */
dialog.modal form { margin-top: var(--space-3); }
dialog.modal form .form-actions { margin-top: var(--space-2); }
/* A delete dialog's form is just the action button in the row: no gap above it. */
dialog.modal .inline-actions form { margin-top: 0; display: flex; }
/* Why the form was refused, above its field: full ink on the notice's
   tint, and close to the field it is about */
dialog.modal p.notice { color: var(--ink); margin-bottom: 0; }

/* On a phone a dialog's buttons behave like a form's (see
 * .form-actions): a pair that fits shares the line, a pair that wraps
 * becomes two buttons of the dialog's width. */
@media (max-width: 32rem) {
    dialog.modal .inline-actions > .button,
    dialog.modal .inline-actions > button,
    dialog.modal .inline-actions > form,
    dialog.modal .inline-actions > form > button {
        flex: 1 1 auto;
        text-align: center;
    }
}

@media (prefers-reduced-motion: reduce) {
    dialog.modal { transition: none; }
}

/* What goes with a deletion: a plain bulleted list (reset.css strips
   bullets from classed lists), on the page and inside the dialog. */
ul.consequences {
    list-style: disc;
    padding-left: 1.25rem;
    margin: 0 0 var(--space-3);
    color: var(--ink-soft);
}

ul.consequences li { list-style: disc; }

ul.consequences li + li { margin-top: var(--space-1); }

/* The Terms of Service and the Privacy Policy: long reading, so
   plain bulleted lists with air between the points, and a smaller
   heading for the groups inside a section. */
main.legal ul {
    list-style: disc;
    padding-left: 1.25rem;
    margin: 0 0 var(--space-3);
}

main.legal li + li { margin-top: var(--space-2); }

main.legal h3 {
    font-size: 1rem;
    margin: var(--space-4) 0 var(--space-2);
}

/* The box that says both were read, on the sign-up form and the
   questionnaire. The sentence wraps, so the box sits at its first
   line rather than its middle. */
.legal-ack .checkbox-row {
    align-items: flex-start;
    margin-bottom: 0;
}

.legal-ack input[type="checkbox"] {
    flex: none;
    margin-top: 0.3em;
}

.legal-ack a { color: var(--accent-dark); }

/* Alternative sign-in below the credentials form */
.alt-auth {
    max-width: 30rem;
    margin-top: var(--space-4);
    padding-top: var(--space-3);
    border-top: 1px solid var(--line, #ddd);
}

/* On a phone it is as wide as the form's own buttons above it
 * (see .form-actions) */
@media (max-width: 32rem) {
    .alt-auth .button {
        display: block;
        text-align: center;
    }
}

/* A notice that carries its own small action (resend, etc.) */
.notice form { margin-top: var(--space-2); }
.notice p + form { margin-top: var(--space-2); }

/* Settings: sections breathe; small standalone forms sit close to
   the list they act on */
main.narrow > h2 { margin-top: var(--space-5); }
main.narrow > form:not(.stack) { margin-bottom: var(--space-3); }
/* ---- book lookup ---- */

/* Picks are their own forms, so they sit beside the lookup form
   (never inside it), in a card of their own under it */
.candidates {
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: var(--space-3) var(--space-4);
    margin: 0 0 var(--space-3);
    background: var(--card);
    max-width: 30rem;
}

.candidates > .hint { margin: 0; }

.candidate-list {
    list-style: none;
    padding: 0;
    margin: var(--space-2) 0 0;
    display: grid;
    gap: var(--space-2);
}

.candidate-list form { margin: 0; }

button.candidate {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.15rem;
    text-align: left;
    padding: var(--space-2) var(--space-3);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--card);
    color: var(--ink);
    font: inherit;
    cursor: pointer;
}

button.candidate:hover { border-color: var(--accent); }

button.candidate strong { font-weight: 600; }

button.candidate span { color: var(--ink-soft); font-size: 0.9rem; }

button.candidate .shelf {
    color: var(--accent);
    font-size: 0.8rem;
}

/* Title typeahead (book_suggest.js): the list hangs from the Title
   field it belongs to and is a touch wider than the field, so a
   long title and its author fit on their own lines */
.field.suggests { position: relative; }

.suggestions {
    position: absolute;
    left: 0;
    top: 100%;
    z-index: 5;
    width: max(100%, 20rem);
    max-width: calc(100vw - 2 * var(--space-4));
    margin: var(--space-1) 0 0;
    padding: var(--space-1);
    list-style: none;
    background: var(--card);
    border: 1px solid var(--line-strong);
    border-radius: var(--radius);
    box-shadow: 0 6px 18px rgba(42, 41, 37, 0.12);
}

.suggestions[hidden] { display: none; }

.suggestions li {
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
    padding: var(--space-2) var(--space-3);
    border-radius: calc(var(--radius) - 2px);
    cursor: pointer;
}

.suggestions li[aria-selected="true"] { background: var(--accent-soft); }

.suggestions .title { font-weight: 600; }

.suggestions .by { color: var(--ink-soft); font-size: 0.9rem; }

.suggestions .year { color: var(--ink-soft); font-size: 0.8rem; }

.suggestions .from { color: var(--accent); font-size: 0.8rem; }

/* ---- radio field ---- */

.radio-group {
    display: grid;
    gap: var(--space-2);
}

.radio-row {
    display: flex;
    align-items: flex-start;
    gap: var(--space-2);
    cursor: pointer;
}

.radio-row input { margin-top: 0.3rem; }

.radio-row .hint {
    display: block;
    margin: 0;
}

/* ---- parent portal ----
 *
 * The parent's working surface. Ink goes to the data — names, doings,
 * what is waiting — and the chrome stays out of the way: hairline
 * rules, no boxes around boxes, one dot of colour per kid, and a
 * single amber that means "waiting for a grade" and nothing else.
 */

/* A tone per kid, in the order they were added. The dot carries it;
 * the soft tint only ever sits behind the kid's own name. */
.kid-tone-0 { --tone: #5B7B6C; --tone-soft: #E9EFEA; }
.kid-tone-1 { --tone: #6E6391; --tone-soft: #EAE7F2; }
.kid-tone-2 { --tone: #4F7A8C; --tone-soft: #E3EEF3; }
.kid-tone-3 { --tone: #8C6A4F; --tone-soft: #F0EAE4; }
.kid-tone-4 { --tone: #78804A; --tone-soft: #EDEEE0; }
.kid-tone-5 { --tone: #8C5A6E; --tone-soft: #F2E8EC; }

.kid-tag {
    display: inline-flex;
    align-items: center;
    gap: 0.45em;
    font-weight: 600;
    white-space: nowrap;
}

.kid-dot {
    flex: none;
    width: 0.62em;
    height: 0.62em;
    border-radius: 50%;
    background: var(--tone, var(--accent));
}

/* The portal's two sections sit under the site header at its width:
 * one segmented control, the current section filled. */
.portal-sections {
    display: flex;
    align-items: center;
    max-width: 64rem;
    margin: 0 auto;
    padding: 0 var(--space-3) var(--space-3);
}

/* Lock belongs to the portal, so it sits with the portal's sections
 * rather than in the site header, which reads the same everywhere */
.portal-sections .lock-form { margin-left: auto; }

.portal-sections a {
    color: var(--ink-soft);
    font-weight: 500;
    text-decoration: none;
    padding: 0.3rem 0.85rem;
    background: var(--card);
    border: 1px solid var(--line-strong);
}

.portal-sections a:first-child { border-radius: 999px 0 0 999px; }
.portal-sections a:last-of-type { border-radius: 0 999px 999px 0; }
.portal-sections a + a { border-left: 0; }

.portal-sections a:hover { color: var(--ink); background: var(--accent-soft); }

.portal-sections a[aria-current="page"] {
    color: #fff;
    background: var(--accent-dark);
    border-color: var(--accent-dark);
}

/* The view switch: one segmented control, the current view filled. */
.portal-nav .view-switch {
    display: inline-flex;
    margin-left: var(--space-2);
    border: 1px solid var(--line-strong);
    border-radius: 999px;
    overflow: hidden;
}

.portal-nav .view-switch a.button {
    border: 0;
    border-radius: 0;
    background: var(--card);
    padding: 0.3rem 0.85rem;
}

.portal-nav .view-switch a.button + a.button {
    border-left: 1px solid var(--line-strong);
}

.portal-nav .view-switch a[aria-current="page"] {
    background: var(--accent-dark);
    color: #fff;
}

/* Which kids: each toggle is the kid's tag, filled while shown. The
 * checkbox itself is visually hidden; the pill is its label. */
.kid-filter {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--space-2);
    margin: 0 0 var(--space-4);
}

.kid-filter-label {
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--ink-soft);
    margin-right: var(--space-1);
}

.kid-toggles {
    display: inline-flex;
    flex-wrap: wrap;
    gap: var(--space-2);
}

.kid-toggle {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 0.45em;
    margin: 0;
    padding: 0.2rem 0.8rem 0.2rem 0.65rem;
    border: 1px solid var(--line-strong);
    border-radius: 999px;
    color: var(--ink-soft);
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
}

.kid-toggle .kid-dot { background: var(--line-strong); }

.kid-toggle:has(input:checked) {
    color: var(--ink);
    background: var(--tone-soft);
    border-color: var(--tone);
}

.kid-toggle:has(input:checked) .kid-dot { background: var(--tone); }

.kid-toggle:has(input:focus-visible) {
    outline: 2px solid var(--ink);
    outline-offset: 2px;
}

html.js .kid-filter .button { display: none; }

/* The Lock button says what it does on hover or keyboard focus. The
 * tip is the button's accessible description too, so it is read even
 * while hidden. */
.lock-form { position: relative; }

.lock-form .tip {
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    z-index: 5;
    width: 17rem;
    padding: var(--space-2) var(--space-3);
    border-radius: var(--radius);
    background: var(--ink);
    color: var(--paper);
    font-family: system-ui, sans-serif;
    font-size: 0.8rem;
    font-weight: 400;
    line-height: 1.45;
    text-align: left;
    box-shadow: 0 6px 18px rgba(42, 41, 37, 0.18);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.15s ease, visibility 0.15s;
}

.lock-form .tip::before {
    content: '';
    position: absolute;
    top: -6px;
    right: 1.1rem;
    border: 6px solid transparent;
    border-top: 0;
    border-bottom-color: var(--ink);
}

.lock-form button:hover + .tip,
.lock-form button:focus-visible + .tip {
    opacity: 1;
    visibility: visible;
    transition-delay: 0.25s;
}

@media (prefers-reduced-motion: reduce) {
    .lock-form .tip { transition: none; }
}

/* ---- the To grade queue ---- */

.to-grade-list { margin-bottom: var(--space-5); }

.to-grade-list h2 {
    display: flex;
    align-items: center;
    gap: 0.5em;
    margin: 0;
    padding-bottom: var(--space-1);
    border-bottom: 2px solid var(--warn);
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--warn);
}

.to-grade-list.is-empty h2 {
    border-bottom-color: var(--line);
    color: var(--ink-soft);
}

.to-grade-list h2 .count {
    display: inline-block;
    min-width: 1.5em;
    padding: 0 0.45em;
    border-radius: 999px;
    background: var(--warn);
    color: #fff;
    font-size: 0.72rem;
    letter-spacing: 0;
    text-align: center;
    line-height: 1.5;
}

.to-grade-list p { margin: var(--space-2) 0 0; }

.to-grade-list li {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: var(--space-2) var(--space-3);
    padding: var(--space-2) 0;
    border-bottom: 1px solid var(--line);
}

.to-grade-list .tg-what {
    flex: 1 1 16rem;
    min-width: 0;
}

.to-grade-list .tg-what .block-title { font-weight: 700; }

.to-grade-list .tg-what .lesson-detail {
    display: block;
    color: var(--ink-soft);
    font-size: 0.9rem;
}

.to-grade-list .tg-when {
    color: var(--ink-soft);
    font-size: 0.85rem;
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}

/* Grading controls: amber while waiting, quiet once done. */
.grade-open {
    display: inline-block;
    padding: 0.05rem 0.7rem;
    border: 1px solid var(--warn);
    border-radius: 999px;
    background: var(--card);
    color: var(--warn);
    font-family: system-ui, sans-serif;
    font-size: 0.78rem;
    font-weight: 700;
    line-height: 1.7;
    text-decoration: none;
    white-space: nowrap;
}

.grade-open:hover { background: var(--warn-soft); }

.grade-open.primary {
    background: var(--warn);
    color: #fff;
}

.grade-open.primary:hover { background: #7A4C1C; }

.grade-open.change {
    border-color: var(--line-strong);
    color: var(--ink-soft);
    font-weight: 600;
}

.grade-open.change:hover { background: var(--paper); }

.score {
    font-family: system-ui, sans-serif;
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--accent-dark);
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}

.grade-cell {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
}

.portal-page .lesson-list li { flex-wrap: wrap; }

.portal-page .lesson-list .grade-cell {
    flex-basis: 100%;
    margin-top: 2px;
}

/* A waiting assessment is marked by an amber rule; nothing fills. */
.portal-page .lesson-list .needs-grade {
    border-left: 3px solid var(--warn);
    padding-left: var(--space-2);
    margin-left: calc(-1 * var(--space-2) - 3px);
}

.portal-page .lesson-list .needs-grade .landmark-tag {
    border-color: var(--warn);
    color: var(--warn);
    background: transparent;
}

/* ---- the week grid: kids down, days across ---- */

.portal-grid-wrap { overflow-x: auto; }

.portal-grid {
    width: 100%;
    min-width: 54rem;
    table-layout: fixed;
    border-collapse: collapse;
}

.portal-grid th,
.portal-grid td {
    vertical-align: top;
    text-align: left;
    padding: var(--space-2) var(--space-2) var(--space-3);
    overflow-wrap: anywhere;
}

.portal-grid thead th {
    padding-top: 0;
    padding-bottom: var(--space-1);
    border-bottom: 1px solid var(--line-strong);
    font-family: system-ui, sans-serif;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--ink-soft);
    white-space: nowrap;
}

.portal-grid thead th .dom {
    margin-left: 0.4em;
    font-weight: 400;
    font-size: 0.85rem;
    letter-spacing: 0;
    color: var(--ink);
}

.portal-grid thead th.today {
    color: var(--accent-dark);
    box-shadow: inset 0 -2px 0 var(--accent-dark);
}

.portal-grid thead th.today .dom { color: var(--accent-dark); }

.portal-grid tbody tr { border-bottom: 1px solid var(--line); }
.portal-grid tbody tr:last-child { border-bottom: 0; }

.portal-grid thead th:first-child,
.portal-grid tbody th { width: 7rem; }

.portal-grid tbody th { padding-left: 0; }

.portal-grid .week-control { width: 8.5rem; }

.portal-grid td.none { color: var(--ink-soft); }
.portal-grid td.done { background: var(--accent-soft); }
.portal-grid td.vacation { background: var(--accent-soft); }
.portal-grid td.vacation .vacation-name { font-size: 0.85rem; }
.portal-grid td.missed .missed-label {
    color: var(--warn);
    font-style: italic;
    font-size: 0.85rem;
    margin: 0;
}

.portal-grid .no-lessons { font-size: 0.85rem; margin: 0; }

.portal-grid .lesson-list li {
    padding: 3px 0;
    gap: var(--space-2);
}

.portal-grid .lesson-list li + li { border-top: 0; }
.portal-grid .lesson-list .block-title { font-weight: 600; font-size: 0.85rem; }
.portal-grid .lesson-list .lesson-detail { font-size: 0.78rem; line-height: 1.35; }
.portal-grid .landmark-tag { font-size: 0.58rem; margin-right: 0.45em; }

.cell-day { display: none; }

/* Done: a small real box; its Save belongs to the no-script path. */
.day-complete {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: var(--space-2);
    margin-top: var(--space-2);
    font-family: system-ui, sans-serif;
    font-size: 0.78rem;
    color: var(--ink-soft);
}

.day-complete.is-done { color: var(--accent-dark); font-weight: 600; }
.day-complete .checkbox-row { margin: 0; gap: 0.4em; }

html.js .day-complete .button { display: none; }

.week-complete .checkbox-row {
    margin-bottom: var(--space-1);
    font-family: system-ui, sans-serif;
    font-size: 0.78rem;
    color: var(--ink-soft);
}

.week-complete .button {
    padding: 0.15rem 0.65rem;
    font-size: 0.78rem;
}

.week-all-done {
    margin: 0;
    font-family: system-ui, sans-serif;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--accent-dark);
}

.week-none {
    margin: 0;
    font-size: 0.8rem;
    font-style: italic;
}

/* Phones: one block per kid-day, the date named inside each. */
@media (max-width: 48rem) {
    .portal-grid { min-width: 0; }
    .portal-grid, .portal-grid thead, .portal-grid tbody,
    .portal-grid tr, .portal-grid th, .portal-grid td {
        display: block;
        width: auto;
    }
    .portal-grid thead { display: none; }
    .portal-grid tbody tr {
        padding-bottom: var(--space-2);
        border-bottom: 1px solid var(--line-strong);
    }
    .portal-grid tbody th { padding-bottom: 0; }
    .portal-grid td { padding-left: 0; padding-right: 0; }
    .cell-day {
        display: block;
        margin-bottom: 2px;
        font-family: system-ui, sans-serif;
        font-size: 0.68rem;
        font-weight: 700;
        letter-spacing: 0.08em;
        text-transform: uppercase;
        color: var(--ink-soft);
    }
    .portal-grid .week-control { width: auto; }
}

/* ---- the day view: a column per kid ---- */

.portal-day {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(18rem, 1fr));
    gap: var(--space-4);
    align-items: start;
}

.portal-day .day-card {
    margin-bottom: 0;
    padding-left: 0;
    padding-right: 0;
    border: 0;
    background: transparent;
}

.portal-day .day-card h2 {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    border-bottom: 1px solid var(--line-strong);
}

/* The columns are flat, so a day off tints its own label instead */
.portal-day .day-card.vacation-day .vacation-label {
    background: var(--accent-soft);
    border-radius: var(--radius);
    padding: var(--space-2) var(--space-3);
}

.portal-day .day-card .day-note {
    font-size: 0.8rem;
    color: var(--ink-soft);
    font-style: italic;
    font-weight: 400;
}

.portal-day .day-card.done h2 { border-bottom-color: var(--accent); }

/* ---- the month view: every kid in each cell ---- */

.portal-month .date-num a {
    color: inherit;
    text-decoration: none;
}

.portal-month .date-num a:hover { text-decoration: underline; }
.portal-month td.today .date-num { color: var(--accent-dark); }

.portal-month .kid-line {
    display: flex;
    align-items: baseline;
    gap: 0.4em;
    margin-bottom: 2px;
    font-family: system-ui, sans-serif;
    font-size: 0.75rem;
}

.portal-month .kid-line .kid-tag { font-weight: 500; }
.portal-month .kid-line .n { color: var(--ink-soft); font-variant-numeric: tabular-nums; }
.portal-month .kid-line.missed .n { color: var(--warn); font-style: italic; }

.portal-month .n-grade {
    display: inline-block;
    min-width: 1.4em;
    padding: 0 0.35em;
    border-radius: 999px;
    background: var(--warn);
    color: #fff;
    font-size: 0.68rem;
    font-weight: 700;
    text-align: center;
    line-height: 1.5;
}

.portal-month .done-mark { color: var(--accent-dark); font-weight: 700; }

/* ---- the grade dialog ---- */

dialog.grade-modal form.stack { max-width: none; }

.score-row {
    display: flex;
    align-items: flex-end;
    gap: var(--space-2);
}

.score-row .field { flex: 1; margin-bottom: 0; }

.score-slash {
    font-size: 1.5rem;
    color: var(--ink-soft);
    padding-bottom: 0.35rem;
}

.pin-lock { margin-top: var(--space-3); }

.forgot-pin { margin-top: var(--space-4); }

.forgot-pin summary {
    cursor: pointer;
    color: var(--ink-soft);
}

.forgot-pin form { margin-top: var(--space-3); }

/* ---- quizzes and tests ----
 *
 * On the add-book form, the quiz rows are three radio sentences; in
 * two of them a small number belongs to the sentence ("[6] over the
 * whole book", "One every [3] sessions"). */

.quiz-rows .radio-row {
    align-items: center;
    flex-wrap: wrap;
}

.quiz-rows .radio-row input[type="radio"] { margin-top: 0; }

.quiz-rows input[type="number"] {
    width: 5rem;
    padding: var(--space-1) var(--space-2);
}

.quiz-rows .field-error { margin: 0; }

/* Per-kid outcome rows on the confirm and edit pages: what the
 * counts come to for this kid, and the one control that changes the
 * test days. Ruled off from the plan fields above so the rows read
 * as their own small block rather than a footnote. */
.assessment-rows {
    margin: var(--space-3) 0 0;
    padding-top: var(--space-3);
    border-top: 1px solid var(--line);
}

/* The dates and the button that moves them stay together, the
 * button after the dates or under them when the row is narrow. */
.assessment-rows .test-days {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--space-2) var(--space-3);
}

.assessment-rows .hint,
.assessment-rows .field-error { margin: 0 0 var(--space-2); }

/* The test-day picker. A calendar of the kid's session days: ringed
 * days are sessions (real checkboxes), a filled ring is a test, faint
 * numbers are school days the book doesn't touch. Head and foot stay
 * put while the months scroll between them. */

.picker-wrap > summary {
    cursor: pointer;
    color: var(--accent-dark);
    text-decoration: underline;
    margin-bottom: var(--space-2);
}

dialog.picker {
    width: calc(100% - 2rem);
    max-width: 26rem;
    max-height: 85vh;
    padding: 0;
}

dialog.picker[open] {
    display: flex;
    flex-direction: column;
}

.picker-head {
    padding: var(--space-4) var(--space-4) var(--space-3);
    border-bottom: 1px solid var(--line);
}

.picker-head p { margin: 0; }

.picker-months {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    padding: 0 var(--space-4) var(--space-3);
}

.picker-month h3 {
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--ink-soft);
    margin: var(--space-3) 0 var(--space-1);
}

.picker-grid {
    width: 100%;
    table-layout: fixed;
    border-collapse: separate;
    border-spacing: 0;
}

.picker-grid th {
    position: sticky;
    top: 0;
    z-index: 1;
    background: var(--card);
    font-family: system-ui, sans-serif;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--ink-soft);
    text-align: center;
    padding: var(--space-1) 0;
}

.picker-day {
    height: 2.9rem;
    text-align: center;
    vertical-align: middle;
    font-size: 0.95rem;
    padding: 0;
}

.picker-day.school { color: var(--ink-soft); opacity: 0.55; }

.picker-day.session label {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.4rem;
    height: 2.4rem;
    border-radius: 50%;
    border: 1.5px solid var(--accent);
    color: var(--ink);
    cursor: pointer;
}

/* The checkbox is the whole ring: invisible but there, so clicks,
 * keyboard and screen readers all land on the real control. */
.picker-day.session input {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    margin: 0;
    opacity: 0;
    cursor: pointer;
}

.picker-day.session label:has(input:focus-visible) {
    outline: 2px solid var(--ink);
    outline-offset: 2px;
}

.picker-day.session label:has(input:checked) {
    background: var(--accent-dark);
    border-color: var(--accent-dark);
    color: #fff;
    font-weight: 700;
}

.picker-day.session label:has(input:disabled) {
    opacity: 0.35;
    border-style: dashed;
    cursor: default;
}

.picker-day.session label:has(input:disabled) input { cursor: default; }

.picker-foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-3);
    padding: var(--space-3) var(--space-4);
    border-top: 1px solid var(--line);
}

.picker-foot .picker-count {
    margin: 0;
    color: var(--ink-soft);
    font-size: 0.9rem;
}

/* Without scripts the same calendar is a plain block under the
 * "Change the test days" disclosure, and the Change button and Done
 * have nothing to do. With scripts the disclosure is transparent. */
html:not(.js) dialog.picker {
    display: block;
    position: static;
    inset: auto;
    width: auto;
    max-width: none;
    max-height: none;
    margin: var(--space-2) 0 var(--space-3);
    opacity: 1;
    transform: none;
    box-shadow: none;
}

html:not(.js) .picker-open,
html:not(.js) dialog.picker [data-modal-dismiss] { display: none; }

html.js .picker-wrap > summary { display: none; }

/* ---- the shelf ----
 *
 * A kid's books, term by term, as spines on a shelf board. A spine's
 * width grows with its chapter count (w-1 … w-4) and the ribbon down
 * its face is the bookmark, as long as the schedule has read (mark-0
 * … mark-10, tenths). A spine is a disclosure: it opens to the book's
 * chapters beside it, pulled off the shelf for a look, and the row
 * carries on after it. Nothing on the closed spine is decoration
 * pretending to be a control — the whole face is the control. */

.shelf { margin-bottom: var(--space-4); }

.shelf-term .shelf-range {
    font-weight: 400;
    color: var(--ink-soft);
    font-size: 0.9rem;
    margin-left: var(--space-2);
}

.shelf-row {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 0.35rem var(--space-1);
    padding: var(--space-3) var(--space-3) 0.6rem;
    /* The board: a plank of wood under the spines, a faint wall behind */
    background:
        linear-gradient(to top, var(--wood-dark) 0, var(--wood) 0.6rem,
            transparent 0.6rem),
        linear-gradient(to top, rgba(42, 41, 37, 0.05), transparent 2.5rem);
    border-radius: 0 0 3px 3px;
    box-shadow: 0 0.9rem 0.8rem -0.7rem rgba(42, 41, 37, 0.28);
    margin-bottom: var(--space-3);
}

/* No minimum height on the book itself: a shorter spine must sit on
 * the board, not hang in a taller slot */
.spine {
    position: relative;
    flex: 0 0 auto;
    width: 2.4rem;
    --spine-h: 11rem;          /* this book's height; a few run shorter */
    --spine-pad: 1.3rem;       /* head and tail, outside the bands */
}

.spine.w-2 { width: 2.9rem; }
.spine.w-3 { width: 3.4rem; }
.spine.w-4 { width: 4rem; }

.spine details { display: block; }

/* The spine face: title down the spine, author smaller beside it */
.spine summary {
    position: relative;
    display: flex;
    justify-content: center;
    box-sizing: border-box;
    height: var(--spine-h);
    width: 100%;
    /* The words sit between the two bands */
    padding: var(--spine-pad) 0.25rem var(--spine-pad) 0.8rem;
    border: 1px solid rgba(42, 41, 37, 0.18);
    border-bottom-width: 0;
    border-radius: 4px 4px 0 0;
    background: var(--spine, var(--accent-soft));
    color: var(--ink);
    cursor: pointer;
    list-style: none;
    font-family: Georgia, 'Times New Roman', serif;
    box-shadow: inset -3px 0 4px -3px rgba(42, 41, 37, 0.25),
        inset 2px 0 2px -2px rgba(255, 255, 255, 0.8);
}

.spine summary::-webkit-details-marker { display: none; }
.spine summary::marker { content: ''; }

.spine summary:hover { filter: brightness(0.97); }

/* Cloth tones in turn, and not every book the same height */
.spine:nth-child(4n+1) { --spine: #DCE6DD; }
.spine:nth-child(4n+2) { --spine: #EADFD3; }
.spine:nth-child(4n+3) { --spine: #D9E4EA; }
.spine:nth-child(4n+4) { --spine: #EBE4CF; }
.spine:nth-child(3n+2) { --spine-h: 10.4rem; }
.spine:nth-child(5n+3) { --spine-h: 10.7rem; }

/* Cloth binding: a soft roundness across the spine, and the bands
 * a bound book carries near its head and tail */
.spine summary {
    background-image:
        linear-gradient(to right, rgba(255, 255, 255, 0.35),
            transparent 35%, rgba(42, 41, 37, 0.06) 100%),
        linear-gradient(to bottom, transparent 0.9rem,
            rgba(42, 41, 37, 0.12) 0.9rem, rgba(42, 41, 37, 0.12) 0.98rem,
            transparent 0.98rem, transparent calc(100% - 0.98rem),
            rgba(42, 41, 37, 0.12) calc(100% - 0.98rem),
            rgba(42, 41, 37, 0.12) calc(100% - 0.9rem),
            transparent calc(100% - 0.9rem));
}

.spine .spine-author { font-style: italic; }

/* Written down the spine from the head, as on a bound book. In
 * vertical writing the flex column runs sideways (title on the right,
 * author beside it). Each line is held to the room between the bands
 * in plain rem — not a percentage, which a flex item may not resolve —
 * and cut short with an ellipsis at the tail. */
.spine-face {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.3rem;
    writing-mode: vertical-rl;
    height: calc(var(--spine-h) - 2 * var(--spine-pad));
}

.spine-title, .spine-author {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.3;
    max-height: calc(var(--spine-h) - 2 * var(--spine-pad));
}

.spine-title {
    font-weight: 700;
    font-size: 0.9rem;
}

.spine-author {
    font-size: 0.7rem;
    color: var(--ink-soft);
}

.spine.w-1 .spine-author { display: none; }

/* The ribbon: down the left edge from the head of the spine to the
 * bookmark's place, a notched tail at its end */
.spine-mark {
    position: absolute;
    top: -1px;
    left: 0.25rem;
    width: 0.35rem;
    height: calc(0.6rem + var(--read, 0) * (11rem - 1.2rem));
    background: var(--accent);
    clip-path: polygon(0 0, 100% 0, 100% 100%, 50% calc(100% - 0.25rem),
        0 100%);
}

.spine.mark-0 { --read: 0; }
.spine.mark-1 { --read: 0.1; }
.spine.mark-2 { --read: 0.2; }
.spine.mark-3 { --read: 0.3; }
.spine.mark-4 { --read: 0.4; }
.spine.mark-5 { --read: 0.5; }
.spine.mark-6 { --read: 0.6; }
.spine.mark-7 { --read: 0.7; }
.spine.mark-8 { --read: 0.8; }
.spine.mark-9 { --read: 0.9; }
.spine.mark-10 { --read: 1; }

/* A book behind us: the ribbon runs the length of the spine, the
 * cloth a little faded. One ahead: a short tab at the head. One no
 * schedule carries yet: no ribbon, and a dashed edge. */
.spine.is-finished summary { filter: saturate(0.7) brightness(0.98); }
.spine.is-ahead .spine-mark { background: var(--line-strong); }
.spine.is-unscheduled summary {
    border-style: dashed;
    background: var(--paper);
    background-image: none;
}
.spine.is-unscheduled .spine-mark { display: none; }

/* Pulled off the shelf: the open spine takes the row, its pages
 * laid out beside it, and the others carry on below */
.spine:has(details[open]) { width: 100%; }

.spine details[open] {
    display: flex;
    align-items: flex-start;
    gap: var(--space-3);
    padding-top: var(--space-2);
}

/* The pulled book keeps its spine beside the pages, and in view
 * while a long chapter list scrolls by */
.spine details[open] > summary {
    flex: 0 0 auto;
    position: sticky;
    top: var(--space-3);
    width: 2.9rem;
    border-bottom-width: 1px;
    border-radius: 4px;
    margin-bottom: 0.35rem;
}

.spine details[open] > summary .spine-face,
.spine details[open] > summary .spine-title,
.spine details[open] > summary .spine-author {
    height: auto;
    max-height: calc(11rem - 2 * var(--spine-pad));
}

.spine-pages {
    flex: 1 1 16rem;
    min-width: 0;
    padding: 0 0 var(--space-3);
}

.book-head {
    margin-bottom: var(--space-1);
    font-family: Georgia, 'Times New Roman', serif;
}

.book-title { font-weight: 700; font-size: 1.05rem; }

.book-author {
    color: var(--ink-soft);
    font-size: 0.95rem;
}

.book-author::before { content: '— '; }

.spine-pages .meta {
    color: var(--ink-soft);
    font-size: 0.9rem;
    margin-bottom: var(--space-2);
}

.chapters {
    display: flex;
    flex-direction: column;
    gap: 0;
    border-top: 1px solid var(--line);
}

.chapter {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: var(--space-1) var(--space-2);
    padding: 0.35rem var(--space-2);
    border-bottom: 1px solid var(--line);
    font-size: 0.9rem;
}

.chapter-label { font-weight: 600; min-width: 4rem; }

.chapter-title { flex: 1 1 10rem; min-width: 0; }

.chapter-when {
    color: var(--ink-soft);
    font-size: 0.8rem;
    margin-left: auto;
    white-space: nowrap;
}

.chapter-grade {
    flex: 0 0 100%;
    padding-left: calc(4rem + var(--space-2));
    color: var(--accent-dark);
    font-size: 0.8rem;
}

.chapter.is-read .chapter-label,
.chapter.is-read .chapter-title { color: var(--ink-soft); }

/* Today's chapter: a ribbon's worth of sage down its left edge */
.chapter.is-here { box-shadow: inset 3px 0 0 var(--accent); }

.chapter.test .chapter-label { color: var(--accent-dark); }

/* The reading log is the printed page's shape; the screen has spines */
.shelf-log { display: none; }

@media (max-width: 32rem) {
    .spine details[open] { flex-direction: column; align-items: stretch; }
    .spine details[open] > summary { width: 2.9rem; }
}

/* ---- home ----
 *
 * The hallway: the school's name, a few facts, and two doors, with
 * the picture from the front step beside them. */

.home-hero {
    display: grid;
    grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr);
    gap: var(--space-5);
    align-items: center;
    padding-block: var(--space-3) var(--space-4);
}

.home-copy > * { max-width: 34rem; }

.home-copy h1 { margin-bottom: var(--space-3); }

.home-plate { max-width: 22rem; }

.home-note {
    color: var(--ink-soft);
    margin-top: var(--space-3);
}

/* The doors: two cards that are links, the whole face clickable */
.doors {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--space-3);
    margin-top: var(--space-4);
}

.door {
    display: flex;
    flex-direction: column;
    gap: var(--space-1);
    padding: var(--space-3) var(--space-4);
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    color: var(--ink);
    text-decoration: none;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.door:hover {
    border-color: var(--accent);
    box-shadow: 0 6px 18px -10px rgba(42, 41, 37, 0.35);
}

.door-title {
    font-weight: 700;
    font-size: 1.1rem;
    color: var(--accent-dark);
}

.door-line {
    color: var(--ink-soft);
    font-size: 0.9rem;
    line-height: 1.45;
}

@media (max-width: 52rem) {
    .home-hero {
        grid-template-columns: minmax(0, 1fr);
        gap: var(--space-4);
    }
    /* On a phone the picture opens the page, as on the front step */
    .home-plate { order: -1; max-width: 14rem; }
    .doors { grid-template-columns: minmax(0, 1fr); }
}

@media (prefers-reduced-motion: reduce) {
    .door { transition: none; }
}

/* ---- the kid portal ----
 *
 * A section per kid: the name, the card, the shelf row beneath it. */

.kid { margin-bottom: var(--space-4); }

.kid .shelf-row { margin-top: var(--space-2); }

.shelf-more {
    color: var(--ink-soft);
    font-size: 0.9rem;
    margin: calc(-1 * var(--space-2)) 0 var(--space-3);
}

/* ---- the garden ----
 *
 * A Game of Life on paper at the foot of the kid portal, in the
 * page's own materials: a card holding graph paper, the page's quiet
 * buttons beneath it. Without scripts only the heading, the rules
 * and one sentence stand — nothing that looks clickable. */

.garden { margin-top: var(--space-5); }

/* The words run the width of the paper beneath them */
.garden-rules {
    color: var(--ink-soft);
    text-wrap: pretty;
}

.garden-board {
    padding: var(--space-2);
    margin-bottom: var(--space-3);
    background: var(--garden-paper);
    border-color: var(--garden-line);
    box-shadow: inset 0 1px 3px rgba(42, 41, 37, 0.08),
        0 1px 2px rgba(42, 41, 37, 0.04);
}

.garden-canvas {
    display: block;
    width: 100%;
    aspect-ratio: 2 / 1;
    border-radius: 4px;
    touch-action: none;
    cursor: crosshair;
}

.garden-rules + .garden-rules { margin-top: calc(-1 * var(--space-2)); }

.garden-noscript {
    margin: var(--space-2) var(--space-2) var(--space-1);
    color: var(--ink-soft);
}

html.js .garden-noscript { display: none; }
html:not(.js) .garden-canvas,
html:not(.js) .garden-controls { display: none; }

.garden-controls .inline-actions { margin-bottom: var(--space-2); }

/* The named seeds wait behind a small arrow beside "Seeds" */
.garden-seeds { margin-bottom: var(--space-2); }

.garden-seeds summary {
    display: inline-flex;
    align-items: center;
    gap: var(--space-1);
    cursor: pointer;
    list-style: none;
    padding: var(--space-1) 0;
}

.garden-seeds summary::-webkit-details-marker { display: none; }

.garden-seeds summary::before {
    content: '';
    width: 0.45rem;
    height: 0.45rem;
    border-right: 1.5px solid var(--ink-soft);
    border-bottom: 1.5px solid var(--ink-soft);
    transform: rotate(-45deg);
    margin-right: var(--space-1);
    transition: transform 0.15s ease;
}

.garden-seeds[open] summary::before { transform: rotate(45deg); }

.garden-seeds .label {
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--ink-soft);
}

.garden-seed-list {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-1) var(--space-2);
    padding: var(--space-1) 0 var(--space-2);
}

@media (prefers-reduced-motion: reduce) {
    .garden-seeds summary::before { transition: none; }
}

.garden-status {
    color: var(--ink-soft);
    font-size: 0.9rem;
    min-height: 1.4em;
}

/* ---- adding a book: two things to do ----
 *
 * Find the book, or scan it with a phone. Each is a card with one
 * job; the fields for typing a book in wait behind "Enter it by
 * hand" until there is something in them to check.
 */

.book-option {
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--card);
    padding: var(--space-4);
    margin: 0 0 var(--space-3);
    max-width: 30rem;
}

.book-option h2 {
    font-size: 1.1rem;
    margin: 0 0 var(--space-3);
}

.book-option h2 label {
    font: inherit;
    color: inherit;
    margin: 0;
}

.book-option .notice { margin: 0 0 var(--space-3); }

.lookup-row {
    display: flex;
    gap: var(--space-2);
    align-items: stretch;
}

.lookup-row .field {
    flex: 1 1 auto;
    min-width: 0;
    margin: 0;
}

.lookup-row .field input { width: 100%; }
.lookup-row .button { flex: none; }
form.lookup > .hint { margin: var(--space-2) 0 0; }

details.by-hand { max-width: 30rem; }

details.by-hand > summary {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    cursor: pointer;
    list-style: none;
    padding: var(--space-2) 0;
    color: var(--ink-soft);
    font-weight: 600;
}

details.by-hand > summary::-webkit-details-marker { display: none; }

details.by-hand > summary::before {
    content: '';
    width: 0.45rem;
    height: 0.45rem;
    border-right: 1.5px solid currentColor;
    border-bottom: 1.5px solid currentColor;
    transform: rotate(-45deg);
    transition: transform 0.15s ease;
}

details.by-hand[open] > summary::before { transform: rotate(45deg); }
details.by-hand > summary:hover { color: var(--ink); }
details.by-hand[open] > summary { margin-bottom: var(--space-3); }

@media (prefers-reduced-motion: reduce) {
    details.by-hand > summary::before { transition: none; }
}

/* ---- book scan ----
 *
 * A book the shelf doesn't know is read from photos of its pages.
 * The add-book page shows the code a phone scans, beside what it is
 * for; /scan is the phone's own page.
 */

.scan-panel [hidden],
.scan-capture [hidden],
.scan-capture .button.camera[hidden] { display: none; }

.scan-body {
    display: flex;
    align-items: center;
    gap: var(--space-4);
}

/* What the code is for, then how the scan is going: a column whose
   gaps only open between the lines that are showing */
.scan-words {
    flex: 1 1 auto;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
}

.scan-words > p,
.scan-words > form { margin: 0; }

/* The code is black on white whatever the page's colours: a phone's
   camera wants the contrast, and the white edge is part of the code */
.scan-qr {
    flex: none;
    width: 9.5rem;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    overflow: hidden;
    background: #fff;
}

.scan-qr svg { display: block; width: 100%; height: auto; }
/* A scan whose code is spent has none to show */
.scan-qr:empty,
.scan-lead:empty { display: none; }

/* What is happening, said where the eye already is: full ink, on the
   accent's tint, so it reads as news and not as small print. Until
   a phone follows the code there is no news. */
.scan-status {
    background: var(--accent-soft);
    border-radius: var(--radius);
    padding: var(--space-2) var(--space-3);
    color: var(--ink);
}

.scan-status:empty { display: none; }

/* Where a script follows the scan the form fills itself in, and the
   button shows only when the script has a use for it */
html.js [data-scan-panel]:not([data-needs-button]) [data-scan-fill-button] {
    display: none;
}

html.js [data-scan-panel]:not([data-needs-button]) form[data-scan-fill] {
    display: none;
}

/* Someone already on a phone can't point it at its own screen: there
   the code gives way to a button that leads to the same place */
.scan-panel .on-phone { display: none; }

@media (max-width: 32rem) {
    .lookup-row { flex-direction: column; }
    .lookup-row .button { width: 100%; text-align: center; }
    .scan-panel .on-wide { display: none; }
    .scan-panel .on-phone { display: block; }
    .scan-panel .on-phone > a.button { display: block; text-align: center; }
}

/* The phone's page: one thing to do at a time, each button a full
   line wide and easy to hit with a thumb */
.scan-step { margin-top: var(--space-4); }
.scan-step h2 { font-size: 1.15rem; margin: 0 0 var(--space-1); }
.scan-step .form-actions { margin-top: var(--space-3); }

.scan-capture .button.camera {
    display: block;
    margin-top: var(--space-3);
    text-align: center;
    padding-top: var(--space-3);
    padding-bottom: var(--space-3);
    cursor: pointer;
}

.scan-capture .form-actions > .button.camera { flex: 1 1 100%; margin-top: 0; }
.scan-capture .form-actions > button { flex: 1 1 100%; text-align: center; }

/* The camera input is hidden but stays in the tab order; its ring
   shows on the button that stands for it */
.scan-capture .button.camera:focus-within {
    outline: 2px solid var(--accent-dark);
    outline-offset: 2px;
}

.scan-thumbs {
    list-style: none;
    padding: 0;
    margin: var(--space-3) 0;
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2);
}

.scan-thumbs:empty { display: none; }

.scan-thumbs li {
    position: relative;
    width: 5.5rem;
    height: 7rem;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--card);
    overflow: hidden;
}

.scan-thumbs img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.scan-thumbs li.sending img { opacity: 0.5; }

.scan-thumb-blank,
.scan-thumb-note {
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    font-size: 0.8rem;
    color: var(--ink-soft);
    padding: var(--space-1);
}

.scan-thumb-blank { width: 100%; height: 100%; }

.scan-thumb-note {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--card);
    color: var(--ink);
}

/* 44px square: a thumb's worth of target on a small picture */
.scan-thumb-remove {
    position: absolute;
    top: 0;
    right: 0;
    width: 2.75rem;
    height: 2.75rem;
    border: 0;
    border-radius: 0 0 0 var(--radius);
    background: rgba(255, 255, 255, 0.9);
    color: var(--ink);
    font: inherit;
    font-size: 1.4rem;
    line-height: 1;
    cursor: pointer;
}

.scan-thumb-remove:focus-visible {
    outline: 2px solid var(--accent-dark);
    outline-offset: -2px;
}
