/* The Embark Dispatch — shared styles for /dispatch and every edition.
   Charts are drawn by js/dispatch.js from the <table> inside each .dx-chart,
   so the data stays in the HTML for crawlers and screen readers. */

:root {
    --dx-surface: #0f172a;
    --dx-panel: rgba(255, 255, 255, 0.04);
    --dx-line: rgba(255, 255, 255, 0.10);
    --dx-grid: rgba(255, 255, 255, 0.07);
    --dx-ink: #ffffff;
    --dx-ink-2: #cbd5e1;
    --dx-ink-3: #94a3b8;
    --dx-gold: #C9A961;           /* brand accent: text, rules, buttons */
    /* Chart series, validated against the dark surface (dataviz validator) */
    --dx-s-embark: #A8832F;
    --dx-s-alt: #3F86EE;
    --dx-s-neg: #D9534F;
    --dx-s-neutral: #475569;
}

/* ── Edition masthead ─────────────────────────────── */
.dx-kicker { letter-spacing: .3em; text-transform: uppercase; font-size: 11px; font-weight: 600; color: var(--dx-gold); }
.dx-issue-pill { display: inline-flex; align-items: center; gap: 8px; padding: 4px 12px; border: 1px solid rgba(201,169,97,.4); color: var(--dx-gold); font-size: 11px; letter-spacing: .2em; text-transform: uppercase; }
.dx-prose p { color: var(--dx-ink-2); font-size: 1.125rem; line-height: 1.8; font-weight: 300; margin-bottom: 1.5rem; }
.dx-prose p strong { color: var(--dx-ink); font-weight: 600; }
.dx-prose a { color: var(--dx-gold); text-decoration: underline; text-underline-offset: 3px; }
.dx-prose h2 { font-family: "Playfair Display", serif; color: var(--dx-ink); font-size: clamp(1.5rem, 3vw, 2rem); line-height: 1.25; margin: 0 0 1.25rem; }
.dx-prose h3 { color: var(--dx-ink); font-weight: 600; font-size: 1.125rem; margin: 2rem 0 .75rem; }
.dx-prose ul.dx-list { margin: 0 0 1.5rem; padding: 0; list-style: none; }
.dx-prose ul.dx-list li { position: relative; padding-left: 1.5rem; margin-bottom: .75rem; color: var(--dx-ink-2); line-height: 1.7; font-size: 1.0625rem; font-weight: 300; }
.dx-prose ul.dx-list li::before { content: ""; position: absolute; left: 0; top: .7em; width: 8px; height: 2px; background: var(--dx-gold); }
.dx-section { padding-top: 2.5rem; margin-bottom: 4rem; border-top: 1px solid rgba(255,255,255,.08); scroll-margin-top: 6rem; }
.dx-section-label { display: flex; align-items: center; gap: 12px; margin-bottom: 1.25rem; font-size: 11px; letter-spacing: .25em; text-transform: uppercase; color: var(--dx-ink-3); font-weight: 600; }
.dx-section-label span { width: 32px; height: 32px; border-radius: 999px; display: inline-flex; align-items: center; justify-content: center; border: 1px solid rgba(201,169,97,.3); background: rgba(201,169,97,.1); color: var(--dx-gold); letter-spacing: 0; }

/* ── Stat strip (count-ups) ───────────────────────── */
.dx-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 1px; background: var(--dx-line); border: 1px solid var(--dx-line); margin: 2.5rem 0; }
.dx-stat { background: var(--dx-surface); padding: 1.25rem 1.25rem 1.1rem; }
.dx-stat b { display: block; font-family: "Playfair Display", serif; font-size: 2rem; line-height: 1.1; color: var(--dx-ink); font-weight: 600; font-variant-numeric: tabular-nums; }
.dx-stat span { display: block; margin-top: .4rem; font-size: 12px; line-height: 1.5; color: var(--dx-ink-3); }

/* ── Charts ───────────────────────────────────────── */
.dx-chart { margin: 2.5rem 0; padding: 1.5rem; background: var(--dx-panel); border: 1px solid var(--dx-line); position: relative; }
@media (min-width: 768px) { .dx-chart { padding: 2rem; } }
.dx-chart-title { font-family: "Playfair Display", serif; color: var(--dx-ink); font-size: 1.25rem; line-height: 1.35; margin: .35rem 0 .35rem; }
.dx-chart-sub { color: var(--dx-ink-3); font-size: .875rem; margin-bottom: 1.5rem; }
.dx-chart figcaption { margin-top: 1.5rem; padding-top: 1rem; border-top: 1px solid var(--dx-line); font-size: 12px; line-height: 1.6; color: var(--dx-ink-3); }
.dx-chart figcaption a { color: var(--dx-ink-3); text-decoration: underline; text-underline-offset: 2px; }
.dx-chart details { margin-top: 1rem; }
.dx-chart summary { cursor: pointer; font-size: 12px; color: var(--dx-ink-3); letter-spacing: .1em; text-transform: uppercase; }
.dx-chart summary:hover { color: var(--dx-gold); }
.dx-chart table { width: 100%; margin-top: .75rem; font-size: 13px; border-collapse: collapse; }
.dx-chart th, .dx-chart td { text-align: left; padding: 6px 8px; border-bottom: 1px solid var(--dx-grid); color: var(--dx-ink-2); }
.dx-chart th { color: var(--dx-ink-3); font-weight: 600; }
.dx-chart td:last-child, .dx-chart th:last-child { text-align: right; font-variant-numeric: tabular-nums; }
.dx-legend { display: flex; flex-wrap: wrap; gap: 8px 20px; margin-bottom: 1rem; font-size: 12px; color: var(--dx-ink-2); }
.dx-legend i { display: inline-block; width: 12px; height: 12px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }

/* Horizontal bars */
.dx-hbar-row { display: grid; grid-template-columns: minmax(96px, 34%) 1fr; gap: 12px; align-items: center; padding: 6px 0; position: relative; }
.dx-hbar-label { font-size: 13px; color: var(--dx-ink-2); line-height: 1.35; }
.dx-hbar-track { position: relative; height: 22px; }
.dx-hbar-zero { position: absolute; top: -4px; bottom: -4px; width: 1px; background: rgba(255,255,255,.35); }
.dx-hbar-fill { position: absolute; top: 3px; height: 16px; width: 0; border-radius: 0 4px 4px 0; transition: width 1.1s cubic-bezier(.22,1,.36,1); }
.dx-hbar-fill.neg { border-radius: 4px 0 0 4px; }
.dx-hbar-val { position: absolute; top: 50%; transform: translateY(-50%); font-size: 12px; font-weight: 600; color: var(--dx-ink); white-space: nowrap; opacity: 0; transition: opacity .4s ease .8s; font-variant-numeric: tabular-nums; }
.dx-chart.in .dx-hbar-val { opacity: 1; }
.dx-hbar-row:hover .dx-hbar-label { color: var(--dx-ink); }
.dx-hbar-row:hover .dx-hbar-fill { filter: brightness(1.2); }

/* Columns */
.dx-cols { display: flex; align-items: flex-end; gap: 6px; height: 220px; padding-top: 24px; border-bottom: 1px solid rgba(255,255,255,.25); position: relative; }
.dx-col { flex: 1; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; height: 100%; position: relative; }
.dx-col-fill { width: 100%; max-width: 44px; height: 0; border-radius: 4px 4px 0 0; transition: height 1.1s cubic-bezier(.22,1,.36,1); }
.dx-col-val { font-size: 11px; color: var(--dx-ink); font-weight: 600; margin-bottom: 4px; opacity: 0; transition: opacity .4s ease .8s; font-variant-numeric: tabular-nums; white-space: nowrap; }
.dx-chart.in .dx-col-val { opacity: 1; }
.dx-col-labels { display: flex; gap: 6px; margin-top: 8px; }
.dx-col-labels span { flex: 1; text-align: center; font-size: 10px; line-height: 1.3; color: var(--dx-ink-3); }
.dx-col:hover .dx-col-fill { filter: brightness(1.2); }
@media (max-width: 520px) { .dx-col-val { font-size: 9px; } .dx-cols { gap: 3px; } .dx-col-labels { gap: 3px; } .dx-col-labels span { font-size: 9px; } }

/* Waffle */
.dx-waffle { display: grid; grid-template-columns: repeat(20, 1fr); gap: 3px; max-width: 520px; }
.dx-waffle i { aspect-ratio: 1; border-radius: 2px; background: var(--dx-s-neutral); opacity: .35; transform: scale(.4); transition: transform .5s cubic-bezier(.22,1,.36,1), opacity .5s, background .5s; }
.dx-chart.in .dx-waffle i { transform: scale(1); opacity: 1; }
.dx-waffle i.on { background: var(--dx-s-embark); }

