/* ── The FDE Toolkit: theme tokens & layout ───────── */
:root {
    --tk-thumb-bg: linear-gradient(145deg, rgba(6, 17, 38, 0.94), rgba(11, 29, 58, 0.88));
    --tk-grid-line: rgba(158, 197, 255, 0.075);
    --tk-surface: rgba(15, 34, 66, 0.92);
    --tk-surface-2: rgba(24, 52, 94, 0.78);
    --tk-stroke: rgba(158, 197, 255, 0.34);
    --tk-stroke-soft: rgba(158, 197, 255, 0.16);
    --tk-accent: #7ed6ff;
    --tk-accent-soft: rgba(126, 214, 255, 0.18);
    --tk-accent-2: #95ffa9;
    --tk-accent-2-soft: rgba(149, 255, 169, 0.18);
    --tk-accent-3: #b9a6ff;
    --tk-accent-3-soft: rgba(185, 166, 255, 0.2);
    --tk-amber: #ffd37e;
    --tk-amber-soft: rgba(255, 211, 126, 0.2);
    --tk-ink: #eff6ff;
    --tk-ink-muted: #9bb4dd;
    --tk-badge-bg: rgba(7, 18, 38, 0.84);
    --tk-badge-border: rgba(126, 214, 255, 0.44);
    --tk-badge-text: #ddf4ff;
    --tk-card-bg: linear-gradient(150deg, rgba(9, 23, 47, 0.84), rgba(7, 15, 31, 0.92));
    --tk-card-border: rgba(158, 197, 255, 0.22);
    --tk-filter-bg: rgba(255, 255, 255, 0.04);
    --tk-filter-border: rgba(158, 197, 255, 0.22);
    --tk-filter-text: #d7e5ff;
}

[data-theme="light"] {
    --tk-thumb-bg: linear-gradient(145deg, #eef4fc, #e1ecf9);
    --tk-grid-line: rgba(34, 82, 145, 0.08);
    --tk-surface: rgba(255, 255, 255, 0.95);
    --tk-surface-2: rgba(224, 236, 250, 0.9);
    --tk-stroke: rgba(45, 92, 152, 0.3);
    --tk-stroke-soft: rgba(45, 92, 152, 0.14);
    --tk-accent: #0077b6;
    --tk-accent-soft: rgba(0, 119, 182, 0.14);
    --tk-accent-2: #1c9648;
    --tk-accent-2-soft: rgba(28, 150, 72, 0.14);
    --tk-accent-3: #6355c7;
    --tk-accent-3-soft: rgba(99, 85, 199, 0.14);
    --tk-amber: #c47a12;
    --tk-amber-soft: rgba(196, 122, 18, 0.16);
    --tk-ink: #1a2233;
    --tk-ink-muted: #526785;
    --tk-badge-bg: rgba(255, 255, 255, 0.92);
    --tk-badge-border: rgba(0, 119, 182, 0.34);
    --tk-badge-text: #0a4d78;
    --tk-card-bg: linear-gradient(150deg, rgba(255, 255, 255, 0.88), rgba(241, 246, 255, 0.78));
    --tk-card-border: rgba(100, 140, 200, 0.22);
    --tk-filter-bg: rgba(0, 80, 160, 0.05);
    --tk-filter-border: rgba(100, 140, 200, 0.24);
    --tk-filter-text: #2e405b;
}

/* ── Compact hero adjustments ─────────────────────── */
.toolkit-hero {
    padding: clamp(1rem, 2vw, 1.4rem);
}

.toolkit-hero .page-kicker {
    margin-bottom: 0.5rem;
}

.toolkit-hero .page-title {
    font-size: clamp(1.95rem, 4vw, 3.05rem);
}

.toolkit-hero .page-lead {
    margin-top: 0.55rem;
    font-size: clamp(0.96rem, 1.4vw, 1.05rem);
    line-height: 1.6;
}

.toolkit-pill-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.75rem;
}

.toolkit-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.36rem 0.72rem;
    border-radius: 999px;
    border: 1px solid rgba(158, 197, 255, 0.26);
    background: rgba(126, 214, 255, 0.09);
    color: var(--tk-ink);
    font-size: 0.84rem;
    font-weight: 500;
}

.toolkit-pill strong {
    color: var(--tk-accent);
    font-weight: 700;
}

.toolkit-pill--articles strong {
    color: var(--tk-accent-2);
}

.toolkit-pill--reference strong {
    color: var(--tk-accent-3);
}

.toolkit-hero .hero-side {
    justify-content: center;
    gap: 0.6rem;
}

.toolkit-hero .hero-badge,
.toolkit-hero .hero-chip {
    padding: 0.7rem 0.9rem;
}

.toolkit-hero .hero-badge p,
.toolkit-hero .hero-chip p {
    margin: 0.25rem 0 0;
    font-size: 0.9rem;
    line-height: 1.5;
}

/* ── Category filter bar ──────────────────────────── */
.toolkit-filter-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.65rem 1rem;
    padding: 0.65rem 0.95rem;
}

