/* The picnic surface, shared by every page: warm ground, square ink-edged controls with a shadow that has
   fallen rather than blurred, mustard for actions, tomato for marks, leaf for confirmation, and a checked
   cloth hem under the header (phonicspicnic docs/plan.md section 10; copied verbatim, edit there first). Interface text is Nunito; anything a child reads
   is Andika. Both are hosted here. */
@font-face { font-family: "Andika"; src: url("/assets/fonts/andika-latin-400-normal.woff2") format("woff2"); font-weight: 400; font-display: block; }
@font-face { font-family: "Andika"; src: url("/assets/fonts/andika-latin-700-normal.woff2") format("woff2"); font-weight: 700; font-display: block; }
@font-face { font-family: "Nunito"; src: url("/assets/fonts/nunito-variable.woff2") format("woff2"); font-weight: 200 1000; font-display: swap; }

:root {
  --canvas: #f8f1df;
  --paper: #fffdf5;
  --surface: #fff;
  --outline: var(--edge);
  --shadow: var(--edge);
  --paper-deep: #f5ecd7;
  --paper-hover: #fff6d5;
  --page-width: 1160px;
  --page-gutter: clamp(16px, 4vw, 40px);
  --control-size: 44px;
  --header-gap: 15px;
  --band-pink: #f2a7b8;
  --band-blue: #8fb8de;
  --band-green: #8fc49a;
  --edge: #17324d;
  --edge-lift: #24476b;
  --soft: #5d5744;          /* secondary text on the canvas, 6.4:1 */
  --mustard: #f4c84b;
  --mustard-deep: #c89521;
  --tomato: #c95848;
  --leaf: #287653;
  --rule: color-mix(in srgb, var(--edge) 26%, transparent);
  --check: color-mix(in srgb, var(--tomato) 24%, transparent);
  --pop: 3px 3px 0 var(--shadow);
  --ui: "Nunito", ui-rounded, system-ui, sans-serif;
  --read: "Andika", "Nunito", system-ui, sans-serif;
  /* Interface roles: reading letters and IPA keep their own geometry. */
  --weight-body: 400;
  --weight-label: 500;
  --weight-control: 600;
  --weight-heading: 700;
  --weight-brand: 800;
  --text-caption: .8125rem;
  --text-label: .875rem;
  --text-body: 1rem;
  --text-lead: 1.125rem;
  --text-card: 1.25rem;
  --text-section: 1.5rem;
  --text-title: clamp(2rem, 4vw, 2.75rem);
  --text-tool-title: clamp(1.75rem, 3.4vw, 2.25rem);
  --leading-body: 1.5;
  --leading-heading: 1.2;
  --tracking-heading: -.015em;
  --out: cubic-bezier(.16, 1, .3, 1);
  color-scheme: light;
  scrollbar-color: var(--edge) var(--paper-deep);
}

* { box-sizing: border-box; }
html { background: var(--canvas); }
body { margin: 0; min-height: 100dvh; background: var(--canvas); color: var(--edge); font: var(--weight-body) var(--text-body)/var(--leading-body) var(--ui); }
/* No ligatures anywhere: ff, fi, fl are two letters a child sounds out, never one shape (Andika joins ff). Important,
   as every font: shorthand below would set them back to normal. */
*, ::before, ::after { font-variant-ligatures: none !important; }
::selection { background: var(--mustard); color: var(--edge); }
:focus-visible { outline: 3px solid var(--edge); outline-offset: 3px; }
button, select { font: inherit; color: inherit; touch-action: manipulation; }
.hidden-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

/* Header: the name, then the page's own controls. The cloth hangs under it. */
.top { position: relative; margin-bottom: var(--header-gap); display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; padding: 10px var(--page-gutter); background: var(--paper); border-bottom: 2px solid var(--outline); }
.top::after { content: ""; position: absolute; left: 0; right: 0; top: 100%; height: 12px; margin-top: 2px;
  background-color: var(--paper);
  background-image: repeating-linear-gradient(90deg, var(--check) 0 6px, transparent 6px 12px), repeating-linear-gradient(0deg, var(--check) 0 6px, transparent 6px 12px);
  border-bottom: 1px solid var(--rule); }
