/* ═══════════════════════════════════════════════════════════════════════
   Bibliofile site stylesheet.
   Part 1 is copied verbatim from ../Folio/folio-docs.html, so the two sites
   share one visual language. Bibliofile-only additions follow in Part 2.
   ═══════════════════════════════════════════════════════════════════════ */

/* ─── Part 1: Folio ─── */

  :root {
    --bg: #faf8f5;
    --bg-card: #ffffff;
    --bg-code: #f3f0eb;
    --bg-nav: #f3f0eb;
    --bg-nav-active: #e8e4dd;
    --text: #2c2418;
    --text-secondary: #6b5d4d;
    --text-tertiary: #9a8c7c;
    --accent: #b8570c;
    --accent-light: #f0dcc8;
    --accent-glow: rgba(184, 87, 12, 0.08);
    --border: #e0dbd4;
    --border-light: #ece8e2;
    --shadow-sm: 0 1px 3px rgba(44,36,24,0.04);
    --shadow-md: 0 4px 16px rgba(44,36,24,0.06);
    --shadow-lg: 0 8px 32px rgba(44,36,24,0.08);
    --radius: 10px;
    --radius-sm: 6px;
    --priority-high: #c9403a;
    --priority-medium: #d48a1a;
    --priority-low: #3a7cc9;
    --font-serif: 'Instrument Serif', Georgia, serif;
    --font-sans: 'DM Sans', -apple-system, sans-serif;
    --font-mono: 'JetBrains Mono', Menlo, monospace;
  }

  * { margin: 0; padding: 0; box-sizing: border-box; }

  /* ─── Detail Level Toggle ─── */
  .detail-toggle {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 20px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    margin-bottom: 32px;
    width: fit-content;
  }

  .detail-toggle .toggle-label {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    transition: color 0.2s ease;
    user-select: none;
  }

  .detail-toggle .toggle-label.active {
    color: var(--accent);
    font-weight: 600;
  }

  .detail-toggle .toggle-track {
    position: relative;
    width: 44px;
    height: 24px;
    background: var(--border);
    border-radius: 12px;
    cursor: pointer;
    transition: background 0.25s ease;
    flex-shrink: 0;
  }

  .detail-toggle .toggle-track.nerd {
    background: var(--accent);
  }

  .detail-toggle .toggle-thumb {
    position: absolute;
    top: 3px;
    left: 3px;
    width: 18px;
    height: 18px;
    background: white;
    border-radius: 50%;
    box-shadow: 0 1px 3px rgba(0,0,0,0.15);
    transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  }

  .detail-toggle .toggle-track.nerd .toggle-thumb {
    transform: translateX(20px);
  }

  /* Nerd content: hidden by default, shown when body has .show-nerd */
  .nerd {
    display: none;
  }

  body.show-nerd .nerd {
    display: revert;
  }

  /* Sidebar nerd indicator */
  .nav-link .nerd-dot {
    width: 6px;
    height: 6px;
    background: var(--accent);
    border-radius: 50%;
    margin-left: auto;
    opacity: 0;
    transition: opacity 0.2s ease;
  }

  body.show-nerd .nav-link .nerd-dot {
    opacity: 1;
  }

  html {
    scroll-behavior: smooth;
    scroll-padding-top: 24px;
  }

  body {
    font-family: var(--font-sans);
    background: var(--bg);
    color: var(--text);
    font-size: 15px;
    line-height: 1.7;
    -webkit-font-smoothing: antialiased;
  }

  /* ─── Layout ─── */
  .page-wrapper {
    display: flex;
    min-height: 100vh;
  }

  /* ─── Sidebar Navigation ─── */
  .sidebar {
    width: 260px;
    flex-shrink: 0;
    background: var(--bg-nav);
    border-right: 1px solid var(--border);
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
    padding: 32px 0 48px;
    scrollbar-width: thin;
    scrollbar-color: var(--border) transparent;
  }

  .sidebar-logo {
    padding: 0 24px 28px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 20px;
  }

  .sidebar-logo h1 {
    font-family: var(--font-serif);
    font-size: 28px;
    font-weight: 400;
    letter-spacing: -0.02em;
    color: var(--text);
  }

  .sidebar-logo h1 i {
    color: var(--accent);
    font-size: 20px;
    margin-right: 8px;
    vertical-align: 1px;
  }

  .sidebar-logo .subtitle {
    font-size: 12px;
    color: var(--text-tertiary);
    margin-top: 2px;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    font-weight: 500;
  }

  .nav-section {
    padding: 0 16px;
    margin-bottom: 8px;
  }

  .nav-section-title {
    font-size: 10.5px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-tertiary);
    padding: 16px 8px 6px;
  }

  .nav-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 7px 10px;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 13.5px;
    font-weight: 450;
    transition: all 0.15s ease;
    cursor: pointer;
  }

  .nav-link:hover {
    background: var(--bg-nav-active);
    color: var(--text);
  }

  .nav-link.active {
    background: var(--accent-glow);
    color: var(--accent);
    font-weight: 550;
  }

  .nav-link i {
    width: 18px;
    text-align: center;
    font-size: 13px;
    opacity: 0.7;
  }

  .nav-link.active i {
    opacity: 1;
  }

  /* ─── Main Content ─── */
  .main-content {
    flex: 1;
    min-width: 0;
    padding: 48px 64px 120px;
    max-width: 840px;
  }

  /* ─── Hero ─── */
  .hero {
    margin-bottom: 56px;
    padding-bottom: 48px;
    border-bottom: 1px solid var(--border);
  }

  .hero-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 12px;
    background: var(--accent-light);
    color: var(--accent);
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.02em;
    margin-bottom: 20px;
  }

  .hero h1 {
    font-family: var(--font-serif);
    font-size: 48px;
    font-weight: 400;
    line-height: 1.15;
    letter-spacing: -0.025em;
    color: var(--text);
    margin-bottom: 16px;
  }

  .hero h1 em {
    font-style: italic;
    color: var(--accent);
  }

  .hero p {
    font-size: 17px;
    line-height: 1.7;
    color: var(--text-secondary);
    max-width: 580px;
  }

  /* ─── Sections ─── */
  .doc-section {
    margin-bottom: 56px;
  }

  .doc-section h2 {
    font-family: var(--font-serif);
    font-size: 30px;
    font-weight: 400;
    letter-spacing: -0.015em;
    margin-bottom: 20px;
    color: var(--text);
    scroll-margin-top: 24px;
  }

  .doc-section h3 {
    font-size: 16px;
    font-weight: 600;
    color: var(--text);
    margin-top: 32px;
    margin-bottom: 12px;
    letter-spacing: -0.01em;
  }

  .doc-section p {
    margin-bottom: 14px;
    color: var(--text-secondary);
    line-height: 1.75;
  }

  .doc-section ul {
    margin: 0 0 14px 1.5em;
    color: var(--text-secondary);
    line-height: 1.75;
  }

  .doc-section ul li {
    margin-bottom: 10px;
  }

  .doc-section p strong {
    color: var(--text);
    font-weight: 600;
  }

  /* ─── Feature Cards ─── */
  .feature-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin: 24px 0;
  }

  .feature-card {
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: var(--radius);
    padding: 22px 24px;
    box-shadow: var(--shadow-sm);
    transition: all 0.2s ease;
  }

  .feature-card:hover {
    box-shadow: var(--shadow-md);
    border-color: var(--border);
    transform: translateY(-1px);
  }

  .feature-card .card-icon {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 15px;
    margin-bottom: 14px;
  }

  .feature-card .card-icon.orange { background: #fef0e0; color: #c6700a; }
  .feature-card .card-icon.blue { background: #e4eef9; color: #3a6fb8; }
  .feature-card .card-icon.green { background: #e2f3e4; color: #3a8c42; }
  .feature-card .card-icon.purple { background: #eee4f6; color: #7c3ab8; }
  .feature-card .card-icon.rose { background: #fce4e8; color: #b83a5c; }
  .feature-card .card-icon.teal { background: #dff0ef; color: #2a8a84; }

  .feature-card h4 {
    font-size: 14.5px;
    font-weight: 600;
    margin-bottom: 6px;
    color: var(--text);
  }

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

  /* ─── Keyboard Shortcuts Table ─── */
  .shortcut-table {
    width: 100%;
    border-collapse: collapse;
    margin: 20px 0;
    font-size: 13.5px;
  }

  .shortcut-table th {
    text-align: left;
    font-weight: 600;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-tertiary);
    padding: 10px 16px;
    border-bottom: 2px solid var(--border);
  }

  .shortcut-table td {
    padding: 10px 16px;
    border-bottom: 1px solid var(--border-light);
    color: var(--text-secondary);
  }

  .shortcut-table tr:last-child td {
    border-bottom: none;
  }

  .shortcut-table tbody tr:hover {
    background: var(--accent-glow);
  }

  kbd {
    display: inline-block;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 5px;
    padding: 2px 7px;
    font-family: var(--font-sans);
    font-size: 12px;
    font-weight: 600;
    color: var(--text);
    box-shadow: 0 1px 1px rgba(44,36,24,0.06);
    line-height: 1.5;
    white-space: nowrap;
  }

  /* ─── Code Blocks ─── */
  code {
    font-family: var(--font-mono);
    font-size: 13px;
    background: var(--bg-code);
    padding: 2px 6px;
    border-radius: 4px;
    color: var(--accent);
  }

  pre {
    background: var(--bg-code);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-sm);
    padding: 18px 20px;
    overflow-x: auto;
    margin: 16px 0;
    line-height: 1.6;
  }

  pre code {
    background: none;
    padding: 0;
    color: var(--text);
  }

  /* ─── Callout Boxes ─── */
  .callout {
    display: flex;
    gap: 14px;
    padding: 18px 20px;
    border-radius: var(--radius);
    margin: 20px 0;
    font-size: 14px;
    line-height: 1.65;
  }

  .callout-icon {
    flex-shrink: 0;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    margin-top: 1px;
  }

  .callout.tip {
    background: #e8f4e9;
    border: 1px solid #c5e1c8;
    color: #2d5a30;
  }
  .callout.tip .callout-icon { background: #3a8c42; color: #fff; }

  .callout.info {
    background: #e4eef9;
    border: 1px solid #c0d5ee;
    color: #2a4a6e;
  }
  .callout.info .callout-icon { background: #3a6fb8; color: #fff; }

  .callout.warn {
    background: #fef5e0;
    border: 1px solid #f0ddb0;
    color: #6b4f14;
  }
  .callout.warn .callout-icon { background: #c6880a; color: #fff; }

  /* ─── Priority Stripe Demo ─── */
  .priority-demo {
    display: flex;
    gap: 12px;
    margin: 16px 0;
  }

  .priority-chip {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 6px 14px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 550;
    border-left: 3px solid;
    background: var(--bg-card);
    box-shadow: var(--shadow-sm);
  }

  .priority-chip.high { border-color: var(--priority-high); color: var(--priority-high); }
  .priority-chip.medium { border-color: var(--priority-medium); color: var(--priority-medium); }
  .priority-chip.low { border-color: var(--priority-low); color: var(--priority-low); }

  /* ─── Phase Roadmap ─── */
  .phase-list {
    margin: 24px 0;
    position: relative;
    padding-left: 28px;
  }

  .phase-list::before {
    content: '';
    position: absolute;
    left: 7px;
    top: 8px;
    bottom: 8px;
    width: 2px;
    background: var(--border);
    border-radius: 1px;
  }

  .phase-item {
    position: relative;
    padding: 12px 0 20px;
  }

  .phase-item::before {
    content: '';
    position: absolute;
    left: -25px;
    top: 18px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    border: 2px solid var(--border);
    background: var(--bg);
  }

  .phase-item.done::before {
    background: var(--accent);
    border-color: var(--accent);
  }

  .phase-item.active::before {
    background: var(--bg);
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-light);
  }

  .phase-item .phase-label {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-bottom: 4px;
  }

  .phase-item.done .phase-label { color: var(--accent); }
  .phase-item.active .phase-label { color: var(--accent); }
  .phase-item .phase-label { color: var(--text-tertiary); }

  .phase-item .phase-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 4px;
  }

  .phase-item .phase-desc {
    font-size: 13.5px;
    color: var(--text-secondary);
    line-height: 1.6;
  }

  /* ─── Architecture Diagram ─── */
  .arch-diagram {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    margin: 24px 0;
  }

  .arch-box {
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: var(--radius);
    padding: 18px;
    text-align: center;
    box-shadow: var(--shadow-sm);
  }

  .arch-box .arch-label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-tertiary);
    font-weight: 600;
    margin-bottom: 6px;
  }

  .arch-box .arch-name {
    font-family: var(--font-mono);
    font-size: 13px;
    font-weight: 500;
    color: var(--accent);
  }

  .arch-box .arch-desc {
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 6px;
    line-height: 1.5;
  }

  .arch-full {
    grid-column: 1 / -1;
  }

  /* ─── Tag Chip Demo ─── */
  .tag-demo {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin: 16px 0;
  }

  .tag-chip {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 550;
  }

  .tag-chip .dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
  }

  /* ─── Responsive ─── */
  @media (max-width: 960px) {
    .sidebar { display: none; }
    .main-content { padding: 32px 28px 80px; }
    .feature-grid { grid-template-columns: 1fr; }
    .arch-diagram { grid-template-columns: 1fr; }
    .arch-full { grid-column: 1; }
  }

  /* ─── Scrollbar Styling ─── */
  .sidebar::-webkit-scrollbar { width: 6px; }
  .sidebar::-webkit-scrollbar-track { background: transparent; }
  .sidebar::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

  /* ─── Smooth Section Transitions ─── */
  .doc-section {
    animation: fadeUp 0.4s ease both;
  }

  @keyframes fadeUp {
    from { opacity: 0; transform: translateY(12px); }
    to { opacity: 1; transform: translateY(0); }
  }

  /* ─── Perspective Icons List ─── */
  .perspective-list {
    margin: 16px 0;
  }

  .perspective-item {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    padding: 12px 0;
    border-bottom: 1px solid var(--border-light);
  }

  .perspective-item:last-child {
    border-bottom: none;
  }

  .perspective-item .persp-icon {
    width: 32px;
    height: 32px;
    border-radius: 7px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    flex-shrink: 0;
    margin-top: 2px;
  }

  .perspective-item h4 {
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 2px;
  }

  .perspective-item p {
    font-size: 13px;
    color: var(--text-secondary);
    margin: 0;
    line-height: 1.55;
  }

  /* ─── Notes showcase ─── */
  .notes-showcase {
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: var(--radius);
    overflow: hidden;
    margin: 20px 0;
    box-shadow: var(--shadow-sm);
  }

  .notes-showcase-header {
    padding: 12px 18px;
    background: var(--bg-code);
    border-bottom: 1px solid var(--border-light);
    font-size: 12px;
    font-weight: 600;
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
  }

  .notes-showcase-body {
    padding: 20px;
    font-family: var(--font-mono);
    font-size: 13px;
    line-height: 1.7;
    color: var(--text-secondary);
  }

  .notes-showcase-body .comment { color: var(--text-tertiary); }
  .notes-showcase-body .kw { color: var(--accent); }
  .notes-showcase-body .str { color: #3a8c42; }

  /* ─── Design Principles ─── */
  .principle-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin: 24px 0;
  }

  .principle-card {
    border-left: 3px solid var(--accent);
    padding: 16px 20px;
    background: var(--bg-card);
    border-radius: 0 var(--radius) var(--radius) 0;
    box-shadow: var(--shadow-sm);
  }

  .principle-card h4 {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 6px;
    color: var(--text);
  }

  .principle-card p {
    font-size: 13px;
    line-height: 1.6;
    color: var(--text-secondary);
    margin: 0;
  }

  /* ─── Table Demo ─── */
  .table-demo {
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: var(--radius);
    overflow: hidden;
    margin: 20px 0;
    box-shadow: var(--shadow-sm);
  }

  .table-demo-header {
    padding: 10px 18px;
    background: var(--bg-code);
    border-bottom: 1px solid var(--border-light);
    font-size: 11px;
    font-weight: 600;
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    display: flex;
    align-items: center;
    gap: 8px;
  }

  .table-demo-header i { font-size: 10px; }

  .table-demo-columns {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .table-demo-col {
    padding: 18px 20px;
  }

  .table-demo-col:first-child {
    border-right: 1px solid var(--border-light);
  }

  .table-demo-col-label {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-tertiary);
    margin-bottom: 10px;
  }

  .table-demo-col pre {
    background: var(--bg-code);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-sm);
    padding: 14px 16px;
    font-family: var(--font-mono);
    font-size: 12.5px;
    line-height: 1.55;
    color: var(--text);
    margin: 0;
    overflow-x: auto;
    white-space: pre;
  }

  .table-demo-col table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13.5px;
    margin: 0;
  }

  .table-demo-col table th,
  .table-demo-col table td {
    padding: 8px 14px;
    border: 1px solid var(--border);
    color: var(--text-secondary);
  }

  .table-demo-col table th {
    background: var(--bg-code);
    font-weight: 600;
    color: var(--text);
    text-align: left;
  }

  .table-demo-col table td {
    background: var(--bg-card);
  }

  .table-demo-col table tr:nth-child(even) td {
    background: var(--bg);
  }

  .table-demo-single {
    padding: 18px 20px;
  }

  .table-demo-single pre {
    background: var(--bg-code);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-sm);
    padding: 14px 16px;
    font-family: var(--font-mono);
    font-size: 12.5px;
    line-height: 1.55;
    color: var(--text);
    margin: 0;
    overflow-x: auto;
    white-space: pre;
  }

  /* ─── Claude Tool Grid ─── */
  .tool-grid {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 12px;
    margin: 20px 0;
  }

  .tool-card {
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: var(--radius);
    padding: 16px 18px;
    box-shadow: var(--shadow-sm);
    transition: all 0.2s ease;
  }

  .tool-card:hover {
    box-shadow: var(--shadow-md);
    border-color: var(--border);
    transform: translateY(-1px);
  }

  .tool-card .tool-icon {
    width: 30px;
    height: 30px;
    border-radius: 7px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    margin-bottom: 10px;
  }

  .tool-card h4 {
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 4px;
    color: var(--text);
  }

  .tool-card p {
    font-size: 12.5px;
    line-height: 1.5;
    color: var(--text-secondary);
    margin: 0;
  }

  /* ─── Claude Conversation Demo ─── */
  .claude-demo {
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: var(--radius);
    overflow: hidden;
    margin: 20px 0;
    box-shadow: var(--shadow-sm);
  }

  .claude-demo-header {
    padding: 10px 18px;
    background: var(--bg-code);
    border-bottom: 1px solid var(--border-light);
    font-size: 11px;
    font-weight: 600;
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    display: flex;
    align-items: center;
    gap: 8px;
  }

  .claude-demo-body {
    padding: 16px 20px;
    font-size: 13.5px;
    line-height: 1.7;
  }

  .claude-demo-msg {
    margin-bottom: 12px;
    padding: 10px 14px;
    border-radius: var(--radius-sm);
  }

  .claude-demo-msg:last-child { margin-bottom: 0; }

  .claude-demo-msg.user {
    background: var(--accent-glow);
    border: 1px solid var(--accent-light);
    color: var(--text);
  }

  .claude-demo-msg.assistant {
    background: var(--bg-code);
    border: 1px solid var(--border-light);
    color: var(--text-secondary);
  }

  .claude-demo-msg .msg-label {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-tertiary);
    margin-bottom: 4px;
  }

  .claude-demo-msg.user .msg-label { color: var(--accent); }

  .claude-demo-activity {
    font-size: 12px;
    color: #3a8c42;
    padding: 4px 14px;
    margin-bottom: 8px;
  }

  .claude-demo-activity i { margin-right: 5px; }

  /* ─── Download Cards ─── */
  .download-grid {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 16px;
    margin: 24px 0;
  }

  .download-card {
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: var(--radius);
    padding: 28px 24px 24px;
    box-shadow: var(--shadow-sm);
    transition: all 0.2s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    text-decoration: none;
    color: inherit;
    cursor: pointer;
  }

  .download-card:hover {
    box-shadow: var(--shadow-md);
    border-color: var(--border);
    transform: translateY(-2px);
  }

  .download-card:active {
    transform: translateY(0);
    box-shadow: var(--shadow-sm);
  }

  .download-card .platform-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    margin-bottom: 16px;
  }

  .platform-icon.macos   { background: #f3f0eb; color: #2c2418; }
  .platform-icon.windows { background: #e4eef9; color: #3a6fb8; }
  .platform-icon.linux   { background: #fef0e0; color: #c6700a; }

  .download-card h4 {
    font-size: 15px;
    font-weight: 600;
    margin-bottom: 4px;
    color: var(--text);
  }

  .download-card .platform-arch {
    font-size: 12.5px;
    color: var(--text-tertiary);
    font-family: var(--font-mono);
    margin-bottom: 14px;
  }

  .download-card .download-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 18px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    font-family: var(--font-sans);
    transition: all 0.15s ease;
    margin-top: auto;
  }

  .download-card:hover .download-btn {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
  }

  .download-note {
    margin-top: 16px;
    font-size: 13px;
    color: var(--text-tertiary);
    line-height: 1.6;
  }

  .download-note code {
    font-family: var(--font-mono);
    font-size: 12px;
    background: var(--bg-code);
    padding: 2px 6px;
    border-radius: 4px;
  }


/* ─── Part 2: Bibliofile additions ─── */

  /* ─── Links in running text ─── */
  .doc-section a:not([class]),
  .hero p a,
  .download-note a,
  .prose a:not([class]) {
    color: var(--accent);
    text-decoration: underline;
    text-decoration-thickness: 1px;
    text-underline-offset: 2px;
    text-decoration-color: var(--accent-light);
    transition: text-decoration-color 0.15s ease;
  }

  .doc-section a:not([class]):hover,
  .hero p a:hover,
  .download-note a:hover,
  .prose a:not([class]):hover {
    text-decoration-color: var(--accent);
  }

  /* ─── Sidebar additions ─── */
  .sidebar-logo a {
    color: inherit;
    text-decoration: none;
  }

  .nav-link .nav-external {
    margin-left: auto;
    font-size: 10px;
    opacity: 0.45;
    width: auto;
  }

  /* Headings of the current manual chapter, nested under its nav link */
  .nav-sub {
    margin: 2px 0 10px 19px;
    border-left: 1px solid var(--border);
  }

  .nav-sub a {
    display: block;
    padding: 4px 10px 4px 13px;
    margin-left: -1px;
    border-left: 2px solid transparent;
    font-size: 12.5px;
    line-height: 1.45;
    color: var(--text-tertiary);
    text-decoration: none;
    transition: all 0.15s ease;
  }

  .nav-sub a:hover {
    color: var(--text);
  }

  .nav-sub a.active {
    color: var(--accent);
    border-left-color: var(--accent);
    font-weight: 550;
  }

  .nav-sub a code {
    font-size: 11.5px;
    padding: 0 4px;
    color: inherit;
  }

  /* ─── Hero additions ─── */
  .hero-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 28px;
  }

  .btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: var(--bg-card);
    color: var(--text-secondary);
    font-family: var(--font-sans);
    font-size: 14px;
    font-weight: 550;
    text-decoration: none;
    box-shadow: var(--shadow-sm);
    transition: all 0.15s ease;
  }

  .btn:hover {
    border-color: var(--accent);
    color: var(--accent);
    box-shadow: var(--shadow-md);
    transform: translateY(-1px);
  }

  .btn.primary {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
  }

  .btn.primary:hover {
    background: #a04b0a;
    border-color: #a04b0a;
    color: #fff;
  }

  .btn .btn-meta {
    font-size: 12px;
    font-weight: 450;
    opacity: 0.8;
  }

  .hero .hero-icon {
    width: 72px;
    height: 72px;
    display: block;
    margin: -8px 0 18px -6px;
  }

  .hero.compact {
    margin-bottom: 40px;
    padding-bottom: 32px;
  }

  .hero.compact h1 {
    font-size: 44px;
  }

  /* ─── Screenshots ─── */
  .screenshot {
    margin: 24px 0;
  }

  .screenshot img {
    display: block;
    width: 100%;
    height: auto;
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: var(--radius);
    box-shadow: var(--shadow-md);
  }

  .screenshot figcaption {
    margin-top: 10px;
    font-size: 12.5px;
    line-height: 1.55;
    color: var(--text-tertiary);
    text-align: center;
  }

  .screenshot.lead img {
    box-shadow: var(--shadow-lg);
  }

  .screenshot-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin: 24px 0;
  }

  .screenshot-grid .screenshot {
    margin: 0;
  }

  /* ─── "Read more" links into the manual ─── */
  .more-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin: 8px 8px 0 0;
    padding: 7px 14px;
    border-radius: var(--radius-sm);
    background: var(--accent-glow);
    border: 1px solid var(--accent-light);
    color: var(--accent);
    font-size: 13px;
    font-weight: 550;
    text-decoration: none;
    transition: all 0.15s ease;
  }

  .more-link:hover {
    background: var(--accent-light);
  }

  .more-link i {
    font-size: 11px;
    transition: transform 0.15s ease;
  }

  .more-link:hover i {
    transform: translateX(2px);
  }

  /* ─── Link cards (landing page → guide, manual, source) ─── */
  .link-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin: 24px 0;
  }

  .link-card {
    display: flex;
    flex-direction: column;
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: var(--radius);
    padding: 24px 24px 22px;
    box-shadow: var(--shadow-sm);
    color: inherit;
    text-decoration: none;
    transition: all 0.2s ease;
  }

  .link-card:hover {
    box-shadow: var(--shadow-md);
    border-color: var(--border);
    transform: translateY(-2px);
  }

  .link-card .card-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 17px;
    margin-bottom: 16px;
  }

  .link-card .card-icon.orange { background: #fef0e0; color: #c6700a; }
  .link-card .card-icon.blue { background: #e4eef9; color: #3a6fb8; }
  .link-card .card-icon.green { background: #e2f3e4; color: #3a8c42; }
  .link-card .card-icon.purple { background: #eee4f6; color: #7c3ab8; }

  .link-card h4 {
    font-family: var(--font-serif);
    font-size: 22px;
    font-weight: 400;
    letter-spacing: -0.01em;
    color: var(--text);
    margin-bottom: 6px;
  }

  .link-card p {
    font-size: 13.5px;
    line-height: 1.6;
    color: var(--text-secondary);
    margin: 0 0 16px;
  }

  .link-card .link-cta {
    margin-top: auto;
    display: inline-flex;
    align-items: center;
    gap: 7px;
    font-size: 13px;
    font-weight: 600;
    color: var(--accent);
  }

  .link-card .link-cta i {
    font-size: 11px;
    transition: transform 0.15s ease;
  }

  .link-card:hover .link-cta i {
    transform: translateX(3px);
  }

  /* ─── Chapter list (landing page, manual contents) ─── */
  .chapter-list {
    margin: 16px 0;
  }

  .chapter-item {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    padding: 12px 12px;
    margin: 0 -12px;
    border-bottom: 1px solid var(--border-light);
    border-radius: var(--radius-sm);
    color: inherit;
    text-decoration: none;
    transition: background 0.15s ease;
  }

  .chapter-item:last-child {
    border-bottom: none;
  }

  .chapter-item:hover {
    background: var(--accent-glow);
  }

  .chapter-item .chapter-num {
    width: 32px;
    height: 32px;
    border-radius: 7px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    margin-top: 2px;
    background: var(--bg-code);
    color: var(--text-secondary);
    font-family: var(--font-mono);
    font-size: 13px;
    font-weight: 500;
    transition: all 0.15s ease;
  }

  .chapter-item:hover .chapter-num {
    background: var(--accent);
    color: #fff;
  }

  .chapter-item h4 {
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 2px;
  }

  .chapter-item p {
    font-size: 13px;
    line-height: 1.55;
    color: var(--text-secondary);
    margin: 0;
  }

  .chapter-item p strong {
    color: var(--text-secondary);
    font-weight: 600;
  }

  /* ─── Manual prose (generated from the Markdown chapters) ─── */
  .prose > h2 {
    font-family: var(--font-serif);
    font-size: 30px;
    font-weight: 400;
    letter-spacing: -0.015em;
    line-height: 1.25;
    color: var(--text);
    margin: 56px 0 20px;
  }

  .prose > h2:first-child {
    margin-top: 0;
  }

  .prose h3 {
    font-size: 17px;
    font-weight: 600;
    color: var(--text);
    margin: 36px 0 12px;
    letter-spacing: -0.01em;
  }

  .prose h4 {
    font-size: 14.5px;
    font-weight: 600;
    color: var(--text);
    margin: 26px 0 10px;
  }

  .prose h5,
  .prose h6 {
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-tertiary);
    margin: 22px 0 8px;
  }

  .prose h2 code,
  .prose h3 code,
  .prose h4 code {
    font-size: 0.85em;
  }

  .prose .heading-anchor {
    margin-left: 8px;
    font-family: var(--font-sans);
    font-size: 0.7em;
    color: var(--text-tertiary);
    text-decoration: none;
    opacity: 0;
    transition: opacity 0.15s ease;
  }

  .prose h2:hover .heading-anchor,
  .prose h3:hover .heading-anchor,
  .prose h4:hover .heading-anchor {
    opacity: 1;
  }

  .prose .heading-anchor:hover {
    color: var(--accent);
  }

  .prose p,
  .prose ul,
  .prose ol,
  .prose dl {
    color: var(--text-secondary);
    line-height: 1.75;
    margin-bottom: 14px;
  }

  .prose ul,
  .prose ol {
    margin-left: 1.5em;
  }

  .prose li {
    margin-bottom: 6px;
  }

  .prose li > ul,
  .prose li > ol {
    margin-top: 6px;
    margin-bottom: 6px;
  }

  .prose li > p {
    margin-bottom: 6px;
  }

  .prose strong {
    color: var(--text);
    font-weight: 600;
  }

  .prose hr {
    border: none;
    border-top: 1px solid var(--border);
    margin: 40px 0;
  }

  .prose blockquote {
    margin: 20px 0;
    padding: 4px 0 4px 18px;
    border-left: 3px solid var(--accent-light);
  }

  .prose blockquote p:last-child {
    margin-bottom: 0;
  }

  .prose .callout p,
  .prose .callout ul,
  .prose .callout ol {
    color: inherit;
    line-height: 1.65;
    margin-bottom: 8px;
  }

  .prose .callout > div:last-child > :last-child {
    margin-bottom: 0;
  }

  .prose .callout strong {
    color: inherit;
  }

  .prose .callout code {
    background: rgba(255, 255, 255, 0.6);
  }

  .prose dt {
    font-weight: 600;
    color: var(--text);
  }

  .prose dd {
    margin: 0 0 10px 1.5em;
  }

  .table-wrap {
    overflow-x: auto;
    margin: 20px 0;
  }

  .table-wrap .shortcut-table {
    margin: 0;
  }

  .prose .shortcut-table td,
  .prose .shortcut-table th {
    vertical-align: top;
  }

  .prose .shortcut-table td:first-child {
    color: var(--text);
  }

  .prose pre {
    font-size: 12.5px;
  }

  .prose pre code {
    font-size: 12.5px;
  }

  /* highlight.js tokens, in Folio's card palette */
  .hljs-comment, .hljs-quote { color: var(--text-tertiary); font-style: italic; }
  .hljs-keyword, .hljs-selector-tag, .hljs-literal, .hljs-built_in, .hljs-name { color: #7c3ab8; }
  .hljs-string, .hljs-regexp, .hljs-addition, .hljs-attr + .hljs-string { color: #3a8c42; }
  .hljs-number, .hljs-bullet, .hljs-symbol { color: #c6700a; }
  .hljs-title, .hljs-title.function_, .hljs-section { color: #3a6fb8; }
  .hljs-attr, .hljs-attribute, .hljs-property, .hljs-variable, .hljs-template-variable, .hljs-params { color: #b83a5c; }
  .hljs-type, .hljs-class .hljs-title, .hljs-tag, .hljs-doctag, .hljs-template-tag { color: #2a8a84; }
  .hljs-meta, .hljs-deletion { color: var(--text-tertiary); }
  .hljs-emphasis { font-style: italic; }
  .hljs-strong { font-weight: 600; }

  /* Previous / next chapter */
  .chapter-pager {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-top: 64px;
    padding-top: 32px;
    border-top: 1px solid var(--border);
  }

  .pager-link {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 16px 20px;
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    color: inherit;
    text-decoration: none;
    transition: all 0.2s ease;
  }

  .pager-link:hover {
    box-shadow: var(--shadow-md);
    border-color: var(--border);
    transform: translateY(-1px);
  }

  .pager-link.next {
    grid-column: 2;
    text-align: right;
  }

  .pager-label {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-tertiary);
  }

  .pager-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--accent);
  }

  /* ─── Footer ─── */
  .site-footer {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 8px 24px;
    margin-top: 72px;
    padding-top: 24px;
    border-top: 1px solid var(--border);
    font-size: 12.5px;
    color: var(--text-tertiary);
  }

  .site-footer a {
    color: var(--text-secondary);
    text-decoration: none;
  }

  .site-footer a:hover {
    color: var(--accent);
  }

  .site-footer .footer-links {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 18px;
  }

  /* ─── Narrow screens: the sidebar is hidden, so a top bar takes over ─── */
  .mobile-bar {
    display: none;
  }

  @media (max-width: 960px) {
    .mobile-bar {
      display: flex;
      align-items: center;
      gap: 18px;
      position: sticky;
      top: 0;
      z-index: 10;
      padding: 12px 28px;
      background: var(--bg-nav);
      border-bottom: 1px solid var(--border);
    }

    .mobile-bar .mobile-logo {
      font-family: var(--font-serif);
      font-size: 22px;
      color: var(--text);
      text-decoration: none;
      margin-right: auto;
    }

    .mobile-bar .mobile-logo i {
      color: var(--accent);
      font-size: 16px;
      margin-right: 6px;
    }

    .mobile-bar a.mobile-link {
      font-size: 13.5px;
      font-weight: 500;
      color: var(--text-secondary);
      text-decoration: none;
    }

    .mobile-bar a.mobile-link.active {
      color: var(--accent);
    }

    html { scroll-padding-top: 72px; }
    .link-grid { grid-template-columns: 1fr; }
    .tool-grid { grid-template-columns: 1fr 1fr; }
    .principle-grid { grid-template-columns: 1fr; }
  }

  @media (max-width: 640px) {
    .main-content { padding: 28px 18px 72px; }
    .mobile-bar { padding: 12px 18px; gap: 14px; }
    .hero h1 { font-size: 38px; }
    .hero.compact h1 { font-size: 34px; }
    .doc-section h2, .prose > h2 { font-size: 26px; }
    .download-grid,
    .screenshot-grid,
    .tool-grid,
    .chapter-pager { grid-template-columns: 1fr; }
    .pager-link.next { grid-column: 1; }
    .table-demo-columns { grid-template-columns: 1fr; }
    .table-demo-col:first-child { border-right: none; border-bottom: 1px solid var(--border-light); }
    .detail-toggle { flex-wrap: wrap; }
  }

  /* Chapter cards inside the manual's prose keep their own spacing */
  .prose .chapter-item h4 {
    margin: 0 0 2px;
  }

  .prose .chapter-item p {
    margin: 0;
    line-height: 1.55;
  }

  /* Code is shown literally: no "=>" → "⇒" ligatures */
  code, pre {
    font-variant-ligatures: none;
  }

  /* Line above the Casual/Nerd toggle (Folio sets this inline) */
  .toggle-intro {
    margin-bottom: 6pt;
  }

  /* Figure captions may carry links and labels */
  .screenshot figcaption a {
    color: var(--accent);
  }

  .screenshot figcaption strong {
    color: var(--text-secondary);
    font-weight: 600;
  }

  /* Two-column chapter index on the landing page */
  .chapter-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-rows: repeat(6, auto);
    grid-auto-flow: column;
    gap: 2px 20px;
    margin: 16px 0 24px;
  }

  .chapter-grid .chapter-item {
    margin: 0;
    border-bottom: none;
    align-items: center;
  }

  .chapter-grid .chapter-item .chapter-num {
    margin-top: 0;
  }

  @media (max-width: 640px) {
    .chapter-grid { grid-template-columns: 1fr; grid-template-rows: none; grid-auto-flow: row; }
    .hero-actions .btn { flex: 1 1 100%; justify-content: center; }
  }

  /* Landing-page gallery: uniform tiles, cropped from the top */
  .screenshot-grid .screenshot img {
    aspect-ratio: 2200 / 1384;
    object-fit: cover;
    object-position: top left;
  }

  .hero .screenshot.lead {
    margin: 40px 0 0;
  }
