/* Shared styles for static pages (homepage + taxonomy) */
:root {
    --accent:       #002868;
    --accent-2:     #1d4ed8;
    --accent-light: #eff6ff;
    --text:         #1f2328;
    --text-2:       #57606a;
    --text-3:       #8b949e;
    --border:       #d0d7de;
    --border-light: #e8ecef;
    --bg:           #ffffff;
    --bg-subtle:    #f6f8fa;
    --shadow-sm:    0 1px 3px rgba(0,0,0,0.10), 0 1px 2px rgba(0,0,0,0.06);
    --shadow-md:    0 4px 14px rgba(0,0,0,0.12);
    --navbar-h:     52px;
    --r:            6px;
    --max-w:        1100px;
}

*, *::before, *::after { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
    margin: 0;
    font-family: 'Source Sans 3', 'Helvetica Neue', Arial, sans-serif;
    font-size: 16px;
    color: var(--text);
    background: var(--bg);
    line-height: 1.6;
}

/* ── Navbar ──────────────────────────────────────────────────── */
.site-nav {
    position: sticky;
    top: 0;
    z-index: 50;
    height: var(--navbar-h);
    background: var(--bg);
    border-bottom: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
    display: flex;
    align-items: center;
    padding: 0 24px;
    gap: 32px;
}

.site-brand {
    display: flex;
    align-items: center;
    gap: 9px;
    text-decoration: none;
    color: inherit;
    flex-shrink: 0;
}

.site-brand-title {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text);
    letter-spacing: -0.02em;
}

.site-brand-tag {
    font-size: 0.7rem;
    color: var(--text-3);
    border-left: 1px solid var(--border);
    padding-left: 10px;
    margin-left: 2px;
    white-space: nowrap;
}

.site-nav-links {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-left: auto;
}

.site-nav-links a {
    padding: 5px 12px;
    border-radius: 5px;
    font-size: 0.875rem;
    font-weight: 500;
    text-decoration: none;
    color: var(--text-2);
    transition: all 0.13s;
}

.site-nav-links a:hover        { background: var(--bg-subtle); color: var(--text); }
.site-nav-links a.active       { background: var(--accent-light); color: var(--accent-2); font-weight: 600; }
.site-nav-links a.btn-primary  {
    background: var(--accent);
    color: white;
    margin-left: 6px;
}
.site-nav-links a.btn-primary:hover { background: var(--accent-2); color: white; }

/* ── Nav dropdowns ───────────────────────────────────────────── */
.nav-dropdown { position: relative; }

.nav-dropdown-trigger {
    display: inline-flex !important;
    align-items: center;
    gap: 3px;
    cursor: pointer;
    user-select: none;
}
.nav-caret {
    font-size: 0.68em;
    opacity: 0.55;
    transition: transform 0.15s;
    line-height: 1;
}
.nav-dropdown:hover .nav-caret { transform: rotate(180deg); }

.nav-dropdown-menu {
    display: none;
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    min-width: 196px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--r);
    box-shadow: var(--shadow-md);
    padding: 5px;
    z-index: 200;
}
.nav-dropdown:hover .nav-dropdown-menu { display: block; }

.nav-dropdown-menu a {
    display: block !important;
    padding: 6px 10px !important;
    border-radius: 4px !important;
    font-size: 0.85rem !important;
    color: var(--text-2) !important;
    background: none !important;
    white-space: nowrap;
}
.nav-dropdown-menu a:hover {
    background: var(--bg-subtle) !important;
    color: var(--text) !important;
}
.nav-dd-label {
    padding: 5px 10px 2px;
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-3);
}
.nav-dd-divider {
    height: 1px;
    background: var(--border-light);
    margin: 4px 0;
}
.nav-dropdown-trigger.active,
.nav-dropdown.active > .nav-dropdown-trigger {
    background: var(--accent-light) !important;
    color: var(--accent-2) !important;
    font-weight: 600 !important;
}

/* ── Layout ──────────────────────────────────────────────────── */
.page-wrap   { max-width: var(--max-w); margin: 0 auto; padding: 0 24px; }
.section     { padding: 64px 0; }
.section-sm  { padding: 40px 0; }
.section-alt { background: var(--bg-subtle); }

.section-label {
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--accent-2);
    margin-bottom: 8px;
}

.section-title {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text);
    letter-spacing: -0.02em;
    margin: 0 0 12px;
    line-height: 1.25;
}

.section-body {
    font-size: 1rem;
    color: var(--text-2);
    max-width: 640px;
    margin: 0 0 32px;
}

