/* ==========================================================
   CSS CUSTOM PROPERTIES (THEME & TOKENS)
   ========================================================== */
:root {
    --color-bg: #090909;
    --color-text: #efe4c8;
    --color-accent: #b89a56;
    --color-highlight: #d9bf82;
    --color-dark-overlay: rgba(9, 9, 9, 0.85);

    --font-title: 'Cinzel', serif;
    --font-poem: 'EB Garamond', serif;
    --font-caption: 'Cormorant Garamond', serif;

    --easing-cinematic: cubic-bezier(0.25, 1, 0.5, 1);
}

/* ==========================================================
   RESET & BASE STYLES
   ========================================================== */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    background-color: var(--color-bg);
    color: var(--color-text);
    font-size: 16px;
    height: 100%;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Tek ekranlık deneyim: kıtalar scroll ile değil, otomatik bir dizi ile
   ilerler (bkz. script.js) — bu yüzden sayfa hiç kaydırılmaz. .poem-stage
   yine de bir güvenlik ağı olarak kendi içinde taşarsa kaydırılabilir. */
body {
    font-family: var(--font-poem);
    background-color: var(--color-bg);
    color: var(--color-text);
    overflow: hidden;
    height: 100%;
    position: relative;
    line-height: 1.8;
}

/* Accessibility: Skip Link */
.skip-link {
    position: absolute;
    top: -100px;
    left: 1rem;
    background: var(--color-accent);
    color: var(--color-bg);
    padding: 0.75rem 1.5rem;
    font-family: var(--font-caption);
    font-weight: 600;
    z-index: 10000;
    text-decoration: none;
    transition: top 0.3s var(--easing-cinematic);
}

.skip-link:focus {
    top: 1rem;
}

/* ==========================================================
   ATMOSPHERIC LAYERS & FILM GRAIN
   ========================================================== */
#atmosphere-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    pointer-events: none;
    z-index: 2;
}

.film-grain {
    position: fixed;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)' opacity='0.08'/%3E%3C/svg%3E");
    pointer-events: none;
    z-index: 10;
    opacity: 0.45;
    animation: grainShift 8s steps(10) infinite;
}

@keyframes grainShift {
    0%, 100% { transform: translate(0, 0); }
    10% { transform: translate(-2%, -2%); }
    20% { transform: translate(2%, 1%); }
    30% { transform: translate(-1%, 2%); }
    40% { transform: translate(1%, -1%); }
    50% { transform: translate(-2%, 1%); }
    60% { transform: translate(2%, 2%); }
    70% { transform: translate(-1%, -2%); }
    80% { transform: translate(1%, 2%); }
    90% { transform: translate(-2%, -1%); }
}

.vignette-layer {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    pointer-events: none;
    z-index: 5;
    background: radial-gradient(circle at center, rgba(9, 9, 9, 0) 35%, rgba(9, 9, 9, 0.7) 85%, rgba(9, 9, 9, 0.95) 100%);
    animation: vignetteBreathing 12s ease-in-out infinite alternate;
}

@keyframes vignetteBreathing {
    0% { opacity: 0.85; }
    100% { opacity: 1; }
}

.light-rays {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    pointer-events: none;
    z-index: 3;
    background: linear-gradient(125deg, rgba(217, 191, 130, 0.04) 0%, rgba(9, 9, 9, 0) 60%);
    mix-blend-mode: screen;
}

/* ==========================================================
   HEADER & AUDIO CONTROLLER
   ========================================================== */
.audio-header {
    position: fixed;
    top: 2.5rem;
    right: 3rem;
    z-index: 100;
}

.audio-button {
    background: transparent;
    border: 1px solid rgba(184, 154, 86, 0.35);
    color: var(--color-accent);
    padding: 0.6rem 1.25rem;
    font-family: var(--font-caption);
    font-size: 0.8rem;
    letter-spacing: 0.2em;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    transition: all 0.5s var(--easing-cinematic);
    backdrop-filter: blur(8px);
}

.audio-button:hover,
.audio-button:focus-visible {
    border-color: var(--color-highlight);
    color: var(--color-highlight);
    background: rgba(184, 154, 86, 0.08);
}

.audio-icon {
    display: flex;
    align-items: flex-end;
    gap: 2px;
    height: 12px;
}

