/* munshiexplains.com. Brand tokens first, then base, layout and components.
   Standalone, nothing shared with any other site.
   Red and green are reserved for chart meaning: the ledger table only. */
@font-face { font-family: 'Fraunces'; src: url(/assets/fonts/fraunces.woff2) format('woff2'); font-weight: 100 900; font-display: swap; }
@font-face { font-family: 'Inter'; src: url(/assets/fonts/inter.woff2) format('woff2'); font-weight: 100 900; font-display: swap; }

:root {
  --mx-ink: #0E1B2A; --teal: #1C8C86; --teal-deep: #146B66; --mustard: #E3A72F; --paper: #F5F1E8; --slate: #5B6B7C;
  --ink-2: #13243A; --rule: rgba(91,107,124,.22);
  --bg: var(--mx-ink); --surface: var(--ink-2); --ink: var(--paper); --muted: #A9B4C0; --muted-strong: #D5D9DD; --line: rgba(245,241,232,.14);
  --font-display: 'Fraunces', Georgia, serif; --font-body: 'Inter', system-ui, sans-serif; --font-label: 'Inter', system-ui, sans-serif;
  --display-tracking: -0.015em;
  --eyebrow: var(--mustard); --link: var(--mustard); --focus: var(--mustard);
  --radius: 4px; --btn-radius: 2px;
  --cta-bg: var(--mustard); --cta-ink: var(--mx-ink); --cta-bg-hover: #EDB848;
  --tag-bg: rgba(28,140,134,.18); --tag-ink: #6FD0C9;
  --header-bg: rgba(14,27,42,.9); --header-h: 76px;
  --footer-bg: #09131F;
  --row: 48px;
}

/* Base */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: calc(var(--header-h) + 16px); }
body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--font-body); font-size: 1.0625rem; line-height: 1.6; text-rendering: optimizeLegibility; font-feature-settings: 'tnum' 1; overflow-x: hidden; }
img, svg, iframe { display: block; max-width: 100%; }
picture { display: contents; }
a { color: inherit; }
h1, h2, h3 { font-family: var(--font-display); font-variation-settings: 'opsz' 144; font-weight: 800; line-height: 1.05; margin: 0; letter-spacing: var(--display-tracking); }
p { margin: 0 0 1em; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; border-radius: 2px; }
.skip { position: absolute; left: -9999px; }
.skip:focus { left: 16px; top: 16px; z-index: 99; background: var(--surface); color: var(--ink); padding: 8px 14px; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.wrap { width: min(1180px, 100% - 40px); margin-inline: auto; }
.section { padding: clamp(64px, 9vw, 120px) 0; }
.eyebrow { font-family: var(--font-label); font-weight: 800; font-size: .8125rem; letter-spacing: .14em; text-transform: uppercase; color: var(--eyebrow); margin: 0 0 18px; }
.section-head { display: flex; justify-content: space-between; align-items: end; gap: 24px; margin-bottom: 40px; flex-wrap: wrap; }
.section-head h2 { font-size: clamp(2.2rem, 5vw, 3.6rem); max-width: 16ch; }
.text-link { display: inline-flex; align-items: center; gap: 8px; font-family: var(--font-label); font-weight: 800; color: var(--link); text-decoration: none; padding: 6px 0; }
.text-link svg, .more svg, .back svg { width: 18px; height: 18px; }
.text-link:hover { text-decoration: underline; text-underline-offset: 4px; }

/* Ledger page texture: faint Slate rules every 48px and one Mustard margin line */
.ledger-bg { background-image: repeating-linear-gradient(to bottom, transparent 0 calc(var(--row) - 1px), var(--rule) calc(var(--row) - 1px) var(--row)); }
.mx-hero { position: relative; overflow: hidden; border-bottom: 1px solid var(--line); }
.mx-hero::before { content: ''; position: absolute; top: 0; bottom: 0; left: max(8px, calc((100% - 1180px) / 2 - 28px)); width: 2px; background: var(--mustard); opacity: .9; }

/* Header */
.site-header { position: sticky; top: 0; z-index: 20; background: var(--header-bg); backdrop-filter: saturate(1.4) blur(10px); -webkit-backdrop-filter: saturate(1.4) blur(10px); border-bottom: 1px solid var(--line); }
.site-header .wrap { display: flex; align-items: center; justify-content: space-between; height: var(--header-h); gap: 20px; }
.brand { display: block; border-radius: 2px; }
.brand img { height: 56px; width: auto; }
.nav { display: flex; gap: 4px; align-items: center; }
.nav a { text-decoration: none; font-family: var(--font-label); font-weight: 700; font-size: .95rem; padding: 10px 14px; border-radius: var(--btn-radius); }
.nav a:hover { background: rgba(245,241,232,.08); }
.nav a[aria-current="page"] { box-shadow: inset 0 -2px 0 var(--mustard); }
.nav .nav-cta { background: var(--cta-bg); color: var(--cta-ink); margin-left: 8px; }
.nav .nav-cta:hover { background: var(--cta-bg-hover); color: var(--mx-ink); }
.menu-btn { display: none; }

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 10px; font-family: var(--font-label); font-weight: 800; font-size: 1rem; text-decoration: none; padding: 15px 24px; border-radius: var(--btn-radius); border: 1px solid transparent; transition: transform .15s ease, background .15s ease, border-color .15s ease; }
.btn:hover { transform: translateY(-2px); }
.btn-primary { background: var(--cta-bg); color: var(--cta-ink); }
.btn-primary:hover { background: var(--cta-bg-hover); }
.btn-ghost { background: transparent; color: var(--paper); border-color: rgba(245,241,232,.35); }
.btn-ghost:hover { border-color: var(--paper); }
.btn svg { width: 18px; height: 18px; flex: none; }
.btn-block { display: flex; width: 100%; margin-top: 18px; }
.actions { display: flex; flex-wrap: wrap; gap: 14px; }

/* Home hero */
.mx-hero > .wrap { display: grid; grid-template-columns: 1.3fr .7fr; gap: 56px; align-items: center; padding: clamp(64px, 10vw, 136px) 0; }
.mx-hero h1 { font-size: clamp(3rem, 7.6vw, 6.4rem); line-height: .98; margin-bottom: 30px; text-wrap: balance; }
.mx-hero h1 em { font-style: normal; color: var(--mustard); }
.mx-hero .lede { font-size: 1.2rem; max-width: 46ch; color: var(--muted-strong); margin-bottom: 36px; }
.mx-owl { position: relative; justify-self: end; width: min(340px, 100%); }
.mx-owl img { width: 100%; height: auto; }
.mx-owl .figure { position: absolute; font-family: var(--font-label); font-weight: 800; font-size: .9rem; letter-spacing: .08em; background: var(--paper); color: var(--mx-ink); padding: 9px 14px 10px; border-radius: 1px; box-shadow: 0 10px 24px rgba(0,0,0,.35); border-bottom: 2px dashed rgba(14,27,42,.25); }
.mx-owl .figure::before { content: ''; position: absolute; top: -5px; left: 50%; width: 10px; height: 10px; margin-left: -5px; border-radius: 50%; background: var(--mustard); box-shadow: 0 1px 2px rgba(0,0,0,.4); }
.mx-owl .figure.a { top: 8%; left: -12%; transform: rotate(-4deg); font-size: 1.15rem; }
.mx-owl .figure.b { bottom: 16%; right: -6%; transform: rotate(3deg); }

/* Simple page hero (stories, 404) */
.page-hero > .wrap.page-hero-wrap, .post-hero > .wrap.post-hero-wrap { display: block; padding: clamp(48px, 7vw, 96px) 0 clamp(40px, 5vw, 64px); }
.page-hero h1 { font-size: clamp(2.6rem, 6.4vw, 5rem); margin-bottom: 20px; }
.page-hero .lede, .post-hero .lede { font-size: 1.2rem; max-width: 60ch; color: var(--muted-strong); margin-bottom: 28px; }
.crumbs { font-family: var(--font-label); font-weight: 700; font-size: .9rem; margin-bottom: 22px; color: var(--muted); }
.crumbs a { text-decoration: none; color: var(--link); }
.crumbs a:hover { text-decoration: underline; }

/* Tags and meta */
.meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-family: var(--font-label); font-weight: 700; font-size: .78rem; letter-spacing: .04em; }
.tag { padding: 5px 11px; border-radius: 999px; background: var(--tag-bg); color: var(--tag-ink); }
.meta .entry-code { margin-right: 6px; }

