/* ============================================================
   dilemma.dev — Candlelit Cathedral of Choice
   ============================================================ */

/* --- CSS Custom Properties --- */
:root {
    /* Palette — Sunset Warm */
    --char-black: #0d0906;
    --smoked-umber: #1a0f0a;
    --tobacco-dark: #2a1610;
    --burnished-copper: #c97d45;
    --ember-gold: #f4a261;
    --parchment-light: #f4e8d8;
    --warm-vellum: #d4c4ae;
    --aged-leather: #8b5e3c;
    --dried-blood: #3d1f14;

    /* Cursor position (updated by JS) */
    --mouse-x: 50%;
    --mouse-y: 30%;

    /* Typography scale */
    --display-size: clamp(5rem, 14vw, 12rem);
    --body-size: clamp(1.05rem, 1.2vw, 1.25rem);
    --accent-size: clamp(0.7rem, 0.9vw, 0.85rem);
}

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

html {
    scroll-behavior: smooth;
    background-color: var(--char-black);
}

body {
    font-family: 'Source Serif 4', Georgia, serif;
    font-size: var(--body-size);
    font-weight: 400;
    line-height: 1.72;
    color: var(--warm-vellum);
    background-color: var(--char-black);
    overflow-x: hidden;
    position: relative;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
}

/* --- Cursor-Follow Candle Light (body::after) --- */
body::after {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 9999;
    background: radial-gradient(
        circle at var(--mouse-x) var(--mouse-y),
        rgba(244, 162, 97, 0.04) 0%,
        rgba(201, 125, 69, 0.02) 25%,
        transparent 60%
    );
    background-size: clamp(400px, 60vw, 1000px) clamp(400px, 60vw, 1000px);
    background-position: center;
    transition: background 0.15s ease;
}

body.crossroads-active::after {
    background: radial-gradient(
        circle at var(--mouse-x) var(--mouse-y),
        rgba(244, 162, 97, 0.06) 0%,
        rgba(201, 125, 69, 0.03) 30%,
        transparent 65%
    );
}

/* --- Flicker Animation --- */
@keyframes flicker {
    0%   { opacity: 1;    filter: brightness(1); }
    18%  { opacity: 0.92; filter: brightness(0.97); }
    22%  { opacity: 1;    filter: brightness(1.03); }
    47%  { opacity: 0.88; filter: brightness(0.95); }
    50%  { opacity: 0.95; filter: brightness(1.02); }
    62%  { opacity: 1;    filter: brightness(1.05); }
    80%  { opacity: 0.90; filter: brightness(0.98); }
    100% { opacity: 1;    filter: brightness(1); }
}

/* --- Navigation Glyph --- */
.nav-glyph {
    position: fixed;
    top: 2rem;
    left: 2rem;
    z-index: 10000;
    cursor: pointer;
}

.nav-icon {
    display: block;
    transition: transform 0.3s ease, opacity 0.3s ease;
    opacity: 0.7;
}

.nav-glyph:hover .nav-icon {
    opacity: 1;
    transform: scale(1.1);
}

.radial-menu {
    position: absolute;
    top: 0;
    left: 0;
    width: 180px;
    height: 180px;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.nav-glyph:hover .radial-menu {
    opacity: 1;
    pointer-events: auto;
}

.radial-item {
    position: absolute;
    font-family: 'Barlow Condensed', sans-serif;
    font-weight: 600;
    font-variant: all-small-caps;
    font-size: var(--accent-size);
    letter-spacing: 0.18em;
    color: var(--burnished-copper);
    text-decoration: none;
    white-space: nowrap;
    transition: color 0.3s ease, transform 0.3s ease;
    opacity: 0;
    transform: translate(0, 0) scale(0.8);
}

.nav-glyph:hover .radial-item {
    opacity: 1;
    transform: scale(1);
}

/* Position items in top-right quadrant arc */
.radial-item[style*="--i:0"] {
    top: 10px;
    left: 50px;
    transition-delay: 0ms;
}
.nav-glyph:hover .radial-item[style*="--i:0"] {
    transition-delay: 0ms;
}

.radial-item[style*="--i:1"] {
    top: 30px;
    left: 55px;
    transition-delay: 50ms;
}
.nav-glyph:hover .radial-item[style*="--i:1"] {
    transition-delay: 50ms;
}

.radial-item[style*="--i:2"] {
    top: 50px;
    left: 52px;
    transition-delay: 100ms;
}
.nav-glyph:hover .radial-item[style*="--i:2"] {
    transition-delay: 100ms;
}

.radial-item[style*="--i:3"] {
    top: 70px;
    left: 45px;
    transition-delay: 150ms;
}
.nav-glyph:hover .radial-item[style*="--i:3"] {
    transition-delay: 150ms;
}

.radial-item:hover {
    color: var(--ember-gold);
}

/* --- The Threshold --- */
.threshold {
    position: relative;
    width: 100%;
    height: 100vh;
    display: flex;
    overflow: hidden;
    z-index: 1;
}

.luminous-seam {
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 1px;
    height: 100%;
    background-color: var(--ember-gold);
    opacity: 0;
    z-index: 10;
    animation: flicker 3s infinite both;
    transition: opacity 0.8s ease;
}

.luminous-seam.visible {
    opacity: 0.6;
}

.threshold-panel {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 50%;
    height: 100%;
    transition: width 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94),
                filter 0.3s ease;
    overflow: hidden;
    opacity: 0;
    transform: translateX(0);
}

