/* ==========================================================================
   Nelson Areal — Finance Tools
   Shared design system: calm, minimal, single-typeface
   Cool off-white paper · Onest sans · one muted-blue accent
   (Builder + Plotter. The landing page is self-contained.)
   ========================================================================== */

:root {
    /* Type — one sans family; system mono only for code-like strings (URLs) */
    --font: "Onest", -apple-system, BlinkMacSystemFont, system-ui, "Segoe UI",
        sans-serif;
    --font-mono: ui-monospace, "SFMono-Regular", "SF Mono", Menlo, Consolas,
        monospace;

    /* Surfaces & ink */
    --paper: #fafaf9;
    --surface: #ffffff;
    --surface-2: #f4f4f2;
    --field-bg: #ffffff;
    --ink: #0a0a0a;
    --ink-soft: #525252;
    --ink-faint: #a3a3a3;
    --line: #ececea;
    --line-strong: #d6d3d1;

    /* Accents — one muted blue, with ochre / oxblood as secondary states */
    --accent: #5b7a99;
    --accent-ink: #4a657f;
    --accent-soft: rgba(91, 122, 153, 0.1);
    --warn: #bb5c24;
    --danger: #a04242;
    /* legacy aliases kept so existing selectors resolve (success btn, etc.) */
    --profit: #5b7a99;
    --profit-ink: #4a657f;
    --gold: #bb5c24;

    /* Chart sheet — always light paper, deliberately NOT overridden in dark
       mode (the D3 charts and legend render on this fixed-light surface) */
    --chart-paper: #ffffff;
    --chart-ink: #525252;
    --chart-axis: #d6d3d1;
    --chart-axis-ink: #6b6b6b;
    --chart-grid: #ececea;
    --chart-payoff: #3f5a78; /* deep muted blue — payoff line */
    --chart-loss: #a04242; /* oxblood — profit/loss line */

    /* Shape & depth */
    --radius: 8px;
    --radius-lg: 12px;
    --shadow: 0 1px 2px rgba(10, 10, 10, 0.04),
        0 10px 30px -22px rgba(10, 10, 10, 0.35);
    --shadow-lg: 0 2px 6px rgba(10, 10, 10, 0.06),
        0 28px 56px -30px rgba(10, 10, 10, 0.4);
    --ring: 0 0 0 3px var(--accent-soft);

    /* Layout */
    --maxw: 1080px;
    --measure: 66ch;

    color-scheme: light;
}

@media (prefers-color-scheme: dark) {
    :root {
        --paper: #111110;
        --surface: #1a1a18;
        --surface-2: #222220;
        --field-bg: #161614;
        --ink: #f5f5f4;
        --ink-soft: #a3a3a3;
        --ink-faint: #6e6e6b;
        --line: #262624;
        --line-strong: #36352f;

        --accent: #7d9cbb;
        --accent-ink: #98b3cd;
        --accent-soft: rgba(125, 156, 187, 0.16);
        --warn: #cf7740;
        --danger: #c06a6a;
        --profit: #7d9cbb;
        --profit-ink: #98b3cd;
        --gold: #cf7740;

        --shadow: 0 1px 2px rgba(0, 0, 0, 0.4),
            0 10px 30px -20px rgba(0, 0, 0, 0.8);
        --shadow-lg: 0 2px 6px rgba(0, 0, 0, 0.5),
            0 28px 56px -28px rgba(0, 0, 0, 0.75);

        color-scheme: dark;
    }
}

/* ---------- Reset ---------- */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    -webkit-text-size-adjust: 100%;
    scroll-behavior: smooth;
}

body {
    font-family: var(--font);
    color: var(--ink);
    line-height: 1.6;
    font-size: clamp(15px, 0.5vw + 14px, 17px);
    background-color: var(--paper);
    padding: clamp(16px, 4vw, 40px) clamp(14px, 4vw, 32px) 64px;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}

/* ---------- Masthead ---------- */
.masthead {
    max-width: var(--maxw);
    margin: 0 auto clamp(16px, 2.5vw, 26px);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--line);
}

/* the brand is two independent links — "Nelson Areal" (+ logo) → personal
   site, "Tools" → the suite home — joined by a dot separator */
.brand {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    font-size: 14px;
    font-weight: 500;
    letter-spacing: -0.01em;
    color: var(--ink);
}

.brand a {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    color: inherit;
    text-decoration: none;
    transition: color 0.2s;
}

.brand a:hover {
    color: var(--accent);
}

.brand-sep {
    color: var(--ink-faint);
}

.brand svg {
    display: block;
    width: 24px;
    height: 24px;
    flex: none;
}

