/* ============================================================
   THESECOND.QUEST - Styles
   ============================================================ */

/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Lora', serif;
    color: #3b3028;
    line-height: 1.75;
    letter-spacing: 0.01em;
    background: linear-gradient(to bottom,
        #f4ede4 0%,
        #e8ddd0 50%,
        #e2d8cc 100%);
    min-height: 100vh;
}

/* Typography Base */
h1, h2, h3 {
    font-family: 'Cormorant Garamond', serif;
    font-weight: 400;
    letter-spacing: 0.02em;
    line-height: 1.2;
}

/* ============================================================
   COLOR PALETTE REFERENCES
   ============================================================ */
/* #3B3028 Roasted Umber (used throughout) */
/* #4A3F35 Roasted Umber secondary (body text) */
/* #5E6B52 Forest Moss (gradients) */
/* #7A6E62 Heather Grey (gradients) */
/* #8FA4A8 Winter Sea (accent use) */
/* #C4897A Dusty Rose (accent primary) */
/* #D4A94E Amber Glow (hover states) */
/* #E2D8CC Footer background */
/* #E8DDD0 Birch Smoke (wave fill) */
/* #F4EDE4 Aged Linen (backgrounds) */

/* ============================================================
   HERO SECTION
   ============================================================ */

.hero {
    position: relative;
    width: 100%;
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.hero-image {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #7a6e62, #5e6b52);
    background-image:
        url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="100" height="100"><filter id="noise"><feTurbulence baseFrequency="0.9" numOctaves="4" seed="2"/></filter><rect width="100" height="100" fill="%23f4ede4" filter="url(%23noise)" opacity="0.03"/></svg>');
    animation: heroFadeIn 1200ms ease-out forwards;
    z-index: 1;
    background-attachment: fixed;
}

.hero-image::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: radial-gradient(ellipse at center, transparent 0%, rgba(42, 36, 28, 0.4) 100%);
    z-index: 2;
}

@keyframes heroFadeIn {
    from {
        opacity: 0;
        background-color: #f4ede4;
    }
    to {
        opacity: 1;
    }
}

.hero-content {
    position: relative;
    z-index: 3;
    text-align: center;
    transform: translateY(-8%);
}

.hero-title {
    font-size: clamp(3.5rem, 9vw, 8rem);
    color: #f4ede4;
    margin-bottom: 1.5rem;
    text-shadow: 0 2px 20px rgba(59, 48, 40, 0.5);
    font-weight: 400;
    animation: heroTitleFadeIn 400ms ease-out 400ms forwards;
    opacity: 0;
    transform: translateY(15px);
}

@keyframes heroTitleFadeIn {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.hero-tagline {
    font-family: 'Josefin Sans', sans-serif;
    font-size: clamp(0.75rem, 1vw, 0.9rem);
    font-weight: 300;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: #f4ede4;
    text-shadow: 0 2px 20px rgba(59, 48, 40, 0.5);
    animation: heroTaglineFadeIn 400ms ease-out 700ms forwards;
    opacity: 0;
}

@keyframes heroTaglineFadeIn {
    to {
        opacity: 1;
    }
}

/* ============================================================
   WAVE DIVIDERS
   ============================================================ */

.wave-divider {
    display: block;
    width: 100%;
    height: auto;
    aspect-ratio: 1440 / 120;
    margin: 0;
    padding: 0;
}

.wave-path {
    animation: waveFlow 4000ms ease-in-out infinite;
}

@keyframes waveFlow {
    0%, 100% {
        d: path('M0,60 Q360,30 720,60 T1440,60 L1440,120 L0,120 Z');
    }
    25% {
        d: path('M0,60 Q360,35 720,60 T1440,60 L1440,120 L0,120 Z');
    }
    50% {
        d: path('M0,60 Q360,50 720,60 T1440,60 L1440,120 L0,120 Z');
    }
    75% {
        d: path('M0,60 Q360,40 720,60 T1440,60 L1440,120 L0,120 Z');
    }
}

/* ============================================================
   CONTENT SECTIONS
   ============================================================ */

.content-section {
    position: relative;
    width: 100%;
    padding: clamp(60px, 8vw, 120px) 0;
}

.section-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 clamp(24px, 3vw, 48px);
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    gap: clamp(24px, 3vw, 48px);
}

