/* ===== DESIGN TOKENS =====
   Default = dark (neutral grey ground; the 朱 accent carries the colour).
   Light is opt-in via :root[data-theme="light"]. Every rule reads var()s,
   so the whole site flips. Toggle in the lang-switch (see theme script). */
:root {
  --paper: #1C1D1F;        /* general canvas (dark) */
  --paper-alt: #232427;    /* alternating sections */
  --paper-raised: #26272A; /* cards / boxes */
  --ink: #E7E7E9;          /* primary text */
  --ink-soft: #ABACB0;     /* secondary text */
  --ink-faint: #7D7E83;    /* meta / labels */
  --hairline: #343539;     /* 1px rules */
  --accent: #D4622C;       /* 朱 accent — links, active, rules */
  --accent-soft: rgba(212, 98, 44, 0.16);
  --font-serif: 'Noto Serif', 'Noto Serif JP', Georgia, serif;
  --font-sans: 'Noto Sans JP', 'Helvetica Neue', Arial, sans-serif;
}

:root[data-theme="light"] {
  --paper: #F7F4EC;
  --paper-alt: #EFEAE0;
  --paper-raised: #FBF9F3;
  --ink: #1C1A17;
  --ink-soft: #6B665D;
  --ink-faint: #9A958A;
  --hairline: #E3DDD0;
  --accent: #B7410E;
  --accent-soft: rgba(183, 65, 14, 0.10);
}

/* ===== RESET & BASE ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
    font-size: 18px;
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-serif);
    color: var(--ink);
    background: var(--paper);
    line-height: 1.8;
}

/* ===== LANGUAGE SWITCHER ===== */
.lang-switch {
    position: fixed;
    top: 1rem;
    right: 1rem;
    z-index: 100;
    display: flex;
    align-items: center;
    gap: 0.25rem;
    background: var(--paper-raised);
    backdrop-filter: blur(8px);
    border: 1px solid var(--hairline);
    border-radius: 4px;
    padding: 0.15rem;
}

.lang-btn {
    font-family: var(--font-sans);
    font-size: 0.7rem;
    font-weight: 400;
    letter-spacing: 0.05em;
    padding: 0.25rem 0.5rem;
    border: none;
    background: none;
    color: var(--ink-faint);
    cursor: pointer;
    border-radius: 3px;
    transition: all 0.15s;
}

.lang-btn:hover { color: var(--ink-soft); }
.lang-btn.active {
    color: var(--ink);
    background: var(--accent-soft);
    font-weight: 600;
}

/* Theme toggle, sits with the language buttons */
.theme-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.2rem 0.4rem;
    border: none;
    background: none;
    color: var(--ink-faint);
    cursor: pointer;
    border-radius: 3px;
    transition: color 0.15s, background 0.15s;
}
.theme-btn:hover { color: var(--ink); background: var(--accent-soft); }
/* default (dark) shows the sun (→ go light); light shows the moon */
.theme-btn .icon-moon { display: none; }
.theme-btn .icon-sun { display: inline-flex; }
:root[data-theme="light"] .theme-btn .icon-sun { display: none; }
:root[data-theme="light"] .theme-btn .icon-moon { display: inline-flex; }

/* 書 seal mark next to the Epistemos heading (matches the app logo) */
.epi-seal {
    color: var(--accent);
    vertical-align: -0.35em;
    margin-right: 0.4rem;
}

/* ===== LAYOUT ===== */
.content {
    max-width: 720px;
    margin: 0 auto;
    padding: 0 1.5rem;
}

.section {
    padding: 4rem 0;
}

.section-dark {
    background: var(--paper-alt);
    color: var(--ink);
}

/* ===== HERO ===== */
.hero {
    text-align: center;
    padding: 8rem 1.5rem 5rem;
    background: var(--paper-alt);
    color: var(--ink);
    position: relative;
    overflow: hidden;
}

/* 梅に鳥 — hero nature motif (Rinpa line art), a quiet corner accent.
   Branch in faint ink (currentColor), the bird carries the 朱 accent. */
