/* Fonts are stored locally in /vendor/fonts so the site works offline. Inter is a variable font: one file, every weight. */
@font-face { font-family: 'Inter'; font-weight: 100 900; font-display: swap;
  src: url('../vendor/fonts/inter-latin-wght-normal.woff2') format('woff2'); }
@font-face { font-family: 'JetBrains Mono'; font-weight: 400; font-display: swap;
  src: url('../vendor/fonts/jetbrains-mono-latin-400-normal.woff2') format('woff2'); }
@font-face { font-family: 'JetBrains Mono'; font-weight: 600; font-display: swap;
  src: url('../vendor/fonts/jetbrains-mono-latin-600-normal.woff2') format('woff2'); }

:root, [data-theme="dark"] {
  /* Night console palette: near-black with a soft cyan glow. Colour lives in glowing outlines, not solid blocks.
     Light mode (below) swaps these values. Variable names are kept from the first version so nothing else has to change. */
  --mist: #05080B;      /* page: near-black with a hint of blue */
  --paper: #0B1015;     /* panels and cards */
  --ink: #DCE4EA;       /* main text */
  --moss: #8D9AA6;      /* secondary text */
  --pine: #5EBFCC;      /* soft cyan: SQL keywords, links, headings */
  --marigold: #2A9FB0;  /* glow cyan: outlines, progress, marks */
  --focus: #7FD3DE;     /* keyboard focus ring */
  --rule: #18222C;      /* lines */
  --edge: #46636F;      /* outlines of buttons and inputs: soft, but still easy to see */
  --editor: #020406;    /* the query editor */
  --brick: #F28B8B;     /* errors */
  --glow: rgba(42, 159, 176, .30);
  --fill: rgba(42, 159, 176, .08);       /* the faint tint inside a glowing outline */
  --fill-strong: rgba(42, 159, 176, .16);
  --on-ink: #05080B;
  --on-pine: #05080B;
  --on-gold: #05080B;
  --th: #0D161D;                          /* table header row */
  --beige: #C9A96A;                       /* timber accent, Byte's colour */
  --sand: rgba(201, 169, 106, .14);
  --beige-ink: #E2C891;
  --top-bg: rgba(5, 8, 11, .85);          /* header bar, see-through */
  --bar-bg: rgba(5, 8, 11, .94);          /* the phone lab bar */
  --shadow: rgba(0, 0, 0, .45);
  --scrim: rgba(0, 0, 0, .6);             /* behind the phone tables panel */
  --halo: rgba(42, 159, 176, .06);        /* the soft glow at the top of the page */
  --grid: rgba(94, 191, 204, .02);        /* the faint background grid */
  --body: 'Inter', system-ui, 'Segoe UI', sans-serif;
  --code: 'JetBrains Mono', Consolas, monospace;
  color-scheme: dark;
}
/* Light mode: the same design, calmer. Glows become soft cyan shadows; code areas stay dark in both modes. */
[data-theme="light"] {
  /* White, blue and beige: blue leads, beige is the timber accent (Byte's colour). */
  --mist: #FFFFFF;
  --paper: #FFFFFF;
  --ink: #13283D;
  --moss: #506070;
  --pine: #0F6E8C;
  --marigold: #0F6E8C;
  --focus: #0F6E8C;
  --rule: #DCE5EB;
  --beige: #C9A96A;
  --sand: #F4EEE2;
  --beige-ink: #7A5B17;
  --edge: #8B9EAA;
  --editor: #0B1117;
  --brick: #B42318;
  --glow: rgba(15, 110, 140, .16);
  --fill: rgba(15, 110, 140, .06);
  --fill-strong: rgba(15, 110, 140, .12);
  --on-ink: #FFFFFF;
  --on-pine: #FFFFFF;
  --on-gold: #FFFFFF;
  --th: #F2F6F9;
  --top-bg: rgba(255, 255, 255, .88);
  --bar-bg: rgba(255, 255, 255, .96);
  --shadow: rgba(20, 33, 43, .12);
  --scrim: rgba(20, 33, 43, .35);
  --halo: rgba(201, 169, 106, .09);
  --grid: rgba(19, 40, 61, .035);
  color-scheme: light;
}
html:not([data-text]) { font-size: 93.75%; } /* standard text size: a touch smaller than the browser default */
html[data-text="large"] { font-size: 112.5%; }
html[data-text="larger"] { font-size: 125%; }

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; color: var(--ink); font-family: var(--body); font-size: .9375rem; line-height: 1.6;
  font-feature-settings: 'cv05', 'cv08'; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale;
  /* a faint grid and one soft glow at the top: the "console" feel, kept quiet so text stays easy to read */
  background-color: var(--mist);
  background-image:
    radial-gradient(70rem 32rem at 80% -12rem, var(--halo), transparent 70%),
    linear-gradient(var(--grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: auto, 32px 32px, 32px 32px; }
h1, h2, p, ul, ol, dl, dd { margin: 0; padding: 0; }
ul, ol { list-style: none; }
a { color: var(--pine); }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; box-shadow: 0 0 16px var(--glow); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: -999px; top: 0; background: var(--ink); color: var(--on-ink); padding: .5rem 1rem; z-index: 10; }
.skip:focus { left: 0; }

/* ---------- top bar ---------- */
.top { display: flex; flex-wrap: wrap; align-items: baseline; gap: .25rem 2rem; padding: 1rem clamp(1rem, 4vw, 3rem); border-bottom: 1px solid var(--rule); }
.brand { font-weight: 700; color: var(--ink); text-decoration: none; margin-right: auto; }
.top nav { display: flex; flex-wrap: wrap; gap: .25rem 1.25rem; }
.top nav a { color: var(--moss); text-decoration: none; padding: .25rem 0; border-bottom: 3px solid transparent; }
.top nav a:hover { color: var(--ink); }
.top nav a[aria-current="page"] { color: var(--ink); border-bottom-color: var(--marigold); box-shadow: 0 6px 12px -8px var(--glow); }

main { padding: clamp(1.5rem, 4vw, 3rem) clamp(1rem, 4vw, 3rem) 3rem; max-width: 78rem; margin: 0 auto; outline: none; }
h1 { font-size: clamp(1.6rem, 4vw, 2.4rem); line-height: 1.15; letter-spacing: -0.025em; font-weight: 700; max-width: 24ch; }
.lede { margin-top: .9rem; max-width: 62ch; color: var(--moss); font-size: 1.0625rem; }

/* ---------- buttons ---------- */
.btn { font: inherit; font-weight: 700; display: inline-block; padding: .6rem 1.1rem; border-radius: 6px; border: 2px solid var(--edge); background: transparent; color: var(--ink); cursor: pointer; text-decoration: none; }
.btn:hover { background: var(--fill); border-color: var(--marigold); color: var(--ink); }
.btn.primary { background: var(--fill); border-color: var(--marigold); color: var(--pine); box-shadow: 0 0 14px var(--glow), inset 0 0 12px var(--fill); }
.btn.primary:hover { background: var(--fill-strong); border-color: var(--pine); color: var(--ink); box-shadow: 0 0 22px var(--glow), inset 0 0 14px var(--fill); }
.link { font: inherit; background: none; border: 0; padding: 0; color: var(--moss); text-decoration: underline; cursor: pointer; }
.actions { display: flex; flex-wrap: wrap; align-items: center; gap: .6rem .75rem; margin-top: 1rem; }
.keys { color: var(--moss); font-size: .9rem; }
.badge { display: inline-block; vertical-align: middle; font-size: .8rem; font-weight: 700; letter-spacing: 0; background: var(--fill); color: var(--pine); box-shadow: inset 0 0 0 1px var(--marigold); padding: .1rem .5rem; border-radius: 3px; }

/* ---------- path (home): the topics laid out as one query ---------- */
.intro-actions { display: flex; flex-wrap: wrap; align-items: center; gap: .75rem 1.25rem; margin-top: 1.5rem; }
.count, .all-done { color: var(--moss); }
.all-done { font-weight: 700; color: var(--ink); }

.path { margin-top: 2.5rem; border-top: 1px solid var(--rule); }
.path-row { display: grid; grid-template-columns: minmax(9.5rem, 15rem) 1fr; gap: 0 2rem; padding: 1.25rem 0; border-bottom: 1px solid var(--rule); align-items: start; }
.clause { font-family: var(--code); font-weight: 600; font-size: clamp(1.2rem, 2.6vw, 1.9rem); line-height: 1.2; color: var(--pine); }
.path-row.complete .clause { box-shadow: inset 0 -0.45em 0 var(--marigold); display: inline-block; justify-self: start; }
.path-body h2, .path-body h3 { font-size: 1.125rem; display: flex; flex-wrap: wrap; gap: .25rem 1rem; align-items: baseline; }
.tally { font-weight: 400; color: var(--moss); font-size: .95rem; }
.ex-list { display: flex; flex-wrap: wrap; gap: .4rem 1.5rem; margin-top: .5rem; }
.ex-list a { display: inline-flex; align-items: center; gap: .5rem; color: var(--ink); text-decoration: none; padding: .2rem 0; }
.ex-list a:hover { text-decoration: underline; }
.mark { width: .8rem; height: .8rem; border: 2px solid var(--moss); border-radius: 50%; flex: none; }
.ex-list a.done .mark { background: var(--fill-strong); border-color: var(--marigold); }