.section-heading {
    grid-column: span 7;
    font-size: clamp(1.8rem, 4vw, 3.2rem);
    color: #3b3028;
    margin-bottom: 1rem;
    position: relative;
}

.section-wave-underline {
    grid-column: span 7;
    height: 8px;
    margin-bottom: 2rem;
    background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 40 4"><path d="M0,2 Q10,0 20,2 T40,2" stroke="%23c4897a" stroke-width="1.5" fill="none" opacity="0.6"/></svg>');
    background-repeat: repeat-x;
    background-size: 40px 4px;
}

.body-text {
    grid-column: span 7;
    font-size: clamp(1rem, 1.3vw, 1.15rem);
    color: #4a3f35;
    line-height: 1.75;
    letter-spacing: 0.01em;
    margin-bottom: 1.5rem;
    opacity: 0;
    animation: textRevealIn 600ms ease-out forwards;
}

.body-text:nth-of-type(2) {
    animation-delay: 100ms;
}

.body-text:nth-of-type(3) {
    animation-delay: 200ms;
}

@keyframes textRevealIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ============================================================
   MEMORY WALL SECTION
   ============================================================ */

.memory-wall-section {
    background-color: #f4ede4;
}

.memory-wall-container {
    grid-column: 1 / -1;
    position: relative;
    height: 600px;
    margin-top: 2rem;
}

.memory-card {
    position: absolute;
    width: 280px;
    height: 320px;
    background: white;
    border: 12px solid #f4ede4;
    border-radius: 2px;
    box-shadow: 4px 4px 12px rgba(59, 48, 40, 0.15);
    cursor: pointer;
    transition: all 300ms ease-out;
    --card-rot: 0deg;
}

.memory-card img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    filter: saturate(0.7) contrast(1.05);
    mix-blend-mode: multiply;
    mix-blend-color: #c4897a;
    opacity: 0.85;
    border-color: #8fa4a8;
}

.memory-card::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: radial-gradient(ellipse at center, transparent 60%, rgba(59, 48, 40, 0.25) 100%);
    pointer-events: none;
}

.memory-card:hover {
    transform: translateY(-8px) rotate(0deg) scale(1.03);
    box-shadow: 8px 8px 24px rgba(59, 48, 40, 0.25);
    border-color: #d4a94e;
    z-index: 100;
}

/* ============================================================
   MEMORY MODAL
   ============================================================ */

.memory-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1000;
}

.memory-modal.active {
    display: flex;
    align-items: center;
    justify-content: center;
}

.memory-modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(59, 48, 40, 0.6);
    cursor: pointer;
}

.memory-modal-content {
    position: relative;
    z-index: 1001;
    background: white;
    width: 90vw;
    height: 80vh;
    max-width: 900px;
    display: flex;
    border-radius: 4px;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(59, 48, 40, 0.3);
    animation: modalSlideIn 400ms ease-out;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: scale(0.95);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.memory-modal-image {
    flex: 1;
    background-color: #e8ddd0;
    overflow: hidden;
}

.memory-modal-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    filter: saturate(0.7) contrast(1.05);
}

.memory-modal-text {
    flex: 1;
    padding: 3rem;
    display: flex;
    flex-direction: column;
    justify-content: center;
    background-color: #f4ede4;
    overflow-y: auto;
}

.memory-modal-text p {
    font-family: 'Lora', serif;
    font-style: italic;
    font-size: 1.1rem;
    line-height: 1.8;
    color: #4a3f35;
}