.hero-motif {
    position: absolute;
    top: 0;
    right: 0;
    width: 260px;
    max-width: 42%;
    height: auto;
    color: var(--ink-faint);
    opacity: 0.55;
    pointer-events: none;
}

@media (max-width: 640px) {
    .hero-motif {
        width: 170px;
        opacity: 0.4;
    }
}

.title-ja {
    font-family: 'Noto Serif JP', serif;
    font-size: 3.5rem;
    font-weight: 300;
    letter-spacing: 0.15em;
    margin-bottom: 0.5rem;
}

.title-romanized {
    font-family: var(--font-serif);
    font-size: 1rem;
    font-weight: 300;
    letter-spacing: 0.3em;
    text-transform: uppercase;
    color: var(--ink-faint);
    margin-bottom: 1.5rem;
}

.subtitle {
    font-family: var(--font-serif);
    font-size: 1.1rem;
    font-weight: 300;
    font-style: italic;
    color: var(--ink-soft);
}

/* ===== TEXT ===== */
h2 {
    font-family: var(--font-serif);
    font-size: 1.5rem;
    font-weight: 400;
    margin-bottom: 1.5rem;
    letter-spacing: 0.02em;
}

.section-dark h2 {
    color: var(--ink);
}

p {
    margin-bottom: 1rem;
}

p:last-child {
    margin-bottom: 0;
}

em {
    font-style: italic;
    color: var(--ink-soft);
}

.section-dark em {
    color: var(--accent);
}

.big-quote {
    font-size: 1.3rem;
    font-style: italic;
    text-align: center;
    padding: 1.5rem 0 2.5rem;
    color: var(--accent);
    line-height: 1.6;
}

/* ===== AXIS GRID ===== */
.axis-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    margin-top: 1rem;
}

.axis-card {
    background: var(--paper-raised);
    border: 1px solid var(--hairline);
    border-radius: 4px;
    padding: 1.5rem;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
}

.axis-ja {
    font-family: 'Noto Serif JP', serif;
    font-size: 2rem;
    font-weight: 300;
    display: block;
    margin-bottom: 0.25rem;
    color: var(--accent);
}

.axis-name {
    font-family: var(--font-sans);
    font-size: 0.75rem;
    font-weight: 400;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: var(--ink-faint);
    display: block;
    margin-bottom: 0.75rem;
}

.axis-card p {
    font-size: 0.85rem;
    line-height: 1.7;
    color: var(--ink-soft);
}

/* ===== FRAGMENT SAMPLE ===== */
.sample-ref {
    font-family: var(--font-sans);
    font-size: 0.8rem;
    color: var(--ink-faint);
    letter-spacing: 0.1em;
    text-transform: uppercase;
    margin-bottom: 1.5rem;
}

.fragment-box {
    background: var(--paper-raised);
    border: 1px solid var(--hairline);
    border-radius: 4px;
    overflow: hidden;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
}

.fragment-label {
    font-family: var(--font-sans);
    font-size: 0.65rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--ink-faint);
    margin-bottom: 0.5rem !important;
}

.fragment-label-rtl {
    font-family: var(--font-sans);
    font-size: 0.65rem;
    letter-spacing: 0.1em;
    color: var(--ink-faint);
    margin-bottom: 0.5rem !important;
    direction: ltr;
    text-align: left;
}

.fragment-hebrew {
    padding: 1.25rem;
    direction: rtl;
    text-align: right;
    font-size: 1.2rem;
    line-height: 1.8;
    color: var(--accent);
    border-bottom: 1px solid var(--hairline);
}

.fragment-hebrew p {
    margin-bottom: 0.25rem;
}

.fragment-translation {
    padding: 1.25rem;
    font-family: 'Noto Serif JP', serif;
    font-size: 1rem;
    line-height: 1.75;
    color: var(--ink);
    border-bottom: 1px solid var(--hairline);
}

.fragment-grid {
    display: grid;
    grid-template-columns: 1fr;
}

.fragment-translation p {
    margin-bottom: 0.3rem;
}

