/* ==========================================================================
   Minimalist Living Cover & Clean PDF Book Reader
   For "A Physical Theory of Intelligence" — Peter David Fagan
   ========================================================================== */

/* ── 3D Book Hinge Opening on index.html ── */
.book-3d-card.opening {
    transition: transform 1.15s cubic-bezier(0.22, 1, 0.36, 1) !important;
    transform: translateX(104px) rotateX(-2deg) rotateY(-10deg) scale(0.98) !important;
}

@media (max-width: 860px) {
    .book-3d-card.opening {
        transform: translateX(96px) rotateX(-2deg) rotateY(-10deg) scale(0.94) !important;
    }
}

.book-front {
    transform-origin: left center;
    transition: transform 1.3s cubic-bezier(0.22, 1, 0.36, 1);
    transform-style: preserve-3d;
    backface-visibility: visible !important;
    -webkit-backface-visibility: visible !important;
    background: none !important;
    box-shadow: none !important;
}

.book-front::after {
    display: none !important;
}

.book-front.opened {
    transform: translateZ(18px) rotateY(-176deg) !important;
}

.book-front-cover {
    position: absolute;
    inset: 0;
    background-size: cover;
    background-position: center;
    border-radius: 2px;
    transform: translateZ(0.5px);
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.15);
}

.book-front-cover::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 2px;
    background:
        linear-gradient(
            90deg,
            rgba(255, 255, 255, 0.22) 0px,
            rgba(255, 255, 255, 0.05) 2px,
            rgba(0, 0, 0, 0.38) 6px,
            rgba(0, 0, 0, 0.18) 9px,
            rgba(255, 255, 255, 0.10) 11px,
            transparent 16px
        ),
        linear-gradient(
            115deg,
            rgba(255, 255, 255, 0.14) 0%,
            rgba(255, 255, 255, 0.03) 30%,
            transparent 60%
        );
    pointer-events: none;
}

.book-inside-left {
    position: absolute;
    inset: 0;
    background-image: url('images/page_3_title_clean.png');
    background-size: cover;
    background-position: center;
    transform: rotateY(180deg) translateZ(0.5px);
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    border-radius: 2px;
    box-shadow: inset -12px 0 18px -6px rgba(0, 0, 0, 0.22);
}

.book-inside-right {
    position: absolute;
    width: 260px;
    height: 390px;
    left: 0;
    top: 0;
    transform: translateZ(17px);
    background-image: url('images/page_8_contents_clean.png');
    background-size: cover;
    background-position: center;
    border-radius: 2px;
    box-shadow: inset 12px 0 18px -6px rgba(0, 0, 0, 0.18), inset 0 0 0 1px rgba(0, 0, 0, 0.08);
    pointer-events: none;
}

.book-3d-hint-interactive {
    margin-top: 38px;
    font-size: 0.85rem;
    color: #0b1d3a;
    letter-spacing: 0.04em;
    font-weight: 600;
    background: rgba(255, 255, 255, 0.88);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    padding: 10px 22px;
    border-radius: 24px;
    border: 1px solid rgba(11, 29, 58, 0.18);
    box-shadow: 0 4px 14px rgba(11, 29, 58, 0.07);
    transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
    user-select: none;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 10px;
}

.book-3d-hint-interactive:hover {
    background: #0b1d3a;
    color: #ffffff !important;
    border-color: #0b1d3a;
    box-shadow: 0 8px 24px rgba(11, 29, 58, 0.2);
    transform: translateY(-2px);
}

.book-3d-hint-interactive:hover span {
    color: #ffffff !important;
}

/* ==========================================================================
   Full-Viewport Experience Root
   ========================================================================== */
