/* Chicago Fed gold dashboard (EA-CHICAGOFED-1): a research-journal look — ivory paper, navy ink and copper by default,
   a "midnight ink" dark theme. Every colour is a token; the charts read the same tokens and follow the theme. */
:root, :root[data-theme="light"] {
    --cf-paper: #f6f2ea;
    --cf-paper-2: #efe9dd;
    --cf-sheet: #fffdf8;
    --cf-ink: #14213a;
    --cf-ink-2: #2b3a55;
    --cf-muted: #6a6f7c;
    --cf-faint: #9a9aa2;
    --cf-rule: rgba(20, 33, 58, .12);
    --cf-rule-strong: rgba(20, 33, 58, .26);
    --cf-navy: #1d3f73;
    --cf-navy-soft: rgba(29, 63, 115, .08);
    --cf-copper: #b0612b;
    --cf-copper-soft: rgba(176, 97, 43, .12);
    --cf-up: #1f7a4d;
    --cf-up-soft: rgba(31, 122, 77, .12);
    --cf-down: #b4343a;
    --cf-down-soft: rgba(180, 52, 58, .11);
    --cf-flat: #7b8190;
    --cf-flat-soft: rgba(123, 129, 144, .14);
    --cf-warn: #a2620c;
    --cf-warn-soft: rgba(162, 98, 12, .12);
    --cf-grid: rgba(20, 33, 58, .07);
    --cf-shadow: 0 1px 0 rgba(20, 33, 58, .04), 0 18px 40px -30px rgba(20, 33, 58, .45);
    color-scheme: light;
}
:root[data-theme="dark"] {
    --cf-paper: #0c1322;
    --cf-paper-2: #101a2d;
    --cf-sheet: #121d32;
    --cf-ink: #e9e4d8;
    --cf-ink-2: #cfc8b8;
    --cf-muted: #98a0b2;
    --cf-faint: #69728a;
    --cf-rule: rgba(233, 228, 216, .10);
    --cf-rule-strong: rgba(233, 228, 216, .22);
    --cf-navy: #8fb4ff;
    --cf-navy-soft: rgba(143, 180, 255, .10);
    --cf-copper: #e39a63;
    --cf-copper-soft: rgba(227, 154, 99, .14);
    --cf-up: #4cc38a;
    --cf-up-soft: rgba(76, 195, 138, .14);
    --cf-down: #f0757b;
    --cf-down-soft: rgba(240, 117, 123, .14);
    --cf-flat: #9aa3b5;
    --cf-flat-soft: rgba(154, 163, 181, .14);
    --cf-warn: #f0b24f;
    --cf-warn-soft: rgba(240, 178, 79, .14);
    --cf-grid: rgba(233, 228, 216, .07);
    --cf-shadow: 0 22px 44px -30px rgba(0, 0, 0, .9);
    color-scheme: dark;
}

html, body { background: var(--cf-paper); }
body.cf {
    font-family: "Vazirmatn", system-ui, sans-serif;
    color: var(--cf-ink);
    font-feature-settings: "tnum";
    -webkit-font-smoothing: antialiased;
    background:
        linear-gradient(var(--cf-paper), var(--cf-paper)) padding-box,
        var(--cf-paper);
}
.cf a { color: var(--cf-navy); text-decoration: none; }
.cf a:hover { color: var(--cf-copper); }
.cf .serif { font-family: "Newsreader", "Georgia", serif; }
.cf .ltr { direction: ltr; unicode-bidi: isolate; }
.cf .muted { color: var(--cf-muted); }
.cf .faint { color: var(--cf-faint); }
.cf .num { font-variant-numeric: tabular-nums; }
.tone-up { color: var(--cf-up) !important; } .tone-down { color: var(--cf-down) !important; } .tone-flat { color: var(--cf-flat) !important; } .tone-warn { color: var(--cf-warn) !important; }

