/* Takeoff Tracker - light editorial theme */

:root {
    --paper: #F7F5F0;
    --surface: #FFFFFF;
    --ink: #1B2430;
    --ink-2: #485364;
    --ink-3: #7B8492;
    --rule: #E2DED5;
    --rule-soft: #EDEAE3;
    --accent: #1F5E73;
    --accent-ink: #174A5B;
    --accent-soft: #E3EDF0;
    --warm: #A3632B;

    /* Type rule: serif only for the site name and page/section headings; sans for everything else */
    --serif: 'Newsreader', 'Iowan Old Style', Georgia, serif;
    --sans: 'IBM Plex Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;

    --rail: 232px;
    --measure: 940px;

    /* Legacy names still used by a few scripts */
    --primary-orange: var(--accent);
    --primary-orange-light: var(--accent);
    --primary-orange-dark: var(--accent-ink);
    --bg-dark: var(--paper);
    --bg-surface: var(--surface);
    --text-primary: var(--ink);
    --text-secondary: var(--ink-2);
    --border-color: var(--rule);
}

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

html { scroll-behavior: smooth; scroll-padding-top: 88px; }

body {
    font-family: var(--sans);
    font-size: 16px;
    line-height: 1.6;
    color: var(--ink);
    background: var(--paper);
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
    font-variant-numeric: tabular-nums;
}

a { color: var(--accent); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { color: var(--accent-ink); }

::selection { background: var(--accent-soft); }

.num { font-variant-numeric: tabular-nums; }

/* ---------- Masthead ---------- */

.masthead {
    position: sticky;
    top: 0;
    z-index: 100;
    background: rgba(247, 245, 240, 0.92);
    backdrop-filter: saturate(1.2) blur(8px);
    -webkit-backdrop-filter: saturate(1.2) blur(8px);
    border-bottom: 1px solid var(--rule);
}

.masthead-inner {
    max-width: calc(var(--rail) + var(--measure) + 96px);
    margin: 0 auto;
    padding: 14px 32px;
    /* brand | latest post (centered) | nav */
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
    align-items: center;
    gap: 24px;
}

.masthead-left { display: flex; align-items: center; gap: 14px; min-width: 0; }
.masthead-nav { grid-column: 3; justify-self: end; }

.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--ink);
    text-decoration: none;
}
.brand:hover { color: var(--ink); }

.brand-mark { width: 26px; height: 26px; flex-shrink: 0; }

.brand-name {
    font-family: var(--serif);
    font-size: 22px;
    font-weight: 600;
    letter-spacing: -0.01em;
    line-height: 1;
}

.masthead-nav {
    display: flex;
    align-items: center;
    gap: 22px;
    font-size: 14px;
}

.masthead-nav a {
    color: var(--ink-2);
    text-decoration: none;
}
.masthead-nav a:hover { color: var(--ink); }

.masthead-updated {
    font-size: 13px;
    color: var(--ink-3);
    white-space: nowrap;
}

/* Header "latest post" link (content filled by blog-snippet.js) */
.masthead .blog-button {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    max-width: 380px;
    color: var(--ink-2);
    text-decoration: none;
}
.masthead .blog-button { grid-column: 2; justify-self: center; justify-content: center; text-align: center; }
.masthead .blog-button:hover { color: var(--ink); }
.masthead .blog-button svg { width: 14px; height: 14px; flex-shrink: 0; color: var(--ink-3); }
.masthead .blog-button .blog-button-content { display: flex; flex-direction: column; align-items: center; gap: 1px; min-width: 0; }
.masthead .blog-button .blog-button-badge {
    font-size: 10.5px;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--accent);
    line-height: 1.2;
}
.masthead .blog-button .blog-button-title {
    font-size: 13px;
    color: var(--ink);
    line-height: 1.3;
    max-width: 340px;
    text-align: center;
    white-space: normal;
    overflow: visible;
    display: block;
    text-wrap: balance;
}

.menu-toggle {
    display: none;
    background: none;
    border: 1px solid var(--rule);
    border-radius: 6px;
    color: var(--ink);
    padding: 6px 10px;
    font: inherit;
    font-size: 13px;
    cursor: pointer;
}

