/* The app's stylesheet. Styles HTML elements rather than classes: the only classes are the card's parts (modules/card).
   Colours are variables, with a dark theme. Green is the accent, for growth; warm yellow marks the words being learned.
   Graphics are SVG files in public/img/. Shed has its own stylesheet (public/admin/style.css). */

:root {
    --bg: #f6f6f3;        /* page */
    --surface: #ffffff;   /* main area, inputs */
    --sunken: #f7f7f4;    /* forms, code, table headings: a light grey on the white main area */
    --border: #dcdcd4;
    --field-border: #878c92; /* inputs, selects and text areas: 3:1 against the white and grey they sit on */
    --text: #22262b;
    --muted: #5f6468;
    --heading: #1b1f24;
    --accent: #1f7d46;    /* links, buttons, focus: green, for growth (4.5:1 on the page and form greys) */
    --accent-text: #ffffff;
    --warm: #f2a541;      /* a second colour: cards */
    --neutral: #4a4f55;   /* dark grey outline buttons: "I already know this" */
    --scroll-track: #d4d4cc; /* the scrollbar's track: a darker grey under the green thumb */
    --highlight: #ffe58a; /* <mark>: the term in a card's sentence */
    --error: #b42318;
    --forgotten: #c8372d; /* the Forgotten button in reviews */
    --error-bg: #fdecea;
    --ok: #146c43;
    --ok-bg: #e6f4ec;
    --chart-learned: #8fd3a8;    /* graphs: lessons learned, */
    --chart-remembered: #23864b; /* remembered (and other single-colour graphs), */
    --chart-forgotten: #f2a541;  /* forgotten */
    --heat-0: #ebebe6;           /* the heatmap: no reviews, then four greens from a few to many */
    --heat-1: #c6ead3;
    --heat-2: #8fd3a8;
    --heat-3: #3fae6a;
    --heat-4: #1f7442;
    --radius: 0.5rem;
    color-scheme: light dark;
}
/* Dark colours: from the device's setting, unless the learner chose light in the footer (theme cookie), or chosen dark */
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        --bg: #15171a;
        --surface: #1d2024;
        --sunken: #262a2f;
        --border: #3a3f45;
        --field-border: #737980;
        --text: #e5e7ea;
        --muted: #a3a8ae;
        --heading: #f1f3f5;
        --accent: #5fd38d;
        --accent-text: #0c1a11;
        --warm: #d9902f;
        --neutral: #b4b9bf; /* lighter, to stand out on the dark page */
        --scroll-track: #0e1012;
        --highlight: #6b5a12;
        --error: #ff8a80;
        --forgotten: #cf3e33; /* white text on it: 4.5:1 */
        --error-bg: #3b2023;
        --ok: #7ad3a2;
        --ok-bg: #1d3328;
        --chart-learned: #2f7a4e;
        --chart-remembered: #5fd38d;
        --chart-forgotten: #d9902f;
        --heat-0: #2a2e33;
        --heat-1: #1f4a31;
        --heat-2: #2f7a4e;
        --heat-3: #46b072;
        --heat-4: #7ee0a4;
    }
}
:root[data-theme="dark"] {
    --bg: #15171a;
    --surface: #1d2024;
    --sunken: #262a2f;
    --border: #3a3f45;
    --field-border: #737980;
    --text: #e5e7ea;
    --muted: #a3a8ae;
    --heading: #f1f3f5;
    --accent: #5fd38d;
    --accent-text: #0c1a11;
    --warm: #d9902f;
    --neutral: #b4b9bf; /* lighter, to stand out on the dark page */
    --scroll-track: #0e1012;
    --highlight: #6b5a12;
    --error: #ff8a80;
    --forgotten: #cf3e33; /* white text on it: 4.5:1 */
    --error-bg: #3b2023;
    --ok: #7ad3a2;
    --ok-bg: #1d3328;
    --chart-learned: #2f7a4e;
    --chart-remembered: #5fd38d;
    --chart-forgotten: #d9902f;
    --heat-0: #2a2e33;
    --heat-1: #1f4a31;
    --heat-2: #2f7a4e;
    --heat-3: #46b072;
    --heat-4: #7ee0a4;
}
:root[data-theme="light"] { color-scheme: light; }
:root[data-theme="dark"] { color-scheme: dark; }

