:root {
    --cream:        #F6EFE3;
    --paper:        #FBF7EF;
    --paper-back:   #EFE6D4;
    --ink:          #3B2A1E;
    --ink-soft:     #6B5744;
    --clay:         #B85C38;
    --clay-dark:    #8F4327;
    --blush:        #E3B79A;
    --heart-red:    #C43A3A;

    --font-display: 'Cormorant Garamond', serif;
    --font-hand:    'Caveat', cursive;
    --font-body:    'Work Sans', sans-serif;

    --space-1: 0.5rem;
    --space-2: 1rem;
    --space-3: 2rem;

    --page-w: min(92vw, 460px);
    --page-h: min(78vh, 640px);
    --flip-duration: 0.9s;
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    height: 100%;
    background: var(--cream);
    color: var(--ink);
    font-family: var(--font-body);
    overflow: hidden;
}

@media (prefers-reduced-motion: reduce) {
    * { transition-duration: 0.01ms !important; }
}

#book-stage {
    height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    background: radial-gradient(ellipse at 50% 40%, var(--paper) 0%, var(--cream) 70%);
}

/* ===== Kitap ===== */
.book {
    position: relative;
    width: var(--page-w);
    height: var(--page-h);
    perspective: 2400px;
    /* Ortalamak için transition ekledik */
    transition: transform var(--flip-duration) cubic-bezier(.62,.06,.35,1);
}

/* KİTAP AÇILDIĞINDA EKRANI ORTALAYACAK KRİTİK KOD */
.book.open {
    transform: translateX(50%);
}

.book::before {
    content: '';
    position: absolute;
    inset: 6px -6px -6px 6px;
    background: var(--paper-back);
    border-radius: 4px;
    box-shadow: 0 20px 40px rgba(59,42,30,0.25);
    z-index: 0;
}

.pages {
    position: absolute;
    inset: 0;
    z-index: 1;
}

.page {
    position: absolute;
    inset: 0;
    transform-origin: left center;
    transform-style: preserve-3d;
    transition: transform var(--flip-duration) cubic-bezier(.62,.06,.35,1);
    cursor: pointer;
    border-radius: 4px;
}

.page.flipped {
    transform: rotateY(-178deg);
}

.page-face {
    position: absolute;
    inset: 0;
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
    border-radius: 4px;
    overflow: hidden;
    box-shadow: 2px 4px 18px rgba(59,42,30,0.18);
    background: var(--paper);
}

.page-back {
    transform: rotateY(180deg);
    background:
            repeating-linear-gradient(180deg, transparent 0 38px, rgba(59,42,30,0.04) 39px 40px),
            var(--paper-back);
}

.page-face::after {
    content: '';
    position: absolute;
    top: 0; bottom: 0; left: 0;
    width: 28px;
    background: linear-gradient(90deg, rgba(59,42,30,0.14), transparent);
    pointer-events: none;
}

.page-content {
    position: absolute;
    inset: 0;
    padding: var(--space-3) var(--space-3) var(--space-3) calc(var(--space-3) + 14px);
    display: flex;
    flex-direction: column;
    overflow-y: auto;
}

/* ===== Kapak sayfası ===== */
.page-cover .page-content {
    padding: 0;
}
.cover-photo {
    position: relative;
    width: 100%;
    height: 100%;
    background-size: cover;
    background-position: center;
    background-color: var(--blush);
    display: flex;
    align-items: flex-end;
}
.cover-photo::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, rgba(255,255,255,0) 40%, rgba(251,247,239,0.88) 100%);
}
.cover-names {
    position: relative;
    width: 100%;
    padding: var(--space-3);
    text-align: center;
    font-family: var(--font-hand);
    font-style: italic;
    font-size: clamp(2rem, 9vw, 2.8rem);
    color: #000;
    line-height: 1.1;
}
.cover-names .heart {
    color: var(--heart-red);
    margin: 0 0.15em;
}
.cover-hint {
    position: relative;
    width: 100%;
    padding-bottom: var(--space-2);
    text-align: center;
    font-family: var(--font-body);
    font-size: 0.78rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #000;
    opacity: 0.85;
}

/* ===== Foto sayfası ===== */
.page-photos-caption {
    font-family: var(--font-hand);
    font-size: 1.6rem;
    color: var(--clay-dark);
    text-align: center;
    margin: 0 0 var(--space-2);
}
.page-photo-grid {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-content: flex-start;
    gap: var(--space-2);
    flex: 1;
}
.polaroid {
    background: var(--paper);
    padding: 8px 8px 16px;
    box-shadow: 0 6px 14px rgba(59,42,30,0.15);
    width: 44%;
    min-width: 140px;
}
.polaroid img {
    width: 100%;
    height: 170px;
    object-fit: cover;
    display: block;
    background: var(--blush);
}
.polaroid figcaption {
    font-family: var(--font-hand);
    font-size: 1rem;
    color: var(--ink-soft);
    text-align: center;
    padding-top: 6px;
}

/* ===== Mektup (son sayfa) ===== */
.page-closing .page-content {
    align-items: stretch;
    justify-content: center;
    text-align: center;
}
.page-closing p:not(.closing-signature) {
    font-family: var(--font-display);
    font-style: italic;
    font-size: 1rem; /* Sığması için 1rem'e çektik */
    line-height: 1.4; /* Satır aralığını çok hafif daralttık */
    margin: 0 0 0.7em; /* Paragraf arası boşluğu azalttık */
}
.page-closing p:not(.closing-signature):last-of-type {
    margin-bottom: 0.5em;
}
.closing-signature {
    font-family: var(--font-display);
    font-size: 1.25rem; /* İmzayı da orantılı küçülttük */
    color: var(--clay-dark);
    font-style: italic;
    margin-top: 1em;
}
/* ===== Kontroller ===== */
#book-controls {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    z-index: 2;
}
#book-controls button {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 1px solid var(--blush);
    background: var(--paper);
    color: var(--clay-dark);
    font-size: 1.3rem;
    cursor: pointer;
    transition: background 0.2s ease, transform 0.15s ease;
}
#book-controls button:hover { background: var(--blush); }
#book-controls button:active { transform: scale(0.92); }
#book-controls button:disabled {
    opacity: 0.35;
    cursor: default;
    pointer-events: none;
}
#page-indicator {
    font-family: var(--font-body);
    font-size: 0.85rem;
    color: var(--ink-soft);
    letter-spacing: 0.05em;
    min-width: 3.5em;
    text-align: center;
}

@media (max-width: 480px) {
    .polaroid { width: 100%; }
    .polaroid img { height: 160px; }
}
/* ===== MOBİL İÇİN ZOOM HİLESİ ===== */
@media (max-width: 768px) {
    body {
        display: flex;
        flex-direction: column;
        justify-content: center;
        align-items: center;
        height: 100vh;
        margin: 0;
        overflow: hidden;
    }

    #book {
        /* Transform yerine tüm yapıyı orantılı küçültür, JS matematiğini bozmaz */
        zoom: 0.50;
        margin: 0 auto !important;
    }

    /* Butonları kitabın yapısından koparıp ekranın altına sabitler */
    #controls, .controls, .page-nav {
        position: fixed !important;
        bottom: 5% !important;
        left: 0 !important;
        width: 100% !important;
        display: flex !important;
        justify-content: center !important;
        z-index: 1000 !important;
    }
}

