/* DealTrade — design tokens */
:root {
  --bg: #f7f8fb;
  --bg-elev: #ffffff;
  /* All text is pure black (white in dark mode): no grey text anywhere. */
  --ink: #000000;
  --ink-2: #000000;
  --muted: #000000;
  --line: #e3e6ef;
  --soft: #eef1f7;
  --c: #8b5cf6;
  --radius: 18px;
  --shadow: 0 1px 2px rgba(13, 18, 34, .04), 0 8px 24px -12px rgba(13, 18, 34, .12);
  --shadow-hover: 0 2px 4px rgba(13, 18, 34, .06), 0 18px 40px -16px rgba(13, 18, 34, .25);
  /* Same pairing as GarageHub: DM Sans for text, Manrope for headings. */
  --font: 'DM Sans', Arial, sans-serif;
  --display: 'Manrope', 'DM Sans', sans-serif;
  /* diagram palette (articles override the accents per category) */
  --d-ink: #000000;
  --d-muted: #000000;
  --d-line: #cbd5e1;
  --d-surface: #f1f5f9;
  --d-accent: var(--c);
  --d-accent-2: #22d3ee;
  --d-accent-3: #f472b6;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #080b14; --bg-elev: #0f1424; --ink: #ffffff; --ink-2: #ffffff; --muted: #ffffff; --line: #1f2740; --soft: #141a2e;
    --shadow: 0 1px 2px rgba(0,0,0,.3), 0 8px 24px -12px rgba(0,0,0,.6);
    --shadow-hover: 0 2px 4px rgba(0,0,0,.4), 0 18px 40px -16px rgba(0,0,0,.8);
    --d-ink: #ffffff; --d-muted: #ffffff; --d-line: #334155; --d-surface: #1a2236;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #080b14; --bg-elev: #0f1424; --ink: #ffffff; --ink-2: #ffffff; --muted: #ffffff; --line: #1f2740; --soft: #141a2e;
  --shadow: 0 1px 2px rgba(0,0,0,.3), 0 8px 24px -12px rgba(0,0,0,.6);
  --shadow-hover: 0 2px 4px rgba(0,0,0,.4), 0 18px 40px -16px rgba(0,0,0,.8);
  --d-ink: #ffffff; --d-muted: #ffffff; --d-line: #334155; --d-surface: #1a2236;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 16px/1.6 var(--font); -webkit-font-smoothing: antialiased; overflow-x: hidden; }
a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }
h1, h2, h3, h4 { font-family: var(--display); letter-spacing: -0.02em; line-height: 1.15; margin: 0; }
.muted { color: var(--muted); }
.wrap { width: min(1240px, 100% - 32px); margin-inline: auto; }
.wrap-narrow { width: min(780px, 100% - 32px); margin-inline: auto; }

/* progress bar */
.progress { position: fixed; inset: 0 auto auto 0; height: 3px; width: 0; background: var(--c); z-index: 60; transition: width .08s linear; }

