/*
 * Memory Log - Cinematic Full-Bleed Design
 * Every image is a backdrop, text floats on top
 */

/* ===== VARIABLES ===== */
:root {
    --font-display: 'Cormorant Garamond', serif;
    --font-body: 'Zen Old Mincho', serif;

    --color-bg: #0a0a0a;
    --color-text: #e8e8e8;
    --color-text-muted: #888;

    --transition-slow: 1.2s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ===== RESET ===== */
*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    background-color: var(--color-bg);
    color: var(--color-text);
    font-family: var(--font-body);
    line-height: 1.6;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

img {
    display: block;
    max-width: 100%;
    height: auto;
}

/* ===== GRAIN OVERLAY ===== */
.grain {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 9999;
    opacity: 0.05;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E");
}

/* ===== SITE HEADER ===== */
.site-header {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    padding: 2rem 3rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    z-index: 100;
}

.logo {
    font-family: var(--font-display);
    font-size: 1.2rem;
    font-weight: 400;
    letter-spacing: 0.25em;
    text-transform: uppercase;
    color: #fff;
}

.tagline {
    font-family: var(--font-display);
    font-size: 0.85rem;
    font-style: italic;
    letter-spacing: 0.15em;
    opacity: 0.7;
}

/* ===== CINEMATIC SECTION ===== */
.cinematic-section {
    position: relative;
    min-height: 100vh;
    /* Fallback */
    min-height: 100dvh;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.cinematic-section.tall {
    min-height: 120vh;
}

.cinematic-section.hero {
    min-height: 100vh;
    /* Fallback */
    min-height: 100dvh;
}

/* Background Image */
.section-bg {
    position: absolute;
    inset: 0;
    z-index: 0;
}

.section-bg img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    filter: grayscale(100%) contrast(1.1) brightness(0.5);
    transform: scale(1.05);
    transition: transform 1.2s cubic-bezier(0.4, 0, 0.2, 1),
        filter 0.8s ease;
}

/* Color tint overlay on hover */
.section-bg::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg,
            rgba(139, 109, 76, 0) 0%,
            rgba(180, 140, 100, 0) 50%,
            rgba(100, 80, 120, 0) 100%);
    opacity: 0;
    transition: opacity 0.6s ease, background 0.6s ease;
    pointer-events: none;
    z-index: 1;
}

.cinematic-section:hover .section-bg::after {
    background: linear-gradient(135deg,
            rgba(180, 140, 100, 0.15) 0%,
            rgba(200, 160, 120, 0.1) 50%,
            rgba(120, 100, 140, 0.12) 100%);
    opacity: 1;
}

.cinematic-section {
    transition: transform 0.5s cubic-bezier(0.4, 0, 0.2, 1),
        box-shadow 0.5s ease;
}

