/* ============================================================
   Fonts (self-hosted, latin subset)
   ============================================================ */

@font-face {
  font-family: 'DM Serif Display';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('/fonts/dm-serif-display-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA,
    U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193,
    U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url('/fonts/inter-latin-var.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA,
    U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193,
    U+2212, U+2215, U+FEFF, U+FFFD;
}

/* ============================================================
   Design tokens
   ============================================================ */

:root {
  /* Type */
  --font-display: 'DM Serif Display', Georgia, 'Times New Roman', serif;
  --font-ui: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Arial, sans-serif;

  /* Greens, deepest to lightest — Felt / Felt Raised converge to the same value on
     purpose (see CLAUDE.md); every gradient built from them renders flat automatically. */
  --bg: #081810;
  --bg-deep: #081810;
  --felt: #0e2419;
  --felt-raised: #0e2419;
  --felt-well: #081810;

  /* Mint — the one accent color. Bright/deep are lightness steps for hover/structural
     use, not a second hue. */
  --mint: #35d07a;
  --mint-bright: #56db92;
  --mint-deep: #279c5f;
  --mint-dim: rgba(53, 208, 122, 0.30);
  --mint-faint: rgba(53, 208, 122, 0.12);

  /* Bone */
  --bone: #edf2ee;
  --text: #dce6df;
  --text-muted: #9fb0a6;
  --text-dim: #77887e;

  /* Semantic — win reuses Mint directly (one accent color, not a second green) */
  --win: #35d07a;
  --lose: #ff8a80;

  /* Edges */
  --edge: rgba(255, 255, 255, 0.09);
  --rail: #1c4a30;
  --edge-mint: rgba(53, 208, 122, 0.30);

  /* Elevation */
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.30);
  --shadow-md: 0 4px 14px rgba(0, 0, 0, 0.35);
  --shadow-lg: 0 14px 38px rgba(0, 0, 0, 0.45);
  --inset-hi: inset 0 1px 0 rgba(255, 255, 255, 0.07);

  /* Radius */
  --r-sm: 6px;
  --r-md: 10px;
  --r-lg: 14px;
  --r-pill: 999px;

  /* Spacing */
  --s-1: 4px;
  --s-2: 8px;
  --s-3: 12px;
  --s-4: 16px;
  --s-5: 24px;
  --s-6: 32px;
  --s-7: 48px;

  /* Felt surface treatment */
  --felt-sheen:
    radial-gradient(ellipse 130% 80% at 50% -10%, rgba(255, 255, 255, 0.055), transparent 62%),
    radial-gradient(ellipse 110% 90% at 50% 115%, rgba(0, 0, 0, 0.34), transparent 68%);
  --noise: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* ============================================================
   Base
   ============================================================ */

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: var(--font-ui);
  font-size: 16px;
  line-height: 1.55;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Money and any figure that updates in place must not reflow as digits change */
.tabular, #bankroll, #net { font-variant-numeric: tabular-nums; }

a { color: var(--mint); }

h1, h2, h3 { font-family: var(--font-display); font-weight: 400; }
h1 { color: var(--mint); line-height: 1.12; }

:focus-visible {
  outline: 2px solid var(--mint-bright);
  outline-offset: 2px;
  border-radius: 3px;
}

/* ============================================================
   Nav
   ============================================================ */

.site-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--s-3) var(--s-5);
  background: linear-gradient(180deg, #0c1f14, var(--bg-deep));
  border-bottom: 1px solid var(--edge-mint);
  box-shadow: var(--shadow-sm);
  flex-wrap: wrap;
  gap: var(--s-3);
}

.site-nav .brand {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  color: var(--bone);
  text-decoration: none;
  white-space: nowrap;
}

.site-nav .brand svg { flex: 0 0 auto; }

.site-nav .brand span {
  font-family: var(--font-ui);
  font-size: 19px;
  font-weight: 800;
  letter-spacing: 0.02em;
}

.site-nav .brand:hover { color: var(--mint-bright); }

.nav-links {
  display: flex;
  gap: var(--s-5);
}

.nav-links a {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  letter-spacing: 0.02em;
  padding: 4px 0;
  border-bottom: 1px solid transparent;
  transition: color 0.15s ease, border-color 0.15s ease;
}

.nav-links a:hover { color: var(--bone); }
.nav-links a.active { color: var(--mint); border-bottom-color: var(--mint); }

/* ============================================================
   Layout
   ============================================================ */

main {
  max-width: 900px;
  margin: 0 auto;
  padding: var(--s-6) var(--s-5) var(--s-7);
}

.site-footer {
  display: flex;
  justify-content: space-between;
  gap: var(--s-3);
  flex-wrap: wrap;
  max-width: 900px;
  margin: 0 auto;
  padding: var(--s-5);
  font-size: 12.5px;
  color: var(--text-dim);
  border-top: 1px solid var(--edge);
}

.site-footer a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  color: var(--text-dim);
  text-decoration: none;
}
.site-footer a:hover { color: var(--mint); }

.footer-help { flex-basis: 100%; line-height: 1.6; }

/* ============================================================
   Hero
   ============================================================ */

.hero {
  text-align: center;
  padding: var(--s-7) 0 var(--s-5);
}

.hero h1 {
  font-size: clamp(2rem, 7vw, 3.25rem);
  letter-spacing: 0.015em;
  margin: 0 0 var(--s-4);
  color: var(--bone);
  text-shadow: 0 2px 18px rgba(0, 0, 0, 0.4);
}

.hero p {
  color: var(--text-muted);
  font-size: 16.5px;
  max-width: 34rem;
  margin: 0 auto var(--s-6);
  line-height: 1.65;
}

