/* ============================================
   lowest.dev - Styles
   Palette:
     Void Black:     #0A0A0A
     Candle Amber:   #E6A817
     Ember Glow:     #D4763A
     Smoke Gray:     #3A3A3A
     Parchment Light:#F5E6CC
     Deep Indigo:    #1A1A3E
     Flame Core:     #FFFFFF
   Fonts:
     Cinzel (headings/logotype)
     Inter (body)
     JetBrains Mono (code/accent)
   ============================================ */

/* --- CSS Custom Properties --- */
:root {
    --void-black: #0A0A0A;
    --candle-amber: #E6A817;
    --ember-glow: #D4763A;
    --smoke-gray: #3A3A3A;
    --parchment-light: #F5E6CC;
    --deep-indigo: #1A1A3E;
    --flame-core: #FFFFFF;
    --depth-mid-1: #0A0A12;
    --depth-mid-2: #0A0A1E;

    --bg-color: #0A0A0A;
    --accent-color: #E6A817;
    --depth-progress: 0;
}

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

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

body {
    background-color: var(--bg-color);
    color: var(--parchment-light);
    font-family: 'Inter', sans-serif;
    font-weight: 300;
    font-size: clamp(16px, 1.2vw, 20px);
    letter-spacing: 0.02em;
    line-height: 1.8;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* --- SVG Filters (hidden) --- */
#svg-filters {
    position: absolute;
    width: 0;
    height: 0;
    overflow: hidden;
}

/* --- Depth Indicator --- */
#depth-indicator {
    position: fixed;
    left: 0;
    top: 0;
    width: 2px;
    height: 0%;
    background: linear-gradient(
        to bottom,
        var(--candle-amber),
        var(--ember-glow) 50%,
        var(--deep-indigo)
    );
    z-index: 100;
    transition: height 0.1s linear;
}

/* --- Particles --- */
#particles-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
    overflow: hidden;
}

.particle {
    position: absolute;
    width: 2px;
    height: 2px;
    border-radius: 50%;
    background: var(--candle-amber);
    opacity: 0;
    will-change: transform;
    animation: fall linear infinite;
}

.particle:nth-child(odd) {
    width: 3px;
    height: 3px;
}

@keyframes fall {
    0% {
        transform: translateY(-10px) translateX(0);
        opacity: 0;
    }
    5% {
        opacity: 0.6;
    }
    50% {
        opacity: 0.3;
    }
    95% {
        opacity: 0.1;
    }
    100% {
        transform: translateY(100vh) translateX(20px);
        opacity: 0;
    }
}

/* --- Sections --- */
.section {
    position: relative;
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
}

/* --- Hero Section --- */
#hero {
    height: 100vh;
    min-height: 600px;
    flex-direction: column;
}

.hero-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
    z-index: 10;
}

/* --- Candle Flame --- */
#candle-container {
    width: 120px;
    height: 200px;
    position: relative;
    opacity: 0;
}

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

#candle-flame {
    width: 100%;
    height: 100%;
}

/* Flame outline path-draw animation */
.flame-outline {
    stroke-dasharray: 500;
    stroke-dashoffset: 500;
    transition: none;
}

.flame-outline.draw {
    animation: drawFlameOutline 1.2s ease-out forwards;
}

@keyframes drawFlameOutline {
    to {
        stroke-dashoffset: 0;
    }
}

/* Flame layers - initially hidden */
.flame-glow,
.flame-mid,
.flame-core {
    opacity: 0;
    transition: opacity 0.8s ease;
}

.flame-glow.visible {
    opacity: 1;
    transition-duration: 0.5s;
}

.flame-mid.visible {
    opacity: 1;
    transition-duration: 0.8s;
}

.flame-core.visible {
    opacity: 1;
    transition-duration: 0.6s;
}

/* Flame flickering */
.flame-mid,
.flame-core {
    transform-origin: 60px 180px;
}

#candle-container.visible .flame-mid {
    animation: flameSway1 3s ease-in-out infinite alternate;
}

#candle-container.visible .flame-core {
    animation: flameSway2 2.3s ease-in-out infinite alternate;
}

#candle-container.visible .flame-glow {
    animation: glowPulse 4s ease-in-out infinite alternate;
}

@keyframes flameSway1 {
    0% { transform: translateX(-2px) scaleX(0.98); }
    33% { transform: translateX(1px) scaleX(1.01); }
    66% { transform: translateX(-1px) scaleX(0.99); }
    100% { transform: translateX(2px) scaleX(1.02); }
}

@keyframes flameSway2 {
    0% { transform: translateX(1px) scaleY(0.98); }
    50% { transform: translateX(-1.5px) scaleY(1.02); }
    100% { transform: translateX(2px) scaleY(0.97); }
}

@keyframes glowPulse {
    0% { opacity: 0.7; transform: scale(0.95); }
    50% { opacity: 1; transform: scale(1.05); }
    100% { opacity: 0.8; transform: scale(1); }
}

