/* ======================================================
   saram.quest — Anti-Design Editorial Experience
   Colors: #F0F0E8 #1A1A1A #D6FF7E #6B2FD6 #FF6B4A #7B7B6E #1E1E24 #D8D8CC #2A2A2A
   Fonts: Space Grotesk, Outfit, Victor Mono, Noto Sans KR
   ====================================================== */

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

html {
    scroll-behavior: smooth;
    font-size: 16px;
}

body {
    background-color: #F0F0E8;
    color: #1A1A1A;
    font-family: 'Outfit', sans-serif;
    font-weight: 400;
    line-height: 1.75;
    overflow-x: hidden;
    position: relative;
}

/* --- Visible 12-Column Grid Overlay --- */
#grid-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    padding: 0 4vw;
    opacity: 0;
    animation: gridFadeIn 0.6s ease forwards;
}

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

.grid-line {
    border-left: 1px solid rgba(214, 255, 126, 0.08);
    height: 100%;
    transition: border-color 2s ease, opacity 2s ease;
}

.grid-line:last-child {
    border-right: 1px solid rgba(214, 255, 126, 0.08);
}

.grid-line.pulse {
    border-left-color: rgba(214, 255, 126, 0.30);
}

.grid-line.glow {
    border-left-color: rgba(107, 47, 214, 0.25);
    transition: border-color 3s ease;
}

/* --- Floating Home Anchor --- */
#home-anchor {
    position: fixed;
    top: 24px;
    left: 24px;
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 700;
    font-size: 1.4rem;
    color: #1A1A1A;
    z-index: 100;
    letter-spacing: -0.02em;
    cursor: default;
    transition: color 0.4s ease;
}

#home-anchor.inverted {
    color: #F0F0E8;
}

/* --- Section Base --- */
.content-section {
    position: relative;
    padding: 120px 4vw;
    z-index: 2;
}

/* --- Opening Sequence --- */
.section-opening {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    position: relative;
    z-index: 2;
    padding: 0 4vw;
}

.opening-content {
    position: relative;
    margin-left: calc(100% / 12);
}

.hero-title-wrapper {
    position: relative;
    display: inline-block;
}

.hero-title {
    font-family: 'Space Grotesk', 'Noto Sans KR', sans-serif;
    font-weight: 700;
    font-size: clamp(8rem, 20vw, 16rem);
    color: #1A1A1A;
    letter-spacing: -0.03em;
    line-height: 1;
    opacity: 0;
    animation: heroAppear 0.6s ease 0.6s forwards;
}

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

.hero-subtitle {
    font-family: 'Outfit', sans-serif;
    font-weight: 300;
    font-size: 1.2rem;
    letter-spacing: 0.3em;
    color: #2A2A2A;
    margin-top: 16px;
    margin-left: calc(100% / 12);
    opacity: 0;
    animation: heroAppear 0.6s ease 0.8s forwards;
}

.hero-vertical-text {
    position: absolute;
    right: -120px;
    top: 50%;
    transform: translateY(-50%) rotate(-90deg);
    font-family: 'Victor Mono', monospace;
    font-style: italic;
    font-weight: 400;
    font-size: 0.9rem;
    color: #7B7B6E;
    letter-spacing: 0.02em;
    opacity: 0;
    animation: heroAppear 0.5s ease 1.8s forwards;
}

/* --- Border Animate Pattern --- */
.border-animate-target {
    position: relative;
}

.border-animate-target::before,
.border-animate-target::after {
    content: '';
    position: absolute;
    pointer-events: none;
}

/* Top and Right borders */
.border-animate-target::before {
    top: -1px;
    left: -1px;
    width: 0;
    height: 0;
    border-top: 1px solid #D6FF7E;
    border-right: 1px solid #D6FF7E;
    transition: width 0.6s ease, height 0.6s ease 0.3s, border-color 1.2s ease;
}

/* Bottom and Left borders */
.border-animate-target::after {
    bottom: -1px;
    right: -1px;
    width: 0;
    height: 0;
    border-bottom: 1px solid #6B2FD6;
    border-left: 1px solid #6B2FD6;
    transition: width 0.6s ease 0.6s, height 0.6s ease 0.9s, border-color 1.2s ease;
}

.border-animate-target.animate-in::before {
    width: calc(100% + 2px);
    height: calc(100% + 2px);
    border-top-color: #6B2FD6;
    border-right-color: #6B2FD6;
}

.border-animate-target.animate-in::after {
    width: calc(100% + 2px);
    height: calc(100% + 2px);
    border-bottom-color: #D6FF7E;
    border-left-color: #D6FF7E;
}

/* Dark section variant */
.border-animate-dark::before {
    border-top-color: #FF6B4A;
    border-right-color: #FF6B4A;
}

