/* ================================================================
   GALERI DUVARI — Müze Estetiği
   ================================================================
   Her piksel kasıtlı. Her boşluk hesaplanmış.
   Bir galeri duvarı gibi: sadece değerli olan görünür.
   ================================================================ */

/* --- Design Tokens --- */
:root {
    /* The wall — warm, restful, never sterile */
    --wall: #F2EDE8;
    --wall-warm: #EDE7E0;
    --wall-light: #F7F3EF;

    /* The darkness — gallery before lights */
    --dark: #1A1714;
    --dark-warm: #221E19;

    /* The ink — deep, warm charcoal, never harsh black */
    --ink: #1C1917;
    --ink-soft: #44403C;
    --ink-muted: #78716C;

    /* The accent — warm gold, barely there, like gallery lighting */
    --accent: #B8A088;
    --accent-glow: rgba(184, 160, 136, 0.08);

    /* Typography */
    --font-serif: 'Cormorant Garamond', 'Garamond', 'Georgia', serif;
    --font-sans: 'Inter', -apple-system, 'Helvetica Neue', sans-serif;

    /* Spacing rhythm based on 8px grid */
    --space-xs: 0.5rem;
    --space-sm: 1rem;
    --space-md: 1.5rem;
    --space-lg: 2.5rem;
    --space-xl: 4rem;
    --space-2xl: 6rem;

    /* Timing — gallery pace, never rushed */
    --ease-gallery: cubic-bezier(0.25, 0.1, 0.25, 1.0);
    --ease-silk: cubic-bezier(0.4, 0.0, 0.2, 1.0);
    --ease-dramatic: cubic-bezier(0.16, 1, 0.3, 1);
    --duration-hover: 0.4s;

    /* Light mode spotlight: darkens the edges to create contrast */
    --spot-bg: radial-gradient(ellipse 55% 65% at 50% 42%,
            transparent 0%,
            transparent 30%,
            rgba(26, 23, 20, 0.08) 55%,
            rgba(26, 23, 20, 0.18) 75%,
            rgba(26, 23, 20, 0.28) 100%);
}

[data-theme="dark"] {
    /* Midnight theme - deep anthracite */
    --wall: #0d0d0d;
    --wall-warm: #111111;
    --wall-light: #151515;

    --dark: #000000;
    --dark-warm: #050505;

    --ink: #FFFFFF;
    --ink-soft: #8A8A8A;
    --ink-muted: #555555;

    --accent: #A3A3A3;
    --accent-glow: rgba(255, 255, 255, 0.05);

    /* Dark mode spotlight: subtle text illumination in the center */
    --spot-bg: radial-gradient(ellipse 45% 65% at 50% 45%,
            rgba(255, 255, 255, 0.06) 0%,
            rgba(255, 255, 255, 0.02) 35%,
            transparent 65%);
}


/* --- Reset & Foundation --- */
*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}

body {
    background-color: var(--wall);
    color: var(--ink);
    overflow: hidden;
    min-height: 100vh;
    min-height: 100dvh;
    transition: background-color 0.8s var(--ease-gallery), color 0.8s var(--ease-gallery);
}

/* Hide default cursor globally */
*,
*::before,
*::after {
    cursor: none !important;
}

/* --- Custom Cursor --- */
.custom-cursor {
    position: fixed;
    top: 0;
    left: 0;
    width: 14px;
    height: 14px;
    border: 1px solid var(--ink-soft);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    pointer-events: none;
    z-index: 100;
    opacity: 0;
    /* Hidden until mouse moves */
    transition:
        width 0.3s var(--ease-gallery),
        height 0.3s var(--ease-gallery),
        opacity 0.3s var(--ease-gallery),
        border-color 0.3s var(--ease-gallery);
    will-change: transform, width, height, opacity;
}

body.is-interactive .custom-cursor {
    opacity: 0.7;
}

.custom-cursor.is-hovering {
    width: 24px;
    height: 24px;
    opacity: 1;
    border-color: var(--accent);
}

::selection {
    background-color: rgba(184, 160, 136, 0.2);
    color: var(--ink);
}


/* ================================================================
   ACT I — THE DARKNESS (Gallery before lights)
   ================================================================ */

