/**
 * Playbook detail — mobile-first reader (v1.0.19.16)
 * Full-bleed dark hero; chrome lives inside hero (no sticky overlap).
 */

.pb-detail {
    --pb-accent: #4f46e5;
    --pb-accent-rgb: 79, 70, 229;
    --pb-obsidian: #08090e;
    --pb-cyan: #22d3ee;
    --pb-border: rgba(15, 23, 42, 0.08);
    --pb-text: #1e293b;
    --pb-muted: #64748b;
    --pb-ease: cubic-bezier(0.16, 1, 0.3, 1);
    --pb-nav-offset: clamp(5.5rem, 11vw, 7rem);
    --pb-content-max: 42rem;
    --pb-figure-max: 100%;
    background: #f1f5f9;
}

.pb-detail #za-pb-progress {
    position: fixed;
    top: 0;
    left: 0;
    height: 3px;
    width: 0;
    z-index: 10002;
    background: linear-gradient(90deg, var(--pb-accent), var(--pb-cyan));
    pointer-events: none;
}

/* ── HERO (full width, clears floating site nav) ── */
.pb-hero {
    background: var(--pb-obsidian);
    color: #fff;
    padding: var(--pb-nav-offset) 0 0;
    position: relative;
    overflow: hidden;
}

.pb-hero::before {
    content: '';
    position: absolute;
    inset: 0;
    background:
        radial-gradient(ellipse 70% 55% at 85% 20%, rgba(var(--pb-accent-rgb), 0.18), transparent 55%),
        radial-gradient(ellipse 60% 50% at 10% 90%, rgba(34, 211, 238, 0.12), transparent 50%);
    pointer-events: none;
}

/* Top chrome row — inside dark hero, never overlaps title */
.pb-hero-top {
    position: relative;
    z-index: 3;
    max-width: 1160px;
    margin: 0 auto;
    padding: 0.75rem clamp(1rem, 4vw, 2rem) 1rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.pb-hero-back {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px 8px 10px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.07);
    border: 1px solid rgba(255, 255, 255, 0.14);
    color: rgba(255, 255, 255, 0.92);
    font-size: 0.78rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    text-decoration: none;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    transition: background 0.25s var(--pb-ease), border-color 0.25s, transform 0.25s;
}

.pb-hero-back:hover {
    background: rgba(255, 255, 255, 0.12);
    border-color: rgba(34, 211, 238, 0.45);
    transform: translateX(-2px);
}

.pb-hero-back svg {
    flex-shrink: 0;
    opacity: 0.9;
}

.pb-hero-export {
    margin-left: auto;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.16);
    background: rgba(255, 255, 255, 0.06);
    color: #fff;
    font-family: var(--ff-mono, 'JetBrains Mono', monospace);
    font-size: 0.62rem;
    font-weight: 800;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    cursor: pointer;
    backdrop-filter: blur(12px);
    transition: background 0.25s, border-color 0.25s;
}

.pb-hero-export:hover {
    background: rgba(34, 211, 238, 0.15);
    border-color: rgba(34, 211, 238, 0.5);
}

.pb-hero-export svg {
    color: var(--pb-cyan);
}

.pb-hero-inner {
    position: relative;
    z-index: 2;
    max-width: 1160px;
    margin: 0 auto;
    padding: 0 clamp(1rem, 4vw, 2rem) 2.25rem;
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.5rem;
    align-items: start;
}

.pb-hero-eyebrow {
    font-family: var(--ff-mono, 'JetBrains Mono', monospace);
    font-size: 0.62rem;
    font-weight: 700;
    letter-spacing: 0.22em;
    text-transform: uppercase;
    color: var(--pb-cyan);
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 0.85rem;
}

.pb-hero-eyebrow::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--pb-cyan);
    box-shadow: 0 0 10px var(--pb-cyan);
}

.pb-hero-title {
    font-family: var(--ff-head, 'Sora', sans-serif);
    font-size: clamp(1.4rem, 4.8vw, 2.35rem);
    font-weight: 900;
    line-height: 1.12;
    letter-spacing: -0.035em;
    margin: 0 0 1rem;
    max-width: 20ch;
    color: #ffffff !important;
    -webkit-text-fill-color: #ffffff;
    text-shadow: 0 1px 24px rgba(0, 0, 0, 0.45);
}

.pb-hero-desc {
    margin: 0 0 1.35rem;
    font-size: clamp(0.9rem, 2.2vw, 1.02rem);
    line-height: 1.65;
    color: rgba(255, 255, 255, 0.58);
    max-width: 52ch;
}

