/* ============================================================================
   elements-live — page styles layered on modernist.css (design system).
   The light "modernist" page hosts two dark data-viz panels: the 3D periodic
   table and the 100-year timeline. Categorical hues live on :root so the chart
   JS can read them regardless of which panel it's rendered in.
   ========================================================================== */

:root {
    /* Dark-theme flip of modernist.css's base tokens, so the whole page
       matches the already-dark table/timeline panels instead of sitting on
       a light page around them. --color-bg reuses --panel-bg's exact value
       (below) so the page background and the panels are one continuous
       surface, not two different darks. Components that key off --color-text
       as a background (stats band, featured pricing tier, CTA section) keep
       working: they now render as light call-out blocks on the dark page,
       the mirror image of the light-theme dark call-outs, so their contrast
       relationships stay intact automatically. */
    --color-bg: #17100f;
    --color-surface: #1f1817;
    --color-text: #f3efed;
    --color-divider: color-mix(in srgb, #f3efed 18%, transparent);

    /* Categorical slots, dark-mode steps, fixed order (blue, aqua, yellow,
       green, violet, red, magenta, orange) — see the dataviz skill's
       reference palette. Order is the CVD-safety mechanism; never reorder. */
    --cat-alkali-alkaline-earth: #3987e5;
    --cat-transition-metal: #199e70;
    --cat-lanthanide: #c98500;
    --cat-actinide: #008300;
    --cat-post-transition-metal: #9085e9;
    --cat-metalloid: #e66767;
    --cat-reactive-nonmetal: #d55181;
    --cat-noble-gas: #d95926;

    --panel-bg: #17100f;   /* warm near-black, tuned to the modernist ink */
    --panel-bg-2: #1f1817;

    /* Research-heat sequential ramp (replaces the old green/blue/red
       categorical buckets, which read as identity, not magnitude, and didn't
       match the site's warm accent). One analogous warm hue family — dark,
       low-chroma "inactive" rising to a bright, saturated "active" orange —
       per the dataviz sequential-encoding rule (one hue, low→high on a dark
       surface) and color-wheel analogous harmony (red → red-orange → orange
       all sit next to each other on the wheel). Single source of truth: both
       the table's JS interpolation and the legend gradient below read these. */
    --heat-0: #241a17;  /* inactive — barely lifts off the panel */
    --heat-1: #7a2a12;  /* low — deep rust */
    --heat-2: #e0501c;  /* intermediate — vivid red-orange */
    --heat-3: #ff8a2e;  /* active/hot — bright orange, the peak */
}

.wrap { max-width: 1240px; margin: 0 auto; padding: 0 clamp(20px, 5vw, 64px); }
.mono { font-variant-numeric: tabular-nums; }
.section { padding: clamp(32px, 5vh, 56px) 0; scroll-margin-top: 70px; }
.kicker {
    font-size: 12px; letter-spacing: .09em; text-transform: uppercase;
    color: var(--color-accent-500); font-weight: 600;
}
nav.nav { position: sticky; top: 0; z-index: 100; background: var(--color-bg); }
nav.nav a.btn { color: var(--color-bg); }
.nav-brand { display: flex; align-items: center; gap: 8px; }
.nav-logo { height: 28px; width: 28px; object-fit: contain; }
/* Below this, brand + 4 links + CTA button no longer fit one row and the
   button overflows the viewport; drop the text links, keep the CTA. */
@media (max-width: 640px) {
    nav.nav a:not(.btn) { display: none; }
}

/* ---- hero ---- */
.hero { padding: clamp(40px, 7vh, 88px) 0 clamp(28px, 4vh, 48px); }
.hero-eyebrow {
    display: flex; align-items: center; gap: 10px; margin-bottom: 22px;
    font-size: 12px; letter-spacing: .09em; text-transform: uppercase;
    color: var(--color-accent-500); font-weight: 600;
}
.livedot {
    width: 9px; height: 9px; background: var(--color-accent); display: block;
    animation: blink 1.6s steps(1, end) infinite;
}
@keyframes blink { 0%, 100% { opacity: 1; } 50% { opacity: 0.25; } }
.hero-title {
    font-size: clamp(44px, 6.4vw, 92px); line-height: 1.02; letter-spacing: -0.025em;
    margin: 0; max-width: 16ch;
}
.hero-sub {
    font-size: clamp(17px, 1.5vw, 20px); line-height: 1.5; max-width: 60ch;
    margin: 24px 0 0; color: color-mix(in srgb, var(--color-text) 82%, transparent);
}
.hero-actions { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 30px; }

/* ---- section head + inline legend ---- */
.section-head {
    display: flex; justify-content: space-between; align-items: flex-end;
    flex-wrap: wrap; gap: 16px; margin-bottom: 20px;
}
/* Continuous heat-scale legend — a gradient bar, not discrete swatches, now
   that tile color is a sequential function of EPS rather than 3 buckets. */
.heat-scale { display: flex; align-items: center; gap: 10px; font-size: 12px; }
.heat-scale[hidden] { display: none; }
.heat-scale-label { text-transform: uppercase; letter-spacing: .08em; color: color-mix(in srgb, var(--color-text) 55%, transparent); }
.heat-scale-bar {
    width: 160px; height: 10px; border-radius: 2px;
    background: linear-gradient(to right, var(--heat-0), var(--heat-1), var(--heat-2), var(--heat-3));
}

/* ---- dark data-viz panel ---- */
.dark-panel {
    background: var(--panel-bg); color: #e7e3e1; padding: clamp(12px, 2vw, 24px);
}

/* ============================================================================
   3D periodic table (dark) — preserved from the original build.
   ========================================================================== */

.table-3d-container { perspective: 1500px; padding: 2rem 0; }

.periodic-table {
    display: grid;
    /* minmax(0, 1fr): without the 0 floor, a 1fr track's implicit minimum is
       "auto" (its content's min-content size), so the grid refuses to shrink
       past that and overflows the viewport at high zoom / narrow windows. */
    grid-template-columns: repeat(18, minmax(0, 1fr));
    grid-template-rows: repeat(10, minmax(0, 1fr));
    /* Scopes the cqw text units below to *this* box's own rendered width
       (capped by max-width), so element text stays proportional to the actual
       cell size at every zoom level and window width. */
    container-type: inline-size;
    gap: 5px;
    max-width: 1200px;
    margin: auto;
    transition: transform 1s ease-in-out;
}
body.is-3d-view .periodic-table { transform: rotateX(40deg); transform-style: preserve-3d; }

/* Chart panel embedded directly in the grid's own natural gap — periods 2-3
   only use columns 1-2 and 13-18 (no transition metals yet), leaving columns
   3-12 empty across those two rows for the chart to sit in, rather than
   floating it outside the table. */
.chart-wrapper-grid {
    display: flex;
    flex-direction: column;
    /* Tight on purpose: the natural gap this panel fits into is only ~2 square
       cells tall (~110-140px depending on table width), so its own chrome has
       to be compact rather than sized for a full standalone chart card. */
    padding: 0.4rem 0.75rem;
    background-color: var(--panel-bg-2);
    border: 1px solid #332a28;
    border-radius: 4px;
    z-index: 5;
    transition: transform 1s ease-in-out;
    transform-style: preserve-3d;
    /* min-height:0 alone isn't enough — a grid row's "auto" track size is
       still measured from this item's own content (title + canvas) even
       with that set, so rows 2-3 would still get pulled taller than the
       square element cells elsewhere need. contain:size removes this
       item from that measurement entirely: it contributes nothing to the
       rows' auto-sizing, so the *cells* set the row height, and this panel
       just stretches to fill whatever area that produces — scaling the
       chart to the gap instead of the gap to the chart. */
    min-height: 0;
    contain: size;
    overflow: hidden;
}
.chart-container { position: relative; flex-grow: 1; min-height: 0; }
/* The table tilts rotateX(40deg) in 3D; this counter-rotates the same amount
   the other way (plus a Z-lift clear of the pillars) so the chart panel
   stands upright and head-on to the viewer instead of lying flat with the
   rest of the tilted table. */
body.is-3d-view .chart-wrapper-grid {
    /* The panel counter-rotates to stand flat/head-on, so it doesn't get the
       perspective foreshortening the tilted table cells around it get — next
       to them it reads as too wide. scaleX pinches it slightly to match the
       narrower effective space the tilt creates. */
    transform: translateZ(150px) rotateX(-40deg) scaleX(0.9);
    box-shadow: 0 30px 60px rgba(0, 0, 0, 0.5);
}

.element-cell {
    position: relative;
    display: flex;
    aspect-ratio: 1 / 1;
    cursor: pointer;
    background-color: transparent;
    border: none;
    padding: 0;
    transform-style: preserve-3d;
    transition: none;
}

.element-face {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    /* Set per-cell by JS (today's live EPS on load; a historical share value
       each time-lapse frame) — see heatColor()/applyHeatColor() in main.js.
       Fallbacks match the old static colors so disabled/unscripted cells
       still render sensibly. */
    background-color: var(--heat-bg, #212121);
    border: 1px solid var(--heat-border, #333);
    border-radius: 4px;
    padding: 2px;
    text-align: center;
    color: #e0e0e0;
    overflow: visible;

    --translate-z: 0px;
    --pillar-height: 0px;
    --scale: 1;
    transform: scale(var(--scale)) translateZ(var(--translate-z));
    transform-style: preserve-3d;
    transition: transform 0.2s ease-out, background-color 0.5s ease, border-color 0.5s ease;
}

body.is-3d-view .element-face {
    transition: transform 1s cubic-bezier(0.34, 1.56, 0.64, 1) var(--animation-delay, 0s),
                background-color 0.5s ease, border-color 0.5s ease;
}

body.is-3d-view .element-cell { box-shadow: 0 10px 20px rgba(0, 0, 0, 0.4); }

.element-face .atomic-number, .element-face .symbol, .element-face .name {
    position: relative;
    z-index: 2;
}
.element-face .symbol { font-size: 1.5cqw; font-weight: 700; }
.element-face .name { font-size: 0.7cqw; line-height: 1; }
.element-face .atomic-number { position: absolute; top: 4px; left: 4px; font-size: 0.6cqw; opacity: 0.7; }

.element-cell.disabled .element-face {
    background-color: #1a1a1a;
    color: #444;
    cursor: not-allowed;
    border-color: #2a2a2a;
}

/* Pillar sides */
body.is-3d-view .element-face::before,
body.is-3d-view .element-face::after {
    content: '';
    position: absolute;
    background: inherit;
    filter: brightness(0.6);
    z-index: 1;
}
body.is-3d-view .element-face::before { width: 100%; height: var(--pillar-height); }
body.is-3d-view .element-face::after { width: var(--pillar-height); height: 100%; }
.pillar-up .element-face::before { left: 0; top: 100%; transform-origin: top; transform: rotateX(-90deg); }
.pillar-up .element-face::after { top: 0; right: 100%; transform-origin: right; transform: rotateY(-90deg); }
.pillar-down .element-face::before { left: 0; bottom: 100%; transform-origin: bottom; transform: rotateX(90deg); }
.pillar-down .element-face::after { top: 0; left: 100%; transform-origin: left; transform: rotateY(90deg); }

.element-cell:not(.disabled) .element-face:hover {
    --scale: 1.1;
    border-color: var(--color-accent);
    z-index: 10;
}
.element-cell.active .element-face {
    background-color: var(--color-accent) !important;
    border-color: var(--color-accent-500);
    color: #fff;
    --scale: 1.05;
    opacity: 1 !important;
}

.lanthanide-label, .actinide-label {
    grid-column-start: 3;
    background-color: #2a2422;
    border: 1px solid #3a3230;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8cqw;
    color: #a49b97;
}

@container (max-width: 700px) {
    .element-face .name { display: none; }
}

/* modernist.css's .btn sets display:inline-flex, an author rule that beats
   the UA [hidden]{display:none} rule regardless of specificity — so any
   .btn given the hidden attribute anywhere on the site would stay visible
   without this. */
.btn[hidden] { display: none; }

/* ---- table controls ---- */
.table-controls {
    display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
    margin-top: 12px; justify-content: center;
}
.table-hint { font-size: 12px; color: #8f8783; }

/* .btn-secondary's default text color is the light-page ink — near-invisible
   on this dark panel, so both control bars need an explicit light override. */
.table-controls .btn-secondary { color: #e7e3e1; border-color: #4a3f3c; }
.table-controls .btn-secondary:hover { background: rgba(255, 255, 255, 0.07); }
#play-timelapse.is-playing { background: var(--color-accent); color: var(--color-bg); border-color: var(--color-accent); }
#toggle-timeline-tab.is-active { background: var(--color-accent-500); color: var(--color-bg); border-color: var(--color-accent-500); }

/* ---- tab panels: the periodic table and the 100-year chart swap in the
   same slot rather than living in two separate scrollable sections. ---- */
#tab-panel-timeline { padding: 8px 4px 4px; }

/* ---- 100-year pillar time-lapse ---- */
.timelapse-controls {
    display: flex; align-items: center; gap: 14px;
    margin: 14px auto 0; max-width: 640px;
    padding: 10px 16px;
    background: var(--panel-bg-2);
    border: 1px solid #332a28;
}
.timelapse-controls[hidden] { display: none; }
.timelapse-year {
    font-family: var(--font-heading); font-weight: 800; font-size: 20px;
    color: var(--color-accent-500); min-width: 3.5ch; text-align: center;
}
.timelapse-controls .scrub {
    flex: 1; height: 4px; accent-color: var(--color-accent-500);
    background: #3a302d; cursor: pointer;
}
.timelapse-controls .btn { white-space: nowrap; padding: 6px 12px; font-size: 12px; color: #e7e3e1; border-color: #4a3f3c; }

/* While time-lapsing, pillars must catch up to a new frame every ~150ms — the
   1s bounce + per-cell stagger tuned for the one-shot 3D toggle would lag
   noticeably behind, so swap in a quicker, unstaggered transition. Declared
   after body.is-3d-view .element-face so it wins on equal specificity. */
body.is-timelapse .element-face {
    transition: transform 0.4s ease-out, background-color 0.4s ease, border-color 0.4s ease;
}
@media (prefers-reduced-motion: reduce) {
    body.is-timelapse .element-face { transition: transform 0.05s linear, background-color 0.05s linear, border-color 0.05s linear; }
}

/* ---- element detail card (dark, appears on click) ---- */
.detail-card {
    margin-top: 18px;
    display: grid;
    /* Widened from the old 200-240px: the hero now packs the symbol *and*
       the stats grid side by side (see .detail-hero-main below), which the
       old symbol-only width couldn't fit — stats had nowhere to go and
       spilled out over the papers column. */
    grid-template-columns: minmax(340px, 420px) 1fr;
    background: var(--panel-bg-2);
    border: 1px solid #332a28;
}
.detail-card[hidden] { display: none; }
.detail-hero {
    background: var(--color-accent);
    color: var(--color-bg);
    padding: 22px 24px;
    display: flex;
    flex-direction: column;
}
.detail-hero-top { display: flex; justify-content: space-between; font-size: 12px; }
.detail-hero-main {
    display: flex;
    gap: 20px;
    align-items: flex-start;
    margin-bottom: 16px;
}
.detail-hero-symbol-col {
    flex: none;
    width: 130px;
}
.detail-sym { font-family: var(--font-heading); font-weight: 800; font-size: 56px; line-height: .9; margin: 0; }
/* Width is fixed on the column above so a long name (e.g. "Praseodymium")
   can't stretch it and squeeze the stats grid — main.js scales this
   font-size down by name length instead, and the wrap here is a fallback
   for names too long to fit even at the smallest step. */
.detail-name {
    font-family: var(--font-heading); font-weight: 800; font-size: 16px; margin-top: 6px;
    overflow-wrap: break-word;
}
.detail-hero-stats {
    flex: 1;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px 18px;
}
.detail-hero-stat { display: flex; flex-direction: column; gap: 3px; }
.detail-hero-stat-label { font-size: 8px; text-transform: uppercase; letter-spacing: .08em; opacity: .7; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.detail-hero-stat-value { font-family: var(--font-heading); font-weight: 800; font-size: 14px; font-variant-numeric: tabular-nums; }
.detail-hero-props {
    width: 100%;
    margin-top: 14px;
    padding-top: 12px;
    border-top: 1px solid rgba(255, 255, 255, 0.2);
    font-size: 11px;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 10px 16px;
}
.detail-hero-props-row {
    display: flex;
    flex-direction: column;
    gap: 3px;
}
.detail-hero-props-label {
    flex: none;
    text-transform: uppercase;
    letter-spacing: .08em;
    opacity: .7;
    font-size: 9px;
}
.detail-hero-props-value {
    font-variant-numeric: tabular-nums;
    font-weight: 500;
}
.detail-body { padding: 20px 24px; position: relative; }
.detail-close { position: absolute; top: 14px; right: 14px; padding: 4px 10px; font-size: 12px; color: #e7e3e1; border-color: #4a3f3c; }
.detail-stat-label { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: #8f8783; }
.detail-papers-section + .detail-papers-section { margin-top: 18px; }
.detail-paper { border-top: 1px solid #332a28; padding: 7px 0; }
.detail-paper-title { display: block; width: 100%; text-align: left; background: none; border: none; padding: 0; font: inherit; font-size: 13px; line-height: 1.35; color: #e7e3e1; text-decoration: none; cursor: pointer; }
.detail-paper-title:hover, .detail-paper-title:focus-visible { color: var(--color-accent); text-decoration: underline; }
.detail-paper-meta { font-size: 11px; color: #8f8783; margin-top: 2px; font-variant-numeric: tabular-nums; }

/* ---- paper modal (abstract + share, opened from a detail-card paper title) ---- */
.paper-modal-backdrop {
    position: fixed;
    inset: 0;
    z-index: 300;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}
.paper-modal-backdrop[hidden] { display: none; }
.paper-modal {
    position: relative;
    width: 100%;
    max-width: 560px;
    max-height: 80vh;
    overflow-y: auto;
    background: var(--panel-bg-2);
    border: 1px solid #332a28;
    box-shadow: var(--shadow-lg);
    padding: 24px;
    color: #e7e3e1;
}
.paper-modal-title { font-family: var(--font-heading); font-weight: 800; font-size: 18px; line-height: 1.3; margin: 6px 32px 6px 0; }
.paper-modal-authors { font-size: 12px; color: #cfc9c6; margin-bottom: 14px; }
.paper-modal-abstract { font-size: 13px; line-height: 1.55; color: #cfc9c6; margin: 0 0 20px; }
.paper-modal-abstract:empty::before,
.paper-modal-abstract.is-empty { color: #8f8783; font-style: italic; }
.paper-modal-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.paper-modal-actions .btn { font-size: 13px; padding: 8px 14px; }
#paper-modal-fulltext[aria-disabled="true"] { pointer-events: none; opacity: .5; }
.paper-modal-share { position: relative; }
.paper-modal-share-menu {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    z-index: 10;
    display: flex;
    flex-direction: column;
    min-width: 160px;
    background: var(--panel-bg-2);
    border: 1px solid #332a28;
    box-shadow: var(--shadow-lg);
}
.paper-modal-share-menu[hidden] { display: none; }
.paper-modal-share-link {
    display: block;
    width: 100%;
    text-align: left;
    background: none;
    border: none;
    border-bottom: 1px solid #332a28;
    padding: 9px 12px;
    font: inherit;
    font-size: 12px;
    color: #e7e3e1;
    text-decoration: none;
    cursor: pointer;
}
.paper-modal-share-link:last-child { border-bottom: none; }
.paper-modal-share-link:hover, .paper-modal-share-link:focus-visible { background: rgba(255, 255, 255, 0.07); color: var(--color-accent); }

@media (max-width: 480px) {
    .paper-modal { padding: 20px; max-height: 88vh; }
}

@media (max-width: 720px) {
    .detail-card { grid-template-columns: 1fr; }
}

/* ---- element properties hover popup (static reference data, layered over
   the grid — independent of the EPS heat/click-detail systems above) ---- */
.props-popup {
    position: fixed;
    z-index: 200;
    pointer-events: none;
    width: 260px;
    background: var(--panel-bg-2);
    border: 1px solid #332a28;
    box-shadow: var(--shadow-lg);
    padding: 14px 16px;
    color: #e7e3e1;
}
.props-popup[hidden] { display: none; }
.props-popup-head { display: flex; align-items: flex-start; gap: 10px; }
.props-popup-symbol-box {
    flex: none;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-heading);
    font-weight: 800;
    font-size: 15px;
    color: #fff;
    background: var(--props-cat-color, var(--color-accent));
}
.props-popup-headtext { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.props-popup-name { font-family: var(--font-heading); font-weight: 800; font-size: 15px; line-height: 1.15; }
.props-popup-sub { font-size: 11px; color: #8f8783; }
.props-popup-summary { font-size: 12px; line-height: 1.4; margin: 10px 0 0; color: #cfc9c6; }
.props-popup-summary:empty { display: none; }
.props-popup-grid {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid #332a28;
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.props-popup-row { display: flex; justify-content: space-between; gap: 10px; font-size: 12px; }
.props-popup-row-label {
    flex: none;
    color: #8f8783;
    text-transform: uppercase;
    font-size: 10px;
    letter-spacing: .06em;
    white-space: nowrap;
    padding-top: 1px;
}
.props-popup-row-value { text-align: right; font-variant-numeric: tabular-nums; }

/* ---- application-evolution viz (3 forms, one dark panel) ---- */
.viz-toggle { display: inline-flex; border: 1px solid var(--color-divider); }
.viz-toggle-btn {
    font-family: var(--font-heading); font-weight: 800; font-size: 12px;
    padding: 7px 14px; background: transparent; color: var(--color-text);
    border: none; border-left: 1px solid var(--color-divider); cursor: pointer;
}
.viz-toggle-btn:first-child { border-left: none; }
.viz-toggle-btn:hover { background: color-mix(in srgb, var(--color-text) 7%, transparent); }
.viz-toggle-btn.is-active { background: var(--color-accent); color: var(--color-bg); }

.evolution-panel { padding: clamp(16px, 2.4vw, 30px); }
.evolution-title { font-size: 13px; color: #b7afab; margin-bottom: 12px; max-width: 70ch; }
.evolution-chart { position: relative; width: 100%; }
#evolution-svg { width: 100%; height: auto; display: block; }
#evolution-svg text { font-family: var(--font-body); }
.evolution-empty {
    position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
    text-align: center; color: #8f8783; font-size: 14px; pointer-events: none;
}
/* A `display` rule overrides the UA [hidden]{display:none}, so restore hiding
   explicitly — otherwise the prompt stays painted on top of a rendered chart. */
.evolution-empty[hidden] { display: none; }
.evolution-legend { margin-top: 14px; max-width: none; color: #cfc9c6; }
.evolution-legend .legend-item {
    cursor: pointer; font-size: 13px; padding: 3px 8px; transition: opacity .15s ease;
}
.evolution-legend .legend-item.is-dim { opacity: 0.32; }
.evolution-legend .legend-color { width: 12px; height: 12px; border-radius: 3px; border: none; }

/* stat band ↓ */

/* ---- stats band (dark) ---- */
.stats-section { background: var(--color-text); color: var(--color-bg); }
.stats-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 24px; padding: clamp(34px, 4vh, 52px) 0; }
.stat-tile { border-left: 2px solid var(--color-accent); padding-left: 16px; }
.stat-value { font-family: var(--font-heading); font-weight: 800; font-size: clamp(30px, 3.4vw, 46px); line-height: 1; }
.stat-label { font-size: 12px; text-transform: uppercase; letter-spacing: .08em; margin-top: 8px; opacity: .7; }

/* ---- how it works ---- */
.steps-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0; margin-top: 36px; }
.step { border-top: 2px solid var(--color-text); padding: 18px 20px 24px 0; }
.step-n { font-family: var(--font-heading); font-weight: 800; font-size: 14px; color: var(--color-accent); }
.step-body { font-size: 14px; line-height: 1.5; margin: 0; color: color-mix(in srgb, var(--color-text) 78%, transparent); }
.how-moat { font-size: 13px; line-height: 1.5; margin-top: 24px; max-width: 80ch; color: color-mix(in srgb, var(--color-text) 62%, transparent); }

/* ---- 100-year timeline — now the second tab of #table, swapped in for
   the periodic table rather than living in its own section down the page. ---- */
.timeline-sub-count { font-family: var(--font-heading); font-weight: 800; font-size: clamp(22px, 3vw, 32px); line-height: .9; color: var(--color-accent-500); }
.timeline-lede { font-size: 14px; line-height: 1.5; margin: 0; max-width: 64ch; color: #b7afab; }
.timeline-chart-container { position: relative; height: 420px; margin-top: 20px; }

.legend { display: flex; justify-content: center; gap: 20px; flex-wrap: wrap; padding: 10px; }
.legend-item { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.legend-color { width: 20px; height: 20px; border-radius: 4px; border: 1px solid rgba(255, 255, 255, 0.2); }
.timeline-legend { margin-top: 18px; max-width: none; color: rgba(243, 242, 242, .8); }
.timeline-legend .legend-item { cursor: default; }
.timeline-legend .legend-color { width: 12px; height: 12px; border-radius: 50%; border: none; }

/* ---- pricing tiers ----
   Auto-fit cards rather than a fixed 3-column divider layout — with 5 tiers
   (Free/Personal/Pro/Enterprise/Data License) a fixed column count either
   crowds a wide screen or breaks the divider-border logic when it wraps.
   Each card carries its own border instead, so wrapping at any width is safe. */
.tiers {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
    margin-top: 34px;
}
.tier {
    padding: 22px 20px 24px;
    border: 1px solid var(--color-divider);
    display: flex;
    flex-direction: column;
}
.tier-featured { background: var(--color-text); color: var(--color-bg); border-color: var(--color-text); }
.tier-name { font-size: 11px; text-transform: uppercase; letter-spacing: .1em; color: var(--color-accent-700); font-weight: 600; }
.tier-featured .tier-name { color: var(--color-accent-500); }
.tier-price { display: flex; align-items: baseline; gap: 6px; flex-wrap: wrap; margin: 14px 0 4px; }
.tier-price-num { font-family: var(--font-heading); font-weight: 800; font-size: clamp(22px, 3vw, 34px); line-height: 1.1; }
.tier-per { font-size: 13px; opacity: .6; }
.tier-blurb { font-size: 13px; line-height: 1.45; margin: 8px 0 18px; opacity: .8; }
.tier-feat { display: flex; gap: 9px; font-size: 13px; padding: 6px 0; border-top: 1px solid var(--color-divider); }
.tier-featured .tier-feat { border-top-color: color-mix(in srgb, var(--color-bg) 20%, transparent); }
.tier-check { flex: none; color: var(--color-accent); font-weight: 800; }
.tier-featured .tier-check { color: var(--color-accent-500); }
.tier-cta { margin-top: auto; width: 100%; justify-content: flex-start; }

/* ---- CTA + footer ---- */
.cta-section { background: var(--color-accent); color: var(--color-bg); }
.cta-inner { padding: clamp(44px, 6vh, 80px) 0; }
.cta-title { font-size: clamp(34px, 5vw, 64px); line-height: 1.02; letter-spacing: -0.02em; margin: 0; max-width: 18ch; }
.cta-actions { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 28px; }
.footer { padding: 28px 0; font-size: 12px; color: color-mix(in srgb, var(--color-text) 55%, transparent); display: flex; justify-content: space-between; flex-wrap: wrap; gap: 12px; }

@media (max-width: 640px) {
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
    .steps-grid { grid-template-columns: repeat(2, 1fr); }
}
