/* alth.ing - Design Language Stylesheet */
/* Sunset-warm, grainy-textured, full-bleed immersive experience */

/* ============================================
   CSS Custom Properties
   ============================================ */
:root {
    --bg-primary: #1E1410;         /* Smoked Paprika */
    --bg-secondary: #2A1F1A;       /* Kiln Ash */
    --surface: #8B5E3C;            /* Terracotta Dust */
    --accent-primary: #E8703A;     /* Ember Orange */
    --accent-secondary: #D4A843;   /* Saffron Thread */
    --text-primary: #F0E6D8;       /* Bleached Cotton */
    --text-muted: #B8A08A;         /* Sandstone */
    --atmospheric: #C4616A;        /* Dusk Rose */
    --gradient-mid: #3A2218;

    --font-headline: 'Space Grotesk', sans-serif;
    --font-body: 'DM Sans', sans-serif;
    --font-accent: 'Noto Sans Javanese', sans-serif;

    --ease-gentle: cubic-bezier(0.23, 1, 0.32, 1);
    --transition-slow: 800ms var(--ease-gentle);
    --transition-medium: 600ms var(--ease-gentle);
}

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

html {
    scroll-snap-type: y proximity;
    scroll-behavior: smooth;
    overflow-x: hidden;
}

body {
    background-color: var(--bg-primary);
    color: var(--text-primary);
    font-family: var(--font-body);
    font-weight: 400;
    font-size: 17px;
    line-height: 1.72;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ============================================
   SVG Defs (hidden)
   ============================================ */
.svg-defs {
    position: absolute;
    width: 0;
    height: 0;
    overflow: hidden;
}

/* ============================================
   Film Grain Overlay
   ============================================ */
.grain-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    pointer-events: none;
    z-index: 9999;
    opacity: 0.08;
    mix-blend-mode: overlay;
}

.grain-overlay svg {
    width: 100%;
    height: 100%;
}

/* Grain shimmer animation */
@keyframes grainShimmer {
    0%, 100% { opacity: 0.08; }
    50% { opacity: 0.06; }
}

.grain-overlay {
    animation: grainShimmer 3s ease-in-out infinite;
}

/* ============================================
   Navigation Curtain
   ============================================ */
.nav-curtain {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 9000;
}

.nav-trigger {
    width: 100%;
    height: 4px;
    background: transparent;
}

.nav-content {
    display: flex;
    justify-content: center;
    gap: 3rem;
    padding: 1.2rem 2rem;
    background: linear-gradient(180deg, rgba(30, 20, 16, 0.95) 0%, rgba(30, 20, 16, 0) 100%);
    transform: translateY(-100%);
    transition: transform var(--transition-medium);
    pointer-events: none;
}

.nav-curtain:hover .nav-content,
.nav-curtain.nav-visible .nav-content {
    transform: translateY(0);
    pointer-events: all;
}

.nav-link {
    font-family: var(--font-headline);
    font-size: 0.85rem;
    font-weight: 500;
    letter-spacing: 0.02em;
    color: var(--text-muted);
    cursor: pointer;
    transition: color var(--transition-medium);
    text-transform: lowercase;
}

.nav-link:hover {
    color: var(--accent-primary);
}

/* ============================================
   Section Base
   ============================================ */
.section {
    position: relative;
    width: 100%;
    min-height: 100vh;
    overflow: hidden;
    scroll-snap-align: start;
}

/* Section gradient mask transitions */
.section + .arabesque-connector + .section,
.section + .arabesque-connector + .textile-divider + .section {
    margin-top: -1px;
}

/* ============================================
   Section Markers (Torii gate)
   ============================================ */
.section-marker {
    position: absolute;
    top: 2rem;
    left: 50%;
    transform: translateX(-50%);
    z-index: 10;
    opacity: 0.7;
    transition: transform var(--transition-slow), opacity var(--transition-medium);
}

.section-marker:hover {
    opacity: 1;
}

/* ============================================
   Kawung Corner Ornaments
   ============================================ */
.kawung-corner {
    position: absolute;
    z-index: 10;
    transition: transform var(--transition-slow);
}

.kawung-corner--tl {
    top: 1.5rem;
    left: 1.5rem;
}