/* ---------- Page layout ---------- */

.page {
    max-width: calc(var(--rail) + var(--measure) + 96px);
    margin: 0 auto;
    padding: 0 32px;
    display: grid;
    grid-template-columns: var(--rail) minmax(0, 1fr);
    column-gap: 64px;
}

/* Section rail */
.rail {
    position: sticky;
    top: 88px;
    align-self: start;
    max-height: calc(100vh - 110px);
    overflow-y: auto;
    padding: 56px 0 24px;
}

.rail-title {
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--ink-3);
    margin-bottom: 14px;
}

.rail ol { list-style: none; }

.rail a {
    display: grid;
    grid-template-columns: 26px 1fr;
    align-items: baseline;
    padding: 5px 0 5px 12px;
    margin-left: -13px;
    border-left: 1px solid transparent;
    color: var(--ink-2);
    text-decoration: none;
    font-size: 14px;
    line-height: 1.35;
    transition: color 0.15s ease, border-color 0.15s ease;
}
.rail a .rail-num { font-size: 11px; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.rail a:hover { color: var(--ink); }
.rail a.active { color: var(--ink); border-left-color: var(--accent); }
.rail a.active .rail-num { color: var(--accent); }

.content { min-width: 0; padding-bottom: 96px; }

/* ---------- Intro ---------- */

.intro {
    padding: 64px 0 40px;
    border-bottom: 1px solid var(--rule);
}

.eyebrow {
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--accent);
}

.intro h1 {
    font-family: var(--serif);
    font-weight: 500;
    font-size: clamp(34px, 4.4vw, 52px);
    line-height: 1.08;
    letter-spacing: -0.015em;
    margin: 12px 0 14px;
    max-width: 18ch;
}

.intro .dek {
    font-family: var(--sans);
    font-size: 20px;
    line-height: 1.5;
    color: var(--ink-2);
    max-width: 42em;
}

/* At a glance */
.glance {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    margin-top: 36px;
    border-top: 1px solid var(--ink);
}

.glance-item {
    padding: 14px 18px 4px 0;
    color: var(--ink);
    text-decoration: none;
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}
.glance-item + .glance-item { padding-left: 18px; border-left: 1px solid var(--rule); }
.glance-item:hover { color: var(--ink); }
.glance-item:hover .glance-value { color: var(--accent); }

.glance-label {
    font-size: 11.5px;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--ink-3);
}

.glance-value {
    font-family: var(--sans);
    font-size: 25px;
    font-weight: 500;
    line-height: 1.18;
    text-wrap: balance;
    overflow-wrap: anywhere;
    transition: color 0.15s ease;
}

.glance-value.is-text { font-size: 21px; line-height: 1.2; padding-top: 3px; }
.glance-sub { font-size: 13px; color: var(--ink-2); }
.glance-spark { display: block; width: 100%; height: 22px; margin-top: 4px; }

.skeleton {
    display: inline-block;
    width: 5.5em;
    height: 0.85em;
    background: var(--rule-soft);
    border-radius: 3px;
    vertical-align: middle;
}

/* ---------- Sections ---------- */

.section {
    padding: 64px 0 8px;
}

.section-head { margin-bottom: 22px; }

.section-kicker {
    display: flex;
    align-items: baseline;
    gap: 10px;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--ink-3);
}
.section-kicker .sec-num { color: var(--accent); font-variant-numeric: tabular-nums; }

.section-title {
    font-family: var(--serif);
    font-weight: 500;
    font-size: clamp(26px, 2.6vw, 34px);
    line-height: 1.15;
    letter-spacing: -0.01em;
    margin-top: 6px;
    color: var(--ink);
    text-shadow: none; /* the old dark theme gave headings an orange glow */
}

.section-lede {
    font-family: var(--sans);
    font-size: 18px;
    line-height: 1.5;
    color: var(--ink-2);
    margin-top: 8px;
    max-width: 40em;
}

.figure {
    background: var(--surface);
    border: 1px solid var(--rule);
    border-radius: 10px;
    padding: 24px 24px 20px;
}
.figure + .figure { margin-top: 20px; }

