/* ============================================
   quietjoon.net - Styles
   Street Photography / Introspective Aesthetic
   ============================================ */

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

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

body {
    font-family: 'Inter', sans-serif;
    font-weight: 400;
    font-size: clamp(0.95rem, 2vw, 1.1rem);
    line-height: 1.7;
    color: #4A4A4A;
    background-color: #F0EDE8;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* --- Film Grain Overlay --- */
#grain-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 9999;
    opacity: 0.12;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='300' height='300'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.75' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='300' height='300' filter='url(%23n)' opacity='1'/%3E%3C/svg%3E");
    background-size: 200px 200px;
    animation: grainShift 3s steps(4) infinite;
}

@keyframes grainShift {
    0% { transform: translate(0, 0); }
    25% { transform: translate(-5px, 3px); }
    50% { transform: translate(3px, -5px); }
    75% { transform: translate(-3px, -2px); }
    100% { transform: translate(0, 0); }
}

/* --- Typography --- */
h2 {
    font-family: 'IBM Plex Serif', serif;
    font-weight: 600;
    font-size: clamp(2.4rem, 6vw, 4.2rem);
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: #2D2D2D;
    line-height: 1.2;
}

.chapter-meta {
    display: block;
    font-family: 'Space Mono', monospace;
    font-weight: 400;
    font-size: 0.8rem;
    letter-spacing: 0.02em;
    color: #6B8BA8;
    margin-top: 0.5rem;
    margin-bottom: 2rem;
}

.chapter-body {
    margin-bottom: 1.5rem;
    max-width: 540px;
}

/* --- Hero Section --- */
.hero-section {
    position: relative;
    width: 100%;
    height: 150vh;
    overflow: hidden;
    background-color: #1A1A1A;
}

.hero-image {
    position: sticky;
    top: 0;
    width: 100%;
    height: 100vh;
    overflow: hidden;
}

.hero-photo {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.hero-text {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
    z-index: 10;
    font-family: 'IBM Plex Serif', serif;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    transition: opacity 0.3s ease-in-out;
}

.hero-text-quiet {
    font-size: clamp(6rem, 15vw, 12rem);
    color: #F0EDE8;
    opacity: 1;
    mix-blend-mode: difference;
}

.hero-text-joon {
    font-size: clamp(5rem, 12vw, 10rem);
    color: #C9A87D;
    opacity: 0;
    justify-content: flex-end;
    padding-right: 10vw;
}

/* --- Film Strip Divider --- */
.film-strip-divider {
    width: 100%;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    background-color: #1A1A1A;
    position: relative;
    overflow: hidden;
}

.film-strip-divider::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 0;
    width: 100%;
    height: 1px;
    background: repeating-linear-gradient(
        90deg,
        transparent 0px,
        transparent 2px,
        #C9A87D 2px,
        #C9A87D 4px
    );
    opacity: 0.4;
    transform: translateY(-50%);
}

.film-strip-divider::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 0;
    width: 100%;
    height: 20px;
    background: repeating-linear-gradient(
        90deg,
        transparent 0px,
        transparent 14px,
        #C9A87D 14px,
        #C9A87D 15px,
        transparent 15px,
        transparent 16px
    );
    opacity: 0.15;
    mask-image: repeating-linear-gradient(
        90deg,
        transparent 0px,
        transparent 6px,
        black 6px,
        black 10px,
        transparent 10px,
        transparent 18px
    );
    -webkit-mask-image: repeating-linear-gradient(
        90deg,
        transparent 0px,
        transparent 6px,
        black 6px,
        black 10px,
        transparent 10px,
        transparent 18px
    );
}

/* --- Chapter Layout --- */
.chapter {
    position: relative;
    min-height: 200vh;
    padding: 8vh 5vw;
}

.chapter-columns {
    display: flex;
    gap: 4vw;
    min-height: 180vh;
    align-items: flex-start;
}

.chapter-image-col {
    flex: 0 0 60%;
    position: sticky;
    top: 5vh;
    height: 90vh;
}