.pb-hero-stats {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.85rem 1rem;
}

@media (min-width: 420px) {
    .pb-hero-stats {
        grid-template-columns: repeat(4, minmax(0, auto));
        gap: 1rem 1.75rem;
    }
}

.pb-hero-stat-val {
    font-family: var(--ff-mono, 'JetBrains Mono', monospace);
    font-size: 1.05rem;
    font-weight: 800;
    color: #fff;
    line-height: 1.2;
}

.pb-hero-stat-label {
    font-size: 0.58rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: rgba(255, 255, 255, 0.36);
    margin-top: 2px;
}

.pb-hero-media {
    width: 100%;
    max-width: 100%;
    margin: 0;
    border-radius: 14px;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 24px 48px rgba(0, 0, 0, 0.35);
    aspect-ratio: 16 / 9;
    max-height: min(42vw, 200px);
    background: #0c0c12;
}

.pb-hero-media img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center 40%;
    display: block;
}

@media (min-width: 900px) {
    .pb-hero-inner {
        grid-template-columns: 1.05fr 0.95fr;
        gap: 2rem 2.5rem;
        align-items: center;
        padding-bottom: 2.75rem;
    }

    .pb-hero-title {
        max-width: none;
    }

    .pb-hero-media {
        max-height: 210px;
        max-width: 480px;
        justify-self: end;
    }
}

/* Soft transition hero → reading surface */
.pb-hero::after {
    content: '';
    display: block;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.08), transparent);
}

/* ── READING LAYOUT ── */
.pb-layout {
    max-width: 1160px;
    margin: 0 auto;
    padding: 2rem clamp(1rem, 4vw, 2rem) 5rem;
    display: grid;
    grid-template-columns: 1fr;
    gap: 2rem;
    background: #f8fafc;
    border-radius: 20px 20px 0 0;
    margin-top: -12px;
    position: relative;
    z-index: 1;
    box-shadow: 0 -8px 32px rgba(0, 0, 0, 0.12);
}

@media (min-width: 1080px) {
    .pb-layout {
        grid-template-columns: minmax(0, 1fr) 248px;
        gap: 2.5rem;
        padding-top: 2.5rem;
    }
}

.pb-article {
    min-width: 0;
}

.pb-practitioner-card {
    display: flex;
    gap: 1rem;
    align-items: flex-start;
    background: #fff;
    border: 1px solid var(--pb-border);
    border-radius: 16px;
    padding: 1.2rem 1.35rem;
    margin-bottom: 2rem;
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.04), 0 8px 24px rgba(15, 23, 42, 0.05);
}

.pb-practitioner-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
    border: 2px solid rgba(var(--pb-accent-rgb), 0.25);
}

.pb-practitioner-name {
    font-weight: 800;
    font-size: 0.95rem;
    color: #0f172a;
}

.pb-practitioner-role {
    font-size: 0.76rem;
    color: var(--pb-muted);
    margin-bottom: 0.35rem;
}

.pb-practitioner-text {
    font-size: 0.9rem;
    line-height: 1.6;
    color: #475569;
    margin: 0;
}

/* Chapters */
.pb-detail .za-pb-chapter {
    scroll-margin-top: calc(var(--pb-nav-offset) + 16px);
}

.pb-detail .za-pb-intro {
    margin-bottom: 2.25rem;
    padding-bottom: 2.25rem;
    border-bottom: 1px solid var(--pb-border);
}

.pb-detail .za-pb-chapter + .za-pb-chapter {
    margin-top: 2.75rem;
    padding-top: 2.25rem;
    border-top: 1px solid var(--pb-border);
}

.pb-detail .za-pb-chapter-heading {
    font-family: var(--ff-head, 'Sora', sans-serif);
    font-size: clamp(1.15rem, 3.5vw, 1.55rem);
    font-weight: 900;
    color: var(--pb-text);
    line-height: 1.22;
    margin: 0 0 1.35rem;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.45rem 0.6rem;
}

.pb-detail .za-pb-ch-num {
    font-family: var(--ff-mono, 'JetBrains Mono', monospace);
    font-size: 0.65rem;
    font-weight: 800;
    letter-spacing: 0.1em;
    color: var(--pb-accent);
    background: rgba(var(--pb-accent-rgb), 0.08);
    border: 1px solid rgba(var(--pb-accent-rgb), 0.2);
    padding: 4px 9px;
    border-radius: 6px;
}

.pb-detail .za-p-rich,
.pb-detail .za-pb-chapter-body {
    font-size: 1rem;
    line-height: 1.78;
    color: var(--pb-text);
}