.audio-icon .bar {
    width: 2px;
    background-color: currentColor;
    height: 4px;
    transition: height 0.3s ease;
}

.audio-button.playing .bar-1 {
    animation: audioWave 1.2s ease-in-out infinite;
}

.audio-button.playing .bar-2 {
    animation: audioWave 0.9s ease-in-out infinite 0.2s;
}

.audio-button.playing .bar-3 {
    animation: audioWave 1.4s ease-in-out infinite 0.4s;
}

@keyframes audioWave {
    0%, 100% { height: 4px; }
    50% { height: 12px; }
}

/* ==========================================================
   MAIN MEMORIAL DESKTOP LAYOUT — TEK EKRAN (100vh, scroll yok)
   ========================================================== */
.memorial-container {
    display: flex;
    width: 100%;
    height: 100vh;
    position: relative;
    z-index: 4;
}

/* LEFT SIDE: 45% POEM COLUMN — header (üst) + stage (ortada, esnek) + progress/hint (alt) */
.poem-column {
    width: 45%;
    height: 100vh;
    padding: 8vh 6% 5vh 8%;
    display: flex;
    flex-direction: column;
    position: relative;
    z-index: 10;
}

.poem-header {
    flex: 0 0 auto;
    margin-bottom: 5vh;
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 1.4s var(--easing-cinematic), transform 1.4s var(--easing-cinematic);
}

.poem-header.visible {
    opacity: 1;
    transform: translateY(0);
}

.poem-subtitle {
    font-family: var(--font-caption);
    font-size: 0.9rem;
    letter-spacing: 0.35em;
    color: var(--color-accent);
    margin-bottom: 0.75rem;
    text-transform: uppercase;
}

.poem-main-title {
    font-family: var(--font-title);
    font-size: 3rem;
    font-weight: 400;
    color: var(--color-highlight);
    letter-spacing: 0.15em;
    line-height: 1.15;
    text-shadow: 0 4px 20px rgba(0, 0, 0, 0.8);
}

/* STAGE: o an okunan tek kıta burada belirir — kalan alanı doldurur ve
   dikeyde ortalar, böylece şiir her ekran boyutunda tek sayfaya sığar. */
.poem-stage {
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
    overflow-y: auto;
    scrollbar-width: none;
    transition: opacity 0.6s ease, filter 0.6s ease;
}

.poem-stage::-webkit-scrollbar {
    display: none;
}

.poem-stage.stage-out {
    opacity: 0;
    filter: blur(10px);
}

.stanza-active {
    padding: 0.25rem 0 0.25rem 2rem;
    border-left: 1px solid rgba(184, 154, 86, 0.15);
    position: relative;
}

.stanza-active::before {
    content: '';
    position: absolute;
    top: 0;
    left: -1px;
    width: 1px;
    height: 0%;
    background: linear-gradient(to bottom, transparent, var(--color-accent), transparent);
    transition: height 2.2s var(--easing-cinematic);
}

.stanza-active.grow::before {
    height: 100%;
}

.stanza-line {
    font-family: var(--font-poem);
    font-size: 1.3rem;
    line-height: 1.6;
    color: var(--color-text);
    margin-bottom: 0.55rem;
    letter-spacing: 0.02em;
    font-style: italic;
    opacity: 0;
    filter: blur(6px);
    transform: translateY(14px);
    transition: opacity 0.6s var(--easing-cinematic), filter 0.6s var(--easing-cinematic), transform 0.6s var(--easing-cinematic);
}

.stanza-line.visible {
    opacity: 1;
    filter: blur(0);
    transform: translateY(0);
}

.stanza-line .caret {
    display: inline-block;
    width: 2px;
    height: 1em;
    margin-left: 3px;
    background: var(--color-highlight);
    vertical-align: -0.15em;
    opacity: 0;
}

.stanza-line.typing .caret {
    opacity: 1;
    animation: caretBlink 0.9s step-end infinite;
}

@keyframes caretBlink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0; }
}

.author-signature {
    margin-top: 2rem;
    font-family: var(--font-caption);
    font-size: 1.2rem;
    letter-spacing: 0.2em;
    color: var(--color-accent);
    text-transform: uppercase;
    opacity: 0;
    transform: translateY(10px);
    transition: opacity 1.1s var(--easing-cinematic), transform 1.1s var(--easing-cinematic);
}

