/* ==========================================================================
   Learning-garden design layer (#17). Loaded after the theme CSS.
   Tokens are the single source for colour and type; change values here,
   not selectors. Palette and fonts: see CLAUDE.md.
   ========================================================================== */

/* 01. Tokens --------------------------------------------------------------- */
:root {
    --ground: #F3F5F0;
    --surface: #FFFFFF;
    --ink: #17231C;
    --muted: #4F5E54;
    --line: #D6DDD2;
    --accent: #24573F;
    --accent-ink: #FFFFFF;

    --font-display: 'Space Grotesk', 'Segoe UI', system-ui, -apple-system, sans-serif;
    --font-body: 'IBM Plex Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
    --font-mono: 'IBM Plex Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

    --radius: 12px;
    --radius-small: 8px;
    --content-width: 1120px;
}

/* Stage chips (light). Dark values below; all >= 8.8:1. */
:root {
    --chip-seedling-bg: #E3EFC4;   --chip-seedling-ink: #3B5212;
    --chip-budding-bg: #F7DFBC;    --chip-budding-ink: #7A3D08;
    --chip-evergreen-bg: #24573F;  --chip-evergreen-ink: #FFFFFF;
}

/* Dark palette (#38). Applies when the visitor picked dark, or when no
   choice is saved and the OS is dark. The theme lives only on
   <html data-theme>; components never check it themselves. */
html[data-theme="dark"] {
    color-scheme: dark;
    --ground: #111813;
    --surface: #18211B;
    --ink: #E6EBE2;
    --muted: #A9B5AC;
    --line: #2C3A31;
    --accent: #7FC4A0;
    --accent-ink: #111813;
    --chip-seedling-bg: #263318;   --chip-seedling-ink: #D4E8A6;
    --chip-budding-bg: #3A2810;    --chip-budding-ink: #F5C98F;
    --chip-evergreen-bg: #7FC4A0;  --chip-evergreen-ink: #111813;
}
@media (prefers-color-scheme: dark) {
    html:not([data-theme]) {
        color-scheme: dark;
        --ground: #111813;
        --surface: #18211B;
        --ink: #E6EBE2;
        --muted: #A9B5AC;
        --line: #2C3A31;
        --accent: #7FC4A0;
        --accent-ink: #111813;
        --chip-seedling-bg: #263318;   --chip-seedling-ink: #D4E8A6;
        --chip-budding-bg: #3A2810;    --chip-budding-ink: #F5C98F;
        --chip-evergreen-bg: #7FC4A0;  --chip-evergreen-ink: #111813;
    }
}

/* Point the theme's older variables at the tokens so pages and components
   not yet restyled (/notes, posts, tooltips) follow the same palette.
   style.css keeps its definitions; these win because this file loads last. */
html,
html[data-theme="light"],
html[data-theme="dark"] {
    --color-bg-main: var(--surface);
    --color-bg-sub: var(--ground);
    --color-text-main: var(--ink);
    --color-text-sub: var(--muted);
    --color-text-link: var(--accent);
    --color-border-dark: var(--ink);
    --color-border: var(--muted);
    --color-border-light: var(--line);
}

.stage-chip--seedling { background: var(--chip-seedling-bg); color: var(--chip-seedling-ink); }
.stage-chip--budding { background: var(--chip-budding-bg); color: var(--chip-budding-ink); }
.stage-chip--evergreen { background: var(--chip-evergreen-bg); color: var(--chip-evergreen-ink); }

/* 02. Base ----------------------------------------------------------------- */
html {
    background-color: var(--ground);
}
body {
    font-family: var(--font-body);
    color: var(--ink);
}
h1, h2, h3, h4 {
    font-family: var(--font-display);
    letter-spacing: -0.01em;
}
:focus-visible {
    outline: 3px solid var(--accent);
    outline-offset: 2px;
    border-radius: 4px;
}
/* Bulma removes the outline on inputs; put the ring back. */
.input:focus-visible,
.textarea:focus-visible {
    outline: 3px solid var(--accent);
    outline-offset: 2px;
}
/* The skip link's target; focus moves here but needs no ring. */
main:focus { outline: none; }