.border-animate-dark::after {
    border-bottom-color: #FF6B4A;
    border-left-color: #FF6B4A;
}

.border-animate-dark.animate-in::before {
    border-top-color: #FF6B4A;
    border-right-color: #6B2FD6;
}

.border-animate-dark.animate-in::after {
    border-bottom-color: #FF6B4A;
    border-left-color: #6B2FD6;
}

/* --- Section Layouts --- */
.section-left .section-inner {
    max-width: 50%;
    margin-left: calc(100% / 12);
    padding: 32px;
}

.section-right {
    display: flex;
    flex-direction: row-reverse;
    align-items: flex-start;
    gap: 40px;
    flex-wrap: wrap;
}

.section-right .section-inner {
    max-width: 40%;
    padding: 32px;
    margin-right: calc(100% / 12);
}

.section-right .photo-block {
    flex: 1;
    min-width: 300px;
    max-width: 55%;
    margin-right: -2vw;
}

.section-center .section-inner {
    max-width: 58%;
    margin: 0 auto;
    padding: 32px;
    text-align: left;
}

/* --- Typography --- */
.section-heading {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 700;
    font-size: clamp(2.5rem, 6vw, 5rem);
    letter-spacing: -0.03em;
    line-height: 1.1;
    margin-bottom: 32px;
    color: #1A1A1A;
}

.body-text {
    font-family: 'Outfit', sans-serif;
    font-weight: 400;
    font-size: clamp(1rem, 1.4vw, 1.2rem);
    line-height: 1.75;
    color: #2A2A2A;
    margin-bottom: 20px;
}

.body-text:last-child {
    margin-bottom: 0;
}

/* --- Margin Notes --- */
.margin-note {
    font-family: 'Victor Mono', monospace;
    font-style: italic;
    font-weight: 400;
    font-size: 0.85rem;
    letter-spacing: 0.02em;
    color: #7B7B6E;
    position: absolute;
    writing-mode: vertical-rl;
    text-orientation: mixed;
    left: 2vw;
    top: 50%;
    transform: translateY(-50%);
}

.margin-note-right {
    left: auto;
    right: 2vw;
}

.margin-note-left {
    left: 2vw;
    right: auto;
}

/* --- Coordinate Stamps --- */
.coordinate-stamp {
    font-family: 'Victor Mono', monospace;
    font-style: italic;
    font-weight: 400;
    font-size: 0.75rem;
    color: #7B7B6E;
    position: absolute;
    letter-spacing: 0.02em;
    opacity: 0.7;
}

.coord-top-right {
    top: 32px;
    right: 6vw;
}

.coord-bottom-left {
    bottom: 32px;
    left: 6vw;
}

.coord-mid-right {
    top: 50%;
    right: 4vw;
    transform: translateY(-50%);
}

.coord-dark {
    bottom: 40px;
    right: 6vw;
    color: #D8D8CC;
}

/* --- Cross-Out Revisions --- */
.crossout {
    position: relative;
    display: inline;
    color: #7B7B6E;
}

.crossout-line {
    position: absolute;
    left: -4px;
    right: -4px;
    top: 50%;
    height: 2px;
    background: #FF6B4A;
    transform: rotate(-2deg);
    display: block;
}

.replacement-text {
    color: #6B2FD6;
    font-weight: 500;
}

/* --- Photo Blocks --- */
.photo-block {
    position: relative;
    padding: 8px;
}

.photo-placeholder {
    width: 100%;
    overflow: hidden;
    line-height: 0;
}

.photo-placeholder svg {
    width: 105%;
    height: auto;
    filter: grayscale(100%) contrast(1.1);
}

.photo-tight-crop svg {
    width: 100%;
    max-height: 500px;
}

.photo-oversize svg {
    width: 110%;
    margin-left: -5%;
}

.photo-meta {
    font-family: 'Victor Mono', monospace;
    font-style: italic;
    font-weight: 400;
    font-size: 0.8rem;
    color: #7B7B6E;
    letter-spacing: 0.02em;
    display: block;
    margin-top: 8px;
}

.photo-meta-dark {
    color: #D8D8CC;
}

/* --- Collision Moments --- */
.collision-moment {
    position: relative;
    min-height: 80vh;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.collision-korean {
    position: absolute;
    font-family: 'Noto Sans KR', sans-serif;
    font-weight: 700;
    font-size: clamp(10rem, 30vw, 25rem);
    color: #D6FF7E;
    opacity: 0.15;
    line-height: 1;
    z-index: 1;
    mix-blend-mode: multiply;
    user-select: none;
    pointer-events: none;
}

.collision-english {
    position: relative;
    z-index: 3;
    max-width: 55%;
    padding: 40px;
}

/* --- Rotated Blocks --- */
.rotated-block {
    transform: rotate(-2deg);
}

/* --- Dark Inversion Section --- */
.section-dark {
    background-color: #1E1E24;
    padding: 160px 4vw;
    position: relative;
    z-index: 2;
}

.dark-section-inner {
    position: relative;
}

.section-dark .section-heading {
    color: #F0F0E8;
}

.section-dark .body-text {
    color: #D8D8CC;
}

.section-dark .section-inner {
    max-width: 58%;
    margin: 0 auto;
    padding: 32px;
}

.dark-photo {
    max-width: 70%;
    margin: 60px auto 0;
}

/* --- Breathing Gaps --- */
.content-section + .content-section {
    margin-top: 0;
}

#section-about {
    padding-top: 200px;
}