.pb-detail .za-p-rich h2 {
    font-size: 1.22rem;
    font-weight: 800;
    margin: 1.85rem 0 0.65rem;
    padding-left: 0.75rem;
    border-left: 3px solid var(--pb-accent);
    color: #0f172a;
}

.pb-detail .za-p-rich h3 {
    font-size: 1.05rem;
    font-weight: 700;
    margin: 1.5rem 0 0.5rem;
}

.pb-detail .za-p-rich p {
    margin: 0 0 1.1rem;
}

.pb-detail .za-p-rich a {
    color: var(--pb-accent);
    text-decoration: underline;
    text-underline-offset: 3px;
}

/* Diagrams — compact inline preview; click opens shared lightbox */
.pb-detail #pb-content .md-image,
.pb-detail #pb-content figure.md-image,
.pb-detail #pb-content figure.md-image-showcase {
    margin: 2rem auto;
    width: min(100%, calc(100% * var(--ds-diagram-showcase-scale, 0.75)));
    max-width: var(--ds-diagram-showcase-max, min(840px, calc((100vw - 2rem) * 0.75)));
    aspect-ratio: auto;
    border-radius: 14px;
    overflow: hidden;
    border: 1px solid var(--pb-border);
    background: #fff;
    box-shadow: 0 4px 24px rgba(15, 23, 42, 0.08);
    padding: 0.5rem;
}

.pb-detail #pb-content .md-image img,
.pb-detail #pb-content figure.md-image-showcase img {
    display: block;
    width: 100%;
    height: auto;
    max-width: 100%;
    max-height: none;
    margin-inline: auto;
    object-fit: contain;
    object-position: center;
    background: #f8fafc;
    border-radius: 10px;
    cursor: zoom-in;
}

.pb-detail #pb-content .md-image figcaption {
    padding: 0.65rem 0.85rem 0.35rem;
    font-size: 0.78rem;
    line-height: 1.45;
    color: var(--pb-muted);
}

@media (min-width: 768px) {
    .pb-detail #pb-content .md-image {
        padding: 0.65rem;
    }
}

/* Markdown + luxury tables — inherit detail-shared mobile card layout */
.pb-detail .za-p-rich .table-wrapper,
.pb-detail .za-p-rich .za-table-container {
    margin: 1.5rem 0;
}

.pb-detail .za-p-rich table:not(.za-luxury-table) {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.86rem;
    margin: 1.25rem 0;
    border: 1px solid var(--pb-border);
    border-radius: 12px;
    overflow: hidden;
}

.pb-detail .za-p-rich table:not(.za-luxury-table) th {
    background: #0f172a;
    color: #fff;
    padding: 9px 11px;
    text-align: left;
}

.pb-detail .za-p-rich table:not(.za-luxury-table) td {
    padding: 8px 11px;
    border-bottom: 1px solid var(--pb-border);
    background: #fff;
    color: #0f172a;
}

/* TOC */
.pb-toc-col {
    position: sticky;
    top: calc(var(--pb-nav-offset) + 12px);
    max-height: calc(100vh - var(--pb-nav-offset) - 24px);
    overflow-y: auto;
    scrollbar-width: thin;
}

.pb-toc-card {
    background: #fff;
    border: 1px solid var(--pb-border);
    border-radius: 14px;
    overflow: hidden;
    box-shadow: 0 2px 12px rgba(15, 23, 42, 0.05);
}

.pb-toc-header {
    padding: 0.85rem 1rem;
    font-family: var(--ff-mono, 'JetBrains Mono', monospace);
    font-size: 0.6rem;
    font-weight: 800;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--pb-muted);
    background: #f8fafc;
    border-bottom: 1px solid var(--pb-border);
    display: flex;
    align-items: center;
    gap: 8px;
}

.pb-toc-progress {
    height: 3px;
    background: rgba(var(--pb-accent-rgb), 0.1);
}

.pb-toc-progress-fill {
    height: 100%;
    width: 0;
    background: linear-gradient(90deg, var(--pb-accent), var(--pb-cyan));
    transition: width 0.35s var(--pb-ease);
}

.pb-toc-list {
    list-style: none;
    margin: 0;
    padding: 0.35rem 0;
}

.pb-toc-link {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    padding: 0.5rem 1rem;
    font-size: 0.78rem;
    font-weight: 600;
    line-height: 1.35;
    color: var(--pb-muted);
    text-decoration: none;
    border-left: 2px solid transparent;
    transition: color 0.2s, background 0.2s, border-color 0.2s;
}