/* Skip link (#20): first focusable element, hidden until focused. */
.skip-link {
    position: absolute;
    top: 0.5rem;
    left: 0.5rem;
    z-index: 100;
    padding: 0.6rem 1rem;
    border-radius: var(--radius-small);
    background: var(--accent);
    color: var(--surface);
    font-weight: 600;
    transform: translateY(calc(-100% - 1rem));
}
.skip-link:focus { transform: none; color: var(--surface); }

/* 03. Shared pieces ------------------------------------------------------ */
.g-button {
    display: inline-flex;
    align-items: center;
    min-height: 44px;
    padding: 0.6rem 1.15rem;
    border-radius: var(--radius-small);
    font-weight: 600;
    text-decoration: none;
    border: 1px solid transparent;
}
.g-button--primary {
    background: var(--accent);
    color: var(--accent-ink);
}
.g-button--primary:hover { filter: brightness(1.1); color: var(--accent-ink); }
.g-button--secondary {
    background: var(--surface);
    color: var(--accent);
    border-color: var(--line);
}
.g-button--secondary:hover { border-color: var(--accent); color: var(--accent); }

.g-link {
    display: inline-flex;
    align-items: center;
    min-height: 44px;
    color: var(--accent);
    font-weight: 600;
    text-decoration: underline;
    text-underline-offset: 3px;
}
.g-link:hover { color: var(--accent); text-decoration-thickness: 2px; }

/* The theme adds an external-link icon to every http link; the garden
   nav and footer mark external links with ↗ instead. */
.garden-nav a[href^="http"],
.garden-footer a[href^="http"] {
    background-image: none;
    padding-right: 0;
}
.garden-nav .navbar-item[href^="http"] { padding-right: 0.75rem; }
.garden-home time,
.garden-footer time { display: inline; }

/* 04. Nav ------------------------------------------------------------------ */
.garden-nav.navbar {
    background: var(--ground);
    border-bottom: 1px solid var(--line);
    min-height: 4rem;
}
.garden-nav__inner {
    display: flex;
    align-items: center;
    width: 100%;
    max-width: var(--content-width);
    margin: 0 auto;
    padding: 0 1.5rem;
}
.garden-nav .navbar-brand { align-items: center; flex: 1 1 auto; }
.garden-nav__brand {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    min-height: 44px;
    font-family: var(--font-display);
    font-weight: 600;
    font-size: 1.1rem;
    color: var(--ink);
    text-decoration: none;
}
.garden-nav__brand:hover { color: var(--ink); }
.garden-nav__sprout { color: var(--accent); flex: none; }
.garden-nav .navbar-menu { background: transparent; }
.garden-nav .navbar-item {
    color: var(--ink);
    font-weight: 500;
    min-height: 44px;
}
.garden-nav a.navbar-item:hover,
.garden-nav a.navbar-item:focus-visible {
    background: transparent;
    color: var(--accent);
    text-decoration: underline;
    text-underline-offset: 4px;
}
.garden-nav .navbar-burger {
    color: var(--ink);
    background: transparent;
    border: 0;
    padding: 0;
    width: 44px;
    height: 44px;
    margin-left: 0;
}
.theme-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    margin-left: auto;
    padding: 0;
    border: 1px solid transparent;
    border-radius: var(--radius-small);
    background: transparent;
    color: var(--ink);
    cursor: pointer;
}
.theme-toggle:hover { border-color: var(--line); color: var(--accent); }
.theme-toggle__sun { display: none; }
html[data-theme="dark"] .theme-toggle__sun { display: block; }
html[data-theme="dark"] .theme-toggle__moon { display: none; }
@media (prefers-color-scheme: dark) {
    html:not([data-theme]) .theme-toggle__sun { display: block; }
    html:not([data-theme]) .theme-toggle__moon { display: none; }
}
/* DOM order = brand, links, toggle, burger (matches desktop focus order).
   Below 1024px: brand + toggle + burger share the top row, menu drops below. */