.fragment-note {
    padding: 1.25rem;
    font-size: 0.85rem;
    line-height: 1.7;
    color: var(--ink-soft);
}

.fragment-note strong {
    font-family: var(--font-sans);
    font-size: 0.75rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--ink);
}

/* ===== LOCALE GRID ===== */
.locale-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.5rem;
    margin-top: 1.5rem;
}

.locale-card {
    border: 1px solid var(--hairline);
    border-radius: 4px;
    padding: 1.5rem;
}

.locale-script {
    font-size: 1.1rem;
    font-weight: 400;
    display: block;
    margin-bottom: 0.25rem;
}

.locale-lang {
    font-family: var(--font-sans);
    font-size: 0.7rem;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: var(--ink-faint);
    display: block;
    margin-bottom: 0.75rem;
}

.locale-axes {
    font-family: var(--font-sans);
    font-size: 0.75rem;
    color: var(--ink-faint);
    font-style: italic;
}

.locale-status {
    display: inline-block;
    font-family: var(--font-sans);
    font-size: 0.65rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    padding: 0.15rem 0.5rem;
    border-radius: 3px;
    margin-top: 0.75rem;
}

.status-active { background: #d4edda; color: #155724; }
.status-design { background: #fff3cd; color: #856404; }
.status-planned { background: #e8e4dc; color: #666; }

/* ===== FOOTER ===== */
.footer {
    padding: 3rem 0;
    background: var(--paper-alt);
    color: var(--ink-soft);
    text-align: center;
    font-size: 0.85rem;
}

.footer-name {
    font-family: 'Noto Serif JP', serif;
    color: var(--ink-soft);
    margin-bottom: 0.5rem;
}

.footer-contact {
    font-family: var(--font-sans);
    font-size: 0.75rem;
    color: var(--ink-soft);
}

.footer-resources {
    margin-top: 1.5rem;
    font-family: var(--font-sans);
    font-size: 0.8rem;
    color: var(--ink-soft);
    font-style: italic;
}

.footer-support {
    margin-top: 0.75rem;
}

.kofi-link {
    display: inline-block;
    padding: 0.5rem 1.5rem;
    border: 1px solid var(--hairline);
    border-radius: 4px;
    color: var(--ink-soft);
    text-decoration: none;
    font-family: var(--font-sans);
    font-size: 0.8rem;
    transition: border-color 0.2s, color 0.2s;
}

.kofi-link:hover {
    border-color: var(--ink);
    color: var(--ink);
}

.footer-license {
    margin-top: 1.5rem;
    padding-top: 1rem;
    border-top: 1px solid var(--hairline);
    font-family: var(--font-sans);
    font-size: 0.72rem;
    color: var(--ink-faint);
}

.footer-license a {
    color: var(--ink-soft);
    text-decoration: none;
    border-bottom: 1px solid var(--hairline);
}

.footer-license a:hover {
    color: var(--ink);
    border-color: var(--ink-soft);
}

/* ===== ESSAY CTA ===== */
.essay-cta {
    text-align: center;
}

.essay-link {
    display: inline-block;
    margin-top: 0.5rem;
    font-size: 0.95rem;
    color: var(--ink-soft);
    text-decoration: none;
    border-bottom: 1px solid var(--hairline);
    padding-bottom: 2px;
    transition: color 0.15s, border-color 0.15s;
}

.essay-link:hover {
    color: var(--ink);
    border-color: var(--ink);
}

/* ===== ESSAY PAGE ===== */
.hero-small {
    padding: 2rem 2rem 1rem;
    text-align: center;
}

.home-link {
    color: inherit;
    text-decoration: none;
    border-bottom: 1px solid transparent;
    transition: border-color 0.15s;
}

.home-link:hover {
    border-bottom-color: var(--ink-faint);
}

.essay-content {
    max-width: 780px;
    margin: 0 auto;
}

.essay-content h1 {
    font-size: 1.6rem;
    font-weight: 400;
    margin-bottom: 1rem;
    line-height: 1.4;
}

.essay-content h2 {
    font-size: 1.2rem;
    font-weight: 600;
    margin: 2rem 0 0.8rem;
    color: var(--ink);
}

.essay-content h3 {
    font-size: 1rem;
    font-weight: 600;
    margin: 1.5rem 0 0.5rem;
    color: var(--ink-soft);
}

.essay-content p {
    margin-bottom: 0.8rem;
}

.essay-content blockquote {
    border-left: 3px solid var(--hairline);
    padding-left: 1rem;
    margin: 1rem 0;
    color: var(--ink-soft);
    font-style: italic;
}

.essay-content ul, .essay-content ol {
    padding-left: 1.5rem;
    margin-bottom: 0.8rem;
}

.essay-content li {
    margin-bottom: 0.4rem;
}

.essay-content table {
    width: 100%;
    border-collapse: collapse;
    margin: 1rem 0;
    font-size: 0.9rem;
}

.essay-content th, .essay-content td {
    border: 1px solid var(--hairline);
    padding: 0.5rem 0.8rem;
    text-align: left;
}

.essay-content th {
    background: var(--paper-alt);
    font-weight: 600;
}

.essay-content hr {
    border: none;
    border-top: 1px solid var(--hairline);
    margin: 2rem 0;
}

/* ===== PHRASE CARDS (used in axes.html) ===== */
.phrase-card {
    border: 1px solid var(--hairline);
    border-radius: 4px;
    padding: 0.9rem 1.25rem;
    margin-bottom: 0.6rem;
}

.phrase-head {
    display: flex;
    align-items: baseline;
    gap: 0.85rem;
    margin-bottom: 0.4rem;
    flex-wrap: wrap;
}

.phrase-jp {
    font-family: 'Noto Serif JP', serif;
    font-size: 1.35rem;
    font-weight: 500;
    color: var(--ink);
}

.phrase-romaji {
    font-family: var(--font-sans);
    font-size: 0.9rem;
    color: #c8645a;
    font-style: italic;
    letter-spacing: 0.03em;
}

.phrase-card p {
    margin-bottom: 0.35rem;
    font-size: 0.95rem;
    line-height: 1.55;
}

.phrase-card .when {
    font-size: 0.82rem;
    color: var(--ink-faint);
    margin-bottom: 0;
    line-height: 1.5;
}

.phrase-card .when em {
    color: var(--ink-faint);
    font-style: italic;
}

/* ===== ROADMAP ===== */
.progress-label {
    font-family: var(--font-sans);
    font-size: 0.85rem;
    color: var(--ink-faint);
    letter-spacing: 0.05em;
}

.progress-bar {
    width: 100%;
    height: 4px;
    background: var(--hairline);
    border-radius: 2px;
    margin: 0.75rem 0 1rem;
    overflow: hidden;
}

.section:not(.section-dark) .progress-bar {
    background: var(--hairline);
}

.progress-fill {
    height: 100%;
    background: var(--accent);
    border-radius: 2px;
}

.roadmap {
    margin-top: 1.5rem;
}

.roadmap-phase {
    margin-bottom: 2rem;
    padding-left: 1.5rem;
    border-left: 2px solid var(--hairline);
}

.roadmap-phase:last-child {
    margin-bottom: 0;
}

.section-dark .roadmap-phase {
    border-left-color: var(--hairline);
}

.roadmap-phase.phase-done {
    border-left-color: #5a8a5e;
}

.roadmap-phase.phase-current {
    border-left-color: var(--accent);
}

.roadmap-phase h3 {
    font-family: var(--font-sans);
    font-size: 0.8rem;
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    margin-bottom: 0.75rem;
    color: var(--ink-faint);
}

.section-dark .roadmap-phase h3 {
    color: var(--ink-faint);
}

.section-dark .phase-done h3 {
    color: #5a8a5e;
}

.section-dark .phase-current h3 {
    color: var(--accent);
}

.phase-done h3 {
    color: #5a8a5e;
}

.phase-current h3 {
    color: var(--accent);
}

.roadmap-phase ul {
    list-style: none;
    padding: 0;
}

.roadmap-phase li {
    font-size: 0.85rem;
    color: var(--ink-soft);
    margin-bottom: 0.4rem;
    padding-left: 1.25rem;
    position: relative;
    line-height: 1.6;
}

.section-dark .roadmap-phase li {
    color: var(--ink-soft);
}

.roadmap-phase li::before {
    position: absolute;
    left: 0;
    width: 1rem;
}

.phase-done li::before {
    content: '\2713';
    color: #5a8a5e;
}

.section-dark .phase-done li::before {
    color: #5a8a5e;
}

.phase-current li::before {
    content: '\2192';
    color: var(--accent);
}

.phase-planned li::before {
    content: '\25C7';
    color: var(--ink-faint);
}

.section-dark .phase-planned li::before {
    color: var(--ink-faint);
}

/* ===== RESPONSIVE ===== */
@media (max-width: 640px) {
    html { font-size: 16px; }

    .hero { padding: 5rem 1.5rem 3rem; }
    .title-ja { font-size: 2.5rem; }
    .section { padding: 3rem 0; }

    .axis-grid {
        grid-template-columns: 1fr;
    }
}

/* ===================================================================
   Dashboard (roadmap.html → #dashboard)
   =================================================================== */

#dashboard {
    margin-top: 1.5rem;
}

.dash-section {
    margin: 2rem 0;
}

.dash-h3 {
    font-family: var(--font-sans);
    font-size: 0.95rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    color: var(--ink);
    margin: 0 0 0.8rem;
    padding-bottom: 0.3rem;
    border-bottom: 1px solid var(--hairline);
}

.section:not(.section-dark) .dash-h3 {
    color: var(--ink);
    border-bottom-color: var(--hairline);
}

.dash-h4 {
    font-family: var(--font-sans);
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--accent);
    margin: 1.2rem 0 0.5rem;
}

.dash-hint {
    font-size: 0.8rem;
    color: var(--ink-faint);
    margin-bottom: 0.8rem;
    line-height: 1.5;
}

/* Cards */
.dash-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 0.8rem;
}