.memory-modal-close {
    position: absolute;
    top: 20px;
    right: 20px;
    background: none;
    border: none;
    font-size: 2rem;
    color: #3b3028;
    cursor: pointer;
    z-index: 1002;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 200ms ease-out;
}

.memory-modal-close:hover {
    transform: rotate(90deg);
}

/* ============================================================
   SCROLLYTELLING SECTION
   ============================================================ */

.scrollytelling-section {
    background-color: #e2d8cc;
}

.scrollytelling-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 clamp(24px, 3vw, 48px);
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: clamp(40px, 5vw, 80px);
    align-items: start;
}

.scrollytelling-text-column {
    display: flex;
    flex-direction: column;
    gap: 3rem;
}

.scrollytelling-chapter {
    opacity: 0;
    animation: chapterFadeIn 600ms ease-out forwards;
}

.scrollytelling-chapter:nth-of-type(1) {
    animation-delay: 0ms;
}

.scrollytelling-chapter:nth-of-type(2) {
    animation-delay: 100ms;
}

.scrollytelling-chapter:nth-of-type(3) {
    animation-delay: 200ms;
}

.scrollytelling-chapter:nth-of-type(4) {
    animation-delay: 300ms;
}

@keyframes chapterFadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.chapter-title {
    font-family: 'Cormorant Garamond', serif;
    font-size: clamp(1.4rem, 2.5vw, 2rem);
    color: #3b3028;
    margin-bottom: 1rem;
    font-weight: 400;
}

.scrollytelling-image-column {
    position: sticky;
    top: 100px;
    height: 500px;
}

.scrollytelling-image {
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #7a6e62, #5e6b52);
    border: 12px solid #f4ede4;
    border-radius: 2px;
    box-shadow: 4px 4px 12px rgba(59, 48, 40, 0.15);
    background-size: cover;
    background-position: center;
    transition: background-image 800ms ease-out;
}

.scrollytelling-image::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: radial-gradient(ellipse at center, transparent 60%, rgba(59, 48, 40, 0.25) 100%);
    pointer-events: none;
}

/* ============================================================
   FOOTER
   ============================================================ */

.site-footer {
    background-color: #e2d8cc;
    padding: 3rem 0;
    border-top: 1px solid rgba(122, 110, 98, 0.2);
}

.footer-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 clamp(24px, 3vw, 48px);
    text-align: center;
}

.footer-text {
    font-family: 'Josefin Sans', sans-serif;
    font-size: clamp(0.85rem, 1.1vw, 1rem);
    font-weight: 300;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #7a6e62;
    margin: 0.5rem 0;
}

.footer-credit {
    margin-top: 1.5rem;
    font-style: italic;
    font-family: 'Lora', serif;
    text-transform: none;
    letter-spacing: normal;
    font-size: 0.9rem;
}

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

@media (max-width: 768px) {
    .section-container {
        grid-template-columns: 1fr;
    }

    .section-heading,
    .section-wave-underline,
    .body-text {
        grid-column: span 1 !important;
    }

    .scrollytelling-container {
        grid-template-columns: 1fr;
        gap: 2rem;
    }

    .scrollytelling-image-column {
        position: relative;
        top: 0;
        height: 400px;
        margin-top: 2rem;
    }

    .memory-wall-container {
        height: 800px;
    }

    .memory-modal-content {
        flex-direction: column;
    }

    .memory-modal-image {
        height: 40%;
    }

    .memory-modal-text {
        height: 60%;
        padding: 1.5rem;
    }

    .memory-modal-text p {
        font-size: 1rem;
    }
}

/* ============================================================
   ACCESSIBILITY & PRINT
   ============================================================ */

@media print {
    .hero {
        height: auto;
        min-height: 400px;
    }

    .wave-divider {
        display: none;
    }

    .scrollytelling-image-column {
        position: relative;
        top: auto;
    }
}

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