.garden-nav .navbar-burger { display: none; }
@media screen and (max-width: 1023px) {
    .garden-nav .navbar-brand { order: 0; flex: 1 1 0; min-width: 0; width: auto; }
    .garden-nav .theme-toggle { order: 1; margin-left: 0; }
    .garden-nav .navbar-burger { display: block; order: 2; }
    .garden-nav .navbar-menu { order: 3; flex-basis: 100%; }
}
@media screen and (min-width: 1024px) {
    .garden-nav .navbar-brand { margin-right: auto; }
    .garden-nav .theme-toggle { margin-left: 0.5rem; }
}

@media screen and (max-width: 1023px) {
    .garden-nav__inner { flex-wrap: wrap; padding: 0 1rem; }
    .garden-nav .navbar-menu.is-active {
        width: 100%;
        padding: 0.5rem 0 1rem;
        box-shadow: none;
        background: var(--ground);
    }
}

/* 05. Homepage ------------------------------------------------------------- */
.garden-home {
    max-width: var(--content-width);
    margin: 0 auto;
    padding: 0 0.75rem 4rem;
}
.garden-home h1,
.garden-home h2 { color: var(--ink); }

.home-hero {
    display: grid;
    grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr);
    gap: 2.5rem;
    align-items: start;
    padding: 2.5rem 0 3rem;
}
.home-hero__eyebrow {
    font-family: var(--font-mono);
    font-size: 0.8rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--accent);
    margin-bottom: 1rem;
}
.home-hero__title {
    font-size: clamp(2.1rem, 4.6vw, 3.6rem);
    line-height: 1.05;
    font-weight: 700;
    margin-bottom: 1.25rem;
    max-width: 18ch;
}
.home-hero__intro {
    font-size: 1.1rem;
    line-height: 1.6;
    color: var(--muted);
    max-width: 52ch;
    margin-bottom: 1.75rem;
}
.home-hero__actions { display: flex; flex-wrap: wrap; gap: 0.75rem; }

.now-card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 1.5rem;
    scroll-margin-top: 1.5rem;
}
.now-card__head {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 0.75rem;
}
.now-card__title { font-size: 1.2rem; font-weight: 600; }
.now-card__quarter { font-family: var(--font-mono); font-size: 0.85rem; color: var(--muted); }
.now-card__list { list-style: none; margin: 0; padding: 0; }
.now-card__item {
    position: relative;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    padding: 0.7rem 0;
    border-bottom: 1px solid var(--line);
}
.now-card__item a { color: var(--ink); font-weight: 500; text-decoration: none; }
.now-card__item a::after,
.recent__title::after { content: ""; position: absolute; inset: 0; } /* whole row is the tap target */
.now-card__item a:hover { color: var(--accent); text-decoration: underline; }
.now-card__item .stage-chip { flex: none; }
.now-card__meta { margin-top: 0.9rem; font-size: 0.85rem; color: var(--muted); }
.now-card__meta a { color: var(--accent); text-decoration: underline; }

.stage-legend {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1rem;
    margin-bottom: 3.5rem;
}
.stage-legend__item {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 1.1rem 1.25rem;
}
.stage-legend__item p { margin-top: 0.6rem; color: var(--ink); line-height: 1.5; }

.home-section-title {
    font-size: clamp(1.5rem, 2.6vw, 2rem);
    font-weight: 600;
    margin-bottom: 1.25rem;
}

.recent { margin-bottom: 3.5rem; }
.recent__list {
    list-style: none;
    margin: 0 0 0.75rem;
    padding: 0;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
}
.recent__item {
    position: relative;
    display: grid;
    grid-template-columns: 7rem minmax(0, 1fr) auto;
    gap: 1rem;
    align-items: start;
    padding: 1.1rem 1.25rem;
    border-bottom: 1px solid var(--line);
}
.recent__item:last-child { border-bottom: 0; }
.recent__list p { display: block; } /* theme sets `ol p { display: contents }` */
.recent__stage { padding-top: 0.2rem; }
.recent__title {
    display: block;
    font-family: var(--font-display);
    font-weight: 600;
    font-size: 1.1rem;
    color: var(--ink);
    text-decoration: none;
}
.recent__title:hover { color: var(--accent); text-decoration: underline; }
.recent__excerpt { display: block; margin-top: 0.25rem; color: var(--muted); font-size: 0.95rem; line-height: 1.5; }
.recent__meta {
    font-family: var(--font-mono);
    font-size: 0.8rem;
    color: var(--muted);
    text-align: right;
    white-space: nowrap;
    padding-top: 0.25rem;
}