/* ---------- SQL lab ---------- */
.lab { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: 2.5rem; align-items: start; }
.crumb { color: var(--moss); font-size: .95rem; margin-bottom: .6rem; }
.kw { font-family: var(--code); font-weight: 600; color: var(--pine); }
.task h1 { font-size: clamp(1.5rem, 3.4vw, 2.1rem); }
.prompt { margin-top: .9rem; font-size: 1.0625rem; max-width: 56ch; }
.hint, .model { margin-top: 1rem; }
summary { cursor: pointer; font-weight: 700; color: var(--pine); }
.hint p { margin-top: .4rem; max-width: 52ch; }
.tables { margin-top: 1.5rem; }
.schema { margin-top: .6rem; border-top: 1px solid var(--rule); }
.schema li { padding: .5rem 0; border-bottom: 1px solid var(--rule); }
.tbl { font-family: var(--code); font-weight: 600; font-size: .95rem; color: var(--pine); background: none; border: 0; padding: 0; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
.cols { display: block; font-family: var(--code); font-size: .82rem; color: var(--moss); overflow-wrap: anywhere; margin-top: .15rem; }
.schema-note { font-size: .9rem; color: var(--moss); margin-top: .5rem; }

.CodeMirror { font-family: var(--code); font-size: .9rem; line-height: 1.6; height: auto; min-height: 11rem; background: var(--editor); color: #ECEDE8; border-radius: 8px; padding: .5rem 0; }
.CodeMirror-scroll { min-height: 11rem; }
.CodeMirror-gutters { background: var(--editor); border-right: 1px solid #1C2833; }
.CodeMirror-linenumber { color: #8A8F95; }
.CodeMirror-cursor { border-left: 2px solid #E0B84A; }
.CodeMirror-selected, .CodeMirror-focused .CodeMirror-selected { background: #3A3E44; }
.cm-s-default .cm-keyword { color: #E0B84A; font-weight: 600; }
.cm-s-default .cm-string { color: #B9D3A8; }
.cm-s-default .cm-number { color: #F3C9A0; }
.cm-s-default .cm-comment { color: #9AA0A6; }
.cm-s-default .cm-builtin, .cm-s-default .cm-atom, .cm-s-default .cm-variable-2, .cm-s-default .cm-operator, .cm-s-default .cm-punctuation, .cm-s-default .cm-bracket { color: #ECEDE8; }
.CodeMirror-focused { outline: 3px solid var(--focus); outline-offset: 2px; }

.feedback { margin-top: 1rem; padding: .7rem .9rem; border-left: 5px solid var(--moss); background: var(--paper); border-radius: 0 6px 6px 0; max-width: 70ch; }
.feedback.good { border-left-color: var(--marigold); font-weight: 700; box-shadow: -6px 0 18px -10px var(--glow); }
.feedback.bad { border-left-color: var(--brick); color: var(--brick); }
#result { margin-top: 1rem; }
.empty { color: var(--moss); }
.table-wrap { overflow: auto; max-height: 24rem; background: var(--paper); border: 1px solid var(--rule); border-radius: 8px; }
table { border-collapse: collapse; width: 100%; font-family: var(--code); font-size: .85rem; }
th, td { text-align: left; padding: .4rem .75rem; border-bottom: 1px solid var(--rule); white-space: nowrap; }
th { position: sticky; top: 0; background: var(--th); color: var(--pine); font-weight: 600; border-bottom: 1px solid var(--marigold); }
tbody tr:last-child td { border-bottom: 0; }
td.null { color: var(--moss); font-style: italic; }
.row-note { font-size: .9rem; color: var(--moss); margin-top: .4rem; }
.model pre { font-family: var(--code); font-size: .9rem; background: var(--paper); border: 1px solid var(--rule); border-radius: 8px; padding: .9rem 1rem; overflow: auto; margin: .6rem 0; }
.model p { max-width: 60ch; }
.pager { display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-top: 2rem; padding-top: 1rem; border-top: 1px solid var(--rule); }

/* ---------- clause order ---------- */
.order-strip { display: flex; flex-wrap: wrap; gap: .35rem; margin-top: 1.25rem; }
.order-strip span { font-family: var(--code); font-weight: 600; font-size: .85rem; color: var(--pine); background: var(--paper); border: 1px solid var(--rule); padding: .2rem .55rem; border-radius: 4px; }
.order-strip span:not(:last-child)::after { content: '>'; color: var(--moss); margin-left: .6rem; font-weight: 400; }
.drill-count { margin-top: 2rem; color: var(--moss); }
.goal { font-size: 1.3rem; margin-top: .25rem; max-width: 40ch; }
.slots { margin-top: 1rem; background: var(--editor); border-radius: 8px; padding: .9rem; min-height: 7rem; display: flex; flex-direction: column; align-items: flex-start; gap: .4rem; }
.slots .empty { color: #A9ADA4; }
.pool { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: 1rem; min-height: 2.75rem; }
.chip { font-family: var(--code); font-size: .88rem; text-align: left; background: var(--paper); color: var(--ink); border: 2px solid var(--edge); border-radius: 6px; padding: .45rem .7rem; cursor: pointer; overflow-wrap: anywhere; }
.chip:hover { background: var(--fill); border-color: var(--marigold); color: var(--ink); }
.chip.placed { background: transparent; color: #ECEDE8; border-color: #4A4F55; }
.chip.placed:hover { background: #3A3E44; }
.chip .n { color: #E0B84A; margin-right: .7rem; }

/* ---------- glossary ---------- */
.g-controls { display: flex; flex-wrap: wrap; gap: .75rem 1rem; align-items: center; margin-top: 1.5rem; }
#g-search { font: inherit; padding: .55rem .8rem; border: 2px solid var(--edge); border-radius: 6px; background: var(--paper); color: var(--ink); min-width: min(100%, 16rem); }
.g-groups { display: flex; flex-wrap: wrap; gap: .4rem; }
.pill { font: inherit; padding: .35rem .8rem; border-radius: 999px; border: 1px solid var(--moss); background: transparent; color: var(--ink); cursor: pointer; }
.pill.on { background: var(--fill); border-color: var(--marigold); color: var(--ink); box-shadow: 0 0 10px var(--glow); }
.terms { margin-top: 1.5rem; border-top: 1px solid var(--rule); }
.term { padding: 1.1rem 0; border-bottom: 1px solid var(--rule); max-width: 70ch; }
.term dt { font-weight: 700; font-size: 1.2rem; display: flex; flex-wrap: wrap; gap: .25rem 1rem; align-items: baseline; }
.area { font-weight: 400; font-size: .9rem; color: var(--moss); }
.term dd { margin-top: .3rem; }
.say { background: var(--paper); border-left: 5px solid var(--marigold); padding: .55rem .8rem; border-radius: 0 6px 6px 0; margin-top: .6rem; }
.say-label { font-weight: 700; }
.card { margin-top: 1.5rem; background: var(--paper); border: 1px solid var(--rule); border-radius: 10px; padding: clamp(1.25rem, 4vw, 2.25rem); max-width: 44rem; }
.card h2 { font-size: clamp(1.5rem, 4vw, 2.2rem); line-height: 1.15; margin: .4rem 0 .8rem; }
.card-count, .card-ask { color: var(--moss); }
.card .say { background: var(--mist); }

/* ---------- footer ---------- */
.foot { padding: 1.5rem clamp(1rem, 4vw, 3rem) 2.5rem; border-top: 1px solid var(--rule); color: var(--moss); font-size: .9rem; display: flex; flex-wrap: wrap; gap: .5rem 2rem; justify-content: space-between; max-width: 78rem; margin: 0 auto; }

@media (max-width: 860px) {
  .lab { grid-template-columns: 1fr; gap: 1.75rem; }
  .path-row { grid-template-columns: 1fr; gap: .5rem; }
}
@media (prefers-reduced-motion: no-preference) {
  .btn, .chip { transition: background-color .12s ease, border-color .12s ease, color .12s ease; }
}

/* ---------- theme toggle and nav count ---------- */
.theme-toggle { font: inherit; font-size: .9rem; background: none; color: var(--moss); border: 1px solid var(--rule); border-radius: 999px; padding: .25rem .85rem; cursor: pointer; }
.theme-toggle:hover { color: var(--ink); border-color: var(--ink); }
.nav-count { display: inline-block; min-width: 1.25rem; padding: 0 .35rem; margin-left: .25rem; border-radius: 999px; background: var(--marigold); color: var(--on-gold); font-size: .8rem; font-weight: 700; text-align: center; line-height: 1.35; }
.btn.quiet { border-color: var(--rule); color: var(--moss); }
.btn.quiet:hover { background: var(--fill); border-color: var(--marigold); color: var(--ink); }
.btn:disabled { opacity: .5; cursor: default; }
.btn:disabled:hover { background: transparent; color: var(--ink); }
.btn.primary:disabled:hover { background: var(--fill); color: var(--pine); }

/* ---------- home: today and due markers ---------- */
.due { margin-left: .5rem; font-size: .8rem; font-weight: 700; background: var(--marigold); color: var(--on-gold); padding: 0 .45rem; border-radius: 3px; }

/* ---------- smarter feedback ---------- */
.tips { margin-top: .9rem; background: var(--paper); border: 1px solid var(--rule); border-left: 5px solid var(--marigold); border-radius: 0 8px 8px 0; padding: .75rem 1rem; max-width: 70ch; }
.tips h2 { font-size: 1rem; }
.tips ul { margin-top: .3rem; list-style: disc; padding-left: 1.2rem; }
.tips li { padding: .15rem 0; }
.compare { margin-top: 1rem; }
.compare h2 { font-size: 1rem; }
.compare h3 { font-size: .95rem; margin: .6rem 0 .3rem; }
.cmp-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }
.compare .table-wrap { max-height: 14rem; }

/* ---------- explain it out loud ---------- */
.aloud { margin-top: 1.75rem; padding: 1.1rem 1.25rem 1.25rem; background: var(--paper); border: 1px solid var(--rule); border-radius: 10px; max-width: 46rem; }
.aloud[hidden] { display: none; }
.aloud h2 { font-size: 1.2rem; }
.aloud > p { margin-top: .35rem; }
.frame { list-style: decimal; padding-left: 1.4rem; margin-top: .6rem; }
.frame li { padding: .15rem 0; }
.timer { display: flex; flex-wrap: wrap; align-items: center; gap: .6rem 1rem; margin-top: 1rem; }
.clock { font-family: var(--code); font-weight: 600; font-size: 1.6rem; min-width: 4.5rem; }
.model-say { list-style: decimal; padding-left: 1.4rem; margin-top: .9rem; }
.model-say li { padding: .2rem 0; max-width: 62ch; }
.model-say[hidden], #after:empty { display: none; }
.marked { font-weight: 700; color: var(--pine); }

/* ---------- review, quiz and plain lists ---------- */
.review h1, .dialects h1 { max-width: none; }
.review-block { margin-top: 2.25rem; max-width: 44rem; }
.review-block h2 { font-size: 1.2rem; margin-bottom: .4rem; }
.review-block h3 { font-size: 1rem; margin-top: 1.25rem; }
.review-block p { margin-top: .5rem; }
.plain { border-top: 1px solid var(--rule); margin-bottom: .75rem; }
.plain li { display: flex; flex-wrap: wrap; justify-content: space-between; gap: .1rem 1rem; padding: .55rem 0; border-bottom: 1px solid var(--rule); }
.meta { color: var(--moss); font-size: .95rem; }
.bar { width: 100%; max-width: 22rem; height: .6rem; margin-bottom: .9rem; accent-color: var(--pine); }
.results { max-width: 40rem; margin-top: 1.5rem; }

/* ---------- dialects ---------- */
.tabs { display: flex; gap: 1.5rem; margin-top: 1.25rem; border-bottom: 1px solid var(--rule); }
.tabs a { color: var(--moss); text-decoration: none; padding: .35rem 0; border-bottom: 3px solid transparent; margin-bottom: -1px; }
.tabs a[aria-current="page"] { color: var(--ink); border-bottom-color: var(--marigold); font-weight: 700; }
.dialects .g-groups { margin-top: 1.25rem; }
.dgroup { font-size: 1.15rem; margin-top: 2.25rem; }
.dcard h4 { margin-top: 0; }
.dcard { margin-top: 1rem; background: var(--paper); border: 1px solid var(--rule); border-radius: 8px; padding: 1rem 1.1rem 1.1rem; }
.dcard h3 { font-size: 1.05rem; margin: 0; }
.dgrid { display: grid; gap: .75rem; margin-top: .7rem; grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr)); }
.dgrid.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.dgrid.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.dgrid.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.dgrid.cols-1 { grid-template-columns: minmax(0, 1fr); }
.dcol h4 { font-size: .85rem; color: var(--moss); margin: 0 0 .25rem; font-weight: 700; }
.dcol pre, .tried, .q-code { font-family: var(--code); font-size: .82rem; line-height: 1.5; margin: 0; padding: .6rem .7rem; background: var(--editor); color: #ECEDE8; border-radius: 6px; white-space: pre-wrap; overflow-wrap: anywhere; }
.dnote { margin-top: .7rem; max-width: 70ch; color: var(--moss); }
.try-out { margin-top: .6rem; }
.try-out .tried { margin-bottom: .5rem; }
.q-code { margin-top: .75rem; font-size: .95rem; max-width: 46rem; }
.opts { display: grid; gap: .6rem; margin-top: 1rem; max-width: 46rem; }
.opt { font: inherit; text-align: left; background: var(--paper); color: var(--ink); border: 2px solid var(--edge); border-radius: 6px; padding: .6rem .8rem; cursor: pointer; }
.opt code { font-family: var(--code); font-size: .88rem; white-space: pre-wrap; overflow-wrap: anywhere; }
.opt:hover:not(:disabled) { background: var(--fill); border-color: var(--marigold); color: var(--ink); }
.opt.right { border-color: var(--pine); box-shadow: inset 6px 0 0 var(--marigold); }
.opt.wrong { border-color: var(--rule); color: var(--moss); text-decoration: line-through; }
#after { margin-top: 1rem; }

@media (max-width: 860px) {
  .dgrid.cols-4, .dgrid.cols-3, .dgrid.cols-2 { grid-template-columns: minmax(0, 1fr); }
  .cmp-grid { grid-template-columns: minmax(0, 1fr); }
  .top { gap: .5rem 1.25rem; }
}

/* ---------- start screen and routes ---------- */
.start { max-width: 56rem; }
.route-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr)); gap: 1rem; margin-top: 1.75rem; }
.route-card { font: inherit; text-align: left; display: flex; flex-direction: column; gap: .35rem; background: var(--paper); color: var(--ink); border: 2px solid var(--rule); border-radius: 8px; padding: 1.1rem 1.25rem; cursor: pointer; }
.route-card:hover { border-color: var(--marigold); box-shadow: 0 0 12px var(--glow); }
.route-card.on { border-color: var(--pine); box-shadow: inset 6px 0 0 var(--marigold); }
.rc-name { font-size: 1.2rem; font-weight: 700; color: var(--pine); }
.rc-blurb { color: var(--moss); }
.start-skip { margin-top: 1.5rem; }
.start-skip a { color: var(--moss); }
.route-bar { color: var(--moss); margin-bottom: 1.25rem; }
.route-bar strong { color: var(--ink); }
.route-bar a { margin-left: .5rem; color: var(--pine); }
.route-note { margin-top: 1rem; max-width: 60ch; color: var(--moss); border-left: 3px solid var(--rule); padding-left: .75rem; }
.route-steps { margin-top: 2rem; max-width: 46rem; }
.route-steps h2 { font-size: 1.25rem; }
.route-steps ol { list-style: decimal; margin: .6rem 0 0 1.4rem; padding: 0; }
.route-steps li { padding: .2rem 0 .2rem .25rem; }
.route-steps li::marker { color: var(--pine); font-weight: 700; }
.route-steps a { display: block; text-decoration: none; color: var(--ink); padding: .45rem .6rem; border-radius: 6px; }
.route-steps a:hover { background: var(--paper); }
.st-label { display: block; font-weight: 700; color: var(--pine); }
.st-text { display: block; color: var(--moss); }
.start h1:focus { outline: none; }
h1[tabindex="-1"]:focus, main[tabindex="-1"]:focus { outline: none; box-shadow: none; }
.section-h { font-size: 1.35rem; margin-top: 2.5rem; }
.route-path .path { margin-top: .5rem; }

.more-topics { margin-top: 1.5rem; }
.more-topics summary { cursor: pointer; font-weight: 700; color: var(--pine); padding: .4rem 0; }
.queue { max-width: 46rem; }
.queue .section-h { margin-top: 2rem; }
.queue p { margin-top: .4rem; color: var(--moss); }
.foot .credits { margin-top: .25rem; }
.foot-actions { display: flex; flex-wrap: wrap; gap: .25rem 1.25rem; margin-top: .5rem; }
.progress-msg { margin-top: .4rem; min-height: 1.2em; color: var(--pine); }
.foot { display: block; }

/* ---------- The Joinery: brand mark ---------- */
.brand { display: inline-flex; align-items: center; gap: .55rem; font-size: 1.15rem; letter-spacing: -0.01em; }
.top { align-items: center; }
.mark-logo { flex: none; }
.mark-logo .m-tail { fill: var(--marigold); }
.mark-logo .m-board { fill: var(--ink); }
.mark-logo .m-tail { stroke: var(--mist); stroke-width: 1.8; stroke-linejoin: round; paint-order: stroke; }
.welcome { color: var(--pine); font-weight: 700; margin-bottom: .6rem; }

/* ---------- route map: checkpoints ---------- */
.route-steps { max-width: none; }
.map-sum { color: var(--moss); margin-top: .25rem; }
.map { display: grid; grid-template-columns: repeat(var(--n, 4), minmax(0, 1fr)); gap: 1rem; margin-top: 1rem; padding: 0; list-style: none; counter-reset: none; }
.route-steps .map { margin-left: 0; list-style: none; }
.cp { position: relative; padding: 0; }
.cp:not(:last-child)::after { content: ''; position: absolute; top: 1.05rem; left: 2.6rem; right: -1rem; height: 3px; background: var(--rule); }
.cp.done:not(:last-child)::after { background: var(--marigold); }
.route-steps .cp a { display: flex; flex-direction: column; gap: .2rem; padding: 0 .25rem .5rem 0; border-radius: 6px; background: none; }
.route-steps .cp a:hover .st-label { text-decoration: underline; }
.cp-dot { width: 2.2rem; height: 2.2rem; border-radius: 50%; display: grid; place-items: center; font-weight: 700; border: 3px solid var(--rule); background: var(--paper); color: var(--moss); position: relative; z-index: 1; margin-bottom: .35rem; }
.cp.done .cp-dot { background: var(--fill-strong); border-color: var(--marigold); color: var(--pine); box-shadow: 0 0 12px var(--glow); }
.cp.here .cp-dot { border-color: var(--ink); color: var(--ink); background: var(--paper); box-shadow: 0 0 0 4px var(--mist), 0 0 0 6px var(--marigold), 0 0 22px var(--glow); }
.cp-state { font-size: .85rem; color: var(--moss); }
.cp.here .cp-state { color: var(--ink); font-weight: 700; }
.cp.ahead .st-label { color: var(--moss); }

/* ---------- lab: panes ---------- */
.tables-btn { display: none; }
.work { min-width: 0; }
.pane-result > :first-child { margin-top: 1rem; }
.schema-diagram { margin: .75rem 0 0; }
.schema-diagram svg { width: 100%; height: auto; display: block; }
.schema-diagram figcaption { font-size: .9rem; color: var(--moss); margin-top: .25rem; }
.sd-box rect { fill: var(--paper); stroke: var(--moss); stroke-width: 1.5; }
.sd-name { font-family: var(--code); font-weight: 600; font-size: 14px; fill: var(--pine); }
.sd-key { font-family: var(--code); font-size: 12px; fill: var(--moss); }
.sd-line { stroke: var(--moss); stroke-width: 2; }
.sd-label { font-family: var(--code); font-size: 11px; fill: var(--moss); }

/* ---------- speaking frames ---------- */
.starter { display: block; color: var(--pine); font-style: italic; margin-top: .1rem; }
.starter-tip { margin-top: .6rem; color: var(--moss); font-size: .95rem; }

/* ---------- clause order diagram ---------- */
.clause-diagram { display: grid; grid-template-columns: repeat(2, minmax(0, 15rem)); gap: .5rem 2.5rem; margin-top: 1.25rem; }
.cd-h { font-size: 1rem; margin-bottom: .4rem; }
.cd-list { counter-reset: cd; border-top: 1px solid var(--rule); }
.cd-list li { counter-increment: cd; display: flex; align-items: baseline; gap: .75rem; font-family: var(--code); font-weight: 600; font-size: .92rem; color: var(--pine); padding: .3rem 0; border-bottom: 1px solid var(--rule); }
.cd-n::before { content: counter(cd); display: inline-block; min-width: 1.2rem; font-family: var(--body); font-weight: 400; color: var(--moss); }
.cd-list li.cd-select { background: var(--paper); box-shadow: inset 5px 0 0 var(--marigold); padding-left: .6rem; color: var(--ink); }
.cd-note { grid-column: 1 / -1; max-width: 60ch; color: var(--moss); margin-top: .5rem; }

/* ---------- settings ---------- */
.settings { max-width: 46rem; }
.settings fieldset { border: 1px solid var(--rule); border-radius: 8px; background: var(--paper); padding: .9rem 1.1rem 1rem; margin: 1.25rem 0 0; }
.settings legend { font-weight: 700; padding: 0 .35rem; }
.hint-text { color: var(--moss); font-size: .95rem; margin-bottom: .4rem; }
.choice { display: inline-flex; align-items: center; gap: .4rem; margin: .3rem 1.5rem .3rem 0; cursor: pointer; }
.choice input { width: 1.1rem; height: 1.1rem; accent-color: var(--ink); }
.shortcuts { display: grid; grid-template-columns: max-content 1fr; gap: .5rem 1.25rem; margin-top: .75rem; }
.shortcuts dt { font-weight: 700; }
kbd { font-family: var(--code); font-size: .85em; background: var(--paper); border: 1px solid var(--rule); border-bottom-width: 2px; border-radius: 4px; padding: 0 .35rem; }

@media (max-width: 860px) {
  .map { grid-template-columns: minmax(0, 1fr); gap: .25rem; }
  .cp:not(:last-child)::after { top: 2.4rem; bottom: -.4rem; left: 1.05rem; right: auto; width: 3px; height: auto; }
  .route-steps .cp a { display: grid; grid-template-columns: 2.2rem 1fr; column-gap: .9rem; padding-bottom: .9rem; }
  .cp-dot { grid-row: 1 / span 3; margin: 0; }
  .lab { gap: 1rem; }
  .clause-diagram { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .5rem 1rem; }
  .shortcuts { grid-template-columns: minmax(0, 1fr); gap: .1rem; }
  .shortcuts dd { margin-bottom: .6rem; }
}

/* ---------- glossary: index, business questions and term pages ---------- */
.glossary h1 { max-width: none; }
.g-controls { justify-content: space-between; }
#g-search { flex: 1 1 18rem; max-width: 30rem; }
.g-modes { display: inline-flex; border: 2px solid var(--edge); border-radius: 6px; overflow: hidden; }
.seg { font: inherit; font-weight: 700; background: transparent; color: var(--ink); border: 0; padding: .5rem .9rem; cursor: pointer; }
.seg + .seg { border-left: 2px solid var(--edge); }
.seg.on { background: var(--fill); color: var(--pine); box-shadow: inset 0 0 0 1px var(--marigold), 0 0 10px var(--glow); }
.seg-n, .pill-n { font-weight: 400; opacity: 1; font-size: .85em; }
.seg:not(.on) .seg-n, .pill:not(.on) .pill-n { color: var(--moss); }
.glossary > .g-groups { margin-top: 1rem; }
.g-count { margin-top: .75rem; color: var(--moss); min-height: 1.2em; }
.g-area { margin-top: 2rem; }
.g-area-head { display: flex; align-items: baseline; gap: 1rem; border-bottom: 2px solid var(--edge); padding-bottom: .35rem; }
.g-area-head h2 { font-size: 1.35rem; }
.g-blurb { color: var(--moss); margin-top: .4rem; }
.g-index { display: grid; grid-template-columns: repeat(auto-fill, minmax(17rem, 1fr)); gap: 0 2rem; margin-top: .5rem; }
.g-index .term { padding: 0; border-bottom: 1px solid var(--rule); max-width: none; }
.g-index a { display: block; padding: .65rem .25rem; text-decoration: none; color: var(--ink); border-radius: 4px; }
.g-index a:hover { background: var(--paper); }
.g-index a:hover .g-term { text-decoration: underline; }
.g-term { display: block; font-weight: 700; color: var(--pine); }
.g-def { display: block; color: var(--moss); font-size: .95rem; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.bq-list { margin-top: .4rem; }
.bq-list li { display: flex; flex-wrap: wrap; justify-content: space-between; gap: .2rem 1.5rem; padding: .6rem 0; border-bottom: 1px solid var(--rule); }
.bq-q { max-width: 60ch; }
.bq-t { font-weight: 700; white-space: nowrap; }
.card-more { margin-top: .75rem; }

.term-page h1 { max-width: 28ch; }
.t-def { font-size: 1.2rem; color: var(--ink); max-width: 62ch; }
.t-grid { display: grid; grid-template-columns: minmax(0, 7fr) minmax(0, 4fr); gap: 2.5rem; margin-top: 2rem; align-items: start; }
.t-sec + .t-sec { margin-top: 1.75rem; }
.t-sec h2, .t-box h2 { font-size: 1.1rem; margin-bottom: .45rem; }
.t-sec p { max-width: 64ch; }
.t-code { font-family: var(--code); font-size: .88rem; line-height: 1.55; background: var(--editor); color: #ECEDE8; border-radius: 8px; padding: .9rem 1rem; overflow: auto; white-space: pre; margin: 0; }
.t-ex { background: var(--paper); border: 1px solid var(--rule); border-radius: 8px; padding: .8rem 1rem; font-family: var(--code); font-size: .9rem; }
.t-list { list-style: disc; padding-left: 1.2rem; }
.t-list li { padding: .2rem 0; max-width: 62ch; }
.t-side { display: grid; gap: 1rem; }
.t-box { background: var(--paper); border: 1px solid var(--rule); border-radius: 8px; padding: 1rem 1.1rem; }
.t-say { border-left: 5px solid var(--marigold); border-radius: 0 8px 8px 0; }
.t-rel { display: flex; flex-wrap: wrap; gap: .45rem; }
.t-rel a { text-decoration: none; color: var(--ink); border: 1px solid var(--moss); border-radius: 999px; padding: .2rem .7rem; font-size: .95rem; }
.t-rel a:hover { background: var(--fill); color: var(--ink); border-color: var(--marigold); }

@media (max-width: 860px) {
  .t-grid { grid-template-columns: minmax(0, 1fr); gap: 1.75rem; }
  .g-modes { width: 100%; }
  .seg { flex: 1; padding: .5rem .4rem; }
  #g-search { max-width: none; }
}

/* ---------- Byte the beetle ---------- */
.byte { position: fixed; right: clamp(.75rem, 2vw, 1.5rem); bottom: clamp(.75rem, 2vw, 1.5rem); z-index: 20; display: flex; align-items: flex-end; gap: .5rem; max-width: min(24rem, calc(100vw - 1.5rem)); color: #25282C; pointer-events: none; }
.byte[hidden] { display: none; }
.byte > * { pointer-events: auto; }
.byte-svg { flex: none; order: 2; overflow: visible; }
.byte-svg .b-shell { fill: #B8912A; }
.byte-svg .b-line { stroke: #25282C; }
.byte-svg .b-grid { stroke: #8A6A12; fill: none; }
.byte-svg .b-head { fill: #25282C; }
.byte-svg .b-tip { fill: #B8912A; }
.byte-svg .b-white { fill: #ECEDE8; }
.byte-svg .b-eyes circle { fill: #25282C; }
.byte-svg .b-mouth { stroke: #ECEDE8; stroke-width: 3; fill: none; stroke-linecap: round; }
.byte-svg .b-grin { fill: #ECEDE8; }
.byte-svg .b-lens { fill: rgba(236, 237, 232, .45); stroke: currentColor; stroke-width: 4; }
.byte-svg .b-spark { fill: #B8912A; }
[data-theme="dark"] .byte { color: #ECEDE8; }
[data-theme="dark"] .byte-svg .b-head, [data-theme="dark"] .byte-svg .b-line { fill: #ECEDE8; stroke: #ECEDE8; }
[data-theme="dark"] .byte-svg .b-head { stroke: none; }
[data-theme="dark"] .byte-svg .b-white { fill: #05080B; }
[data-theme="dark"] .byte-svg .b-eyes circle { fill: #ECEDE8; }
[data-theme="dark"] .byte-svg .b-mouth { stroke: #05080B; }
[data-theme="dark"] .byte-svg .b-grin { fill: #05080B; }
.byte-bubble { order: 1; position: relative; background: var(--paper); color: var(--ink); border: 2px solid var(--edge); border-radius: 12px 12px 4px 12px; padding: .6rem 2.1rem .7rem .85rem; font-size: .95rem; line-height: 1.4; }
.byte-name { font-weight: 700; font-size: .8rem; color: var(--pine); }
.byte-text { margin-top: .1rem; }
.byte-act { font: inherit; font-weight: 700; font-size: .9rem; margin-top: .5rem; background: var(--ink); color: var(--on-ink); border: 0; border-radius: 6px; padding: .35rem .7rem; cursor: pointer; }
.byte-close { position: absolute; top: .25rem; right: .3rem; font: inherit; font-size: 1.3rem; line-height: 1; width: 1.8rem; height: 1.8rem; border: 0; background: none; color: var(--moss); cursor: pointer; border-radius: 4px; }
.byte-close:hover { color: var(--ink); background: var(--mist); }

@media (prefers-reduced-motion: no-preference) {
  .byte { transform: translateY(130%); transition: transform .28s cubic-bezier(.2, .9, .3, 1.2); }
  .byte.in { transform: translateY(0); }
  .byte.mood-idle .b-ant { animation: byte-wig 1.8s ease-in-out infinite; transform-origin: 0 -54px; }
  .byte.mood-search .b-glass { animation: byte-scan 2s ease-in-out infinite; }
  .byte.mood-happy .byte-svg { animation: byte-hop .6s ease-in-out 3; }
  .byte.mood-happy .b-spark { animation: byte-tw 1.2s ease-in-out infinite; }
}
@keyframes byte-wig { 0%, 100% { transform: rotate(-6deg); } 50% { transform: rotate(6deg); } }
@keyframes byte-scan { 0%, 100% { transform: translateX(0); } 50% { transform: translateX(-8px); } }
@keyframes byte-hop { 0%, 100% { transform: translateY(0); } 40% { transform: translateY(-12px); } }
@keyframes byte-tw { 0%, 100% { opacity: .25; } 50% { opacity: 1; } }

@media (max-width: 860px) {
  .byte-svg { width: 48px; height: 48px; }
  .byte-bubble { font-size: .9rem; }
}
@media print { .byte { display: none; } }
.byte-svg { color: #25282C; }
[data-theme="dark"] .byte-svg { color: #ECEDE8; }

/* resting Byte: peeks up from the corner; select it for a tip */
.byte-peek { position: fixed; right: clamp(.5rem, 2vw, 1.25rem); bottom: 0; z-index: 19; width: 56px; height: 56px; padding: 0; border: 0; background: none; cursor: pointer; transform: translateY(28%); border-radius: 50% 50% 0 0; }
.byte-peek[hidden] { display: none; }
.byte-peek .byte-svg { width: 56px; height: 56px; }
.byte-peek:hover, .byte-peek:focus-visible { transform: translateY(0); }
@media (prefers-reduced-motion: no-preference) {
  .byte-peek { transition: transform .2s ease; animation: byte-arrive .4s ease-out; }
  .byte-peek .b-ant { animation: byte-wig 2.4s ease-in-out infinite; transform-origin: 0 -54px; }
  .byte-mini.mood-idle .b-ant { animation: byte-wig 2.4s ease-in-out infinite; transform-origin: 0 -54px; }
}
@keyframes byte-arrive { from { transform: translateY(100%); } to { transform: translateY(28%); } }

/* Byte inside pages */
.with-byte { display: flex; align-items: center; gap: .75rem; }
.with-byte .byte-mini { flex: none; }
h2.with-byte { gap: .5rem; }
.cp-dot { overflow: visible; }
.cp-byte { position: absolute; left: 50%; bottom: 100%; transform: translate(-50%, 2px); line-height: 0; pointer-events: none; }
.cp.here { margin-top: 0; }
.map { padding-top: 1.9rem; }
@media (max-width: 860px) {
  .map { padding-top: 0; }
  .cp-byte { left: auto; right: 100%; bottom: auto; top: 50%; transform: translate(-2px, -50%); }
  .route-steps .cp a { padding-left: 2.4rem; }
  .cp:not(:last-child)::after { left: 3.45rem; }
  .byte-peek, .byte-peek .byte-svg { width: 48px; height: 48px; }
}
@media print { .byte-peek { display: none; } }
.with-byte .byte-mini { order: 0; }
.route-steps ol.map { padding-top: 2.4rem; margin-top: .5rem; }
@media (max-width: 860px) { .route-steps ol.map { padding-top: 0; } }

/* ---------- My progress dashboard ---------- */
.progress-page h1 { max-width: none; }
.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1rem; margin-top: 1.75rem; }
.kpi { background: var(--paper); border: 1px solid var(--rule); border-radius: 8px; padding: 1rem 1.1rem; }
.kpi-label { color: var(--moss); font-size: .95rem; }
.kpi-value { font-size: 2.4rem; font-weight: 700; line-height: 1.1; margin-top: .2rem; letter-spacing: -0.02em; }
.kpi-of { font-size: 1rem; font-weight: 400; color: var(--moss); letter-spacing: 0; }
.kpi-note { color: var(--moss); font-size: .9rem; margin-top: .25rem; }
.dash-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; margin-top: 1rem; }
.panel { background: var(--paper); border: 1px solid var(--rule); border-radius: 8px; padding: 1.1rem 1.25rem 1.25rem; min-width: 0; }
.panel h2 { font-size: 1.15rem; }
.panel-sub { color: var(--moss); font-size: .92rem; margin-top: .1rem; }
.bars { margin-top: .9rem; display: grid; gap: .35rem; }
.bar-row { display: grid; grid-template-columns: 7.5rem minmax(0, 1fr) 4.2rem; align-items: center; gap: .75rem; padding: .25rem .3rem; border-radius: 4px; }
.bar-row:hover { background: var(--mist); }
.bar-name { font-size: .88rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar-track { height: .7rem; background: var(--mist); border-radius: 0 4px 4px 0; overflow: hidden; }
.bar-fill { display: block; height: 100%; background: var(--pine); border-radius: 0 4px 4px 0; }
.bar-val { font-size: .88rem; color: var(--moss); text-align: right; font-variant-numeric: tabular-nums; }
.as-table { margin-top: .9rem; }
.as-table summary { font-size: .92rem; }
.as-table table { margin-top: .5rem; font-family: var(--body); font-size: .9rem; }
.as-table th { position: static; background: none; color: var(--ink); border-bottom: 2px solid var(--edge); }
.q-chart { width: 100%; height: auto; display: block; margin-top: .75rem; overflow: visible; }
.q-grid { stroke: var(--rule); stroke-width: 1; }
.q-axis { font-size: 11px; fill: var(--moss); font-family: var(--body); }
.q-line { fill: none; stroke: var(--pine); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.q-dot { fill: var(--pine); stroke: var(--paper); stroke-width: 2; }
.q-hit { fill: transparent; }
.q-pt { cursor: default; outline: none; }
.q-pt:focus-visible .q-dot, .q-pt:hover .q-dot { r: 7; }
.q-pt:focus-visible .q-hit { stroke: var(--focus); stroke-width: 2; }
.cal { display: flex; gap: .4rem; margin-top: .9rem; }
.cal-days { display: grid; grid-template-rows: repeat(7, 14px); gap: 3px; font-size: 10px; color: var(--moss); line-height: 14px; }
.cal-grid { display: grid; grid-template-rows: repeat(7, 14px); grid-auto-flow: column; grid-auto-columns: 14px; gap: 3px; }
.cal-cell { width: 14px; height: 14px; border-radius: 3px; display: inline-block; }
.cal-cell.lvl-0 { background: #E3EAEE; }
.cal-cell.lvl-1 { background: #A6D6DD; }
.cal-cell.lvl-2 { background: #3AA2B0; }
.cal-cell.lvl-3 { background: #0C5E6A; }
.cal-cell.is-today { box-shadow: 0 0 0 2px var(--ink); }
[data-theme="dark"] .cal-cell.lvl-0 { background: #1A2530; }
[data-theme="dark"] .cal-cell.lvl-1 { background: #135A66; }
[data-theme="dark"] .cal-cell.lvl-2 { background: #1F98A8; }
[data-theme="dark"] .cal-cell.lvl-3 { background: #8BEAF3; }
.cal-key { display: flex; align-items: center; gap: 3px; font-size: .85rem; color: var(--moss); margin-top: .6rem; }
.cal-key .cal-cell { width: 12px; height: 12px; }
.need { margin-top: .75rem; border-top: 1px solid var(--rule); }
.need li { display: flex; align-items: baseline; gap: .75rem; padding: .5rem 0; border-bottom: 1px solid var(--rule); }
.need-tag { flex: none; min-width: 7.5rem; font-size: .82rem; font-weight: 700; color: var(--moss); }
.tip { position: fixed; z-index: 30; max-width: 18rem; background: var(--ink); color: var(--on-ink); font-size: .85rem; padding: .35rem .6rem; border-radius: 6px; pointer-events: none; }
.tip[hidden] { display: none; }
@media (max-width: 860px) {
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kpi-value { font-size: 1.9rem; }
  .dash-grid { grid-template-columns: minmax(0, 1fr); }
  .bar-row { grid-template-columns: 6rem minmax(0, 1fr) 3.8rem; }
  .cal { overflow-x: auto; }
}
.cal-days { grid-template-rows: repeat(7, 20px); gap: 4px; line-height: 20px; font-size: 11px; }
.cal-grid { grid-template-rows: repeat(7, 20px); grid-auto-columns: 20px; gap: 4px; }
.cal-grid .cal-cell { width: 20px; height: 20px; border-radius: 4px; }
@media (max-width: 860px) {
  .cal-days { grid-template-rows: repeat(7, 16px); gap: 3px; line-height: 16px; }
  .cal-grid { grid-template-rows: repeat(7, 16px); grid-auto-columns: 16px; gap: 3px; }
  .cal-grid .cal-cell { width: 16px; height: 16px; }
}
@media (max-width: 860px) { .q-axis { font-size: 15px; } }

/* ---------- home: your progress; SQL lab front page ---------- */
.home-progress { margin-top: 2.5rem; }
.section-row { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: .25rem 1rem; }
.section-row .section-h { margin-top: 0; }
.home-progress .section-row { margin-bottom: .2rem; }
.panel h3 { font-size: 1.15rem; }
.lab-index h1 { max-width: none; }
.lab-index .more-topics { margin-top: 2rem; }

/* ---------- editor frame ---------- */
.CodeMirror { border: 2px solid #1E2B36; box-shadow: 0 0 0 4px var(--mist), 0 0 0 5px var(--rule); }
[data-theme="light"] .CodeMirror-focused { box-shadow: 0 0 0 4px var(--mist), 0 0 0 5px var(--marigold), 0 0 20px var(--glow); }
[data-theme="dark"] .CodeMirror { border-color: #1E2B36; box-shadow: 0 0 0 4px var(--mist), 0 0 0 5px #131C24; }
.CodeMirror-focused { border-color: var(--marigold); }
[data-theme="dark"] .CodeMirror-focused { border-color: var(--marigold); box-shadow: 0 0 0 4px var(--mist), 0 0 0 5px var(--marigold), 0 0 28px var(--glow); }


/* ---------- accent colours: six areas, each with a job ----------
   Checked for colour-blind separation and 3:1 contrast on both surfaces.
   Colour never carries meaning alone: every use sits beside a name or label. */
:root { --c1: #1F5FA8; --c2: #B0306A; --c3: #3F7D20; --c4: #8A3FA8; --c5: #B8470C; --c6: #00809E; --ac: var(--pine); }
[data-theme="dark"] { --c1: #4A8AE0; --c2: #D95A92; --c3: #68A83A; --c4: #A877D6; --c5: #DB7430; --c6: #1FA3B3; }
[data-area="SQL"] { --ac: var(--c1); }
[data-area="Modelling"] { --ac: var(--c2); }
[data-area="Pipelines"] { --ac: var(--c3); }
[data-area="Business"] { --ac: var(--c4); }
[data-area="Statistics"] { --ac: var(--c5); }
[data-area="BI"] { --ac: var(--c6); }
[data-accent="1"] { --ac: var(--c1); }
[data-accent="2"] { --ac: var(--c3); }
[data-accent="3"] { --ac: var(--c4); }
[data-accent="4"] { --ac: var(--c5); }
[data-accent="5"] { --ac: var(--c6); }
[data-topic="select"] { --ac: var(--c1); }
[data-topic="where"] { --ac: var(--c2); }
[data-topic="group"] { --ac: var(--c3); }
[data-topic="join"] { --ac: var(--c4); }
[data-topic="union"] { --ac: var(--c5); }
[data-topic="cte"] { --ac: var(--c6); }
[data-topic="window"] { --ac: var(--pine); }

/* glossary */
.pill .dot { display: inline-block; width: .7em; height: .7em; border-radius: 50%; background: var(--ac); margin-right: .45em; vertical-align: baseline; }
.pill.on .dot { box-shadow: 0 0 0 2px var(--on-ink); }
.g-area-head { border-bottom: 3px solid var(--ac); }
.g-index a { border-left: 4px solid var(--ac); padding-left: .65rem; border-radius: 0 4px 4px 0; }
.card[data-area] { border-top: 8px solid var(--ac); }
.term-page h1 { border-left: 8px solid var(--ac); padding-left: .65rem; }
.term-page .t-box { border-top: 4px solid var(--ac); }
.term-page .t-say { background: color-mix(in srgb, var(--ac) 10%, var(--paper)); }

/* routes */
.route-card[data-accent] { border-top: 8px solid var(--pine); }
.route-card[data-accent="2"], .route-card[data-accent="4"] { border-top-color: var(--beige); }
.route-card[data-accent].on { border-top-color: var(--ac); }

/* SQL topics */
.path-row[data-topic] .clause { border-left: 8px solid var(--ac); padding-left: .7rem; }
.crumb[data-topic] .kw { border-left: 4px solid var(--ac); padding-left: .45rem; }
.bar-row[data-topic] .bar-fill { background: var(--ac); }

/* topic quiz buttons */
.topic-quiz { display: grid; grid-template-columns: repeat(auto-fill, minmax(13rem, 1fr)); gap: .75rem; margin: .75rem 0 1.5rem; }
.topic-btn { font: inherit; text-align: left; display: flex; flex-direction: column; gap: .2rem; background: var(--paper); color: var(--ink); border: 2px solid var(--rule); border-left: 8px solid var(--ac); border-radius: 8px; padding: .75rem .9rem; cursor: pointer; }
.topic-btn:hover { border-color: var(--marigold); border-left-color: var(--ac); box-shadow: 0 0 12px var(--glow); }
.tb-clause { font-family: var(--code); font-weight: 600; color: var(--pine); }
.tb-name { font-weight: 700; }
.tb-meta { color: var(--moss); font-size: .9rem; }

/* subject quiz */
a.topic-btn { text-decoration: none; }
a.topic-btn:not([data-area]) { --ac: var(--marigold); }
.subject-quiz { max-width: 44rem; }
.sq-prompt { font-size: clamp(1.25rem, 3vw, 1.6rem); margin-top: .8rem; }
.sq-text { margin: 1rem 0; padding: .9rem 1.1rem; background: var(--paper); border-left: 8px solid var(--ac); border-radius: 0 8px 8px 0; font-size: 1.15rem; }
.sq-opts { display: grid; gap: .6rem; margin-top: 1rem; }
.sq-opt { font: inherit; text-align: left; background: var(--paper); color: var(--ink); border: 2px solid var(--rule); border-left: 8px solid var(--ac); border-radius: 8px; padding: .75rem 1rem; cursor: pointer; font-weight: 600; }
.sq-opt:hover:not(:disabled) { border-color: var(--marigold); border-left-color: var(--ac); }
.sq-opt:disabled { cursor: default; opacity: 1; }
.sq-opt.right { border-color: var(--marigold); background: var(--fill); box-shadow: 0 0 12px var(--glow); }
.sq-opt.wrong { border-style: dashed; }
.sq-tag { font-weight: 400; color: var(--moss); }
.sq-feedback { margin-top: 1rem; }
.sq-feedback.good, .sq-feedback.bad { padding: .75rem 1rem; border: 2px solid var(--edge); border-radius: 8px; background: var(--paper); }
.sq-actions { margin-top: 1rem; }

/* footer links and info pages */
.foot-links { display: flex; flex-wrap: wrap; gap: .25rem 1.25rem; margin-top: .75rem; }
.foot-links a { color: var(--ink); }
.info { max-width: 44rem; }
.info h2 { margin-top: 1.75rem; }
.info ul { padding-left: 1.2rem; }
.info li { margin: .35rem 0; }
.contact-actions { display: flex; flex-wrap: wrap; gap: .6rem; margin: 1rem 0 1.5rem; }
.info ul { list-style: disc; }

/* ---------- header: one row on wide screens, a Menu button on phones ---------- */
.menu-btn { display: none; font: inherit; font-weight: 600; background: var(--paper); color: var(--ink); border: 1px solid var(--rule); border-radius: 6px; padding: .4rem .9rem; cursor: pointer; }
.menu-btn:hover { border-color: var(--marigold); }
.top-menu { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem 2rem; }
.top { position: relative; z-index: 35; background: var(--top-bg); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); }
@media (max-width: 860px) {
  .top { flex-wrap: nowrap; padding-top: .7rem; padding-bottom: .7rem; }
  .menu-btn { display: inline-block; }
  .menu-btn[aria-expanded="true"] { border-color: var(--marigold); box-shadow: 0 0 14px var(--glow); }
  .top-menu { display: none; position: absolute; left: 0; right: 0; top: 100%; z-index: 30; flex-direction: column; align-items: stretch; gap: 0;
    background: var(--paper); border-bottom: 1px solid var(--rule); padding: .5rem clamp(1rem, 4vw, 3rem) 1rem; box-shadow: 0 18px 30px var(--shadow); }
  .top-menu.open { display: flex; }
  .top-menu nav { flex-direction: column; gap: 0; }
  .top-menu nav a { padding: .7rem 0; border-bottom: 1px solid var(--rule); }
  .top-menu nav a[aria-current="page"] { border-bottom-color: var(--rule); color: var(--pine); box-shadow: inset 3px 0 0 var(--marigold); padding-left: .75rem; }
}

/* ---------- SQL lab on phones: one flowing page, buttons always in reach ---------- */
@media (max-width: 860px) {
  .lab { padding-bottom: 5rem; }
  .pane { scroll-margin-top: .75rem; }
  .task h1 { font-size: 1.4rem; }
  .prompt { margin-top: .5rem; }
  .hint { margin-top: .6rem; }
  .pane-query .CodeMirror, .pane-query .CodeMirror-scroll { min-height: 8rem; }
  .pane-result > :first-child { margin-top: .25rem; }
  .lab-bar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 25; margin: 0; flex-wrap: nowrap; gap: .5rem;
    padding: .6rem clamp(1rem, 4vw, 3rem) calc(.6rem + env(safe-area-inset-bottom));
    background: var(--bar-bg); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
    border-top: 1px solid var(--rule); box-shadow: 0 -10px 24px var(--shadow); }
  .lab-bar .btn { flex: 1 1 auto; padding: .55rem .6rem; font-size: .9rem; white-space: nowrap; }
  .lab-bar .keys { display: none; }
  .tables-btn { display: inline-block; flex: 0 0 auto !important; }
  .tables-btn[aria-expanded="true"] { border-color: var(--marigold); color: var(--ink); }
  /* the tables list becomes a panel that slides up from the bottom */
  .tables { margin-top: .9rem; }
  .tables[open] { position: fixed; left: 0; right: 0; bottom: 0; z-index: 40; margin: 0; max-height: 72vh; overflow-y: auto;
    background: var(--paper); border-top: 1px solid var(--marigold); border-radius: 12px 12px 0 0;
    padding: 0 clamp(1rem, 4vw, 3rem) calc(1rem + env(safe-area-inset-bottom));
    box-shadow: 0 0 0 100vmax var(--scrim), 0 -6px 30px var(--glow); }
  .tables[open] > summary { position: sticky; top: 0; background: var(--paper); padding: .9rem 0 .6rem; display: flex; justify-content: space-between; list-style: none; }
  .tables[open] > summary::-webkit-details-marker { display: none; }
  .tables[open] > summary::after { content: 'Close'; font-weight: 600; color: var(--moss); }
  body:has(.lab) .byte { bottom: 4.6rem; }
}
@media (max-width: 860px) and (prefers-reduced-motion: no-preference) {
  .tables[open] { animation: sheet-up .18s ease-out; }
  @keyframes sheet-up { from { transform: translateY(20%); opacity: .4; } to { transform: none; opacity: 1; } }
}

/* on touch screens, a tapped button should not stay lit up */
@media (hover: none) {
  .btn:hover { background: transparent; color: var(--ink); }
  .btn.quiet:hover { border-color: var(--rule); color: var(--moss); }
  .btn.primary:hover { background: var(--fill); border-color: var(--marigold); color: var(--pine); box-shadow: 0 0 14px var(--glow), inset 0 0 12px var(--fill); }
}

/* the search box glows when you type in it */
#g-search:focus { border-color: var(--marigold); box-shadow: 0 0 14px var(--glow); outline: none; }

/* ---------- SQL lab: "Translate to another database" ---------- */
.xlate { margin-top: 1.25rem; border: 1px solid var(--rule); border-radius: 8px; background: var(--paper); padding: 0 1rem; }
.xlate[open] { border-color: var(--edge); padding-bottom: 1rem; }
.xlate > summary { cursor: pointer; font-weight: 700; color: var(--pine); padding: .75rem 0; }
.xlate-pick { display: flex; flex-wrap: wrap; border: 2px solid var(--edge); border-radius: 6px; overflow: hidden; margin: .25rem 0 1rem; }
.xlate-pick .seg { flex: 1 1 auto; }
.xlate-pick .seg + .seg { border-left: 2px solid var(--edge); }
.xlate-head { margin: 0 0 .4rem; color: var(--moss); }
.xlate-head strong { color: var(--ink); }
.xlate-code { font-family: var(--code); font-size: .85rem; background: var(--editor); color: var(--ink); border: 1px solid var(--marigold);
  border-radius: 6px; padding: .8rem 1rem; margin: 0; overflow-x: auto; white-space: pre-wrap; word-break: break-word; box-shadow: 0 0 14px var(--glow); }
.xlate-copy { margin-top: .6rem; }
.xlate h2 { font-size: .95rem; margin: 1.1rem 0 .3rem; }
.xlate-list { margin: 0; padding-left: 1.2rem; }
.xlate-list li { margin: .3rem 0; }
.xlate-warn li::marker { color: var(--brick); }
.xlate-small { margin: 1rem 0 0; font-size: .85rem; color: var(--moss); }
@media (max-width: 860px) { .xlate-pick .seg { flex: 1 1 45%; } .xlate-pick .seg:nth-child(3) { border-left: 0; } .xlate-pick .seg:nth-child(n+3) { border-top: 2px solid var(--edge); } }

/* ---------- glossary: "SQL dialect" comparison ---------- */
.dialect-compare .dc-group { border-top: 1px solid var(--rule); }
.dialect-compare .dc-group:last-child { border-bottom: 1px solid var(--rule); }
.dialect-compare .dc-group > summary { cursor: pointer; font-weight: 700; padding: .7rem 0; color: var(--pine); }
.dc-row { margin: .4rem 0 1.4rem; }
.dc-row h3 { font-size: 1rem; margin: 0 0 .4rem; }
.dc-table { width: 100%; border-collapse: collapse; font-size: .9rem; font-family: var(--body); }
.dc-table th, .dc-table td { text-align: left; vertical-align: top; padding: .45rem .6rem; border-bottom: 1px solid var(--rule); }
.dc-table thead th { position: static; background: transparent; color: var(--moss); font-weight: 600; border-bottom: 1px solid var(--edge); }
.dc-table tbody th { position: static; background: transparent; border-bottom: 1px solid var(--rule); font-weight: 600; color: var(--ink); white-space: nowrap; width: 9.5rem; }
.dc-table pre { margin: 0; font-family: var(--code); font-size: .82rem; white-space: pre-wrap; word-break: break-word; color: var(--ink); }
.dc-note { color: var(--moss); margin: .5rem 0 0; }
@media (max-width: 600px) { .dc-table tbody th { width: auto; white-space: normal; } }

/* ---------- quiz path: levels, mastery and the next step ---------- */
.mastery { display: flex; flex-direction: column; gap: .35rem; margin: .4rem 0; }
.mastery-text { font-weight: 600; }
.mastery-track { display: block; height: 6px; border-radius: 3px; background: var(--rule); overflow: hidden; margin-top: .25rem; }
.mastery-fill { display: block; height: 100%; background: var(--ac, var(--marigold)); box-shadow: 0 0 8px var(--glow); border-radius: 3px; }
.sq-next-step { margin: 1.25rem 0 1.5rem; padding: 1rem 1.1rem; border: 1px solid var(--marigold); border-radius: 8px; background: var(--fill); box-shadow: 0 0 16px var(--glow); }
.sq-why { margin: 0 0 .8rem; }
.sq-standing { margin-bottom: 1.25rem; }
.sq-standing h2 { font-size: 1.05rem; margin: 0 0 .3rem; }
.meta-line { color: var(--moss); margin: .3rem 0; }
.sq-term { margin: 1rem 0; padding: .9rem 1.1rem; background: var(--paper); border-left: 8px solid var(--ac); border-radius: 0 8px 8px 0; font-size: 1.35rem; font-weight: 700; }
.sq-code { margin: 1rem 0; white-space: pre-wrap; }
.sq-opts-long .sq-opt { font-weight: 500; line-height: 1.45; }
.sq-mastered { color: var(--pine); font-weight: 600; }

/* ---------- glossary: area headings open and close their terms ---------- */
.g-area-head { margin: 0; font-size: 1.35rem; padding-bottom: 0; }
.g-toggle { font: inherit; font-weight: 700; color: var(--ink); background: none; border: 0; padding: .5rem 0 .45rem; width: 100%;
  display: flex; align-items: baseline; gap: .75rem; text-align: left; cursor: pointer; }
.g-toggle:hover .g-name { color: var(--pine); }
.g-toggle .tally { font-size: .9rem; font-weight: 400; color: var(--moss); margin-left: auto; }
.g-chev { display: inline-block; width: .6rem; height: .6rem; border-right: 2px solid var(--ac, var(--marigold)); border-bottom: 2px solid var(--ac, var(--marigold));
  transform: rotate(-45deg); transition: transform .15s ease; position: relative; top: -.1rem; flex: none; }
.g-toggle[aria-expanded="true"] .g-chev { transform: rotate(45deg); top: -.25rem; }
.g-area { margin-top: 1rem; }
.g-area-body { padding-top: .5rem; }
.g-open-all-row { margin: 1.25rem 0 0; text-align: right; }
.linkish { font: inherit; background: none; border: 0; padding: 0; color: var(--pine); text-decoration: underline; cursor: pointer; }
@media (prefers-reduced-motion: reduce) { .g-chev { transition: none; } }

/* ---------- phones: a more compact layout (same text sizes, less padding and space) ---------- */
@media (max-width: 600px) {
  /* smaller text on phones: everything sized in rem shrinks with it. The Settings text sizes still apply on top. */
  html:not([data-text]) { font-size: 87.5%; }
  body { font-size: 1rem; }
  main { padding: 1rem 1rem 2.5rem; }
  h1 { font-size: 1.45rem; }
  .lede { font-size: 1rem; margin-top: .6rem; line-height: 1.55; }
  .review-block { margin-top: 1.6rem; }
  .review-block h2, .route-steps h2, .panel h2, .panel h3 { font-size: 1.05rem; }

  /* quiz subjects: two small cards per row */
  .topic-quiz { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .5rem; margin: .6rem 0 1.2rem; }
  .topic-btn { padding: .55rem .65rem; border-width: 1px; border-left-width: 5px; gap: .1rem; }
  .tb-clause { font-size: .85rem; }
  .tb-name { font-size: .95rem; }
  .tb-meta { font-size: .86rem; }
  .topic-btn .mastery-track { height: 4px; }

  /* home: route map and progress */
  .route-steps { margin-top: 1.4rem; }
  .cp-dot { width: 1.9rem; height: 1.9rem; border-width: 2px; font-size: .9rem; }
  .route-steps .cp a { padding-bottom: .25rem; }
  .home-progress { margin-top: 1.75rem; }
  .kpis { gap: .5rem; margin-top: 1rem; }
  .kpi { padding: .65rem .75rem; }
  .kpi-label { font-size: .9rem; }
  .kpi-value { font-size: 1.5rem; }
  .kpi-note { font-size: .86rem; }
  .dash-grid { grid-template-columns: 1fr; gap: .6rem; margin-top: .6rem; }
  .panel { padding: .8rem .85rem .9rem; }
  .panel > h2:first-child, .panel > h3:first-child, .panel > :first-child { margin-top: 0; }
  .section-h, .home-progress h2 { font-size: 1.15rem; }
  .panel-sub { font-size: .9rem; }
  .bars { margin-top: .5rem; gap: .15rem; }
  .bar-row { grid-template-columns: 6rem minmax(0, 1fr) 3.2rem; gap: .5rem; padding: .15rem .2rem; font-size: .88rem; }

  /* glossary controls */
  .g-controls { gap: .5rem; margin-top: 1rem; }
  #g-search { padding: .45rem .7rem; font-size: 16px; } /* 16px stops phones zooming in when you tap the box */
  .CodeMirror { font-size: 1rem; }
  .seg { padding: .4rem .5rem; font-size: .88rem; }
  .g-groups { gap: .3rem; }
  .pill { padding: .2rem .6rem; font-size: .85rem; }
  .g-area-head { font-size: 1.1rem; }
  .g-toggle { padding: .4rem 0 .35rem; }
  .g-open-all-row { margin-top: .8rem; font-size: .9rem; }

  /* buttons and quiz */
  .btn { padding: .5rem .9rem; }
  .sq-text, .sq-term { padding: .7rem .85rem; border-left-width: 5px; font-size: 1rem; }
  .sq-term { font-size: 1.15rem; }
  .sq-opts { gap: .45rem; }
  .sq-next-step { padding: .8rem .9rem; margin: 1rem 0 1.2rem; }
}

/* ---------- Projects hub ---------- */
.pj-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(18rem, 1fr)); gap: 1rem; margin-top: 1.5rem; }
.pj-card { display: flex; flex-direction: column; gap: .35rem; padding: 1.1rem 1.2rem; background: var(--paper); border: 1px solid var(--rule); border-radius: 10px; color: var(--ink); text-decoration: none; }
a.pj-card:hover { border-color: var(--marigold); box-shadow: 0 0 16px var(--glow); }
.pj-card h2 { font-size: 1.25rem; margin: 0; color: var(--pine); }
.pj-card-level { font-size: .85rem; color: var(--moss); }
.pj-card-tag { margin: 0; }
.pj-card-meta, .pj-card-progress { margin: 0; color: var(--moss); font-size: .9rem; }
.pj-soon { opacity: .75; border-style: dashed; }
.pj-soon h2 { color: var(--ink); }

.project { max-width: 50rem; }
.pj-brief { margin: 1.25rem 0; padding: 1rem 1.15rem; border-left: 4px solid var(--marigold); background: var(--paper); border-radius: 0 8px 8px 0; }
.pj-box-label { margin: 0 0 .3rem; font-size: .85rem; font-weight: 700; color: var(--pine); }
.pj-brief p:last-child { margin: 0; font-size: 1.05rem; }
.pj-glance { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .6rem 1.5rem; margin: 1rem 0; }
.pj-glance dt { font-size: .85rem; color: var(--moss); }
.pj-glance dd { margin: .1rem 0 0; }
.pj-dim { color: var(--moss); }
.pj-downloads { display: grid; grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr)); gap: .75rem; margin: 1.25rem 0 .5rem; }
.pj-download { display: flex; flex-direction: column; gap: .15rem; padding: .85rem 1rem; border: 1px solid var(--marigold); border-radius: 8px; background: var(--fill); color: var(--ink); text-decoration: none; box-shadow: 0 0 12px var(--glow); }
.pj-download:hover { background: var(--fill-strong); }
.pj-dl-label { font-weight: 700; color: var(--pine); }
.pj-dl-meta, .pj-dl-note { font-size: .88rem; color: var(--moss); }
.pj-fictional { font-size: .85rem; color: var(--moss); margin: .5rem 0 1.25rem; }
.pj-progress { display: flex; flex-direction: column; gap: .3rem; margin: 1rem 0 .5rem; font-weight: 600; }

.pj-steps { list-style: none; margin: 0; padding: 0; }
.pj-step { border-top: 1px solid var(--rule); padding: 1.5rem 0 1.25rem; }
.pj-step h2 { display: flex; align-items: baseline; gap: .65rem; font-size: 1.3rem; margin: 0; }
.pj-num { display: inline-grid; place-items: center; flex: none; width: 1.9rem; height: 1.9rem; border-radius: 50%; border: 2px solid var(--marigold); color: var(--pine); font-size: .95rem; box-shadow: 0 0 10px var(--glow); }
.pj-time { margin: .25rem 0 .75rem 2.55rem; color: var(--moss); font-size: .88rem; }
.pj-step h3 { font-size: 1.05rem; margin: 1.25rem 0 .4rem; }
.pj-step p { margin: .5rem 0; }
.pj-list { margin: .5rem 0; padding-left: 1.3rem; }
.pj-list li { margin: .3rem 0; }
.pj-step code, .pj-brief code { font-family: var(--code); font-size: .9em; background: var(--paper); border: 1px solid var(--rule); border-radius: 4px; padding: .05em .3em; }
.pj-code { margin: .75rem 0; border: 1px solid var(--rule); border-radius: 8px; overflow: hidden; background: var(--editor); }
.pj-code-head { display: flex; justify-content: space-between; align-items: center; padding: .35rem .5rem .35rem .85rem; border-bottom: 1px solid var(--rule); font-size: .85rem; color: var(--moss); }
.pj-copy { font: inherit; font-size: .85rem; background: none; color: var(--pine); border: 1px solid var(--edge); border-radius: 5px; padding: .15rem .6rem; cursor: pointer; }
.pj-copy:hover { border-color: var(--marigold); }
.pj-code pre { margin: 0; padding: .8rem 1rem; overflow-x: auto; font-size: .84rem; line-height: 1.55; }
.pj-code pre code { background: none; border: 0; padding: 0; font-size: inherit; }
.pj-check, .pj-note { margin: .75rem 0; padding: .7rem .95rem; border-radius: 8px; }
.pj-check { border: 1px solid var(--marigold); background: var(--fill); }
.pj-check p:last-child, .pj-note p { margin: 0; }
.pj-note { border: 1px dashed var(--edge); }
.pj-links { list-style: none; margin: .5rem 0; padding: 0; display: grid; gap: .5rem; }
.pj-links li { display: flex; flex-direction: column; gap: .1rem; padding: .55rem .8rem; border: 1px solid var(--rule); border-radius: 8px; background: var(--paper); }
.pj-links a { font-weight: 700; }
.pj-link-note { font-size: .9rem; color: var(--moss); }
.pj-table-wrap { overflow-x: auto; margin: .75rem 0; }
.pj-table { border-collapse: collapse; width: 100%; font-size: .9rem; }
.pj-table th, .pj-table td { text-align: left; padding: .4rem .6rem; border-bottom: 1px solid var(--rule); vertical-align: top; }
.pj-table thead th { position: static; background: transparent; color: var(--moss); font-weight: 600; border-bottom: 1px solid var(--edge); }
.pj-fig { margin: .75rem 0; }
.pj-fig img { display: block; max-width: 100%; height: auto; border-radius: 8px; border: 1px solid var(--rule); }
.pj-reveal { margin: .75rem 0; border: 1px solid var(--rule); border-radius: 8px; padding: 0 .9rem; background: var(--paper); }
.pj-reveal > summary { cursor: pointer; padding: .6rem 0; font-weight: 700; color: var(--pine); }
.pj-reveal[open] { border-color: var(--edge); }
.pj-reveal-body { padding-bottom: .6rem; }
.pj-terms { color: var(--moss); font-size: .9rem; }
.pj-done { display: inline-flex; align-items: center; gap: .5rem; margin-top: .75rem; font-weight: 600; cursor: pointer; }
.pj-done input { width: 1.15rem; height: 1.15rem; accent-color: var(--marigold); }
@media (max-width: 600px) {
  .pj-glance { grid-template-columns: 1fr 1fr; gap: .5rem 1rem; }
  .pj-glance > div:nth-child(n+3) { grid-column: 1 / -1; }
  .pj-brief p:last-child { font-size: 1rem; }
  .pj-step h2 { font-size: 1.1rem; }
  .pj-time { margin-left: 0; }
  .pj-code pre { font-size: .8rem; padding: .6rem .7rem; }
  .pj-cards { grid-template-columns: 1fr; }
}

/* ---------- Projects hub: headings that open in place ---------- */
.pj-head { border-bottom: 3px solid var(--marigold); }
.pj-soon .pj-head { border-bottom: 2px dashed var(--edge); }
.pj-soon-head { display: flex; align-items: baseline; gap: .75rem; width: 100%; padding: .5rem 0 .45rem; color: var(--moss); }
.pj-blurb { margin: .5rem 0 0; color: var(--moss); }
.pj-meta-line { color: var(--moss); font-size: .95rem; }
.pj-meta-line strong { color: var(--ink); }
.pj-steps-head { font-size: 1rem; margin: 1rem 0 .3rem; }
.pj-step-links { margin: 0 0 1rem; padding-left: 1.4rem; }
.pj-step-links li { margin: .25rem 0; }
.pj-ticked { color: var(--pine); font-size: .85rem; font-weight: 600; }
.project h1 { margin-bottom: .25rem; }
.project > h2 { font-size: 1.15rem; margin: 1.5rem 0 .4rem; }
.project blockquote { margin: .75rem 0; padding: .6rem .9rem; border-left: 3px solid var(--edge); color: var(--moss); }
.project hr { border: 0; border-top: 1px solid var(--rule); margin: 2rem 0 1rem; }
.project .pj-table th[scope="row"] { color: var(--moss); font-weight: 600; white-space: nowrap; }
.pj-step > h2 { display: flex; align-items: baseline; gap: .65rem; font-size: 1.3rem; margin: 0 0 .25rem; }
.pj-step > h2 + p em { color: var(--moss); font-style: normal; font-size: .88rem; }

.pj-step-links { list-style: decimal; }
.pj-step-links li::marker { color: var(--pine); font-weight: 700; }
.pj-list { list-style: disc; }
ol.pj-list { list-style: decimal; }
.pj-table, .pj-table th, .pj-table td { font-family: var(--body); white-space: normal; }
.pj-table td code { white-space: nowrap; }
.pj-dl-list { list-style: none; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr)); gap: .75rem; }
.pj-dl-list li { margin: 0; padding: .85rem 1rem; border: 1px solid var(--marigold); border-radius: 8px; background: var(--fill); box-shadow: 0 0 12px var(--glow); color: var(--moss); }
.pj-dl-list li a { display: block; font-weight: 700; font-size: 1.05rem; margin-bottom: .15rem; }
.pj-soon-head .tally { margin-left: auto; font-size: .9rem; font-weight: 400; }

/* ---------- light and dark switch: shows the mode you will switch to ---------- */
.theme-btn { order: 2; align-self: center; display: inline-flex; align-items: center; justify-content: center; width: 2.25rem; height: 2.25rem; padding: 0;
  background: var(--paper); color: var(--ink); border: 1px solid var(--rule); border-radius: 8px; cursor: pointer; }
.theme-btn:hover { border-color: var(--marigold); box-shadow: 0 0 12px var(--glow); }
.theme-btn svg { fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.theme-btn .i-moon { display: none; }
.theme-btn[data-mode="light"] .i-sun { display: none; }
.theme-btn[data-mode="light"] .i-moon { display: block; }
.top-menu { order: 1; }
.top .brand { align-self: center; }
@media (max-width: 860px) {
  .theme-btn { order: 1; margin-left: auto; }
  .menu-btn { order: 2; margin-left: .5rem; }
  .top { align-items: center; }
}

/* Code areas stay dark in light mode too, so everything inside them uses the dark colours. */
[data-theme="light"] .pj-code, [data-theme="light"] .xlate-code, [data-theme="light"] .slots, [data-theme="light"] .t-code,
[data-theme="light"] .dcol pre, [data-theme="light"] .tried, [data-theme="light"] .q-code {
  --ink: #DCE4EA; --moss: #8D9AA6; --pine: #5EBFCC; --marigold: #2A9FB0; --focus: #7FD3DE; --rule: #1E2B36; --edge: #46636F; --paper: #0B1015;
  --fill: rgba(42, 159, 176, .08); --fill-strong: rgba(42, 159, 176, .16); --glow: rgba(42, 159, 176, .30); --on-pine: #05080B; --on-gold: #05080B; --on-ink: #05080B;
  color-scheme: dark;
}
[data-theme="light"] .pj-code { border-color: #1E2B36; color: var(--ink); }
[data-theme="light"] .pj-code pre, [data-theme="light"] .pj-code code { color: var(--ink); }

/* ---------- welcome section: the moving network behind the first screen ---------- */
.hero-home { position: relative; min-height: min(38rem, 82vh); display: flex; align-items: center; margin: calc(-1 * clamp(1.5rem, 4vw, 3rem)) calc(-1 * clamp(1rem, 4vw, 3rem)) 0; padding: clamp(2rem, 5vw, 4rem) clamp(1rem, 4vw, 3rem); overflow: hidden; }
.net-bg { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
/* The fade that keeps the words readable is CSS, not part of the drawing, so browsers that repaint pages
   in their own dark mode (Samsung Internet) repaint it together with the background. */
.hero-home::after { content: ""; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(90deg, color-mix(in srgb, var(--mist) 97%, transparent) 0%, color-mix(in srgb, var(--mist) 90%, transparent) 44%, color-mix(in srgb, var(--mist) 12%, transparent) 62%, transparent 100%); }
.hero-copy { z-index: 1; }
.hero-copy { position: relative; max-width: 33rem; }
.hero-tag { display: inline-block; font-size: .85rem; font-weight: 600; color: var(--beige-ink); background: var(--sand); padding: .3rem .75rem; border-radius: 999px; margin: 0; }
[data-theme="light"] .hero-tag { color: var(--pine); }
.hero-home h1 { font-size: clamp(2.3rem, 5.2vw, 3.4rem); line-height: 1.06; letter-spacing: -.025em; margin: 1rem 0 0; }
.hero-home h1 span { color: var(--pine); display: block; }
.hero-home h1:focus { outline: none; box-shadow: none; }
.hero-blurb { margin: 1.1rem 0 0; font-size: 1.12rem; line-height: 1.55; color: var(--moss); max-width: 31rem; }
.picks { display: grid; grid-template-columns: repeat(3, 1fr); gap: .75rem; margin-top: 1.9rem; }
.pick { display: flex; flex-direction: column; gap: .3rem; text-align: left; padding: .9rem 1rem; border: 1.5px solid var(--rule); border-radius: 12px; background: var(--paper); color: var(--ink); text-decoration: none; font: inherit; cursor: pointer; }
.pick b { color: var(--pine); font-size: 1rem; }
.pick span { color: var(--moss); font-size: .86rem; line-height: 1.35; }
.pick:hover { border-color: var(--marigold); box-shadow: 0 0 16px var(--glow); }
.pick.main { background: var(--pine); border-color: var(--pine); }
.pick.main b, .pick.main span { color: var(--on-pine); }
[data-theme="dark"] .pick { background: rgba(11, 16, 21, .85); border-color: var(--edge); }
[data-theme="dark"] .pick.main { background: var(--fill-strong); border-color: var(--marigold); box-shadow: 0 0 18px var(--glow); }
[data-theme="dark"] .pick.main b { color: var(--focus); }
[data-theme="dark"] .pick.main span { color: var(--ink); }
.start-below { padding-top: 2.5rem; }
.start-below h2 { font-size: 1.6rem; margin: 0; scroll-margin-top: 5rem; }
.start-below h2:focus { outline: none; box-shadow: none; }
@media (max-width: 760px) {
  .hero-home { min-height: 0; align-items: flex-start; }
  .hero-home::after { background: linear-gradient(180deg, color-mix(in srgb, var(--mist) 62%, transparent) 0%, color-mix(in srgb, var(--mist) 84%, transparent) 35%, color-mix(in srgb, var(--mist) 90%, transparent) 100%); }
  .picks { grid-template-columns: 1fr; gap: .6rem; }
  .pick { padding: .75rem .9rem; }
  .hero-blurb { font-size: 1.02rem; }
}

/* ---------- home: one-line summaries, full numbers on #/progress ---------- */
.today-line { margin-top: 1.5rem; padding: .7rem 1rem; border: 1px solid var(--rule); border-left: 4px solid var(--beige); border-radius: 8px; background: var(--paper); }
.prog-line { margin: .3rem 0 1rem; color: var(--moss); }
.home-progress .panel { max-width: 40rem; }
.progress-page h1 { margin-bottom: 1.25rem; }

/* ---------- glossary pictures, inside the Example section ---------- */
.t-vis { margin: 1rem 0 0; padding: 1rem; border: 1px solid var(--rule); border-radius: 10px; background: var(--paper); max-width: 44rem; }
.vis-flow { display: flex; align-items: center; gap: 1rem; }
.vis-flow > .vis-t, .vis-pair > .vis-t { flex: none; width: auto; }
.vis-pair { display: flex; flex-direction: column; gap: .75rem; }
.vis-t { border-collapse: collapse; font-family: var(--code); font-size: .8rem; }
.vis-t caption { text-align: left; font-family: var(--body); font-weight: 650; font-size: .8rem; color: var(--moss); padding-bottom: .3rem; }
.vis-t th { position: static; background: var(--th); color: var(--ink); font-weight: 600; text-align: left; padding: .25rem .6rem; border: 1px solid var(--rule); }
.vis-t td { padding: .25rem .6rem; border: 1px solid var(--rule); color: var(--ink); }
.vis-t tbody tr:last-child td { border-bottom: 1px solid var(--rule); }
.vis-t tr.vis-kept:last-child td { border-bottom-color: var(--beige); }
.vis-t .vis-null { color: var(--moss); font-style: italic; }
.vis-t tr.vis-kept td { background: var(--sand); border-color: var(--beige); }
.vis-arrow { display: flex; flex-direction: column; align-items: center; color: var(--pine); font-family: var(--code); font-size: .75rem; font-weight: 600; }
.vis-arrow::after { content: ""; width: 3.2rem; height: 2px; margin-top: .3rem; background: var(--pine); box-shadow: 0 0 8px var(--glow);
  mask: linear-gradient(#000 0 0); }
.vis-arrow span::after { content: " →"; }
.vis-note { margin: .85rem 0 0; font-size: .92rem; color: var(--moss); max-width: 60ch; }
.vis-note code { font-family: var(--code); font-size: .85em; color: var(--ink); }
.vis-svg { width: 100%; max-width: 30rem; height: auto; display: block; }
.vis-axis { stroke: var(--edge); stroke-width: 1.5; }
.vis-lbl { fill: var(--moss); font-family: var(--body); font-size: 12px; }
.vis-dot { fill: var(--paper); stroke: var(--pine); stroke-width: 2.2; }
.vis-median { stroke: var(--pine); stroke-width: 2; }
.vis-mean { stroke: var(--beige); stroke-width: 2; stroke-dasharray: 5 4; }
.vis-lbl-median { fill: var(--pine); font-weight: 650; }
.vis-lbl-mean { fill: var(--beige-ink); font-weight: 650; }
[data-theme="light"] .vis-lbl-mean { fill: #8A6A1E; }
@media (max-width: 600px) {
  .vis-flow { flex-direction: column; align-items: flex-start; }
  .vis-arrow::after { display: none; }
  .vis-arrow span::after { content: " ↓"; }
}
.vis-t tr.vis-gone td { text-decoration: line-through; color: var(--moss); background: rgba(180, 35, 24, .06); }
.vis-t tr.vis-new td { background: var(--fill); }
.vis-t td b { font-weight: 700; color: var(--ink); }
.vis-t td em, .vis-note em { font-style: italic; }
.vis-bad { color: var(--brick); }
.vis-sum { margin: .5rem 0 0; font-size: .85rem; color: var(--moss); }
.vis-diagram { max-width: 32rem; }
.vis-box rect { fill: var(--paper); stroke: var(--edge); stroke-width: 1.5; }
.vis-box.vis-main rect { stroke: var(--pine); stroke-width: 2; fill: var(--fill); }
.vis-box-t { fill: var(--ink); font-family: var(--code); font-size: 14px; font-weight: 600; }
.vis-box-s { fill: var(--moss); font-family: var(--body); font-size: 11.5px; }
.vis-link { stroke: var(--edge); stroke-width: 1.5; }
.vis-arrowed { stroke: var(--pine); stroke-width: 2; }
.vis-head { fill: var(--pine); }
.vis-bar { fill: var(--fill-strong); stroke: var(--pine); stroke-width: 1; }
.vis-bar-end { fill: var(--sand); stroke: var(--beige); }
.vis-val { font-size: 11.5px; }