/* Tooltip */
.dx-tip { position: fixed; z-index: 60; pointer-events: none; background: #020617; border: 1px solid rgba(201,169,97,.35); color: #fff; font-size: 12px; line-height: 1.45; padding: 8px 10px; border-radius: 6px; max-width: 240px; opacity: 0; transition: opacity .12s; box-shadow: 0 10px 30px rgba(0,0,0,.4); }
.dx-tip.show { opacity: 1; }
.dx-tip b { color: var(--dx-gold); }

/* ── Interactive tools ────────────────────────────── */
.dx-tool { margin: 2.5rem 0; padding: 1.5rem; border: 1px solid rgba(201,169,97,.3); background: linear-gradient(160deg, rgba(201,169,97,.08), rgba(201,169,97,.01)); }
@media (min-width: 768px) { .dx-tool { padding: 2rem; } }
.dx-field { display: block; }
.dx-field > span { display: flex; justify-content: space-between; font-size: 11px; letter-spacing: .15em; text-transform: uppercase; color: var(--dx-ink-3); font-weight: 600; margin-bottom: 8px; }
.dx-field output, .dx-field > span b { color: var(--dx-ink); letter-spacing: 0; font-size: 13px; text-transform: none; font-variant-numeric: tabular-nums; }
.dx-input { width: 100%; background: rgba(15,23,42,.7); border: 1px solid rgba(255,255,255,.15); color: #fff; padding: 10px 12px; font-size: 16px; border-radius: 6px; }
.dx-input:focus { outline: none; border-color: var(--dx-gold); }
.dx-range { width: 100%; accent-color: var(--dx-gold); }
.dx-out { padding: 1rem; border: 1px solid var(--dx-line); background: rgba(255,255,255,.03); }
.dx-out.hi { border-color: rgba(201,169,97,.45); background: rgba(201,169,97,.08); }
.dx-out p { font-size: 12px; color: var(--dx-ink-3); margin: 0 0 4px; }
.dx-out b { display: block; font-family: "Playfair Display", serif; font-size: 1.6rem; color: var(--dx-ink); font-variant-numeric: tabular-nums; line-height: 1.2; }
.dx-out.hi b { color: var(--dx-gold); }

/* ── Personalized calculator CTA ──────────────────── */
.dx-cta { margin: 4rem 0; padding: 2rem 1.5rem; border-radius: 18px; border: 1px solid rgba(201,169,97,.28); background: radial-gradient(ellipse at 85% 0%, rgba(201,169,97,.16), transparent 55%), linear-gradient(160deg, rgba(201,169,97,.09), rgba(201,169,97,.015)); position: relative; overflow: hidden; }
@media (min-width: 768px) { .dx-cta { padding: 2.75rem 3rem; } }
.dx-cta-greet { min-height: 1.25rem; font-size: 13px; color: var(--dx-gold); margin-bottom: .5rem; }
.dx-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.dx-chip { padding: 7px 16px; border-radius: 999px; border: 1px solid rgba(255,255,255,.15); background: rgba(255,255,255,.04); color: #fff; font-size: 13px; font-weight: 600; transition: all .2s; }
.dx-chip:hover { border-color: rgba(201,169,97,.6); color: var(--dx-gold); }
.dx-chip[aria-pressed="true"] { background: var(--dx-gold); border-color: var(--dx-gold); color: #000; }
.dx-cta-go { display: inline-flex; align-items: center; justify-content: center; gap: 10px; width: 100%; padding: 16px 28px; background: var(--dx-gold); color: #000; font-size: 12px; font-weight: 700; letter-spacing: .2em; text-transform: uppercase; border-radius: 10px; transition: background .2s; }
.dx-cta-go:hover { background: #fff; }
.dx-pulse { position: relative; }
.dx-pulse::after { content: ""; position: absolute; inset: -4px; border-radius: 14px; border: 1px solid rgba(201,169,97,.6); animation: dxPulse 2.4s ease-out infinite; pointer-events: none; }
@keyframes dxPulse { 0% { opacity: .9; transform: scale(1); } 70%, 100% { opacity: 0; transform: scale(1.04); } }

/* ── Signup ───────────────────────────────────────── */
.dx-signup { padding: 2rem 1.5rem; border: 1px solid var(--dx-line); background: linear-gradient(180deg, rgba(30,41,59,.7), rgba(15,23,42,.9)); }
@media (min-width: 768px) { .dx-signup { padding: 2.5rem; } }

/* ── Archive cards ────────────────────────────────── */
.dx-card { display: grid; grid-template-columns: 1fr; gap: 1rem; padding: 1.75rem 0; border-top: 1px solid var(--dx-line); transition: background .2s; }
@media (min-width: 768px) { .dx-card { grid-template-columns: 140px 1fr 40px; gap: 2rem; align-items: start; padding: 2rem 1rem; } }
.dx-card:hover { background: rgba(255,255,255,.025); }
.dx-card:hover .dx-card-title { color: var(--dx-gold); }
.dx-card-no { font-family: "Playfair Display", serif; font-size: 3rem; line-height: 1; color: rgba(201,169,97,.45); }
.dx-card-title { font-family: "Playfair Display", serif; color: #fff; font-size: 1.5rem; line-height: 1.3; transition: color .2s; }
.dx-tag { display: inline-block; padding: 3px 10px; border: 1px solid rgba(255,255,255,.15); font-size: 10px; letter-spacing: .18em; text-transform: uppercase; color: var(--dx-ink-3); }

/* Scroll reveal */
.dx-reveal { opacity: 0; transform: translateY(18px); transition: opacity .8s ease, transform .8s cubic-bezier(.22,1,.36,1); }
.dx-reveal.in { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
    .dx-hbar-fill, .dx-col-fill, .dx-waffle i, .dx-reveal, .dx-hbar-val, .dx-col-val { transition: none !important; }
    .dx-pulse::after { animation: none; }
}
@media (forced-colors: active) {
    .dx-hbar-fill, .dx-col-fill, .dx-waffle i.on { background: CanvasText !important; }
}