#section-photo-1 {
    padding-top: 80px;
}

#collision-1 {
    margin-top: 60px;
    margin-bottom: 60px;
}

#section-stories {
    padding-top: 180px;
}

#collision-2 {
    margin-top: 40px;
}

#section-return {
    padding-top: 200px;
}

#collision-3 {
    margin-top: 60px;
}

/* --- Closing Section --- */
.section-closing {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    position: relative;
    z-index: 2;
}

.closing-content {
    position: relative;
}

.closing-text {
    font-family: 'Noto Sans KR', 'Space Grotesk', sans-serif;
    font-weight: 400;
    font-size: clamp(1.5rem, 3vw, 2.5rem);
    color: #1A1A1A;
    line-height: 1.6;
    margin-bottom: 24px;
}

.closing-subtitle {
    font-family: 'Outfit', sans-serif;
    font-weight: 300;
    font-size: 1rem;
    letter-spacing: 0.3em;
    color: #7B7B6E;
}

/* --- Viewport Border (Closing Gesture) --- */
#viewport-border {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 99;
    opacity: 0;
    transition: opacity 0.6s ease;
}

#viewport-border.active {
    opacity: 1;
}

#viewport-border::before,
#viewport-border::after {
    content: '';
    position: absolute;
    pointer-events: none;
}

#viewport-border::before {
    top: 8px;
    left: 8px;
    width: 0;
    height: 0;
    border-top: 1px solid #D6FF7E;
    border-right: 1px solid #D6FF7E;
    transition: width 0.8s ease, height 0.8s ease 0.4s;
}

#viewport-border::after {
    bottom: 8px;
    right: 8px;
    width: 0;
    height: 0;
    border-bottom: 1px solid #6B2FD6;
    border-left: 1px solid #6B2FD6;
    transition: width 0.8s ease 0.8s, height 0.8s ease 1.2s;
}

#viewport-border.active::before {
    width: calc(100% - 16px);
    height: calc(100% - 16px);
}

#viewport-border.active::after {
    width: calc(100% - 16px);
    height: calc(100% - 16px);
}

/* --- Grid Line Animation in Dark Section --- */
body.in-dark-section .grid-line {
    border-left-color: rgba(214, 255, 126, 0.12);
}

/* --- Grid Fade Out for Closing --- */
body.closing-active #grid-overlay {
    opacity: 0;
    transition: opacity 2s ease;
}

/* --- Responsive: Mobile (<768px) --- */
@media (max-width: 768px) {
    #grid-overlay {
        grid-template-columns: repeat(6, 1fr);
        padding: 0 3vw;
    }

    .grid-line:nth-child(n+7) {
        display: none;
    }

    .section-left .section-inner,
    .section-right .section-inner,
    .section-center .section-inner,
    .section-dark .section-inner {
        max-width: 90%;
        margin-left: 5%;
        margin-right: 5%;
    }

    .section-right {
        flex-direction: column;
    }

    .section-right .photo-block {
        max-width: 100%;
        margin-right: 0;
    }

    .collision-english {
        max-width: 85%;
        padding: 24px;
    }

    .collision-korean {
        font-size: clamp(6rem, 20vw, 14rem);
    }

    .hero-title {
        font-size: clamp(5rem, 16vw, 10rem);
    }

    .hero-vertical-text {
        right: -60px;
    }

    .rotated-block {
        transform: rotate(0deg);
    }

    .margin-note {
        position: relative;
        writing-mode: horizontal-tb;
        text-orientation: initial;
        left: auto;
        top: auto;
        transform: none;
        display: block;
        margin-top: 24px;
        padding-left: 5%;
    }

    .margin-note-right,
    .margin-note-left {
        left: auto;
        right: auto;
    }

    .opening-content {
        margin-left: 5%;
    }

    .hero-subtitle {
        margin-left: 0;
    }

    .dark-photo {
        max-width: 95%;
    }

    #section-about,
    #section-stories,
    #section-return {
        padding-top: 100px;
    }
}

/* --- Selection Styling --- */
::selection {
    background: #D6FF7E;
    color: #1A1A1A;
}

::-moz-selection {
    background: #D6FF7E;
    color: #1A1A1A;
}