.pti-experience-backdrop {
    position: fixed;
    inset: 0;
    z-index: 10000;
    background: #0b1933;
    color: #ffffff;
    font-family: -apple-system, BlinkMacSystemFont, 'Lato', sans-serif;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.4s cubic-bezier(0.16, 1, 0.3, 1), visibility 0.4s ease;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.pti-experience-backdrop.active {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

/* ==========================================================================
   PHASE 1: VISUAL-FIRST MINIMALIST LIVING COVER
   ========================================================================== */
.pti-living-cover {
    position: relative;
    width: 100%;
    height: 100%;
    background: #0b1933;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: space-between;
    padding: 36px 24px 36px 24px;
    box-sizing: border-box;
    overflow: hidden;
    user-select: none;
    transition: opacity 0.4s ease, transform 0.5s cubic-bezier(0.22, 1, 0.36, 1);
}

.pti-living-cover.exiting-to-reader {
    opacity: 0;
    transform: scale(1.02);
    pointer-events: none;
}

.pti-lc-close-btn {
    position: absolute;
    top: 22px;
    right: 26px;
    z-index: 30;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, 0.14);
    background: transparent;
    color: rgba(255, 255, 255, 0.55);
    font-size: 20px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
}

.pti-lc-close-btn:hover {
    color: #ffffff;
    border-color: rgba(255, 255, 255, 0.45);
    background: rgba(255, 255, 255, 0.06);
}

.pti-living-canvas-stage {
    flex: 1;
    width: 100%;
    min-height: 0;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.pti-living-canvas {
    width: 100%;
    height: 100%;
    display: block;
}

.pti-lc-minimal-footer {
    flex-shrink: 0;
    z-index: 20;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
    min-height: 44px;
    justify-content: center;
}

.pti-lc-progress-dots {
    display: flex;
    align-items: center;
    gap: 10px;
}

.pti-lc-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    padding: 0;
    border: 1px solid rgba(255, 255, 255, 0.3);
    background: transparent;
    cursor: pointer;
    transition: all 0.25s ease;
}

.pti-lc-dot:hover {
    border-color: rgba(255, 255, 255, 0.75);
}

.pti-lc-dot.active {
    background: #ffffff;
    border-color: #ffffff;
    transform: scale(1.2);
}

.pti-lc-minimal-enter-btn {
    font-family: -apple-system, BlinkMacSystemFont, 'Lato', sans-serif;
    font-size: 12px;
    font-weight: 500;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: #0b1933;
    background: #ffffff;
    border: none;
    padding: 8px 20px;
    border-radius: 18px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.pti-lc-minimal-enter-btn:hover {
    background: rgba(255, 255, 255, 0.9);
    transform: translateY(-1px);
}

/* ==========================================================================
   PHASE 2: MINIMALIST PDF BOOK READER
   ========================================================================== */
.pti-reader-shell {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    background: #0b1933;
    color: #f3f5f8;
    overflow: hidden;
}

/* ── Whisper-Quiet Top Bar ── */
.pti-reader-toolbar {
    height: 44px;
    flex-shrink: 0;
    background: #0b1933;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 22px;
    gap: 16px;
    z-index: 30;
    user-select: none;
}

.pti-reader-toolbar-left {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: flex-start;
}

.pti-reader-toolbar-center {
    display: flex;
    align-items: center;
    gap: 24px;
}

.pti-reader-toolbar-right {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 18px;
}

.pti-min-btn {
    border: none;
    background: transparent;
    font-family: inherit;
    font-size: 12px;
    font-weight: 500;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.55) !important;
    padding: 4px 0;
    cursor: pointer;
    text-decoration: none !important;
    border-bottom: 1px solid transparent;
    transition: color 0.18s ease, border-color 0.18s ease;
    white-space: nowrap;
}

.pti-min-btn:hover {
    color: rgba(255, 255, 255, 0.92) !important;
}

.pti-min-btn.active {
    color: #ffffff !important;
    border-bottom-color: rgba(255, 255, 255, 0.65);
}

.pti-min-modes {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.pti-min-mode {
    border: none;
    background: transparent;
    font-family: inherit;
    font-size: 12px;
    font-weight: 500;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.45);
    padding: 4px 0;
    border-bottom: 1px solid transparent;
    cursor: pointer;
    transition: color 0.18s ease, border-color 0.18s ease;
}

.pti-min-mode:hover {
    color: rgba(255, 255, 255, 0.82);
}

.pti-min-mode.active {
    color: #ffffff;
    border-bottom-color: rgba(255, 255, 255, 0.7);
}

.pti-min-sep {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.22);
}

.pti-page-nav-group {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-variant-numeric: tabular-nums;
}

.pti-min-icon {
    width: 24px;
    height: 24px;
    border: none;
    background: transparent;
    color: rgba(255, 255, 255, 0.55);
    font-size: 16px;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    padding: 0;
    transition: color 0.15s ease;
}

.pti-min-icon:hover:not(:disabled) {
    color: #ffffff;
}

.pti-min-icon:disabled {
    opacity: 0.22;
    cursor: default;
}

.pti-min-icon.close {
    font-size: 20px;
    width: 26px;
    height: 26px;
    margin-left: 2px;
}

.pti-page-input {
    background: transparent;
    border: none;
    border-bottom: 1px solid transparent;
    color: rgba(255, 255, 255, 0.88);
    font-family: inherit;
    font-size: 12.5px;
    font-variant-numeric: tabular-nums;
    text-align: right;
    padding: 2px 1px;
    outline: none;
    transition: border-color 0.15s ease, color 0.15s ease;
}

.pti-page-input:hover {
    color: #ffffff;
    border-bottom-color: rgba(255, 255, 255, 0.25);
}

.pti-page-input:focus {
    color: #ffffff;
    border-bottom-color: rgba(255, 255, 255, 0.75);
}

.pti-page-total {
    font-size: 12.5px;
    color: rgba(255, 255, 255, 0.42);
}

.pti-zoom-controls {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    font-variant-numeric: tabular-nums;
}

.pti-zoom-label {
    border: none;
    background: transparent;
    color: rgba(255, 255, 255, 0.52);
    font-family: inherit;
    font-size: 11.5px;
    min-width: 38px;
    text-align: center;
    cursor: pointer;
    padding: 2px 3px;
    transition: color 0.15s ease;
}