.author-signature.visible {
    opacity: 1;
    transform: translateY(0);
}

/* PROGRESS DOTS (scroll indicator yerine — ilerlemeyi gösterir) */
.poem-progress {
    flex: 0 0 auto;
    display: flex;
    gap: 0.5rem;
    margin-top: 1.5rem;
}

.poem-progress .dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: rgba(239, 228, 200, 0.18);
    transition: background 0.5s ease, transform 0.5s ease;
}

.poem-progress .dot.done {
    background: var(--color-accent);
}

.poem-progress .dot.active {
    background: var(--color-highlight);
    transform: scale(1.5);
}

.poem-hint {
    flex: 0 0 auto;
    margin-top: 0.75rem;
    font-family: var(--font-caption);
    font-size: 0.7rem;
    letter-spacing: 0.16em;
    color: var(--color-text);
    text-transform: uppercase;
    opacity: 0;
    transition: opacity 1.5s ease;
}

.poem-hint.visible {
    opacity: 0.4;
}

/* RIGHT SIDE: 55% CINEMATIC POSTER COLUMN */
.poster-column {
    width: 55%;
    height: 100vh;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    z-index: 4;
}

.poster-wrapper {
    width: 100%;
    height: 100%;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    transform: scale(1);
    animation: slowZoom 32s var(--easing-cinematic) infinite alternate;
    will-change: transform;
}

@keyframes slowZoom {
    0% { transform: scale(1) translate(0, 0); }
    100% { transform: scale(1.1) translate(-1.5%, -1.5%); }
}

.poster-frame {
    width: 100%;
    height: 100%;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #050505;
}

.poster-image {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center 20%;
    user-select: none;
    pointer-events: none;
    --px: 0px;
    --py: 0px;
    opacity: 0;
    z-index: 2;
    filter: sepia(18%) contrast(118%) brightness(95%);
    transform: scale(1.02) translate(var(--px), var(--py));
    transition: opacity 1.8s var(--easing-cinematic), filter 0.3s ease-out;
}

/* Üç fotoğraf artık aynı anda üst üste bindirilen katmanlar DEĞİL — script.js
   şiir kıtası ilerledikçe (bkz. IMAGE_SCHEDULE) hangi portrenin sırası
   geldiyse ona .active ekleyip diğerlerinden kaldırıyor; burada yalnızca
   opacity crossfade ile geçiş animasyonu tanımlanıyor. */
.poster-image.active {
    opacity: 0.94;
    z-index: 3;
}

/* WARM CINEMATIC LIGHT SWEEP (EVERY 12 SECONDS) */
.light-sweep-effect {
    position: absolute;
    top: -50%;
    left: -100%;
    width: 50%;
    height: 200%;
    background: linear-gradient(90deg,
                rgba(217, 191, 130, 0) 0%,
                rgba(217, 191, 130, 0.09) 50%,
                rgba(217, 191, 130, 0) 100%);
    transform: rotate(25deg);
    pointer-events: none;
    z-index: 6;
    animation: lightSweep 12s infinite var(--easing-cinematic);
}

@keyframes lightSweep {
    0%, 75% { left: -100%; }
    100% { left: 200%; }
}

/* FOG & GRADING OVERLAYS */
.poster-fog-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle at 50% 50%, rgba(9, 9, 9, 0) 40%, rgba(9, 9, 9, 0.65) 90%),
                linear-gradient(to right, rgba(9, 9, 9, 0.95) 0%, rgba(9, 9, 9, 0) 30%);
    pointer-events: none;
    z-index: 7;
}

.poster-grading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(180deg, rgba(184, 154, 86, 0.05) 0%, rgba(9, 9, 9, 0.4) 100%);
    mix-blend-mode: overlay;
    pointer-events: none;
    z-index: 8;
}

/* ==========================================================
   ENDING SCREEN (4 AĞUSTOS 1922 — BELCİVÂN)
   ========================================================== */
.ending-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: var(--color-bg);
    z-index: 500;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 2.5s var(--easing-cinematic);
}

.ending-screen.visible {
    opacity: 1;
    pointer-events: auto;
}

.ending-content {
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.5rem;
}

.ending-date,
.ending-location,
.ending-region {
    opacity: 0;
    transform: translateY(20px);
    filter: blur(6px);
    transition: opacity 1.4s var(--easing-cinematic), transform 1.4s var(--easing-cinematic), filter 1.4s var(--easing-cinematic);
}

