/* ===================================
   gabs.cx - Chrome & Candlelight
   =================================== */

/* --- CSS Custom Properties --- */
:root {
    --chrome-light: #C0C0C8;
    --chrome-mid: #7B7D84;
    --chrome-dark: #3A3A42;
    --chrome-gradient-start: #E8E8EE;
    --chrome-gradient-end: #4A4A54;
    --candle-warm: #E8A83E;
    --candle-hot: #FFF5E0;
    --candle-ambient: #C4883A;
    --shadow-deep: #1A1A1E;
    --shadow-mid: #2E2E34;
    --memory-tint: #9E7B7B;
    --reflection: #D4D4DC;
    --body-cream: #F0E6D3;
    --body-graphite: #2A2A2E;
    --ui-chrome-gray: #8A8A90;
}

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

html {
    scroll-behavior: smooth;
    overflow-x: hidden;
}

body {
    background: var(--shadow-deep);
    color: var(--candle-hot);
    font-family: 'Source Serif 4', Georgia, serif;
    font-weight: 400;
    font-size: 18px;
    line-height: 1.65;
    letter-spacing: 0.005em;
    overflow-x: hidden;
    animation: ambientFlicker 3s ease-in-out infinite;
}

/* --- Ambient Flicker (entire page) --- */
@keyframes ambientFlicker {
    0%, 100% { filter: brightness(1); }
    50% { filter: brightness(0.98); }
}

/* --- Scroll Navigation --- */
.scroll-nav {
    position: fixed;
    left: 16px;
    top: 0;
    bottom: 0;
    width: 2px;
    z-index: 100;
    pointer-events: all;
    cursor: pointer;
}

.scroll-nav-line {
    position: absolute;
    top: 0;
    left: 0;
    width: 2px;
    height: 100%;
    background: linear-gradient(180deg, var(--chrome-gradient-start), var(--chrome-light), var(--chrome-mid), var(--chrome-gradient-end), var(--chrome-dark));
    opacity: 0.3;
}

.scroll-nav-progress {
    position: absolute;
    top: 0;
    left: 0;
    width: 2px;
    height: 0%;
    background: linear-gradient(180deg, var(--chrome-light), var(--candle-warm));
    transition: height 0.1s linear;
}

.scroll-nav-marker {
    position: absolute;
    left: -3px;
    width: 8px;
    height: 8px;
    opacity: 0.6;
}

.scroll-nav-marker::before {
    content: '';
    display: block;
    width: 8px;
    height: 8px;
    background: var(--candle-warm);
    border-radius: 50% 50% 50% 0;
    transform: rotate(-45deg) scale(0.6);
    filter: blur(0.5px);
}

.scroll-nav-marker:nth-child(3) { top: 10%; }
.scroll-nav-marker:nth-child(4) { top: 30%; }
.scroll-nav-marker:nth-child(5) { top: 50%; }
.scroll-nav-marker:nth-child(6) { top: 70%; }
.scroll-nav-marker:nth-child(7) { top: 90%; }

/* ===================================
   Section 1: The Chrome Viewport
   =================================== */
