/* ================================================
   quietjoon.com - Surreal-Introspective Design
   Color Palette:
     Primary Neutral:   #D4C5B0
     Deep Anchor:       #2A2520
     Secondary Accent:  #8B7B6B
     Tertiary Highlight: #A89968
     Atmospheric:       #E8DFD3
     Shadow/Depth:      #5C4E43

   Fonts:
     Headlines: Playfair Display 400
     Body: IBM Plex Sans 300/500
     Accent: EB Garamond 400
   ================================================ */

*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    font-size: 16px;
    background-color: #D4C5B0;
}

body {
    font-family: 'IBM Plex Sans', sans-serif;
    font-weight: 300;
    color: #2A2520;
    background-color: #D4C5B0;
    overflow-x: hidden;
    line-height: 1.7;
    letter-spacing: 0.01em;
    cursor: default;
}

/* ================================================
   GRAIN OVERLAY
   ================================================ */
#grain-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    pointer-events: none;
    z-index: 1000;
    opacity: 0.06;
    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.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E");
    background-size: 256px 256px;
}

/* ================================================
   PAPER TEXTURE
   ================================================ */
#paper-texture {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    pointer-events: none;
    z-index: 999;
    opacity: 0.015;
    background-image:
        radial-gradient(ellipse at 20% 50%, #8B7B6B 0%, transparent 50%),
        radial-gradient(ellipse at 80% 20%, #5C4E43 0%, transparent 50%),
        radial-gradient(ellipse at 50% 80%, #A89968 0%, transparent 50%);
}

/* ================================================
   FLOATING FRAGMENTS (Palimpsest)
   ================================================ */
#floating-fragments {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 5;
}

.fragment {
    position: absolute;
    font-family: 'EB Garamond', serif;
    font-weight: 400;
    font-size: clamp(1.2rem, 2.5vw, 2rem);
    text-transform: uppercase;
    letter-spacing: 0.3em;
    color: #5C4E43;
    opacity: 0.05;
    transition: opacity 2s ease;
    will-change: transform;
}

/* ================================================
   BOTANICAL LAYER
   ================================================ */
#botanical-layer {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    pointer-events: none;
    z-index: 3;
    opacity: 0.07;
}

.botanical {
    position: absolute;
    will-change: transform;
}

.botanical-1 {
    width: 180px;
    height: auto;
    top: 10vh;
    right: 5vw;
    transform: rotate(-15deg);
}

.botanical-2 {
    width: 120px;
    height: auto;
    bottom: 15vh;
    left: 3vw;
    transform: rotate(8deg);
}

.botanical-3 {
    width: 100px;
    height: auto;
    top: 50vh;
    left: 60vw;
    transform: rotate(-5deg);
}

/* ================================================
   ANNOTATION LAYER
   ================================================ */
#annotation-layer {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    pointer-events: none;
    z-index: 4;
}

.annotation {
    position: absolute;
    opacity: 0;
    transition: opacity 1.5s ease;
}

.annotation-underline-1 {
    width: 140px;
    bottom: 30vh;
    left: 10vw;
}

.annotation-check-1 {
    width: 24px;
    top: 25vh;
    right: 15vw;
}

.annotation-bracket {
    width: 16px;
    top: 45vh;
    left: 4vw;
}

.annotation-circle {
    width: 50px;
    top: 70vh;
    right: 8vw;
}

.annotation.visible {
    opacity: 0.08;
}

/* ================================================
   SECTION ROOMS - General
   ================================================ */
.section-room {
    position: relative;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 8vh 8vw;
}

/* ================================================
   OPENING SECTION (0-150vh)
   ================================================ */
#opening {
    min-height: 150vh;
    flex-direction: column;
    background-color: #D4C5B0;
}

.opening-content {
    text-align: center;
    position: sticky;
    top: 30vh;
}

.identity-text {
    font-family: 'Playfair Display', serif;
    font-weight: 400;
    font-size: clamp(3rem, 10vw, 8rem);
    letter-spacing: 0.05em;
    color: #2A2520;
    line-height: 1.1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.1em;
}

.identity-line {
    display: block;
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 1.5s ease, transform 1.5s ease;
}

.identity-line.revealed {
    opacity: 1;
    transform: translateY(0);
}

.identity-line-2 {
    transition-delay: 0.4s;
}

.opening-whisper {
    font-family: 'IBM Plex Sans', sans-serif;
    font-weight: 300;
    font-size: clamp(0.85rem, 1.5vw, 1.1rem);
    color: #8B7B6B;
    margin-top: 3rem;
    letter-spacing: 0.15em;
    opacity: 0;
    transform: translateY(10px);
    transition: opacity 2s ease 1.2s, transform 2s ease 1.2s;
}

.opening-whisper.revealed {
    opacity: 0.7;
    transform: translateY(0);
}