.threshold-panel--left {
    background-color: var(--smoked-umber);
    transform: translateX(-100%);
}

.threshold-panel--right {
    background-color: var(--tobacco-dark);
    transform: translateX(100%);
}

.threshold-panel.visible {
    opacity: 1;
    transform: translateX(0);
    transition: width 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94),
                filter 0.3s ease,
                opacity 0.6s ease-out,
                transform 0.6s ease-out;
}

.threshold-panel:hover {
    width: 51%;
}

.threshold-panel:hover ~ .threshold-panel,
.threshold-panel:not(:hover) {
    /* handled by JS for more precise control */
}

.threshold-word {
    font-family: 'Bebas Neue', sans-serif;
    font-size: var(--display-size);
    font-weight: 400;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--parchment-light);
    user-select: none;
    line-height: 1;
}

/* --- The Descent --- */
.descent {
    position: relative;
    max-width: 72ch;
    margin: 0 auto;
    padding-inline: clamp(2rem, 6vw, 8rem);
    padding-top: 8rem;
    padding-bottom: 4rem;
}

.meditation {
    margin-bottom: 12rem;
}

.section-divider {
    text-align: center;
    margin-bottom: 3rem;
    opacity: 0.6;
}

.meditation-heading {
    font-family: 'Bebas Neue', sans-serif;
    font-size: clamp(2.5rem, 6vw, 4.5rem);
    font-weight: 400;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--parchment-light);
    margin-bottom: 2rem;
    line-height: 1.1;
}

.meditation p {
    margin-bottom: 1.5rem;
    max-width: 68ch;
    color: var(--warm-vellum);
}

.meditation p em {
    font-style: italic;
    color: var(--burnished-copper);
}

/* Gradient rule divider */
.gradient-rule {
    width: 100%;
    height: 1px;
    background: linear-gradient(
        to right,
        transparent 0%,
        var(--burnished-copper) 30%,
        var(--burnished-copper) 70%,
        transparent 100%
    );
    opacity: 0.4;
    margin: 6rem 0;
}

/* --- Smoke Wisps --- */
.smoke-wisp {
    display: block;
    width: 60px;
    height: 120px;
    margin: -4rem auto 2rem;
    opacity: 0.08;
    filter: blur(1px);
    overflow: visible;
}

.smoke-wisp--alt {
    width: 40px;
    height: 100px;
    margin: -3rem auto 3rem;
}

.smoke-path {
    stroke-dasharray: 400;
    stroke-dashoffset: 400;
    animation: smoke-rise 8s ease-in-out infinite;
}

.smoke-path--alt {
    animation: smoke-rise 10s ease-in-out 2s infinite;
}

@keyframes smoke-rise {
    0% {
        stroke-dashoffset: 400;
        transform: translateY(0);
    }
    50% {
        stroke-dashoffset: 0;
    }
    100% {
        stroke-dashoffset: -400;
        transform: translateY(-30px);
    }
}

/* --- Fade Blocks (IntersectionObserver) --- */
.fade-block {
    opacity: 0;
    transition: opacity 0.5s ease;
}

.fade-block.in-view {
    opacity: 1;
}

/* --- The Crossroads --- */
.crossroads {
    position: relative;
    max-width: 1100px;
    margin: 0 auto;
    padding: 8rem clamp(2rem, 6vw, 8rem);
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0;
}

.crossroads-panel {
    background-color: var(--smoked-umber);
    padding: clamp(2rem, 4vw, 4rem);
    border: 1px solid rgba(139, 94, 60, 0.2);
    transition: filter 0.3s ease, box-shadow 0.3s ease;
    position: relative;
}

