@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url('/assets/fonts/inter-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+2074, 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: 100 900;
  font-display: swap;
  src: url('/assets/fonts/inter-latin-ext.woff2') format('woff2');
  unicode-range: U+0100-02AF, U+0304, U+0308, U+0329, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20CF, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: 'JetBrains Mono';
  font-style: normal;
  font-weight: 100 800;
  font-display: swap;
  src: url('/assets/fonts/jetbrains-mono-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+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'JetBrains Mono';
  font-style: normal;
  font-weight: 100 800;
  font-display: swap;
  src: url('/assets/fonts/jetbrains-mono-latin-ext.woff2') format('woff2');
  unicode-range: U+0100-02AF, U+0304, U+0308, U+0329, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20CF, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

    :root {
      --bg:           #09090b;   /* zinc-950 */
      --bg-card:      #18181b;   /* zinc-900 */
      --bg-input:     #09090b;   /* zinc-950 */
      --border:       rgba(255,255,255,0.10);  /* white/10 */
      --border-faint: rgba(255,255,255,0.06);
      --text:         #fafafa;   /* neutral-50 */
      --text-muted:   #9f9fa9;
      --text-dark:    #0d542b;   /* green label text */
      --accent:       #00bc7d;
      --accent-dim:   rgba(0,188,125,0.15);
      --accent-hover: rgba(0,188,125,0.90);
      --green-bar:    #00bc7d;
      --font-body:    'Inter', system-ui, sans-serif;
      --font-mono:    'JetBrains Mono', 'Courier New', monospace;
      --radius:       0.75rem;   /* rounded-xl */
      --radius-sm:    0.375rem;  /* rounded-md */
      --radius-full:  9999px;
    }


    html { font-size: 16px; scroll-behavior: smooth; }

    body {
      background-color: var(--bg);
      color: var(--text);
      font-family: var(--font-body);
      line-height: 1.6;
      min-height: 100vh;
    }


    /* ── Main Layout ──────────────────────────────────────── */
    main {
      max-width: 1140px;
      margin: 0 auto;
      padding: 3rem 2rem 6rem;
      display: grid;
      grid-template-columns: 1fr 300px;
      grid-template-rows: auto auto 1fr;
      gap: 0 2rem;
    }

    /* ── Post Header (spans full width conceptually via article) */
    .post-header {
      grid-column: 1 / 2;
      margin-bottom: 2rem;
    }

    .post-category {
      display: inline-flex;
      align-items: center;
      font-size: 0.75rem;
      font-weight: 500;
      line-height: 1rem;
      padding: 0.25rem 0.75rem;
      border-radius: var(--radius-full);
      background: var(--accent-dim);
      color: var(--accent);
      margin-bottom: 1rem;
      text-decoration: none;
    }

    .post-header h1 {
      font-size: clamp(1.6rem, 4vw, 2.25rem);
      font-weight: 700;
      line-height: 1.2;
      letter-spacing: -0.025em;
      color: var(--text);
      margin-bottom: 0.75rem;
    }

    /* the green underline bar from BlogView */
    .post-header h1 + .title-bar {
      display: block;
      width: 5rem;
      height: 4px;
      border-radius: var(--radius-full);
      background: var(--green-bar);
      margin-bottom: 1.25rem;
    }

    .post-meta {
      display: flex;
      flex-wrap: wrap;
      align-items: center;
      gap: 0.5rem 1.25rem;
      font-size: 0.78rem;
      color: var(--text-muted);
      line-height: 1rem;
    }
    .post-meta .dot { color: var(--border); }
    .post-meta .pnl {
      font-family: var(--font-mono);
      font-size: 0.72rem;
      font-weight: 500;
      padding: 0.2rem 0.6rem;
      border-radius: var(--radius-full);
    }
    .post-meta .pnl.pos { background: var(--accent-dim); color: var(--accent); }
    .post-meta .pnl.neg { background: rgba(224,92,92,0.12); color: #e05c5c; }

    /* ── Article Body ─────────────────────────────────────── */
    .post-body {
      grid-column: 1 / 2;
      min-width: 0;
    }

    .post-body p {
      font-size: 0.9375rem;
      line-height: 1.8;
      color: var(--text-muted);
      margin-bottom: 1.4rem;
    }
    .post-body p:first-child { color: var(--text); } /* lead paragraph */

    .post-body h2 {
      font-size: 1.1rem;
      font-weight: 700;
      color: var(--text);
      margin: 2.5rem 0 0.75rem;
      padding-top: 2rem;
      border-top: 1px solid var(--border);
      letter-spacing: -0.01em;
    }
    .post-body h2::before {
      content: '';
      display: inline-block;
      width: 8px;
      height: 8px;
      border-radius: 50%;
      background: var(--accent);
      margin-right: 0.6rem;
      vertical-align: middle;
      position: relative;
      top: -1px;
    }

    .post-body h3 {
      font-size: 0.95rem;
      font-weight: 600;
      color: var(--text);
      margin: 1.75rem 0 0.5rem;
    }

    .post-body strong { color: var(--text); font-weight: 600; }
    .post-body em     { color: #c8c8d0; }

    .post-body a {
      color: var(--accent);
      text-decoration: none;
      border-bottom: 1px solid rgba(0,188,125,0.3);
      transition: border-color 0.15s, color 0.15s;
    }
    .post-body a:hover {
      color: #33d49a;
      border-bottom-color: #33d49a;
    }

    .post-body hr {
      border: none;
      border-top: 1px solid var(--border);
      margin: 2rem 0;
    }

    /* ── Blockquote ───────────────────────────────────────── */
    .post-body blockquote {
      margin: 1.75rem 0;
      padding: 1rem 1.25rem;
      background: var(--bg-card);
      border: 1px solid var(--border);
      border-left: 3px solid var(--accent);
      border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
      font-size: 0.9rem;
      color: var(--text-muted);
    }
    .post-body blockquote p { margin: 0; color: inherit; font-size: inherit; }
    .post-body blockquote strong { color: var(--accent); }

    /* ── Lists ────────────────────────────────────────────── */
    .post-body ul,
    .post-body ol {
      margin: 0 0 1.4rem 1.1rem;
      font-size: 0.9375rem;
      color: var(--text-muted);
    }
    .post-body li { margin-bottom: 0.4rem; line-height: 1.7; }
    .post-body ul li::marker { color: var(--accent); }
    .post-body ol li::marker {
      color: var(--text-muted);
      font-family: var(--font-mono);
      font-size: 0.8em;
    }

    /* ── Code ─────────────────────────────────────────────── */
    .post-body code {
      font-family: var(--font-mono);
      font-size: 0.78em;
      background: var(--bg-card);
      color: var(--accent);
      padding: 0.15em 0.45em;
      border-radius: 4px;
      border: 1px solid var(--border);
    }
    .post-body pre {
      background: var(--bg-card);
      border: 1px solid var(--border);
      border-radius: var(--radius-sm);
      padding: 1.1rem 1.25rem;
      overflow-x: auto;
      margin: 1.5rem 0;
    }
    .post-body pre code {
      background: none;
      border: none;
      padding: 0;
      font-size: 0.82rem;
      color: var(--text);
    }

    /* ── Images & Figures ─────────────────────────────────── */
    .post-body figure {
      margin: 2rem 0;
      background: var(--bg-card);
      border: 1px solid var(--border);
      border-radius: var(--radius);
      overflow: hidden;
    }
    .post-body figure img {
      width: 100%;
      display: block;
      max-height: 440px;
      object-fit: cover;
    }
    .post-body figcaption {
      font-size: 0.72rem;
      color: var(--text-muted);
      padding: 0.55rem 1rem;
      border-top: 1px solid var(--border);
      font-family: var(--font-mono);
      letter-spacing: 0.04em;
    }
    .post-body img:not(figure img) {
      max-width: 100%;
      border-radius: var(--radius-sm);
      border: 1px solid var(--border);
      display: block;
      margin: 1rem 0;
    }

    /* ── Trade Stats Card ─────────────────────────────────── */
    .trade-card {
      background: var(--bg-card);
      border: 1px solid var(--border);
      border-radius: var(--radius);
      padding: 1.25rem 1.5rem;
      margin: 2rem 0;
      display: grid;
      grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
      gap: 1rem 1.5rem;
    }
    .trade-card .stat-label {
      font-size: 0.65rem;
      font-weight: 500;
      letter-spacing: 0.1em;
      text-transform: uppercase;
      color: var(--text-muted);
      margin-bottom: 0.25rem;
      font-family: var(--font-mono);
    }
    .trade-card .stat-value {
      font-size: 1rem;
      font-weight: 700;
      color: var(--text);
      font-family: var(--font-mono);
    }
    .trade-card .stat-value.pos { color: var(--accent); }
    .trade-card .stat-value.neg { color: #e05c5c; }

    /* ── Tags ─────────────────────────────────────────────── */
    .post-tags {
      margin-top: 2.5rem;
      padding-top: 1.5rem;
      border-top: 1px solid var(--border);
      display: flex;
      flex-wrap: wrap;
      gap: 0.5rem;
    }
    .post-tags code {
      font-size: 0.72rem;
      color: var(--text-muted);
      background: var(--bg-card);
      border: 1px solid var(--border);
      border-radius: var(--radius-full);
      padding: 0.2em 0.7em;
    }

    /* ── Post Footer ──────────────────────────────────────── */
    .post-footer {
      margin-top: 2rem;
      padding-top: 1.25rem;
      border-top: 1px solid var(--border);
      display: flex;
      justify-content: space-between;
      align-items: center;
      flex-wrap: wrap;
      gap: 0.75rem;
      font-size: 0.78rem;
      color: var(--text-muted);
    }
    .post-footer a {
      color: var(--accent);
      text-decoration: none;
      font-weight: 500;
      display: inline-flex;
      align-items: center;
      gap: 0.25rem;
      transition: opacity 0.15s;
    }
    .post-footer a:hover { opacity: 0.8; }
    .post-footer a::after { content: ' →'; }

    /* ── Sidebar ──────────────────────────────────────────── */
    .sidebar {
      grid-column: 2 / 3;
      grid-row: 1 / 4;
      display: flex;
      flex-column: column;
      flex-direction: column;
      gap: 1.5rem;
      align-self: start;
      position: sticky;
      top: 72px;
    }

    .sidebar-card {
      background: var(--bg-card);
      border: 1px solid var(--border);
      border-radius: var(--radius);
      padding: 1.25rem;
      display: flex;
      flex-direction: column;
      gap: 1rem;
    }

    .sidebar-card-title {
      font-size: 0.875rem;
      font-weight: 700;
      color: var(--text);
      display: flex;
      align-items: center;
      gap: 0.5rem;
    }
    .sidebar-card-title .icon {
      width: 16px;
      height: 16px;
      color: var(--accent);
      flex-shrink: 0;
    }
    .sidebar-card p {
      font-size: 0.8rem;
      color: var(--text-muted);
      line-height: 1.5;
    }

    /* related posts */
    .related-post {
      display: flex;
      flex-direction: column;
      gap: 0.25rem;
      padding-bottom: 0.85rem;
      border-bottom: 1px solid var(--border-faint);
      text-decoration: none;
    }
    .related-post:last-child { border-bottom: none; padding-bottom: 0; }
    .related-post .rp-cat {
      font-size: 0.65rem;
      font-weight: 500;
      color: var(--accent);
      text-transform: uppercase;
      letter-spacing: 0.08em;
    }
    .related-post .rp-title {
      font-size: 0.8rem;
      font-weight: 600;
      color: var(--text);
      line-height: 1.4;
      transition: color 0.15s;
    }
    .related-post:hover .rp-title { color: var(--accent); }
    .related-post .rp-date {
      font-size: 0.68rem;
      color: var(--text-muted);
    }

    /* toc */
    .toc-list {
      list-style: none;
      margin: 0;
      padding: 0;
      display: flex;
      flex-direction: column;
      gap: 0.4rem;
    }
    .toc-list a {
      font-size: 0.78rem;
      color: var(--text-muted);
      text-decoration: none;
      display: flex;
      align-items: center;
      gap: 0.5rem;
      transition: color 0.15s;
    }
    .toc-list a::before {
      content: '';
      display: inline-block;
      width: 6px;
      height: 6px;
      border-radius: 50%;
      background: var(--accent-dim);
      flex-shrink: 0;
      border: 1px solid var(--accent);
    }
    .toc-list a:hover { color: var(--accent); }

    /* back to blog */
    .back-link {
      display: inline-flex;
      align-items: center;
      gap: 0.4rem;
      font-size: 0.8rem;
      font-weight: 500;
      color: var(--accent);
      text-decoration: none;
      padding: 0.5rem 1rem;
      border: 1px solid rgba(0,188,125,0.35);
      border-radius: var(--radius-full);
      transition: background 0.15s, border-color 0.15s;
      width: 100%;
      justify-content: center;
    }
    .back-link:hover {
      background: var(--accent-dim);
      border-color: var(--accent);
    }
    .back-link::before { content: '←'; }

    /* ── Responsive ───────────────────────────────────────── */
    @media (max-width: 860px) {
      main {
        grid-template-columns: 1fr;
        padding: 2rem 1.25rem 4rem;
      }
      .post-header, .post-body { grid-column: 1 / 2; }
      .sidebar {
        grid-column: 1 / 2;
        grid-row: auto;
        position: static;
      }
    }

    /* ── Featured Image (added for the featured_images slot) ─ */
    .post-featured {
      grid-column: 1 / 2;
      margin: 0 0 2.5rem;
      border: 1px solid var(--border);
      border-radius: var(--radius);
      overflow: hidden;
    }
    .post-featured img {
      display: block;
      width: 100%;
      height: auto;
      object-fit: cover;
    }
    .post-featured figcaption {
      font-size: 0.72rem;
      color: var(--text-muted);
      padding: 0.6rem 0.9rem;
      background: var(--bg-card);
      border-top: 1px solid var(--border);
    }
    @media (max-width: 860px) {
      .post-featured { grid-column: 1 / 2; }
    }