.pb-toc-link:hover,
.pb-toc-link.is-active {
    color: var(--pb-accent);
    background: rgba(var(--pb-accent-rgb), 0.06);
    border-left-color: var(--pb-accent);
}

.pb-toc-num {
    flex-shrink: 0;
    font-family: var(--ff-mono, 'JetBrains Mono', monospace);
    font-size: 0.56rem;
    font-weight: 800;
    opacity: 0.7;
    min-width: 1.35rem;
}

.pb-toc-link--overview .pb-toc-num {
    font-size: 0.5rem;
    letter-spacing: 0.08em;
    opacity: 0.85;
    color: var(--pb-cyan);
}

.pb-toc-link--overview.is-active .pb-toc-num {
    color: var(--pb-accent);
}

.pb-detail .za-author-nexus {
    margin-top: 2.5rem;
}

.pb-author-card {
    margin-top: 0.85rem;
    display: flex;
    gap: 0.65rem;
    align-items: center;
    padding: 0.9rem 1rem;
    background: #fff;
    border: 1px solid var(--pb-border);
    border-radius: 12px;
}

.pb-author-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    object-fit: cover;
}

.pb-mobile-toc-btn {
    display: none;
    position: fixed;
    bottom: max(1rem, env(safe-area-inset-bottom));
    left: 50%;
    transform: translateX(-50%);
    z-index: 900;
    align-items: center;
    gap: 8px;
    padding: 12px 20px;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    background: var(--pb-obsidian);
    color: #fff;
    font-family: var(--ff-mono, 'JetBrains Mono', monospace);
    font-size: 0.64rem;
    font-weight: 800;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    cursor: pointer;
    box-shadow: 0 12px 36px rgba(0, 0, 0, 0.4);
}

@media (max-width: 1079px) {
    .pb-toc-col {
        display: none;
    }

    .pb-mobile-toc-btn {
        display: inline-flex;
    }
}

.pb-toc-drawer {
    position: fixed;
    inset: 0;
    z-index: 1300;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s;
}

.pb-toc-drawer.is-open {
    pointer-events: auto;
    opacity: 1;
}

.pb-toc-drawer-bg {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    backdrop-filter: blur(6px);
}

.pb-toc-drawer-panel {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    max-height: 78vh;
    overflow-y: auto;
    background: #fff;
    border-radius: 20px 20px 0 0;
    padding: 1.25rem 1rem 2.5rem;
    transform: translateY(100%);
    transition: transform 0.4s var(--pb-ease);
}

.pb-toc-drawer.is-open .pb-toc-drawer-panel {
    transform: translateY(0);
}

.pb-toc-drawer-handle {
    width: 36px;
    height: 4px;
    background: #e2e8f0;
    border-radius: 2px;
    margin: 0 auto 1rem;
}

.pb-cta-strip {
    margin-top: 2.5rem;
    padding: 2rem 1.25rem;
    text-align: center;
    background: #fff;
    border: 1px solid var(--pb-border);
    border-radius: 16px;
}

.pb-cta-strip h3 {
    font-size: 1.2rem;
    margin-bottom: 0.5rem;
}

.za-pb-end-marker {
    text-align: center;
    font-family: var(--ff-mono, 'JetBrains Mono', monospace);
    font-size: 0.62rem;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: rgba(15, 23, 42, 0.22);
    padding: 2rem 0 0;
}

.pb-detail .za-pb-checklist {
    margin: 1.75rem 0;
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid rgba(34, 211, 238, 0.15);
    background: linear-gradient(180deg, #0c0c0f, #0f1014);
}

.pb-detail .za-pb-ai-summary,
.pb-detail .za-tldr-box {
    margin: 1.25rem 0;
    padding: 1.15rem 1.25rem;
    border-radius: 12px;
    border: 1px solid rgba(var(--pb-accent-rgb), 0.14);
    background: linear-gradient(165deg, #fff, #f8fafc);
}

@media (max-width: 480px) {
    .pb-hero-export-label {
        display: none;
    }

    .pb-hero-export {
        padding: 8px 12px;
    }

    .pb-hero-back span {
        display: none;
    }

    .pb-hero-back {
        padding: 8px 11px;
    }
}

.za-print-cover {
    display: none;
}

@media print {
    .pb-hero-top,
    .pb-toc-col,
    .pb-mobile-toc-btn,
    .navbar-wrapper,
    .footer {
        display: none !important;
    }

    .za-print-cover {
        display: block !important;
    }
}
