/* Red theme: cool grey page, white surfaces, market red/green as the only loud colors. */
:root {
  --bg: #eef1f5;
  --surface: #ffffff;
  --ink: #18212e;
  --muted: #5b6676;
  --line: #d6dce5;
  --down: #d23f3a;
  --down-soft: #fbe7e5;
  --up: #1f8a5b;
  --up-soft: #e2f4ea;
  --gold: #e7a83a;
  --fur: #8a5a3b;
  --fur-light: #d9b48f;
  --fur-dark: #3a2618;
  --cheek: #f2a3a0;
  --display: var(--gh-font-heading, "Bricolage Grotesque", "Avenir Next", system-ui, sans-serif);
  --body: var(--gh-font-body, "Source Serif 4", Georgia, serif);
  --mono: "JetBrains Mono", ui-monospace, Menlo, monospace;
  --measure: 680px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #10151d; --surface: #19212c; --ink: #e8edf3; --muted: #9aa6b6; --line: #2c3746;
    --down: #ff6b63; --down-soft: #3a1f22; --up: #4cc58c; --up-soft: #17332a; --gold: #f0b54d;
    --fur: #a8724d; --fur-light: #e2c19e; --fur-dark: #2a1b10; --cheek: #e58f8c;
    color-scheme: dark;
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--body); font-size: 18px; line-height: 1.6; }
img { max-width: 100%; height: auto; }
a { color: var(--down); }
a:focus-visible, button:focus-visible, input:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--ink); color: var(--surface); padding: 8px 12px; border-radius: 8px; z-index: 20; }
.skip:focus { left: 8px; }

.wrap { width: 100%; max-width: 1040px; margin: 0 auto; padding-left: max(18px, env(safe-area-inset-left, 0px)); padding-right: max(18px, env(safe-area-inset-right, 0px)); }
.eyebrow { font-family: var(--mono); font-size: 0.75rem; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); margin: 0; }
.lede { color: var(--muted); font-size: 1.1rem; margin: 0; max-width: 56ch; }
.fine { font-family: var(--mono); font-size: 0.72rem; color: var(--muted); line-height: 1.5; margin: 0; }
.center { text-align: center; }
.bear { display: block; width: 100%; height: 100%; }

/* buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; font: 700 1rem/1 var(--display); color: #fff; background: var(--down); border: 0; border-radius: 12px; padding: 15px 20px; cursor: pointer; text-decoration: none; white-space: nowrap; }
.btn:hover { filter: brightness(1.06); }
.btn-small { padding: 10px 14px; font-size: 0.9rem; border-radius: 10px; }

/* header */
.site-header { background: var(--surface); border-bottom: 1px solid var(--line); }
.site-header-inner { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding-block: 12px; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); min-width: 0; }
.brand-bear { width: 40px; height: 40px; flex: none; }
.brand-name { font-family: var(--display); font-weight: 800; font-size: 1.05rem; line-height: 1.15; margin: 0; }
.site-nav { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; font-family: var(--display); font-size: 0.95rem; }
.site-nav ul { display: flex; gap: 14px; list-style: none; margin: 0; padding: 0; }
.site-nav ul a, .nav-link { color: var(--ink); text-decoration: none; }
.site-nav ul a:hover, .nav-link:hover { color: var(--down); }

/* hero */
.hero { padding-block: 56px 40px; }
.hero-inner { display: grid; grid-template-columns: 180px minmax(0, 1fr); gap: 36px; align-items: center; }
.hero-bear { width: 180px; height: 180px; display: block; }
.hero-text { display: grid; gap: 14px; min-width: 0; }
.hero-title { font-family: var(--display); font-weight: 800; font-size: clamp(2rem, 5vw, 3.2rem); line-height: 1.05; letter-spacing: -0.015em; margin: 0; text-wrap: balance; }
.subscribed { font-family: var(--display); font-weight: 600; color: var(--up); background: var(--up-soft); padding: 12px 16px; border-radius: 12px; margin: 0; justify-self: start; }
@media (max-width: 680px) {
  .hero { padding-block: 32px 24px; }
  .hero-inner { grid-template-columns: minmax(0, 1fr); gap: 18px; justify-items: center; text-align: center; }
  .hero-bear { width: 130px; height: 130px; }
  .lede { margin-inline: auto; }
  .subscribed { justify-self: center; }
}