/* The dark room — solid overlay that fades away as the spot turns on */
.gallery-darkness {
    position: fixed;
    inset: 0;
    background-color: var(--dark);
    z-index: 15;
    pointer-events: none;
    opacity: 1;
    animation: darkness-lift 2.8s var(--ease-silk) 0.4s forwards;
}

@keyframes darkness-lift {
    0% {
        opacity: 1;
    }

    40% {
        opacity: 0.7;
    }

    100% {
        opacity: 0;
    }
}


/* ================================================================
   ACT II — THE SPOTLIGHT (Gallery track lighting)
   ================================================================ */

/* The spot — works by darkening the EDGES, leaving the center bright.
   Real gallery lighting creates perception of brightness through contrast,
   not by adding light to an already-bright surface. */
.spotlight {
    position: fixed;
    inset: 0;
    z-index: 14;
    pointer-events: none;
    opacity: 0;
    background: var(--spot-bg);
    transition: background 0.8s var(--ease-gallery);
    animation: spotlight-on 2.4s var(--ease-dramatic) 0.8s forwards;
}

@keyframes spotlight-on {
    0% {
        opacity: 0;
    }

    100% {
        opacity: 1;
    }
}


/* ================================================================
   AMBIENT LAYERS
   ================================================================ */

/* --- The Ambient Light (Cursor Glow) — only activates after entrance --- */
.ambient-light {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 4;
    opacity: 0;
    transition: opacity 0.8s var(--ease-gallery);
    will-change: background;
}

body.is-interactive .ambient-light {
    opacity: 1;
}


/* --- Gravure Paper Grain Texture --- */
/* Revealed by the spotlight — texture only emerges where light hits */
.grain-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 5;
    opacity: 0;
    mix-blend-mode: multiply;
    animation: grain-emerge 1.5s var(--ease-silk) 2s forwards;
}

@keyframes grain-emerge {
    0% {
        opacity: 0;
    }

    100% {
        opacity: 0.4;
    }
}


/* --- Vignette removed — spotlight now handles edge darkening --- */


/* ================================================================
   ACT III — THE ARTWORK (Name emerging from shadow)
   ================================================================ */

.gallery {
    position: relative;
    z-index: 10;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    min-height: 100dvh;
    padding: var(--space-lg);
}


/* --- The Artwork (Name) --- */
.artwork {
    text-align: center;
    opacity: 0;
    transform: translateY(6px);
    animation: artwork-enter 2s var(--ease-dramatic) 1.2s forwards;
}

