/* =====================================================
   tsundere.style — CSS
   Colors: #F5EDE0 #1A0A00 #C4622D #8A6A50 #3D2010
           #EDD9C0 #F0C490 #2D1B00
   Fonts: Fraunces (variable), Instrument Serif, Space Grotesk
   ===================================================== */

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

/* ---- Root variables ---- */
:root {
    --bg:        #F5EDE0;
    --text-dark: #1A0A00;
    --accent:    #C4622D;
    --stone:     #8A6A50;
    --espresso:  #3D2010;
    --sand:      #EDD9C0;
    --amber:     #F0C490;
    --spine-clr: #2D1B00;

    --spine-x: 50%;
    --max-w: 1100px;
    --col-gap: 80px;
    --section-gap: 120px;
}

/* ---- Base ---- */
html {
    scroll-behavior: smooth;
}

body {
    background-color: var(--bg);
    color: var(--text-dark);
    font-family: 'Instrument Serif', Georgia, serif;
    overflow-x: hidden;
    position: relative;
}

/* ---- Noise texture overlay ---- */
#noise-overlay {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    pointer-events: none;
    z-index: 9999;
    opacity: 0.03;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='300' height='300'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.75' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='300' height='300' filter='url(%23noise)' opacity='1'/%3E%3C/svg%3E");
    background-repeat: repeat;
}

/* ---- Grid background ---- */
#grid-bg {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    pointer-events: none;
    z-index: 0;
    background-image:
        repeating-linear-gradient(
            to right,
            rgba(45, 27, 0, 0.08) 0px,
            rgba(45, 27, 0, 0.08) 1px,
            transparent 1px,
            transparent calc(100% / 12)
        ),
        repeating-linear-gradient(
            to bottom,
            rgba(45, 27, 0, 0.05) 0px,
            rgba(45, 27, 0, 0.05) 1px,
            transparent 1px,
            transparent 80px
        );
}

/* ---- Progress bar: left edge amber line ---- */
#progress-bar {
    position: fixed;
    top: 0;
    left: 0;
    width: 2px;
    height: 0%;
    background-color: var(--accent);
    z-index: 1000;
    transition: height 0.05s linear;
}

/* =====================================================
   TYPOGRAPHY CLASSES
   ===================================================== */

.fraunces-heading {
    font-family: 'Fraunces', Georgia, serif;
    font-style: normal;
    font-variation-settings: 'wght' 200, 'opsz' 72;
    color: var(--text-dark);
    transition: font-variation-settings 300ms ease;
}

.fraunces-heading.warm {
    font-variation-settings: 'wght' 500, 'opsz' 72;
}

.fraunces-italic {
    font-family: 'Fraunces', Georgia, serif;
    font-style: italic;
    font-variation-settings: 'wght' 300, 'opsz' 144;
    color: var(--espresso);
    transition: font-variation-settings 300ms ease;
}

.fraunces-italic:hover {
    font-variation-settings: 'wght' 700, 'opsz' 144;
}

.instrument-serif {
    font-family: 'Instrument Serif', Georgia, serif;
    font-weight: 400;
    font-style: normal;
}

.space-grotesk-meta {
    font-family: 'Space Grotesk', system-ui, sans-serif;
    font-weight: 300;
    font-size: 11px;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: var(--stone);
}

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

#hero {
    width: 100%;
    height: 100vh;
    min-height: 600px;
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    overflow: hidden;
}

/* Ambient amber radial glow behind hero */
#hero::before {
    content: '';
    position: absolute;
    top: 30%;
    left: 5%;
    width: 35%;
    height: 60%;
    background: radial-gradient(ellipse at center, rgba(240, 196, 144, 0.18) 0%, transparent 70%);
    pointer-events: none;
    z-index: 0;
}

#hero-inner {
    display: flex;
    width: 100%;
    max-width: var(--max-w);
    margin: 0 auto;
    padding: 0 40px;
    align-items: center;
    height: 100%;
    position: relative;
    z-index: 1;
}

#hero-text {
    width: 40%;
    padding-right: 60px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

#hero-title {
    font-size: clamp(42px, 5.5vw, 72px);
    line-height: 1.05;
    letter-spacing: -0.02em;
}

#hero-descriptor {
    font-size: 11px;
    letter-spacing: 0.25em;
    color: var(--stone);
    margin-top: 8px;
}

#hero-photo-wrap {
    width: 60%;
    height: 80vh;
    position: relative;
}

.hero-photo-container {
    width: 100%;
    height: 100%;
}