.chapter-text-col {
    flex: 0 0 35%;
    padding-top: 10vh;
}

.chapter-reverse .chapter-columns {
    flex-direction: row-reverse;
}

/* --- Chapter Images --- */
.chapter-image {
    width: 100%;
    height: 100%;
    position: relative;
    overflow: hidden;
    background-color: #1A1A1A;
}

.chapter-image svg {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.image-reflection {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 30%;
    background: linear-gradient(to top, rgba(26, 26, 26, 0.6), transparent);
    pointer-events: none;
}

.halftone-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: radial-gradient(circle, #C9A87D 0.5px, transparent 0.5px);
    background-size: 6px 6px;
    opacity: 0.04;
    pointer-events: none;
}

/* --- Routine Grid --- */
.routine-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-rows: 1fr 1fr;
    gap: 12px;
    height: 80vh;
    position: sticky;
    top: 10vh;
}

.routine-image {
    position: relative;
    overflow: hidden;
    background-color: #1A1A1A;
}

.routine-image svg {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.heavy-grain {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='200'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='5' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='200' height='200' filter='url(%23n)' opacity='1'/%3E%3C/svg%3E");
    background-size: 150px 150px;
    opacity: 0.2;
    pointer-events: none;
}

/* --- Full Bleed Chapter (Reflection) --- */
.chapter-fullbleed {
    min-height: 200vh;
    padding: 0;
    position: relative;
}

.chapter-fullbleed-image {
    position: sticky;
    top: 0;
    width: 100%;
    height: 100vh;
    overflow: hidden;
}

.chapter-fullbleed-image svg {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.chapter-fullbleed-content {
    position: relative;
    z-index: 2;
    padding: 10vh 10vw;
    margin-top: -60vh;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
}

.chapter-title-overlay {
    color: #1A1A1A;
    opacity: 0.7;
    margin-bottom: 3rem;
    text-shadow: 0 0 40px rgba(240, 237, 232, 0.2);
}

.chapter-fullbleed-text {
    max-width: 600px;
    background: rgba(240, 237, 232, 0.85);
    padding: 3rem;
    backdrop-filter: blur(4px);
}

.chapter-fullbleed-text .chapter-body {
    color: #2D2D2D;
}

/* --- Interlude --- */
.interlude {
    height: 60vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #F0EDE8;
    position: relative;
    overflow: hidden;
}

.interlude-word {
    font-family: 'DM Serif Display', serif;
    font-weight: 400;
    font-size: clamp(3.8rem, 10vw, 7.2rem);
    color: #2D2D2D;
    opacity: 0;
    transition: opacity 0.8s ease-in-out;
    letter-spacing: 0.02em;
}

.interlude-word.visible {
    opacity: 0.15;
}

/* --- Annotations --- */
.chapter-annotation {
    margin-top: 2rem;
    padding-left: 1rem;
    border-left: 2px solid #C9A87D;
}

.annotation-text {
    font-family: 'Caveat', cursive;
    font-weight: 400;
    font-size: 1.1rem;
    color: #6B8BA8;
    font-style: italic;
}

/* --- Metadata / Counters --- */
.chapter-metadata {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-top: 3rem;
    padding-top: 2rem;
    border-top: 1px solid #C9A87D;
}

.metadata-item {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    font-family: 'Space Mono', monospace;
    font-size: 0.8rem;
    letter-spacing: 0.02em;
}

.metadata-label {
    color: #6B8BA8;
}

.counter {
    color: #2D2D2D;
    font-weight: 400;
    font-variant-numeric: tabular-nums;
}

/* --- Sidebar / Quote --- */
.chapter-sidebar {
    margin-top: 3rem;
    padding: 2rem;
    background-color: #DFDAD4;
    position: relative;
}

.sidebar-quote {
    font-family: 'IBM Plex Serif', serif;
    font-weight: 400;
    font-size: 1rem;
    font-style: italic;
    color: #2D2D2D;
    line-height: 1.6;
    border: none;
    margin: 0;
    padding: 0;
}

.sidebar-attribution {
    display: block;
    font-family: 'Space Mono', monospace;
    font-size: 0.75rem;
    color: #6B8BA8;
    margin-top: 1rem;
}

/* --- Fade In Animation --- */
.fade-in {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.6s ease-in-out, transform 0.6s ease-in-out;
}

.fade-in.visible {
    opacity: 1;
    transform: translateY(0);
}

/* --- Chapter Header --- */
.chapter-header {
    margin-bottom: 2rem;
}

/* --- Closing Section --- */
.closing-section {
    position: relative;
    min-height: 100vh;
    background-color: #DFDAD4;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 10vh 10vw;
    overflow: hidden;
}

.closing-image {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0.3;
}

.closing-image svg {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.closing-content {
    position: relative;
    z-index: 2;
    max-width: 640px;
    text-align: center;
}

.closing-text {
    font-family: 'Inter', sans-serif;
    font-size: clamp(1rem, 2.2vw, 1.2rem);
    line-height: 1.8;
    color: #2D2D2D;
    margin-bottom: 4rem;
}

.closing-signature {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
}

.signature-line {
    font-family: 'Space Mono', monospace;
    font-size: 0.9rem;
    color: #2D2D2D;
    letter-spacing: 0.02em;
}

.signature-date {
    font-family: 'Space Mono', monospace;
    font-size: 0.75rem;
    color: #6B8BA8;
}

/* --- Footer --- */
.site-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 3rem 5vw;
    background-color: #1A1A1A;
    color: #DFDAD4;
}

.footer-attribution {
    font-family: 'Space Mono', monospace;
    font-size: 0.75rem;
    letter-spacing: 0.02em;
    color: #DFDAD4;
}

.back-to-top {
    font-family: 'Space Mono', monospace;
    font-size: 0.75rem;
    color: #C9A87D;
    text-decoration: none;
    letter-spacing: 0.02em;
    transition: opacity 0.3s ease;
}

.back-to-top:hover {
    opacity: 0.7;
}

/* --- Hover Annotations on Images --- */
.chapter-image::after {
    content: attr(data-caption);
    position: absolute;
    bottom: 40px;
    left: 20px;
    font-family: 'Space Mono', monospace;
    font-size: 0.7rem;
    color: #DFDAD4;
    letter-spacing: 0.02em;
    opacity: 0;
    transition: opacity 0.3s ease;
    background: rgba(26, 26, 26, 0.6);
    padding: 0.4rem 0.8rem;
}

.chapter-image:hover::after {
    opacity: 1;
}

/* --- Lens Vignette on Images --- */
.chapter-image::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    box-shadow: inset 0 0 120px 40px rgba(26, 26, 26, 0.4);
    pointer-events: none;
    z-index: 1;
}

/* --- Responsive --- */
@media (max-width: 900px) {
    .chapter-columns {
        flex-direction: column;
    }

    .chapter-reverse .chapter-columns {
        flex-direction: column;
    }

    .chapter-image-col {
        flex: none;
        width: 100%;
        position: relative;
        top: 0;
        height: 60vh;
    }

    .chapter-text-col {
        flex: none;
        width: 100%;
        padding-top: 4vh;
    }

    .routine-grid {
        height: 60vh;
        position: relative;
        top: 0;
    }

    .chapter-fullbleed-content {
        padding: 6vh 6vw;
        margin-top: -40vh;
    }

    .hero-text-quiet {
        font-size: clamp(4rem, 12vw, 8rem);
    }

    .hero-text-joon {
        font-size: clamp(3.5rem, 10vw, 7rem);
        padding-right: 5vw;
    }
}

@media (max-width: 600px) {
    .chapter {
        padding: 6vh 4vw;
    }

    .chapter-image-col {
        height: 50vh;
    }

    .chapter-fullbleed-text {
        padding: 2rem;
    }

    .closing-section {
        padding: 8vh 6vw;
    }
}