/**** Page *****************************************************************/

* { box-sizing: border-box; }

html {
    font-family: system-ui, -apple-system, "Segoe UI", "Hiragino Sans", "Noto Sans JP", sans-serif;
    line-height: 1.6;
    color: var(--text);
    background: var(--bg);
    border-top: 0.3rem solid var(--accent);           /* a green stripe along the top, as in Shed */
    scrollbar-color: var(--accent) var(--scroll-track); /* a green scrollbar (thumb, then track) */
}
body {
    max-width: 76rem; /* wide, so the dashboard and Settings use the screen; card pages narrow their own column (below) */
    margin: 0 auto;
    padding: 0 1.5rem 2rem;
}

body > header {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem 1.5rem;
    padding: 1rem 0;
}
body > header > a:first-child { /* the logo and the app's name */
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1.5rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    color: var(--heading);
    text-decoration: none;
}
nav a {
    font-weight: 600;
    color: var(--text);
    text-decoration: none;
}
nav a:hover { color: var(--accent); }
nav strong a { /* a call to action, such as Register */
    padding: 0.35rem 0.9rem;
    border-radius: 999px;
    color: var(--accent-text);
    background: var(--accent);
}
nav strong a:hover { color: var(--accent-text); filter: brightness(1.08); }

main {
    padding: 1.5rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}
body > footer {
    padding: 1.25rem 0;
    font-size: 0.9rem;
    color: var(--muted);
    text-align: center;
}
body > footer > * + * { margin-top: 0.75rem; }
body > footer + footer { text-align: left; } /* the dev stats panel (test users only, Q62) comes after the page's footer: not centred */
body > footer .controls { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 0.75rem 1.5rem; }
body > footer .controls + nav { margin-top: 1.25rem; }
body > footer form.language { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 0.5rem; }
body > footer form.language label { display: inline-flex; align-items: center; gap: 0.35rem; font-weight: 600; }
body > footer form.language select { width: auto; padding: 0.3rem 0.5rem; }
body > footer form.language button { padding: 0.3rem 0.8rem; font-size: 0.85rem; } /* small, in the usual green */
body > footer nav div { display: flex; flex-wrap: wrap; justify-content: center; gap: 0.5rem 1.25rem; }
body > footer nav a { font-weight: 500; color: var(--muted); } /* quieter than the header's menu */
body > footer nav a:hover { color: var(--accent); }

/* Separators between nav links, for text browsers (Lynx, Dillo); hidden elsewhere */
.sep { visibility: hidden; color: var(--bg); }

/**** Text *****************************************************************/

h1, h2, h3, h4 { line-height: 1.25; margin: 1.5em 0 0.5em; color: var(--heading); }
h1 { font-size: 1.8rem; margin-top: 0; }
h2 { font-size: 1.35rem; }
h3 { font-size: 1.1rem; }

a { color: var(--accent); text-underline-offset: 0.15em; }
a:hover { text-decoration-thickness: 2px; }

small { color: var(--muted); }
mark { color: inherit; background: var(--highlight); padding: 0 0.15em; border-radius: 0.2em; }
code, kbd { padding: 0 0.3em; background: var(--sunken); border-radius: 0.25em; }
img { max-width: 100%; height: auto; }
figure { margin: 0 0 1rem; text-align: center; } /* illustrations, such as public/img/growth.svg */
img[src^="/img/stage-"] { vertical-align: -0.35em; margin-right: 0.25rem; } /* the stage icons on the dashboard */
/* Pages written in Shed (/help, /pages/…): a readable line length, room between sections, and keys that look like keys */
.page { max-width: 42rem; }
.page h2 { margin-top: 2rem; }
.page figure img { max-height: 12rem; width: auto; }
.page kbd { border: 1px solid var(--border); border-bottom-width: 2px; font-family: inherit; }
.page details { border-bottom: 1px solid var(--border); padding: 0 0 0.75rem; }
hr { border: 0; border-top: 1px solid var(--border); margin: 1.5rem 0; }