/* Hairline rule under the hero, fading out at both ends */
.hero::after {
  content: '';
  display: block;
  width: min(340px, 60%);
  height: 1px;
  margin: var(--s-6) auto 0;
  background: linear-gradient(90deg, transparent, var(--mint-dim), transparent);
}

/* ============================================================
   Buttons
   ============================================================ */

.btn-row {
  display: flex;
  gap: var(--s-3);
  justify-content: center;
  flex-wrap: wrap;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  background: var(--mint);
  color: #081810;
  text-decoration: none;
  font-weight: 600;
  font-size: 15px;
  letter-spacing: 0.02em;
  padding: var(--s-3) var(--s-6);
  border-radius: var(--r-sm);
  border: 1px solid var(--mint-deep);
  box-shadow: var(--shadow-md), inset 0 1px 0 rgba(255, 255, 255, 0.32);
  transition: transform 0.12s ease, box-shadow 0.15s ease, filter 0.15s ease;
}

.btn:hover { filter: brightness(1.07); box-shadow: var(--shadow-lg), inset 0 1px 0 rgba(255, 255, 255, 0.32); }
.btn:active { transform: translateY(1px); box-shadow: var(--shadow-sm); }

.btn.secondary {
  background: transparent;
  border: 1px solid var(--edge-mint);
  color: var(--mint);
  box-shadow: none;
}

.btn.secondary:hover {
  background: var(--mint-faint);
  border-color: var(--mint);
  filter: none;
  box-shadow: none;
}

/* ============================================================
   Cards
   ============================================================ */

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: var(--s-4);
  margin-top: var(--s-5);
}

.card {
  position: relative;
  background: linear-gradient(180deg, var(--felt-raised), var(--felt));
  border: 1px solid var(--rail);
  border-radius: var(--r-md);
  padding: var(--s-5);
  color: var(--text);
  display: block;
  box-shadow: var(--shadow-sm), var(--inset-hi);
  transition: transform 0.15s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}

.card:hover {
  transform: translateY(-2px);
  border-color: var(--edge-mint);
  box-shadow: var(--shadow-md), var(--inset-hi);
}

.card:has(a:focus-visible) {
  outline: 2px solid var(--mint-bright);
  outline-offset: 2px;
  border-radius: var(--r-md);
}

.card h3 {
  margin: 0 0 var(--s-2);
  font-size: 20px;
  letter-spacing: 0.01em;
}

/* The heading link is the only real anchor text; a stretched ::after keeps the
   whole card clickable without wrapping the description in the link too. */
.card h3 a {
  color: var(--mint);
  text-decoration: none;
}

.card h3 a::after {
  content: '';
  position: absolute;
  inset: 0;
}

.card p { margin: 0; font-size: 13.5px; color: var(--text-muted); line-height: 1.55; }

.card.disabled { opacity: 0.42; pointer-events: none; }

/* ============================================================
   Prose
   ============================================================ */

.post-date { color: var(--text-muted); font-size: 13px; margin-bottom: var(--s-5); }
.post-body { line-height: 1.75; font-size: 16px; color: var(--text); }
.post-body h2 { color: var(--mint); margin-top: var(--s-6); font-size: 25px; }
.post-body ul { padding-left: var(--s-5); }

.post-body code {
  background: var(--bg-deep);
  border: 1px solid var(--edge);
  padding: 2px 6px;
  border-radius: var(--r-sm);
  font-size: 0.9em;
}

.post-body table {
  width: 100%;
  border-collapse: collapse;
  margin: var(--s-5) 0;
  font-size: 14px;
  font-variant-numeric: tabular-nums;
}

.post-body th, .post-body td {
  text-align: left;
  padding: var(--s-2) var(--s-3);
  border-bottom: 1px solid var(--edge);
}

.post-body th {
  color: var(--mint);
  font-weight: 600;
  border-bottom: 1px solid var(--edge-mint);
}

/* Wide tables scroll inside themselves rather than pushing the page sideways */
@media (max-width: 640px) {
  .post-body table { display: block; overflow-x: auto; white-space: nowrap; }
}

.list-item {
  position: relative;
  display: block;
  padding: var(--s-4) 0;
  border-bottom: 1px solid var(--edge);
  color: var(--text);
  transition: border-color 0.15s ease;
}

.list-item:hover { border-bottom-color: var(--edge-mint); }
.list-item:has(a:focus-visible) { outline: 2px solid var(--mint-bright); outline-offset: 2px; }
.list-item h3 { margin: 0 0 var(--s-1); font-size: 19px; }
.list-item h3 a { color: var(--mint); text-decoration: none; }
.list-item h3 a::after { content: ''; position: absolute; inset: 0; }
.list-item p { margin: 0; font-size: 13.5px; color: var(--text-muted); }

/* ============================================================
   Responsive
   ============================================================ */

@media (max-width: 640px) {
  main { padding: var(--s-5) var(--s-4) var(--s-6); }

  .site-nav {
    padding: var(--s-3) var(--s-4);
    justify-content: center;
  }

  .nav-links { gap: var(--s-2); }

  /* Full-height tap targets on touch */
  .nav-links a {
    font-size: 13.5px;
    display: flex;
    align-items: center;
    min-height: 44px;
    padding: 0 var(--s-3);
  }

  .hero { padding: var(--s-5) 0 var(--s-4); }
  .hero p { font-size: 15.5px; }
  .hero::after { margin-top: var(--s-5); }

  .btn-row { flex-direction: column; align-items: stretch; }
  .btn { width: 100%; }

  .card-grid { grid-template-columns: 1fr; gap: var(--s-3); }
  .card { padding: var(--s-4); }

  .site-footer { flex-direction: column; align-items: center; text-align: center; }
}

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