/* Dissolve effect on scroll */
#opening.dissolving .identity-text {
    filter: blur(var(--dissolve-blur, 0px));
    opacity: var(--dissolve-opacity, 1);
    transition: none;
}

#opening.dissolving .opening-whisper {
    opacity: var(--whisper-opacity, 0.7);
    transition: none;
}

/* ================================================
   PASSAGE SECTION (150-350vh)
   ================================================ */
#passage {
    min-height: 200vh;
    flex-direction: column;
    gap: 0;
    padding: 0;
    background-color: #E8DFD3;
}

.passage-grid {
    width: 100%;
    display: flex;
    flex-direction: column;
}

.passage-moment {
    position: relative;
    min-height: 40vh;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.passage-moment:nth-child(odd) {
    padding-left: 15vw;
    padding-right: 8vw;
}

.passage-moment:nth-child(even) {
    padding-left: 8vw;
    padding-right: 15vw;
    text-align: right;
}

.moment-veil {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        135deg,
        rgba(232, 223, 211, 0.85) 0%,
        rgba(212, 197, 176, 0.6) 100%
    );
    transition: opacity 1.2s ease;
    z-index: 1;
}

.passage-moment.unveiled .moment-veil {
    opacity: 0.2;
}

.moment-text {
    position: relative;
    z-index: 2;
    font-family: 'Playfair Display', serif;
    font-weight: 400;
    font-size: clamp(1.2rem, 2.8vw, 2.2rem);
    letter-spacing: 0.03em;
    color: #2A2520;
    line-height: 1.6;
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 1.5s ease, transform 1.5s ease;
}

.passage-moment.unveiled .moment-text {
    opacity: 0.85;
    transform: translateY(0);
}

/* Alternating background tones */
.passage-moment-1 { background-color: #E8DFD3; }
.passage-moment-2 { background-color: #D4C5B0; }
.passage-moment-3 { background-color: #E8DFD3; }
.passage-moment-4 { background-color: #D4C5B0; }
.passage-moment-5 { background-color: #E8DFD3; }

/* ================================================
   CORE CONTENT SECTION (350-600vh)
   ================================================ */
#core {
    min-height: 250vh;
    flex-direction: column;
    align-items: flex-start;
    background-color: #D4C5B0;
    padding: 15vh 12vw;
}

.core-content {
    max-width: 680px;
    margin-left: 8vw;
    display: flex;
    flex-direction: column;
    gap: 12vh;
}

.core-block {
    opacity: 0;
    transform: translateY(40px);
    transition: opacity 1.2s ease, transform 1.2s ease;
}

.core-block.revealed {
    opacity: 1;
    transform: translateY(0);
}

.core-label {
    font-family: 'IBM Plex Sans', sans-serif;
    font-weight: 500;
    font-size: clamp(0.7rem, 1.2vw, 0.85rem);
    text-transform: lowercase;
    letter-spacing: 0.2em;
    color: #A89968;
    margin-bottom: 2rem;
}

.core-body {
    font-family: 'IBM Plex Sans', sans-serif;
    font-weight: 300;
    font-size: clamp(1rem, 2.2vw, 1.2rem);
    line-height: 1.7;
    letter-spacing: 0.01em;
    color: #2A2520;
    margin-bottom: 1.5rem;
}

.core-body em {
    font-family: 'Playfair Display', serif;
    font-style: italic;
    font-weight: 400;
    color: #5C4E43;
}

.core-pullquote {
    padding: 6vh 0;
    opacity: 0;
    transform: translateX(-20px);
    transition: opacity 1.5s ease, transform 1.5s ease;
}

.core-pullquote.revealed {
    opacity: 1;
    transform: translateX(0);
}

.core-pullquote blockquote {
    font-family: 'EB Garamond', serif;
    font-weight: 400;
    font-size: clamp(1.4rem, 3vw, 2.4rem);
    color: #5C4E43;
    line-height: 1.5;
    padding-left: 2rem;
    border-left: 1px solid #A89968;
    opacity: 0.6;
}

/* ================================================
   ARCHIVE SECTION (600-800vh)
   ================================================ */
#archive {
    min-height: 200vh;
    flex-direction: column;
    align-items: center;
    background-color: #E8DFD3;
    padding: 15vh 8vw;
    gap: 8vh;
}

.archive-header {
    text-align: center;
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 1.2s ease, transform 1.2s ease;
}

.archive-header.revealed {
    opacity: 1;
    transform: translateY(0);
}

.archive-label {
    font-family: 'IBM Plex Sans', sans-serif;
    font-weight: 500;
    font-size: clamp(0.7rem, 1.2vw, 0.85rem);
    text-transform: lowercase;
    letter-spacing: 0.25em;
    color: #A89968;
}

.archive-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 3rem;
    max-width: 900px;
    width: 100%;
}

.archive-card {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    padding: 2rem 1.5rem;
    background: rgba(212, 197, 176, 0.4);
    border: 1px solid rgba(139, 123, 107, 0.1);
    opacity: 0;
    transform: translateY(30px) scale(0.97);
    transition: opacity 0.8s ease, transform 0.8s ease, background 0.6s ease, border-color 0.6s ease;
    cursor: default;
}

.archive-card.revealed {
    opacity: 1;
    transform: translateY(0) scale(1);
}

.archive-card:hover {
    background: rgba(212, 197, 176, 0.7);
    border-color: rgba(168, 153, 104, 0.25);
}

.archive-card:hover .card-desc {
    opacity: 0.7;
    max-height: 100px;
    margin-top: 0.5rem;
}

.card-year {
    font-family: 'EB Garamond', serif;
    font-weight: 400;
    font-size: 0.85rem;
    color: #A89968;
    letter-spacing: 0.1em;
}

.card-title {
    font-family: 'Playfair Display', serif;
    font-weight: 400;
    font-size: clamp(1.1rem, 2vw, 1.4rem);
    color: #2A2520;
    letter-spacing: 0.02em;
}

.card-desc {
    font-family: 'IBM Plex Sans', sans-serif;
    font-weight: 300;
    font-size: 0.85rem;
    color: #8B7B6B;
    line-height: 1.5;
    opacity: 0;
    max-height: 0;
    overflow: hidden;
    transition: opacity 0.6s ease, max-height 0.6s ease, margin-top 0.6s ease;
}

/* ================================================
   CLOSING SECTION (800vh+)
   ================================================ */
#closing {
    min-height: 100vh;
    flex-direction: column;
    background-color: #D4C5B0;
    gap: 2rem;
}

.closing-content {
    text-align: center;
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 2s ease, transform 2s ease;
}

.closing-content.revealed {
    opacity: 1;
    transform: translateY(0);
}

.closing-text {
    font-family: 'IBM Plex Sans', sans-serif;
    font-weight: 300;
    font-size: clamp(1rem, 2vw, 1.3rem);
    color: #8B7B6B;
    line-height: 1.8;
    letter-spacing: 0.02em;
}

.closing-name {
    font-family: 'Playfair Display', serif;
    font-weight: 400;
    font-size: clamp(1.4rem, 3vw, 2rem);
    color: #2A2520;
    letter-spacing: 0.05em;
    margin-top: 3rem;
    opacity: 0.5;
}

.closing-year {
    font-family: 'EB Garamond', serif;
    font-weight: 400;
    font-size: 0.85rem;
    color: #A89968;
    letter-spacing: 0.15em;
    opacity: 0.4;
}

/* Grain intensification at closing */
#closing .closing-content {
    filter: blur(var(--closing-blur, 0px));
}

