/**
 * Playbook detail — editorial reader shell (v1.2.2.5)
 * Mesh hero + warm reading surface + glass contents rail.
 */

.pb-detail {
    --pb-accent: #4f46e5;
    --pb-accent-rgb: 79, 70, 229;
    --pb-obsidian: #06070c;
    --pb-ink: #0b1220;
    --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: 44rem;
    --pb-rail-w: 272px;
    background: #eef2f7;
}

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

body:has(#playbook-detail) .navbar-wrapper {
    z-index: 10150;
}

/* ── HERO ── */
.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 80% 60% at 92% 8%, rgba(var(--pb-accent-rgb), 0.22), transparent 58%),
        radial-gradient(ellipse 55% 45% at 8% 88%, rgba(34, 211, 238, 0.14), transparent 52%),
        linear-gradient(180deg, transparent 70%, rgba(0, 0, 0, 0.35));
    pointer-events: none;
}

.pb-hero::after {
    content: '';
    position: absolute;
    inset: 0;
    background-image:
        linear-gradient(rgba(255, 255, 255, 0.03) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.03) 1px, transparent 1px);
    background-size: 48px 48px;
    mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.5), transparent 85%);
    pointer-events: none;
}

.pb-hero-top {
    position: relative;
    z-index: 3;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0.75rem clamp(1rem, 4vw, 2rem) 1rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

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

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

.pb-hero-export {
    margin-left: auto;
    font-family: var(--ff-mono, 'JetBrains Mono', monospace);
    font-size: 0.62rem;
    font-weight: 800;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.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: 1200px;
    margin: 0 auto;
    padding: 0 clamp(1rem, 4vw, 2rem) 2.5rem;
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.75rem;
    align-items: end;
}

.pb-hero-copy { max-width: 56ch; }

.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 12px var(--pb-cyan);
}

.pb-hero-title {
    font-family: var(--ff-head, 'Sora', sans-serif);
    font-size: clamp(1.55rem, 4.8vw, 2.65rem);
    font-weight: 900;
    line-height: 1.08;
    letter-spacing: -0.04em;
    margin: 0 0 1rem;
    color: #fff !important;
    -webkit-text-fill-color: #fff;
    text-shadow: 0 2px 28px rgba(0, 0, 0, 0.45);
}

.pb-hero-desc {
    margin: 0 0 1.35rem;
    font-size: clamp(0.92rem, 2.2vw, 1.05rem);
    line-height: 1.68;
    color: rgba(255, 255, 255, 0.62);
}

.pb-hero-stats {
    display: flex;
    flex-wrap: wrap;
    gap: 0.55rem;
}

.pb-hero-stat-pill {
    display: inline-flex;
    flex-direction: column;
    gap: 2px;
    padding: 0.55rem 0.9rem;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    min-width: 4.5rem;
}

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

.pb-hero-stat-label {
    font-size: 0.56rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: rgba(255, 255, 255, 0.38);
}

.pb-hero-media {
    width: 100%;
    margin: 0;
    border-radius: 16px;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.12);
    box-shadow: 0 28px 56px rgba(0, 0, 0, 0.42);
    aspect-ratio: 16 / 9;
    max-height: min(42vw, 220px);
    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.1fr 0.9fr;
        gap: 2.5rem;
        padding-bottom: 3rem;
    }

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

/* ── READING SHELL ── */
.pb-read-shell {
    max-width: 1200px;
    margin: -18px auto 0;
    padding: 0 clamp(1rem, 4vw, 2rem) 5rem;
    position: relative;
    z-index: 2;
}