/* Messages: form errors (role="alert") and confirmations (role="status") */
[role="alert"], [role="status"] {
    margin: 0 0 1rem;
    padding: 0.75rem 1rem;
    border-radius: var(--radius);
}
[role="alert"] { color: var(--error); background: var(--error-bg); }
[role="status"] { color: var(--ok); background: var(--ok-bg); }
[role="alert"] ul { margin: 0.25rem 0 0; }

/* A page's heading with a profile picture beside it (the dashboard's welcome) */
main > header { display: flex; align-items: center; gap: 1rem; margin: 0 0 1rem; }
main > header h1 { margin: 0; }
main > header img[src="/img/welcome.svg"] { margin-left: auto; } /* the illustration on the right */
h2 > img[src^="/img/icon-"] { vertical-align: -0.4em; margin-right: 0.35rem; } /* section icons on the dashboard */
@media (max-width: 40rem) { main > header img[src="/img/welcome.svg"] { display: none; } }
img[src^="/profile/avatar"] { border-radius: 50%; object-fit: cover; }
/* A section's header: a picture beside a few lines of text (the Profile card in Settings) */
main section > header { display: flex; align-items: center; gap: 1rem; margin: 0 0 1.25rem; padding: 0 0 1rem; border-bottom: 1px solid var(--border); }
main section > header strong { font-size: 1.2rem; }
main section form > div > input + button { margin-left: 0.5rem; } /* a field with its button beside it */
/* A field with its buttons beside it (Settings → Profile): on a phone they wrap under it, level with it on the left and
   with a gap above, rather than indented and touching it */
.field-row { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; margin: 0.25rem 0; }
.field-row > * { margin: 0; }
main input[type="file"] { max-width: 20rem; padding: 0.35rem; } /* narrower than text fields */
main section > form + form { margin-top: 1rem; }

/**** Dashboard sections ***************************************************/

/* A <div> of <section>s inside <main> lays them out side by side when there's room */
main > div { display: grid; grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr)); gap: 1rem; margin: 0 0 1rem; }
main section { padding: 1rem 1.25rem; border: 1px solid var(--border); border-radius: var(--radius); margin: 0 0 1rem; }
main > div > section { margin: 0; }
main section h2 { margin-top: 0; font-size: 1.1rem; }
main section p > strong:first-child { font-size: 2rem; line-height: 1; } /* a big number */
main section form { margin: 0.5rem 0 0; }
main section table { margin: 0; }
/* Progress bars (level progress) */
progress {
    -webkit-appearance: none;
    appearance: none;
    display: block;
    width: 100%;
    height: 14px;
    margin: 0.5rem 0;
    overflow: hidden;
    color: var(--accent); /* old Edge */
    background: var(--sunken);
    border: 0;
    border-radius: 7px;
}
progress::-webkit-progress-bar { background: var(--sunken); border-radius: 7px; }
progress::-webkit-progress-value { background: var(--accent); border-radius: 7px; }
progress::-moz-progress-bar { background: var(--accent); border-radius: 7px; }

/* Graphs (modules/dashboard/dashboard_chart.php): inline SVG */
figure:has(> svg) { overflow-x: auto; } /* a graph wider than a phone scrolls sideways */
figure svg { display: block; height: auto; }
figure svg text { font-size: 12px; fill: var(--muted); }
figure > figcaption { display: flex; flex-wrap: wrap; justify-content: center; gap: 0.25rem 1rem; font-size: 0.9rem; color: var(--muted); }

/**** Tables ***************************************************************/

table { width: 100%; border-collapse: collapse; margin: 1rem 0; }
th, td { padding: 0.45rem 0.6rem; text-align: left; vertical-align: top; border-bottom: 1px solid var(--border); }
th { font-weight: 700; background: var(--sunken); }
tr:last-child td { border-bottom: 0; }
footer table { font-size: 0.85rem; }
footer td:first-child { font-family: ui-monospace, monospace; word-break: break-word; } /* SQL in the dev stats */
footer td:last-child, footer th:last-child { width: 1%; white-space: nowrap; } /* the Time column: as narrow as its content */