/* ── Hero ────────────────────────────────────────────────────── */
.hero {
    position: relative;
    background-image: url('img/cover.jpg');
    background-size: cover;
    background-position: center 40%;
    color: white;
    padding: 96px 24px 80px;
    text-align: center;
    isolation: isolate;
}
.hero::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(
        to bottom,
        rgba(5, 8, 22, 0.52) 0%,
        rgba(5, 8, 22, 0.42) 55%,
        rgba(5, 8, 22, 0.72) 100%
    );
    z-index: -1;
}

.hero-eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.78rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    background: rgba(255,255,255,0.15);
    padding: 4px 12px;
    border-radius: 100px;
    margin-bottom: 20px;
    opacity: 0.9;
}

.hero-title {
    font-size: clamp(2rem, 5vw, 3.25rem);
    font-weight: 700;
    letter-spacing: -0.03em;
    line-height: 1.15;
    margin: 0 0 16px;
}

.hero-sub {
    font-size: 1.1rem;
    opacity: 0.85;
    max-width: 580px;
    margin: 0 auto 36px;
    line-height: 1.55;
}

.hero-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
    flex-wrap: wrap;
}

.btn {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 11px 22px;
    border-radius: var(--r);
    font-size: 0.9rem;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.15s;
    border: 2px solid transparent;
    font-family: inherit;
    cursor: pointer;
}

.btn-white {
    background: white;
    color: var(--accent);
    border-color: white;
}
.btn-white:hover { background: var(--accent-light); border-color: var(--accent-light); color: var(--accent); }

.btn-outline-white {
    background: transparent;
    color: white;
    border-color: rgba(255,255,255,0.5);
}
.btn-outline-white:hover { border-color: white; background: rgba(255,255,255,0.1); }

/* ── Stats band ──────────────────────────────────────────────── */
.stats-band {
    background: var(--bg-subtle);
    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
    padding: 0;
}

.stats-band-inner {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    max-width: var(--max-w);
    margin: 0 auto;
}

.stat-block {
    padding: 24px 20px;
    border-right: 1px solid var(--border);
    text-align: center;
}
.stat-block:last-child { border-right: none; }

.stat-block-num {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text);
    font-family: 'Source Code Pro', monospace;
    letter-spacing: -0.02em;
    line-height: 1.1;
}

.stat-block-label {
    font-size: 0.75rem;
    color: var(--text-3);
    text-transform: uppercase;
    letter-spacing: 0.07em;
    margin-top: 4px;
}

/* ── Cards ───────────────────────────────────────────────────── */
.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 16px;
}

.card {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--r);
    padding: 20px;
    transition: box-shadow 0.15s;
}
.card:hover { box-shadow: var(--shadow-md); }

.card-flag { margin-bottom: 10px; line-height: 1; }
.card-flag img { border-radius: 50%; display: block; }

.card-title {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text);
    margin: 0 0 4px;
}

.card-meta {
    font-size: 0.8rem;
    color: var(--text-3);
    margin-bottom: 12px;
}