.pb-layout {
    display: grid;
    grid-template-columns: 1fr;
    gap: 2rem;
    background: linear-gradient(180deg, #fafbfc 0%, #f1f5f9 100%);
    border: 1px solid rgba(15, 23, 42, 0.06);
    border-radius: 24px 24px 0 0;
    padding: 2rem clamp(1rem, 3vw, 2rem) 3rem;
    box-shadow:
        0 -12px 40px rgba(0, 0, 0, 0.14),
        0 1px 0 rgba(255, 255, 255, 0.8) inset;
}

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

.pb-article {
    min-width: 0;
    max-width: var(--pb-content-max);
    margin-inline: auto;
    width: 100%;
    background: #fff;
    border: 1px solid var(--pb-border);
    border-radius: 22px;
    padding: clamp(1.35rem, 3vw, 2.25rem);
    box-shadow:
        0 1px 2px rgba(15, 23, 42, 0.04),
        0 20px 50px rgba(15, 23, 42, 0.07);
}

@media (min-width: 1100px) {
    .pb-article {
        margin-inline: 0;
        max-width: none;
    }
}

.pb-practitioner-card {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 1rem 1.15rem;
    align-items: start;
    background: linear-gradient(135deg, #fff 0%, #f8fafc 100%);
    border: 1px solid var(--pb-border);
    border-radius: 18px;
    padding: 1.25rem 1.4rem;
    margin-bottom: 2rem;
    box-shadow: 0 8px 28px rgba(15, 23, 42, 0.05);
}

.pb-practitioner-card::before {
    content: 'Guide';
    grid-column: 2;
    grid-row: 1;
    font-family: var(--ff-mono, 'JetBrains Mono', monospace);
    font-size: 0.58rem;
    font-weight: 800;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--pb-accent);
    margin-bottom: -0.35rem;
}

.pb-practitioner-avatar {
    width: 52px;
    height: 52px;
    border-radius: 14px;
    object-fit: cover;
    grid-row: 1 / span 2;
    border: 2px solid rgba(var(--pb-accent-rgb), 0.22);
    box-shadow: 0 8px 20px rgba(var(--pb-accent-rgb), 0.15);
}

.pb-practitioner-name {
    font-weight: 800;
    font-size: 1rem;
    color: var(--pb-ink);
}

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

.pb-practitioner-text {
    grid-column: 1 / -1;
    font-size: 0.92rem;
    line-height: 1.65;
    color: #475569;
    margin: 0;
    padding-top: 0.35rem;
    border-top: 1px dashed rgba(15, 23, 42, 0.08);
}

/* Chapters — timeline editorial cards */
.pb-detail .za-pb-chapter {
    scroll-margin-top: clamp(5.5rem, 12vw, 7.5rem);
    position: relative;
    background: #fff;
    border: 1px solid var(--pb-border);
    border-radius: 20px;
    padding: clamp(1.35rem, 3vw, 1.85rem) clamp(1.25rem, 3vw, 1.75rem) clamp(1.35rem, 3vw, 1.85rem) clamp(1.5rem, 3.5vw, 2rem);
    margin-bottom: 1.35rem;
    box-shadow: 0 10px 32px rgba(15, 23, 42, 0.04);
}

.pb-detail .za-pb-chapter::before {
    content: '';
    position: absolute;
    left: 0;
    top: 1.25rem;
    bottom: 1.25rem;
    width: 4px;
    border-radius: 0 4px 4px 0;
    background: linear-gradient(180deg, var(--pb-accent), var(--pb-cyan));
    opacity: 0.85;
}

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

.pb-detail .za-pb-chapter-heading {
    font-family: var(--ff-head, 'Sora', sans-serif);
    font-size: clamp(1.2rem, 3.5vw, 1.6rem);
    font-weight: 900;
    color: var(--pb-ink);
    line-height: 1.2;
    margin: 0 0 1.25rem;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem 0.65rem;
}

.pb-detail .za-pb-ch-num {
    font-family: var(--ff-mono, 'JetBrains Mono', monospace);
    font-size: 0.62rem;
    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: 5px 10px;
    border-radius: 8px;
}

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

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

.pb-detail .za-p-rich h3 {
    font-size: 1.06rem;
    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;
}

.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)));
    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;
    object-fit: contain;
    background: #f8fafc;
    border-radius: 10px;
    cursor: zoom-in;
}

.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),
.pb-detail .za-p-rich .za-comparison-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
    background: #fff !important;
    border-radius: 12px;
    overflow: hidden;
}

.pb-detail .za-p-rich table:not(.za-luxury-table) th,
.pb-detail .za-p-rich .za-comparison-table th,
.pb-detail .za-p-rich .za-luxury-table th {
    background: #e2e8f0 !important;
    color: #0f172a !important;
    font-weight: 800;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    padding: 0.75rem 0.9rem;
}

.pb-detail .za-p-rich table:not(.za-luxury-table) td,
.pb-detail .za-p-rich .za-comparison-table td,
.pb-detail .za-p-rich .za-luxury-table td {
    color: #334155 !important;
    background: #fff !important;
    padding: 0.75rem 0.9rem;
    border-bottom: 1px solid rgba(15, 23, 42, 0.08);
}

/* ── CONTENTS RAIL ── */
.pb-toc-col {
    position: sticky;
    top: calc(var(--pb-nav-offset) + 12px);
    align-self: start;
    max-height: calc(100vh - var(--pb-nav-offset) - 24px);
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-width: thin;
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
}

.pb-toc-card {
    background: rgba(255, 255, 255, 0.92);
    border: 1px solid rgba(15, 23, 42, 0.08);
    border-radius: 18px;
    overflow: hidden;
    box-shadow: 0 12px 36px rgba(15, 23, 42, 0.08);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
}

.pb-toc-header {
    padding: 0.9rem 1rem 0.75rem;
    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);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.pb-toc-header-title {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.pb-toc-read-pct {
    font-size: 0.58rem;
    color: var(--pb-accent);
    font-weight: 800;
}

.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-scroll {
    max-height: min(48vh, 26rem);
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-width: thin;
}

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

.pb-toc-link {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    padding: 0.52rem 1rem;
    font-size: 0.8rem;
    font-weight: 600;
    line-height: 1.38;
    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;
    color: var(--pb-cyan);
}

.pb-author-card {
    display: flex;
    gap: 0.65rem;
    align-items: center;
    padding: 0.9rem 1rem;
    background: #fff;
    border: 1px solid var(--pb-border);
    border-radius: 14px;
    box-shadow: 0 4px 16px rgba(15, 23, 42, 0.04);
}

.pb-author-avatar {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    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: 1099px) {
    .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: linear-gradient(180deg, #fff, #f8fafc);
    border: 1px solid var(--pb-border);
    border-radius: 18px;
}

.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);
}

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

@media (max-width: 480px) {
    .pb-hero-export-label,
    .pb-hero-back span { display: none; }
    .pb-hero-export { padding: 8px 12px; }
    .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; }
}
