/* ============================================================
   Digital Insight — "Market Paper" theme
   A daily financial paper, not an app.
   Cool ledger paper · ink black · one deep emerald · hairline rules
   No cards, no shadow, no gradient, no rounded corners.
   ============================================================ */

/* ---------- tokens ---------- */
:root {
  /* palette */
  --paper:       #F2F4F2;
  --paper-2:     #E9EDEA;
  --paper-3:     #DFE4E0;
  --ink:         #101418;
  --ink-2:       #39424A;
  --muted:       #6C767C;
  --rule:        #D9DDD9;
  --rule-hard:   #B4BCB6;
  --accent:      #0B6E4F;
  --accent-soft: #E2EDE7;
  --flag:        #B4453A;

  /* type */
  --display: "Newsreader", Georgia, "Noto Serif", "Times New Roman", serif;
  --text:    "Public Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;

  /* layout */
  --page-max: 430px;          /* mobile design width */
  --header-h: 54px;
  --gutter: 20px;
  --page-max-lg: 560px;

  /* legacy aliases — article.css, checklist.html and old markup reference these */
  --bg:        var(--paper);
  --bg-alt:    var(--paper-2);
  --bg-tint:   var(--paper-2);
  --card:      var(--paper);
  --text-2:    var(--muted);
  --line:      var(--rule);
  --brand:     var(--accent);
  --brand-2:   var(--accent);
  --grad:      var(--accent);   /* was a blue→violet gradient; now flat */
  --green:     var(--accent);
  --radius:    0px;
  --radius-s:  0px;
  --shadow-sm: none;
  --shadow-md: none;
  --shadow-lg: none;
  --font-display: var(--display);
  --font-serif:   var(--display);
  --font-sans:    var(--text);
}

html.dark {
  --paper:       #12161A;
  --paper-2:     #1A1F24;
  --paper-3:     #222830;
  --ink:         #EDEFEC;
  --ink-2:       #C2C8C4;
  --muted:       #8D969B;
  --rule:        #262C31;
  --rule-hard:   #3A4248;
  --accent:      #4FB289;
  --accent-soft: #1B2A24;
  --flag:        #D4675C;
}

/* ---------- reset ---------- */
*, *::before, *::after { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-h) + 12px);
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink-2);
  font-family: var(--text);
  font-size: 16px;
  line-height: 1.62;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 {
  font-family: var(--display);
  color: var(--ink);
  font-weight: 600;
  letter-spacing: -0.011em;
  margin: 0;
}
h1 { font-size: 32px; line-height: 1.14; }
h2 { font-size: 23px; line-height: 1.2; }
h3 { font-size: 18px; line-height: 1.28; }

p { margin: 0; }
a { color: var(--ink); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1px; }
img { max-width: 100%; display: block; }
ul, ol, figure { margin: 0; padding: 0; list-style: none; }
button, input { font: inherit; color: inherit; }
svg { display: block; }

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

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------- utilities ---------- */
.wrap {
  width: 100%;
  max-width: var(--page-max);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

.skip-link {
  position: absolute; inset-inline-start: -9999px; top: 0; z-index: 100;
  background: var(--ink); color: var(--paper); padding: 10px 14px; font-size: 14px;
}
.skip-link:focus { inset-inline-start: 0; }

.ic {
  width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.8;
  stroke-linecap: round; stroke-linejoin: round; flex: none;
}

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font-family: var(--text); font-size: 15px; font-weight: 600; line-height: 1;
  padding: 13px 20px; border: 1px solid var(--ink); border-radius: 0;
  background: transparent; color: var(--ink); cursor: pointer;
  transition: background-color .15s ease, color .15s ease, border-color .15s ease;
}
.btn::after { content: none; }
.btn-primary { background: var(--ink); color: var(--paper); }
.btn-primary:hover { background: var(--accent); border-color: var(--accent); text-decoration: none; }
.btn-ghost { border-color: var(--rule-hard); color: var(--ink-2); }
.btn-ghost:hover { border-color: var(--ink); color: var(--ink); text-decoration: none; }
.btn-white { border-color: var(--paper); color: var(--paper); }
.btn-white:hover { background: var(--paper); color: var(--ink); text-decoration: none; }
.btn-sm { padding: 10px 15px; font-size: 14px; }

.icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 38px; height: 38px; padding: 0; border: 0; border-radius: 0;
  background: transparent; color: var(--ink); cursor: pointer;
}
.icon-btn:hover { color: var(--accent); }