.pti-zoom-label:hover {
    color: #ffffff;
}

/* ── Main Reader Workspace ── */
.pti-reader-workspace {
    flex: 1;
    display: flex;
    overflow: hidden;
    position: relative;
}

/* ── Minimal Contents Drawer ── */
.pti-reader-sidebar {
    width: 264px;
    flex-shrink: 0;
    background: #09152b;
    border-right: 1px solid rgba(255, 255, 255, 0.06);
    display: flex;
    flex-direction: column;
    transition: margin-left 0.25s cubic-bezier(0.16, 1, 0.3, 1);
    z-index: 25;
}

.pti-reader-sidebar.collapsed {
    margin-left: -264px;
}

.pti-sidebar-toc-list {
    flex: 1;
    overflow-y: auto;
    padding: 16px 14px 28px 14px;
    display: flex;
    flex-direction: column;
    gap: 1px;
}

.pti-toc-item {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 10px;
    width: 100%;
    text-align: left;
    border: none;
    background: transparent;
    cursor: pointer;
    border-radius: 4px;
    padding: 7px 10px;
    transition: color 0.15s ease, background 0.15s ease;
    color: rgba(255, 255, 255, 0.62);
    font-family: inherit;
    font-size: 12.5px;
}

.pti-toc-item:hover {
    color: rgba(255, 255, 255, 0.95);
    background: rgba(255, 255, 255, 0.04);
}

.pti-toc-item.active {
    color: #ffffff;
    background: rgba(255, 255, 255, 0.08);
    font-weight: 500;
}

.pti-toc-item.level-part {
    margin-top: 14px;
    font-size: 10.5px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: rgba(255, 255, 255, 0.38);
}

.pti-toc-page-num {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.32);
    flex-shrink: 0;
    font-variant-numeric: tabular-nums;
}

/* ── Main PDF Stage ── */
.pti-reader-stage {
    flex: 1;
    overflow: auto;
    overflow-anchor: none;
    display: flex;
    padding: 18px 16px;
    box-sizing: border-box;
    position: relative;
}

.pti-reader-stage.scroll-mode {
    align-items: flex-start;
}

.pti-reader-loading {
    margin: auto;
    font-size: 13px;
    letter-spacing: 0.04em;
    color: rgba(255, 255, 255, 0.45);
}

/* ── Continuous Scroll Stack ── */
.pti-scroll-stack {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    padding: 0 0 36px 0;
    margin: 0 auto;
    min-width: 100%;
    width: max-content;
}

.pti-scroll-page-card {
    background: #ffffff;
    border-radius: 2px;
    box-shadow: 0 12px 36px rgba(0, 0, 0, 0.38);
    overflow: hidden;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ── 2-Page Book Spread Container ── */
.pti-book-spread {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin: auto;
    flex-shrink: 0;
    background: #ffffff;
    border-radius: 2px;
    box-shadow: 0 20px 52px rgba(0, 0, 0, 0.48);
}

.pti-page-slot {
    position: relative;
    background: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    cursor: pointer;
}

.pti-page-slot canvas {
    display: block;
}

.pti-spine-crease {
    width: 1px;
    align-self: stretch;
    background: rgba(0, 0, 0, 0.14);
    position: relative;
    z-index: 5;
}

.pti-spine-crease::before {
    content: '';
    position: absolute;
    top: 0;
    bottom: 0;
    left: -18px;
    width: 36px;
    background: linear-gradient(
        90deg,
        rgba(0, 0, 0, 0) 0%,
        rgba(0, 0, 0, 0.05) 46%,
        rgba(0, 0, 0, 0.12) 50%,
        rgba(0, 0, 0, 0.04) 54%,
        rgba(0, 0, 0, 0) 100%
    );
    pointer-events: none;
}

.pti-spread-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 36px;
    height: 48px;
    border: none;
    background: transparent;
    color: rgba(255, 255, 255, 0.32);
    font-size: 26px;
    font-weight: 300;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 15;
    transition: color 0.18s ease, transform 0.18s ease;
}

.pti-spread-arrow:hover {
    color: rgba(255, 255, 255, 0.92);
    transform: translateY(-50%) scale(1.08);
}

.pti-spread-arrow.left {
    left: -46px;
}

.pti-spread-arrow.right {
    right: -46px;
}

/* ── Responsive Adjustments ── */
@media (max-width: 900px) {
    .pti-reader-sidebar {
        position: absolute;
        top: 0;
        bottom: 0;
        left: 0;
    }

    .pti-spread-arrow.left {
        left: -34px;
    }

    .pti-spread-arrow.right {
        right: -34px;
    }
}

@media (max-width: 640px) {
    .hide-mobile {
        display: none !important;
    }

    .pti-reader-toolbar {
        padding: 0 12px;
        gap: 8px;
    }

    .pti-reader-toolbar-center {
        gap: 14px;
    }
}

