/*
  This file contains overrides for the film page to create a full-screen,
  dark-themed image slider that works in both light and dark modes.
*/

:root {
    --film-accent: #dca445;
    --film-bg: #000;
    --film-nav-bg: rgba(14, 14, 17, 0.84);
    --film-nav-border: rgba(255, 255, 255, 0.13);
    --film-nav-text: rgba(245, 245, 247, 0.92);
    --film-nav-hover: rgba(255, 255, 255, 0.08);
}

[data-theme="light"] {
    --film-accent: #e8b255;
    --film-bg: #040507;
    --film-nav-bg: rgba(9, 10, 14, 0.86);
    --film-nav-border: rgba(255, 255, 255, 0.18);
    --film-nav-text: rgba(251, 252, 255, 0.94);
    --film-nav-hover: rgba(255, 255, 255, 0.11);
}

/* 1. Force a cinematic dark shell on the body, overriding the site theme. */
body {
    background:
        radial-gradient(circle at 18% 6%, rgba(88, 117, 168, 0.16), transparent 32%),
        radial-gradient(circle at 82% 100%, rgba(220, 164, 69, 0.1), transparent 40%),
        var(--film-bg) !important;
    padding: 0;
}

/* 2. Keep navigation readable on this dark scene in both themes */
nav {
    border-color: var(--film-nav-border);
    background: var(--film-nav-bg);
    box-shadow: 0 12px 45px rgba(0, 0, 0, 0.45);
}

nav a,
.theme-toggle,
.random-quote {
    color: var(--film-nav-text);
}

nav a:hover,
.theme-toggle:hover {
    background-color: var(--film-nav-hover);
}

/* 3. Reset the main element */
main {
    background-color: transparent;
    padding: 0;
    border-radius: 0;
    max-width: 100%;
    align-items: stretch;
    justify-content: stretch;
}

nav a[aria-current="page"] {
    text-decoration: underline;
    text-decoration-color: var(--film-accent);
    text-decoration-thickness: 2px;
    text-underline-offset: 7px;
}

html, body {
    margin: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
}

.slider-container {
    width: 100%;
    height: 100%;
    position: relative;
    overflow: hidden;
    background-color: var(--film-bg);
}


.slider-container::before {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 2;
    opacity: 0;
    background-image:
        radial-gradient(circle at 20% 30%, rgba(255, 255, 255, 0.035) 0 1px, transparent 1.8px),
        radial-gradient(circle at 80% 70%, rgba(255, 255, 255, 0.028) 0 1px, transparent 1.9px),
        radial-gradient(circle at 35% 80%, rgba(255, 255, 255, 0.03) 0 1px, transparent 2px);
    background-size: 3px 3px, 4px 4px, 5px 5px;
    mix-blend-mode: screen;
    animation: grainDrift 14s steps(10) infinite;
    transition: opacity 0.3s ease;
}

body.grain-overlay-enabled .slider-container::before {
    opacity: 0.16;
}

@keyframes grainDrift {
    0% { transform: translate3d(0, 0, 0); }
    25% { transform: translate3d(-0.4%, 0.6%, 0); }
    50% { transform: translate3d(0.6%, -0.4%, 0); }
    75% { transform: translate3d(-0.5%, -0.5%, 0); }
    100% { transform: translate3d(0, 0, 0); }
}

.slider-track {
    display: flex;
    height: 100%;
    transition: transform 0.5s ease-in-out;
}

.slide {
    flex: 0 0 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    position: relative;
}

.image-frame {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
}


.image-frame {
    min-width: min(92vw, 1280px);
    min-height: 56vh;
}

.image-frame--error {
    background: radial-gradient(circle at 25% 20%, rgba(255,255,255,0.08), transparent 40%), #111;
}

.image-frame--error::after {
    content: "Görsel yüklenemedi";
    color: rgba(255, 255, 255, 0.8);
    font-size: 0.95rem;
    letter-spacing: 0.04em;
}

.slide.is-active .image-frame {
    border: 1px solid rgba(255, 255, 255, 0.14);
    background: rgba(255, 255, 255, 0.02);
    backdrop-filter: blur(3px);
    -webkit-backdrop-filter: blur(3px);
}

.slide.is-active .image-frame::before {
    content: "";
    position: absolute;
    inset: -18px;
    border-radius: inherit;
    background: radial-gradient(circle, rgba(106, 168, 255, 0.12) 0%, rgba(106, 168, 255, 0) 72%);
    opacity: 0.42;
    z-index: -1;
    pointer-events: none;
}

.slide img {
    display: block;
    width: min(92vw, 1280px);
    height: min(74vh, 780px);
    max-width: 100%;
    max-height: calc(100vh - 170px);
    object-fit: contain;
}