/* ---------- header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 40;
  background: var(--paper);
  border-bottom: 1px solid var(--rule-hard);
}
.site-header.scrolled { border-bottom-color: var(--ink); }

.header-inner {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  height: var(--header-h);
}

.brand { display: inline-flex; align-items: center; gap: 9px; color: var(--ink); }
.brand:hover { text-decoration: none; }
.brand .logo-mark { display: none; }
.brand-name {
  font-family: var(--display); font-size: 19px; font-weight: 600;
  letter-spacing: -0.015em; color: var(--ink);
}

.header-nav { display: none; }
.header-actions { display: flex; align-items: center; gap: 2px; }
.header-actions .btn-read { display: none; }

/* hidden by default — i18n.js toggles `.open` on the menu itself */
.lang-menu {
  position: absolute; top: calc(var(--header-h) - 4px); inset-inline-end: var(--gutter);
  min-width: 190px; max-height: 64vh; overflow-y: auto;
  background: var(--paper); border: 1px solid var(--rule-hard);
  padding: 6px 0; z-index: 60; border-radius: 0;
  display: none;
}
.lang-menu.open { display: block; }
.lang-opt {
  display: block; width: 100%; text-align: start; padding: 9px 14px;
  background: none; border: 0; font: inherit; font-size: 14px;
  color: var(--ink-2); cursor: pointer; border-radius: 0;
}
.lang-opt:hover { background: var(--paper-2); color: var(--ink); }
.lang-opt.is-active { color: var(--accent); font-weight: 600; }

.lang-notice {
  margin: 0; padding: 10px var(--gutter);
  background: var(--accent-soft); color: var(--ink);
  font-size: 13px; border-bottom: 1px solid var(--rule);
}

/* script.js drives these with transform: scaleX() + a `.on` class */
.scroll-progress {
  position: fixed; top: 0; inset-inline-start: 0; height: 2px; width: 100%;
  background: var(--accent); z-index: 70;
  transform: scaleX(0); transform-origin: left center;
  opacity: 0; transition: opacity .2s ease;
}
.scroll-progress.on { opacity: 1; }
html[dir="rtl"] .scroll-progress { transform-origin: right center; }

/* shown only once the page is scrolled (script toggles `.visible`) */
.totop {
  position: fixed; inset-inline-end: var(--gutter); bottom: 18px; z-index: 45;
  width: 40px; height: 40px; display: grid; place-items: center;
  background: var(--ink); color: var(--paper); border: 0; border-radius: 0; cursor: pointer;
  opacity: 0; pointer-events: none; transition: opacity .2s ease;
}
.totop.visible { opacity: 1; pointer-events: auto; }

/* ---------- drawer ---------- */
/* script.js only removes `hidden` when opening and never puts it back, so the
   overlay must be gated on body.drawer-open — otherwise the page stays dimmed. */
.scrim {
  position: fixed; inset: 0; z-index: 80;
  background: rgba(16, 20, 24, .5);
  opacity: 0; pointer-events: none;
  transition: opacity .2s ease;
}
.scrim[hidden] { display: none; }
body.drawer-open .scrim { opacity: 1; pointer-events: auto; }

.drawer {
  position: fixed; top: 0; inset-inline-start: 0; height: 100%; width: min(310px, 84vw);
  background: var(--paper); border-inline-end: 1px solid var(--rule-hard);
  z-index: 90; display: flex; flex-direction: column;
  transform: translateX(-100%); transition: transform .25s ease;
}
html[dir="rtl"] .drawer { transform: translateX(100%); }
body.drawer-open .drawer { transform: translateX(0); }

.drawer-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px var(--gutter); border-bottom: 1px solid var(--rule-hard);
}
.drawer-brand { font-family: var(--display); font-size: 18px; font-weight: 600; color: var(--ink); }
.drawer-nav { display: flex; flex-direction: column; padding: 6px 0; }
.drawer-nav a {
  padding: 13px var(--gutter); font-size: 16px; color: var(--ink-2);
  border-bottom: 1px solid var(--rule);
}
.drawer-nav a:hover { color: var(--accent); text-decoration: none; }
.drawer-foot { margin-top: auto; padding: var(--gutter); border-top: 1px solid var(--rule); }
.drawer-foot .btn { width: 100%; }

/* ---------- section headers ---------- */
.eyebrow {
  display: inline-flex; align-items: center; gap: 8px;
  font-family: var(--text); font-size: 12.5px; font-weight: 600;
  text-transform: none; letter-spacing: 0; color: var(--accent);
  margin-bottom: 10px;
}
.eyebrow::before { content: ""; width: 14px; height: 2px; background: var(--accent); flex: none; }
.eyebrow .ic { display: none; }
.eyebrow.light { color: var(--paper); }
.eyebrow.light::before { background: var(--paper); }