.figure-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--ink);
    line-height: 1.3;
}
.figure-sub { font-size: 13px; color: var(--ink-3); margin-top: 2px; }
.figure-head { margin-bottom: 14px; }

.chart-box { position: relative; width: 100%; height: 400px; }
.chart-box.tall { height: 480px; }
.chart-box canvas { display: block; }

.caption {
    margin-top: 16px;
    padding-top: 14px;
    border-top: 1px solid var(--rule-soft);
    font-size: 14px;
    line-height: 1.55;
    color: var(--ink-2);
    max-width: 52em;
}
.caption + .caption { border-top: 0; padding-top: 0; margin-top: 8px; }
.caption a { word-break: break-word; }

.state {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    min-height: 160px;
    color: var(--ink-3);
    font-size: 14px;
    text-align: center;
}
.state.error { color: var(--ink-2); }

.spinner {
    width: 14px;
    height: 14px;
    border: 1.5px solid var(--rule);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Forecast milestones ---------- */

.milestones {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0;
    border-bottom: 1px solid var(--rule-soft);
}

.milestone { padding: 4px 24px 22px 0; min-width: 0; }
.milestone + .milestone { padding-left: 24px; border-left: 1px solid var(--rule-soft); }

.milestone-label {
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--ink-3);
}

.milestone-date {
    font-family: var(--sans);
    font-size: clamp(30px, 3.4vw, 42px);
    font-weight: 500;
    line-height: 1.1;
    letter-spacing: -0.015em;
    margin: 6px 0 4px;
    color: var(--ink);
}
.milestone-date.is-near { color: var(--warm); }

.milestone-away { font-size: 15px; color: var(--ink-2); }
.milestone-range { font-size: 13.5px; color: var(--ink-3); margin-top: 6px; }
.milestone-range strong { font-weight: 500; color: var(--ink-2); }
.milestone-meta { font-size: 12px; color: var(--ink-3); margin-top: 8px; }
.milestone-meta a { color: var(--ink-3); }
.milestone-meta a:hover { color: var(--accent); }

.range-chart { margin-top: 18px; }
.range-chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.range-chart text { font-family: var(--sans); }

/* ---------- Tables ---------- */

.table-scroll { width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14.5px;
    line-height: 1.45;
    color: var(--ink);
}

.data-table th {
    text-align: left;
    font-size: 11.5px;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--ink-3);
    padding: 0 12px 10px;
    border-bottom: 1px solid var(--ink);
    white-space: nowrap;
}