.dash-card {
    border: 1px solid var(--hairline);
    border-radius: 4px;
    padding: 0.9rem 1rem;
    background: var(--paper-raised);
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
}

.section:not(.section-dark) .dash-card {
    border-color: var(--hairline);
    background: var(--paper-raised);
}

.dash-card-head {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 0.5rem;
}

.dash-locale {
    font-size: 0.7rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    font-weight: 600;
    color: var(--ink-faint);
}

.dash-pct {
    font-family: var(--font-serif);
    font-size: 1.6rem;
    font-weight: 300;
    color: var(--accent);
    font-variant-numeric: tabular-nums;
}

.section:not(.section-dark) .dash-pct {
    color: var(--ink);
}

.dash-card-line {
    font-size: 0.78rem;
    color: var(--ink-soft);
    margin-top: 0.6rem;
    line-height: 1.5;
}

.section:not(.section-dark) .dash-card-line {
    color: var(--ink-soft);
}

.dash-card-sub {
    font-size: 0.72rem;
    color: var(--ink-faint);
    margin-top: 0.3rem;
    font-variant-numeric: tabular-nums;
}

.muted { color: var(--ink-faint) !important; }
.muted-small {
    color: var(--ink-faint);
    font-size: 0.72rem;
    font-variant-numeric: tabular-nums;
}

