/* page: flipbook */

/* page: flipbook — page-specific styles only */

/* page: flipbook — extracted from flipbook.html; keep page-specific rules only */

/* ── Design tokens (shared with home.html) ───────────────────────────── */
:root {
    --teal:              #00A896;
    --teal-dark:         #088F7F;
    --burnt-orange:      #DD6F3E;
    --burnt-orange-dark: #C45E32;
    --deep-brown:        #3D2321;
    --sand-50:           #FDFAF4;
    --ease-out-expo:     ease;

    /* Copper palette */
    --copper-bg:    #E8D5B7;   /* light warm copper page background */
    --copper-mid:   #D4B896;   /* card borders / dividers */
    --copper-dark:  #B8956A;   /* accents on copper bg */
    --copper-deep:  #8B6914;   /* darker accent */
    --accent:       #C5A059;
    --paper:        #fdfaf3;
    --shadow:       rgba(61,35,33,0.18);

    /* Reader chrome */
    --ctrl-bg:  rgba(61,35,33,0.94);
    --ctrl-text: #f0ebe2;
    --ctrl-dim:  rgba(240,235,226,0.5);
    --ease:      ease;
}

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

html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }

body {
    background: var(--sand-50);
    color: var(--deep-brown);
    font-family: 'Lato', sans-serif;
    min-height: 100vh;
    overflow-x: hidden;
}

/* ── Page layout ─────────────────────────────────────────────────────── */
.page-hero {
    padding: 140px 5% 60px;
    text-align: center;
    background: linear-gradient(180deg, rgba(184,149,106,0.25) 0%, transparent 100%);
    border-bottom: 1px solid rgba(184,149,106,0.3);
}

.page-hero h1 {
    font-family: 'Playfair Display', serif;
    font-size: clamp(2rem, 5vw, 3.2rem);
    font-weight: 400;
    color: var(--deep-brown);
    letter-spacing: -0.02em;
    line-height: 1.15;
    margin-bottom: 0.6rem;
}

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

.page-hero p {
    font-size: 0.95rem;
    color: rgba(61,35,33,0.6);
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

/* ── Library screen ──────────────────────────────────────────────────── */
#library-screen { min-height: 60vh; }

/* Tab switcher */
.lib-tabs {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    padding: 0 5% 0;
    margin-bottom: 0.5rem;
}

.lib-tab {
    padding: 0.55rem 1.8rem;
    border-radius: 40px;
    border: 1.5px solid var(--copper-mid);
    background: transparent;
    color: var(--deep-brown);
    font-family: 'Lato', sans-serif;
    font-size: 0.82rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    cursor: pointer;
    transition: background 0.2s, color 0.2s, border-color 0.2s;
}

.lib-tab:hover { border-color: var(--accent); color: var(--accent); }

.lib-tab.active { background: var(--deep-brown); color: #fdfaf3; border-color: var(--deep-brown); }

/* ── Publication Cards — Magazine Mosaic (Bento Grid) ───────────────── */
.pub-section-title {
    font-family: 'Playfair Display', serif;
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--deep-brown);
    padding: 0 5%;
    max-width: 1200px;
    margin: 3rem auto 1.25rem;
    letter-spacing: -0.01em;
    border-left: 3px solid var(--accent);
    padding-left: calc(5% + 0.75rem);
}

.pub-section-title:first-of-type { margin-top: 1.5rem; }

/* Bento mosaic grid */
.pub-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    grid-auto-rows: 220px;
    gap: 1rem;
    padding: 0 5% 2.5rem;
    max-width: 1200px;
    margin: 0 auto;
}

/* First tile: 2 cols × 2 rows */
.pub-card:first-child { grid-column: span 2; grid-row: span 2; }

/* Every 4th tile: wide accent */
.pub-card:nth-child(4n) { grid-column: span 2; }

@media (max-width: 800px) {
  .pub-grid { grid-template-columns: repeat(2, 1fr); grid-auto-rows: 180px; }

  .pub-card:first-child { grid-column: span 2; grid-row: span 1; }

  .pub-card:nth-child(4n) { grid-column: span 1; }
}

@media (max-width: 500px) {
  .pub-grid { grid-template-columns: 1fr; grid-auto-rows: 160px; }

  .pub-card:first-child, .pub-card:nth-child(4n) { grid-column: span 1; }
}

/* Tile base */
.pub-card {
    position: relative;
    overflow: hidden;
    border-radius: 12px;
    cursor: pointer;
    color: white;
    background: linear-gradient(135deg, rgba(0,168,150,0.35), rgba(61,35,33,0.6));
    box-shadow: 0 3px 14px rgba(0,0,0,0.12);
    transition: transform 0.3s var(--ease), box-shadow 0.3s var(--ease);
    display: block;
    text-decoration: none;
}

.pub-card:hover { transform: scale(1.02); box-shadow: 0 10px 32px rgba(0,0,0,0.22); }

/* Background image layer */
.pub-tile-bg {
    position: absolute;
    inset: 0;
    background-size: cover;
    background-position: center;
    transition: transform 0.3s var(--ease);
}

.pub-card:hover .pub-tile-bg { transform: scale(1.06); }

/* Dark gradient overlay */
.pub-tile-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(to top, rgba(20,8,5,0.82) 0%, rgba(20,8,5,0.15) 55%, transparent 100%);
    z-index: 1;
}

/* Emoji/icon fallback */
.pub-tile-icon {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 4rem;
    opacity: 0.18;
    pointer-events: none;
}

.pub-card:first-child .pub-tile-icon { font-size: 7rem; }

/* Text body — overlaid at bottom */
.pub-card-body {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    top: 0;
    padding: 1.25rem 1.4rem;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    gap: 0.25rem;
    z-index: 2;
}

.pub-card-label {
    font-size: 0.65rem;
    font-weight: 800;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--teal);
    margin-bottom: 0.1rem;
}

.pub-card:first-child .pub-card-label { font-size: 0.72rem; }

.pub-card-title {
    font-family: 'Playfair Display', serif;
    font-size: 1rem;
    font-weight: 700;
    color: white;
    line-height: 1.2;
    margin: 0;
    text-shadow: 0 1px 4px rgba(0,0,0,0.5);
}

.pub-card:first-child .pub-card-title { font-size: clamp(1.3rem, 2.2vw, 1.8rem); }

.pub-card-date {
    font-size: 0.7rem;
    color: rgba(255,255,255,0.6);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* ── Press Links strip ──────────────────────────────────────────────── */
.pub-press-links {
    margin-top: auto;
    padding-top: 0.55rem;
    border-top: 1px solid rgba(255,255,255,0.12);
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.pub-press-label {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 0.56rem;
    font-weight: 800;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--teal, #00A896);
    opacity: 0.9;
}

.pub-press-label::before {
    content: '';
    width: 5px; height: 5px;
    border-radius: 50%;
    background: #C5A059;
    flex-shrink: 0;
}

.pub-press-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    align-items: center;
}

.pub-press-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    border-radius: 5px;
    font-size: 0.62rem;
    font-weight: 600;
    line-height: 1.5;
    color: rgba(255,255,255,0.92);
    background: rgba(255,255,255,0.1);
    border: 1px solid rgba(255,255,255,0.18);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    cursor: pointer;
    text-decoration: none;
    white-space: nowrap;
    transition: background 0.2s, color 0.2s, border-color 0.2s, transform 0.2s;
    max-width: 140px;
    overflow: hidden;
    text-overflow: ellipsis;
}

.pub-press-chip::before {
    content: '\f35d';
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
    font-size: 0.48rem;
    opacity: 0.5;
}

.pub-press-chip:hover {
    background: rgba(255,255,255,0.95);
    color: #1a0e0b;
    border-color: transparent;
    transform: translateY(-1px);
}

.pub-press-chip.overflow {
    background: rgba(184,149,106,0.18);
    border-color: rgba(184,149,106,0.35);
    color: rgba(255,255,255,0.6);
    cursor: default;
    pointer-events: none;
}

.pub-press-chip.overflow::before { display: none; }

/* PDF icon overlay on pub card */
.pub-pdf-pill {
    position: absolute;
    top: 10px;
    right: 10px;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 10px;
    border-radius: 999px;
    background: rgba(220,56,36,0.85);
    border: 1px solid rgba(255,255,255,0.25);
    color: #fff;
    font-size: 0.66rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    cursor: pointer;
    z-index: 3;
    transition: background 0.18s, transform 0.18s;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

.pub-pdf-pill:hover { background: rgba(220,56,36,1); transform: scale(1.06); }

.pub-pdf-pill i { font-size: 0.72rem; }

/* PDF reader modal */
.pub-pdf-modal {
    position: fixed;
    inset: 0;
    z-index: 1000;
    background: rgba(0,0,0,0.78);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    animation: fadeIn .18s ease;
}

@keyframes fadeIn { from { opacity:0 } to { opacity:1 } }

.pub-pdf-box {
    background: #fff;
    border-radius: 14px;
    width: min(900px, 96vw);
    height: min(88vh, 900px);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 24px 64px rgba(0,0,0,0.45);
}

.pub-pdf-hd {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 18px;
    border-bottom: 1px solid #e8e0d8;
    flex-shrink: 0;
    gap: 12px;
}

.pub-pdf-hd-title {
    font-family: 'Playfair Display', serif;
    font-size: 1rem;
    font-weight: 700;
    color: #3D2321;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
}

.pub-pdf-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.pub-pdf-dl {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 6px 12px;
    border-radius: 6px;
    background: #f3ede6;
    color: #3D2321;
    font-size: 0.78rem;
    font-weight: 600;
    text-decoration: none;
    border: 1px solid #d9cfc4;
    transition: background .0.3s;
}

.pub-pdf-dl:hover { background: #e9e0d5; }

.pub-pdf-close {
    background: none;
    border: none;
    cursor: pointer;
    color: #888;
    font-size: 1.1rem;
    padding: 4px 8px;
    border-radius: 6px;
    line-height: 1;
    transition: color .0.3s, background .15s;
}

.pub-pdf-close:hover { color: #3D2321; background: #f0e8e0; }

.pub-pdf-frame {
    flex: 1;
    border: none;
    width: 100%;
    background: #f8f5f0;
    display: block;
}

/* ── Professional Card Grid ────────────────────────────────────────── */
.lib-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 0.75rem;
    padding: 1.25rem 5% 3rem;
    max-width: 1300px;
    margin: 0 auto;
}

@media (min-width: 600px) {
  .lib-grid { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); }
}

@media (min-width: 900px) {
  .lib-grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 1rem; }
}

@media (min-width: 1200px) {
  .lib-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
}

.lib-card {
    background: rgba(255,252,245,0.97);
    border: 1px solid rgba(184,149,106,0.3);
    border-radius: 8px;
    overflow: hidden;
    transition: box-shadow 0.25s var(--ease), border-color 0.25s, transform 0.25s var(--ease);
    display: flex;
    flex-direction: column;
    box-shadow: 0 2px 6px rgba(61,35,33,0.07);
    cursor: pointer;
}

.lib-card:hover {
    box-shadow: 0 8px 22px rgba(61,35,33,0.13);
    border-color: var(--accent);
    transform: translateY(-3px);
}

.lib-card-cover {
    width: 100%;
    aspect-ratio: 3 / 4;
    background: linear-gradient(160deg, #e8d8bc 0%, #c9a87a 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    position: relative;
}

.lib-card-cover canvas {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.lib-card-cover .cover-placeholder {
    font-size: 3rem;
    opacity: 0.22;
}

.lib-card-body {
    padding: 0.6rem 0.65rem 0.7rem;
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 0.35rem;
    border-top: 1px solid rgba(184,149,106,0.18);
}

.lib-card-title {
    font-family: 'Playfair Display', serif;
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--deep-brown);
    line-height: 1.25;
    margin: 0;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.lib-card-meta {
    font-size: 0.58rem;
    color: rgba(61,35,33,0.5);
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.lib-card-btn {
    margin-top: 0.4rem;
    background: var(--deep-brown);
    color: var(--paper);
    border: none;
    border-radius: 4px;
    padding: 0.35rem 0.6rem;
    font-family: 'Lato', sans-serif;
    font-size: 0.58rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    cursor: pointer;
    transition: background 0.2s var(--ease);
    width: 100%;
    text-align: center;
}

.lib-card-btn:hover {
    background: var(--burnt-orange);
}

/* ── E-book Folder Cards ─────────────────────────────────────────────── */
.lib-folder-card {
    background: rgba(255,252,245,0.97);
    border: 1px solid rgba(184,149,106,0.3);
    border-radius: 10px;
    overflow: hidden;
    cursor: pointer;
    transition: transform 0.25s var(--ease), box-shadow 0.25s var(--ease), border-color 0.25s;
    box-shadow: 0 2px 8px rgba(61,35,33,0.06);
    display: flex;
    flex-direction: column;
}

.lib-folder-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 32px rgba(61,35,33,0.12);
    border-color: var(--teal);
}

.lib-folder-cover {
    position: relative;
    height: 180px;
    background: linear-gradient(135deg, var(--copper-bg) 0%, var(--copper-mid) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.lib-folder-cover img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.lib-folder-icon {
    font-size: 4rem;
    color: #fff;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
}

.lib-folder-icon i {
    display: block;
    text-shadow: 0 2px 8px rgba(0,0,0,0.2);
    font-size: 5rem;
}

.lib-folder-badge {
    position: absolute;
    top: 10px;
    right: 10px;
    background: var(--deep-brown);
    color: #fff;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.lib-folder-info {
    padding: 0.9rem 1rem;
}

.lib-folder-title {
    font-family: 'Playfair Display', serif;
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--deep-brown);
    margin-bottom: 0.25rem;
    line-height: 1.3;
}

.lib-folder-langs {
    font-size: 0.72rem;
    color: var(--copper-deep);
    font-weight: 500;
}

/* ── Folder Modal ────────────────────────────────────────────────────── */
.folder-modal {
    position: fixed;
    inset: 0;
    z-index: 2000;
    background: rgba(0,0,0,0.6);
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

.folder-modal.open {
    display: flex;
}

.folder-modal-box {
    background: var(--paper);
    border-radius: 14px;
    width: min(400px, 94vw);
    max-height: 80vh;
    overflow: hidden;
    box-shadow: 0 24px 64px rgba(0,0,0,0.35);
    animation: folderModalIn 0.3s var(--ease);
}

@keyframes folderModalIn {
    from { opacity: 0; transform: scale(0.95) translateY(20px); }
    to { opacity: 1; transform: scale(1) translateY(0); }
}

.folder-modal-hd {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--copper-mid);
    background: linear-gradient(135deg, var(--sand-50), var(--paper));
}

.folder-modal-hd h3 {
    font-family: 'Playfair Display', serif;
    font-size: 1.1rem;
    color: var(--deep-brown);
    margin: 0;
}

.folder-modal-close {
    background: none;
    border: none;
    font-size: 1.6rem;
    color: var(--copper-dark);
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background 0.2s;
    line-height: 1;
}

.folder-modal-close:hover {
    background: var(--copper-bg);
}

.folder-modal-body {
    padding: 0.6rem;
    overflow-y: auto;
    max-height: calc(80vh - 70px);
}

.folder-lang-btn {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0.85rem 1rem;
    margin-bottom: 0.6rem;
    background: #fff;
    border: 1.5px solid var(--copper-mid);
    border-radius: 8px;
    cursor: pointer;
    transition: background .25s ease, color .25s ease, box-shadow .25s ease, transform .25s ease;
    text-align: left;
}

.folder-lang-btn:hover {
    border-color: var(--teal);
    background: rgba(0,168,150,0.04);
    transform: translateX(4px);
}

.folder-lang-thumb {
    width: 50px;
    height: 65px;
    object-fit: cover;
    border-radius: 4px;
    background: var(--copper-bg);
    flex-shrink: 0;
}

.folder-lang-thumb-placeholder {
    width: 50px;
    height: 65px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 4px;
    flex-shrink: 0;
    color: #fff;
    font-size: 1.5rem;
}

.folder-lang-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.folder-lang-name {
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--deep-brown);
}

.folder-lang-meta {
    font-size: 0.75rem;
    color: var(--copper-deep);
}

.folder-lang-btn i {
    color: var(--teal);
    font-size: 0.85rem;
}

.lib-empty, .lib-loading {
    grid-column: 1/-1; text-align: center;
    padding: 5rem 2rem; color: rgba(61,35,33,0.5);
}

.lib-empty h3 { font-family: 'Playfair Display', serif; font-size: 1.5rem; margin-bottom: 0.75rem; color: var(--deep-brown); }

/* ── Reader overlay ──────────────────────────────────────────────────── */
#reader-screen {
    position: fixed; inset: 0;
    display: none;
    flex-direction: column;
    background: #1a1612;
    z-index: 500;
}

/* Top bar */
#reader-bar {
    height: 54px;
    background: var(--ctrl-bg);
    border-bottom: 1px solid rgba(197,160,89,0.18);
    display: flex; align-items: center;
    padding: 0 0.8rem; gap: 0.5rem;
    flex-shrink: 0;
    backdrop-filter: blur(8px);
    z-index: 10;
}

.bar-btn {
    background: none;
    border: 1px solid rgba(197,160,89,0.28);
    color: var(--ctrl-text);
    border-radius: 6px;
    width: 34px; height: 34px;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer; font-size: 1rem;
    transition: background 0.15s, border-color 0.15s, color 0.15s;
    flex-shrink: 0;
}

.bar-btn:hover { background: rgba(197,160,89,0.15); border-color: var(--accent); color: var(--accent); }

.bar-btn:disabled { opacity: 0.3; cursor: default; }

.bar-btn.active { background: rgba(197,160,89,0.2); border-color: var(--accent); color: var(--accent); }

.bar-title { font-family: 'Playfair Display', serif; font-size: 0.88rem; color: var(--ctrl-text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex: 1; padding: 0 0.3rem; }

.bar-page-info { font-size: 0.7rem; color: var(--ctrl-dim); white-space: nowrap; letter-spacing: 0.06em; }

.bar-sep { width: 1px; height: 22px; background: rgba(197,160,89,0.15); flex-shrink: 0; }

#zoom-display { font-size: 0.7rem; color: var(--accent); min-width: 40px; text-align: center; letter-spacing: 0.04em; }

#page-jump {
    width: 46px;
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(197,160,89,0.28);
    border-radius: 4px;
    color: var(--ctrl-text);
    font-family: 'Lato', sans-serif; font-size: 0.75rem;
    text-align: center; padding: 0.28rem;
    outline: none;
}

#page-jump:focus { border-color: var(--accent); }

/* Viewport */
#pdf-viewport {
    flex: 1;
    overflow: auto;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: 1.5rem 1rem;
    background: #141210;
    position: relative;
}

#spread-wrap {
    display: flex;
    gap: 3px;
    align-items: flex-start;
    transition: opacity 0.25s;
}

#spread-wrap.single { justify-content: center; }

.pdf-page-wrap {
    position: relative; flex-shrink: 0;
    box-shadow: 0 8px 48px rgba(0,0,0,0.7), 0 2px 8px rgba(0,0,0,0.5);
    background: var(--paper); line-height: 0;
}

.pdf-page-wrap canvas { display: block; max-width: 100%; }

/* Bottom nav */
#nav-strip {
    height: 56px;
    background: var(--ctrl-bg);
    border-top: 1px solid rgba(197,160,89,0.12);
    display: flex; align-items: center; justify-content: center;
    gap: 1rem; flex-shrink: 0;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    position: relative;
}

/* Small floating nav buttons */
.floating-nav-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(61,35,33,0.85);
    border: 1px solid rgba(197,160,89,0.3);
    color: #f0ebe2;
    font-size: 1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background .25s ease, color .25s ease, box-shadow .25s ease, transform .25s ease ease;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 5;
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
    opacity: 0.6;
}

.floating-nav-btn:hover {
    background: rgba(197,160,89,0.9);
    transform: translateY(-50%) scale(1.1);
    box-shadow: 0 4px 12px rgba(0,0,0,0.4);
    opacity: 1;
}

.floating-nav-btn:active {
    transform: translateY(-50%) scale(0.95);
}

.floating-nav-prev {
    left: 10px;
}

.floating-nav-next {
    right: 10px;
}

.nav-strip-btn {
    background: var(--accent); border: none; color: #1c1a17;
    border-radius: 6px; padding: 0.55rem 1.6rem;
    font-family: 'Lato', sans-serif; font-size: 0.73rem; font-weight: 700;
    text-transform: uppercase; letter-spacing: 0.12em;
    cursor: pointer; transition: background 0.18s, transform 0.18s;
    display: flex; align-items: center; gap: 0.5rem;
}

.nav-strip-btn:hover { background: #d4b06a; transform: translateY(-1px); }

.nav-strip-btn:disabled { background: rgba(197,160,89,0.3); color: rgba(28,26,23,0.5); cursor: default; transform: none; }

/* Exit button styling */
#btn-exit {
    background: rgba(220,56,36,0.9) !important;
    color: #fff !important;
    transition: background .25s ease, color .25s ease, box-shadow .25s ease, transform .25s ease ease;
}

#btn-exit:hover {
    background: rgba(220,56,36,1) !important;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(220,56,36,0.4);
}

.nav-strip-info { font-size: 0.76rem; color: var(--ctrl-dim); min-width: 90px; text-align: center; letter-spacing: 0.05em; }

/* Loader */
#pdf-loader {
    position: absolute; inset: 0;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    background: #141210; z-index: 5; gap: 1rem;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* Thumbnail panel */
#thumb-panel {
    position: fixed; right: 0; top: 54px; bottom: 56px;
    width: 140px;
    background: rgba(20,18,16,0.97);
    border-left: 1px solid rgba(197,160,89,0.12);
    overflow-y: auto; z-index: 20;
    display: none; flex-direction: column; gap: 6px; padding: 8px;
    backdrop-filter: blur(8px);
}

#thumb-panel.open { display: flex; }

.thumb-item { cursor: pointer; border: 2px solid transparent; border-radius: 4px; overflow: hidden; background: #222; flex-shrink: 0; transition: border-color 0.2s; }

.thumb-item.active { border-color: var(--accent); }

.thumb-item:hover { border-color: rgba(197,160,89,0.5); }

.thumb-item canvas { display: block; width: 100%; height: auto; }

.thumb-label { font-size: 0.58rem; text-align: center; color: var(--ctrl-dim); padding: 2px 0 4px; }

/* Flip hint */
.flip-hint { position: absolute; bottom: 70px; left: 50%; transform: translateX(-50%); font-size: 0.63rem; color: var(--ctrl-dim); letter-spacing: 0.12em; text-transform: uppercase; pointer-events: none; opacity: 0; animation: fadeHint 3.5s 1.8s ease-out forwards; }

@keyframes fadeHint { 0% { opacity: 0; transform: translateX(-50%) translateY(4px); } 20% { opacity: 1; transform: translateX(-50%) translateY(0); } 80% { opacity: 1; } 100% { opacity: 0; } }

/* Fullscreen */
:fullscreen #reader-bar, :fullscreen #nav-strip { background: rgba(20,18,16,0.98); }

/* ── Ticket footer (identical to home.html) ──────────────────────────── */
:root {
    --lj-earth:     #3D2321;
    --lj-paper:     #F2EFE9;
    --lj-accent:    #C5A059;
    --lj-ink-light: rgba(61,35,33,0.6);
    --font-footer:  'Lato', sans-serif;
}

.legal-links { display: flex; gap: 1.5rem; }

.legal-links a, .ddx-attr a { color: var(--lj-earth); text-decoration: none; font-weight: 700; }

.legal-links a:hover, .ddx-attr a:hover { text-decoration: underline; }

.giraffe { display: inline-block; transition: transform 0.3s ease; }

.ddx-attr:hover .giraffe { transform: translateY(-3px) scale(1.1); }

.stub-title { font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.15em; font-weight: 900; margin: 0 0 0.5rem; color: var(--lj-accent); }

.stub-heading { font-size: 1.5rem; font-weight: 300; margin: 0 0 1.5rem; line-height: 1.2; }

.stub-form { display: flex; flex-direction: column; gap: 1rem; }

.stub-form input { background: transparent; border: none; border-bottom: 2px solid rgba(61,35,33,0.2); padding: 0.5rem 0; font-family: var(--font-footer); font-size: 0.95rem; color: var(--lj-earth); outline: none; transition: border-color 0.3s ease; }

.stub-form input:focus { border-color: var(--lj-earth); }

.stub-form input::placeholder { color: var(--lj-ink-light); font-style: italic; }

.stub-form button { background-color: transparent; color: var(--lj-earth); border: 2px solid var(--lj-earth); padding: 0.6rem; border-radius: 6px; font-family: var(--font-footer); font-weight: 700; text-transform: uppercase; letter-spacing: 0.1em; cursor: pointer; transition: background .25s ease, color .25s ease, box-shadow .25s ease, transform .25s ease ease; }

.stub-form button:hover { background-color: var(--lj-earth); color: var(--lj-paper); }

.barcode { margin-top: 2rem; height: 30px; width: 100%; background: linear-gradient(90deg, var(--lj-earth) 0%, var(--lj-earth) 5%, transparent 5%, transparent 8%, var(--lj-earth) 8%, var(--lj-earth) 10%, transparent 10%, transparent 15%, var(--lj-earth) 15%, var(--lj-earth) 22%, transparent 22%, transparent 24%, var(--lj-earth) 24%, var(--lj-earth) 26%, transparent 26%, transparent 30%, var(--lj-earth) 30%, var(--lj-earth) 32%, transparent 32%, transparent 35%, var(--lj-earth) 35%, var(--lj-earth) 45%, transparent 45%, transparent 48%, var(--lj-earth) 48%, var(--lj-earth) 50%, transparent 50%, transparent 55%, var(--lj-earth) 55%, var(--lj-earth) 60%, transparent 60%, transparent 62%, var(--lj-earth) 62%, var(--lj-earth) 70%, transparent 70%, transparent 75%, var(--lj-earth) 75%, var(--lj-earth) 77%, transparent 77%, transparent 80%, var(--lj-earth) 80%, var(--lj-earth) 85%, transparent 85%, transparent 88%, var(--lj-earth) 88%, var(--lj-earth) 95%, transparent 95%, transparent 97%, var(--lj-earth) 97%, var(--lj-earth) 100%); opacity: 0.3; }

@media (max-width: 768px) {
  .bar-title { display: none; }

  #pdf-viewport { padding: 0.5rem; }

  /* Force single page mode on mobile */
    #spread-wrap {
        flex-direction: column;
        gap: 0;
    }

  #spread-wrap.single { justify-content: center; }

  .pdf-page-wrap {
        width: 100%;
        max-width: 100vw;
    }

  .pdf-page-wrap canvas {
        width: 100% !important;
        height: auto !important;
    }

  /* Hide right page on mobile by default */
    #page-right { display: none !important; }

  /* Make reader fullscreen-friendly on mobile */
    #reader-screen {
        position: fixed;
        inset: 0;
        width: 100vw;
        height: 100vh;
    }

  /* Larger touch-friendly nav buttons on mobile */
    .nav-strip-btn {
        padding: 12px 20px;
        font-size: 0.9rem;
        min-height: 44px;
    }

  /* Floating nav buttons on mobile */
    .floating-nav-btn {
        width: 44px;
        height: 44px;
        font-size: 1.1rem;
    }

  .floating-nav-prev {
        left: 8px;
    }

  .floating-nav-next {
        right: 8px;
    }

  .bar-btn {
        min-width: 36px;
        min-height: 36px;
        padding: 8px;
    }

  .stub-heading {
        font-size: 1.35rem;
        margin-bottom: 1.25rem;
    }

  .stub-form input {
        font-size: 0.9rem;
        padding: 0.6rem 0;
    }

  .stub-form button {
        padding: 0.7rem;
        font-size: 0.85rem;
    }

  /* E-books cards on mobile */
    .lib-grid {
        flex-direction: column;
        padding: 1.5rem 4% 3rem;
        gap: 1.5rem;
    }

  .lib-card {
        flex-direction: column;
        min-height: auto;
    }

  .lib-card-cover {
        width: 100%;
        min-width: 100%;
        height: 200px;
    }

  .lib-card-title {
        font-size: 1.1rem;
    }

  /* Publications grid on mobile */
    .pub-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
        padding: 0 4% 2rem;
    }

  .pub-section-title {
        font-size: 1.2rem;
        padding: 0 4%;
    }

  /* Better tab arrangement for mobile - all visible together */
    .lib-tabs {
        gap: 0.35rem;
        padding: 0 3%;
        margin-bottom: 0.75rem;
    }

  .lib-tab {
        padding: 0.5rem 1rem;
        font-size: 0.7rem;
        flex: 1;
        text-align: center;
        white-space: nowrap;
    }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