@keyframes artwork-enter {
    0% {
        opacity: 0;
        transform: translateY(6px);
    }

    50% {
        opacity: 0.6;
    }

    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

.name {
    font-family: var(--font-serif);
    font-weight: 300;
    line-height: 1.1;
    letter-spacing: 0.06em;
    color: var(--ink);
    user-select: text;
}

.name-line {
    display: block;
}

.name-first {
    font-size: clamp(2.4rem, 6vw, 5rem);
    font-weight: 400;
    letter-spacing: 0.08em;
}

.name-last {
    font-size: clamp(3.2rem, 8.5vw, 7.5rem);
    font-weight: 300;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    margin-top: 0.05em;
    color: var(--ink);
    /* Subtle relief — letters lift from the wall under the spotlight */
    text-shadow: 0 1px 3px rgba(26, 23, 20, 0.06);
}


/* ================================================================
   THE PLACARD (Links — at the edge of the spotlight)
   ================================================================ */

.placard {
    margin-top: var(--space-xl);
    display: flex;
    align-items: center;
    gap: var(--space-lg);
    opacity: 0;
    transform: translateY(5px);
    /* Links appear last — at the dim edge of the spotlight */
    animation: placard-enter 1.8s var(--ease-dramatic) 2.2s forwards;
}

@keyframes placard-enter {
    0% {
        opacity: 0;
        transform: translateY(5px);
    }

    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

.placard-link {
    font-family: var(--font-sans);
    font-size: clamp(0.72rem, 1.1vw, 0.85rem);
    font-weight: 300;
    letter-spacing: 0.18em;
    color: var(--ink-soft);
    text-decoration: none;
    position: relative;
    padding-bottom: 3px;
    transition:
        color var(--duration-hover) var(--ease-gallery),
        opacity var(--duration-hover) var(--ease-gallery);
}

/* The underline — drawn from left to right like a curator's pen */
.placard-link::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 0.5px;
    background-color: var(--accent);
    transform: scaleX(0);
    transform-origin: left center;
    transition: transform var(--duration-hover) var(--ease-silk);
}

.placard-link:hover::after,
.placard-link:focus-visible::after {
    transform: scaleX(1);
}

.placard-link:hover {
    color: var(--ink);
}

/* When one link is hovered, others recede */
.placard:hover .placard-link:not(:hover) {
    opacity: 0.35;
}

.placard-link:focus-visible {
    outline: 1px solid var(--accent);
    outline-offset: 6px;
    color: var(--ink);
}

.placard-separator {
    font-family: var(--font-sans);
    font-size: 0.6rem;
    color: var(--ink-muted);
    opacity: 0.4;
    user-select: none;
    transition: opacity var(--duration-hover) var(--ease-gallery);
}

/* ================================================================
   THEME TOGGLE
   ================================================================ */

.theme-toggle {
    position: fixed;
    bottom: var(--space-lg);
    right: var(--space-lg);
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: transparent;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 50;
    pointer-events: auto;
    opacity: 0;
    /* Appears slightly after links */
    animation: placard-enter 1.8s var(--ease-dramatic) 2.8s forwards;
}

/* Base icon: Hollow circle (Light Mode) */
.theme-toggle-icon {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    border: 1.5px solid var(--ink-soft);
    background-color: transparent;
    transition: all var(--duration-hover) var(--ease-silk);
}

.theme-toggle:hover .theme-toggle-icon,
.theme-toggle:focus-visible .theme-toggle-icon {
    border-color: var(--ink);
    transform: scale(1.1);
}

.theme-toggle:focus-visible {
    outline: 1px solid var(--accent);
    outline-offset: 6px;
}

/* Dark mode icon: Solid circle */
[data-theme="dark"] .theme-toggle-icon {
    background-color: var(--ink-soft);
    border-color: transparent;
}

[data-theme="dark"] .theme-toggle:hover .theme-toggle-icon,
[data-theme="dark"] .theme-toggle:focus-visible .theme-toggle-icon {
    background-color: var(--ink);
}

/* ================================================================
   RESPONSIVE
   ================================================================ */

@media (max-width: 640px) {
    :root {
        /* Widen the spotlight horizontally on narrow screens to prevent vertical stretching */
        --spot-bg: radial-gradient(ellipse 120% 55% at 50% 42%,
                transparent 0%,
                transparent 30%,
                rgba(26, 23, 20, 0.08) 55%,
                rgba(26, 23, 20, 0.18) 75%,
                rgba(26, 23, 20, 0.28) 100%);
    }

    [data-theme="dark"] {
        --spot-bg: radial-gradient(ellipse 120% 55% at 50% 45%,
                rgba(255, 255, 255, 0.06) 0%,
                rgba(255, 255, 255, 0.02) 35%,
                transparent 65%);
    }

    .placard {
        gap: var(--space-md);
        margin-top: var(--space-lg);
    }

    .placard-separator {
        font-size: 0.5rem;
    }
}

@media (max-width: 380px) {
    .placard {
        flex-direction: column;
        gap: var(--space-sm);
    }

    .placard-separator {
        display: none;
    }
}

/* Respect reduced motion preferences */
@media (prefers-reduced-motion: reduce) {
    .gallery-darkness {
        animation: none;
        opacity: 0;
    }

    .spotlight {
        animation: none;
        opacity: 1;
        transform: none;
    }

    .artwork,
    .placard {
        animation: none;
        opacity: 1;
        transform: none;
    }

    .grain-overlay {
        animation: none;
        opacity: 0.4;
    }


    .ambient-light {
        display: none;
    }

    .placard-link::after {
        transition: none;
    }
}


/* ================================================================
   PRINT
   ================================================================ */

@media print {
    body {
        background: white;
        overflow: visible;
    }

    .gallery-darkness,
    .spotlight,
    .ambient-light,
    .grain-overlay {
        display: none;
    }

    .artwork,
    .placard {
        animation: none;
        opacity: 1;
        transform: none;
    }

    .name {
        color: black;
        text-shadow: none;
    }

    .placard-link {
        color: black;
    }

    .placard-link::after {
        display: none;
    }
}