.sec-title { font-size: 25px; line-height: 1.18; color: var(--ink); }
.sec-sub { margin-top: 10px; font-size: 15px; line-height: 1.6; color: var(--muted); max-width: 62ch; }

/* ---------- masthead + hero ---------- */
.hero { background: var(--paper); border-bottom: 1px solid var(--rule-hard); }
.hero-inner { padding-bottom: 30px; }

.masthead {
  display: flex; align-items: baseline; justify-content: space-between; gap: 12px;
  padding-top: 18px; padding-bottom: 8px;
  border-bottom: 3px double var(--rule-hard);
}
.masthead-name {
  font-family: var(--display); font-size: 20px; font-weight: 700;
  letter-spacing: -0.02em; color: var(--ink);
}
.masthead-date { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }

.hero-title { margin-top: 22px; font-size: 33px; line-height: 1.1; letter-spacing: -0.02em; }
.hero-title em { font-style: italic; color: var(--accent); }
.hero-sub { margin-top: 14px; font-size: 16px; line-height: 1.62; color: var(--ink-2); max-width: 60ch; }
.hero-actions { display: flex; flex-direction: column; gap: 10px; margin-top: 22px; }
.hero-actions .btn { width: 100%; }

/* the decorative product mockup does not belong on a paper's front page */
.hero-visual, .hv-bg, .hv-wallet, .hv-ai, .hv-tx, .hv-holding, .hv-chart-line, .hv-eq-bar {
  display: none !important;
}

/* ---------- trust row ---------- */
.trust-item {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 14px 0; border-bottom: 1px solid var(--rule);
  font-size: 14px; line-height: 1.5; color: var(--ink-2);
}
.trust-icon { color: var(--accent); display: inline-flex; flex: none; }

/* ---------- filter tabs ---------- */
.filter-tabs {
  display: flex; gap: 6px; overflow-x: auto; padding-bottom: 2px;
  border-bottom: 1px solid var(--rule-hard); margin-bottom: 4px;
  scrollbar-width: none;
}
.filter-tabs::-webkit-scrollbar { display: none; }
.filter-tab {
  flex: none; background: none; border: 0; border-bottom: 2px solid transparent;
  padding: 10px 2px; margin-bottom: -1px; font: inherit; font-size: 14px;
  font-weight: 500; color: var(--muted); cursor: pointer; border-radius: 0;
}
.filter-tab:hover { color: var(--ink); }
.filter-tab.is-active { color: var(--ink); border-bottom-color: var(--accent); }

/* ---------- story list (rows, not cards) ---------- */
.cards-stack { display: block; }

.story-card {
  display: block; padding: 18px 0; border-bottom: 1px solid var(--rule);
  background: none; border-radius: 0; transition: none;
}
.story-card:hover { text-decoration: none; }
.story-card:last-child { border-bottom: 0; }
.story-card.is-hidden { display: none; }   /* category filter (script toggles this) */
.story-card.spotlight { padding-top: 20px; }

.story-media { margin-bottom: 12px; }
.story-media img { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; border-radius: 0; }
.story-card.spotlight .story-media img { aspect-ratio: 3 / 2; }

.story-cat {
  display: inline-flex; align-items: center; gap: 7px;
  font-size: 12px; font-weight: 600; color: var(--accent); margin-bottom: 7px;
  background: none;
}
.story-cat::before { content: ""; width: 10px; height: 2px; background: var(--accent); }

.story-body h3 { font-size: 19px; line-height: 1.26; color: var(--ink); }
.story-card.spotlight .story-body h3 { font-size: 24px; line-height: 1.16; }
.story-card:hover .story-body h3 { text-decoration: underline; text-underline-offset: 3px; }