.data-table td {
    padding: 14px 12px;
    border-bottom: 1px solid var(--rule-soft);
    vertical-align: top;
}
.data-table tr:last-child td { border-bottom: 0; }
.data-table th:first-child, .data-table td:first-child { padding-left: 0; }
.data-table th:last-child, .data-table td:last-child { padding-right: 0; }
.data-table .r { text-align: right; }
.data-table .c { text-align: center; }
.data-table .muted { color: var(--ink-2); }
.data-table .strong { font-weight: 500; }
.data-table tbody tr { transition: background-color 0.12s ease; }
.data-table tbody tr:hover { background: #FBFAF7; }

.table-icon { width: 18px; height: 18px; color: var(--ink-3); stroke-width: 1.6; }

/* Inline bar inside a table cell */
.cell-bar { display: flex; align-items: center; gap: 10px; min-width: 120px; }
.cell-bar .bar { flex: 1; height: 6px; background: var(--rule-soft); border-radius: 3px; overflow: hidden; min-width: 48px; }
.cell-bar .bar span { display: block; height: 100%; background: var(--accent); border-radius: 3px; }
.cell-bar .val { min-width: 3.2em; text-align: right; font-variant-numeric: tabular-nums; }

/* Leaderboard */
.lb-rank { width: 44px; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.lb-model { font-weight: 500; word-break: break-word; }
.lb-org { display: inline-flex; align-items: center; gap: 8px; color: var(--ink-2); white-space: nowrap; }
.lb-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.lb-ci { color: var(--ink-3); font-size: 0.85em; margin-left: 4px; }
.lb-score { min-width: 190px; }
.lb-score .cell-bar { gap: 12px; }
.lb-score .val { font-weight: 500; }
.lb-table { background: #fff; }
.lb-table td { vertical-align: middle; }
.lb-table tbody tr.lb-row { background: var(--org-tint); }
.lb-table tbody tr.lb-row:hover { background: var(--org-tint-hover); }
.lb-table tbody tr.lb-row td:first-child { padding-left: 14px; box-shadow: inset 3px 0 0 var(--org); }
.lb-table tbody tr.lb-row td:last-child { padding-right: 12px; }
.lb-table thead th { background: transparent; color: var(--ink-3); }
.lb-table thead th:first-child { padding-left: 14px; }
.lb-table thead th:last-child { padding-right: 12px; }
.lb-table .cell-bar .bar span { background: var(--org); }
.lb-table .lb-org { color: var(--ink); }
.data-table tr.lb-top .lb-rank { color: var(--accent); font-weight: 600; }
.data-table tr.lb-top .lb-model { color: var(--accent-ink); }

/* People */
.person-name { font-weight: 600; font-size: 15px; }
.person-links { margin-top: 4px; font-size: 13px; }
.person-links a { color: var(--ink-2); }
.doom-meter { display: inline-flex; gap: 3px; vertical-align: middle; margin-right: 8px; }
.doom-meter i { width: 14px; height: 6px; border-radius: 2px; background: var(--rule); display: block; }
.doom-meter i.on { background: var(--ink-2); }
.doom-label { font-weight: 500; }
.doom-text { font-size: 13.5px; color: var(--ink-2); margin-top: 4px; }

/* ---------- Embedded game ---------- */

.embed { width: 100%; height: 60vh; min-height: 420px; border: 0; border-radius: 6px; display: block; background: #0b1020; }

/* ---------- Blog snippet overrides ---------- */

.blog-footer-container .blog-snippet-date { font-size: 12.5px; letter-spacing: 0.04em; text-transform: uppercase; color: var(--ink-3); }
.blog-footer-container .blog-snippet-title { font-family: var(--sans); font-size: 24px; font-weight: 600; line-height: 1.2; }
.blog-footer-container .blog-snippet-title a { color: var(--ink); }
.blog-footer-container .blog-snippet-title a:hover { color: var(--accent); }
.blog-footer-container .blog-snippet-subheadline { font-family: var(--sans); font-size: 18px; color: var(--ink-2); }
.blog-footer-container .blog-snippet-description { font-size: 15px; color: var(--ink-2); }
.blog-footer-container .blog-snippet-image { width: 240px; height: 240px; border-radius: 6px; }
.blog-footer-container .blog-snippet-image a:hover img { transform: none; opacity: 0.92; }
.blog-footer-container .blog-snippet-read-more svg { width: 14px; height: 14px; }

/* ---------- Footer ---------- */

.site-footer {
    border-top: 1px solid var(--rule);
    background: var(--paper);
}
.site-footer-inner {
    max-width: calc(var(--rail) + var(--measure) + 96px);
    margin: 0 auto;
    padding: 28px 32px 40px;
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 16px;
    font-size: 13px;
    color: var(--ink-3);
}
.site-footer .footer-brand { font-family: var(--serif); font-size: 17px; color: var(--ink); background: none; text-shadow: none; }
.site-footer .footer-links { display: flex; gap: 20px; }
.site-footer .footer-links a { color: var(--ink-2); font-size: 14px; text-decoration: none; }
.site-footer .footer-links a:hover { color: var(--accent); text-decoration: underline; text-underline-offset: 3px; }

/* ---------- Responsive ---------- */

@media (max-width: 1180px) {
    .page { grid-template-columns: minmax(0, 1fr); }
    .rail {
        position: fixed;
        top: 0;
        left: 0;
        bottom: 0;
        width: 280px;
        max-height: none;
        z-index: 300;
        background: var(--paper);
        border-right: 1px solid var(--rule);
        padding: 72px 28px 28px 40px;
        transform: translateX(-100%);
        transition: transform 0.25s ease;
    }
    .rail.open { transform: none; box-shadow: 0 0 0 100vmax rgba(27, 36, 48, 0.25); }
    .menu-toggle { display: inline-block; }
    .content { max-width: var(--measure); margin: 0 auto; width: 100%; }
}

@media (max-width: 860px) {
    .masthead-inner { padding: 12px 20px; gap: 14px; }
    .masthead .blog-button .blog-button-title { display: none; }
    .masthead-updated { display: none; }
    .page { padding: 0 20px; }
    .site-footer-inner { padding: 24px 20px 32px; }
    .glance { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .glance-item:nth-child(3) { padding-left: 0; border-left: 0; }
    .glance-item:nth-child(n+3) { border-top: 1px solid var(--rule); }
    .milestones { grid-template-columns: minmax(0, 1fr); }
    .milestone + .milestone { padding-left: 0; border-left: 0; border-top: 1px solid var(--rule-soft); padding-top: 18px; }
    .chart-box { height: 340px; }
    .chart-box.tall { height: 420px; }
    .figure { padding: 18px 16px 16px; }
    .blog-footer-container .blog-snippet-image { width: 100%; height: auto; aspect-ratio: 1.6; align-self: stretch; }
}

@media (max-width: 520px) {
    body { font-size: 15px; }
    .intro { padding: 40px 0 28px; }
    .intro .dek { font-size: 18px; }
    .glance-value { font-size: 22px; }
    .glance-value.is-text { font-size: 18px; }
    .section { padding-top: 48px; }
    .brand-name { font-size: 20px; }
    .masthead-nav { gap: 14px; }
    .data-table { font-size: 14px; }
    .embed { min-height: 360px; }
}

@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    * { transition: none !important; animation-duration: 0.01ms !important; }
}

/* ---------- Reading list ---------- */

.reading-list { list-style: none; counter-reset: read; }
.reading-list li {
    display: grid;
    grid-template-columns: 2.2em minmax(0, 1fr);
    column-gap: 8px;
    padding: 18px 0;
    border-bottom: 1px solid var(--rule-soft);
    counter-increment: read;
}
.reading-list li:first-child { padding-top: 4px; }
.reading-list li:last-child { border-bottom: 0; padding-bottom: 4px; }
.reading-list li::before {
    content: counter(read, decimal-leading-zero);
    font-size: 12px;
    color: var(--ink-3);
    padding-top: 6px;
    font-variant-numeric: tabular-nums;
}
.read-title { font-family: var(--sans); font-size: 18px; font-weight: 600; line-height: 1.3; }
.read-meta { font-size: 13.5px; color: var(--ink-3); margin-top: 2px; }
.read-meta a { color: var(--ink-2); }
.read-why { font-size: 15px; color: var(--ink-2); margin-top: 6px; max-width: 46em; }

/* ---------- Trellis (small multiples) ---------- */

.trellis {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 22px 20px;
    touch-action: pan-y;
}
.trellis > .state { grid-column: 1 / -1; }
/* Full sector name on its own line (wraps if needed); plots stay aligned along each row */
.trellis-cell { min-width: 0; border-top: 1px solid var(--ink); padding-top: 8px; display: flex; flex-direction: column; }
.trellis-head { display: block; }
.trellis-name { display: block; font-size: 12.5px; font-weight: 600; color: var(--ink); line-height: 1.3; overflow-wrap: anywhere; }
.trellis-val { display: block; margin-top: 2px; font-size: 12.5px; color: var(--ink); font-weight: 500; }
.trellis-delta { margin-bottom: 6px; font-size: 11.5px; color: var(--ink-3); margin-top: 1px; min-height: 1.3em; }
.trellis-delta.is-down { color: var(--warm); }
.trellis-plot { position: relative; height: 96px; margin-top: auto; cursor: crosshair; }
#ner-hover-date { color: var(--ink-2); font-variant-numeric: tabular-nums; }

@media (max-width: 1180px) { .trellis { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
@media (max-width: 860px) { .trellis { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 560px) { .trellis { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px 16px; } .trellis-plot { height: 80px; } }