/* Bars */
.dash-bar {
    height: 6px;
    background: var(--hairline);
    border-radius: 3px;
    overflow: hidden;
    margin: 0.4rem 0 0.2rem;
}

.section:not(.section-dark) .dash-bar {
    background: var(--hairline);
}

.dash-bar-fill {
    height: 100%;
    transition: width 0.4s;
}

.bar-translated { background: #6a9c7a; }
.bar-draft      { background: #c8a06a; }
.bar-usage      { background: #8aa2c8; }

/* Tables */
.dash-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.82rem;
    margin-top: 0.5rem;
}

.dash-table th,
.dash-table td {
    padding: 0.4rem 0.6rem;
    text-align: left;
    border-bottom: 1px solid var(--hairline);
}

.section:not(.section-dark) .dash-table th,
.section:not(.section-dark) .dash-table td {
    border-bottom-color: var(--hairline);
}

.dash-table th {
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--ink-faint);
    white-space: nowrap;
}

.dash-table td.num,
.dash-table th.num {
    text-align: right;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.dash-table td.done,    .dash-table th.done    { color: #6a9c7a; }
.dash-table td.partial, .dash-table th.partial { color: #c8a06a; }

.dash-book-table {
    font-size: 0.78rem;
}

/* Cell bar (per-locale mini bar inside book table) */
.dash-cell-bar {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    min-width: 80px;
}

.dash-cell-track {
    flex: 1;
    height: 8px;
    background: var(--hairline);
    border-radius: 2px;
    position: relative;
    overflow: hidden;
    min-width: 40px;
}

.section:not(.section-dark) .dash-cell-track {
    background: var(--hairline);
}

.dash-cell-fill {
    position: absolute;
    top: 0;
    height: 100%;
}

.dash-cell-num {
    font-size: 0.7rem;
    color: var(--ink-soft);
    font-variant-numeric: tabular-nums;
    min-width: 32px;
    text-align: right;
}

.section:not(.section-dark) .dash-cell-num {
    color: var(--ink-soft);
}

/* Bar chart (top axes / top glossary) */
.dash-chart {
    margin: 0.4rem 0 1rem;
}

.dash-row {
    display: grid;
    grid-template-columns: 130px auto auto 1fr 90px;
    gap: 0.5rem;
    align-items: center;
    padding: 0.3rem 0;
    border-bottom: 1px solid var(--hairline);
    font-size: 0.78rem;
}

.section:not(.section-dark) .dash-row {
    border-bottom-color: var(--hairline);
}

.dash-row-label {
    font-weight: 500;
    color: var(--ink);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.section:not(.section-dark) .dash-row-label {
    color: var(--ink);
}

.dash-row-aux {
    font-size: 0.72rem;
    color: var(--ink-faint);
    white-space: nowrap;
}

.dash-row-aux.dash-hebrew {
    font-family: var(--font-serif);
    font-size: 0.85rem;
    color: var(--accent);
    direction: rtl;
}

.section:not(.section-dark) .dash-row-aux.dash-hebrew {
    color: var(--ink-soft);
}

.dash-row-bar {
    height: 8px;
    background: var(--hairline);
    border-radius: 2px;
    overflow: hidden;
}

.section:not(.section-dark) .dash-row-bar {
    background: var(--hairline);
}

.dash-row-num {
    font-size: 0.72rem;
    color: var(--ink-soft);
    font-variant-numeric: tabular-nums;
    text-align: right;
    white-space: nowrap;
}

.section:not(.section-dark) .dash-row-num {
    color: var(--ink-soft);
}

@media (max-width: 720px) {
    .dash-row {
        grid-template-columns: 100px 1fr 70px;
    }
    .dash-row-aux {
        display: none;
    }
    .dash-book-table {
        font-size: 0.7rem;
    }
}

/* ===================================================================
   Dashboard tabs (CSS-only via radio inputs)
   =================================================================== */

.dash-tab-radio {
    display: none;
}

.dash-tab-bar {
    display: flex;
    gap: 0;
    border-bottom: 1px solid var(--hairline);
    margin: 0.5rem 0 1.2rem;
    flex-wrap: wrap;
}

.section:not(.section-dark) .dash-tab-bar {
    border-bottom-color: var(--hairline);
}

.dash-tab-label {
    font-family: var(--font-sans);
    font-size: 0.78rem;
    letter-spacing: 0.05em;
    padding: 0.55rem 1rem;
    color: var(--ink-faint);
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: color 0.15s, border-color 0.15s;
    user-select: none;
    margin-bottom: -1px;
}

.dash-tab-label:hover {
    color: var(--ink-soft);
}

.section:not(.section-dark) .dash-tab-label:hover {
    color: var(--ink);
}

#dt-overview:checked   ~ .dash-tab-bar .dash-tab-label[for="dt-overview"],
#dt-books-st:checked   ~ .dash-tab-bar .dash-tab-label[for="dt-books-st"],
#dt-bymatrix:checked   ~ .dash-tab-bar .dash-tab-label[for="dt-bymatrix"],
#dt-glossary:checked   ~ .dash-tab-bar .dash-tab-label[for="dt-glossary"],
#dt-axes:checked       ~ .dash-tab-bar .dash-tab-label[for="dt-axes"] {
    color: var(--accent);
    border-bottom-color: var(--accent);
    font-weight: 600;
}

.section:not(.section-dark) #dt-overview:checked   ~ .dash-tab-bar .dash-tab-label[for="dt-overview"],
.section:not(.section-dark) #dt-books-st:checked   ~ .dash-tab-bar .dash-tab-label[for="dt-books-st"],
.section:not(.section-dark) #dt-bymatrix:checked   ~ .dash-tab-bar .dash-tab-label[for="dt-bymatrix"],
.section:not(.section-dark) #dt-glossary:checked   ~ .dash-tab-bar .dash-tab-label[for="dt-glossary"],
.section:not(.section-dark) #dt-axes:checked       ~ .dash-tab-bar .dash-tab-label[for="dt-axes"] {
    color: var(--ink);
    border-bottom-color: var(--ink);
}

.dash-tab-panel {
    display: none;
}

#dt-overview:checked ~ .dash-tab-panels #dp-overview,
#dt-books-st:checked ~ .dash-tab-panels #dp-books-st,
#dt-bymatrix:checked ~ .dash-tab-panels #dp-bymatrix,
#dt-glossary:checked ~ .dash-tab-panels #dp-glossary,
#dt-axes:checked     ~ .dash-tab-panels #dp-axes {
    display: block;
}

/* Cap the per-book matrix height so it scrolls in-place rather than
   pushing the page down. */
#dp-bymatrix .dash-book-table {
    display: block;
    max-height: 60vh;
    overflow-y: auto;
}

/* Inside the by-book scroll area, keep the header sticky. */
#dp-bymatrix .dash-book-table thead th {
    position: sticky;
    top: 0;
    background: var(--paper-raised);
    z-index: 1;
}

