/* ============================================
   namu.style - Dark Academia Candlelit Library
   ============================================ */
:root {
    --candle-gold: #FFD54F;
    --library-dark: #1A1410;
    --oxblood: #8B3A3A;
    --aged-paper: #E8DCC8;
    --burnished-amber: #C4923A;
    --flame-orange: #FFB300;
    --walnut-deep: #1E1612;
    --leather-brown: #7A6652;
    --void: #0D0A07;
}

*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
html { font-size: 16px; scroll-behavior: smooth; }
body {
    background: var(--void);
    color: var(--aged-paper);
    font-family: 'Cormorant Garamond', serif;
    font-weight: 400;
    font-size: 1rem;
    line-height: 1.7;
    overflow-x: hidden;
}

/* ==============================
   CURSOR GLOW
   ============================== */
.cursor-glow {
    position: fixed;
    width: 400px;
    height: 400px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(255, 213, 79, 0.06) 0%, rgba(255, 179, 0, 0.02) 40%, transparent 70%);
    pointer-events: none;
    z-index: 1000;
    transform: translate(-50%, -50%);
    transition: opacity 0.3s ease;
    opacity: 0;
}
.cursor-glow.active {
    opacity: 1;
}

/* ==============================
   THRESHOLD
   ============================== */
.threshold {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: var(--void);
    position: relative;
}
.candle-container {
    position: relative;
    margin-bottom: 3rem;
    opacity: 0;
    animation: candleAppear 1.5s ease 0.5s forwards;
}
@keyframes candleAppear {
    0% { opacity: 0; transform: translateY(10px); }
    100% { opacity: 1; transform: translateY(0); }
}
.candle-body {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
}
.candle-wax {
    width: 20px;
    height: 60px;
    background: linear-gradient(180deg, #E8DCC8 0%, #D4C5B2 100%);
    border-radius: 2px 2px 4px 4px;
}
.candle-wick {
    width: 2px;
    height: 10px;
    background: #3A3020;
    position: absolute;
    top: -10px;
}
.flame-group {
    position: absolute;
    top: -38px;
    left: 50%;
    transform: translateX(-50%);
}
.flame {
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    border-radius: 50% 50% 50% 50% / 60% 60% 40% 40%;
}
.flame--outer {
    width: 18px;
    height: 34px;
    background: radial-gradient(ellipse, rgba(196, 146, 58, 0.6) 0%, rgba(139, 58, 58, 0.3) 60%, transparent 100%);
    animation: flameOuter 0.4s ease-in-out infinite alternate;
}
.flame--mid {
    width: 14px;
    height: 30px;
    background: radial-gradient(ellipse, #FFB300 0%, #E65100 60%, transparent 100%);
    animation: flameMid 0.3s ease-in-out infinite alternate;
}
.flame--inner {
    width: 8px;
    height: 22px;
    background: radial-gradient(ellipse, #FFF8E1 0%, #FFD54F 40%, transparent 100%);
    animation: flameInner 0.35s ease-in-out infinite alternate;
}
@keyframes flameOuter {
    0% { transform: translateX(-50%) scaleX(1) scaleY(1); }
    100% { transform: translateX(-50%) scaleX(0.9) scaleY(1.05); }
}
@keyframes flameMid {
    0% { transform: translateX(-50%) scaleX(1) scaleY(1) rotate(-1deg); }
    100% { transform: translateX(-50%) scaleX(0.92) scaleY(1.08) rotate(1deg); }
}
@keyframes flameInner {
    0% { transform: translateX(-50%) scaleX(1) scaleY(1) rotate(0.5deg); }
    100% { transform: translateX(-50%) scaleX(0.95) scaleY(1.06) rotate(-0.5deg); }
}
.candle-glow {
    position: absolute;
    top: -80px;
    left: 50%;
    transform: translateX(-50%);
    width: 200px;
    height: 200px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(255, 213, 79, 0.12) 0%, rgba(255, 179, 0, 0.04) 50%, transparent 70%);
    animation: glowPulse 3s ease-in-out infinite;
    pointer-events: none;
}
@keyframes glowPulse {
    0%, 100% { opacity: 0.8; transform: translateX(-50%) scale(1); }
    50% { opacity: 1; transform: translateX(-50%) scale(1.1); }
}

.threshold-title {
    font-family: 'Playfair Display', serif;
    font-weight: 900;
    font-size: clamp(2.5rem, 6vw, 5.5rem);
    color: var(--candle-gold);
    letter-spacing: 0.04em;
    line-height: 1.1;
    opacity: 0;
    animation: titleReveal 1.2s ease 1.5s forwards;
    text-shadow: 0 0 40px rgba(255, 213, 79, 0.15);
}
.threshold-sub {
    font-family: 'JetBrains Mono', monospace;
    font-weight: 300;
    font-size: 0.75rem;
    letter-spacing: 0.3em;
    color: var(--leather-brown);
    margin-top: 0.75rem;
    opacity: 0;
    animation: titleReveal 1s ease 2s forwards;
    text-transform: lowercase;
}
@keyframes titleReveal {
    0% { opacity: 0; transform: translateY(8px); }
    100% { opacity: 1; transform: translateY(0); }
}

/* ==============================
   GALLERY
   ============================== */
.gallery {
    padding: clamp(3rem, 8vw, 6rem) clamp(1rem, 5vw, 4rem);
    background: var(--library-dark);
    position: relative;
}
.gallery-header {
    text-align: center;
    margin-bottom: clamp(2rem, 5vw, 4rem);
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.8s ease, transform 0.8s ease;
}
.gallery-header.visible {
    opacity: 1;
    transform: translateY(0);
}
.gallery-label {
    font-family: 'JetBrains Mono', monospace;
    font-weight: 300;
    font-size: 0.65rem;
    letter-spacing: 0.4em;
    color: var(--burnished-amber);
    text-transform: uppercase;
}

/* Card Grid */
.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: clamp(1rem, 2vw, 1.5rem);
    max-width: 1000px;
    margin: 0 auto;
}
.card {
    background: var(--walnut-deep);
    border: 1px solid rgba(122, 102, 82, 0.2);
    padding: 0;
    opacity: 0;
    transform: translateY(25px);
    transition: opacity 0.6s ease, transform 0.6s ease, box-shadow 0.3s ease;
}
.card.visible {
    opacity: 1;
    transform: translateY(0);
}
.card:hover {
    box-shadow: 0 0 30px rgba(255, 213, 79, 0.06), inset 0 0 30px rgba(255, 213, 79, 0.03);
}
.card--tall {
    grid-row: span 2;
}
.card--wide {
    grid-column: span 2;
}
.card-inner {
    position: relative;
    padding: clamp(1.5rem, 3vw, 2.5rem);
    height: 100%;
    display: flex;
    flex-direction: column;
}
.card-vignette {
    position: absolute;
    inset: 0;
    background: radial-gradient(ellipse at center, transparent 40%, rgba(13, 10, 7, 0.4) 100%);
    pointer-events: none;
}
.card-number {
    font-family: 'Playfair Display', serif;
    font-weight: 700;
    font-size: 0.9rem;
    color: var(--burnished-amber);
    opacity: 0.5;
    margin-bottom: 0.75rem;
}
.card-title {
    font-family: 'Playfair Display', serif;
    font-weight: 700;
    font-size: clamp(1.2rem, 2.5vw, 1.6rem);
    color: var(--candle-gold);
    margin-bottom: 0.75rem;
    line-height: 1.3;
}
.card-text {
    font-family: 'Cormorant Garamond', serif;
    font-weight: 400;
    font-size: clamp(0.95rem, 1.5vw, 1.05rem);
    line-height: 1.8;
    color: var(--aged-paper);
    flex-grow: 1;
    margin-bottom: 1rem;
}
.card-meta {
    font-family: 'JetBrains Mono', monospace;
    font-weight: 300;
    font-size: 0.6rem;
    letter-spacing: 0.15em;
    color: var(--leather-brown);
    opacity: 0.6;
    font-style: italic;
}

/* ==============================
   ALCOVE
   ============================== */
.alcove {
    min-height: 80vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--void);
    padding: clamp(3rem, 8vw, 6rem) clamp(2rem, 8vw, 6rem);
}
.alcove-content {
    max-width: 700px;
    text-align: center;
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 1s ease, transform 1s ease;
}
.alcove-content.visible {
    opacity: 1;
    transform: translateY(0);
}
.alcove-quote {
    font-family: 'Cormorant Garamond', serif;
    font-style: italic;
    font-weight: 400;
    font-size: clamp(1.3rem, 3vw, 2rem);
    color: var(--candle-gold);
    line-height: 1.6;
    margin-bottom: 1.5rem;
    text-shadow: 0 0 30px rgba(255, 213, 79, 0.08);
}
.alcove-attr {
    font-family: 'JetBrains Mono', monospace;
    font-weight: 300;
    font-size: 0.65rem;
    letter-spacing: 0.2em;
    color: var(--leather-brown);
    opacity: 0.5;
}

/* ==============================
   COLOPHON
   ============================== */
.colophon {
    padding: 4rem 2rem;
    background: var(--library-dark);
    text-align: center;
    border-top: 1px solid rgba(122, 102, 82, 0.15);
}
.colophon-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    opacity: 0;
    transform: translateY(15px);
    transition: opacity 0.8s ease, transform 0.8s ease;
}
.colophon-content.visible {
    opacity: 1;
    transform: translateY(0);
}
.colophon-domain {
    font-family: 'Playfair Display', serif;
    font-weight: 700;
    font-size: 1rem;
    color: var(--burnished-amber);
    letter-spacing: 0.1em;
}
.colophon-note {
    font-family: 'Cormorant Garamond', serif;
    font-style: italic;
    font-size: 0.85rem;
    color: var(--leather-brown);
    opacity: 0.5;
}

/* ==============================
   RESPONSIVE
   ============================== */
@media (max-width: 768px) {
    .card--tall { grid-row: span 1; }
    .card--wide { grid-column: span 1; }
    .card-grid {
        grid-template-columns: 1fr;
    }
    .cursor-glow { display: none; }
}