.chrome-viewport {
    position: relative;
    height: 100vh;
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.chrome-surface {
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, #E8E8EE 0%, #C0C0C8 25%, #7B7D84 50%, #4A4A54 75%, #3A3A42 100%);
    z-index: 0;
}

.chrome-title {
    position: relative;
    z-index: 2;
    text-align: center;
}

.title-text {
    font-family: 'Libre Baskerville', Georgia, serif;
    font-style: italic;
    font-weight: 400;
    font-size: clamp(80px, 15vw, 160px);
    line-height: 1.05;
    letter-spacing: -0.02em;
    background: linear-gradient(135deg, #E8E8EE 0%, #C0C0C8 25%, #7B7D84 50%, #4A4A54 75%, #3A3A42 100%);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    opacity: 0;
    transition: opacity 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

.title-text.visible {
    opacity: 1;
}

.title-text .char {
    display: inline-block;
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.6s cubic-bezier(0.4, 0, 0.2, 1), transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
    /* Chrome gradient on individual letters */
    background: linear-gradient(180deg, var(--shadow-deep) 0%, var(--chrome-dark) 40%, var(--chrome-mid) 60%, var(--chrome-light) 100%);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.title-text .char.revealed {
    opacity: 1;
    transform: translateY(0);
}

/* Entry flame */
.candle-flame-container {
    position: relative;
    z-index: 2;
    margin-top: 40px;
    opacity: 0;
    transition: opacity 1.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.candle-flame-container.visible {
    opacity: 1;
}

/* Flame animations */
@keyframes flicker {
    0%, 100% { opacity: 1; transform: scale(1); }
    25% { opacity: 0.9; transform: scale(0.98, 1.02); }
    50% { opacity: 0.85; transform: scale(0.97, 1.03); }
    75% { opacity: 0.92; transform: scale(0.99, 1.01); }
}

.flame-mid {
    animation: flicker 2.5s ease-in-out infinite;
    transform-origin: center bottom;
}

.flame-inner {
    animation: flicker 2s ease-in-out infinite 0.3s;
    transform-origin: center bottom;
}

.flame-outer {
    animation: flicker 3s ease-in-out infinite 0.5s;
    transform-origin: center center;
}

/* Scroll prompt */
.scroll-prompt {
    position: absolute;
    bottom: 40px;
    z-index: 2;
    opacity: 0;
    transition: opacity 1.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.scroll-prompt.visible {
    opacity: 1;
}

.scroll-line {
    stroke-dasharray: 80;
    stroke-dashoffset: 80;
    transition: stroke-dashoffset 2s cubic-bezier(0.4, 0, 0.2, 1);
}

.scroll-prompt.visible .scroll-line {
    stroke-dashoffset: 0;
}

/* ===================================
   Section 2: First Candle Station
   =================================== */
.candle-station {
    position: relative;
    min-height: 100vh;
    padding: 120px 48px 120px 48px;
    background: var(--shadow-deep);
    overflow: hidden;
}

/* Candlelight glow effect */
.candle-station::before {
    content: '';
    position: absolute;
    top: 10%;
    left: 10%;
    width: 500px;
    height: 500px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(232, 168, 62, 0.08) 0%, transparent 70%);
    pointer-events: none;
}

.candle-station-inner {
    display: grid;
    grid-template-columns: 35% 1fr;
    gap: 48px;
    max-width: 1400px;
    margin: 0;
    padding-left: 40px;
}

.candle-column {
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.melting-candle {
    width: 100%;
    max-width: 200px;
    height: auto;
}

.wax-drip {
    opacity: 0;
    transition: opacity 1.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.candle-station.in-view .wax-drip {
    opacity: 1;
}

.wax-drip-1 { transition-delay: 0.5s; }
.wax-drip-2 { transition-delay: 1s; }
.wax-drip-3 { transition-delay: 1.5s; }

.content-column {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 24px;
    max-width: 600px;
}

.section-heading {
    font-family: 'Libre Baskerville', Georgia, serif;
    font-weight: 700;
    font-size: clamp(36px, 5vw, 64px);
    line-height: 1.05;
    letter-spacing: -0.02em;
    background: linear-gradient(135deg, #E8E8EE 0%, #C0C0C8 25%, #7B7D84 50%, #4A4A54 75%, #3A3A42 100%);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.body-text {
    font-family: 'Source Serif 4', Georgia, serif;
    font-weight: 400;
    font-size: 18px;
    line-height: 1.65;
    letter-spacing: 0.005em;
    color: #F0E6D3;
}

/* Dark-on-light section variant */
.body-text.on-light {
    color: #2A2A2E;
}

.body-text.de-emphasized {
    font-weight: 300;
    opacity: 0.7;
}

.timestamp {
    font-family: 'Josefin Sans', sans-serif;
    font-weight: 300;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    color: #8A8A90;
}

/* Smoke trails */
.smoke-trail {
    position: absolute;
    pointer-events: none;
    opacity: 0.5;
}

.smoke-trail-1 {
    top: 5%;
    left: calc(10% + 100px);
}

.smoke-path {
    stroke-dasharray: 600;
    stroke-dashoffset: 600;
    transition: stroke-dashoffset 3s cubic-bezier(0.4, 0, 0.2, 1);
}

.candle-station.in-view .smoke-path {
    stroke-dashoffset: 0;
}

/* Reveal animation for elements */
.reveal-element {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 1.2s cubic-bezier(0.4, 0, 0.2, 1), transform 1.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.reveal-element.revealed {
    opacity: 1;
    transform: translateY(0);
}

/* ===================================
   Section 3: The Reflection Corridor
   =================================== */
.reflection-corridor {
    position: relative;
    height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    background: var(--shadow-deep);
}

.chrome-pool-filter {
    position: absolute;
}

.reflection-surface {
    position: absolute;
    inset: 0;
}

.chrome-pool {
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, #E8E8EE 0%, #C0C0C8 20%, #7B7D84 50%, #4A4A54 80%, #3A3A42 100%);
    filter: url(#chromeDistortion);
    opacity: 0.4;
}

.reflection-content {
    position: relative;
    z-index: 2;
    text-align: center;
    padding: 0 48px;
}

.reflection-heading {
    font-family: 'Libre Baskerville', Georgia, serif;
    font-weight: 400;
    font-size: clamp(40px, 6vw, 72px);
    line-height: 1.05;
    letter-spacing: -0.02em;
    color: var(--candle-hot);
    opacity: 0;
    transition: opacity 1s cubic-bezier(0.4, 0, 0.2, 1);
}

.reflection-heading.visible {
    opacity: 1;
}

.reflection-heading .char {
    display: inline-block;
    opacity: 0;
    transition: opacity 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.reflection-heading .char.revealed {
    opacity: 1;
}

.mirrored-content {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    text-align: center;
    transform: scaleY(-1);
    filter: blur(4px);
    opacity: 0.15;
    z-index: 1;
    padding: 60px;
    pointer-events: none;
}

.mirrored-text {
    font-family: 'Libre Baskerville', Georgia, serif;
    font-weight: 700;
    font-size: clamp(36px, 5vw, 64px);
    background: linear-gradient(135deg, #E8E8EE 0%, #C0C0C8 25%, #7B7D84 50%, #4A4A54 75%, #3A3A42 100%);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

/* ===================================
   Section 4: Memory Archive
   =================================== */
.memory-archive {
    position: relative;
    min-height: 100vh;
    padding: 120px 48px;
    background: var(--shadow-deep);
    overflow: hidden;
}

.archive-floating-objects {
    position: absolute;
    left: 0;
    top: 0;
    width: 30%;
    height: 100%;
    pointer-events: none;
}

/* Chrome spheres */
.chrome-sphere {
    position: absolute;
    border-radius: 50%;
    overflow: hidden;
}

.chrome-sphere-1 {
    width: 120px;
    height: 120px;
    top: 15%;
    left: 10%;
    animation: sphereRotate 25s linear infinite;
}

.chrome-sphere-2 {
    width: 60px;
    height: 60px;
    top: 55%;
    left: 20%;
    animation: sphereRotate 20s linear infinite reverse;
}

.sphere-inner {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: radial-gradient(ellipse at 30% 30%, var(--chrome-gradient-start), var(--chrome-light) 30%, var(--chrome-mid) 60%, var(--chrome-dark) 90%);
    box-shadow:
        inset -10px -10px 30px rgba(58, 58, 66, 0.5),
        inset 5px 5px 15px rgba(232, 232, 238, 0.3),
        0 0 20px rgba(192, 192, 200, 0.1);
}

.chrome-sphere-1 .sphere-inner::after {
    content: '';
    position: absolute;
    top: 20%;
    left: 60%;
    width: 15px;
    height: 10px;
    background: radial-gradient(ellipse, rgba(232, 168, 62, 0.4), transparent);
    border-radius: 50%;
}

@keyframes sphereRotate {
    0% { transform: rotateY(0deg); }
    100% { transform: rotateY(360deg); }
}

/* Memory objects */
.memory-object {
    position: absolute;
    animation: sphereRotate 30s linear infinite;
}

.memory-key {
    top: 35%;
    left: 15%;
    opacity: 0.7;
}

.memory-marble {
    top: 75%;
    left: 8%;
    width: 40px;
    height: 40px;
}

.marble-inner {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: radial-gradient(ellipse at 35% 35%, var(--candle-hot), var(--candle-warm) 40%, var(--candle-ambient) 70%, var(--chrome-dark) 100%);
    box-shadow:
        inset -5px -5px 15px rgba(26, 26, 30, 0.4),
        0 0 15px rgba(232, 168, 62, 0.15);
}

/* Archive cards - right-heavy layout */
.archive-cards {
    display: flex;
    flex-direction: column;
    gap: 40px;
    margin-left: auto;
    max-width: 65%;
    position: relative;
    z-index: 2;
}

.archive-card {
    position: relative;
    background: var(--shadow-mid);
    border-radius: 4px;
    overflow: visible;
    box-shadow: 0 0 60px rgba(232, 168, 62, 0.15), 0 0 120px rgba(196, 136, 58, 0.08);
    transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.archive-card:nth-child(odd) {
    margin-left: 40px;
}

.archive-card:nth-child(even) {
    margin-right: 40px;
}

/* Depth layering */
.card-depth-7 { z-index: 7; }
.card-depth-5 { z-index: 5; }
.card-depth-3 {
    z-index: 3;
    filter: blur(0.5px);
    opacity: 0.9;
}
.card-depth-4 {
    z-index: 4;
    filter: blur(0.3px);
    opacity: 0.95;
}

/* Animated border gradient for candlelight catching */
.archive-card::before {
    content: '';
    position: absolute;
    inset: -1px;
    border-radius: 5px;
    background: linear-gradient(
        var(--card-border-angle, 135deg),
        transparent 30%,
        var(--candle-warm) 50%,
        transparent 70%
    );
    z-index: -1;
    opacity: 0.3;
    animation: borderGlow 6s linear infinite;
}

@keyframes borderGlow {
    0% { --card-border-angle: 0deg; }
    100% { --card-border-angle: 360deg; }
}

/* Fallback for browsers that don't support @property */
@property --card-border-angle {
    syntax: '<angle>';
    initial-value: 0deg;
    inherits: false;
}

.card-content {
    padding: 40px;
}

.card-timestamp {
    font-family: 'Josefin Sans', sans-serif;
    font-weight: 300;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    color: #9E7B7B;
    display: block;
    margin-bottom: 16px;
}

.card-heading {
    font-family: 'Libre Baskerville', Georgia, serif;
    font-weight: 700;
    font-size: clamp(24px, 3vw, 36px);
    line-height: 1.1;
    letter-spacing: -0.02em;
    background: linear-gradient(135deg, #E8E8EE 0%, #C0C0C8 25%, #7B7D84 50%, #4A4A54 75%, #3A3A42 100%);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    margin-bottom: 16px;
}

.card-text {
    font-family: 'Source Serif 4', Georgia, serif;
    font-weight: 400;
    font-size: 17px;
    line-height: 1.65;
    color: var(--candle-hot);
}

/* Wax drip borders */
.wax-drip-border {
    display: block;
    width: 100%;
    height: 20px;
    position: absolute;
    bottom: -18px;
    left: 0;
}

.drip-path {
    stroke-dasharray: 1200;
    stroke-dashoffset: 1200;
    fill: var(--shadow-mid);
    stroke: none;
    transition: stroke-dashoffset 2s cubic-bezier(0.4, 0, 0.2, 1);
}

.archive-card.revealed .drip-path {
    stroke-dashoffset: 0;
}

/* Wick lines */
.wick-lines {
    position: absolute;
    right: 50%;
    top: 80px;
    pointer-events: none;
    opacity: 0.4;
}

.wick-line-path {
    stroke-dasharray: 800;
    stroke-dashoffset: 800;
    transition: stroke-dashoffset 3s cubic-bezier(0.4, 0, 0.2, 1);
}

.memory-archive.in-view .wick-line-path {
    stroke-dashoffset: 0;
}

/* ===================================
   Section 5: The Dissolution
   =================================== */
.dissolution {
    position: relative;
    height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: var(--shadow-deep);
    overflow: hidden;
}

.dissolution-content {
    position: relative;
    z-index: 2;
    text-align: center;
    padding: 0 48px;
}

.dissolving-flame {
    margin: 0 auto 40px;
    transition: opacity 2s cubic-bezier(0.4, 0, 0.2, 1), transform 2s cubic-bezier(0.4, 0, 0.2, 1);
}

.dissolving-flame.extinguishing {
    opacity: 0;
    transform: scale(0.5);
}

.dissolution-heading {
    font-family: 'Libre Baskerville', Georgia, serif;
    font-weight: 400;
    font-style: italic;
    font-size: clamp(32px, 5vw, 56px);
    line-height: 1.1;
    letter-spacing: -0.02em;
    color: var(--candle-hot);
    margin-bottom: 16px;
    transition: opacity 3s cubic-bezier(0.4, 0, 0.2, 1);
}

.dissolution-text {
    font-family: 'Source Serif 4', Georgia, serif;
    font-weight: 300;
    font-size: 20px;
    color: var(--chrome-light);
    opacity: 0.6;
    transition: opacity 3s cubic-bezier(0.4, 0, 0.2, 1);
}

.dissolution.dissolving .dissolution-heading,
.dissolution.dissolving .dissolution-text {
    opacity: 0.1;
}

/* Ghost borders */
.ghost-borders {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    pointer-events: none;
    opacity: 0;
    transition: opacity 2s cubic-bezier(0.4, 0, 0.2, 1);
}

.dissolution.in-view .ghost-borders {
    opacity: 1;
}

.ghost-path {
    stroke-dasharray: 1400;
    stroke-dashoffset: 1400;
    transition: stroke-dashoffset 3s cubic-bezier(0.4, 0, 0.2, 1);
}

.dissolution.in-view .ghost-path {
    stroke-dashoffset: 0;
}

.ghost-1 { transition-delay: 0s; }
.ghost-2 { transition-delay: 0.5s; }
.ghost-3 { transition-delay: 1s; }
.ghost-4 { transition-delay: 1.5s; }

/* Dissolution reverse animations */
.dissolution.dissolving .ghost-path {
    stroke-dashoffset: 1400;
}

/* Final wick */
.final-wick {
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1;
}

.final-wick-path {
    stroke-dasharray: 400;
    stroke-dashoffset: 400;
    transition: stroke-dashoffset 3s cubic-bezier(0.4, 0, 0.2, 1);
}

.dissolution.in-view .final-wick-path {
    stroke-dashoffset: 0;
}

.dissolution.dissolving .final-wick-path {
    opacity: 0;
    transition: opacity 4s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ===================================
   Responsive
   =================================== */
@media (max-width: 768px) {
    .candle-station {
        padding: 80px 24px;
    }

    .candle-station-inner {
        grid-template-columns: 1fr;
        gap: 40px;
        padding-left: 0;
    }

    .candle-column {
        justify-content: center;
    }

    .melting-candle {
        max-width: 140px;
    }

    .content-column {
        max-width: 100%;
    }

    .archive-cards {
        max-width: 100%;
    }

    .archive-card:nth-child(odd),
    .archive-card:nth-child(even) {
        margin-left: 0;
        margin-right: 0;
    }

    .archive-floating-objects {
        display: none;
    }

    .memory-archive {
        padding: 80px 24px;
    }

    .scroll-nav {
        left: 8px;
    }

    .card-content {
        padding: 24px;
    }
}

@media (max-width: 480px) {
    body {
        font-size: 16px;
    }

    .body-text {
        font-size: 16px;
    }

    .card-text {
        font-size: 15px;
    }
}