.image-frame img {
    position: relative;
    z-index: 1;
}

@media (prefers-reduced-motion: reduce) {
    .slide.is-active .image-frame,
    .slide.is-active .image-frame::before {
        border: none;
        background: transparent;
        backdrop-filter: none;
        -webkit-backdrop-filter: none;
        opacity: 0;
    }
}

.caption {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background-color: rgba(0, 0, 0, 0.85); /* Slightly darker */
    color: #fff;
    padding: 25px 40px;
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Arial, sans-serif;
}

[data-theme="light"] .caption {
    background: linear-gradient(to top, rgba(7, 8, 12, 0.92), rgba(7, 8, 12, 0.8));
}

.caption-left {
    display: flex;
    flex-direction: column;
    gap: 4px;
    max-width: min(70ch, 78%);
}

.caption-title {
    font-size: clamp(1.45rem, 2.7vw, 1.75rem);
    font-weight: 650;
    letter-spacing: 0.01em;
    margin-bottom: 2px;
}

.caption-title::before {
    content: "";
    display: inline-block;
    width: 12px;
    height: 2px;
    margin-right: 9px;
    margin-bottom: 0.25em;
    border-radius: 999px;
    background-color: var(--film-accent);
}

.caption-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    font-size: 0.86rem;
    opacity: 0.72;
}

.meta-chip {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.05);
    line-height: 1.25;
}

[data-theme="light"] .meta-chip {
    border-color: rgba(255, 255, 255, 0.25);
    background: rgba(255, 255, 255, 0.08);
}

.caption-note {
    max-width: 68ch;
    font-size: 0.95em;
    opacity: 0.86;
    line-height: 1.55;
    margin-top: 4px;
    font-style: normal;
}

.caption-note--italic {
    font-style: italic;
}

.imdb-link {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    color: #fff;
    font-size: 1.1em;
}

.imdb-logo {
    background-color: #f5c518;
    color: #000;
    font-weight: bold;
    padding: 5px 8px;
    border-radius: 4px;
    font-size: 1em;
}

.imdb-rating {
    color: #ccc;
}


.prev-btn, .next-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 44px;
    height: 44px;
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 999px;
    background: rgba(16, 16, 16, 0.2);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    color: rgba(255, 255, 255, 0.55);
    font-size: 28px;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    user-select: none;
    z-index: 10;
    padding: 0;
    opacity: 0.7;
    transition: color 0.25s ease, background-color 0.25s ease, border-color 0.25s ease, opacity 0.25s ease;
}

[data-theme="light"] .prev-btn,
[data-theme="light"] .next-btn {
    border-color: rgba(255, 255, 255, 0.25);
    background: rgba(13, 13, 16, 0.36);
}

.prev-btn span, .next-btn span {
    display: block;
    line-height: 1;
    transition: transform 0.2s ease;
}

.prev-btn:hover,
.next-btn:hover,
.prev-btn:focus-visible,
.next-btn:focus-visible {
    color: rgba(255, 255, 255, 0.95);
    background: rgba(16, 16, 16, 0.4);
    border-color: rgba(255, 255, 255, 0.4);
    opacity: 1;
}

.prev-btn:hover span,
.prev-btn:focus-visible span {
    transform: translateX(-3px);
}

.next-btn:hover span,
.next-btn:focus-visible span {
    transform: translateX(3px);
}

.prev-btn:focus-visible,
.next-btn:focus-visible {
    outline: 2px solid rgba(255, 255, 255, 0.7);
    outline-offset: 2px;
}

.prev-btn { left: 18px; }
.next-btn { right: 18px; }

@media (prefers-reduced-motion: reduce) {
    .prev-btn, .next-btn,
    .prev-btn span, .next-btn span {
        transition: none;
    }

    .prev-btn:hover span,
    .prev-btn:focus-visible span,
    .next-btn:hover span,
    .next-btn:focus-visible span {
        transform: none;
    }
}

@media (max-width: 768px) {
    .caption {
        flex-direction: column;
        align-items: flex-start;
        gap: 14px;
        padding: 18px;
    }

    .caption-left {
        gap: 3px;
        max-width: 100%;
    }

    .caption-title {
        font-size: clamp(1.2rem, 5.4vw, 1.45rem);
    }

    .caption-meta {
        font-size: 0.8rem;
        gap: 6px;
    }

    .meta-chip {
        padding: 2px 7px;
    }

    .caption-note {
        max-width: 100%;
        font-size: 0.9rem;
        line-height: 1.6;
    }

    .imdb-link {
        font-size: 1rem;
    }
}


@media (prefers-reduced-motion: reduce), (hover: none) and (pointer: coarse) {
    .slider-container::before {
        animation: none;
    }
}