/* ================================================
   MARGIN NAVIGATION
   ================================================ */
#margin-nav {
    position: fixed;
    right: 2vw;
    top: 50%;
    transform: translateY(-50%);
    z-index: 100;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    opacity: 0;
    transition: opacity 1s ease;
}

#margin-nav.visible {
    opacity: 1;
}

.nav-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #8B7B6B;
    opacity: 0.3;
    transition: opacity 0.4s ease, transform 0.4s ease;
    display: block;
    position: relative;
    text-decoration: none;
}

.nav-dot:hover {
    opacity: 0.7;
    transform: scale(1.5);
}

.nav-dot.active {
    opacity: 0.8;
    transform: scale(1.8);
    background: #A89968;
}

.nav-label {
    position: absolute;
    right: 16px;
    top: 50%;
    transform: translateY(-50%);
    font-family: 'IBM Plex Sans', sans-serif;
    font-weight: 300;
    font-size: 0.65rem;
    letter-spacing: 0.15em;
    color: #8B7B6B;
    white-space: nowrap;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.nav-dot:hover .nav-label {
    opacity: 0.6;
}

/* ================================================
   RESPONSIVE
   ================================================ */
@media (max-width: 768px) {
    .core-content {
        margin-left: 0;
        max-width: 100%;
    }

    .passage-moment:nth-child(odd),
    .passage-moment:nth-child(even) {
        padding: 8vh 8vw;
        text-align: center;
    }

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

    #margin-nav {
        display: none;
    }

    .botanical-1 { width: 120px; }
    .botanical-2 { width: 80px; }
    .botanical-3 { width: 60px; }
}

@media (max-width: 480px) {
    .identity-text {
        font-size: clamp(2.5rem, 15vw, 4rem);
    }

    .section-room {
        padding: 6vh 6vw;
    }

    #core {
        padding: 10vh 6vw;
    }
}

/* ================================================
   SELECTION STYLE
   ================================================ */
::selection {
    background: rgba(168, 153, 104, 0.2);
    color: #2A2520;
}