.toolkit-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.toolkit-filter-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.5rem 0.9rem;
    border-radius: 12px;
    border: 1px solid var(--tk-filter-border);
    background: var(--tk-filter-bg);
    color: var(--tk-filter-text);
    font-family: inherit;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.18s ease, background 0.18s ease, border-color 0.18s ease, color 0.18s ease, box-shadow 0.18s ease;
}

.toolkit-filter-btn:hover {
    transform: translateY(-1px);
    border-color: var(--tk-accent);
    color: var(--tk-ink);
}

.toolkit-filter-btn.is-active {
    color: #061223;
    background: linear-gradient(135deg, #7ed6ff, #95ffa9);
    border-color: rgba(149, 255, 169, 0.45);
    box-shadow: 0 8px 20px rgba(126, 214, 255, 0.22);
}

.toolkit-filter-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 1.45rem;
    padding: 0.08rem 0.4rem;
    border-radius: 999px;
    font-size: 0.76rem;
    font-weight: 700;
    background: rgba(255, 255, 255, 0.12);
}

.toolkit-filter-btn.is-active .toolkit-filter-count {
    background: rgba(6, 18, 35, 0.16);
    color: #061223;
}

.toolkit-filter-status {
    margin: 0;
    font-size: 0.88rem;
    color: var(--tk-ink-muted);
    white-space: nowrap;
}

/* ── Section header & grid ────────────────────────── */
.toolkit-section {
    padding: clamp(1rem, 2.1vw, 1.45rem);
}

.toolkit-section[hidden] {
    display: none;
}

.toolkit-section__header {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    justify-content: space-between;
    gap: 0.5rem 1rem;
    margin-bottom: 0.9rem;
}

.toolkit-section__header .section-subtitle {
    margin-bottom: 0.35rem;
}

.toolkit-section__header .section-title {
    margin: 0;
}

.toolkit-section__count {
    display: inline-flex;
    align-items: center;
    padding: 0.32rem 0.72rem;
    border-radius: 999px;
    border: 1px solid var(--tk-card-border);
    background: var(--tk-filter-bg);
    color: var(--tk-ink-muted);
    font-size: 0.82rem;
    font-weight: 600;
}

.toolkit-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1rem;
}

/* ── Toolkit card (non-interactive placeholder) ───── */
.toolkit-card {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-height: 100%;
    border-radius: 18px;
    border: 1px solid var(--tk-card-border);
    background: var(--tk-card-bg);
    box-shadow: 0 14px 32px rgba(0, 0, 0, 0.28);
    cursor: default;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.toolkit-card:hover {
    border-color: rgba(158, 197, 255, 0.36);
    box-shadow: 0 16px 36px rgba(0, 0, 0, 0.34);
}

/* ── Thumbnail visual area ────────────────────────── */
.toolkit-thumb {
    position: relative;
    aspect-ratio: 16 / 9;
    width: 100%;
    overflow: hidden;
    background: var(--tk-thumb-bg);
    border-bottom: 1px solid var(--tk-card-border);
}

.toolkit-thumb::before {
    content: "";
    position: absolute;
    inset: 0;
    background-image:
        linear-gradient(to right, var(--tk-grid-line) 1px, transparent 1px),
        linear-gradient(to bottom, var(--tk-grid-line) 1px, transparent 1px);
    background-size: 20px 20px;
    pointer-events: none;
}

.toolkit-thumb svg {
    position: relative;
    z-index: 1;
    width: 100%;
    height: 100%;
    display: block;
}

.toolkit-status-badge {
    position: absolute;
    top: 0.65rem;
    right: 0.65rem;
    z-index: 2;
    display: inline-flex;
    align-items: center;
    gap: 0.38rem;
    padding: 0.28rem 0.68rem;
    border-radius: 999px;
    border: 1px solid var(--tk-badge-border);
    background: var(--tk-badge-bg);
    color: var(--tk-badge-text);
    font-size: 0.74rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    backdrop-filter: blur(8px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.toolkit-status-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--tk-accent-2);
    box-shadow: 0 0 8px var(--tk-accent-2);
    flex-shrink: 0;
}

/* ── Card content ─────────────────────────────────── */
.toolkit-card__body {
    display: flex;
    flex-direction: column;
    gap: 0.42rem;
    padding: 0.85rem 1rem 0.98rem;
    flex: 1;
}

.toolkit-card__meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
}

.toolkit-type-tag {
    display: inline-flex;
    align-items: center;
    padding: 0.18rem 0.56rem;
    border-radius: 8px;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    color: var(--tk-accent);
    background: var(--tk-accent-soft);
    border: 1px solid rgba(126, 214, 255, 0.22);
}

.toolkit-type-tag--article {
    color: var(--tk-accent-2);
    background: var(--tk-accent-2-soft);
    border-color: rgba(149, 255, 169, 0.24);
}

.toolkit-type-tag--reference {
    color: var(--tk-accent-3);
    background: var(--tk-accent-3-soft);
    border-color: rgba(185, 166, 255, 0.24);
}

.toolkit-card .card-title {
    margin: 0.15rem 0 0;
    font-size: 1.1rem;
    line-height: 1.28;
}