.ending-screen.visible .ending-date {
    opacity: 1;
    transform: translateY(0);
    filter: blur(0);
    transition-delay: 0.3s;
}

.ending-screen.visible .ending-location {
    opacity: 1;
    transform: translateY(0);
    filter: blur(0);
    transition-delay: 0.8s;
}

.ending-screen.visible .ending-region {
    opacity: 1;
    transform: translateY(0);
    filter: blur(0);
    transition-delay: 1.3s;
}

.ending-date {
    font-family: var(--font-caption);
    font-size: 1.25rem;
    letter-spacing: 0.45em;
    color: var(--color-accent);
    margin-bottom: 0.5rem;
}

.ending-location {
    font-family: var(--font-title);
    font-size: 3.5rem;
    font-weight: 600;
    letter-spacing: 0.25em;
    color: var(--color-text);
    text-shadow: 0 0 30px rgba(184, 154, 86, 0.3);
}

.ending-region {
    font-family: var(--font-caption);
    font-size: 1.6rem;
    letter-spacing: 0.35em;
    color: var(--color-highlight);
    font-style: italic;
}

/* Bitişten sonra donmuş hissi vermemesi için: bir süre sonra beliren,
   yeniden oynatma/blog'a dönüş seçenekleri sunan zarif bir kapanış. */
.ending-actions {
    margin-top: 1rem;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 1.25rem;
    opacity: 0;
    transform: translateY(10px);
    transition: opacity 1.2s var(--easing-cinematic), transform 1.2s var(--easing-cinematic);
    pointer-events: none;
}

.ending-screen.show-actions .ending-actions {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

.ending-link {
    font-family: var(--font-caption);
    font-size: 0.85rem;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--color-accent);
    background: transparent;
    border: 1px solid rgba(184, 154, 86, 0.4);
    padding: 0.65rem 1.4rem;
    cursor: pointer;
    text-decoration: none;
    display: inline-block;
    transition: all 0.4s ease;
}

.ending-link:hover,
.ending-link:focus-visible {
    color: var(--color-highlight);
    border-color: var(--color-highlight);
    background: rgba(184, 154, 86, 0.08);
}

/* ==========================================================
   RESPONSIVE DESIGN (TABLET & MOBILE)
   ========================================================== */
@media screen and (max-width: 1024px) {
    .poem-column {
        width: 50%;
        padding: 7vh 6% 4vh 6%;
    }

    .poster-column {
        width: 50%;
    }

    .poem-main-title {
        font-size: 2.3rem;
    }

    .stanza-line {
        font-size: 1.15rem;
        line-height: 1.5;
    }
}

@media screen and (max-width: 768px) {
    /* Mobile: Poster becomes full screen with dark overlay; poem sits over image */
    .memorial-container {
        flex-direction: column;
    }

    .poster-column {
        position: fixed;
        top: 0;
        left: 0;
        width: 100vw;
        height: 100vh;
        z-index: 1;
    }

    .poster-fog-overlay {
        background: var(--color-dark-overlay);
    }

    .poem-column {
        width: 100%;
        height: 100vh;
        padding: 9vh 7% 4vh 7%;
        z-index: 10;
        background: transparent;
    }

    .poem-header {
        margin-bottom: 3vh;
    }

    .poem-main-title {
        font-size: 2rem;
    }

    .stanza-line {
        font-size: 1.05rem;
        line-height: 1.45;
    }

    .audio-header {
        top: 1.5rem;
        right: 1.5rem;
    }

    .ending-location {
        font-size: 2.4rem;
        letter-spacing: 0.15em;
    }

    .ending-actions {
        flex-direction: column;
        gap: 0.75rem;
    }
}

/* ==========================================================
   ACCESSIBILITY: REDUCED MOTION & HIGH CONTRAST
   ========================================================== */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }

    .poster-wrapper {
        animation: none;
    }

    .light-sweep-effect,
    .film-grain {
        display: none;
    }
}

@media (prefers-contrast: high) {
    :root {
        --color-text: #ffffff;
        --color-accent: #ffd700;
        --color-highlight: #ffff00;
        --color-dark-overlay: rgba(0, 0, 0, 0.94);
    }

    .stanza-active {
        border-left: 2px solid var(--color-accent);
    }
}
