/* ============================================================
   ECONS WIRE — money, explained like news.
   Newsprint ground. Ink type. Wire-green data. Mono carries the numbers.
   ============================================================ */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }

:root {
  --paper: #F7F4EE;
  --paper-deep: #EFEAE0;
  --ink: #16130D;
  --ink-2: #4A453B;
  --ink-3: #7C766A;
  --rule: #D9D2C4;
  --rule-light: #E7E1D5;
  --green: #0B6B3A;
  --green-bright: #0E8A4A;
  --green-soft: #E3EFE5;
  --gold: #B98A1E;
  --card: #FFFDF9;
  --font-serif: 'Newsreader', Georgia, 'Times New Roman', serif;
  --font-mono: 'IBM Plex Mono', ui-monospace, 'Courier New', monospace;
  --font-sans: 'Inter', -apple-system, 'Segoe UI', sans-serif;
  --w-site: 1180px;
  --w-prose: 680px;
  --gutter: 24px;
  --ease: cubic-bezier(0.25, 0.1, 0.25, 1);
  --dur: 0.15s;
}

body {
  font-family: var(--font-sans);
  font-size: 16px; line-height: 1.65; color: var(--ink); background: var(--paper);
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; height: auto; display: block; }
a { color: inherit; text-decoration: none; }
ul, ol { list-style: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: none; }
::selection { background: var(--green); color: #fff; }
a:focus-visible, button:focus-visible, input:focus-visible { outline: 2px solid var(--green-bright); outline-offset: 2px; }

/* --- Type scale --- */
h1, h2, h3, h4 { line-height: 1.15; color: var(--ink); }
.heading-xl { font-family: var(--font-serif); font-weight: 700; font-size: clamp(2.1rem, 4.6vw, 3.1rem); letter-spacing: -0.01em; }
.heading-lg { font-family: var(--font-serif); font-weight: 600; font-size: clamp(1.45rem, 3vw, 1.95rem); }
.heading-md { font-family: var(--font-serif); font-weight: 600; font-size: 1.35rem; }
.text-sm { font-size: 0.8125rem; }
.text-secondary { color: var(--ink-2); }
.mono-label { font-family: var(--font-mono); font-size: 0.6875rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.16em; color: var(--green); }

/* --- Layout --- */
.container { max-width: var(--w-site); margin-inline: auto; padding-inline: var(--gutter); }
.section { padding: 64px 0; }
.section-header { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; border-bottom: 2px solid var(--ink); padding-bottom: 10px; margin-bottom: 32px; }
.section-link { font-family: var(--font-mono); font-size: 0.75rem; font-weight: 500; color: var(--green); white-space: nowrap; }
.section-link:hover { color: var(--ink); }

/* --- Header --- */
.site-header { position: sticky; top: 0; z-index: 100; background: var(--paper); border-bottom: 2px solid var(--ink); }
.header-inner { display: flex; align-items: center; justify-content: space-between; height: 58px; max-width: var(--w-site); margin-inline: auto; padding-inline: var(--gutter); }
.site-logo { display: inline-flex; align-items: center; gap: 9px; }
.logo-tick { width: 12px; height: 12px; background: var(--green-bright); display: inline-block; position: relative; }
.logo-tick::after { content: ''; position: absolute; inset: 0; background: var(--green-bright); animation: tickpulse 2.6s infinite; }
@keyframes tickpulse { 0%,100% { transform: scale(1); opacity: 0; } 50% { transform: scale(1.9); opacity: 0.25; } }
.logo-word { font-family: var(--font-serif); font-weight: 700; font-size: 1.35rem; letter-spacing: -0.02em; color: var(--ink); }
.logo-word em { font-style: normal; color: var(--green); }
.nav-links { display: flex; align-items: center; gap: 2px; }
.nav-links li a { display: block; padding: 8px 11px; font-size: 0.8125rem; font-weight: 500; color: var(--ink-2); transition: color var(--dur); }
.nav-links li a:hover { color: var(--green); }
.nav-link-tools { font-family: var(--font-mono); font-size: 0.75rem !important; color: var(--green) !important; border: 1px solid var(--rule); }
.nav-link-tools:hover { border-color: var(--green); }
.nav-toggle { display: none; width: 30px; height: 30px; flex-direction: column; align-items: center; justify-content: center; gap: 5px; }
.nav-toggle span { display: block; width: 18px; height: 2px; background: var(--ink); transition: transform 0.2s, opacity 0.2s; }
.nav-toggle.active span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-toggle.active span:nth-child(2) { opacity: 0; }
.nav-toggle.active span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }
.mobile-nav { display: none; }
.mobile-nav.open { display: block; position: absolute; top: 58px; left: 0; right: 0; background: var(--paper); border-bottom: 2px solid var(--ink); padding: 10px var(--gutter) 18px; }
.mobile-nav a { display: block; padding: 10px 0; font-size: 0.9375rem; color: var(--ink-2); border-bottom: 1px solid var(--rule-light); }
@media (max-width: 860px) { .site-nav { display: none; } .nav-toggle { display: flex; } }