/**** Forms ****************************************************************/

/* A page's own forms (direct children of <main>) sit in a box; small action forms inside content don't */
main > form {
    display: block; /* Dillo */
    padding: 1.25rem;
    background: var(--sunken);
    border-radius: var(--radius);
}
main > form + form { margin-top: 1rem; }
form > p:first-child, form > input[type="hidden"]:first-child + p { margin-top: 0; }
form > div { margin: 0 0 1rem; }
form > div:last-child { margin-bottom: 0; }

label { font-weight: 600; }
fieldset {
    margin: 0 0 1rem;
    padding: 0.75rem 1rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
}
legend { padding: 0 0.25rem; font-weight: 700; }
fieldset label { font-weight: normal; }
fieldset > div { margin: 0.5rem 0; }
fieldset ul { margin: 0.25rem 0 0.75rem 1.75rem; padding: 0; list-style: none; font-size: 0.9rem; color: var(--muted); }
fieldset ul p { margin: 0; }

input, select, textarea, button {
    font: inherit;
    color: inherit;
}
input:not([type="checkbox"], [type="radio"]), select, textarea {
    width: 100%;
    max-width: 28rem;
    padding: 0.5rem 0.65rem;
    background: var(--surface);
    border: 1px solid var(--field-border);
    border-radius: var(--radius);
}
input[type="checkbox"], input[type="radio"] { accent-color: var(--accent); width: 1.1rem; height: 1.1rem; vertical-align: -0.15em; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

button {
    padding: 0.6rem 1.3rem;
    font-weight: 700;
    color: var(--accent-text);
    background: var(--accent);
    border: 0;
    border-radius: var(--radius);
    cursor: pointer;
}
button:hover { filter: brightness(1.08); }
button:disabled { opacity: 0.5; cursor: default; filter: none; }
/* Secondary actions under a card: small text buttons in a row */
aside { display: flex; flex-wrap: wrap; gap: 0.25rem 1rem; margin: 1rem 0 0; }
aside form { margin: 0; }
aside button { padding: 0.2rem 0; font-size: 0.9rem; font-weight: 600; color: var(--muted); background: none; text-decoration: underline; text-underline-offset: 0.15em; }
aside p { margin: 0.2rem 0; }
td button { padding: 0.2rem 0.75rem; font-size: 0.9rem; color: var(--accent); background: transparent; box-shadow: inset 0 0 0 1.5px var(--accent); } /* small row actions */
td form { margin: 0; }
td form.inline { display: inline; } /* a link-style action after a status (level pages: Q70) */
td form.inline button.link { padding: 0; font-size: inherit; color: var(--accent); box-shadow: none; text-underline-offset: 0.15em; }
.level-nav { display: flex; justify-content: space-between; gap: 1rem; margin: 1rem 0; }
.level-nav a[rel=next] { margin-left: auto; }
button + button { margin-left: 0.5rem; color: var(--accent); background: transparent; box-shadow: inset 0 0 0 2px var(--accent); } /* a second, lesser choice */
button[value="forgotten"] { color: #ffffff; background: var(--forgotten); box-shadow: none; } /* reviews: red Forgotten, then */
button[value="remembered"] { color: var(--accent-text); background: var(--accent); box-shadow: none; } /* solid green Remembered */
button[value="known"] { /* "I already know this", in lessons and reviews: a dark grey outline, apart from the green answers */
    padding: 0.6rem 1.3rem; font-size: 1rem; font-weight: 700; text-decoration: none;
    color: var(--neutral); background: transparent; box-shadow: inset 0 0 0 2px var(--neutral);
}

details { margin: 0.75rem 0 0; }
summary { cursor: pointer; font-weight: 600; color: var(--accent); }
details > form { margin: 0.5rem 0 0; }

/**** Cards (modules/card) *************************************************/

/* Pages built around a card (lessons, reviews, a term's page) hold little, so they keep a narrow column in the middle */
main:has(> article) > * { max-width: 46rem; margin-left: auto; margin-right: auto; }

main article { /* a card being studied */
    margin: 0 auto 1.25rem;
    padding: 1rem 1.25rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-left: 6px solid var(--warm);
    border-radius: var(--radius);
}
main article h1 { margin-top: 0; }

.card-front { font-size: 1.4rem; line-height: 1.5; }
.card-meaning { font-size: 1.1rem; font-weight: 600; }
.card-translation { color: var(--muted); }
.card-us { color: var(--muted); }
/* Play a recording (Q51): a round speaker button after the term or sentence; .playing while app.js plays it */
a.play { display: inline-flex; align-items: center; justify-content: center; width: 2.25rem; height: 2.25rem; margin-left: 0.4rem;
    vertical-align: middle; border-radius: 50%; color: var(--accent); background: var(--surface); border: 1px solid var(--border); }
a.play:hover, a.play.playing { color: var(--accent-text); background: var(--accent); border-color: var(--accent); }
a.play svg { width: 1.25rem; height: 1.25rem; fill: currentColor; }
.card-term { font-size: 1.1rem; }

/* A "nothing to do" page after or between sessions (lesson and review status): a centred column, the message larger,
   and the closing link (where to go next) as a button, so a wide screen isn't a small picture and two lines in a big box */
main > div.status { display: block; max-width: 36rem; margin: 0 auto; padding: 2rem 0 1rem; text-align: center; }
.status figure { margin-bottom: 1.5rem; }
.status figure + p { font-size: 1.2rem; font-weight: 600; color: var(--heading); }
.status > p:last-child { margin: 2rem 0 0; }
.status > p:last-child a {
    display: inline-block; padding: 0.6rem 1.5rem; font-weight: 700; text-decoration: none;
    color: var(--accent-text); background: var(--accent); border-radius: var(--radius);
}
.status > p:last-child a:hover { filter: brightness(1.08); }
/* All of today's lessons or reviews done (templates/all_done.php): a bigger picture and heading than after a batch, with a little bounce */
.status figure.all-done img { width: 100%; max-width: 320px; height: auto; }
.status h2.all-done { font-size: 2rem; margin: 0 0 0.75rem; color: var(--accent); }
.status h2.all-done + p { font-size: 1.2rem; font-weight: 600; color: var(--heading); }
@media (prefers-reduced-motion: no-preference) {
    .status figure.all-done img { animation: all-done-pop 0.6s ease-out; }
}
@keyframes all-done-pop { 0% { transform: scale(0.6); opacity: 0; } 70% { transform: scale(1.06); opacity: 1; } 100% { transform: scale(1); } }

/**** Small screens ********************************************************/

@media (max-width: 40rem) {
    main { padding: 1rem; border-left: 0; border-right: 0; border-radius: 0; margin: 0 -1rem; }
}

/* The review heatmap (dashboard) */
svg.heatmap text { font-size: 11px; }
.heat-scroll { display: flex; flex-direction: row-reverse; overflow-x: auto; } /* on a narrow screen, starts scrolled to the latest weeks */
.heat-scroll svg { flex: none; width: 100%; }
svg.heatmap rect.today { stroke: var(--text); stroke-width: 1.5; }
/* Less ▪▪▪▪▪ More: the caption is a flex row, where vertical-align does nothing, so the squares sit on the text's
   baseline through align-items, close together */
figcaption.heat-legend { align-items: baseline; gap: 0.25rem; }
.heat-key { display: inline-block; width: 0.85em; height: 0.85em; border-radius: 2px; }
.heat-stats { display: flex; flex-wrap: wrap; gap: 0.25rem 1.5rem; padding: 0; list-style: none; }

/* The daily limit reached: the congratulations picture beside the dashboard's message */
img.daily-done { vertical-align: middle; }
/* The dashboard (Q66): today's next step stands out; cards by stage in one row */
section.today { border-color: var(--accent); border-width: 2px; }
section.today p { margin: 0.5rem 0; }
ul.stages { display: flex; flex-wrap: wrap; gap: 0.5rem 1.5rem; padding: 0; margin: 0 0 0.75rem; list-style: none; }
ul.stages img { vertical-align: middle; }

/* Settings tabs: links, one page each (no JS) */
nav.tabs { display: flex; flex-wrap: wrap; gap: 0.25rem; margin: 0 0 1.5rem; border-bottom: 2px solid var(--border); }
nav.tabs a { padding: 0.5rem 1rem; margin-bottom: -2px; border-bottom: 3px solid transparent; color: var(--muted); font-weight: 600; text-decoration: none; }
nav.tabs a:hover { color: var(--text); }
nav.tabs a[aria-current="page"] { color: var(--accent); border-bottom-color: var(--accent); }

/* Reset progress can't be undone: a red button, as a warning */
form[action="/settings/reset"] button, form[action="/settings/delete"] button { color: #ffffff; background: var(--forgotten); box-shadow: none; }

/* Help requests: the new-reply banner on every page, the count on the Help tab, and the conversation */
.notice { margin: 0 0 1rem; padding: 0.75rem 1rem; border-radius: var(--radius); background: var(--ok-bg); color: var(--ok); }
.notice a { font-weight: 700; }
.notice > p { margin: 0.5rem 0; } /* the Decks welcome (Q63) */
.notice > p:first-child { margin-top: 0; }
.notice > p:last-child { margin-bottom: 0; }

/* Installing on a phone (PWA, PLAN.md Phase 15). The install note's "don't show again" looks like a link; the notes are
   hidden inside the installed app itself, which needs no telling (no JS: the display-mode media query). */
button.link { padding: 0; border: 0; background: none; color: inherit; font: inherit; text-decoration: underline; cursor: pointer; }
form.install-note { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.25rem 0.75rem; }
@media (display-mode: standalone) { .install-note { display: none; } }
/* /install: each phone's steps, a picture over its words; side by side when there's room */
.install-steps { display: grid; grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr)); gap: 1.5rem; margin-top: 1.5rem; }
.install-steps figcaption { display: block; margin-top: 0.5rem; font-size: 1rem; color: inherit; }
/* Full screen on an iPhone (viewport-fit=cover in templates/header.php): keep everything clear of the notch, the rounded
   corners and the home bar. env() is 0 everywhere else, so nothing changes there. */
body {
    padding-left: max(1.5rem, env(safe-area-inset-left));
    padding-right: max(1.5rem, env(safe-area-inset-right));
    padding-bottom: max(2rem, env(safe-area-inset-bottom));
}
body > header { padding-top: max(1rem, env(safe-area-inset-top)); }
nav.tabs .count, .new { display: inline-block; min-width: 1.4em; padding: 0 0.4em; border-radius: 1em; background: var(--forgotten); color: #ffffff; font-size: 0.8em; text-align: center; }
.new { min-width: 0; }
ol.thread { list-style: none; padding: 0; }
ol.thread li { margin: 0 0 1rem; padding: 0.75rem 1rem; border-radius: var(--radius); background: var(--sunken); border: 1px solid var(--border); }
ol.thread li.owner { border-left: 4px solid var(--accent); }
ol.thread li p { margin: 0.25rem 0; }

/* Decks: the search form as one row (label above the field and its button), with room before the results */
form.search { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem 0.75rem; margin: 0 0 1.5rem; }
form.search label { flex: 0 0 100%; }
form.search input { flex: 1 1 16rem; max-width: 28rem; }
table.results { width: 100%; border-collapse: collapse; }
table.results td { padding: 0.6rem 0.5rem; vertical-align: middle; border-top: 1px solid var(--border); }
table.results tr:first-child td { border-top: 0; }
table.results td:last-child { text-align: right; white-space: nowrap; }
table.results form { margin: 0; }

/* Help requests: message boxes as wide as the page allows */
form[action^="/contact"] textarea { max-width: none; }

/* The footer's theme button: only the one that switches away from the theme being shown is visible */
body > footer form.theme { display: flex; justify-content: center; }
body > footer form.theme button { display: inline-flex; align-items: center; gap: 0.4rem; padding: 0.3rem 0.8rem; font-size: 0.85rem;
    color: var(--text); background: var(--surface); box-shadow: inset 0 0 0 1px var(--border); }
body > footer form.theme .to-light { display: none; }
:root[data-theme="dark"] body > footer form.theme .to-light { display: inline-flex; }
:root[data-theme="dark"] body > footer form.theme .to-dark { display: none; }
@media (prefers-color-scheme: dark) {
    :root:not([data-theme]) body > footer form.theme .to-light { display: inline-flex; }
    :root:not([data-theme]) body > footer form.theme .to-dark { display: none; }
}

/* A link that looks like a button (Download my data) */
a.button { display: inline-block; padding: 0.6rem 1.25rem; border-radius: var(--radius); font-weight: 600;
    color: var(--accent-text); background: var(--accent); text-decoration: none; }
a.button:hover { filter: brightness(1.08); }

/* The Decks page: two columns of decks, each with its picture (set in Shed) on top; one column on phones */
.deck-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; align-items: start; }
.deck-card { border: 1px solid var(--border); border-radius: var(--radius); padding: 1rem; background: var(--surface); }
/* The picture across the top (8:3, as Shed saves it) */
.deck-card > img { display: block; width: calc(100% + 2rem); max-width: none; margin: -1rem -1rem 1rem; aspect-ratio: 8 / 3;
    object-fit: cover; border-radius: var(--radius) var(--radius) 0 0; }
.deck-card > h2 { margin-top: 0; }
.deck-card select { width: auto; }
.deck-card label + select { margin: 0 0.5rem; } /* "Start at [Level 1] [Start this deck]" on one line */
@media (max-width: 40rem) { .deck-grid { grid-template-columns: minmax(0, 1fr); } }
/* The Decks page search: in the grey box like a page's own forms, with its picture on the right (hidden on phones) */
.deck-search { display: flex; align-items: center; gap: 1.5rem; margin: 0 0 1.5rem; padding: 1.25rem;
    background: var(--sunken); border-radius: var(--radius); }
.deck-search > form { flex: 1; margin: 0; }
.deck-search > img { flex: none; }
@media (max-width: 40rem) { .deck-search > img { display: none; } }
/* A form with a picture and a few words on its right (Create account): both in one grey box; the picture side goes on
   narrow screens */
.form-with-art { display: flex; align-items: flex-start; gap: 2.5rem; padding: 1.25rem; background: var(--sunken); border-radius: var(--radius); }
.form-with-art > form { flex: 1 1 24rem; max-width: 30rem; padding: 0; background: none; }
.form-art { display: block; flex: 0 1 560px; align-self: stretch; min-width: 0; margin: 0 0 0 auto; padding-left: 2.5rem; border-left: 1px solid var(--border); text-align: center; } /* a line between form and picture */
.form-art img { display: block; width: 100%; margin: 0 auto; }
.form-art h2 { margin: 1.5rem auto 0.5rem; font-size: 1.85rem; line-height: 1.2; text-align: center; text-wrap: balance; color: var(--heading); }
.form-art p { margin: 0 auto; max-width: 28rem; font-size: 1.1rem; text-align: center; color: var(--muted); }
@media (max-width: 52rem) { .form-art { display: none; } }

/* Accessibility (PLAN.md 12.8): text only screen readers hear, and the "Skip to content" link, hidden until it has focus */
.visually-hidden { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden;
    clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.skip-link { position: absolute; left: 0.75rem; top: -3rem; z-index: 10; padding: 0.5rem 0.9rem; border-radius: var(--radius);
    color: var(--accent-text); background: var(--accent); font-weight: 700; text-decoration: none; }
.skip-link:focus { top: 0.75rem; }
main:focus { outline: none; } /* focused only by the skip link, which moves on to it */