.toolkit-card__desc {
    margin: 0;
    font-size: 0.93rem;
    line-height: 1.58;
    color: var(--tk-ink-muted);
}

/* ── SVG wireframe utility classes ────────────────── */
.tk-svg-panel {
    fill: var(--tk-surface);
    stroke: var(--tk-stroke);
    stroke-width: 1.2;
}

.tk-svg-sub {
    fill: var(--tk-surface-2);
    stroke: var(--tk-stroke-soft);
    stroke-width: 1;
}

.tk-svg-accent-fill {
    fill: var(--tk-accent);
}

.tk-svg-accent-soft {
    fill: var(--tk-accent-soft);
    stroke: var(--tk-accent);
    stroke-width: 1.2;
}

.tk-svg-accent2-fill {
    fill: var(--tk-accent-2);
}

.tk-svg-accent2-soft {
    fill: var(--tk-accent-2-soft);
    stroke: var(--tk-accent-2);
    stroke-width: 1.2;
}

.tk-svg-accent3-fill {
    fill: var(--tk-accent-3);
}

.tk-svg-accent3-soft {
    fill: var(--tk-accent-3-soft);
    stroke: var(--tk-accent-3);
    stroke-width: 1.2;
}

.tk-svg-amber-fill {
    fill: var(--tk-amber);
}

.tk-svg-amber-soft {
    fill: var(--tk-amber-soft);
    stroke: var(--tk-amber);
    stroke-width: 1.2;
}

.tk-svg-line {
    stroke: var(--tk-stroke);
    stroke-width: 1.4;
    fill: none;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.tk-svg-line-accent {
    stroke: var(--tk-accent);
    stroke-width: 1.8;
    fill: none;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.tk-svg-line-accent2 {
    stroke: var(--tk-accent-2);
    stroke-width: 1.8;
    fill: none;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.tk-svg-line-dashed {
    stroke: var(--tk-stroke);
    stroke-width: 1.2;
    stroke-dasharray: 4 3;
    fill: none;
}

.tk-svg-text {
    fill: var(--tk-ink);
    font-family: "Space Grotesk", sans-serif;
    font-size: 9px;
    font-weight: 600;
}

.tk-svg-text-sm {
    fill: var(--tk-ink-muted);
    font-family: "Space Grotesk", sans-serif;
    font-size: 7.5px;
    font-weight: 500;
}

.tk-svg-text-accent {
    fill: var(--tk-accent);
    font-family: "Space Grotesk", sans-serif;
    font-size: 8.5px;
    font-weight: 700;
}

.tk-svg-text-accent2 {
    fill: var(--tk-accent-2);
    font-family: "Space Grotesk", sans-serif;
    font-size: 8.5px;
    font-weight: 700;
}

/* ── Footer panel ─────────────────────────────────── */
.toolkit-footer {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 1rem 1.5rem;
}

.toolkit-footer__copy {
    max-width: 58ch;
}

.toolkit-footer__copy h2 {
    margin: 0 0 0.35rem;
    font-size: clamp(1.2rem, 2vw, 1.5rem);
}

.toolkit-footer__copy p {
    margin: 0;
}

.toolkit-footer .inline-links {
    margin-top: 0;
}

/* ── Light theme refinements ──────────────────────── */
[data-theme="light"] .toolkit-pill {
    background: rgba(0, 100, 200, 0.08);
    border-color: rgba(100, 140, 200, 0.25);
}

[data-theme="light"] .toolkit-filter-btn.is-active {
    color: #ffffff;
    background: linear-gradient(135deg, #0088cc, #22aa44);
    border-color: rgba(34, 170, 68, 0.4);
    box-shadow: 0 8px 18px rgba(0, 100, 200, 0.16);
}

[data-theme="light"] .toolkit-filter-btn.is-active .toolkit-filter-count {
    background: rgba(255, 255, 255, 0.22);
    color: #ffffff;
}

[data-theme="light"] .toolkit-filter-count {
    background: rgba(0, 80, 160, 0.09);
}

[data-theme="light"] .toolkit-card {
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.07);
}

[data-theme="light"] .toolkit-card:hover {
    border-color: rgba(0, 119, 182, 0.32);
    box-shadow: 0 12px 28px rgba(0, 0, 0, 0.1);
}

[data-theme="light"] .toolkit-status-badge {
    box-shadow: 0 4px 10px rgba(15, 45, 85, 0.1);
}

[data-theme="light"] .toolkit-type-tag {
    border-color: rgba(0, 119, 182, 0.24);
}

[data-theme="light"] .toolkit-type-tag--article {
    border-color: rgba(28, 150, 72, 0.24);
}

[data-theme="light"] .toolkit-type-tag--reference {
    border-color: rgba(99, 85, 199, 0.24);
}

/* ── Responsive grid ──────────────────────────────── */
@media (max-width: 1040px) {
    .toolkit-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 680px) {
    .toolkit-grid {
        grid-template-columns: 1fr;
    }

    .toolkit-filter-bar {
        align-items: flex-start;
    }

    .toolkit-filter-btn {
        font-size: 0.84rem;
        padding: 0.45rem 0.72rem;
    }
}