.rolodex-teaser__head {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    flex-wrap: wrap;
    gap: 0.5rem;
}
.rolodex-teaser__grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;
}
.rolodex-teaser__card {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 1.25rem 1.4rem;
    color: var(--ink);
    text-decoration: none;
}
.rolodex-teaser__card:hover { border-color: var(--accent); color: var(--ink); }
.rolodex-teaser__top { display: flex; justify-content: space-between; gap: 1rem; align-items: baseline; }
.rolodex-teaser__term { font-family: var(--font-display); font-weight: 600; font-size: 1.15rem; }
.rolodex-teaser__tags { font-family: var(--font-mono); font-size: 0.75rem; color: var(--muted); white-space: nowrap; }
.rolodex-teaser__label { font-family: var(--font-mono); font-size: 0.75rem; color: var(--accent); }
.rolodex-teaser__text { line-height: 1.55; }

/* 06. Note page (#17, 7b) ------------------------------------------------ */
.note-page {
    max-width: var(--content-width);
    margin: 0 auto;
    padding: 0 0.75rem 3rem;
}
.breadcrumb-trail ol {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem 0.5rem;
    list-style: none;
    margin: 0 0 1.25rem;
    padding: 0;
    font-family: var(--font-mono);
    font-size: 0.85rem;
    color: var(--muted);
}
.breadcrumb-trail li + li::before { content: "/"; margin-right: 0.5rem; color: var(--muted); }
.breadcrumb-trail a {
    display: inline-flex;
    align-items: center;
    min-height: 44px;
    margin: -0.75rem 0;
    color: var(--accent);
    text-decoration: underline;
    text-underline-offset: 3px;
}
.note-header {
    max-width: 46rem;
    padding-bottom: 1.25rem;
    margin-bottom: 2rem;
    border-bottom: 1px solid var(--line);
}
.note-title {
    font-size: clamp(2rem, 4vw, 3rem);
    line-height: 1.1;
    font-weight: 700;
    color: var(--ink);
    margin-bottom: 1rem;
}
.note-header .note-meta { margin: 0; gap: 0.5rem 1.25rem; }
.note-date {
    font-family: var(--font-mono);
    font-size: 0.85rem;
    color: var(--muted);
}
.note-tag {
    padding: 0.15rem 0.6rem;
    border: 1px solid var(--line);
    border-radius: 999px;
    font-size: 0.8rem;
    background: var(--surface);
}
.note-grid {
    display: grid;
    grid-template-columns: minmax(0, 46rem) minmax(0, 20rem);
    justify-content: space-between;
    gap: 3rem;
    align-items: start;
}
.note-article { min-width: 0; }
.note-article .content { color: var(--ink); line-height: 1.7; }
.note-article .content a:not(.stale-link) {
    color: var(--accent);
    text-decoration: underline;
    text-underline-offset: 3px;
}
.note-article .content > h2,
.note-article .content > h3 { color: var(--ink); scroll-margin-top: 1.5rem; }
/* Code blocks (all pages): dark panel per the mockup, readable in both themes. fruity.css is a dark-background
   theme driven by CSS variables, so re-point them here (all >= 5.4:1 on ink). */
.highlight {
    --color-border-light: #17231C;
    --color-text: #E6EBE2;
    --color-text-main: #E6EBE2;
    --color-text-link: #8CB4F2;
    --highlight-color-green: #8FB89A;
    --highlight-color-comment-bg: transparent;
    --highlight-color-pink: #FF8FC0;
    --highlight-color-red: #FF7B72;
    --highlight-color-khaki: #D4C76A;
    --highlight-color-grey: #A9B5AC;
}
pre.highlight {
    background: #17231C;
    color: #E6EBE2;
    border-radius: var(--radius);
    padding: 1.25rem 1.4rem;
    overflow-x: auto;
}
.note-article--list .content ul { padding-left: 0; }
.note-article--list .content li {
    list-style: none;
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--line);
}