/* ---- masthead */
.cf-mast { border-bottom: 3px double var(--cf-rule-strong); background: var(--cf-sheet); }
.cf-mast-top { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: .55rem 0; border-bottom: 1px solid var(--cf-rule); font-size: .72rem; color: var(--cf-muted); }
.cf-mast-top .ltr { letter-spacing: .14em; text-transform: uppercase; }
.cf-mast-title { text-align: center; padding: 1.1rem 0 .4rem; }
.cf-mast-title h1 { direction: ltr; font-family: "Newsreader", Georgia, serif; font-weight: 600; font-size: clamp(1.5rem, 3.4vw, 2.6rem); letter-spacing: .04em; margin: 0; color: var(--cf-ink); }
.cf-mast-title .kicker { direction: ltr; font-family: "Newsreader", Georgia, serif; font-style: italic; color: var(--cf-copper); font-size: clamp(.95rem, 1.8vw, 1.2rem); margin-top: .15rem; }
.cf-mast-title .fa { font-size: .85rem; color: var(--cf-muted); margin-top: .35rem; }
.cf-nav { display: flex; justify-content: center; gap: .2rem; overflow-x: auto; scrollbar-width: none; padding: .35rem 0 .6rem; }
.cf-nav::-webkit-scrollbar { display: none; }
.cf-nav a { flex: none; color: var(--cf-ink-2); font-size: .86rem; font-weight: 600; padding: .4rem .85rem; border-radius: 999px; border: 1px solid transparent; white-space: nowrap; }
.cf-nav a:hover { background: var(--cf-navy-soft); color: var(--cf-navy); }
.cf-nav a.active { background: var(--cf-ink); color: var(--cf-sheet); }
.cf-nav a .r { direction: ltr; font-family: "Newsreader", Georgia, serif; font-style: italic; margin-inline-end: .35rem; opacity: .7; }
.cf-theme { width: 32px; height: 32px; border-radius: 50%; border: 1px solid var(--cf-rule-strong); background: transparent; color: var(--cf-ink); display: grid; place-items: center; cursor: pointer; }
.cf-theme:hover { border-color: var(--cf-copper); color: var(--cf-copper); }
.cf-theme svg { width: 15px; height: 15px; }
:root[data-theme="dark"] .cf-moon, :root:not([data-theme="dark"]) .cf-sun { display: none; }
.cf-status { display: inline-flex; align-items: center; gap: .35rem; }
.cf-status i { width: 7px; height: 7px; border-radius: 50%; background: var(--cf-up); display: inline-block; }
.cf-status.warn i { background: var(--cf-warn); }

/* ---- section heads */
.cf-section { margin: 2rem 0 1rem; display: flex; align-items: baseline; gap: .8rem; }
.cf-section .no { direction: ltr; font-family: "Newsreader", Georgia, serif; font-size: 2rem; line-height: 1; color: var(--cf-copper); font-style: italic; }
.cf-section h2 { font-size: 1.15rem; font-weight: 800; margin: 0; }
.cf-section .en { direction: ltr; font-family: "Newsreader", Georgia, serif; font-style: italic; color: var(--cf-muted); font-size: .9rem; }
.cf-section::after { content: ""; flex: 1; border-bottom: 1px solid var(--cf-rule-strong); transform: translateY(-.3rem); }
.cf-lede { font-size: .95rem; line-height: 2; color: var(--cf-ink-2); max-width: 70rem; }

/* ---- sheets */
.cf-sheet { background: var(--cf-sheet); border: 1px solid var(--cf-rule); border-radius: 6px; padding: 1.2rem 1.3rem; box-shadow: var(--cf-shadow); position: relative; }
.cf-sheet-head { display: flex; align-items: baseline; justify-content: space-between; flex-wrap: wrap; gap: .4rem 1rem; padding-bottom: .55rem; margin-bottom: .9rem; border-bottom: 1px solid var(--cf-rule); }
.cf-sheet-head h3 { font-size: 1rem; font-weight: 800; margin: 0; }
.cf-sheet-head .en { direction: ltr; font-family: "Newsreader", Georgia, serif; font-style: italic; color: var(--cf-muted); font-size: .85rem; }
.cf-grid { display: grid; gap: 1.1rem; }
.cf-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.cf-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.cf-21 { grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); }
@media (max-width: 991px) { .cf-3, .cf-2, .cf-21 { grid-template-columns: minmax(0, 1fr); } }