/* =====================================================
   PHOTO CONTAINERS
   ===================================================== */

.photo-container {
    position: relative;
    overflow: hidden;
    display: block;
}

.photo-container .photo-img {
    width: 100%;
    height: 100%;
    background-size: cover;
    background-position: center;
    filter: grayscale(90%) contrast(1.1);
    transition: filter 600ms cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.photo-container .photo-warm-overlay {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: radial-gradient(ellipse at center, rgba(240, 196, 144, 0.15) 0%, transparent 70%);
    opacity: 0;
    transition: opacity 600ms cubic-bezier(0.25, 0.46, 0.45, 0.94);
    pointer-events: none;
}

/* Hover states */
.photo-container:hover .photo-img {
    filter: grayscale(0%) contrast(1.05);
}

.photo-container:hover .photo-warm-overlay {
    opacity: 1;
}

/* Scroll-triggered warm state */
.photo-container.photo-visible .photo-img {
    filter: grayscale(10%) contrast(1.05);
    opacity: 1;
}

/* Initial state for scroll-trigger fade-in */
.photo-container.photo-hidden {
    opacity: 0;
}

.photo-container.photo-fading-in {
    opacity: 1;
    transition: opacity 400ms ease;
}

/* Aspect ratios */
.ratio-4-3 {
    aspect-ratio: 4 / 3;
}

.ratio-3-4 {
    aspect-ratio: 3 / 4;
}

/* Final photo: full color from the start */
.photo-final .photo-img {
    filter: grayscale(0%) contrast(1.0) !important;
}

/* =====================================================
   TIMELINE LAYOUT
   ===================================================== */

#timeline-section {
    position: relative;
    z-index: 1;
    padding: 0 0 var(--section-gap) 0;
}

#timeline-wrapper {
    max-width: var(--max-w);
    margin: 0 auto;
    padding: 0 40px;
    position: relative;
}

/* ---- Spine ---- */
#spine {
    position: absolute;
    left: 50%;
    top: 0;
    bottom: 0;
    transform: translateX(-50%);
    width: 1px;
    z-index: 2;
    pointer-events: none;
}

#spine-line {
    position: absolute;
    top: 0;
    left: 0;
    width: 1px;
    height: 100%;
    background-color: var(--spine-clr);
    opacity: 0.5;
    transition: opacity 200ms ease;
}

#spine-dot {
    position: absolute;
    top: 0;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background-color: var(--accent);
    opacity: 0;
    z-index: 3;
}

/* ---- Timeline Entries ---- */
.timeline-entry {
    display: grid;
    grid-template-columns: 1fr 40px 1fr;
    align-items: start;
    margin-bottom: var(--section-gap);
    position: relative;
}

/* Left entry: photo on left, empty on right */
.entry-left .entry-spine-mark {
    grid-column: 2;
    grid-row: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
}

.entry-left .entry-content {
    grid-column: 1;
    grid-row: 1;
    padding-right: 40px;
}

/* Right entry: empty on left, photo on right */
.entry-right .entry-spine-mark {
    grid-column: 2;
    grid-row: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
}

.entry-right .entry-content {
    grid-column: 3;
    grid-row: 1;
    padding-left: 40px;
}

/* Spine tick mark */
.spine-tick {
    display: block;
    width: 8px;
    height: 1px;
    background-color: var(--spine-clr);
    opacity: 0.4;
    margin-top: 20px;
}

/* Date stamp — rotated */
.date-stamp {
    margin-top: 8px;
    writing-mode: vertical-rl;
    transform: rotate(180deg);
    white-space: nowrap;
    font-size: 10px;
    letter-spacing: 0.15em;
    color: var(--stone);
    user-select: none;
}

/* Caption */
.caption {
    margin-top: 12px;
    font-size: 15px;
    line-height: 1.6;
    color: var(--espresso);
    opacity: 0.85;
    max-width: 380px;
    transition: color 200ms ease;
}

.caption:hover {
    color: var(--accent);
}

.caption-chevron {
    color: var(--accent);
    font-size: 14px;
    font-family: 'Space Grotesk', sans-serif;
}

/* Caption for final entry */
.caption-final {
    color: var(--espresso);
    opacity: 1;
}

/* Pull quote */
.pull-quote {
    display: block;
    font-size: clamp(22px, 3vw, 34px);
    line-height: 1.35;
    color: var(--espresso);
    opacity: 0.6;
    margin-top: 28px;
    margin-left: -20px;  /* bleeds slightly beyond column */
    padding-left: 0;
    border: none;
    font-variation-settings: 'wght' 300, 'opsz' 144;
    font-style: italic;
    max-width: 420px;
    transition: opacity 300ms ease, font-variation-settings 300ms ease;
}