.crossroads-panel--right {
    background-color: var(--tobacco-dark);
    margin-top: 3rem;
    margin-left: -2rem;
    z-index: 2;
}

.crossroads-panel--left {
    z-index: 1;
}

.crossroads-panel.panel-highlight {
    filter: brightness(1.1);
    box-shadow: 0 0 60px rgba(201, 125, 69, 0.15);
}

.crossroads-panel.panel-dim {
    filter: brightness(0.7);
}

.crossroads-heading {
    font-family: 'Bebas Neue', sans-serif;
    font-size: clamp(1.8rem, 4vw, 3rem);
    font-weight: 400;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--parchment-light);
    margin-bottom: 1.5rem;
    line-height: 1.1;
}

.crossroads-panel p {
    margin-bottom: 1.2rem;
    color: var(--warm-vellum);
    line-height: 1.72;
    max-width: 68ch;
}

/* --- The Seal (Footer) --- */
.seal-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 6rem 2rem;
    text-align: center;
}

.wax-seal {
    margin-bottom: 3rem;
}

.seal-outer {
    width: clamp(120px, 18vw, 200px);
    height: clamp(120px, 18vw, 200px);
    border-radius: 50%;
    background: radial-gradient(
        circle at 45% 40%,
        var(--burnished-copper) 0%,
        var(--aged-leather) 60%,
        var(--dried-blood) 100%
    );
    box-shadow:
        0 4px 15px rgba(0, 0, 0, 0.6),
        0 2px 6px rgba(0, 0, 0, 0.4),
        inset 0 2px 4px rgba(244, 162, 97, 0.3),
        inset 0 -2px 4px rgba(13, 9, 6, 0.5),
        inset 0 0 20px rgba(13, 9, 6, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    animation: flicker 3s infinite both;
    transform: scale(0.9);
    transition: transform 0.6s ease;
}

.seal-outer.seal-animate {
    transform: scale(1);
}

.seal-inner {
    width: 70%;
    height: 70%;
    border-radius: 50%;
    border: 1px solid rgba(244, 162, 97, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
}

.seal-text {
    font-family: 'Bebas Neue', sans-serif;
    font-size: clamp(2.5rem, 6vw, 4.5rem);
    color: var(--parchment-light);
    text-shadow:
        1px 1px 2px rgba(13, 9, 6, 0.8),
        -1px -1px 1px rgba(244, 162, 97, 0.2);
    letter-spacing: 0.04em;
    user-select: none;
}

.seal-domain {
    font-family: 'Barlow Condensed', sans-serif;
    font-weight: 600;
    font-variant: all-small-caps;
    font-size: clamp(0.9rem, 1.2vw, 1.1rem);
    letter-spacing: 0.18em;
    color: var(--burnished-copper);
    margin-bottom: 0.5rem;
}

.seal-tagline {
    font-family: 'Source Serif 4', Georgia, serif;
    font-style: italic;
    font-size: clamp(0.85rem, 1vw, 1rem);
    color: var(--warm-vellum);
    opacity: 0.6;
}

/* --- Links & Interactive Proximity --- */
a {
    color: var(--warm-vellum);
    text-decoration: none;
    transition: color 0.3s ease;
}

a:hover {
    color: var(--ember-gold);
}

/* --- Mobile Adaptations --- */
@media (max-width: 768px) {
    .threshold {
        flex-direction: column;
    }

    .threshold-panel {
        width: 100%;
        height: 50vh;
    }

    .threshold-panel:hover {
        width: 100%;
    }

    .luminous-seam {
        top: 50%;
        left: 0;
        width: 100%;
        height: 1px;
        transform: translateY(-50%);
    }

    .crossroads {
        grid-template-columns: 1fr;
        gap: 2rem;
    }

    .crossroads-panel--right {
        margin-top: 0;
        margin-left: 0;
    }

    .nav-glyph {
        top: 1rem;
        left: 1rem;
    }

    .radial-item[style*="--i:0"] { top: 5px; left: 40px; }
    .radial-item[style*="--i:1"] { top: 25px; left: 45px; }
    .radial-item[style*="--i:2"] { top: 45px; left: 42px; }
    .radial-item[style*="--i:3"] { top: 65px; left: 38px; }
}

@media (max-width: 480px) {
    .meditation {
        margin-bottom: 8rem;
    }

    .crossroads {
        padding: 4rem clamp(1.5rem, 4vw, 3rem);
    }
}