.cinematic-section:hover {
    transform: translateY(-4px);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.cinematic-section:hover .section-bg img {
    transform: scale(1.08);
    filter: grayscale(60%) contrast(1.05) brightness(0.55);
}

/* Overlay Variations */
.section-overlay {
    position: absolute;
    inset: 0;
    z-index: 1;
    background: linear-gradient(to bottom,
            rgba(10, 10, 10, 0.4) 0%,
            rgba(10, 10, 10, 0.2) 50%,
            rgba(10, 10, 10, 0.7) 100%);
}

.section-overlay.dark {
    background: linear-gradient(135deg,
            rgba(10, 10, 10, 0.7) 0%,
            rgba(10, 10, 10, 0.3) 50%,
            rgba(10, 10, 10, 0.6) 100%);
}

.section-overlay.gradient-up {
    background: linear-gradient(to top,
            rgba(10, 10, 10, 0.9) 0%,
            rgba(10, 10, 10, 0.3) 40%,
            rgba(10, 10, 10, 0.2) 100%);
}

.section-overlay.gradient-center {
    background: radial-gradient(ellipse at center,
            rgba(10, 10, 10, 0.3) 0%,
            rgba(10, 10, 10, 0.7) 100%);
}

/* Section Content */
.section-content {
    position: relative;
    z-index: 10;
    width: 100%;
    max-width: 1400px;
    padding: 4rem;
}

.section-content.align-left {
    text-align: left;
}

.section-content.align-right {
    text-align: right;
    margin-left: auto;
}

.section-content.align-center {
    text-align: center;
}

.section-content.align-bottom {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding-bottom: 8rem;
}

/* Memory Number */
.memory-number {
    display: block;
    font-family: var(--font-display);
    font-size: clamp(4rem, 10vw, 8rem);
    font-weight: 300;
    line-height: 1;
    color: rgba(255, 255, 255, 0.15);
    margin-bottom: 1rem;
}

/* Memory Title */
.memory-title {
    font-family: var(--font-body);
    font-size: clamp(1.5rem, 4vw, 2.5rem);
    font-weight: 400;
    letter-spacing: 0.15em;
    color: #fff;
    text-shadow: 0 2px 40px rgba(0, 0, 0, 0.8);
}

.memory-text {
    margin-top: 1.5rem;
    font-size: 1rem;
    letter-spacing: 0.1em;
    color: rgba(255, 255, 255, 0.7);
    max-width: 400px;
}

/* Hero Specific */
.main-title {
    font-family: var(--font-display);
    font-size: clamp(3.5rem, 12vw, 10rem);
    /* Refined for better scaling */
    font-weight: 300;
    line-height: 0.9;
    /* Slightly relaxed */
    letter-spacing: -0.02em;
    color: #fff;
    text-shadow: 0 0 80px rgba(0, 0, 0, 0.8);
    margin-bottom: 2rem;
}

.main-title .line {
    display: block;
}

.main-sub {
    font-size: 1.1rem;
    line-height: 2.2;
    letter-spacing: 0.15em;
    color: rgba(255, 255, 255, 0.8);
}

/* Final Section */
.final-title {
    font-family: var(--font-display);
    font-size: clamp(3rem, 10vw, 7rem);
    font-weight: 300;
    letter-spacing: 0.05em;
    color: #fff;
    margin-bottom: 1.5rem;
}

.final-sub {
    font-size: 1.2rem;
    letter-spacing: 0.15em;
    color: rgba(255, 255, 255, 0.7);
}

/* Scroll Indicator */
.scroll-indicator {
    position: absolute;
    bottom: 3rem;
    left: 50%;
    transform: translateX(-50%);
    z-index: 10;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    font-family: var(--font-display);
    font-size: 0.75rem;
    letter-spacing: 0.3em;
    text-transform: uppercase;
    opacity: 0.6;
}

.scroll-line {
    width: 1px;
    height: 60px;
    background: linear-gradient(to bottom, #fff, transparent);
    animation: scrollPulse 2.5s ease-in-out infinite;
}

@keyframes scrollPulse {

    0%,
    100% {
        opacity: 0.2;
        transform: scaleY(0.6);
    }

    50% {
        opacity: 1;
        transform: scaleY(1);
    }
}

/* ===== SPLIT SECTION ===== */
.split-section {
    display: flex;
    min-height: 80vh;
}

.split-item {
    position: relative;
    flex: 1;
    overflow: hidden;
    transition: transform 0.5s cubic-bezier(0.4, 0, 0.2, 1),
        box-shadow 0.5s ease;
}

.split-item .section-bg img {
    filter: grayscale(100%) contrast(1.1) brightness(0.6);
    transition: transform 1.2s cubic-bezier(0.4, 0, 0.2, 1),
        filter 0.8s ease;
}

/* Split item color tint */
.split-item .section-bg::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg,
            rgba(139, 109, 76, 0) 0%,
            rgba(180, 140, 100, 0) 100%);
    opacity: 0;
    transition: opacity 0.6s ease, background 0.6s ease;
    pointer-events: none;
    z-index: 1;
}

.split-item:hover {
    transform: translateY(-3px);
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.25);
}

.split-item:hover .section-bg::after {
    background: linear-gradient(135deg,
            rgba(200, 160, 120, 0.12) 0%,
            rgba(150, 120, 160, 0.1) 100%);
    opacity: 1;
}

.split-item:hover .section-bg img {
    filter: grayscale(50%) contrast(1.05) brightness(0.65);
    transform: scale(1.06);
}

/* Split item content */
.split-content {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    pointer-events: none;
}