/* Lead story feature */
.feature { display: grid; grid-template-columns: 1.25fr 1fr; border-radius: var(--radius); overflow: hidden; background: var(--surface); border: 1px solid var(--line); text-decoration: none; color: var(--ink); transition: box-shadow .2s ease; }
.feature:hover { box-shadow: 0 0 0 1px var(--mustard); }
.card-thumb { position: relative; aspect-ratio: 16 / 9; background: #000; }
.card-thumb img { width: 100%; height: 100%; object-fit: cover; }
.card-body { padding: clamp(28px, 4vw, 48px); display: flex; flex-direction: column; justify-content: center; gap: 16px; }
.card-body h3 { font-size: clamp(1.8rem, 3.2vw, 2.6rem); line-height: 1.08; text-wrap: balance; }
.card-body p { color: var(--muted); margin: 0; }
.more { display: inline-flex; align-items: center; gap: 8px; font-family: var(--font-label); font-weight: 800; color: var(--link); }
.feature:hover .more { text-decoration: underline; text-underline-offset: 4px; }

/* Story index as a ledger: each story is a ruled row that sits on the 48px lines */
.entries { list-style: none; margin: 0; padding: 0; border-top: 2px solid var(--paper);
  background-image: repeating-linear-gradient(to bottom, transparent 0 calc(var(--row) - 1px), var(--rule) calc(var(--row) - 1px) var(--row)); }
.entry { display: grid; grid-template-columns: 92px 120px minmax(0, 1fr) auto 160px; align-items: center; gap: 28px; height: calc(var(--row) * 2); text-decoration: none; color: var(--ink); border-bottom: 1px solid var(--line); position: relative; }
.entry:hover { background: rgba(245,241,232,.04); }
.entry:hover .entry-title { text-decoration: underline; text-decoration-color: var(--mustard); text-underline-offset: 5px; }
.entry-code { font-family: var(--font-label); font-weight: 800; font-size: .85rem; letter-spacing: .12em; color: var(--mustard); white-space: nowrap; }
.entry-date { font-family: var(--font-label); font-weight: 600; font-size: .9rem; color: var(--muted); white-space: nowrap; }
.entry-title { font-family: var(--font-display); font-variation-settings: 'opsz' 144; font-weight: 700; font-size: 1.35rem; line-height: 1.15; }
.entry-figure { font-family: var(--font-display); font-variation-settings: 'opsz' 144; font-weight: 800; font-size: 2rem; color: var(--mustard); white-space: nowrap; text-align: right; }
.entry-thumb { width: 144px; aspect-ratio: 16 / 9; overflow: hidden; border-radius: 2px; background: #000; border: 1px solid var(--line); }
.entry-thumb img { width: 100%; height: 100%; object-fit: cover; }

/* How we work */
.method { display: grid; grid-template-columns: repeat(3, 1fr); border-top: 1px solid var(--line); }
.method div { padding: 34px 32px 10px 0; border-right: 1px solid var(--line); margin-right: 32px; }
.method div:last-child { border-right: 0; margin-right: 0; }
.method .n { font-family: var(--font-display); font-variation-settings: 'opsz' 144; font-weight: 800; font-size: 3.6rem; color: var(--mustard); line-height: 1; display: block; margin-bottom: 18px; }
.method h3 { font-size: 1.6rem; margin-bottom: 10px; }
.method p { color: var(--muted); }

/* About (paper band) */
.paper-band { background: var(--paper); color: var(--mx-ink); --muted: #4A5866; --eyebrow: var(--teal-deep); --focus: var(--teal-deep); }
.about { display: grid; grid-template-columns: 260px 1fr; gap: 64px; align-items: center; }
.about img { width: 100%; height: auto; }
.about h2 { font-size: clamp(2.2rem, 5vw, 3.6rem); margin-bottom: 22px; }
.about p { font-size: 1.15rem; max-width: 58ch; color: #2A3846; }

/* Story page */
.post-hero h1 { font-size: clamp(2.4rem, 6vw, 4.6rem); max-width: 20ch; margin: 18px 0 20px; text-wrap: balance; }
.post-hero .tag { background: transparent; border: 1px solid rgba(245,241,232,.3); color: var(--paper); }
.post-layout { display: grid; grid-template-columns: minmax(280px, 360px) minmax(0, 1fr); gap: clamp(32px, 5vw, 64px); align-items: start; padding: clamp(40px, 5vw, 64px) 0 clamp(64px, 9vw, 120px); }
.post-side { position: sticky; top: calc(var(--header-h) + 24px); display: grid; gap: 14px; }
.side-card { background: var(--ink-2); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px 22px 22px; }
.fact-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; font-family: var(--font-label); font-size: .95rem; }
.fact-list li { display: flex; justify-content: space-between; gap: 12px; border-bottom: 1px solid var(--line); padding-bottom: 10px; }
.fact-list span { color: var(--muted); }
.fact-list b { font-weight: 800; text-align: right; }

.reading { background: var(--paper); color: var(--mx-ink); padding: clamp(24px, 4vw, 56px); border-radius: var(--radius); max-width: 760px; min-width: 0;
  --muted: #4A5866; --line: rgba(14,27,42,.14); --link: var(--teal-deep); --eyebrow: var(--teal-deep); --focus: var(--teal-deep); }
.reading h2 { font-size: clamp(1.6rem, 3vw, 2.1rem); margin: 48px 0 16px; color: var(--mx-ink); }
.reading .eyebrow + h2 { margin-top: 0; }
.reading p { font-size: 1.1rem; line-height: 1.7; color: #1E2C3A; }
.reading a { color: var(--teal-deep); text-underline-offset: 3px; }
.reading a:hover { color: var(--mx-ink); }
.table-scroll { overflow-x: auto; }
.ledger-table { width: 100%; border-collapse: collapse; font-size: .98rem; margin: 6px 0 10px; }
.ledger-table th { text-align: left; font-family: var(--font-label); font-size: .75rem; letter-spacing: .12em; text-transform: uppercase; color: #4A5866; border-bottom: 2px solid var(--mx-ink); padding: 8px 12px 8px 0; }
.ledger-table td { border-bottom: 1px solid rgba(14,27,42,.14); padding: 12px 12px 12px 0; vertical-align: top; }
.ledger-table td:first-child { white-space: nowrap; font-weight: 600; color: #3A4856; width: 116px; }
.ledger-table .num { text-align: right; padding-right: 0; }
.ledger-table td.num { font-weight: 800; white-space: nowrap; color: var(--mx-ink); }
.ledger-table td.up { color: #1D7A3E; }
.ledger-table td.down { color: #B3261E; }
.lesson { border-left: 3px solid var(--mustard); padding: 6px 0 6px 22px; margin: 44px 0 10px; font-family: var(--font-display); font-size: clamp(1.5rem, 3vw, 2rem); line-height: 1.25; font-variation-settings: 'opsz' 144; font-weight: 700; }
.lesson small { display: block; font-family: var(--font-label); font-size: .78rem; letter-spacing: .14em; text-transform: uppercase; color: var(--teal-deep); margin-bottom: 8px; font-weight: 800; }
.sources { list-style: none; padding: 0; margin: 0; counter-reset: s; }
.sources li { counter-increment: s; position: relative; padding-left: 42px; margin-bottom: 16px; }
.sources li::before { content: counter(s); position: absolute; left: 0; top: 1px; width: 26px; height: 26px; display: grid; place-items: center; border-radius: 50%; background: var(--mx-ink); color: var(--paper); font-size: .8rem; font-weight: 800; }
.sources small { display: block; color: #4A5866; font-weight: 600; font-size: .85rem; }
.sources a { font-weight: 600; overflow-wrap: anywhere; }
details.transcript { border-top: 1px solid rgba(14,27,42,.14); margin-top: 40px; padding-top: 20px; }
details.transcript summary { cursor: pointer; font-weight: 800; font-family: var(--font-label); padding: 6px 0; }
details.transcript[open] summary { margin-bottom: 14px; }
details.transcript p { font-size: 1rem; color: #33414F; }
.back { margin: 40px 0 0; }
.back a { display: inline-flex; align-items: center; gap: 8px; font-family: var(--font-label); font-weight: 800; text-decoration: none; }
.back svg { transform: scaleX(-1); }

/* Click to load player. No YouTube request until the viewer presses play. */
.player { position: relative; width: 100%; border-radius: var(--radius); overflow: hidden; background: var(--mx-ink); border: 1px solid var(--line);
  background-image: repeating-linear-gradient(to bottom, transparent 0 calc(var(--row) - 1px), var(--rule) calc(var(--row) - 1px) var(--row)); }
.player.is-short { aspect-ratio: 9 / 16; max-height: 78vh; margin-inline: auto; }
.player.is-long { aspect-ratio: 16 / 9; }
.player button, .player a.player-face { all: unset; cursor: pointer; position: absolute; inset: 0; display: grid; place-items: center; }
.player button:focus-visible, .player a.player-face:focus-visible { outline: 3px solid var(--focus); outline-offset: -3px; }
.player img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.player.is-short img { object-fit: contain; }
.player .play { position: relative; width: 84px; height: 84px; border-radius: 50%; display: grid; place-items: center; background: var(--mustard); color: var(--mx-ink); transition: transform .15s ease; }
.player button:hover .play { transform: scale(1.06); }
.player .play svg { width: 32px; height: 32px; margin-left: 4px; }
.player iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.player .soon { position: absolute; left: 50%; bottom: 18%; transform: translateX(-50%); white-space: nowrap; font-family: var(--font-label); font-weight: 800; font-size: .95rem; background: var(--paper); color: var(--mx-ink); padding: 10px 18px; border-radius: 2px; }
.player a.player-face:hover .soon { background: var(--mustard); }
.player-note { font-size: .85rem; color: var(--muted); margin: 0; text-align: center; }

/* Footer */
.site-footer { background: var(--footer-bg); color: var(--paper); padding: 64px 0 40px; }
.site-footer .wrap { display: grid; grid-template-columns: 1.4fr 1fr 1fr; gap: 40px; }
.site-footer img { height: 60px; width: auto; margin-bottom: 18px; }
.footer-line { color: var(--muted); max-width: 36ch; }
.footer-h { font-family: var(--font-label); font-variation-settings: normal; font-size: .8rem; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; margin: 0 0 14px; color: var(--muted); }
.site-footer a { text-decoration: none; }
.site-footer a:hover { text-decoration: underline; text-underline-offset: 3px; }
.site-footer ul { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.site-footer .legal { grid-column: 1 / -1; border-top: 1px solid var(--line); padding-top: 24px; font-size: .85rem; color: var(--muted); display: flex; justify-content: space-between; flex-wrap: wrap; gap: 12px; }

/* Responsive */
@media (max-width: 1020px) {
  .entry { grid-template-columns: 84px 108px minmax(0, 1fr) auto; gap: 20px; }
  .entry-thumb { display: none; }
}
@media (max-width: 900px) {
  .mx-hero > .wrap { grid-template-columns: 1fr; gap: 40px; }
  .mx-owl { justify-self: start; width: min(240px, 64%); margin-left: 12%; }
  .feature { grid-template-columns: 1fr; }
  .post-layout { grid-template-columns: 1fr; }
  .post-side { position: static; width: 100%; max-width: 420px; margin-inline: auto; }
  .player.is-short { max-width: 320px; max-height: none; }
  .player.is-short.is-soon { max-width: none; aspect-ratio: 16 / 9; }
  .player.is-soon .soon { bottom: 8px; left: 8px; transform: none; font-size: .78rem; padding: 6px 12px; }
  .method { grid-template-columns: 1fr; }
  .method div { border-right: 0; margin-right: 0; border-bottom: 1px solid var(--line); padding-right: 0; }
  .about { grid-template-columns: 1fr; gap: 28px; }
  .about img { width: 180px; }
  .site-footer .wrap { grid-template-columns: 1fr 1fr; }
  .site-footer .wrap > div:first-child { grid-column: 1 / -1; }
}
@media (max-width: 720px) {
  :root { --header-h: 64px; }
  .menu-btn { all: unset; display: inline-flex; align-items: center; cursor: pointer; font-family: var(--font-label); font-weight: 800; font-size: .95rem; padding: 10px 16px; border-radius: var(--btn-radius); border: 1px solid rgba(245,241,232,.35); }
  .menu-btn:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; }
  .nav { display: none; position: absolute; left: 0; right: 0; top: var(--header-h); flex-direction: column; align-items: stretch; gap: 2px; padding: 12px 20px 20px; background: var(--mx-ink); border-bottom: 1px solid var(--line); }
  .nav.open { display: flex; }
  .nav a { padding: 14px 12px; }
  .nav .nav-cta { margin: 8px 0 0; text-align: center; }
  .brand img { height: 46px; }

  /* Ledger rows stack: code and date on one line, then the title, figure on the right */
  .entries { background-image: none; }
  .entry { height: auto; min-height: calc(var(--row) * 2); grid-template-columns: auto auto minmax(0, 1fr); grid-template-areas: "code date figure" "title title title"; gap: 6px 14px; padding: 16px 0 18px; }
  .entry-code { grid-area: code; }
  .entry-date { grid-area: date; }
  .entry-figure { grid-area: figure; font-size: 1.5rem; line-height: 1; }
  .entry-title { grid-area: title; font-size: 1.25rem; }
  .ledger-table { font-size: .92rem; }
  .ledger-table td:first-child { width: auto; white-space: normal; min-width: 72px; }
  .site-footer .wrap { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .btn:hover { transform: none; }
}
