/* ============================================================
   DAI — shared design tokens & base styles
   Data Assisted Intelligence

   Signature concept: the page reads like a structured research
   index/log — bracketed category tags, dotted leader lines to
   the year, a live status line computed from the actual entity
   count. Nothing here is decorative; every structural device
   maps to something true about the underlying data.
   ============================================================ */

   @import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@500;600;700&family=IBM+Plex+Sans:wght@400;500;600&family=IBM+Plex+Mono:wght@400;500;600&display=swap');

   * {
     margin: 0;
     padding: 0;
     box-sizing: border-box;
   }
   
   :root {
     --bg: #0a0a09;
     --bg-raised: #141412;
     --fg: #ececE7;
     --fg-muted: #8a8a83;
     --green: #3e9656;
     --green-bright: #5cc97a;
     --border: #232320;
     --red-muted: #b56a6a;
   
     --font-display: 'Space Grotesk', -apple-system, BlinkMacSystemFont, sans-serif;
     --font-body: 'IBM Plex Sans', -apple-system, BlinkMacSystemFont, sans-serif;
     --font-mono: 'IBM Plex Mono', 'JetBrains Mono', monospace;
   
     --radius: 3px;
     --max-width: 760px;
   }
   
   [data-theme="light"] {
     --bg: #f7f7f2;
     --bg-raised: #ffffff;
     --fg: #14140f;
     --fg-muted: #63635c;
     --green: #2f7a45;
     --green-bright: #1f5c33;
     --border: #dcdcd3;
     --red-muted: #9a4f4f;
   }
   
   html {
     font-size: 16px;
     -webkit-font-smoothing: antialiased;
   }
   
   body {
     background: var(--bg);
     color: var(--fg);
     font-family: var(--font-body);
     line-height: 1.65;
     transition: background 0.25s ease, color 0.25s ease;
   }
   
   a {
     color: inherit;
     text-decoration: none;
   }
   
   @media (prefers-reduced-motion: reduce) {
     * {
       animation-duration: 0.01ms !important;
       animation-iteration-count: 1 !important;
       transition-duration: 0.01ms !important;
       scroll-behavior: auto !important;
     }
   }
   
   :focus-visible {
     outline: 2px solid var(--green);
     outline-offset: 3px;
   }
   
   /* ---------- layout shell ---------- */
   
   .shell {
     max-width: var(--max-width);
     margin: 0 auto;
     padding: 0 1.25rem 5rem;
   }
   
   /* ---------- top index nav ---------- */
   
   .topnav {
     position: sticky;
     top: 0;
     z-index: 20;
     background: color-mix(in srgb, var(--bg) 92%, transparent);
     backdrop-filter: blur(8px);
     border-bottom: 1px solid var(--border);
   }
   
   .topnav-inner {
     max-width: var(--max-width);
     margin: 0 auto;
     padding: 0.85rem 1.25rem;
     display: flex;
     align-items: center;
     justify-content: space-between;
     gap: 1rem;
   }
   
   .topnav-mark {
     font-family: var(--font-display);
     font-weight: 700;
     font-size: 1.05rem;
     letter-spacing: -0.01em;
     white-space: nowrap;
   }
   
   .topnav-mark .dot {
     color: var(--green);
   }
   
   .topnav-links {
     display: flex;
     gap: 1.1rem;
     font-family: var(--font-mono);
     font-size: 0.72rem;
     letter-spacing: 0.04em;
     text-transform: uppercase;
     overflow-x: auto;
     scrollbar-width: none;
   }
   .topnav-links::-webkit-scrollbar { display: none; }
   
   .topnav-links a {
     color: var(--fg-muted);
     white-space: nowrap;
     padding-bottom: 0.15rem;
     border-bottom: 1px solid transparent;
     transition: color 0.15s, border-color 0.15s;
   }
   .topnav-links a:hover {
     color: var(--green);
     border-color: var(--green);
   }
   
   .theme-toggle {
     background: transparent;
     border: 1px solid var(--border);
     border-radius: 999px;
     width: 34px;
     height: 34px;
     display: flex;
     align-items: center;
     justify-content: center;
     cursor: pointer;
     color: var(--fg);
     flex-shrink: 0;
     transition: border-color 0.15s;
   }
   .theme-toggle:hover { border-color: var(--green); }
   .theme-toggle svg { width: 16px; height: 16px; fill: currentColor; }
   
   /* ---------- header / hero block ---------- */
   
   .hero {
     padding: 3.5rem 0 2.5rem;
     border-bottom: 1px solid var(--border);
     margin-bottom: 2.5rem;
   }
   
   .hero-mark {
     font-family: var(--font-display);
     font-weight: 700;
     font-size: 3.4rem;
     line-height: 1;
     letter-spacing: -0.02em;
     margin-bottom: 0.9rem;
   }
   .hero-mark .dot { color: var(--green); }
   
   .eyebrow {
     font-family: var(--font-mono);
     font-size: 0.82rem;
     color: var(--green);
     letter-spacing: 0.01em;
     margin-bottom: 1.75rem;
   }
   
   .hero p {
     font-size: 0.98rem;
     color: var(--fg-muted);
     max-width: 58ch;
     margin-bottom: 0.9rem;
   }
   
   .hero p strong {
     color: var(--fg);
     font-weight: 500;
   }
   
   .status-line {
     margin-top: 1.75rem;
     font-family: var(--font-mono);
     font-size: 0.78rem;
     color: var(--fg-muted);
     display: flex;
     flex-wrap: wrap;
     gap: 0.6rem 0;
   }
   
   .status-line .sep {
     margin: 0 0.6rem;
     color: var(--border);
   }
   
   .status-line strong {
     color: var(--fg);
     font-weight: 500;
   }
   
   .status-dot {
     display: inline-block;
     width: 6px;
     height: 6px;
     border-radius: 50%;
     background: var(--green);
     margin-right: 0.45rem;
   }
   @keyframes pulse-dot {
     0%, 100% { opacity: 1; }
     50% { opacity: 0.35; }
   }
   
   /* ---------- section structure ---------- */
   
   .section {
     margin-bottom: 3.25rem;
     scroll-margin-top: 4.5rem;
   }
   
   .section-label {
     font-family: var(--font-mono);
     font-size: 0.72rem;
     font-weight: 500;
     letter-spacing: 0.08em;
     text-transform: uppercase;
     color: var(--fg);
     display: flex;
     align-items: center;
     gap: 0.75rem;
     margin-bottom: 1.4rem;
   }
   
   .section-label::after {
     content: '';
     flex: 1;
     height: 1px;
     background: var(--border);
   }
   
   .section-note {
     font-family: var(--font-mono);
     font-size: 0.72rem;
     color: var(--fg-muted);
     margin: -0.8rem 0 1.4rem;
   }
   
   .era-label {
     font-family: var(--font-mono);
     font-size: 0.7rem;
     color: var(--fg-muted);
     text-transform: uppercase;
     letter-spacing: 0.06em;
     margin: 1.5rem 0 0.75rem;
     opacity: 0.75;
   }
   .era-label:first-child { margin-top: 0; }
   
   /* ---------- entry rows (the signature index/log element) ---------- */
   
   .entry {
     padding: 0.85rem 0;
     border-bottom: 1px dashed var(--border);
   }
   .entry:last-child { border-bottom: none; }
   
   .entry-line {
     display: flex;
     align-items: baseline;
     gap: 0.6rem;
     flex-wrap: wrap;
   }
   
   .entry-tag {
     font-family: var(--font-mono);
     font-size: 0.68rem;
     color: var(--green);
     white-space: nowrap;
     flex-shrink: 0;
   }
   
   .entry-title {
     font-family: var(--font-display);
     font-weight: 600;
     font-size: 1.02rem;
     color: var(--fg);
     display: inline-flex;
     align-items: center;
     gap: 0.3rem;
   }
   
   a.entry-title:hover { color: var(--green); }
   
   .entry-title .arrow {
     font-size: 0.8rem;
     transition: transform 0.15s;
   }
   a.entry-title:hover .arrow { transform: translate(2px, -2px); }
   
   .entry-leader {
     flex: 1;
     min-width: 1.5rem;
     border-bottom: 1px dotted var(--border);
     height: 0;
     align-self: center;
     margin-bottom: 0.3em;
   }
   
   .entry-year {
     font-family: var(--font-mono);
     font-size: 0.76rem;
     color: var(--fg-muted);
     white-space: nowrap;
     flex-shrink: 0;
   }
   
   .entry-desc {
     font-size: 0.88rem;
     color: var(--fg-muted);
     margin-top: 0.3rem;
     line-height: 1.55;
     max-width: 62ch;
   }
   
   .entry-meta {
     font-family: var(--font-mono);
     font-size: 0.68rem;
     color: var(--fg-muted);
     opacity: 0.7;
     margin-top: 0.3rem;
   }
   
   .badge {
     font-family: var(--font-mono);
     font-size: 0.6rem;
     font-weight: 500;
     text-transform: uppercase;
     letter-spacing: 0.04em;
     padding: 0.1rem 0.5rem;
     border-radius: 999px;
     border: 1px solid var(--border);
     color: var(--fg-muted);
     white-space: nowrap;
   }
   .badge.free { border-color: var(--green); color: var(--green); }
   .badge.paid { border-color: var(--red-muted); color: var(--red-muted); }
   .badge.soon { border-color: var(--fg-muted); color: var(--fg-muted); }
   .badge.live { border-color: var(--green); color: var(--green); }
   
   /* ---------- research panel (visually distinct — not DAI-branded work) ---------- */
   
   .research-panel {
     background: var(--bg-raised);
     border: 1px solid var(--border);
     border-radius: var(--radius);
     padding: 1.25rem 1.4rem;
   }
   .research-panel .entry { border-bottom: 1px dashed var(--border); }
   .research-panel .entry:last-child { border-bottom: none; }
   
   /* ---------- book cards ---------- */
   
   .book-card {
     background: var(--bg-raised);
     border: 1px solid var(--border);
     border-radius: var(--radius);
     padding: 1.4rem 1.5rem;
     margin-bottom: 1rem;
     transition: border-color 0.15s;
   }
   .book-card:hover { border-color: var(--green); }
   
   .book-card-top {
     display: flex;
     justify-content: space-between;
     align-items: flex-start;
     gap: 1rem;
     margin-bottom: 0.5rem;
   }
   
   .book-card-title {
     font-family: var(--font-display);
     font-weight: 600;
     font-size: 1.1rem;
   }
   
   .book-card p {
     font-size: 0.88rem;
     color: var(--fg-muted);
     margin-bottom: 0.9rem;
   }
   
   .book-card-link {
     font-family: var(--font-mono);
     font-size: 0.75rem;
     color: var(--green);
     display: inline-flex;
     align-items: center;
     gap: 0.3rem;
   }
   .book-card-link:hover { color: var(--green-bright); }
   
   /* ---------- footer ---------- */
   
   .footer {
     margin-top: 3rem;
     padding-top: 1.5rem;
     border-top: 1px solid var(--border);
     font-family: var(--font-mono);
     font-size: 0.75rem;
     color: var(--fg-muted);
     display: flex;
     flex-wrap: wrap;
     justify-content: space-between;
     gap: 0.75rem;
   }
   .footer a { color: var(--fg-muted); transition: color 0.15s; }
   .footer a:hover { color: var(--green); }
   
   /* ---------- book detail page ---------- */
   
   .book-header {
     padding: 3rem 0 2rem;
     border-bottom: 1px solid var(--border);
     margin-bottom: 2.5rem;
   }
   
   .back-link {
     font-family: var(--font-mono);
     font-size: 0.75rem;
     color: var(--fg-muted);
     display: inline-flex;
     align-items: center;
     gap: 0.4rem;
     margin-bottom: 2rem;
     transition: color 0.15s;
   }
   .back-link:hover { color: var(--green); }
   
   .book-title {
     font-family: var(--font-display);
     font-weight: 700;
     font-size: 2.1rem;
     line-height: 1.15;
     letter-spacing: -0.01em;
     margin-bottom: 0.6rem;
   }
   
   .book-subtitle {
     font-family: var(--font-mono);
     font-size: 0.85rem;
     color: var(--green);
     margin-bottom: 1.25rem;
   }
   
   .pill-row {
     display: flex;
     flex-wrap: wrap;
     gap: 0.5rem;
     margin-bottom: 1.5rem;
   }
   
   .pill {
     font-family: var(--font-mono);
     font-size: 0.68rem;
     padding: 0.25rem 0.65rem;
     border: 1px solid var(--border);
     border-radius: 999px;
     color: var(--fg-muted);
   }
   
   .status-block {
     display: inline-flex;
     align-items: center;
     gap: 0.5rem;
     font-family: var(--font-mono);
     font-size: 0.75rem;
     color: var(--fg-muted);
     border: 1px solid var(--border);
     border-radius: var(--radius);
     padding: 0.6rem 0.9rem;
     margin-top: 0.5rem;
   }
   
   .fit-grid {
     display: grid;
     grid-template-columns: 1fr 1fr;
     gap: 2rem;
     margin-bottom: 2.5rem;
   }
   
   @media (max-width: 620px) {
     .fit-grid { grid-template-columns: 1fr; gap: 1.75rem; }
   }
   
   .fit-col h3 {
     font-family: var(--font-mono);
     font-size: 0.72rem;
     text-transform: uppercase;
     letter-spacing: 0.06em;
     margin-bottom: 0.9rem;
   }
   
   .fit-col.yes h3 { color: var(--green); }
   .fit-col.no h3 { color: var(--fg-muted); }
   
   .fit-col ul {
     list-style: none;
   }
   
   .fit-col li {
     font-size: 0.88rem;
     color: var(--fg-muted);
     line-height: 1.6;
     margin-bottom: 0.9rem;
     padding-left: 1.3rem;
     position: relative;
   }
   
   .fit-col.yes li::before {
     content: '✓';
     position: absolute;
     left: 0;
     color: var(--green);
   }
   .fit-col.no li::before {
     content: '×';
     position: absolute;
     left: 0;
     color: var(--fg-muted);
   }
   
   .cta-block {
     border: 1px solid var(--border);
     border-radius: var(--radius);
     padding: 1.5rem;
     text-align: center;
     background: var(--bg-raised);
   }
   
   .cta-block p {
     font-size: 0.85rem;
     color: var(--fg-muted);
     margin-bottom: 0.9rem;
   }
   
   .cta-notify {
     font-family: var(--font-mono);
     font-size: 0.8rem;
     color: var(--green);
     border: 1px solid var(--green);
     border-radius: 999px;
     padding: 0.6rem 1.4rem;
     display: inline-block;
     transition: background 0.15s, color 0.15s;
   }
   .cta-notify:hover {
     background: var(--green);
     color: var(--bg);
   }
   
   /* ---------- buy buttons (Gumroad badge + Selar logo, normalized to one height) ---------- */
   
   .buy-block {
     border: 1px solid var(--border);
     border-radius: var(--radius);
     padding: 1.5rem;
     text-align: center;
     background: var(--bg-raised);
   }
   
   .buy-block p {
     font-size: 0.85rem;
     color: var(--fg-muted);
     margin-bottom: 1.1rem;
   }
   
   .buy-row {
     display: flex;
     align-items: center;
     justify-content: center;
     flex-wrap: wrap;
     gap: 0.9rem;
   }
   
   /* Both buttons share one pill height/shape so the very different
      source-asset shapes (Gumroad 157x22 wide badge vs. Selar 400x400
      square logo) still read as a matched pair of buttons. */
   .buy-btn {
     display: inline-flex;
     align-items: center;
     justify-content: center;
     height: 48px;
     padding: 0 1.2rem;
     border: 1px solid var(--border);
     border-radius: 999px;
     background: var(--bg);
     transition: border-color 0.15s, transform 0.15s;
   }
   .buy-btn:hover {
     border-color: var(--green);
     transform: translateY(-1px);
   }
   
   /* Gumroad ships as a pre-shaped wide badge (157x22) — render near
      native height so it stays crisp, the pill just gives it equal
      click-target padding to match the Selar button. */
   .buy-btn.buy-gumroad img {
     height: 22px;
     width: auto;
     display: block;
   }
   
   /* Selar ships as a square logo (400x400) with no text baked in —
      shrink it to an icon and pair it with a label so the button
      carries the same visual weight as the Gumroad badge. */
   .buy-btn.buy-selar img {
     height: 26px;
     width: 26px;
     object-fit: contain;
     border-radius: 6px;
     display: block;
   }
   .buy-btn.buy-selar span {
     font-family: var(--font-mono);
     font-size: 0.8rem;
     color: var(--fg);
     margin-left: 0.6rem;
     white-space: nowrap;
   }
   
   /* ---------- responsive ---------- */
   
   @media (max-width: 480px) {
     .hero { padding: 2.5rem 0 2rem; }
     .hero-mark { font-size: 2.5rem; }
     .book-title { font-size: 1.6rem; }
     .entry-title { font-size: 0.95rem; }
     .topnav-links { gap: 0.85rem; }
   }
   
   .show-more-btn {
     font-family: var(--font-mono);
     font-size: 0.72rem;
     color: var(--green);
     background: transparent;
     border: 1px solid var(--border);
     border-radius: 999px;
     padding: 0.4rem 1.2rem;
     cursor: pointer;
     transition: border-color 0.15s, color 0.15s;
   }
   .show-more-btn:hover {
     border-color: var(--green);
     color: var(--green-bright);
   }