/* ---- model plates (overview) */
.cf-plate { display: flex; flex-direction: column; gap: .9rem; padding-top: 1.5rem; }
.cf-plate .roman { position: absolute; top: -.85rem; inset-inline-start: 1.1rem; direction: ltr; font-family: "Newsreader", Georgia, serif; font-style: italic; font-size: 1.05rem;
    background: var(--cf-ink); color: var(--cf-sheet); padding: .1rem .65rem; border-radius: 4px; }
.cf-plate-title { direction: ltr; text-align: start; font-size: .72rem; letter-spacing: .2em; color: var(--cf-copper); font-weight: 700; }
.cf-plate-sub { font-weight: 800; font-size: 1.05rem; margin-top: -.5rem; }
.cf-score-row { display: flex; align-items: flex-end; justify-content: space-between; gap: .6rem; }
.cf-score { font-family: "Vazirmatn", system-ui, sans-serif; font-size: 3rem; line-height: 1; font-weight: 800; letter-spacing: -1px; direction: ltr; }
.cf-bias { font-weight: 800; font-size: .95rem; text-align: end; }
.cf-bias .en { direction: ltr; display: block; font-family: "Newsreader", Georgia, serif; font-style: italic; font-weight: 400; font-size: .8rem; opacity: .8; }

/* the pressure scale: −10 … +10, a diamond marker */
.cf-scale { position: relative; height: 34px; direction: ltr; margin: .2rem 0 .1rem; }
.cf-scale .track { position: absolute; inset: 13px 0; border-radius: 4px;
    background: linear-gradient(90deg, var(--cf-down) 0%, var(--cf-down) 15%, color-mix(in srgb, var(--cf-down) 45%, var(--cf-flat)) 35%, var(--cf-flat) 42.5%, var(--cf-flat) 57.5%, color-mix(in srgb, var(--cf-up) 45%, var(--cf-flat)) 65%, var(--cf-up) 85%, var(--cf-up) 100%); opacity: .85; }
.cf-scale .ticks { position: absolute; inset: 0; display: flex; justify-content: space-between; }
.cf-scale .ticks span { width: 1px; height: 100%; background: var(--cf-rule-strong); }
.cf-scale .mark { position: absolute; top: 4px; width: 26px; height: 26px; transform: translateX(-50%); transition: left 1.2s cubic-bezier(.2, .9, .2, 1); }
.cf-scale .mark::before { content: ""; position: absolute; inset: 4px; background: var(--cf-sheet); border: 3px solid var(--cf-ink); transform: rotate(45deg); border-radius: 2px; box-shadow: 0 4px 10px -4px rgba(0,0,0,.5); }
.cf-scale-labels { display: flex; justify-content: space-between; direction: ltr; font-size: .66rem; color: var(--cf-faint); font-family: "Newsreader", Georgia, serif; }
.cf-facts { display: grid; grid-template-columns: auto 1fr; gap: .3rem .9rem; font-size: .8rem; margin: 0; }
.cf-facts dt { color: var(--cf-muted); font-weight: 400; }
.cf-facts dd { margin: 0; text-align: end; }
.cf-r2 { display: inline-flex; gap: .4rem; align-items: center; font-size: .74rem; color: var(--cf-navy); background: var(--cf-navy-soft); border-radius: 4px; padding: .15rem .5rem; }

/* ---- equation */
.cf-eq { direction: ltr; text-align: left; font-family: "Newsreader", Georgia, serif; font-size: 1.02rem; line-height: 2; background: var(--cf-paper-2);
    border-inline-start: 3px solid var(--cf-copper); padding: .7rem 1rem; border-radius: 2px; overflow-x: auto; white-space: normal; word-spacing: .08em; }