.brand { display: inline-flex; align-items: center; gap: 8px; margin-right: 6px; font-weight: var(--weight-brand); font-size: var(--text-card); letter-spacing: -.01em; color: var(--edge); text-decoration: none; white-space: nowrap; }
.brand .logo { display: block; width: 30px; height: 30px; margin: -4px 0; }

/* Where this page is, from the front page down. Above the page's name, in small type. */
.crumbs { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 8px; margin: 0 0 6px; font-size: var(--text-label); font-weight: var(--weight-label); color: var(--soft); }
.crumbs a { color: var(--edge); text-decoration: none; text-underline-offset: 3px; }
.crumbs a:hover { text-decoration: underline; text-decoration-thickness: 2px; }
.crumbs .sep { font-weight: var(--weight-body); opacity: .7; }
.crumbs [aria-current] { color: var(--soft); }
.crumbs a { display: inline-flex; align-items: center; min-height: var(--control-size); }
.intro .crumbs { margin-bottom: 16px; }
.heading .way .crumbs { min-width: 0; margin: 0; }

/* Controls. A resting control is paper with an ink edge; the one that is on, or that acts, is mustard. */
.btn, .pick { min-height: var(--control-size); padding: 0 14px; background: var(--paper); border: 2px solid var(--outline); border-radius: 0; font-weight: var(--weight-control); cursor: pointer;
  transition: background-color .15s, box-shadow .15s var(--out), transform .15s var(--out); }