.pull-quote:hover {
    opacity: 1;
    font-variation-settings: 'wght' 700, 'opsz' 144;
}

.entry-right .pull-quote {
    margin-left: 0;
    margin-right: -20px;
}

/* Final pull quote */
.pull-quote-final {
    opacity: 0.85;
    color: var(--accent);
}

/* Section rule between timeline segments */
.section-rule {
    width: 100%;
    height: 1px;
    background-color: var(--spine-clr);
    opacity: 0.2;
    margin-bottom: var(--section-gap);
}

/* =====================================================
   CLOSING
   ===================================================== */

#closing {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 120px 40px 140px;
    position: relative;
    z-index: 1;
}

/* Ambient amber glow behind closing */
#closing::before {
    content: '';
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: radial-gradient(ellipse at center, rgba(240, 196, 144, 0.14) 0%, transparent 60%);
    pointer-events: none;
}

#closing-title {
    font-size: clamp(56px, 9vw, 96px);
    text-align: center;
    position: relative;
    z-index: 1;
}

/* The tsundere admission: this heading becomes warm and bold */
.closing-admit {
    color: var(--accent) !important;
    font-variation-settings: 'wght' 800, 'opsz' 72 !important;
}

/* =====================================================
   SCROLL-TRIGGERED STATES
   ===================================================== */

/* Headings warm on viewport entry */
.fraunces-heading.in-view {
    font-variation-settings: 'wght' 500, 'opsz' 72;
}