.kawung-corner--br {
    bottom: 1.5rem;
    right: 1.5rem;
}

/* ============================================
   Arabesque Connectors
   ============================================ */
.arabesque-connector {
    display: flex;
    justify-content: center;
    padding: 0;
    background-color: var(--bg-primary);
    position: relative;
    z-index: 2;
}

/* ============================================
   Textile Divider Band
   ============================================ */
.textile-divider {
    width: 100%;
    height: 40px;
    background-color: var(--bg-primary);
    opacity: 0.8;
    transition: transform var(--transition-slow);
}

/* ============================================
   Section 1: Threshold (Hero)
   ============================================ */
.section--threshold {
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-primary);
}

.threshold__gradient {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(165deg, #1E1410 0%, #2A1F1A 40%, #3A2218 70%, #E8703A 100%);
    z-index: 1;
}

.threshold__content {
    position: relative;
    z-index: 10;
    text-align: center;
    width: 100%;
}

.threshold__title {
    font-family: var(--font-headline);
    font-size: clamp(2.4rem, 6vw, 5.5rem);
    font-weight: 500;
    letter-spacing: 0.02em;
    color: var(--text-primary);
    mix-blend-mode: difference;
    text-transform: none;
    user-select: none;
}

/* Ember particles */
.ember-field {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 5;
    overflow: hidden;
}

.ember {
    position: absolute;
    border-radius: 50%;
    background-color: var(--accent-primary);
    pointer-events: none;
}

/* Generate varied ember styles */
.ember:nth-child(1)  { width: 3px; height: 3px; left: 12%; bottom: -10px; opacity: 0.45; animation: emberFloat 8s linear infinite; animation-delay: 0s; }
.ember:nth-child(2)  { width: 5px; height: 5px; left: 25%; bottom: -10px; opacity: 0.35; animation: emberFloat 10s linear infinite; animation-delay: 1.2s; }
.ember:nth-child(3)  { width: 2px; height: 2px; left: 38%; bottom: -10px; opacity: 0.55; animation: emberFloat 7s linear infinite; animation-delay: 0.5s; }
.ember:nth-child(4)  { width: 4px; height: 4px; left: 52%; bottom: -10px; opacity: 0.4; animation: emberFloat 9s linear infinite; animation-delay: 2.1s; }
.ember:nth-child(5)  { width: 6px; height: 6px; left: 65%; bottom: -10px; opacity: 0.3; animation: emberFloat 11s linear infinite; animation-delay: 0.8s; }
.ember:nth-child(6)  { width: 3px; height: 3px; left: 78%; bottom: -10px; opacity: 0.5; animation: emberFloat 8.5s linear infinite; animation-delay: 3s; }
.ember:nth-child(7)  { width: 2px; height: 2px; left: 88%; bottom: -10px; opacity: 0.6; animation: emberFloat 7.5s linear infinite; animation-delay: 1.8s; }
.ember:nth-child(8)  { width: 4px; height: 4px; left: 8%; bottom: -10px; opacity: 0.38; animation: emberFloat 9.5s linear infinite; animation-delay: 4.2s; }
.ember:nth-child(9)  { width: 5px; height: 5px; left: 33%; bottom: -10px; opacity: 0.32; animation: emberFloat 10.5s linear infinite; animation-delay: 2.5s; }
.ember:nth-child(10) { width: 3px; height: 3px; left: 45%; bottom: -10px; opacity: 0.48; animation: emberFloat 8s linear infinite; animation-delay: 5s; }
.ember:nth-child(11) { width: 2px; height: 2px; left: 58%; bottom: -10px; opacity: 0.52; animation: emberFloat 7s linear infinite; animation-delay: 1.5s; }
.ember:nth-child(12) { width: 4px; height: 4px; left: 72%; bottom: -10px; opacity: 0.36; animation: emberFloat 9s linear infinite; animation-delay: 3.5s; }
.ember:nth-child(13) { width: 3px; height: 3px; left: 18%; bottom: -10px; opacity: 0.42; animation: emberFloat 8.2s linear infinite; animation-delay: 0.3s; }
.ember:nth-child(14) { width: 5px; height: 5px; left: 82%; bottom: -10px; opacity: 0.3; animation: emberFloat 10s linear infinite; animation-delay: 2.8s; }
.ember:nth-child(15) { width: 2px; height: 2px; left: 95%; bottom: -10px; opacity: 0.55; animation: emberFloat 7.8s linear infinite; animation-delay: 4.5s; }

@keyframes emberFloat {
    0% {
        transform: translateY(0) translateX(0);
        opacity: var(--ember-start-opacity, 0.4);
    }
    25% {
        transform: translateY(-25vh) translateX(8px);
    }
    50% {
        transform: translateY(-50vh) translateX(-5px);
        opacity: var(--ember-mid-opacity, 0.5);
    }
    75% {
        transform: translateY(-75vh) translateX(10px);
    }
    100% {
        transform: translateY(-105vh) translateX(3px);
        opacity: 0;
    }
}

/* Scroll hint chevron */
.scroll-hint {
    position: absolute;
    bottom: 3rem;
    left: 50%;
    transform: translateX(-50%);
    z-index: 10;
    opacity: 0.3;
    animation: chevronPulse 4s ease-in-out infinite;
}

@keyframes chevronPulse {
    0%, 80%, 100% { opacity: 0.15; transform: translateX(-50%) translateY(0); }
    40% { opacity: 0.4; transform: translateX(-50%) translateY(6px); }
}

/* ============================================
   Section 2: The Weave
   ============================================ */
.section--weave {
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: var(--bg-secondary);
    padding: 6rem 0;
}

.weave__band {
    position: absolute;
    top: 0;
    height: 100%;
    width: 33.33%;
    opacity: 0.8;
}

.weave__band--left {
    left: 0;
}

.weave__band--right {
    right: 0;
}

.weave__text {
    position: relative;
    z-index: 10;
    width: 33.33%;
    margin: 0 auto;
    text-align: center;
    padding: 4rem 2rem;
}

.weave__poem {
    font-family: var(--font-body);
    font-size: clamp(1rem, 2vw, 1.25rem);
    font-weight: 400;
    line-height: 1.85;
    color: var(--text-primary);
    max-width: 38ch;
    margin: 0 auto;
}

/* ============================================
   Section 3: The Garden
   ============================================ */
.section--garden {
    background-color: var(--bg-primary);
    padding: 4rem 0;
}

.garden__layout {
    display: flex;
    width: 100%;
    min-height: 100vh;
    align-items: stretch;
}

.garden__text {
    width: 20%;
    padding: 6rem 2rem 4rem 3rem;
    display: flex;
    flex-direction: column;
    justify-content: center;
    position: relative;
    z-index: 10;
}

.garden__title {
    font-family: var(--font-headline);
    font-size: clamp(1.6rem, 3.5vw, 3rem);
    font-weight: 500;
    letter-spacing: 0.02em;
    color: var(--text-primary);
    margin-bottom: 2rem;
    text-transform: none;
}

.garden__prose {
    max-width: 38ch;
    line-height: 1.85;
    color: var(--text-primary);
}

.reveal-word {
    opacity: 0;
    transition: opacity 0.6s var(--ease-gentle);
    display: inline;
}

.reveal-word.revealed {
    opacity: 1;
}

.garden__imagery {
    width: 80%;
    position: relative;
    overflow: hidden;
}

.botanical-field {
    width: 100%;
    height: 100%;
    min-height: 600px;
}

/* ============================================
   Section 4: The Kiln
   ============================================ */
.section--kiln {
    background-color: var(--bg-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 8rem 4rem;
}

.kiln__panels {
    position: relative;
    width: 100%;
    max-width: 900px;
    min-height: 400px;
    margin: 0 auto;
}

.kiln__card {
    position: relative;
    padding: 3.5rem 4rem;
    background-color: var(--bg-secondary);
    border: 1px solid rgba(139, 94, 60, 0.3);
    transition: transform var(--transition-slow), opacity var(--transition-medium);
}

.kiln__card--rear {
    width: 85%;
    opacity: 0.4;
    border-color: var(--atmospheric);
    border-width: 1px;
    transform: translateY(0);
    position: relative;
    z-index: 1;
}

.kiln__card--front {
    width: 100%;
    position: relative;
    z-index: 2;
    margin-top: -60px;
    background-color: var(--bg-primary);
    opacity: 1;
}

.kiln__heading {
    font-family: var(--font-headline);
    font-size: clamp(1.6rem, 3.5vw, 3rem);
    font-weight: 500;
    letter-spacing: 0.02em;
    color: var(--text-primary);
    margin-bottom: 1.5rem;
    text-transform: none;
}

.kiln__body {
    font-family: var(--font-body);
    font-size: 17px;
    font-weight: 400;
    line-height: 1.72;
    color: var(--text-muted);
    max-width: 60ch;
}

/* ============================================
   Section 5: The Thread
   ============================================ */
.section--thread {
    background-color: var(--bg-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 80vh;
    padding: 6rem 2rem;
}

.thread__content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2rem;
}

.thread__line {
    overflow: visible;
}

.thread__line path {
    transition: stroke-dashoffset 3s var(--ease-gentle);
}

.thread__line.animate path {
    stroke-dashoffset: 0;
}

.thread__glyph {
    opacity: 0;
    transition: opacity 1.5s var(--ease-gentle) 2.5s;
}

.thread__line.animate ~ .thread__glyph,
.thread__glyph.visible {
    opacity: 0.7;
}

.thread__whisper {
    font-family: var(--font-body);
    font-size: 0.9rem;
    font-weight: 400;
    color: var(--text-muted);
    letter-spacing: 0.05em;
    opacity: 0;
    transition: opacity 2s var(--ease-gentle) 3.5s;
    text-transform: lowercase;
}

.thread__line.animate ~ .thread__whisper,
.thread__whisper.visible {
    opacity: 0.6;
}

/* ============================================
   Magnetic Element Base
   ============================================ */
.magnetic-element {
    transition: transform var(--transition-slow);
    will-change: transform;
}

/* ============================================
   5-Column Grid (for future use / structural reference)
   ============================================ */
.grid-5col {
    display: grid;
    grid-template-columns: 1fr 2fr 1fr 2fr 1fr;
    gap: 0;
}

/* ============================================
   Section Gradient Mask Transitions
   ============================================ */
.section--weave {
    -webkit-mask-image: linear-gradient(to bottom, transparent 0px, black 120px, black calc(100% - 120px), transparent 100%);
    mask-image: linear-gradient(to bottom, transparent 0px, black 120px, black calc(100% - 120px), transparent 100%);
}

.section--garden {
    -webkit-mask-image: linear-gradient(to bottom, transparent 0px, black 120px, black 100%);
    mask-image: linear-gradient(to bottom, transparent 0px, black 120px, black 100%);
}

.section--kiln {
    -webkit-mask-image: linear-gradient(to bottom, transparent 0px, black 120px, black calc(100% - 120px), transparent 100%);
    mask-image: linear-gradient(to bottom, transparent 0px, black 120px, black calc(100% - 120px), transparent 100%);
}

/* ============================================
   Reduced Motion
   ============================================ */
@media (prefers-reduced-motion: reduce) {
    .ember {
        animation: none;
        display: none;
    }

    .grain-overlay {
        animation: none;
    }

    .magnetic-element {
        transition: none;
    }

    .scroll-hint {
        animation: none;
        opacity: 0.3;
    }

    * {
        transition-duration: 0.01ms !important;
    }
}

/* ============================================
   Responsive Adjustments
   ============================================ */
@media (max-width: 768px) {
    .garden__layout {
        flex-direction: column;
    }

    .garden__text {
        width: 100%;
        padding: 4rem 2rem 2rem;
    }

    .garden__imagery {
        width: 100%;
        min-height: 50vh;
    }

    .weave__band {
        display: none;
    }

    .weave__text {
        width: 80%;
    }

    .kiln__panels {
        padding: 0 1rem;
    }

    .kiln__card {
        padding: 2.5rem 2rem;
    }

    .kiln__card--rear {
        width: 95%;
    }

    .nav-content {
        gap: 1.5rem;
        flex-wrap: wrap;
    }
}

@media (max-width: 480px) {
    .weave__text {
        width: 95%;
        padding: 3rem 1rem;
    }

    .garden__text {
        padding: 3rem 1.5rem 2rem;
    }

    .kiln__card {
        padding: 2rem 1.5rem;
    }

    .section--kiln {
        padding: 6rem 1.5rem;
    }
}