.card-badge {
    display: inline-block;
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 3px 8px;
    border-radius: 3px;
}
.badge-available { background: #dcfce7; color: #166534; }
.badge-soon      { background: #f1f5f9; color: var(--text-3); }

.card-stats {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px dashed var(--border);
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.card-stat-row {
    display: flex;
    justify-content: space-between;
    font-size: 0.75rem;
    color: var(--text-2);
}

.card-stat-row span {
    opacity: 0.8;
}

.card-stat-row strong {
    font-family: 'Source Code Pro', monospace;
    font-weight: 600;
    color: var(--text);
}

/* ── Method steps ────────────────────────────────────────────── */
.steps {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 24px;
    counter-reset: steps;
}

.step {
    counter-increment: steps;
    position: relative;
    padding-top: 10px;
}

.step-img {
    background: white;
    border: 1px solid var(--border-light);
    border-radius: var(--r);
    margin-bottom: 16px;
    aspect-ratio: 16 / 9;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

.step-img img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.step::before {
    content: counter(steps);
    position: absolute;
    left: 10px; top: 10px;
    width: 26px; height: 26px;
    background: var(--accent);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.75rem;
    z-index: 10;
    box-shadow: 0 0 0 3px white;
}
.step-title {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text);
    margin: 6px 0 6px;
}

.step-body {
    font-size: 0.875rem;
    color: var(--text-2);
    line-height: 1.55;
}

.step-tech {
    margin-top: 8px;
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

.tech-tag {
    font-size: 0.68rem;
    font-family: 'Source Code Pro', monospace;
    background: var(--bg-subtle);
    border: 1px solid var(--border);
    color: var(--text-2);
    padding: 2px 7px;
    border-radius: 3px;
}

/* ── Source logos ────────────────────────────────────────────── */
.source-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
}

.source-card {
    border: 1px solid var(--border);
    border-radius: var(--r);
    padding: 20px 24px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.source-name {
    font-weight: 700;
    font-size: 0.95rem;
    color: var(--text);
}

.source-desc {
    font-size: 0.82rem;
    color: var(--text-2);
    line-height: 1.5;
}

.source-tag {
    font-size: 0.68rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-3);
}

/* ── Footer ──────────────────────────────────────────────────── */
.site-footer {
    background: var(--text);
    color: rgba(255,255,255,0.7);
    padding: 32px 24px;
    font-size: 0.82rem;
}

.footer-inner {
    max-width: var(--max-w);
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
}

.footer-links {
    display: flex;
    gap: 16px;
}
.footer-links a {
    color: rgba(255,255,255,0.6);
    text-decoration: none;
    transition: color 0.15s;
}
.footer-links a:hover { color: white; }

/* ── Taxonomy page ───────────────────────────────────────────── */
.taxonomy-header {
    background: var(--bg-subtle);
    border-bottom: 1px solid var(--border);
    padding: 32px 24px;
}

.taxonomy-header-inner {
    max-width: var(--max-w);
    margin: 0 auto;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 24px;
    flex-wrap: wrap;
}

.tax-controls {
    display: flex;
    gap: 6px;
    align-items: center;
    flex-shrink: 0;
}

.tax-view-btn {
    padding: 6px 14px;
    border: 1px solid var(--border);
    border-radius: var(--r);
    background: var(--bg);
    font-family: inherit;
    font-size: 0.82rem;
    font-weight: 500;
    cursor: pointer;
    color: var(--text-2);
    transition: all 0.13s;
}
.tax-view-btn:hover { border-color: var(--accent-2); color: var(--accent-2); }
.tax-view-btn.active { background: var(--accent); color: white; border-color: transparent; }

#treemap-wrap {
    width: 100%;
    background: var(--bg-subtle);
    border-bottom: 1px solid var(--border);
    overflow: hidden;
}

#treemap-svg {
    display: block;
    width: 100%;
}

/* Treemap label text */
.node-label-t1 {
    font-family: 'Source Sans 3', sans-serif;
    font-size: 11px;
    font-weight: 700;
    fill: white;
    pointer-events: none;
    dominant-baseline: middle;
}

.node-label-t2 {
    font-family: 'Source Sans 3', sans-serif;
    font-size: 9px;
    fill: white;
    pointer-events: none;
    dominant-baseline: middle;
}

/* Tooltip */
#tax-tooltip {
    position: fixed;
    background: var(--text);
    color: white;
    padding: 8px 12px;
    border-radius: var(--r);
    font-size: 0.78rem;
    pointer-events: none;
    z-index: 100;
    max-width: 220px;
    line-height: 1.5;
    box-shadow: var(--shadow-md);
}
#tax-tooltip[hidden] { display: none; }
#tax-tooltip strong { display: block; margin-bottom: 2px; }

/* Taxonomy table */
.tax-table-wrap {
    max-width: var(--max-w);
    margin: 0 auto;
    padding: 32px 24px 64px;
}

.tax-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}

.tax-table th {
    text-align: left;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-3);
    padding: 6px 12px;
    border-bottom: 2px solid var(--border);
}

.tax-table td {
    padding: 5px 12px;
    border-bottom: 1px solid var(--border-light);
    vertical-align: middle;
}

.t1-header-row td {
    background: var(--bg-subtle);
    font-weight: 700;
    font-size: 0.82rem;
    padding: 8px 12px;
    border-bottom: 1px solid var(--border);
}

.t1-swatch {
    display: inline-block;
    width: 9px; height: 9px;
    border-radius: 50%;
    margin-right: 7px;
    vertical-align: middle;
}

.src-pill {
    display: inline-block;
    font-size: 0.63rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    padding: 1px 5px;
    border-radius: 3px;
    border: 1px solid;
    margin-right: 3px;
}
.src-pill-osm      { background: #fff7ed; color: #92400e; border-color: #fcd34d; }
.src-pill-overture { background: #f0fdf4; color: #166534; border-color: #86efac; }
.src-pill-both     { background: #eff6ff; color: #1d4ed8; border-color: #93c5fd; }

code.rule-count {
    font-family: 'Source Code Pro', monospace;
    font-size: 0.75rem;
    color: var(--text-3);
}

/* Discrepancy alert */
.discrepancy-flag {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 0.63rem;
    color: #b45309;
    background: #fefce8;
    border: 1px solid #fde68a;
    padding: 1px 5px;
    border-radius: 3px;
}

#table-view  { display: block; }
#treemap-view { display: block; }