/* header */
.site-header { position: sticky; top: 0; z-index: 50; background: color-mix(in srgb, var(--bg) 82%, transparent); backdrop-filter: saturate(160%) blur(14px); -webkit-backdrop-filter: saturate(160%) blur(14px); border-bottom: 1px solid var(--line); }
.header-row { display: flex; align-items: center; gap: 28px; height: 64px; }
.logo { display: inline-flex; align-items: center; gap: 10px; font: 700 21px var(--display); letter-spacing: -0.03em; }
.logo-accent { background: linear-gradient(90deg, #8b5cf6, #22d3ee); -webkit-background-clip: text; background-clip: text; color: transparent; }
.logo-mark { width: 26px; height: 26px; border-radius: 8px; background: conic-gradient(from 210deg, #8b5cf6, #22d3ee, #10b981, #f59e0b, #f43f5e, #8b5cf6); box-shadow: inset 0 0 0 6px var(--bg); outline: 2px solid var(--ink); outline-offset: -2px; }
.nav { display: flex; gap: 4px; flex: 1; overflow-x: auto; scrollbar-width: none; }
.nav::-webkit-scrollbar { display: none; }
.nav-link { position: relative; padding: 8px 12px; border-radius: 10px; font-weight: 500; font-size: 14.5px; color: var(--ink-2); white-space: nowrap; transition: background .15s, color .15s; }
.nav-link:hover { background: var(--soft); color: var(--ink); }
.nav-link.active { color: var(--ink); }
.nav-link.active::after { content: ''; position: absolute; left: 12px; right: 12px; bottom: -13px; height: 2px; background: var(--c); border-radius: 2px; }
.header-actions { display: flex; gap: 6px; margin-left: auto; }
.icon-btn { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 10px; border: 1px solid var(--line); background: var(--bg-elev); color: var(--ink); cursor: pointer; }
.icon-btn:hover { background: var(--soft); }
.icon-btn svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.menu-toggle { display: none; }

/* kicker + meta */
.kicker { display: flex; align-items: center; gap: 10px; font-size: 12.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.kicker a { color: var(--c); }
.kicker span::before { content: '•'; margin-right: 10px; opacity: .5; }
.meta-row { display: flex; gap: 14px; font-size: 13px; color: var(--muted); margin-top: auto; padding-top: 14px; }
.dek { color: var(--ink-2); margin: 8px 0 0; font-size: 15px; }

/* cards */
.grid { display: grid; gap: 22px; }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.card { display: flex; flex-direction: column; background: var(--bg-elev); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); transition: transform .2s, box-shadow .2s, border-color .2s; }
.card:hover { transform: translateY(-3px); box-shadow: var(--shadow-hover); border-color: color-mix(in srgb, var(--c) 40%, var(--line)); }
.card-img { aspect-ratio: 1200/630; overflow: hidden; background: #0b1020; }
.card-img img { width: 100%; height: 100%; object-fit: cover; transition: transform .5s; }
.card:hover .card-img img { transform: scale(1.04); }
.card-body { display: flex; flex-direction: column; flex: 1; padding: 16px 18px 18px; }
.card h3 { font-size: 18px; margin-top: 8px; }
.card h3 a:hover { color: var(--c); }
.card.row { flex-direction: row; box-shadow: none; }
.card.row .card-img { width: 38%; flex-shrink: 0; aspect-ratio: auto; }
/* Hero art draws its motif around x≈73%, so aim narrow crops at it. */
.card.row .card-img img, .lead-img img { object-position: 74% 50%; }
.card.row .card-body { padding: 12px 14px; }
.card.row h3 { font-size: 15.5px; }
.card.row .dek { display: none; }
.card.row .meta-row { padding-top: 8px; }

/* home hero */
.hero-grid { display: grid; grid-template-columns: 1.55fr 1fr; gap: 22px; padding-top: 28px; }
.lead { position: relative; border-radius: 24px; overflow: hidden; min-height: 520px; display: flex; align-items: flex-end; background: #0b1020; box-shadow: var(--shadow); }
.lead-img { position: absolute; inset: 0; }
.lead-img img { width: 100%; height: 100%; object-fit: cover; transition: transform .8s; }
.lead:hover .lead-img img { transform: scale(1.03); }
.lead::after { content: ''; position: absolute; inset: 0; background: linear-gradient(180deg, transparent 30%, rgba(5, 8, 16, .92)); pointer-events: none; }
.lead-body { position: relative; z-index: 1; padding: 34px; color: #fff; pointer-events: none; }
.lead-body a { pointer-events: auto; }
.lead .kicker { color: rgba(255,255,255,.7); }
.lead h1 { font-size: clamp(28px, 3.4vw, 44px); margin-top: 12px; max-width: 18ch; }
.lead .dek { color: rgba(255,255,255,.82); font-size: 17px; max-width: 56ch; }
.side-list { display: flex; flex-direction: column; gap: 14px; }
.side-list .card { flex: 1; }

/* ticker */
.ticker { margin-top: 28px; border-block: 1px solid var(--line); background: var(--bg-elev); }
.ticker-inner { display: flex; align-items: center; gap: 18px; height: 48px; }
.ticker-label { flex-shrink: 0; font: 600 12px var(--font); text-transform: uppercase; letter-spacing: .08em; padding: 5px 10px; border-radius: 999px; background: var(--ink); color: var(--bg); }
.ticker-track { overflow: hidden; flex: 1; mask-image: linear-gradient(90deg, transparent, #000 4%, #000 96%, transparent); }
.ticker-move { display: flex; gap: 40px; width: max-content; animation: ticker 90s linear infinite; }
.ticker-move a { white-space: nowrap; font-size: 14px; color: var(--ink-2); }
.ticker-move a b { margin-right: 6px; font-weight: 600; }
.ticker-move a:hover { color: var(--ink); }
.ticker:hover .ticker-move { animation-play-state: paused; }
@keyframes ticker { to { transform: translateX(-50%); } }
@media (prefers-reduced-motion: reduce) { .ticker-move { animation: none; } }

/* intro band + stats */
.intro-band { display: grid; grid-template-columns: 1.2fr 1fr; gap: 40px; align-items: center; margin: 56px 0 20px; padding: 36px; border-radius: 24px; background: radial-gradient(120% 140% at 0% 0%, color-mix(in srgb, #8b5cf6 16%, transparent), transparent 55%), radial-gradient(120% 140% at 100% 100%, color-mix(in srgb, #22d3ee 14%, transparent), transparent 55%), var(--bg-elev); border: 1px solid var(--line); }
.intro-band h2 { font-size: clamp(24px, 3vw, 34px); }
.intro-band p { margin: 10px 0 0; }
.stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.stats div { padding: 16px 18px; border-radius: 14px; background: var(--bg); border: 1px solid var(--line); }
.stats b { display: block; font: 700 30px var(--display); letter-spacing: -0.03em; }
.stats span { font-size: 13px; color: var(--muted); }

/* section heads + rails */
.section-head { display: flex; align-items: baseline; flex-wrap: wrap; gap: 6px 16px; margin: 56px 0 20px; }
.section-head h2 { font-size: 26px; display: flex; align-items: center; gap: 10px; }
.section-head p { margin: 0; flex: 1; min-width: 240px; font-size: 14.5px; }
.section-head .dot { width: 12px; height: 12px; border-radius: 4px; background: var(--c); box-shadow: 0 0 0 4px color-mix(in srgb, var(--c) 20%, transparent); }
.see-all { font-weight: 600; font-size: 14px; color: var(--c); }

/* category page */
.cat-banner { position: relative; overflow: hidden; padding: 56px 0 44px; border-bottom: 1px solid var(--line); background: radial-gradient(80% 160% at 100% 0%, color-mix(in srgb, var(--c) 28%, transparent), transparent 60%), radial-gradient(60% 120% at 0% 100%, color-mix(in srgb, var(--c) 12%, transparent), transparent 60%), var(--bg-elev); }
.cat-banner::after { content: ''; position: absolute; inset: 0; background-image: radial-gradient(color-mix(in srgb, var(--ink) 14%, transparent) 1px, transparent 1px); background-size: 22px 22px; mask-image: linear-gradient(90deg, transparent 40%, #000); pointer-events: none; }
.cat-banner h1 { font-size: clamp(40px, 6vw, 72px); margin-top: 10px; }
.cat-banner p { max-width: 60ch; font-size: 18px; color: var(--ink-2); margin: 10px 0 0; }
.cat-meta { display: inline-block; margin-top: 18px; padding: 6px 12px; border-radius: 999px; font-size: 13px; font-weight: 600; background: color-mix(in srgb, var(--c) 16%, transparent); color: var(--ink); }
.crumbs { font-size: 13px; color: var(--muted); }
.crumbs a:hover { color: var(--c); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 28px 0 24px; }
.chip { font: 500 13.5px var(--font); padding: 7px 13px; border-radius: 999px; border: 1px solid var(--line); background: var(--bg-elev); color: var(--ink-2); cursor: pointer; }
.chip:hover { border-color: var(--c); }
.chip.active { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.card.hidden { display: none; }

/* article */
.post-head { padding-top: 40px; text-align: center; }
.post-head h1 { font-size: clamp(30px, 4.6vw, 52px); margin-top: 16px; }
.post-dek { font-size: clamp(17px, 2vw, 20px); color: var(--ink-2); margin: 16px auto 0; max-width: 60ch; }
.post-meta { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px 16px; margin-top: 20px; font-size: 14px; color: var(--muted); }
.badge { padding: 2px 10px; border-radius: 999px; background: color-mix(in srgb, var(--c) 16%, transparent); color: var(--ink); font-weight: 600; }
.post-hero { margin: 32px auto 0; }
.post-hero img { width: 100%; aspect-ratio: 1200/500; object-fit: cover; border-radius: 24px; box-shadow: var(--shadow); background: #0b1020; }
.post-grid { display: grid; grid-template-columns: 220px minmax(0, 720px); justify-content: center; gap: 56px; margin-top: 40px; }
.toc { font-size: 14px; }
.toc-inner { position: sticky; top: 90px; display: flex; flex-direction: column; gap: 4px; }
.toc h4 { font: 600 12px var(--font); text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin-bottom: 8px; }
.toc a { padding: 6px 0 6px 12px; border-left: 2px solid var(--line); color: var(--ink-2); line-height: 1.35; }
.toc a:hover, .toc a.on { color: var(--ink); border-left-color: var(--c); }
.tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 20px; }
.tag { font-size: 12px; padding: 3px 9px; border-radius: 999px; background: var(--soft); color: var(--ink-2); }

.prose { font-size: 18px; line-height: 1.75; color: var(--ink-2); min-width: 0; }
.prose > p:first-child, .prose .lede { font-size: 20px; color: var(--ink); }
.prose .lede::first-letter { float: left; font: 700 64px/0.9 var(--display); margin: 6px 10px 0 0; color: var(--c); }
.prose p { margin: 0 0 1.2em; }
.prose h2 { font-size: 28px; color: var(--ink); margin: 1.8em 0 .6em; scroll-margin-top: 90px; }
.prose h3 { font-size: 21px; color: var(--ink); margin: 1.5em 0 .5em; }
.prose a { color: var(--ink); text-decoration: underline; text-decoration-color: var(--c); text-decoration-thickness: 2px; text-underline-offset: 3px; }
.prose strong { color: var(--ink); }
.prose ul, .prose ol { padding-left: 1.3em; margin: 0 0 1.3em; }
.prose li { margin: .35em 0; }
.prose li::marker { color: var(--c); }
.prose blockquote { margin: 1.6em 0; padding: 4px 0 4px 24px; border-left: 4px solid var(--c); font: 500 22px/1.45 var(--display); color: var(--ink); letter-spacing: -0.01em; }
.prose table { width: 100%; border-collapse: collapse; margin: 1.5em 0; font-size: 15px; display: block; overflow-x: auto; }
.prose th, .prose td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); }
.prose th { color: var(--ink); font-weight: 600; background: var(--soft); }

.takeaways { margin: 0 0 2em; padding: 22px 24px; border-radius: 16px; background: color-mix(in srgb, var(--c) 8%, var(--bg-elev)); border: 1px solid color-mix(in srgb, var(--c) 28%, var(--line)); }
.takeaways h4 { font: 600 12px var(--font); text-transform: uppercase; letter-spacing: .08em; color: var(--c); margin-bottom: 8px; }
.takeaways ul { margin: 0; font-size: 16px; color: var(--ink); }

figure.diagram { margin: 2em -24px; padding: 24px; border-radius: 20px; background: var(--bg-elev); border: 1px solid var(--line); box-shadow: var(--shadow); }
figure.diagram svg { display: block; width: 100%; height: auto; font-family: var(--font); overflow: visible; }
figure.diagram svg text { font-family: var(--font); }
figure.diagram figcaption { margin-top: 14px; font-size: 14px; line-height: 1.5; color: var(--muted); padding-top: 12px; border-top: 1px dashed var(--line); }

.sources { margin-top: 3em; padding-top: 1.4em; border-top: 1px solid var(--line); font-size: 15px; }
.sources h4 { font: 600 12px var(--font); text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin-bottom: 8px; }
.sources a { text-decoration-thickness: 1px; }
.prevnext { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 2.4em; }
.prevnext a { display: flex; flex-direction: column; gap: 4px; padding: 16px 18px; border-radius: 14px; border: 1px solid var(--line); background: var(--bg-elev); text-decoration: none; font: 600 15px/1.35 var(--display); color: var(--ink); }
.prevnext a:hover { border-color: var(--c); }
.prevnext small { font: 500 12px var(--font); color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.prevnext .nx { text-align: right; }
.related { padding-bottom: 20px; }

/* search */
.search-wrap { padding-top: 48px; min-height: 60vh; }
.search-wrap h1 { font-size: 44px; }
.search-input { width: 100%; margin: 20px 0 12px; padding: 18px 22px; font: 500 18px var(--font); color: var(--ink); background: var(--bg-elev); border: 1px solid var(--line); border-radius: 16px; outline: none; box-shadow: var(--shadow); }
.search-input:focus { border-color: #8b5cf6; box-shadow: 0 0 0 4px color-mix(in srgb, #8b5cf6 20%, transparent); }
.search-count { margin-bottom: 20px; font-size: 14px; }
.about { padding: 48px 0; }
.about h1 { font-size: 44px; margin-bottom: 20px; color: var(--ink); }

/* footer */
.site-footer { margin-top: 80px; padding: 48px 0 28px; border-top: 1px solid var(--line); background: var(--bg-elev); }
.footer-grid { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 32px; }
.footer-grid h4 { font: 600 12px var(--font); text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin-bottom: 10px; }
.footer-grid a:not(.logo) { display: block; padding: 3px 0; color: var(--ink-2); font-size: 14.5px; }
.footer-grid a:hover { color: var(--ink); }
.footer-base { margin-top: 32px; padding-top: 20px; border-top: 1px solid var(--line); font-size: 13px; }

/* responsive */
@media (max-width: 1100px) {
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .post-grid { grid-template-columns: minmax(0, 720px); }
  .toc { display: none; }
}
@media (max-width: 900px) {
  .hero-grid, .intro-band { grid-template-columns: 1fr; }
  .lead { min-height: 420px; }
  .grid-3 { grid-template-columns: repeat(2, 1fr); }
  .menu-toggle { display: grid; }
  .nav { display: none; position: absolute; top: 64px; left: 0; right: 0; flex-direction: column; padding: 10px 16px 16px; background: var(--bg-elev); border-bottom: 1px solid var(--line); }
  .nav.open { display: flex; }
  .nav-link.active::after { display: none; }
  .nav-link.active { background: var(--soft); }
  figure.diagram { margin-inline: 0; padding: 16px; }
}
@media (max-width: 600px) {
  .grid-4, .grid-3 { grid-template-columns: 1fr; }
  .lead-body { padding: 22px; }
  .card.row .card-img { width: 34%; }
  .prose { font-size: 17px; }
  .prose .lede { font-size: 18px; }
  .footer-grid { grid-template-columns: 1fr 1fr; }
  .footer-grid > div:first-child { grid-column: 1 / -1; }
  .prevnext { grid-template-columns: 1fr; }
  .prevnext .nx { text-align: left; }
  .intro-band { padding: 24px; }
  .post-hero img { border-radius: 16px; aspect-ratio: 16/9; }
}