/* check-mark stroke follows the accent so it stays visible in dark mode
   (overrides the hardcoded presentation attribute in the inline SVGs) */
.brand svg path {
    stroke: var(--accent);
}

.site-nav {
    display: inline-flex;
    align-items: center;
    gap: 18px;
    font-size: 13.5px;
    font-weight: 500;
}

.site-nav a {
    color: var(--ink-soft);
    text-decoration: none;
    border-bottom: 1px solid transparent;
    padding-bottom: 2px;
    transition: color 0.2s, border-color 0.2s;
}

.site-nav a:hover {
    color: var(--accent);
    border-color: currentColor;
}

.backlink::before {
    content: "\2190";
    margin-right: 7px;
}

/* ---------- Container card ---------- */
.container {
    max-width: var(--maxw);
    margin: 0 auto;
    background-color: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    padding: clamp(22px, 4vw, 52px);
    position: relative;
    overflow: hidden;
}

/* ---------- Header / type ---------- */
header {
    margin-bottom: clamp(22px, 3vw, 34px);
}

.eyebrow {
    display: inline-block;
    font-size: 12px;
    font-weight: 500;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--accent);
    margin-bottom: 12px;
}

h1 {
    font-family: var(--font);
    font-weight: 600;
    font-size: clamp(28px, 5vw, 44px);
    line-height: 1.08;
    letter-spacing: -0.03em;
    color: var(--ink);
    margin-bottom: 14px;
    text-wrap: balance;
}

h2 {
    font-family: var(--font);
    font-weight: 600;
    font-size: clamp(20px, 2.6vw, 26px);
    line-height: 1.18;
    letter-spacing: -0.02em;
    color: var(--ink);
    margin: 44px 0 16px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--line);
}

h3 {
    font-family: var(--font);
    font-weight: 600;
    font-size: 17px;
    letter-spacing: -0.01em;
    color: var(--ink);
}

.description {
    max-width: var(--measure);
    color: var(--ink-soft);
    font-size: 1.02rem;
    line-height: 1.62;
}

a {
    color: var(--accent);
}

/* ---------- Buttons ---------- */
.btn {
    cursor: pointer;
    border: 1px solid transparent;
    padding: 11px 20px;
    border-radius: var(--radius);
    font-family: var(--font);
    font-size: 15px;
    font-weight: 500;
    line-height: 1.1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    text-decoration: none;
    transition: transform 0.12s ease, background-color 0.2s, box-shadow 0.2s,
        border-color 0.2s;
}

.btn:active {
    transform: scale(0.995);
}

.btn:focus-visible {
    outline: none;
    box-shadow: var(--ring);
}

/* primary — the timer-ii dark action button (flips with the palette in dark) */
.btn-primary {
    background-color: var(--ink);
    border-color: var(--ink);
    color: var(--paper);
}

.btn-primary:hover {
    background-color: color-mix(in srgb, var(--ink) 84%, var(--paper));
    border-color: color-mix(in srgb, var(--ink) 84%, var(--paper));
}

.btn-success {
    background-color: var(--accent);
    border-color: var(--accent);
    color: #fff;
}

.btn-success:hover {
    background-color: var(--accent-ink);
    border-color: var(--accent-ink);
}

.btn-secondary {
    background-color: transparent;
    border-color: var(--line-strong);
    color: var(--ink);
}

.btn-secondary:hover {
    border-color: var(--ink);
    background-color: var(--surface-2);
}

.btn-icon {
    width: 38px;
    height: 38px;
    padding: 0;
    border-radius: var(--radius);
    background-color: var(--surface-2);
    border-color: var(--line);
    color: var(--ink-soft);
    font-size: 15px;
}

.btn-icon:hover {
    background-color: var(--surface);
    border-color: var(--ink-faint);
    color: var(--ink);
}

.icon {
    font-size: 1.05em;
    line-height: 1;
}

/* ---------- Footer ---------- */
footer {
    margin-top: clamp(36px, 5vw, 56px);
    padding-top: 18px;
    border-top: 1px solid var(--line);
    text-align: center;
    color: var(--ink-faint);
    font-size: 13px;
    letter-spacing: 0.01em;
}

/* ---------- Motion ---------- */
@keyframes rise {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.rise {
    animation: rise 0.5s cubic-bezier(0.2, 0.7, 0.2, 1) both;
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.001ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.001ms !important;
        scroll-behavior: auto !important;
    }
}

/* ==========================================================================
   Tabular data — numbers with tabular figures
   ========================================================================== */
