/* ===========================
   memorial.wiki - Styles
   Luminous Dark Reliquary
   =========================== */

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

html {
    scroll-behavior: smooth;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}

body {
    font-family: 'DM Sans', sans-serif;
    font-weight: 400;
    background-color: #1a1a1e;
    color: #b8b4ae;
    overflow-x: hidden;
    line-height: 1.75;
    letter-spacing: 0.02em;
}

/* --- Background Blobs --- */
.bg-blobs {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
    overflow: hidden;
}

.bg-blob {
    position: absolute;
    background: linear-gradient(135deg, #2a2830, #1e1a18);
    will-change: border-radius;
}

.blob-1 {
    width: 450px;
    height: 450px;
    top: -10%;
    left: -8%;
    opacity: 0.05;
    animation: blobMorph1 22s ease-in-out infinite;
}

.blob-2 {
    width: 380px;
    height: 380px;
    top: 30%;
    right: -12%;
    opacity: 0.04;
    animation: blobMorph2 27s ease-in-out infinite;
}

.blob-3 {
    width: 500px;
    height: 500px;
    bottom: 10%;
    left: -15%;
    opacity: 0.03;
    animation: blobMorph3 31s ease-in-out infinite;
}

.blob-4 {
    width: 320px;
    height: 320px;
    top: 60%;
    right: -5%;
    opacity: 0.05;
    animation: blobMorph4 25s ease-in-out infinite;
}

.blob-5 {
    width: 400px;
    height: 400px;
    top: 85%;
    left: 50%;
    transform: translateX(-50%);
    opacity: 0.03;
    animation: blobMorph5 29s ease-in-out infinite;
}

@keyframes blobMorph1 {
    0%   { border-radius: 30% 70% 70% 30% / 30% 30% 70% 70%; }
    25%  { border-radius: 58% 42% 56% 44% / 45% 60% 40% 55%; }
    50%  { border-radius: 50% 50% 34% 66% / 56% 68% 32% 44%; }
    75%  { border-radius: 40% 60% 66% 34% / 65% 35% 65% 35%; }
    100% { border-radius: 30% 70% 70% 30% / 30% 30% 70% 70%; }
}

@keyframes blobMorph2 {
    0%   { border-radius: 50% 50% 34% 66% / 56% 68% 32% 44%; }
    25%  { border-radius: 33% 67% 58% 42% / 63% 37% 63% 37%; }
    50%  { border-radius: 60% 40% 40% 60% / 35% 65% 35% 65%; }
    75%  { border-radius: 42% 58% 70% 30% / 48% 52% 48% 52%; }
    100% { border-radius: 50% 50% 34% 66% / 56% 68% 32% 44%; }
}

@keyframes blobMorph3 {
    0%   { border-radius: 40% 60% 66% 34% / 65% 35% 65% 35%; }
    25%  { border-radius: 70% 30% 30% 70% / 30% 70% 30% 70%; }
    50%  { border-radius: 35% 65% 55% 45% / 50% 50% 50% 50%; }
    75%  { border-radius: 55% 45% 45% 55% / 40% 60% 40% 60%; }
    100% { border-radius: 40% 60% 66% 34% / 65% 35% 65% 35%; }
}

@keyframes blobMorph4 {
    0%   { border-radius: 58% 42% 56% 44% / 45% 60% 40% 55%; }
    25%  { border-radius: 45% 55% 38% 62% / 55% 45% 55% 45%; }
    50%  { border-radius: 65% 35% 50% 50% / 38% 62% 38% 62%; }
    75%  { border-radius: 38% 62% 62% 38% / 62% 38% 62% 38%; }
    100% { border-radius: 58% 42% 56% 44% / 45% 60% 40% 55%; }
}

@keyframes blobMorph5 {
    0%   { border-radius: 33% 67% 58% 42% / 63% 37% 63% 37%; }
    25%  { border-radius: 50% 50% 50% 50% / 50% 50% 50% 50%; }
    50%  { border-radius: 42% 58% 36% 64% / 58% 42% 58% 42%; }
    75%  { border-radius: 66% 34% 44% 56% / 34% 66% 34% 66%; }
    100% { border-radius: 33% 67% 58% 42% / 63% 37% 63% 37%; }
}

/* --- Accent Blobs --- */
.accent-blob {
    position: absolute;
    background: radial-gradient(circle, #c0bdb8 0%, transparent 70%);
    will-change: border-radius;
    pointer-events: none;
}

.accent-blob-1 {
    width: 120px;
    height: 120px;
    top: 20%;
    left: 8%;
    animation: blobMorph1 18s ease-in-out infinite;
    opacity: 0.15;
}

.accent-blob-2 {
    width: 100px;
    height: 100px;
    bottom: 25%;
    right: 10%;
    animation: blobMorph2 21s ease-in-out infinite;
    opacity: 0.12;
}

.accent-blob-3 {
    width: 90px;
    height: 90px;
    top: 10%;
    right: 5%;
    animation: blobMorph3 24s ease-in-out infinite;
    opacity: 0.1;
}

/* --- Chambers --- */
.chamber {
    position: relative;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 10vw;
    z-index: 1;
    transition: background-color 1.5s ease;
}

.chamber-content {
    position: relative;
    max-width: 640px;
    width: 100%;
    margin: 0 auto;
}

.narrow-column {
    max-width: 480px;
}

/* --- Chamber 1: Threshold --- */
.chamber-threshold {
    background-color: #0d0d10;
    text-align: center;
}

.site-title {
    font-family: 'Caveat', cursive;
    font-weight: 400;
    font-size: clamp(2.5rem, 6vw, 4.5rem);
    color: #d4d0cc;
    letter-spacing: 0.01em;
    line-height: 1.4;
    margin-bottom: 1.5rem;
    opacity: 0;
    animation: fadeInUp 1.5s ease-out 0.5s forwards;
}

.site-tagline {
    font-family: 'DM Sans', sans-serif;
    font-weight: 400;
    font-size: clamp(1rem, 2vw, 1.25rem);
    color: #b8b4ae;
    letter-spacing: 0.04em;
    opacity: 0;
    animation: fadeInUp 1.2s ease-out 1.2s forwards;
}

.scroll-indicator {
    position: absolute;
    bottom: -15vh;
    left: 50%;
    transform: translateX(-50%);
    opacity: 0;
    animation: fadeIn 1s ease-out 2.5s forwards, bounce 2s ease-in-out 3.5s infinite;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 0.6; }
}

@keyframes bounce {
    0%, 100% { transform: translateX(-50%) translateY(0); }
    50% { transform: translateX(-50%) translateY(8px); }
}

/* --- Chamber 2: Memory Well --- */
.chamber-memory-well {
    background-color: #1a1a1e;
    padding-left: calc(10vw + 20px);
}

.chamber-title {
    font-family: 'Caveat', cursive;
    font-weight: 400;
    font-size: clamp(1.5rem, 4vw, 3rem);
    color: #d4d0cc;
    letter-spacing: 0.01em;
    line-height: 1.4;
    margin-bottom: 3rem;
    text-align: center;
}

.body-text {
    font-family: 'DM Sans', sans-serif;
    font-weight: 400;
    font-size: clamp(0.95rem, 1.5vw, 1.125rem);
    color: #b8b4ae;
    line-height: 1.75;
    letter-spacing: 0.02em;
    margin-bottom: 0;
}

/* --- Chrome Lines --- */
.chrome-line {
    width: 100%;
    height: 2px;
    margin: 2.5rem 0;
    opacity: 0.35;
}

.chrome-line svg {
    stroke: #c0bdb8;
    width: 100%;
    height: 2px;
    display: block;
}

.line-draw {
    stroke-dasharray: 400;
    stroke-dashoffset: 400;
    transition: stroke-dashoffset 1.5s ease-out;
}

.line-draw.drawn {
    stroke-dashoffset: 0;
}

/* --- Chamber 3: Candle Array --- */
.chamber-candle-array {
    background-color: #0d0d10;
    padding-right: calc(10vw - 20px);
}

.candle-array {
    display: flex;
    flex-direction: column;
    gap: 2.5rem;
    margin-top: 3rem;
}

.candle-item {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    padding: 1rem 0;
}

.candle-flame {
    position: relative;
    width: 30px;
    height: 40px;
    flex-shrink: 0;
}

.flame-inner {
    position: absolute;
    bottom: 8px;
    left: 50%;
    transform: translateX(-50%);
    width: 14px;
    height: 22px;
    background: radial-gradient(ellipse at center bottom, #e8a44a 0%, #c4944a 50%, transparent 100%);
    border-radius: 50% 50% 50% 50% / 60% 60% 40% 40%;
    animation: flamePulse 3s ease-in-out infinite;
    will-change: transform, opacity;
}

.candle-item:nth-child(2) .flame-inner { animation-duration: 3.3s; animation-delay: 0.5s; }
.candle-item:nth-child(3) .flame-inner { animation-duration: 2.8s; animation-delay: 0.2s; }
.candle-item:nth-child(4) .flame-inner { animation-duration: 3.5s; animation-delay: 0.8s; }
.candle-item:nth-child(5) .flame-inner { animation-duration: 3.1s; animation-delay: 0.3s; }
.candle-item:nth-child(6) .flame-inner { animation-duration: 2.9s; animation-delay: 0.7s; }
.candle-item:nth-child(7) .flame-inner { animation-duration: 3.4s; animation-delay: 0.1s; }
.candle-item:nth-child(8) .flame-inner { animation-duration: 3.2s; animation-delay: 0.6s; }
.candle-item:nth-child(9) .flame-inner { animation-duration: 2.7s; animation-delay: 0.4s; }

.flame-glow {
    position: absolute;
    bottom: 4px;
    left: 50%;
    transform: translateX(-50%);
    width: 30px;
    height: 30px;
    background: radial-gradient(circle, rgba(232, 164, 74, 0.25) 0%, transparent 70%);
    border-radius: 50%;
    animation: glowPulse 3s ease-in-out infinite;
}

@keyframes flamePulse {
    0%, 100% {
        transform: translateX(-50%) scaleY(1) scaleX(1);
        opacity: 0.7;
    }
    25% {
        transform: translateX(-50%) scaleY(1.1) scaleX(0.95);
        opacity: 0.8;
    }
    50% {
        transform: translateX(-50%) scaleY(0.9) scaleX(1.05);
        opacity: 0.6;
    }
    75% {
        transform: translateX(-50%) scaleY(1.05) scaleX(0.98);
        opacity: 0.75;
    }
}

@keyframes glowPulse {
    0%, 100% { opacity: 0.5; transform: translateX(-50%) scale(1); }
    50% { opacity: 0.3; transform: translateX(-50%) scale(1.15); }
}

.candle-item:hover .flame-inner {
    animation-duration: 1.5s;
}

.candle-item:hover .flame-glow {
    animation-duration: 1.5s;
}

.candle-info {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.candle-name {
    /* Warm Chrome accent: #d4cfc8 */
    font-family: 'Caveat', cursive;
    font-weight: 400;
    font-size: 1.5rem;
    color: #d4d0cc;
    letter-spacing: 0.01em;
    line-height: 1.3;
}


.candle-item:hover .candle-name {
    color: #d4cfc8;
    transition: color 0.3s ease;
}

.candle-date {
    font-family: 'IBM Plex Mono', monospace;
    font-weight: 400;
    font-size: 0.8rem;
    color: #7a7672;
    letter-spacing: 0.05em;
}

/* --- Chamber 4: Writing Desk --- */
.chamber-writing-desk {
    background-color: #1e1a18;
    padding-left: calc(10vw + 40px);
}

.desk-block {
    display: flex;
    align-items: flex-start;
    gap: 1.5rem;
    margin-bottom: 3rem;
}

.desk-illustration {
    flex-shrink: 0;
    width: 48px;
    height: 48px;
    margin-top: 0.25rem;
}

.desk-text {
    flex: 1;
}

/* --- Chamber 5: Vigil --- */
.chamber-vigil {
    background-color: #0d0d10;
    text-align: center;
    min-height: 100vh;
}

.vigil-flame {
    position: relative;
    width: 60px;
    height: 90px;
    margin: 0 auto 3rem;
}

.vigil-flame-outer {
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 40px;
    height: 60px;
    background: radial-gradient(ellipse at center bottom, rgba(232, 164, 74, 0.5) 0%, rgba(196, 148, 74, 0.2) 50%, transparent 100%);
    border-radius: 50% 50% 50% 50% / 60% 60% 40% 40%;
    animation: vigilFlamePulse 4s ease-in-out infinite;
}

.vigil-flame-inner {
    position: absolute;
    bottom: 8px;
    left: 50%;
    transform: translateX(-50%);
    width: 20px;
    height: 35px;
    background: radial-gradient(ellipse at center bottom, #e8a44a 0%, #c4944a 60%, transparent 100%);
    border-radius: 50% 50% 50% 50% / 60% 60% 40% 40%;
    animation: vigilFlamePulse 3.5s ease-in-out infinite;
    animation-delay: 0.3s;
}

.vigil-flame-glow {
    position: absolute;
    bottom: -10px;
    left: 50%;
    transform: translateX(-50%);
    width: 80px;
    height: 60px;
    background: radial-gradient(circle, rgba(232, 164, 74, 0.15) 0%, transparent 70%);
    border-radius: 50%;
    animation: glowPulse 4s ease-in-out infinite;
}

@keyframes vigilFlamePulse {
    0%, 100% {
        transform: translateX(-50%) scaleY(1) scaleX(1);
        opacity: 0.8;
    }
    30% {
        transform: translateX(-50%) scaleY(1.08) scaleX(0.94);
        opacity: 0.9;
    }
    60% {
        transform: translateX(-50%) scaleY(0.92) scaleX(1.06);
        opacity: 0.7;
    }
}

.vigil-title {
    font-family: 'Caveat', cursive;
    font-weight: 400;
    font-size: clamp(1.8rem, 4vw, 3.5rem);
    color: #d4d0cc;
    letter-spacing: 0.01em;
    line-height: 1.4;
    margin-bottom: 3rem;
}

.vigil-input-wrapper {
    position: relative;
    max-width: 480px;
    margin: 0 auto;
}

.vigil-input {
    width: 100%;
    background: transparent;
    border: none;
    border-bottom: 1px solid rgba(192, 189, 184, 0.3);
    padding: 1rem 0;
    font-family: 'Caveat', cursive;
    font-weight: 400;
    font-size: 1.25rem;
    color: #d4d0cc;
    letter-spacing: 0.01em;
    outline: none;
    border-radius: 2px;
    transition: border-color 0.5s ease;
}

.vigil-input::placeholder {
    font-family: 'Caveat', cursive;
    font-weight: 400;
    color: #7a7672;
    opacity: 1;
}

.vigil-input-line {
    position: absolute;
    bottom: 0;
    left: 50%;
    width: 0%;
    height: 1px;
    background: #e8e4de;
    transform: translateX(-50%);
    transition: width 0.5s ease;
    pointer-events: none;
}

.vigil-input:focus ~ .vigil-input-line {
    width: 100%;
}

.vigil-input:focus {
    border-bottom-color: transparent;
    box-shadow: 0 0 20px rgba(232, 228, 222, 0.1);
}

/* --- Reveal Animations --- */
.reveal-element {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.8s ease-out, transform 0.8s ease-out;
}

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

/* --- Link Styles --- */
a {
    color: #b8b4ae;
    text-decoration: none;
    position: relative;
    transition: color 0.3s ease;
}

a::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 0;
    height: 1px;
    background: #e8e4de;
    transition: width 0.3s ease;
}

a:hover {
    color: #e8e4de;
}

a:hover::after {
    width: 100%;
}


::selection {
    background: rgba(255, 255, 255, 0.1);
    color: #ffffff;
}

/* --- Responsive --- */
@media (max-width: 768px) {
    .chamber {
        padding: 8vw 6vw;
    }

    .chamber-memory-well {
        padding-left: 6vw;
    }

    .chamber-candle-array {
        padding-right: 6vw;
    }

    .chamber-writing-desk {
        padding-left: 6vw;
    }

    .desk-block {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }

    .candle-array {
        gap: 2rem;
    }

    .bg-blob {
        display: none;
    }

    .accent-blob {
        display: none;
    }
}

@media (max-width: 480px) {
    .chamber {
        padding: 12vw 5vw;
    }

    .site-title {
        font-size: 2.2rem;
    }

    .candle-item {
        gap: 1rem;
    }

    .candle-name {
        font-size: 1.25rem;
    }
}