/* --- Wire ticker (the masthead strip) --- */
.wire-strip { background: var(--ink); color: var(--paper); overflow: hidden; }
.wire-strip-inner { display: flex; align-items: center; gap: 18px; max-width: var(--w-site); margin-inline: auto; padding: 7px var(--gutter); }
.wire-strip .mono-label { color: var(--green-bright); flex-shrink: 0; }
.wire-strip-fact { font-family: var(--font-mono); font-size: 0.75rem; color: rgba(247,244,238,0.85); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wire-strip-fact strong { color: #fff; font-weight: 600; }
.wire-strip-fact a { color: var(--green-bright); border-bottom: 1px solid rgba(14,138,74,0.5); }
.wire-strip-fact a:hover { color: #fff; }

/* --- Front page: lead + briefs --- */
.front-lead { padding: 40px 0 56px; }
.front-grid { display: grid; grid-template-columns: 1.55fr 1fr; gap: 40px; }
.lead-story .badge { margin-bottom: 12px; }
.lead-story h1 a, .lead-story h2 a { transition: color var(--dur); }
.lead-story h1 a:hover, .lead-story h2 a:hover { color: var(--green); }
.lead-kicker { font-family: var(--font-mono); font-size: 0.6875rem; font-weight: 600; letter-spacing: 0.16em; text-transform: uppercase; color: var(--green); margin-bottom: 10px; }
.lead-excerpt { font-family: var(--font-serif); font-size: 1.2rem; font-style: italic; color: var(--ink-2); line-height: 1.5; margin: 14px 0 12px; }
.lead-image { margin-top: 20px; border: 1px solid var(--rule); }
.lead-image img { aspect-ratio: 16/9; object-fit: cover; width: 100%; }
.briefs { border-left: 1px solid var(--rule); padding-left: 32px; display: flex; flex-direction: column; }
.briefs-heading { font-family: var(--font-mono); font-size: 0.6875rem; font-weight: 600; letter-spacing: 0.16em; text-transform: uppercase; color: var(--ink-3); padding-bottom: 10px; border-bottom: 2px solid var(--ink); margin-bottom: 4px; }
.brief { padding: 14px 0; border-bottom: 1px solid var(--rule-light); }
.brief:last-child { border-bottom: none; }
.brief h2, .brief h3 { font-family: var(--font-serif); font-weight: 600; font-size: 1.02rem; line-height: 1.3; }
.brief h2 a:hover, .brief h3 a:hover { color: var(--green); }
.brief .meta { margin-top: 5px; }

/* --- Meta line --- */
.meta { font-family: var(--font-mono); font-size: 0.6875rem; color: var(--ink-3); text-transform: uppercase; letter-spacing: 0.08em; display: flex; gap: 8px; align-items: center; }
.meta .dot::before { content: '·'; }

/* --- Badges --- */
.badge { display: inline-block; font-family: var(--font-mono); font-size: 0.6875rem; font-weight: 600; letter-spacing: 0.12em; text-transform: uppercase; color: var(--badge-color, var(--green)); }

/* --- Number of the day --- */
.wire-number { display: grid; grid-template-columns: auto 1fr; gap: 26px; align-items: center; background: var(--card); border: 1px solid var(--rule); border-top: 3px solid var(--green-bright); padding: 26px 30px; }
.wire-number-figure { font-family: var(--font-serif); font-weight: 700; font-size: clamp(2rem, 4vw, 2.9rem); color: var(--green); white-space: nowrap; }
.wire-number-eyebrow { font-family: var(--font-mono); font-size: 0.625rem; font-weight: 600; letter-spacing: 0.2em; text-transform: uppercase; color: var(--ink-3); margin-bottom: 6px; }
.wire-number-text { font-family: var(--font-serif); font-size: 1.1rem; line-height: 1.5; }
.wire-number-link { font-family: var(--font-mono); font-size: 0.75rem; color: var(--green); border-bottom: 1px solid var(--green); }
.wire-number-link:hover { color: var(--ink); border-color: var(--ink); }

/* --- Cards / lanes --- */
.article-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 30px; }
.article-grid-4 { grid-template-columns: repeat(4, 1fr); }
.card { display: flex; flex-direction: column; transition: transform 0.22s var(--ease); }
.card:hover { transform: translateY(-3px); }
.card-image { position: relative; overflow: hidden; border: 1px solid var(--rule); margin-bottom: 12px; background: var(--paper-deep); }
.card-image img { aspect-ratio: 3/2; object-fit: cover; width: 100%; transition: transform 0.4s var(--ease); }
.card:hover .card-image img { transform: scale(1.035); }
.card-image::after { content: ''; position: absolute; left: 0; bottom: 0; height: 3px; width: 0; background: var(--green-bright); transition: width 0.3s var(--ease); }
.card:hover .card-image::after { width: 100%; }
.card-title { font-family: var(--font-serif); font-weight: 600; font-size: 1.08rem; line-height: 1.3; margin: 6px 0; }
.card-title a:hover { color: var(--green); }
.card-excerpt { color: var(--ink-2); font-size: 0.84rem; line-height: 1.55; margin-bottom: 8px; flex: 1; }

/* --- Category index page --- */
.category-header { padding: 48px 0 8px; }
.category-header .heading-xl { margin: 6px 0 8px; }
.category-desc { font-family: var(--font-serif); font-style: italic; font-size: 1.1rem; color: var(--ink-2); max-width: 640px; }

/* --- Article page --- */
.article-header { padding: 46px 0 30px; border-bottom: 1px solid var(--rule); background: var(--card); }
.article-header-content { max-width: 780px; }
.article-header .heading-xl { margin: 10px 0 12px; }
.article-excerpt { font-family: var(--font-serif); font-style: italic; font-size: 1.18rem; line-height: 1.55; color: var(--ink-2); margin-bottom: 14px; }
.article-hero { padding: 30px 0 0; }
.article-hero-img { width: 100%; max-height: 460px; object-fit: cover; border: 1px solid var(--rule); }
.article-layout { display: grid; grid-template-columns: 200px minmax(0, var(--w-prose)) 1fr; gap: 44px; max-width: var(--w-site); margin-inline: auto; padding: 40px var(--gutter) 64px; }
.article-body { font-size: 1.05rem; line-height: 1.85; }
.article-body > p:first-of-type::first-letter { font-family: var(--font-serif); font-weight: 700; font-size: 3.3em; line-height: 0.78; float: left; padding: 7px 10px 0 0; color: var(--green); }
.article-body h2 { font-family: var(--font-serif); font-weight: 600; font-size: 1.5rem; margin: 42px 0 14px; }
.article-body h2::before { content: ''; display: block; width: 34px; height: 3px; background: var(--green-bright); margin-bottom: 13px; }
.article-body h3 { font-family: var(--font-serif); font-weight: 600; font-size: 1.15rem; margin: 26px 0 10px; }
.article-body p { margin-bottom: 18px; }
.article-body ul, .article-body ol { margin: 0 0 18px 20px; }
.article-body ul { list-style: disc; }
.article-body ol { list-style: decimal; }
.article-body li { margin-bottom: 6px; }
.article-body strong { font-weight: 600; }
.article-body a { color: var(--ink); text-decoration: underline; text-decoration-color: var(--green-bright); text-underline-offset: 3px; }
.article-body a:hover { color: var(--green); }
.article-body blockquote { border-left: 3px solid var(--green-bright); background: var(--card); padding: 14px 18px; margin: 24px 0; font-family: var(--font-serif); font-style: italic; }
.article-body table { width: 100%; border-collapse: collapse; margin: 22px 0; font-size: 0.9rem; }
.article-body th { font-family: var(--font-mono); font-size: 0.6875rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.1em; text-align: left; padding: 8px 10px; border-bottom: 2px solid var(--ink); }
.article-body td { padding: 9px 10px; border-bottom: 1px solid var(--rule-light); vertical-align: top; }
.article-body tr:hover td { background: var(--green-soft); }

/* TOC */
.toc { position: sticky; top: 84px; }
.toc-title { font-family: var(--font-mono); font-size: 0.625rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.14em; color: var(--ink-3); border-bottom: 2px solid var(--ink); padding-bottom: 8px; margin-bottom: 10px; }
.toc-list { display: flex; flex-direction: column; }
.toc-item a { display: block; padding: 4px 0 4px 9px; font-size: 0.75rem; color: var(--ink-3); line-height: 1.4; border-left: 2px solid transparent; transition: color var(--dur); }
.toc-item a:hover { color: var(--ink); }
.toc-item a.active { color: var(--green); font-weight: 600; border-left-color: var(--green-bright); }
.toc-sub { padding-left: 12px; }

/* Reading progress */
.read-progress { position: fixed; top: 0; left: 0; height: 3px; width: 0; background: var(--green-bright); z-index: 200; }

/* Sidebar wire-number variant */
.wire-number--side { display: block; padding: 16px; margin-top: 26px; }
.wire-number--side .wire-number-figure { font-size: 1.6rem; margin-bottom: 4px; }
.wire-number--side .wire-number-text { font-size: 0.88rem; }

/* Author strip */
.author-card { max-width: var(--w-prose); margin: 8px auto 40px; padding: 18px var(--gutter) 0; border-top: 2px solid var(--ink); }
.author-name { font-family: var(--font-mono); font-size: 0.75rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.1em; margin-bottom: 3px; }
.author-bio { font-size: 0.8125rem; color: var(--ink-2); }

/* --- Static pages --- */
.page-prose { max-width: var(--w-prose); margin-inline: auto; padding: 48px var(--gutter) 72px; }
.page-prose h1 { margin-bottom: 14px; }
.page-prose h2 { font-family: var(--font-serif); font-weight: 600; font-size: 1.4rem; margin: 34px 0 12px; }
.page-prose h2::before { content: ''; display: block; width: 34px; height: 3px; background: var(--green-bright); margin-bottom: 12px; }
.page-prose p, .page-prose li { color: var(--ink); margin-bottom: 14px; line-height: 1.75; }
.page-prose ul { list-style: disc; margin-left: 20px; }
.page-prose a { text-decoration: underline; text-decoration-color: var(--green-bright); text-underline-offset: 3px; }
.page-prose a:hover { color: var(--green); }

/* --- Numbers board --- */
.numbers-board { display: grid; grid-template-columns: repeat(3, 1fr); gap: 22px; margin-top: 30px; }
.num-card { background: var(--card); border: 1px solid var(--rule); border-top: 3px solid var(--green-bright); padding: 20px; }
.num-card-figure { font-family: var(--font-serif); font-weight: 700; font-size: 1.9rem; color: var(--green); }
.num-card-label { font-family: var(--font-mono); font-size: 0.625rem; font-weight: 600; letter-spacing: 0.14em; text-transform: uppercase; color: var(--ink-3); margin: 4px 0 8px; }
.num-card-note { font-size: 0.8125rem; color: var(--ink-2); line-height: 1.5; }
.num-card-note a { text-decoration: underline; text-decoration-color: var(--green-bright); }

/* --- Calculators --- */
.calc { background: var(--card); border: 1px solid var(--rule); border-top: 3px solid var(--green-bright); padding: 26px; margin: 26px 0; }
.calc-title { font-family: var(--font-serif); font-weight: 600; font-size: 1.25rem; margin-bottom: 4px; }
.calc-sub { font-size: 0.8125rem; color: var(--ink-2); margin-bottom: 18px; }
.calc-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 14px; margin-bottom: 16px; }
.calc label { display: block; font-family: var(--font-mono); font-size: 0.625rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.1em; color: var(--ink-3); margin-bottom: 5px; }
.calc input, .calc select { width: 100%; padding: 9px 11px; font-size: 0.9375rem; border: 1px solid var(--rule); background: var(--paper); }
.calc input:focus { border-color: var(--green); outline: none; }
.calc-result { border-top: 1px solid var(--rule); padding-top: 16px; }
.calc-big { font-family: var(--font-serif); font-weight: 700; font-size: 2rem; color: var(--green); }
.calc-note { font-size: 0.75rem; color: var(--ink-3); margin-top: 10px; }
.calc-compare { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.calc-side { background: var(--paper); border: 1px solid var(--rule-light); padding: 14px; }
.calc-side h3, .calc-side h4 { font-family: var(--font-mono); font-size: 0.6875rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.1em; margin-bottom: 8px; color: var(--ink-2); }

/* --- Footer --- */
.site-footer { background: var(--ink); color: rgba(247,244,238,0.78); margin-top: 40px; }
.site-footer .container { padding-top: 52px; padding-bottom: 30px; }
.footer-grid { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 40px; margin-bottom: 34px; }
.site-footer .logo-word { color: #fff; }
.footer-tag { font-size: 0.8125rem; color: rgba(247,244,238,0.55); line-height: 1.6; max-width: 300px; margin-top: 12px; }
.footer-heading { font-family: var(--font-mono); font-size: 0.625rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.16em; color: rgba(247,244,238,0.45); margin-bottom: 12px; }
.footer-links { display: flex; flex-direction: column; gap: 7px; }
.footer-links a { font-size: 0.8125rem; color: rgba(247,244,238,0.75); transition: color var(--dur); }
.footer-links a:hover { color: #fff; }
.footer-bottom { border-top: 1px solid rgba(247,244,238,0.14); padding-top: 18px; }
.footer-fine { font-size: 0.75rem; color: rgba(247,244,238,0.45); line-height: 1.6; margin-bottom: 8px; }

/* --- Scroll reveal --- */
.fade-up { opacity: 0; transform: translateY(12px); transition: opacity 0.45s var(--ease), transform 0.45s var(--ease); }
.fade-up.is-visible { opacity: 1; transform: none; }

/* --- Motion respect --- */
@media (prefers-reduced-motion: reduce) {
  .fade-up { opacity: 1; transform: none; transition: none; }
  .card, .card:hover, .card-image img, .card-image::after, .logo-tick::after { transition: none; transform: none; animation: none; }
}

/* --- Responsive --- */
@media (max-width: 1024px) {
  .article-layout { grid-template-columns: minmax(0, 1fr); max-width: calc(var(--w-prose) + 2 * var(--gutter)); }
  .toc { display: none; }
  .wire-number--side { display: none; }
  .front-grid { grid-template-columns: 1fr; gap: 8px; }
  .briefs { border-left: none; padding-left: 0; margin-top: 26px; }
  .article-grid, .article-grid-4 { grid-template-columns: repeat(2, 1fr); }
  .numbers-board { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 640px) {
  .section { padding: 44px 0; }
  .article-grid, .article-grid-4 { grid-template-columns: 1fr; }
  .numbers-board { grid-template-columns: 1fr; }
  .wire-number { grid-template-columns: 1fr; gap: 8px; padding: 20px; }
  .footer-grid { grid-template-columns: 1fr; gap: 26px; }
  .calc-compare { grid-template-columns: 1fr; }
  .article-body > p:first-of-type::first-letter { font-size: 2.7em; }
  .wire-strip-fact { white-space: normal; font-size: 0.6875rem; }
}