.note-sidebar { display: grid; gap: 1rem; position: sticky; top: 1.5rem; }
.note-card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 1.25rem 1.4rem;
}
.note-card__title {
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--ink);
    margin-bottom: 0.75rem;
}
.note-card__sub { margin: -0.5rem 0 0.75rem; font-size: 0.85rem; color: var(--muted); }

.growth { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.6rem; }
.growth__step { display: flex; align-items: center; gap: 0.6rem; color: var(--muted); }
.growth__dot {
    flex: none;
    width: 0.75rem;
    height: 0.75rem;
    border-radius: 50%;
    border: 2px solid var(--accent);
    background: transparent;
}
.growth__step--done .growth__dot,
.growth__step--current .growth__dot { border-color: transparent; }
.growth__step--seedling .growth__dot { background: #7A9A3A; }
.growth__step--budding .growth__dot { background: #C27A2C; }
.growth__step--evergreen .growth__dot { background: var(--accent); }
.growth__step--future .growth__dot { background: transparent; border-color: var(--muted); }
.growth__step--current { color: var(--ink); font-weight: 600; }
.growth__step--current .growth__dot { box-shadow: 0 0 0 3px var(--line); }

.toc { list-style: none; margin: 0; padding: 0; }
.toc__item a {
    display: flex;
    align-items: center;
    min-height: 44px;
    color: var(--accent);
    text-decoration: none;
}
.toc__item a:hover { text-decoration: underline; }
.toc__item--h3 a { padding-left: 1rem; font-size: 0.95rem; }

.backlinks.hide { display: none; }
.backlinks__list { list-style: none; margin: 0; padding: 0; }
.backlinks__item a {
    display: block;
    padding: 0.6rem 0;
    min-height: 44px;
    color: var(--ink);
    text-decoration: none;
    border-top: 1px solid var(--line);
}
.backlinks__item:first-child a { border-top: 0; }
.backlinks__item a:hover .backlinks__title { color: var(--accent); text-decoration: underline; }
.backlinks__title { display: block; font-weight: 600; }
.backlinks__excerpt { display: block; font-size: 0.8rem; color: var(--muted); }

@media screen and (max-width: 900px) {
    .note-grid { grid-template-columns: 1fr; gap: 2rem; }
    .note-sidebar { position: static; }
}

/* Older page types (/notes, posts, static pages) — headings promoted from
   div/h6 for a correct outline (#20); keep their previous look. */
h1.jumbo { padding: 0; }
p.meta-title { margin: 0; }
.notelist-feed .notelist-feed__title {
    font-family: var(--font-body);
    font-size: var(--text-m);
    font-weight: var(--text-weight-bold);
    line-height: var(--text-leading-normal);
    letter-spacing: normal;
    padding: 0.4rem 0;
}

/* Page previews open on keyboard focus as well as hover (WCAG 1.4.13). */
.tooltip:focus-within .right { display: block; }

/* 07. Footer --------------------------------------------------------------- */
.garden-footer {
    border-top: 1px solid var(--line);
    margin-top: 2rem;
}
.garden-footer__inner {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.75rem 1.5rem;
    max-width: var(--content-width);
    margin: 0 auto;
    padding: 1.5rem;
    color: var(--muted);
}
.garden-footer__inner,
.garden-footer__inner p,
.garden-footer__links a { font-size: 0.9rem; }
.garden-footer__links { display: flex; gap: 1.25rem; }
.garden-footer__links a {
    display: inline-flex;
    align-items: center;
    min-height: 44px;
    color: var(--accent);
    text-decoration: underline;
    text-underline-offset: 3px;
}

/* 08. Responsive ----------------------------------------------------------- */
@media screen and (max-width: 900px) {
    .home-hero { grid-template-columns: 1fr; gap: 2rem; padding-top: 1.5rem; }
    .stage-legend { grid-template-columns: 1fr; }
    .rolodex-teaser__grid { grid-template-columns: 1fr; }
}
@media screen and (max-width: 600px) {
    .recent__item { grid-template-columns: 1fr; gap: 0.5rem; }
    .recent__meta { text-align: left; white-space: normal; padding-top: 0; }
    .garden-footer__inner { flex-direction: column; align-items: flex-start; }
    .rolodex-teaser__top { flex-direction: column; gap: 0.25rem; }
}

/* 08b. Rolodex page (/note/Rolodex) -------------------------------------- */
/* Data: _data/terms.yml. Card: _includes/term-card.html. Filters: assets/js/terms.js.
   The theme's .content list/heading styles are reset inside .rolodex-page. */
.rolodex-page { margin-top: 1.75rem; width: 100%; }
.rolodex-page ul { list-style: none; margin: 0; padding: 0; }
.rolodex-page li + li { margin-top: 0; }
.rolodex-page p { margin: 0; }

.rolodex-stats {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.75rem;
    width: 100%;
    margin: 0 0 1.5rem;
}
.rolodex-stats__item {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 0.9rem 1.1rem;
}
.rolodex-stats dt {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    font-weight: 500;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--muted);
}
.rolodex-stats dd {
    margin: 0.2rem 0 0;
    font-family: var(--font-display);
    font-size: 1.6rem;
    font-weight: 600;
    line-height: 1.2;
    color: var(--ink);
}
.rolodex-stats time { display: inline; }

/* Filter bar: text filter + topics (JS only) and the A–Z bar (always). */
.rolodex-bar {
    z-index: 5;
    display: grid;
    gap: 0.75rem;
    margin: 0 -0.75rem 0.5rem;
    padding: 0.75rem;
    background: var(--ground);
    border-bottom: 1px solid var(--line);
}
.rolodex-bar__controls {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 0.75rem 1rem;
}
.rolodex-bar__controls[hidden] { display: none; }
.rolodex-bar__search { display: grid; gap: 0.3rem; flex: 1 1 14rem; }
.rolodex-bar__search label {
    font-family: var(--font-mono);
    font-size: 0.8rem;
    color: var(--muted);
}
.rolodex-bar__input {
    min-height: 44px;
    width: 100%;
    padding: 0.5rem 0.85rem;
    border: 1px solid var(--muted);
    border-radius: var(--radius-small);
    background: var(--surface);
    color: var(--ink);
    font: inherit;
}
.rolodex-bar__input::placeholder { color: var(--muted); opacity: 1; }
.rolodex-bar__topics { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.topic-button {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    min-height: 44px;
    padding: 0.4rem 0.9rem;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: var(--surface);
    color: var(--ink);
    font: inherit;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
}
.topic-button:hover { border-color: var(--accent); }
.topic-button__count { font-family: var(--font-mono); font-size: 0.8rem; color: var(--muted); }
.topic-button[aria-pressed="true"] {
    background: var(--accent);
    border-color: var(--accent);
    color: var(--accent-ink);
}
.topic-button[aria-pressed="true"] .topic-button__count { color: var(--accent-ink); }
.rolodex-bar__status {
    flex-basis: 100%;
    font-family: var(--font-mono);
    font-size: 0.8rem;
    color: var(--muted);
}
.rolodex-bar__status:empty { display: none; }

.az__list { display: flex; flex-wrap: wrap; gap: 0.3rem; }
.rolodex-page .az__list li { display: flex; margin: 0; padding: 0; }
.az__letter {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    border-radius: 6px;
    font-family: var(--font-mono);
    font-size: 0.85rem;
}
.rolodex-page .az a.az__letter {
    border: 1px solid var(--line);
    background: var(--surface);
    color: var(--accent);
    font-weight: 600;
    text-decoration: none;
}
.rolodex-page .az a.az__letter:hover { border-color: var(--accent); text-decoration: underline; }
.az__letter--empty { color: var(--muted); font-weight: 400; }

/* Letter groups read as rolodex dividers: a green tab on a green rule. */
.letter-group {
    position: relative;
    margin-top: 3.25rem;
    padding-top: 1.25rem;
    border-top: 2px solid var(--accent);
}
.letter-group[hidden] { display: none; }
.rolodex-page .letter-group__letter {
    position: absolute;
    top: calc(-2.25rem - 2px);
    left: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 3rem;
    height: 2.25rem;
    margin: 0;
    padding: 0 0.9rem;
    border-radius: var(--radius-small) var(--radius-small) 0 0;
    background: var(--accent);
    color: var(--accent-ink);
    font-size: 1.25rem;
    font-weight: 700;
    line-height: 1;
    scroll-margin-top: 1rem;
}

.term-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 19rem), 1fr));
    gap: 1rem;
}
.term-card {
    display: flex;
    flex-direction: column;
    gap: 0.9rem;
    min-width: 0;
    padding: 1.25rem 1.3rem 1rem;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    scroll-margin-top: 1rem;
}
.term-card[hidden] { display: none; }
.term-card:hover { border-color: var(--accent); }
.term-card__head { display: flex; flex-direction: row; justify-content: space-between; align-items: flex-start; gap: 0.75rem; }
.rolodex-page .term-card__term {
    margin: 0;
    padding: 0;
    font-size: 1.2rem;
    font-weight: 600;
    line-height: 1.25;
    color: var(--ink);
    overflow-wrap: anywhere;
}
.term-card__head .stage-chip { flex: none; }
.term-card__topics { display: flex; flex-wrap: wrap; gap: 0.35rem; }
.term-card__topics li {
    padding: 0.05rem 0.55rem;
    border: 1px solid var(--line);
    border-radius: 999px;
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: var(--muted);
}
.term-card__label {
    font-family: var(--font-mono);
    font-size: 0.72rem;
    font-weight: 500;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--muted);
    margin-bottom: 0.25rem !important;
}
.term-card__mine .term-card__label { color: var(--accent); }
.term-card p code { font-size: 0.85em; padding: 0.05em 0.3em; }
.term-card__mine p:last-child { font-size: 1.08rem; line-height: 1.55; color: var(--ink); }
.term-card__official p:last-child { font-size: 0.875rem; line-height: 1.55; color: var(--muted); }
.term-card__foot {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0 1.25rem;
    margin-top: auto;
    padding-top: 0.5rem;
    border-top: 1px solid var(--line);
}
.term-card__example[open] { flex: 1 0 100%; }
.term-card__example summary,
.rolodex-page a.term-card__link {
    display: inline-flex;
    align-items: center;
    min-height: 44px;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--accent);
}
.term-card__example summary { cursor: pointer; gap: 0.4rem; list-style: none; }
.term-card__example summary::-webkit-details-marker { display: none; }
.term-card__example summary::before {
    content: "";
    width: 0.45rem;
    height: 0.45rem;
    border-right: 2px solid currentColor;
    border-bottom: 2px solid currentColor;
    transform: rotate(-45deg);
    transition: transform 0.15s ease;
}
.term-card__example[open] summary::before { transform: rotate(45deg); }
.term-card__example summary:hover { text-decoration: underline; }
.rolodex-page a.term-card__link {
    text-decoration: underline;
    text-underline-offset: 3px;
    background-image: none; /* theme's external-link icon; ↗ marks it instead */
    padding-right: 0;
}
.rolodex-page a.term-card__link:hover { text-decoration-thickness: 2px; }
.term-card__example pre {
    margin: 0 0 0.75rem;
    padding: 0.9rem 1rem;
    border: 1px solid var(--line);
    border-radius: var(--radius-small);
    background: #17231C;
    color: #E6EBE2;
    font-family: var(--font-mono);
    font-size: 0.8rem;
    line-height: 1.6;
    overflow-x: auto;
}
.term-card__example pre code { background: none; color: inherit; padding: 0; font-size: inherit; }

.rolodex-empty { margin-top: 2rem !important; color: var(--muted); }
.rolodex-empty[hidden] { display: none; }

@media screen and (min-width: 768px) {
    .rolodex-bar { position: sticky; top: 0; }
    .rolodex-page .letter-group__letter,
    .term-card { scroll-margin-top: calc(var(--rolodex-bar-h, 5rem) + 3rem); }
}
@media screen and (max-width: 600px) {
    .rolodex-stats { gap: 0.5rem; }
    .rolodex-stats__item { padding: 0.75rem; }
    .rolodex-stats dd { font-size: 1.25rem; }
}

/* 09. Motion --------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    *, *::before, *::after { transition: none !important; animation: none !important; }
}