/* Photo fade-in on scroll */
.photo-container {
    opacity: 0;
    transition: opacity 400ms ease,
                filter 600ms cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.photo-container.visible {
    opacity: 1;
}

.photo-container.visible .photo-img {
    filter: grayscale(10%) contrast(1.05);
}

/* ====================================================
   KEYFRAME ANIMATIONS
   ==================================================== */

/* Spine line opacity pulse — faint heartbeat on idle */
@keyframes spinePulse {
    0%   { opacity: 0.5; }
    50%  { opacity: 0.85; }
    100% { opacity: 0.5; }
}

/* Spine dot travel — controlled by JS, this provides the base fade */
@keyframes dotFadeIn {
    from { opacity: 0; transform: translate(-50%, -50%) scale(0.6); }
    to   { opacity: 0.85; transform: translate(-50%, -50%) scale(1); }
}

/* Warm wash fade — photograph warming on scroll */
@keyframes warmReveal {
    from { opacity: 0; }
    to   { opacity: 0.15; }
}

/* =====================================================
   GENERATED PHOTO COMPOSITIONS
   CSS-painted photographic abstracts: intimate, ambiguous
   ===================================================== */

/* All generated photos: dark rich base */
.photo-gen {
    width: 100%;
    height: 100%;
    min-height: 280px;
    background-color: #1a1410;
}

/* Hero: light across a floor — diagonal shaft of warmth */
.photo-gen--hero {
    background:
        radial-gradient(ellipse 30% 70% at 70% 50%, rgba(200, 160, 90, 0.55) 0%, transparent 60%),
        linear-gradient(135deg, #0d0a08 0%, #1e1610 35%, #2a1e14 50%, #3a2818 65%, #221810 100%),
        repeating-linear-gradient(170deg, rgba(255,255,255,0.01) 0px, rgba(255,255,255,0.01) 1px, transparent 1px, transparent 12px);
}

/* Photo 1: hand around a ceramic cup — close crop, warm center */
.photo-gen--1 {
    background:
        radial-gradient(ellipse 45% 55% at 55% 60%, rgba(180, 130, 70, 0.6) 0%, rgba(120, 80, 40, 0.3) 40%, transparent 70%),
        radial-gradient(circle 20% at 48% 58%, rgba(230, 190, 130, 0.45) 0%, transparent 50%),
        linear-gradient(160deg, #111009 0%, #1c1410 40%, #261a0f 70%, #170f08 100%);
}

/* Photo 2: light falling through window — angular geometric */
.photo-gen--2 {
    background:
        linear-gradient(145deg, transparent 0%, transparent 40%, rgba(220, 175, 100, 0.5) 42%, rgba(200, 155, 70, 0.35) 55%, transparent 60%, transparent 100%),
        linear-gradient(145deg, transparent 0%, transparent 43%, rgba(240, 200, 120, 0.25) 45%, rgba(210, 165, 80, 0.2) 58%, transparent 63%, transparent 100%),
        linear-gradient(180deg, #0d0b09 0%, #1a1410 30%, #14100c 60%, #0e0b09 100%);
}

/* Photo 3: coat near a door — vertical form, dark edge */
.photo-gen--3 {
    background:
        linear-gradient(95deg, rgba(30, 22, 14, 0.95) 0%, rgba(40, 28, 16, 0.6) 30%, rgba(100, 72, 40, 0.3) 50%, rgba(160, 115, 65, 0.15) 70%, transparent 85%),
        radial-gradient(ellipse 15% 80% at 30% 50%, rgba(80, 56, 30, 0.7) 0%, transparent 100%),
        linear-gradient(180deg, #0e0c0a 0%, #1b1510 50%, #130f0c 100%);
}

/* Photo 4: frost on glass, amber inside — diffuse bloom */
.photo-gen--4 {
    background:
        radial-gradient(ellipse 50% 40% at 60% 45%, rgba(240, 190, 100, 0.5) 0%, rgba(200, 150, 70, 0.3) 35%, transparent 65%),
        radial-gradient(circle at 60% 45%, rgba(255, 220, 140, 0.2) 0%, transparent 40%),
        linear-gradient(180deg, #0c0b0a 0%, #19160f 40%, #221c12 55%, #19140e 100%),
        repeating-linear-gradient(100deg, rgba(255,255,255,0.015) 0px, rgba(255,255,255,0.015) 1px, transparent 1px, transparent 8px);
}

/* Photo 5: hands briefly touching — two forms, center highlight */
.photo-gen--5 {
    background:
        radial-gradient(ellipse 60% 30% at 45% 55%, rgba(170, 125, 75, 0.5) 0%, rgba(120, 85, 45, 0.25) 45%, transparent 70%),
        radial-gradient(circle 8% at 42% 53%, rgba(220, 175, 110, 0.4) 0%, transparent 100%),
        radial-gradient(circle 8% at 58% 57%, rgba(200, 155, 90, 0.35) 0%, transparent 100%),
        linear-gradient(180deg, #0f0d0a 0%, #1d1610 45%, #15110d 100%);
}

/* Photo 6: morning — soft horizontal light bands */
.photo-gen--6 {
    background:
        linear-gradient(180deg,
            rgba(30, 22, 14, 0.9) 0%,
            rgba(60, 44, 26, 0.5) 20%,
            rgba(190, 150, 90, 0.45) 38%,
            rgba(220, 175, 105, 0.4) 45%,
            rgba(180, 140, 80, 0.3) 55%,
            rgba(50, 36, 20, 0.5) 72%,
            rgba(18, 14, 10, 0.9) 100%),
        linear-gradient(180deg, #0e0c0a 0%, #201810 100%);
}

/* Final photo: full color reveal — warm amber tones, full saturation shown through CSS */
.photo-gen--final {
    background:
        radial-gradient(ellipse 80% 70% at 50% 45%, rgba(195, 140, 70, 0.75) 0%, rgba(160, 105, 45, 0.5) 40%, rgba(100, 65, 25, 0.2) 70%, transparent 90%),
        radial-gradient(circle at 35% 40%, rgba(240, 200, 120, 0.5) 0%, transparent 40%),
        radial-gradient(circle at 65% 60%, rgba(210, 155, 80, 0.45) 0%, transparent 35%),
        linear-gradient(160deg, #2a1e0c 0%, #3d2a10 30%, #4a3315 50%, #382610 70%, #231800 100%);
}

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

@media (max-width: 768px) {
    #hero-inner {
        flex-direction: column;
        padding: 60px 24px 40px;
        gap: 40px;
    }

    #hero-text {
        width: 100%;
        padding-right: 0;
    }

    #hero-title {
        font-size: 42px;
    }

    #hero-photo-wrap {
        width: 100%;
        height: 50vw;
        min-height: 240px;
    }

    #timeline-wrapper {
        padding: 0 16px;
    }

    .timeline-entry {
        grid-template-columns: 1fr 24px 1fr;
        margin-bottom: 80px;
    }

    .entry-left .entry-content {
        padding-right: 16px;
    }

    .entry-right .entry-content {
        padding-left: 16px;
    }

    .pull-quote {
        font-size: 18px;
        margin-left: 0;
    }

    .entry-right .pull-quote {
        margin-right: 0;
    }

    #closing-title {
        font-size: 48px;
    }
}