.portfolio-table {
    width: 100%;
    border-collapse: collapse;
    margin: 0;
    font-size: 14.5px;
}

.table-wrap {
    width: 100%;
    overflow-x: auto;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    margin: 22px 0 30px;
    -webkit-overflow-scrolling: touch;
}

.portfolio-table th,
.portfolio-table td {
    border-bottom: 1px solid var(--line);
    padding: 11px 14px;
    text-align: left;
    white-space: nowrap;
}

.portfolio-table thead th {
    background-color: var(--surface-2);
    font-size: 11.5px;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--ink-soft);
    border-bottom: 1.5px solid var(--line-strong);
}

.portfolio-table tbody td {
    font-variant-numeric: tabular-nums;
}

/* numeric columns (quantity, price, future/strike) emphasised */
.portfolio-table tbody td:nth-child(2),
.portfolio-table tbody td:nth-child(3),
.portfolio-table tbody td:nth-child(5) {
    color: var(--ink);
}

.portfolio-table tbody tr:nth-child(even) td {
    background-color: color-mix(in srgb, var(--surface-2) 55%, transparent);
}

.portfolio-table tbody tr:hover td {
    background-color: var(--accent-soft);
}

.portfolio-table tbody tr:last-child td {
    border-bottom: none;
}

/* ---------- Payoff / P&L breakdown tables (algebraic, per region) ---------- */
.payoff-tables {
    display: grid;
    gap: 26px;
    margin: 22px 0 30px;
}

/* min-width:0 lets the grid item shrink so the scroll wrapper (not the page)
   absorbs an over-wide table */
.payoff-block {
    min-width: 0;
}

.payoff-caption {
    font-family: var(--font);
    font-weight: 600;
    font-size: 16px;
    letter-spacing: -0.01em;
    color: var(--ink);
    margin: 0 0 10px;
}

.payoff-scroll {
    width: 100%;
    overflow-x: auto;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    -webkit-overflow-scrolling: touch;
}

.payoff-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14.5px;
}

.payoff-table th,
.payoff-table td {
    border-bottom: 1px solid var(--line);
    padding: 11px 16px;
    white-space: nowrap;
}

/* region column headers */
.payoff-table thead th {
    background-color: var(--surface-2);
    font-size: 12.5px;
    font-weight: 600;
    text-align: center;
    color: var(--ink-soft);
    border-bottom: 1.5px solid var(--line-strong);
}

.payoff-table thead th:first-child {
    text-align: left;
}

/* row labels (first column) — allowed to wrap so long asset names don't force
   the whole table wider than the screen */
.payoff-table tbody th {
    text-align: left;
    font-weight: 500;
    color: var(--ink);
    white-space: normal;
}

/* algebraic expression cells */
.payoff-table tbody td {
    text-align: center;
    font-variant-numeric: tabular-nums;
    color: var(--ink);
}

.payoff-table tbody tr:nth-child(even) th,
.payoff-table tbody tr:nth-child(even) td {
    background-color: color-mix(in srgb, var(--surface-2) 55%, transparent);
}

/* total row — ruled off and emphasised, booktabs style */
.payoff-table tbody tr.payoff-total th,
.payoff-table tbody tr.payoff-total td {
    border-top: 1.5px solid var(--line-strong);
    border-bottom: none;
    font-weight: 600;
    background-color: color-mix(in srgb, var(--accent-soft) 65%, transparent);
}

/* within a run of total rows (Payoff / Premium / P&L) only the first keeps the
   strong rule; the rest get a light internal separator */
.payoff-table tbody tr.payoff-total + tr.payoff-total th,
.payoff-table tbody tr.payoff-total + tr.payoff-total td {
    border-top: 1px solid var(--line);
}

/* ==========================================================================
   Charts (plotter)
   ========================================================================== */
.chart-container {
    margin: 26px 0 30px;
}

#portfolio-chart {
    width: 100%;
    height: 520px;
    background-color: var(--chart-paper);
    border: 1px solid var(--line-strong);
    border-radius: var(--radius);
    overflow: hidden;
}

/* ---------- Empty / error notice (plotter) ---------- */
.notice {
    margin: 26px 0 30px;
    padding: clamp(28px, 5vw, 56px) clamp(22px, 4vw, 40px);
    background-color: var(--surface);
    border: 1px solid var(--line-strong);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    text-align: center;
}

.notice-title {
    font-family: var(--font);
    font-weight: 600;
    font-size: clamp(20px, 2.6vw, 26px);
    letter-spacing: -0.02em;
    color: var(--ink);
    margin: 0 0 10px;
    padding: 0;
    border: none;
}