.section:not(.section-dark) #dp-bymatrix .dash-book-table thead th {
    background: var(--paper-raised);
}

/* ===== LOCALE SUGGESTION BANNER ===== */
.locale-banner {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.85rem;
    padding: 0.55rem 4.5rem 0.55rem 1.25rem;
    background: var(--paper-alt);
    border-bottom: 1px solid var(--hairline);
    font-family: var(--font-sans);
    font-size: 0.85rem;
    color: var(--ink);
    text-align: center;
    flex-wrap: wrap;
}

.locale-banner-text {
    line-height: 1.45;
}

.locale-banner-cta {
    color: var(--ink);
    text-decoration: underline;
    text-underline-offset: 2px;
    font-weight: 500;
    white-space: nowrap;
}

.locale-banner-cta:hover {
    color: var(--ink-soft);
}

.locale-banner-close {
    background: none;
    border: 1px solid var(--hairline);
    color: var(--ink-faint);
    cursor: pointer;
    width: 1.5rem;
    height: 1.5rem;
    border-radius: 50%;
    font-size: 0.95rem;
    line-height: 1;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s;
    flex-shrink: 0;
}

.locale-banner-close:hover {
    color: var(--ink-soft);
    border-color: var(--ink-soft);
}

@media (max-width: 640px) {
    .locale-banner {
        padding: 0.55rem 1rem;
        font-size: 0.8rem;
    }
}

.alpha-badge {
    display: inline-block;
    font-size: 0.75rem;
    letter-spacing: 0.04em;
    padding: 0.1rem 0.6rem;
    border: 1px solid currentColor;
    border-radius: 999px;
    opacity: 0.85;
    margin-bottom: 0.5rem;
}
.alpha-note { opacity: 0.85; }