.cf-eq > span { white-space: nowrap; display: inline-block; }
.cf-eq .t { padding: .05rem .3rem; border-radius: 3px; }
.cf-eq .t.up { background: var(--cf-up-soft); color: var(--cf-up); }
.cf-eq .t.down { background: var(--cf-down-soft); color: var(--cf-down); }
.cf-eq .eqn-name { color: var(--cf-muted); font-style: italic; }

/* ---- factor table */
.cf-table { width: 100%; border-collapse: collapse; font-size: .82rem; }
.cf-table th { font-weight: 600; color: var(--cf-muted); font-size: .72rem; text-align: start; padding: .5rem .55rem; border-bottom: 1.5px solid var(--cf-ink); white-space: nowrap; }
.cf-table td { padding: .5rem .55rem; border-bottom: 1px solid var(--cf-rule); vertical-align: middle; }
.cf-table tr:last-child td { border-bottom: 1px solid var(--cf-ink); }
.cf-table .n { text-align: end; white-space: nowrap; }
.cf-scroll { overflow-x: auto; }
.cf-mini-bar { position: relative; height: 8px; width: 110px; background: var(--cf-flat-soft); border-radius: 4px; display: inline-block; vertical-align: middle; direction: ltr; }
.cf-mini-bar::after { content: ""; position: absolute; left: 50%; top: -2px; bottom: -2px; width: 1px; background: var(--cf-rule-strong); }
.cf-mini-bar span { position: absolute; top: 0; bottom: 0; border-radius: 4px; }

/* ---- charts */
.cf-chart { position: relative; height: 300px; }
.cf-chart.sm { height: 230px; }
.cf-chart.lg { height: 360px; }
@media (max-width: 575px) { .cf-chart { height: 250px; } .cf-chart.lg { height: 290px; } }
.cf-note { font-size: .76rem; color: var(--cf-muted); line-height: 1.85; margin: .6rem 0 0; }
.cf-caveat { font-size: .8rem; line-height: 1.9; background: var(--cf-warn-soft); color: var(--cf-ink); border-inline-start: 3px solid var(--cf-warn); padding: .55rem .8rem; border-radius: 2px; }
.cf-badge { display: inline-block; padding: .12rem .5rem; border-radius: 3px; font-size: .72rem; font-weight: 700; }
.bg-up { background: var(--cf-up-soft); color: var(--cf-up); } .bg-down { background: var(--cf-down-soft); color: var(--cf-down); }
.bg-flat { background: var(--cf-flat-soft); color: var(--cf-flat); } .bg-warn { background: var(--cf-warn-soft); color: var(--cf-warn); }

/* ---- narrative: a pull-quote */
.cf-quote { position: relative; padding: 1.1rem 1.3rem 1.1rem 1.3rem; background: var(--cf-sheet); border: 1px solid var(--cf-rule); border-inline-start: 4px solid var(--cf-navy); border-radius: 4px; }
.cf-quote p { margin: 0 0 .6rem; line-height: 2.05; font-size: .93rem; }
.cf-quote p:last-child { margin-bottom: 0; }
.cf-quote::before { content: "“"; position: absolute; top: -.5rem; inset-inline-end: .9rem; font-family: "Newsreader", Georgia, serif; font-size: 4rem; color: var(--cf-copper); opacity: .35; line-height: 1; }

.cf-method h3 { font-size: 1rem; font-weight: 800; margin: 1.4rem 0 .5rem; }
.cf-method p, .cf-method li { font-size: .9rem; line-height: 2; }
.cf-foot { border-top: 3px double var(--cf-rule-strong); margin-top: 2.5rem; padding: 1.2rem 0 2.4rem; font-size: .76rem; color: var(--cf-muted); line-height: 1.9; }
.cf-fade { animation: cfIn .55s ease both; }
@keyframes cfIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .cf-fade { animation: none; } .cf-scale .mark { transition: none; } }
@media (max-width: 575px) {
    .cf-sheet { padding: 1rem .95rem; }
    .cf-score { font-size: 2.7rem; }
    .cf-mast-top .hide-sm { display: none; }
}