.story-meta {
  display: block; margin-top: 7px; font-size: 12.5px; color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.story-body p { margin-top: 9px; font-size: 14.5px; line-height: 1.58; color: var(--muted); max-width: 62ch; }

.read-more {
  display: inline-block; margin-top: 10px; font-size: 13.5px; font-weight: 600;
  color: var(--accent); text-decoration: underline; text-underline-offset: 3px;
}
.read-more .ic { display: none; }

/* ---------- benefits ---------- */
.benefit { display: flex; gap: 12px; padding: 15px 0; border-bottom: 1px solid var(--rule); }
.benefit:last-child { border-bottom: 0; }
.benefit-icon { color: var(--accent); flex: none; display: inline-flex; margin-top: 2px; }
.benefit h3 { font-size: 17px; }
.benefit p { margin-top: 5px; font-size: 14.5px; color: var(--muted); line-height: 1.58; }

/* ---------- guide / checklist panels ---------- */
.panel { padding: 20px 0; border-top: 1px solid var(--rule-hard); background: none; }
.panel-title { font-size: 20px; color: var(--ink); }

.guide-item { display: flex; gap: 12px; padding: 13px 0; border-bottom: 1px solid var(--rule); }
.guide-num {
  font-family: var(--display); font-size: 15px; font-weight: 600;
  color: var(--accent); flex: none; min-width: 20px;
}

.checklist li {
  display: flex; gap: 10px; padding: 11px 0; border-bottom: 1px solid var(--rule);
  font-size: 15px; color: var(--ink-2);
}
.check-ic { color: var(--accent); flex: none; display: inline-flex; margin-top: 3px; }

/* ---------- tables ---------- */
.net-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.net-table th {
  text-align: start; font-family: var(--text); font-size: 12px; font-weight: 600;
  color: var(--muted); text-transform: none; letter-spacing: 0;
  padding: 10px 0; border-bottom: 1px solid var(--rule-hard);
}
.net-table td {
  padding: 11px 0; border-bottom: 1px solid var(--rule); color: var(--ink-2);
  font-variant-numeric: tabular-nums;
}

/* ---------- AI cards ---------- */
.ai-card { padding: 16px 0; border-bottom: 1px solid var(--rule); }
.ai-card:last-child { border-bottom: 0; }
.ai-icon { color: var(--accent); display: inline-flex; margin-bottom: 8px; }

/* ---------- FAQ ---------- */
.faq-item { border-bottom: 1px solid var(--rule); }
.faq-item summary {
  padding: 15px 0; font-family: var(--display); font-size: 17px; font-weight: 600;
  color: var(--ink); cursor: pointer; list-style: none;
}
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary::after { content: "+"; float: inline-end; color: var(--accent); font-weight: 400; }
.faq-item[open] summary::after { content: "−"; }
.faq-item p { padding: 0 0 16px; font-size: 14.5px; color: var(--muted); line-height: 1.62; }

/* ---------- newsletter ---------- */
.newsletter { padding: 26px 0; border-block: 1px solid var(--rule-hard); background: none; }
.newsletter::before, .newsletter::after { content: none; }
.newsletter h2 { font-size: 22px; }
.nl-row { display: flex; flex-direction: column; gap: 10px; margin-top: 16px; }
.nl-row input {
  width: 100%; padding: 13px 14px; font: inherit; font-size: 15px;
  background: transparent; color: var(--ink);
  border: 1px solid var(--rule-hard); border-radius: 0;
}
.nl-row input::placeholder { color: var(--muted); }
.nl-row .btn { width: 100%; }
.nl-error { min-height: 18px; color: var(--flag); font-size: 13px; }
.nl-success { margin-top: 12px; font-size: 14px; color: var(--accent); }

/* ---------- footer ---------- */
.site-footer { padding: 26px 0 34px; border-top: 1px solid var(--rule-hard); }
.footer-social { display: flex; gap: 14px; margin-bottom: 20px; }
.footer-social a { color: var(--muted); display: inline-flex; }
.footer-social a:hover { color: var(--accent); }
/* brand marks are filled paths, so they take a size here rather than `.ic`
   (which forces fill:none) — unsized they default to 300x150 and blow the
   layout viewport wide on phones */
.footer-social svg { width: 20px; height: 20px; }
.footer-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 22px 16px; }
.footer-col a { display: block; padding: 6px 0; font-size: 14px; color: var(--ink-2); }
.footer-col a:hover { color: var(--accent); }
.footer-bottom {
  margin-top: 24px; padding-top: 16px; border-top: 1px solid var(--rule);
  font-size: 12.5px; color: var(--muted);
}

/* ---------- motion: quiet ---------- */
.reveal-group > * { opacity: 1; transform: none; }
html.js .reveal-group > * { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  html { scroll-behavior: auto; }
}

/* ---------- wider screens: nudge the measure, stay a reading column ---------- */
@media (min-width: 720px) {
  .wrap { max-width: var(--page-max-lg); }
  .hero-title { font-size: 40px; }
  .hero-actions { flex-direction: row; }
  .hero-actions .btn { width: auto; }
  .nl-row { flex-direction: row; }
  .nl-row .btn { width: auto; flex: none; }
  .header-nav { display: flex; gap: 18px; }
  .header-nav a { font-size: 14px; color: var(--ink-2); }
  .header-nav a:hover { color: var(--accent); }
  .header-actions .btn-read { display: inline-flex; }
  .footer-cols { grid-template-columns: repeat(4, 1fr); }
}