/* signup form */
.signup { display: grid; gap: 8px; max-width: 520px; width: 100%; }
.signup-row { display: flex; gap: 8px; flex-wrap: wrap; }
.signup input { flex: 1 1 220px; min-width: 0; font: 1rem var(--body); padding: 14px 16px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); }
.signup .btn { flex: 1 1 auto; }
.btn-loading, .form-msg { display: none; }
.form-msg { margin: 0; font-size: 0.95rem; }
.form-msg--success { color: var(--up); }
.form-msg--error { color: var(--down); }
.signup.loading .btn-label { display: none; }
.signup.loading .btn-loading { display: inline; }
.signup.success .form-msg--success, .signup.error .form-msg--error { display: block; }
.signup.success .signup-row { display: none; }

/* issue list */
.issues { padding-block: 24px 64px; display: grid; gap: 18px; }
.section-title { font-family: var(--display); font-weight: 700; font-size: 1.4rem; margin: 0; }
.post-list { display: grid; gap: 10px; }
.post-card-link { display: grid; grid-template-columns: 52px minmax(0, 1fr); gap: 16px; align-items: center; padding: 14px 16px; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; color: var(--ink); text-decoration: none; }
.post-card-link:hover { border-color: var(--down); }
.post-card-bear { width: 52px; height: 52px; }
.post-card-text { display: grid; gap: 2px; min-width: 0; }
.post-card-title { font-family: var(--display); font-weight: 700; font-size: 1.1rem; line-height: 1.25; }
.post-card-excerpt { color: var(--muted); font-size: 0.95rem; }
.pagination { display: flex; justify-content: space-between; align-items: center; font-family: var(--display); color: var(--muted); }
.pagination a { color: var(--ink); }

/* Red's mood follows the post's internal tag: #crash = sweating, #green = suspicious */
.bear-moods { display: block; width: 100%; height: 100%; }
.bear-moods .bear--sweat, .bear-moods .bear--sus { display: none; }
.mood-hash-crash .bear-moods .bear--calm, .mood-hash-green .bear-moods .bear--calm { display: none; }
.mood-hash-crash .bear-moods .bear--sweat { display: block; }
.mood-hash-green .bear-moods .bear--sus { display: block; }

/* single issue */
.issue { padding-block: 40px 24px; }
.issue-head { display: grid; grid-template-columns: 96px minmax(0, 1fr); gap: 22px; align-items: center; max-width: calc(var(--measure) + 160px); }
.issue-bear { width: 96px; height: 96px; }
.issue-head-text { display: grid; gap: 8px; min-width: 0; }
.issue-title { font-family: var(--display); font-weight: 800; font-size: clamp(1.8rem, 4vw, 2.6rem); line-height: 1.08; letter-spacing: -0.01em; margin: 0; text-wrap: balance; }
@media (max-width: 560px) { .issue-head { grid-template-columns: 64px minmax(0, 1fr); gap: 14px; } .issue-bear { width: 64px; height: 64px; } }
.issue-body, .disclaimer { max-width: var(--measure); margin-inline: auto; }
.disclaimer { font-family: var(--mono); font-size: 0.72rem; color: var(--muted); border-top: 1px solid var(--line); padding-top: 14px; margin-top: 32px; }
.page { padding-block: 40px 64px; }
.page .issue-title { max-width: var(--measure); margin: 0 auto 20px; }
.page-image { display: block; max-width: var(--measure); width: 100%; margin: 0 auto; border-radius: 16px; }
.after-issue { max-width: calc(var(--measure) + 36px); padding-block: 24px 64px; display: grid; gap: 12px; }
.after-issue-title { font-family: var(--display); font-weight: 700; font-size: 1.2rem; margin: 0; }