.notice-body {
    max-width: 52ch;
    margin: 0 auto 22px;
    color: var(--ink-soft);
    font-size: 1.02rem;
    line-height: 1.6;
}

.individual-charts {
    margin-top: 14px;
    display: grid;
    gap: 30px;
}

.individual-charts > div {
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 18px 18px 8px;
    background: var(--surface);
}

.individual-charts h3 {
    font-family: var(--font);
    font-weight: 600;
    font-size: 18px;
    margin-bottom: 4px;
}

.asset-chart {
    width: 100%;
    height: 300px;
    background-color: var(--chart-paper);
    border: 1px solid var(--line-strong);
    border-radius: var(--radius);
    overflow: hidden;
    margin-bottom: 6px;
}

/* Each asset card: chart and its breakdown table, stacked on small screens
   and side by side once there is room. */
.asset-body {
    display: grid;
    grid-template-columns: 1fr;
    gap: 18px;
    align-items: start;
}

@media (min-width: 860px) {
    .asset-body {
        grid-template-columns: minmax(0, 1fr) minmax(240px, 320px);
    }
}

/* min-width:0 lets the chart track shrink instead of overflowing the card */
.asset-chart-col,
.asset-table-wrap {
    min-width: 0;
}

/* compact per-asset table */
.asset-mini-table {
    font-size: 13.5px;
}

.asset-mini-table th,
.asset-mini-table td {
    padding: 9px 14px;
}

/* D3 axes / grid — chart surface is always light "paper" */
.axis {
    font-family: var(--font);
    font-size: 11px;
}

.axis path,
.axis line {
    fill: none;
    stroke: var(--chart-axis);
    shape-rendering: crispEdges;
}

.axis text {
    fill: var(--chart-axis-ink);
}

.grid line {
    stroke: var(--chart-grid);
    stroke-opacity: 0.85;
    shape-rendering: crispEdges;
}

.grid path {
    stroke-width: 0;
}

.tooltip {
    position: absolute;
    padding: 9px 12px;
    background: var(--surface);
    color: var(--ink);
    border: 1px solid var(--line-strong);
    border-radius: var(--radius);
    pointer-events: none;
    font-family: var(--font);
    font-variant-numeric: tabular-nums;
    font-size: 12.5px;
    line-height: 1.5;
    box-shadow: var(--shadow);
    z-index: 50;
}

/* ---------- Legend ---------- */
/* sits on the fixed-light chart paper so the swatch colors (which match the
   always-light chart lines) stay readable in dark mode */
.legend {
    display: flex;
    flex-wrap: wrap;
    gap: 10px 22px;
    margin: 16px 0;
    padding: 12px 16px;
    font-size: 13.5px;
    color: var(--chart-ink);
    background: var(--chart-paper);
    border: 1px solid var(--chart-axis);
    border-radius: var(--radius);
}

.legend:empty {
    display: none;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 9px;
}

.legend-color {
    width: 22px;
    height: 4px;
    border-radius: 2px;
}

/* ==========================================================================
   Forms / cards (builder)
   ========================================================================== */
.portfolio-builder {
    margin-bottom: 30px;
}

.language-selector {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 26px;
    padding: 8px 12px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface-2);
}

.language-selector label {
    font-size: 11.5px;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--ink-soft);
}

.assets-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
    gap: 20px;
    margin-bottom: 24px;
}

.asset-card {
    background-color: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
    transition: transform 0.18s ease, box-shadow 0.2s ease, border-color 0.2s;
}

.asset-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
    border-color: var(--line-strong);
}

.card-header {
    background-color: var(--surface-2);
    padding: 12px 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--line);
}

.asset-title {
    font-family: var(--font);
    font-weight: 600;
    font-size: 16px;
    letter-spacing: -0.01em;
    color: var(--ink);
}

.card-body {
    padding: 18px;
}

.form-group {
    display: block;
    margin-bottom: 15px;
}

.field-caption {
    display: block;
    margin-bottom: 6px;
    font-size: 11.5px;
    font-weight: 600;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--ink-soft);
}

.form-group select,
.form-group input,
.language-selector select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--line-strong);
    border-radius: var(--radius);
    background-color: var(--field-bg);
    color: var(--ink);
    font-family: var(--font);
    font-size: 15px;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.language-selector select {
    width: auto;
    font-size: 13px;
    padding: 6px 10px;
}

/* numeric inputs use tabular figures */
.form-group input[type="number"] {
    font-variant-numeric: tabular-nums;
}

.form-group select:focus,
.form-group input:focus,
.language-selector select:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: var(--ring);
}

.controls {
    display: flex;
    flex-wrap: wrap;
    gap: 14px;
    margin-top: 28px;
}

.remove-asset {
    font-size: 19px;
    line-height: 1;
}

/* ---------- Generated URL panel ---------- */
.url-result {
    margin-top: 30px;
    padding: 22px;
    background-color: var(--surface-2);
    border: 1px solid var(--line);
    border-radius: var(--radius);
}

.url-result h3 {
    font-family: var(--font);
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--ink-soft);
}

.url-container {
    display: flex;
    margin: 14px 0;
}

.url-container input {
    flex: 1;
    min-width: 0;
    padding: 11px 13px;
    border: 1px solid var(--line-strong);
    border-right: none;
    border-radius: var(--radius) 0 0 var(--radius);
    background: var(--field-bg);
    color: var(--ink);
    font-family: var(--font-mono);
    font-size: 13px;
}

.url-container input:focus {
    outline: none;
    border-color: var(--accent);
}

.url-container .btn-icon {
    border-radius: 0 var(--radius) var(--radius) 0;
    height: auto;
    flex: none;
}

.action-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 14px;
}

/* ==========================================================================
   Landing page
   ========================================================================== */
/* narrower column than the 1080px tool pages — masthead + content share it */
.page {
    max-width: 760px;
    margin: 0 auto;
}

.lede {
    font-size: 1.1rem;
}

.tool-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(258px, 1fr));
    gap: 18px;
    margin-top: clamp(24px, 4vw, 40px);
}

.tool-card {
    display: flex;
    flex-direction: column;
    text-decoration: none;
    color: inherit;
    background-color: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    padding: 22px;
    transition: border-color 0.2s ease, transform 0.15s ease,
        box-shadow 0.2s ease;
}

.tool-card:hover {
    border-color: var(--line-strong);
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.tool-card svg.thumb {
    width: 100%;
    height: 80px;
    display: block;
    margin-bottom: 18px;
    background: var(--paper);
    border: 1px solid var(--line);
    border-radius: var(--radius);
}

.tool-card .eyebrow {
    margin-bottom: 0;
    color: var(--ink-faint);
}

/* override the global h2 (no section rule / big margins inside a card) */
.tool-card h2 {
    margin: 10px 0 8px;
    padding: 0;
    border: none;
    font-size: 19px;
    letter-spacing: -0.01em;
}

.tool-card p {
    color: var(--ink-soft);
    font-size: 14.5px;
    line-height: 1.55;
    flex: 1;
}

.tool-go {
    margin-top: 18px;
    font-size: 13px;
    font-weight: 500;
    color: var(--accent);
    display: inline-flex;
    align-items: center;
    gap: 7px;
}

.tool-go::after {
    content: "\2192";
    transition: transform 0.2s ease;
}

.tool-card:hover .tool-go::after {
    transform: translateX(4px);
}

/* ==========================================================================
   Responsive
   ========================================================================== */
@media (max-width: 720px) {
    .masthead {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }

    .assets-container {
        grid-template-columns: 1fr;
    }

    .controls,
    .action-buttons {
        flex-direction: column;
    }

    .controls .btn,
    .action-buttons .btn {
        width: 100%;
    }

    #portfolio-chart {
        height: 360px;
    }

    .asset-chart {
        height: 250px;
    }

    /* tighter table cells so more fits before horizontal scrolling kicks in */
    .payoff-table th,
    .payoff-table td {
        padding: 9px 11px;
    }
}

/* ---------- Courses landing additions ----------
   Everything above is styles.css from vps/tools, copied verbatim so the two
   landing pages stay visually identical. Landing-only rules live below. */

/* Cards hold several links, so they are <div>s rather than one big <a>. */
.card-links {
    margin-top: 18px;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px 18px;
}

.card-links .tool-go {
    margin-top: 0;
    text-decoration: none;
}

a.tool-go:hover {
    color: var(--accent-ink);
}

/* Secondary row of small links inside a card (e.g. per-chapter quizzes). */
.sub-links {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--line);
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 4px 12px;
    font-size: 13px;
}

.sub-links .sub-label {
    font-size: 11px;
    font-weight: 500;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--ink-faint);
}

.sub-links a {
    color: var(--accent);
    font-weight: 500;
    text-decoration: none;
    white-space: nowrap;
}

.sub-links a:hover {
    color: var(--accent-ink);
    text-decoration: underline;
}

/* The label itself may be a link (e.g. "Quizzes" → the quizzes index);
   it keeps the muted label look until hovered. */
.sub-links a.sub-label:hover {
    color: var(--accent-ink);
    text-decoration: underline;
}