/* --- Logotype (domain name) --- */
.logotype {
    font-family: 'Cinzel', serif;
    font-weight: 700;
    font-size: clamp(28px, 5vw, 64px);
    color: var(--parchment-light);
    letter-spacing: 0.15em;
    margin-top: 40px;
    text-transform: lowercase;
    position: relative;
}

.logotype .char {
    display: inline-block;
    opacity: 0;
    transform: translateY(10px);
    transition: opacity 0.4s ease, transform 0.4s ease;
}

.logotype .char.visible {
    opacity: 1;
    transform: translateY(0);
}

/* --- Scroll Cue --- */
#scroll-cue {
    position: absolute;
    bottom: 60px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    opacity: 0;
    transition: opacity 1s ease;
}

#scroll-cue.visible {
    opacity: 1;
}

.scroll-text {
    font-family: 'Inter', sans-serif;
    font-weight: 300;
    font-size: 12px;
    letter-spacing: 0.3em;
    text-transform: uppercase;
    color: var(--candle-amber);
    opacity: 0.6;
}

.scroll-arrow {
    animation: bobDown 2s ease-in-out infinite;
}

@keyframes bobDown {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(6px); }
}

/* --- Content Sections --- */
.content-section {
    min-height: 100vh;
    padding: 20vh 24px;
    flex-direction: column;
}

.section-inner {
    max-width: 640px;
    width: 100%;
    position: relative;
    z-index: 10;
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.8s ease, transform 0.8s ease;
}

.section-inner.revealed {
    opacity: 1;
    transform: translateY(0);
}

/* --- Section Glow (candlelight pooling) --- */
.section-glow {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 800px;
    height: 600px;
    background: radial-gradient(
        ellipse at center,
        rgba(230, 168, 23, 0.06) 0%,
        rgba(230, 168, 23, 0.02) 40%,
        transparent 70%
    );
    pointer-events: none;
    z-index: 0;
}

/* --- Section Headings --- */
.section-heading {
    position: relative;
    margin-bottom: 48px;
    text-align: center;
    height: 60px;
}

.heading-line {
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    max-width: 640px;
    height: 60px;
}

.draw-text {
    stroke-dasharray: 2000;
    stroke-dashoffset: 2000;
    transition: none;
}

.draw-text.animate {
    animation: drawHeading 1.5s ease-out forwards;
}

@keyframes drawHeading {
    to {
        stroke-dashoffset: 0;
    }
}

.heading-fill {
    font-family: 'Cinzel', serif;
    font-weight: 600;
    font-size: clamp(24px, 4vw, 36px);
    color: var(--parchment-light);
    letter-spacing: 0.1em;
    opacity: 0;
    transition: opacity 0.6s ease 1.2s;
    display: block;
    text-align: center;
    line-height: 60px;
}

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

/* --- Body Text --- */
.body-text {
    color: var(--parchment-light);
    margin-bottom: 24px;
    opacity: 0.9;
}

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

/* --- Code Block --- */
.code-block {
    background: rgba(26, 26, 62, 0.3);
    border-left: 2px solid var(--candle-amber);
    padding: 24px 28px;
    margin: 32px 0;
    border-radius: 0 4px 4px 0;
    overflow-x: auto;
}

.mono-text {
    font-family: 'JetBrains Mono', monospace;
    font-weight: 400;
    font-size: 14px;
    line-height: 1.8;
}

.code-comment {
    color: var(--smoke-gray);
}

.code-keyword {
    color: var(--candle-amber);
}

.code-string {
    color: var(--ember-glow);
}

/* --- Terminal Section --- */
#section-terminal {
    min-height: 100vh;
    padding: 20vh 24px;
    flex-direction: column;
    position: relative;
}

.terminal-glow {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 60%;
    background: radial-gradient(
        ellipse at center bottom,
        rgba(26, 26, 62, 0.4) 0%,
        rgba(26, 26, 62, 0.15) 30%,
        transparent 70%
    );
    pointer-events: none;
    z-index: 0;
}

.terminal-inner {
    text-align: center;
}

.terminal-message {
    font-family: 'Cinzel', serif;
    font-weight: 600;
    font-size: clamp(20px, 3vw, 32px);
    color: var(--parchment-light);
    letter-spacing: 0.08em;
    margin-bottom: 24px;
    opacity: 0.9;
}

.terminal-submessage {
    color: var(--candle-amber);
    font-size: 14px;
    letter-spacing: 0.2em;
    opacity: 0.5;
}

/* --- Stone texture overlay --- */
.content-section::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    filter: url(#stone-noise);
    pointer-events: none;
    z-index: 0;
    opacity: 0.4;
}

/* --- Responsive --- */
@media (max-width: 768px) {
    .content-section {
        padding: 15vh 20px;
    }

    .section-glow {
        width: 400px;
        height: 400px;
    }

    #candle-container {
        width: 80px;
        height: 140px;
    }

    .logotype {
        margin-top: 24px;
    }

    .code-block {
        padding: 16px 20px;
    }

    .heading-line {
        max-width: 90vw;
    }
}

@media (max-width: 480px) {
    .content-section {
        padding: 12vh 16px;
    }

    .section-glow {
        width: 300px;
        height: 300px;
    }
}