/* post content */
.gh-content { margin-top: 28px; }
.gh-content > * + * { margin-top: 1.1em; }
.gh-content h2 { font-family: var(--display); font-weight: 700; font-size: 1.35rem; line-height: 1.25; margin-top: 1.8em; }
.gh-content h3 { font-family: var(--display); font-weight: 700; font-size: 1.12rem; margin-top: 1.5em; }
.gh-content ol, .gh-content ul { padding-left: 1.3em; }
.gh-content li + li { margin-top: 0.4em; }
.gh-content blockquote { margin-inline: 0; padding: 14px 18px; background: var(--surface); border-radius: 14px; font-style: normal; }
.gh-content hr { border: 0; border-top: 1px solid var(--line); }
.gh-content table { width: 100%; border-collapse: collapse; font-size: 0.95rem; font-variant-numeric: tabular-nums; }
.gh-content th, .gh-content td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); }
.gh-content th { font-family: var(--mono); font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); }
.gh-content figure { margin-inline: 0; }
.gh-content pre { overflow-x: auto; }
.kg-width-wide { position: relative; width: min(1000px, 100vw - 36px); left: 50%; transform: translateX(-50%); }
.kg-width-full { position: relative; width: 100vw; left: 50%; transform: translateX(-50%); }
.kg-width-full img { width: 100%; }

/* building blocks the daily drafting script writes into each issue */
.tape { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.tape > div { border-radius: 12px; padding: 10px 12px; background: var(--down-soft); }
.tape > div.up { background: var(--up-soft); }
.tape small { display: block; font-family: var(--mono); font-size: 0.68rem; color: var(--muted); letter-spacing: 0.04em; }
.tape strong { font-family: var(--mono); color: var(--down); font-variant-numeric: tabular-nums; }
.tape > div.up strong { color: var(--up); }
.red-says { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 14px 16px; }
.levels { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.levels > div { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; }
.levels small { display: block; font-family: var(--mono); font-size: 0.68rem; color: var(--muted); }
.levels strong { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.grade-a { color: var(--up); } .grade-c { color: var(--gold); } .grade-d, .grade-f { color: var(--down); }

/* paywall */
.paywall { margin-top: 32px; display: grid; gap: 10px; justify-items: center; text-align: center; background: var(--surface); border: 1px dashed var(--line); border-radius: 18px; padding: 28px 22px; }
.paywall-bear { width: 72px; height: 72px; }
.paywall-title { font-family: var(--display); font-weight: 800; font-size: 1.25rem; margin: 0; text-wrap: balance; }
.paywall-text { color: var(--muted); margin: 0; max-width: 46ch; }

/* upgrade page */
.upgrade { max-width: 560px; padding-block: 48px 64px; display: grid; gap: 18px; }
.upgrade-bear { width: 110px; height: 110px; justify-self: center; }
.upgrade-title { font-family: var(--display); font-weight: 800; font-size: clamp(1.7rem, 4vw, 2.3rem); line-height: 1.1; text-align: center; margin: 0; text-wrap: balance; }
.checks { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.checks li { display: grid; grid-template-columns: 22px minmax(0, 1fr); gap: 8px; }
.checks li::before { content: "✓"; color: var(--up); font-weight: 700; }
.plans { display: grid; gap: 10px; }
.plan { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; padding: 16px 18px; border: 2px solid var(--line); border-radius: 14px; background: var(--surface); color: var(--ink); text-decoration: none; }
.plan:hover, .plan--featured { border-color: var(--down); }
.plan-name { font-family: var(--display); font-weight: 700; }
.plan-note { font-family: var(--body); font-weight: 400; color: var(--muted); font-size: 0.9rem; margin-left: 6px; }
.plan-price { font-family: var(--mono); font-weight: 600; font-variant-numeric: tabular-nums; }
.save { font-family: var(--mono); font-size: 0.66rem; color: var(--up); background: var(--up-soft); padding: 2px 6px; border-radius: 6px; margin-left: 6px; vertical-align: 2px; text-transform: uppercase; }
.upgrade-copy { margin-top: 0; }

/* error */
.error-page { padding-block: 64px; display: grid; gap: 12px; justify-items: center; text-align: center; }
.error-page .hero-bear { width: 140px; height: 140px; }

/* footer */
.site-footer { border-top: 1px solid var(--line); background: var(--surface); }
.site-footer-inner { padding-block: 28px; display: grid; gap: 10px; }
.site-footer ul { display: flex; gap: 14px; list-style: none; margin: 0; padding: 0; flex-wrap: wrap; font-family: var(--display); font-size: 0.9rem; }
.site-footer ul a { color: var(--ink); text-decoration: none; }
.site-footer .fine { max-width: 70ch; }

@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }
