/* Kitap / page-flip görünümü */
html.book-mode,
body.book-mode {
    overflow-x: hidden;
    max-width: 100%;
}

body.book-mode {
    background:
        radial-gradient(900px 420px at 15% 0%, rgba(45, 138, 62, 0.14), transparent 55%),
        radial-gradient(700px 380px at 95% 8%, rgba(10, 37, 64, 0.1), transparent 50%),
        linear-gradient(180deg, #eef3f6 0%, #dfe7ec 100%);
}

/* Kıvırma sırasında kütüphane taşıyor — belge kaydırılmasın */
body.book-mode.book-flipping {
    overflow: hidden !important;
}

body.book-mode .site-main {
    padding-top: 1rem;
    padding-bottom: 2.5rem;
    overflow-x: hidden;
    max-width: 100%;
}

.book-shell {
    width: min(1100px, calc(100% - 1.25rem));
    max-width: 100%;
    margin: 0 auto;
}

/* Tam ekran: yalnızca sözlük (akıllı tahta) */
.book-shell:fullscreen,
.book-shell:-webkit-full-screen {
    width: 100%;
    max-width: none;
    margin: 0;
    min-height: 100%;
    padding: 1rem 1.25rem 1.25rem;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    background:
        radial-gradient(1000px 480px at 12% 0%, rgba(45, 138, 62, 0.16), transparent 55%),
        radial-gradient(800px 400px at 100% 0%, rgba(10, 37, 64, 0.12), transparent 50%),
        linear-gradient(180deg, #e8eef2 0%, #d4dde4 100%);
}

.book-shell:fullscreen .book-toolbar,
.book-shell:-webkit-full-screen .book-toolbar {
    margin-bottom: 0.5rem;
    flex-shrink: 0;
}

.book-shell:fullscreen .book-toolbar-note,
.book-shell:-webkit-full-screen .book-toolbar-note,
.book-shell:fullscreen .book-toolbar-extra,
.book-shell:-webkit-full-screen .book-toolbar-extra,
.book-shell:fullscreen .book-hint,
.book-shell:-webkit-full-screen .book-hint {
    display: none;
}

.book-shell:fullscreen .book-stage,
.book-shell:-webkit-full-screen .book-stage {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 0;
    padding: 0.25rem 0;
}

.book-shell:fullscreen #book,
.book-shell:-webkit-full-screen #book {
    box-shadow: 0 18px 48px rgba(10, 37, 64, 0.18);
}

.book-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 0.85rem;
}

.book-toolbar h1 {
    margin: 0;
    font-size: clamp(1.2rem, 2.5vw, 1.55rem);
    letter-spacing: -0.02em;
}

.book-controls {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.45rem;
}

.book-controls .page-indicator {
    min-width: 5.5rem;
    text-align: center;
    font-size: 0.9rem;
    color: rgba(28, 42, 34, 0.7);
}

.book-stage {
    display: flex;
    justify-content: center;
    align-items: flex-start;
    width: 100%;
    max-width: 100%;
    padding: 0.5rem 0 1rem;
    box-sizing: border-box;
    /* Kıvırma taşmasını sayfada tut; çift sayfa genişliğine izin ver */
    overflow-x: hidden;
    overflow-y: visible;
}

#book {
    margin: 0 auto;
    box-shadow: 0 14px 36px rgba(28, 42, 34, 0.12);
    flex-shrink: 0;
}

/* Kıvırırken body kaydırılmasın; stage içinde kes */
body.book-mode.book-flipping .book-stage {
    overflow: hidden;
}

/* Fihrist satırları — tıklanabilir alan net olsun */
.fihrist-link {
    width: 100%;
    border-radius: 6px;
    padding: 0.28rem 0.2rem !important;
}
.fihrist-link:hover {
    background: rgba(47, 107, 79, 0.08);
}
.fihrist-link:focus {
    outline: 2px solid rgba(47, 107, 79, 0.35);
    outline-offset: 1px;
}

/* Sayfa yüzeyi */
.page {
    background: #fbf7ee;
    color: #1c2a22;
    border: 1px solid rgba(28, 42, 34, 0.08);
    overflow: hidden;
}

.page.--left { border-right: 0; }
.page.--right { border-left: 0; }

.page-inner {
    height: 100%;
    padding: 1.35rem 1.45rem 1.6rem;
    display: flex;
    flex-direction: column;
    box-sizing: border-box;
    background:
        linear-gradient(90deg, rgba(28, 42, 34, 0.04), transparent 18px),
        repeating-linear-gradient(
            0deg,
            transparent,
            transparent 27px,
            rgba(47, 107, 79, 0.04) 28px
        ),
        #fbf7ee;
}

.page-cover .page-inner {
    background:
        linear-gradient(165deg, #0a2540 0%, #0d3358 45%, #061a2e 100%);
    color: #f4f7f5;
    justify-content: center;
    text-align: center;
    padding: 1.5rem 1.4rem;
}

.page-cover .cover-logo {
    width: min(120px, 42%);
    height: auto;
    margin: 0 auto 0.85rem;
    display: block;
    filter: drop-shadow(0 6px 14px rgba(0, 0, 0, 0.25));
    background: #fff;
    border-radius: 50%;
    padding: 0.35rem;
}

.page-cover h2 {
    margin: 0 0 0.5rem;
    font-size: clamp(1.6rem, 3vw, 2.2rem);
    line-height: 1.15;
}

.page-cover .cover-sub {
    margin: 0 0 1.25rem;
    opacity: 0.9;
    font-size: 1.02rem;
}

.page-cover .cover-meta {
    margin-top: auto;
    font-size: 0.92rem;
    line-height: 1.5;
    opacity: 0.92;
}

.page-kicker {
    font-size: 0.78rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: #2d8a3e;
    margin: 0 0 0.55rem;
    font-weight: 700;
}

.page h2 {
    margin: 0 0 0.65rem;
    font-size: 1.35rem;
    line-height: 1.2;
}

.page h3.word-head {
    margin: 0 0 0.35rem;
    font-size: clamp(1.55rem, 3vw, 2.1rem);
    color: #0a2540;
    font-family: Georgia, "Times New Roman", serif;
}

.page .source-chip {
    display: inline-block;
    margin-bottom: 0.55rem;
    padding: 0.2rem 0.55rem;
    border-radius: 999px;
    background: rgba(45, 138, 62, 0.12);
    color: #1f6b2d;
    font-size: 0.8rem;
}

.page .body-text {
    margin: 0 0 0.75rem;
    line-height: 1.55;
    font-size: 0.98rem;
}

.page .page-media {
    margin-top: 0.5rem;
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid rgba(28, 42, 34, 0.1);
    background: #fff;
    max-height: 42%;
}

.page .page-media img {
    display: block;
    width: 100%;
    height: 100%;
    max-height: 220px;
    object-fit: contain;
    background: #faf7f0;
}

.page audio {
    width: 100%;
    margin-top: 0.5rem;
}

.page-footer-num {
    margin-top: auto;
    padding-top: 0.75rem;
    font-size: 0.78rem;
    color: rgba(28, 42, 34, 0.45);
    text-align: center;
}

/* Sayfa düzeni: kenar harf şeridi + içerik */
.page-inner-with-rail {
    display: flex;
    flex-direction: row;
    gap: 0.5rem;
    align-items: stretch;
}

.page-letter-rail {
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
    flex-shrink: 0;
    width: 1.85rem;
    overflow-y: auto;
    padding-right: 0.2rem;
    border-right: 2px solid rgba(45, 138, 62, 0.28);
}

.page-main {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow: auto;
}

.fihrist-letter-btn {
    width: 1.65rem;
    height: 1.4rem;
    border-radius: 6px;
    border: 1px solid rgba(10, 37, 64, 0.1);
    background: rgba(10, 37, 64, 0.04);
    color: #0a2540;
    font-weight: 700;
    font-size: 0.7rem;
    cursor: pointer;
    padding: 0;
    line-height: 1;
    flex-shrink: 0;
}

.fihrist-letter-btn.is-active,
.fihrist-letter-big.is-active {
    background: #0a2540;
    color: #fff;
    border-color: #0a2540;
    box-shadow: 0 0 0 2px rgba(45, 138, 62, 0.35);
}

.fihrist-letter-btn:hover,
.fihrist-letter-big:hover {
    background: #2d8a3e;
    color: #fff;
    border-color: #2d8a3e;
}

/* Fihrist 1 — büyük harfler */
.page-fihrist-letters .fihrist-lead {
    margin: 0 0 0.75rem;
    font-size: 0.88rem;
    color: rgba(10, 37, 64, 0.65);
    line-height: 1.4;
}

.fihrist-letters-hero {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.45rem;
    flex: 1;
    align-content: start;
}

.fihrist-letter-big {
    min-height: 3.1rem;
    border-radius: 12px;
    border: 1px solid rgba(10, 37, 64, 0.12);
    background: linear-gradient(180deg, #fff, #eef5f0);
    color: #0a2540;
    font-weight: 800;
    font-size: 1.45rem;
    font-family: Georgia, "Times New Roman", serif;
    cursor: pointer;
    padding: 0.35rem;
}

.page-fihrist .page-inner h2,
.page-main h2 {
    margin-bottom: 0.4rem;
    font-size: 1.2rem;
}

.fihrist-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.fihrist-list-compact {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.05rem 0.55rem;
    align-content: start;
    flex: 1;
}

.fihrist-list li {
    display: flex;
    align-items: baseline;
    margin: 0;
    min-width: 0;
}

.fihrist-list button,
.fihrist-link {
    appearance: none;
    border: 0;
    background: none;
    padding: 0.16rem 0.1rem;
    font: inherit;
    color: #0a2540;
    cursor: pointer;
    text-align: left;
    flex: 1;
    display: flex;
    gap: 0.25rem;
    align-items: baseline;
    min-width: 0;
    width: 100%;
    border-radius: 4px;
}

.fihrist-link:hover {
    background: rgba(45, 138, 62, 0.08);
}

.fihrist-link:hover .fihrist-word {
    color: #2d8a3e;
}

.fihrist-word {
    font-weight: 700;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 0.86rem;
}

.fihrist-dots {
    flex: 1;
    border-bottom: 1px dotted rgba(10, 37, 64, 0.28);
    transform: translateY(-3px);
    min-width: 0.35rem;
}

.fihrist-page {
    font-variant-numeric: tabular-nums;
    color: rgba(10, 37, 64, 0.5);
    font-size: 0.75rem;
    flex-shrink: 0;
}

.book-hint {
    text-align: center;
    color: rgba(28, 42, 34, 0.6);
    font-size: 0.88rem;
    margin: 0.35rem 0 0;
}

.book-hint kbd {
    display: inline-block;
    padding: 0.1rem 0.4rem;
    border-radius: 6px;
    border: 1px solid rgba(28, 42, 34, 0.18);
    background: rgba(255, 253, 248, 0.8);
    font-size: 0.8rem;
}

@media (max-width: 700px) {
    .book-shell { width: calc(100% - 0.75rem); }
    .book-toolbar {
        flex-direction: column;
        align-items: stretch;
    }
    .book-controls {
        justify-content: space-between;
    }
    .book-controls .btn {
        min-height: 42px;
        padding: 0.45rem 0.7rem;
    }
    .page-inner { padding: 0.9rem 0.95rem 1.1rem; }
    .page .page-media img { max-height: 140px; }
    .page-cover .cover-logo { width: min(96px, 46%); }
    .speak-row .btn { min-height: 36px; }
    body.book-mode .site-main { padding-bottom: 1.5rem; }
    .book-hint { font-size: 0.8rem; padding: 0 0.25rem; }
    .fihrist-list-compact {
        grid-template-columns: 1fr;
        gap: 0.05rem;
    }
    .fihrist-letters-hero {
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 0.35rem;
    }
    .fihrist-letter-big {
        min-height: 2.6rem;
        font-size: 1.2rem;
    }
    .fihrist-letter-btn {
        width: 1.5rem;
        height: 1.3rem;
        font-size: 0.65rem;
    }
    .page-letter-rail { width: 1.65rem; }
}