.btn:hover, .pick:hover { background-color: var(--paper-deep); }
.btn:active { transform: translate(2px, 2px); box-shadow: none; }
.btn[aria-pressed="true"] { background: var(--mustard); box-shadow: var(--pop); }
.pick { appearance: none; padding-right: 38px; max-width: 100%; text-overflow: ellipsis;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5l5 5 5-5' fill='none' stroke='%2317324d' stroke-width='2' stroke-linecap='square'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 13px center; background-size: 12px 8px; }
.seg { display: flex; margin: 0; padding: 0; border: 0; }
.seg .btn + .btn { margin-left: -2px; }
.seg .btn[aria-pressed="true"] { position: relative; z-index: 1; }

.acts { display: flex; flex-wrap: wrap; gap: 8px; }
.saved, [aria-pressed="true"] > .unsaved { display: none; }
[aria-pressed="true"] > .saved { display: inline; }

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


/* ---- The site's own header: the name, where to go, the search ----------------------------------------- */
.top.site { gap: 10px 22px; }
.menu { display: flex; flex-wrap: wrap; gap: 2px 4px; flex: 1 1 auto; }
.menu a { position: relative; padding: 8px 8px; color: var(--edge); font-weight: var(--weight-control); font-size: var(--text-body); text-decoration: none; white-space: nowrap; }
.menu a::after { content: ""; position: absolute; left: 8px; right: 8px; bottom: 3px; height: 3px; background: var(--mustard); transform: scaleX(0); transform-origin: left; transition: transform .2s var(--out); }
.menu a:hover::after, .menu a[aria-current="page"]::after { transform: none; }
.menu a[aria-current="page"] { color: var(--edge); }

/* The search button: a magnifier, the word, the key. */
.find { display: inline-flex; align-items: center; gap: 9px; margin-left: auto; }
.find svg { width: 18px; height: 18px; flex: none; }
.find kbd { padding: 1px 6px 2px; border: 1.5px solid var(--rule); font: var(--weight-label) var(--text-caption)/1.2 var(--ui); color: var(--soft); }

/* The search itself: a paper slip over the page. The slip's edge is the field's edge, so the field has none of its
   own: a glass, the words typed in Andika, and Esc. The list under it shows only once something is typed. */
.finder, .share { background: var(--paper); color: var(--edge); border: 2px solid var(--outline); box-shadow: 6px 6px 0 var(--shadow); }
.finder { width: min(560px, calc(100vw - 32px)); max-height: min(70vh, 640px); margin: 12vh auto 0; padding: 0; }
.finder::backdrop, .share::backdrop { background: color-mix(in srgb, var(--edge) 55%, transparent); }
.finder .ask { display: flex; align-items: center; gap: 12px; margin: 0; padding: 0 10px 0 18px; min-height: 64px; }
.finder .ask:has(+ .found:not(:empty)) { border-bottom: 2px solid var(--outline); }
.finder .ask svg { flex: none; width: 22px; height: 22px; color: var(--edge); }
.finder input { flex: 1; min-width: 0; height: 60px; padding: 0; background: none; border: 0; border-radius: 0; outline: none; font: 400 26px/1 var(--read); color: var(--edge); }
.finder input::placeholder { font: var(--weight-body) var(--text-body)/1 var(--ui); color: var(--soft); }
.finder input::-webkit-search-cancel-button { display: none; }
.finder .close, .share .close { display: grid; place-items: center; min-width: var(--control-size); min-height: var(--control-size); padding: 0; background: none; border: 0; cursor: pointer; }
.finder .close kbd, .share .close kbd { padding: 2px 7px 3px; border: 1.5px solid var(--rule); font: var(--weight-label) var(--text-caption)/1.2 var(--ui); color: var(--soft); }
.finder .close:hover kbd, .finder .close:focus-visible kbd, .share .close:hover kbd, .share .close:focus-visible kbd { border-color: var(--edge); color: var(--edge); }
.found:empty { display: none; }
.found { margin: 0; padding: 6px 0 8px; overflow-y: auto; max-height: calc(min(70vh, 640px) - 72px); }
.found ol, .found ul { margin: 0; padding: 0; list-style: none; }
.found li { margin: 0; }
.found h2 { margin: 10px 16px 4px; font: var(--weight-label) var(--text-caption)/1.3 var(--ui); color: var(--soft); }
.found h2 b { font: 400 1.15em/1 var(--read); color: var(--edge); }
/* The words found, side by side; the chosen one, whose places show under them, outlined. */
.found .words { display: flex; flex-wrap: wrap; gap: 6px; padding: 8px 16px 6px; }
.found .words a { display: flex; align-items: center; min-height: 40px; padding: 2px 11px 5px; border: 1.5px solid var(--rule); color: var(--edge); font: 400 22px/1.15 var(--read); text-decoration: none; }
.found .words a.chosen { border-color: var(--edge); box-shadow: 2px 2px 0 var(--shadow); }
.found ol a { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; padding: 8px 16px; color: var(--edge); font-weight: var(--weight-label); text-decoration: none; }
.found small { font: var(--weight-body) var(--text-caption)/1 var(--ui); color: var(--soft); white-space: nowrap; }
.found a:hover, .found a[aria-selected="true"] { background: var(--mustard); }
.found .none { margin: 0; padding: 8px 16px; font-weight: var(--weight-body); color: var(--soft); }
.found > .none { padding: 14px 16px; }
.finder:not([open]), .share:not([open]) { display: none; }

/* ---- Footer: the shared Picnic family layout, with a deep green ground ---------------------------- */
.foot { --footer-text: #cfdae0; --footer-soft: #aebfca; --footer-bright: #fffdf5; --footer-accent: #ffbc87;
  margin-top: 56px; background: #143b2e; color: var(--footer-text); font-size: var(--text-body); }
.foot .in { max-width: var(--page-width); margin: 0 auto; padding-inline: var(--page-gutter); }
.foot .in:first-child { display: grid; grid-template-columns: minmax(0, 1.5fr) repeat(3, minmax(0, 1fr)); align-items: start; gap: clamp(24px, 4vw, 48px); padding-block: 56px 36px; }
.foot a { color: var(--footer-text); text-decoration: none; }
.foot a:hover { color: var(--footer-bright); text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 4px; }
.foot a:focus-visible { outline-color: var(--footer-accent); }
.foot .brand { gap: 16px; margin: 0; color: var(--footer-bright); font-size: var(--text-card); font-weight: var(--weight-brand); letter-spacing: var(--tracking-heading); white-space: normal; }
.foot .brand .logo { width: 40px; height: 40px; margin: 0; flex: none; }
.foot .brand small { display: block; margin-top: 2px; color: var(--footer-soft); font-size: var(--text-label); font-weight: var(--weight-control); letter-spacing: normal; }
.foot .us .sister { max-width: 34ch; margin: 28px 0 0; color: var(--footer-soft); font-size: var(--text-label); line-height: 1.65; }
.foot .us .sister a { color: var(--footer-bright); font-weight: var(--weight-brand); text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 4px; }
.foot .us .sister a:hover { color: var(--footer-accent); }
.foot nav { display: flex; flex-direction: column; align-items: start; min-width: 0; }
.foot h2 { margin: 0 0 10px; color: var(--footer-accent); font-size: var(--text-caption); font-weight: var(--weight-brand); letter-spacing: .04em; text-transform: uppercase; }
.foot nav a { display: inline-flex; align-items: center; min-height: 36px; padding-block: 5px; font-size: var(--text-body); font-weight: var(--weight-label); }
.foot .small { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 24px; padding-block: 18px 36px; border-top: 1px solid rgb(174 191 202 / .3);
  font-size: var(--text-label); color: var(--footer-soft); }
.foot .small nav { flex-direction: row; flex-wrap: wrap; gap: 4px 22px; }
.foot .small nav a { min-height: 44px; font-size: var(--text-label); }

/* The header at three widths (Ken, 2026-10-15, after a phone screenshot with Puzzles alone on a line and
   US | UK on a line of its own). Measured: the name, seven links, the search, the shirt, US | UK and the basket
   need about 1135px in one row with the search a magnifier alone, 1245px with its word and key.
   Wide, 1140px and up: one row, the name, the menu, then the controls at the right; the search says "Search"
   and its key only from 1260px. Between, 701 to 1139px: two rows, the name with the controls at the right,
   and the menu on a row of its own, where the seven links stay on one line down to about 640px. A phone,
   700px and under: the name with the search, the shirt and the basket, then the links wrapping, with US | UK
   ending their last line (the menu's box is let go, so the links and the switch share lines; each link is
   its word with 5px either side, the 10px gap between them, so a line's first word sits over the name). */
@media (max-width: 1259px) {
  .top.site .find span, .top.site .find kbd { display: none; }
  .top.site .find { width: var(--control-size); padding: 0; justify-content: center; }
}
@media (max-width: 1139px) {
  .top.site { gap: 4px 14px; }
  .top.site > .menu { order: 9; flex: 1 1 100%; margin: 0 -8px; }
}
@media (max-width: 700px) {
  .top.site { gap: 4px 10px; }
  .top.site > .brand { order: 0; margin-right: auto; gap: 6px; font-size: var(--text-lead); }
  .top.site > .brand .logo { width: 26px; height: 26px; }
  .top.site > .find { order: 1; margin-left: 0; }
  .top.site > .appearance { order: 2; }
  .top.site > .basket-link { order: 3; }
  .top.site > .menu { display: contents; }
  .top.site > .menu a { order: 4; padding-inline: 5px; margin-inline: -5px; }
  .top.site > .menu a::after { left: 5px; right: 5px; }
  .top.site > .accent { order: 5; margin-left: auto; }
}
/* Between a phone and a wide screen the footer's name takes a row of its own above its three columns. */
@media (max-width: 900px) {
  .foot .in:first-child { grid-template-columns: repeat(3, 1fr); gap: 32px; }
  .foot .us { grid-column: 1 / -1; }
}
@media (max-width: 640px) {
  .finder { margin-top: 16px; }
  .foot .in:first-child { grid-template-columns: 1fr 1fr; gap: 28px 20px; padding-block: 36px 28px; }
  .foot .us { grid-column: 1 / -1; }
  .foot nav a { min-height: 40px; }
}

/* ---- US | UK in the header: the same page in the other accent (scripts/site.mjs, alternates) --------------- */
.accent { display: flex; border: 2px solid var(--outline); }
.accent a { display: grid; place-items: center; min-width: 40px; min-height: 40px; padding: 0 8px; font: var(--weight-control) var(--text-label)/1 var(--ui); letter-spacing: .03em; color: var(--edge); text-decoration: none; }
.accent a + a { border-left: 2px solid var(--outline); }
.accent a:hover { background: var(--paper-deep); }
.accent a[aria-current="true"] { background: var(--mustard); }
/* On a phone it ends the menu's last line, at the right (the header's widths, above). */

/* ---- The basket in the header: opens the picked words (the tray, below), with how many are in it ---------- */
.basket-link { position: relative; display: grid; place-items: center; min-width: var(--control-size); min-height: var(--control-size); padding: 0; background: none; border: 0; color: var(--edge); cursor: pointer; transition: transform .15s var(--out); }
.basket-link svg { width: 26px; height: 24px; }
.basket-link:hover { background: var(--paper-deep); }
.basket-link[aria-expanded="true"] { background: var(--mustard); }
.basket-link .n { position: absolute; top: 2px; right: 0; min-width: 18px; padding: 1px 5px; background: var(--tomato); color: #fff; font: var(--weight-control) 11px/16px var(--ui); text-align: center; font-variant-numeric: tabular-nums; }
.basket-link .n[hidden] { display: none; }
.basket-link.receiving { transform: scale(1.12); }
/* The +1 that flies from an Add button to the basket. */
.fly { position: fixed; z-index: 50; padding: 4px 9px; background: var(--mustard); border: 2px solid var(--outline); font: var(--weight-heading) var(--text-label)/1 var(--ui); color: var(--edge); pointer-events: none; opacity: 0; }

/* ---- The tray: the picked words, sliding in from the right (src/lists/tray.js). Not modal: the page stays in
   reach, so words can be tapped in while it is open. On a wide screen the page makes room; on a phone it rises
   from the bottom and takes the lower half. ------------------------------------------------------------------- */
:root { --tray-w: 340px; }
.tray { position: fixed; z-index: 40; top: 0; right: 0; bottom: 0; display: flex; flex-direction: column; gap: 12px; width: var(--tray-w); max-width: 100vw; padding: 16px 18px 18px; background: var(--paper); border-left: 2px solid var(--outline); box-shadow: -5px 0 0 color-mix(in srgb, var(--shadow) 12%, transparent); overflow-y: auto; transform: translateX(calc(100% + 8px)); visibility: hidden; transition: transform .28s var(--out), visibility 0s .28s; }
.picking .tray { transform: none; visibility: visible; transition: transform .28s var(--out); }
.tray.still { transition: none !important; }
.tray-head { display: flex; align-items: baseline; gap: 10px; }
.tray-head h2 { margin: 0; font-size: var(--text-card); font-weight: var(--weight-heading); letter-spacing: var(--tracking-heading); }
.tray-head .n { font-size: var(--text-label); font-weight: var(--weight-label); color: var(--soft); font-variant-numeric: tabular-nums; }
.tray-head .close { margin-left: auto; align-self: center; min-width: 40px; min-height: 40px; background: none; border: 2px solid transparent; font: var(--weight-body) 26px/1 var(--ui); color: var(--edge); cursor: pointer; }
.tray-head .close:hover { border-color: var(--edge); background: var(--paper-deep); }
.tray-hint p { margin: 0; font-size: var(--text-label); font-weight: var(--weight-label); color: var(--soft); }
.tray-hint .btn { margin-top: 8px; font-size: var(--text-label); }
.tray-page:empty { display: none; }
.tray-page .btn { display: inline-flex; align-items: center; gap: 8px; font-size: var(--text-label); }
.tray-page .btn svg { width: 18px; height: 16px; }
.tray-page .btn:disabled { opacity: .4; cursor: default; }
.tray-words { display: flex; flex-wrap: wrap; align-content: flex-start; gap: 6px; margin: 0; padding: 0; list-style: none; }
.tray-words li { display: inline-flex; align-items: center; background: var(--surface); border: 1px solid var(--rule); }
.tray-words span { padding: 4px 4px 4px 10px; font: 400 21px/1.15 var(--read); }
.tray-words button { min-width: 32px; min-height: 34px; padding: 0 6px; background: none; border: 0; font: var(--weight-body) 18px/1 var(--ui); color: var(--soft); cursor: pointer; }
.tray-words button:hover { color: var(--tomato); background: var(--paper-deep); }
.tray .none { margin: 0; font-weight: var(--weight-body); color: var(--soft); }
.tray .none[hidden] { display: none; }
.tray-done:empty { display: none; }
.tray-done { margin: 0; padding: 10px 12px; background: color-mix(in srgb, var(--leaf) 12%, var(--surface)); border: 1px solid var(--leaf); font-size: var(--text-label); font-weight: var(--weight-label); }
.tray-done a { color: var(--edge); }
.tray-foot { margin-top: auto; display: grid; gap: 8px; padding-top: 12px; border-top: 1px solid var(--rule); }
.tray-foot label { font-size: var(--text-caption); font-weight: var(--weight-control); color: var(--soft); }
.tray-foot input { min-height: var(--control-size); padding: 6px 10px; background: var(--surface); border: 2px solid var(--outline); border-radius: 0; font: 400 19px/1.3 var(--read); color: var(--edge); }
.tray-foot input::placeholder { font: var(--weight-body) var(--text-label)/1.3 var(--ui); color: var(--soft); opacity: .8; }
.tray-foot .go { display: flex; gap: 8px; }
.tray-foot .save { flex: 1; background: var(--mustard); box-shadow: var(--pop); }
.tray-foot .btn:disabled { opacity: .4; cursor: default; box-shadow: none; }
.tray-foot .mine { justify-self: end; font-size: var(--text-label); font-weight: var(--weight-control); color: var(--edge); }
@media (min-width: 1180px) { body.picking { padding-right: var(--tray-w); } }
@media (max-width: 640px) {
  .tray { top: auto; width: 100vw; height: 42dvh; gap: 8px; padding: 12px 16px 14px; border-left: 0; border-top: 2px solid var(--outline); box-shadow: 0 -5px 0 color-mix(in srgb, var(--shadow) 12%, transparent); transform: translateY(calc(100% + 8px)); }
  body.picking { padding-bottom: 42dvh; }
  .tray-head h2 { font-size: var(--text-lead); }
  .tray-foot { gap: 6px; padding-top: 8px; }
  .tray-foot label { display: none; }
  .tray-words span { font-size: 19px; }
}

/* The Practice menu on a words page: the button is the summary, the drills drop under it (src/practice/presets.js). */
.drills { position: relative; }
.drills[hidden] { display: none; }
.drills > summary { display: inline-flex; align-items: center; gap: 8px; list-style: none; }
.drills > summary::-webkit-details-marker { display: none; }
.drills[open] > summary { background: var(--mustard); box-shadow: var(--pop); }
.drills .menu { position: absolute; top: calc(100% + 6px); left: 0; z-index: 5; display: grid; min-width: 180px; padding: 6px 0; background: var(--paper); border: 2px solid var(--outline); box-shadow: var(--pop); }
.drills .menu a, .drills .menu .off { display: block; padding: 10px 16px; font-weight: var(--weight-control); color: var(--edge); text-decoration: none; white-space: nowrap; }
.drills .menu a:hover, .drills .menu a:focus-visible { background: var(--mustard); outline: none; }
.drills .menu .off { color: var(--soft); opacity: .5; }
.drills .menu .own { margin-top: 6px; padding-top: 12px; border-top: 1px solid var(--rule); }