.split-text {
    font-family: var(--font-body);
    font-size: clamp(1rem, 2.5vw, 1.4rem);
    letter-spacing: 0.2em;
    color: rgba(255, 255, 255, 0.85);
    text-shadow: 0 2px 20px rgba(0, 0, 0, 0.6);
    opacity: 0;
    transform: translateY(10px);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

.split-item:hover .split-text {
    opacity: 1;
    transform: translateY(0);
}

/* ===== INTERLUDE ===== */
.interlude {
    min-height: 60vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 10vh 5vw;
    background: var(--color-bg);
}

.interlude blockquote {
    max-width: 700px;
    text-align: center;
}

.interlude p {
    font-family: var(--font-body);
    font-size: clamp(1.3rem, 3vw, 2rem);
    line-height: 2.4;
    letter-spacing: 0.12em;
    color: rgba(255, 255, 255, 0.85);
}

/* ===== FOOTER ===== */
.footer {
    padding: 15vh 5vw;
    text-align: center;
    background: var(--color-bg);
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.footer-quote {
    font-family: var(--font-display);
    font-size: 1.8rem;
    font-style: italic;
    margin-bottom: 4rem;
    opacity: 0.6;
}

.footer-brand .logo {
    display: block;
    font-size: 1.5rem;
    margin-bottom: 1rem;
}

.footer .credit {
    font-size: 0.9rem;
    color: var(--color-text-muted);
}

/* ===== RESPONSIVE ===== */

/* Large Screens (Desktops) */
@media (min-width: 1600px) {
    .section-content {
        max-width: 1600px;
        padding: 0 4rem;
        /* Horizontal padding, vertical handled by flex alignment */
        /* Center content wrapper itself if needed, but alignment classes handle text */
        margin-left: auto;
        margin-right: auto;
    }
}

/* Notebooks & Tablets (Landscape) */
@media (max-width: 1024px) {
    .section-content {
        padding: 3rem;
        max-width: 90%;
    }

    .main-title {
        font-size: clamp(3rem, 10vw, 8rem);
        /* Slightly smaller max for laptops */
    }

    .memory-number {
        font-size: clamp(3rem, 8vw, 6rem);
    }

    .final-title {
        font-size: clamp(2.5rem, 8vw, 5rem);
    }

    .split-text {
        font-size: 1rem;
        /* Fixed size for tablet split to avoid overflow */
    }
}

/* Tablets (Portrait) & Large Phones */
@media (max-width: 820px) {
    .cinematic-section {
        min-height: 90vh;
        /* Relax height slightly */
    }

    .split-section {
        min-height: 60vh;
        /* Reduce split height */
    }
}

/* Mobile Devices */
@media (max-width: 768px) {
    .site-header {
        position: absolute;
        width: 100%;
        padding: 1.5rem;
        justify-content: center;
        flex-direction: column;
        gap: 0.5rem;
    }

    /* Reduce logo size slightly on mobile */
    .logo {
        font-size: 1rem;
    }

    .tagline {
        font-size: 0.75rem;
    }

    .section-content {
        padding: 1.5rem;
        width: 100%;
        max-width: 100%;
    }

    /* Reset specific alignments on mobile for better readability */
    .section-content.align-left,
    .section-content.align-right,
    .section-content.align-center {
        text-align: center;
        margin-left: auto;
        margin-right: auto;
    }

    .section-content.align-bottom {
        padding-bottom: 5rem;
        text-align: center;
        bottom: auto;
        position: absolute;
        /* Keep absolute but adjust padding */
        bottom: 0;
    }

    /* Adjust font sizes for mobile to be readable but not overwhelming */
    .main-title {
        /* Reduce min size to 2rem to prevent overflow on small screens */
        font-size: clamp(2rem, 11vw, 4.5rem);
        margin-bottom: 1rem;
        width: 100%;
        overflow-wrap: break-word;
    }

    .main-sub {
        font-size: 0.9rem;
        line-height: 1.8;
        padding: 0 1rem;
    }

    .memory-number {
        font-size: 3rem;
        /* Fixed comfortable size */
        margin-bottom: 0.5rem;
        color: rgba(255, 255, 255, 0.25);
    }

    .memory-title {
        font-size: 1.6rem;
    }

    .memory-text {
        font-size: 0.95rem;
        margin: 1rem auto 0;
        line-height: 1.8;
        max-width: 90%;
    }

    /* Split section becomes vertical stack */
    .split-section {
        flex-direction: column;
        display: block;
        min-height: auto;
    }

    .split-item {
        height: 50vh;
        /* Fallback */
        height: 50dvh;
        width: 100%;
    }

    /* MOBILE DESIGN FIX: 
       On mobile, there is no "hover". 
       So we make the text and overlay always visible for better UX.
    */
    .split-item .section-bg::after {
        opacity: 1;
        /* Always show overlay */
        background: linear-gradient(135deg,
                rgba(0, 0, 0, 0.3) 0%,
                rgba(0, 0, 0, 0.1) 100%);
    }

    .split-text {
        opacity: 1;
        /* Always show text */
        transform: translateY(0);
        font-size: 1.4rem;
        text-shadow: 0 2px 10px rgba(0, 0, 0, 0.5);
    }

    /* Prevent image from zooming in too much on mobile selection, keep it steady */
    .split-item .section-bg img {
        filter: grayscale(80%) contrast(1.1) brightness(0.6);
    }

    .interlude {
        padding: 15vh 1.5rem;
        min-height: 50vh;
    }

    .interlude p {
        font-size: 1.1rem;
        line-height: 2;
    }

    .final-title {
        font-size: 2.5rem;
    }

    .footer {
        padding: 10vh 1.5rem;
    }

    .footer-quote {
        font-size: 1.2rem;
        margin-bottom: 2rem;
    }
}

@media (max-height: 600px) and (orientation: landscape) {

    /* Optimize for landscape mobile */
    .cinematic-section {
        min-height: 140vh;
        /* Force scroll */
    }

    .site-header {
        padding: 1rem;
        flex-direction: row;
        /* Keep header compact in landscape */
        justify-content: space-between;
    }

    .logo {
        text-align: left;
    }

    .section-content {
        padding-top: 4rem;
        /* Clear header */
    }
}