/* ==========================================================================
   xanadu.quest — The Pleasure Dome, Rekindled
   Palette: Void Black, Starlight Gold, Nebula Rose, Ice Blue, Pearl White, Deep Indigo
   ========================================================================== */

:root {
    --void-black: #0a0a1a;
    --deep-indigo: #1a1a3e;
    --starlight-gold: #c9b896;
    --nebula-rose: #c47a8a;
    --ice-blue: #a8c4d4;
    --pearl-white: #f0ece4;

    --sidebar-width: 280px;
    --section-gap: 120px;

    --scroll-progress: 0;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html, body {
    height: 100%;
}

body {
    font-family: "Source Sans 3", "Inter", -apple-system, sans-serif;
    font-weight: 300;
    font-size: 1.05rem;
    line-height: 1.85;
    color: var(--pearl-white);
    background-color: var(--void-black);
    background-image:
        radial-gradient(ellipse at top left, rgba(26, 26, 62, 0.55), transparent 60%),
        radial-gradient(ellipse at bottom right, rgba(196, 122, 138, 0.08), transparent 60%);
    background-attachment: fixed;
    min-height: 100vh;
    overflow-x: hidden;
    cursor: none;
    transition: background-color 1.2s ease;
}

/* Scroll-shifted background --------------------------------------------- */
body.scroll-deep {
    background-color: #13133a;
}

body.scroll-deeper {
    background-color: var(--deep-indigo);
}

/* =============================================================
   LOADER — poetic narrative entry
   ============================================================= */
.loader {
    position: fixed;
    inset: 0;
    background: var(--void-black);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 1.4s ease;
}

.loader.loader-fade {
    opacity: 0;
    pointer-events: none;
}

.loader-glow {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: var(--starlight-gold);
    box-shadow: 0 0 20px 4px var(--starlight-gold);
    transform: translate(-50%, -50%) scale(0);
    animation: loader-expand 2.4s ease-out forwards;
    animation-delay: 0.5s;
}

@keyframes loader-expand {
    0%   { transform: translate(-50%, -50%) scale(0); opacity: 0; }
    15%  { opacity: 1; }
    100% { transform: translate(-50%, -50%) scale(220); opacity: 0; background: radial-gradient(circle, rgba(201,184,150,0.4), transparent 70%); box-shadow: none; }
}

.loader-quote {
    font-family: "Cormorant Garamond", "Playfair Display", serif;
    font-style: italic;
    font-size: 2rem;
    color: var(--starlight-gold);
    letter-spacing: 0.04em;
    opacity: 0;
    animation: loader-quote-in 3.2s ease forwards;
    animation-delay: 1.2s;
    text-align: center;
    text-shadow: 0 0 30px rgba(201, 184, 150, 0.4);
}

@keyframes loader-quote-in {
    0%   { opacity: 0; }
    25%  { opacity: 1; }
    75%  { opacity: 1; }
    100% { opacity: 0; }
}

/* =============================================================
   CURSOR TORCH — the user as torchbearer
   ============================================================= */
.cursor-torch {
    position: fixed;
    top: 0;
    left: 0;
    width: 320px;
    height: 320px;
    border-radius: 50%;
    pointer-events: none;
    z-index: 900;
    transform: translate(-50%, -50%);
    background: radial-gradient(
        circle,
        rgba(201, 184, 150, 0.22) 0%,
        rgba(196, 122, 138, 0.12) 25%,
        rgba(196, 122, 138, 0.04) 50%,
        transparent 70%
    );
    mix-blend-mode: screen;
    transition: opacity 0.4s ease;
    opacity: 0;
    filter: blur(2px);
    animation: torch-flicker 3.4s ease-in-out infinite;
}

.cursor-torch.active {
    opacity: 1;
}

@keyframes torch-flicker {
    0%, 100% { filter: blur(2px) brightness(1); }
    30%      { filter: blur(3px) brightness(0.92); }
    55%      { filter: blur(2px) brightness(1.08); }
    80%      { filter: blur(2.4px) brightness(0.98); }
}

/* =============================================================
   ATMOSPHERE — nebulae, particles, candle glows
   ============================================================= */
.atmosphere {
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    overflow: hidden;
}

.nebula {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.45;
}

.nebula-one {
    width: 900px;
    height: 900px;
    top: -260px;
    left: -280px;
    background: radial-gradient(circle, rgba(168, 196, 212, 0.25), transparent 65%);
    animation: nebula-drift 60s ease-in-out infinite alternate;
}

.nebula-two {
    width: 700px;
    height: 700px;
    bottom: -180px;
    right: -160px;
    background: radial-gradient(circle, rgba(196, 122, 138, 0.22), transparent 65%);
    animation: nebula-drift 78s ease-in-out infinite alternate-reverse;
}

.nebula-three {
    width: 540px;
    height: 540px;
    top: 40%;
    left: 50%;
    background: radial-gradient(circle, rgba(201, 184, 150, 0.12), transparent 70%);
    animation: nebula-drift 90s ease-in-out infinite alternate;
}

@keyframes nebula-drift {
    0%   { transform: translate(0, 0) scale(1); }
    50%  { transform: translate(40px, -60px) scale(1.08); }
    100% { transform: translate(-30px, 30px) scale(0.96); }
}

/* Starfield via layered box-shadows */
.starfield {
    position: absolute;
    top: 0;
    left: 0;
    width: 1px;
    height: 1px;
    background: transparent;
    box-shadow:
        23vw 12vh 0 0 rgba(240, 236, 228, 0.7),
        68vw 8vh 0 0 rgba(240, 236, 228, 0.5),
        12vw 34vh 0 0 rgba(201, 184, 150, 0.6),
        84vw 28vh 0 0 rgba(240, 236, 228, 0.7),
        41vw 52vh 0 0 rgba(168, 196, 212, 0.55),
        76vw 66vh 0 0 rgba(240, 236, 228, 0.6),
        8vw 72vh 0 0 rgba(201, 184, 150, 0.45),
        54vw 86vh 0 0 rgba(240, 236, 228, 0.5),
        92vw 90vh 0 0 rgba(201, 184, 150, 0.5),
        32vw 18vh 0 0 rgba(240, 236, 228, 0.3),
        58vw 22vh 0 0 rgba(168, 196, 212, 0.4),
        18vw 62vh 0 0 rgba(240, 236, 228, 0.35),
        72vw 48vh 0 0 rgba(201, 184, 150, 0.5),
        4vw 44vh 0 0 rgba(240, 236, 228, 0.6),
        88vw 76vh 0 0 rgba(168, 196, 212, 0.4),
        48vw 6vh 0 0 rgba(240, 236, 228, 0.6),
        62vw 94vh 0 0 rgba(201, 184, 150, 0.45),
        28vw 82vh 0 0 rgba(240, 236, 228, 0.55),
        79vw 14vh 0 0 rgba(201, 184, 150, 0.35),
        16vw 96vh 0 0 rgba(240, 236, 228, 0.35);
    animation: star-drift 120s linear infinite;
}

@keyframes star-drift {
    0%   { transform: translateY(0); opacity: 0.8; }
    50%  { opacity: 1; }
    100% { transform: translateY(-40px); opacity: 0.7; }
}

.particles {
    position: absolute;
    inset: 0;
}

.particles span {
    position: absolute;
    width: 3px;
    height: 3px;
    border-radius: 50%;
    background: rgba(201, 184, 150, 0.6);
    box-shadow: 0 0 6px rgba(201, 184, 150, 0.5);
    opacity: 0;
    animation: particle-float 14s linear infinite;
}

.particles span:nth-child(1)  { left: 18%; animation-delay:  0s; }
.particles span:nth-child(2)  { left: 27%; animation-delay: -1.2s; }
.particles span:nth-child(3)  { left: 35%; animation-delay: -3.4s; }
.particles span:nth-child(4)  { left: 44%; animation-delay: -5.1s; }
.particles span:nth-child(5)  { left: 52%; animation-delay: -6.8s; }
.particles span:nth-child(6)  { left: 60%; animation-delay: -8.2s; }
.particles span:nth-child(7)  { left: 68%; animation-delay: -9.7s; }
.particles span:nth-child(8)  { left: 76%; animation-delay: -11.3s; }
.particles span:nth-child(9)  { left: 84%; animation-delay: -12.4s; background: rgba(196, 122, 138, 0.6); }
.particles span:nth-child(10) { left: 91%; animation-delay: -2.6s; background: rgba(168, 196, 212, 0.6); }
.particles span:nth-child(11) { left: 22%; animation-delay: -7.5s; background: rgba(196, 122, 138, 0.55); }
.particles span:nth-child(12) { left: 38%; animation-delay: -4.1s; background: rgba(168, 196, 212, 0.5); }
.particles span:nth-child(13) { left: 48%; animation-delay: -10.8s; }
.particles span:nth-child(14) { left: 65%; animation-delay: -13.1s; }
.particles span:nth-child(15) { left: 82%; animation-delay: -8.9s;  background: rgba(196, 122, 138, 0.45); }

@keyframes particle-float {
    0%   { transform: translateY(110vh) translateX(0);   opacity: 0; }
    10%  { opacity: 1; }
    50%  { transform: translateY(50vh)  translateX(20px); opacity: 0.7; }
    90%  { opacity: 1; }
    100% { transform: translateY(-10vh) translateX(-10px); opacity: 0; }
}

.candle-glow {
    position: absolute;
    width: 200px;
    height: 200px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(196, 122, 138, 0.28), rgba(196, 122, 138, 0.05) 55%, transparent 75%);
    filter: blur(10px);
    animation: candle-pulse 4s ease-in-out infinite;
}

.candle-one   { top: 18%; left: 38%; animation-delay: 0s; }
.candle-two   { top: 62%; left: 70%; animation-delay: -1.6s; }
.candle-three { top: 88%; left: 45%; animation-delay: -3.1s; }

@keyframes candle-pulse {
    0%, 100% { transform: scale(1)    translate(0, 0); opacity: 0.9; }
    40%      { transform: scale(1.08) translate(4px, -6px); opacity: 1; }
    70%      { transform: scale(0.96) translate(-6px, 4px); opacity: 0.75; }
}

/* =============================================================
   SIDEBAR — the spacecraft control panel
   ============================================================= */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: var(--sidebar-width);
    height: 100vh;
    padding: 48px 32px 32px;
    background: rgba(10, 10, 26, 0.9);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-right: 1px solid rgba(201, 184, 150, 0.2);
    z-index: 100;
    display: flex;
    flex-direction: column;
    transform: translateX(-110%);
    opacity: 0;
    transition: transform 1.2s cubic-bezier(0.22, 0.61, 0.36, 1), opacity 1.2s ease;
    overflow: hidden;
}

.sidebar.revealed {
    transform: translateX(0);
    opacity: 1;
}

/* pulsing diagnostic line — right edge */
.sidebar::after {
    content: "";
    position: absolute;
    top: 0;
    right: 0;
    width: 1px;
    height: 100%;
    background: linear-gradient(to bottom,
        transparent,
        rgba(201, 184, 150, 0.35) 25%,
        rgba(196, 122, 138, 0.5) 50%,
        rgba(201, 184, 150, 0.35) 75%,
        transparent);
    animation: diagnostic-pulse 4s ease-in-out infinite;
}

@keyframes diagnostic-pulse {
    0%, 100% { opacity: 0.4; }
    50%      { opacity: 1; }
}

.sidebar-header {
    padding-bottom: 28px;
    border-bottom: 1px solid rgba(201, 184, 150, 0.15);
    margin-bottom: 28px;
    text-align: center;
}

.insignia {
    width: 56px;
    height: 56px;
    margin: 0 auto 18px;
    animation: insignia-rotate 44s linear infinite;
}

.insignia-svg {
    width: 100%;
    height: 100%;
    display: block;
    filter: drop-shadow(0 0 4px rgba(201, 184, 150, 0.4));
}

@keyframes insignia-rotate {
    from { transform: rotate(0deg); }
    to   { transform: rotate(360deg); }
}

.sidebar-title {
    font-family: "Playfair Display", "Cormorant Garamond", serif;
    font-weight: 500;
    font-size: 1.9rem;
    color: var(--starlight-gold);
    letter-spacing: 0.18em;
    text-transform: uppercase;
    line-height: 1;
}

.sidebar-subtitle {
    margin-top: 8px;
    font-family: "Cormorant Garamond", serif;
    font-style: italic;
    font-size: 0.85rem;
    color: rgba(240, 236, 228, 0.6);
    letter-spacing: 0.08em;
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 2px;
    flex: 1;
}

.nav-item {
    position: relative;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px 12px 18px;
    font-family: "Source Sans 3", "Inter", sans-serif;
    font-weight: 400;
    font-size: 0.9rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: rgba(240, 236, 228, 0.6);
    text-decoration: none;
    border-left: 1px solid rgba(201, 184, 150, 0);
    transition: color 0.4s ease, background-color 0.4s ease, border-color 0.4s ease, padding-left 0.4s ease;
}

.nav-item::before {
    content: "";
    position: absolute;
    left: 0;
    top: 50%;
    width: 2px;
    height: 0;
    background: var(--starlight-gold);
    transform: translateY(-50%);
    transition: height 0.4s ease-out, background 0.4s ease;
}

.nav-item:hover,
.nav-item.active {
    color: var(--starlight-gold);
    background: linear-gradient(to right, rgba(201, 184, 150, 0.08), transparent);
    padding-left: 22px;
}

.nav-item:hover::before,
.nav-item.active::before {
    height: 80%;
}

.nav-item.active::before {
    background: var(--nebula-rose);
    width: 2px;
}

.nav-marker {
    width: 6px;
    height: 6px;
    border: 1px solid var(--starlight-gold);
    border-radius: 50%;
    flex-shrink: 0;
    transition: background 0.4s ease, box-shadow 0.4s ease;
}

.nav-item:hover .nav-marker,
.nav-item.active .nav-marker {
    background: var(--nebula-rose);
    border-color: var(--nebula-rose);
    box-shadow: 0 0 8px rgba(196, 122, 138, 0.6);
}

.nav-label {
    flex: 1;
    font-size: 0.82rem;
}

.nav-meta {
    font-family: "Cormorant Garamond", serif;
    font-style: italic;
    font-size: 0.78rem;
    color: rgba(168, 196, 212, 0.6);
    letter-spacing: 0.1em;
}

/* heartbeat monitor */
.heartbeat {
    display: flex;
    align-items: flex-end;
    gap: 3px;
    height: 22px;
    margin: 18px 0;
    padding: 0 4px;
}

.heartbeat span {
    flex: 1;
    background: var(--starlight-gold);
    opacity: 0.35;
    border-radius: 1px;
    animation: heartbeat-bar 2s ease-in-out infinite;
}

.heartbeat span:nth-child(1)  { animation-delay: 0s;    height: 30%; }
.heartbeat span:nth-child(2)  { animation-delay: 0.08s; height: 55%; }
.heartbeat span:nth-child(3)  { animation-delay: 0.16s; height: 85%; }
.heartbeat span:nth-child(4)  { animation-delay: 0.24s; height: 40%; background: var(--nebula-rose); }
.heartbeat span:nth-child(5)  { animation-delay: 0.32s; height: 25%; }
.heartbeat span:nth-child(6)  { animation-delay: 0.40s; height: 60%; }
.heartbeat span:nth-child(7)  { animation-delay: 0.48s; height: 95%; background: var(--nebula-rose); }
.heartbeat span:nth-child(8)  { animation-delay: 0.56s; height: 50%; }
.heartbeat span:nth-child(9)  { animation-delay: 0.64s; height: 30%; }
.heartbeat span:nth-child(10) { animation-delay: 0.72s; height: 70%; }
.heartbeat span:nth-child(11) { animation-delay: 0.80s; height: 45%; }
.heartbeat span:nth-child(12) { animation-delay: 0.88s; height: 35%; }

@keyframes heartbeat-bar {
    0%, 100% { opacity: 0.35; transform: scaleY(1); }
    50%      { opacity: 1;    transform: scaleY(1.25); }
}

.sidebar-footer {
    padding-top: 18px;
    border-top: 1px solid rgba(201, 184, 150, 0.15);
    text-align: center;
}

.flame {
    width: 20px;
    height: 32px;
    margin: 0 auto 10px;
    animation: flame-flicker 3s ease-in-out infinite;
    transform-origin: center bottom;
}

.flame svg {
    width: 100%;
    height: 100%;
    display: block;
    filter: drop-shadow(0 0 4px rgba(196, 122, 138, 0.6));
}

@keyframes flame-flicker {
    0%, 100% { transform: scale(1)    rotate(0deg);   opacity: 0.95; }
    25%      { transform: scale(1.06) rotate(-1.5deg); opacity: 0.75; }
    50%      { transform: scale(0.94) rotate(1deg);    opacity: 1; }
    75%      { transform: scale(1.03) rotate(-0.5deg); opacity: 0.85; }
}

.sidebar-status {
    font-family: "Source Sans 3", sans-serif;
    font-size: 0.72rem;
    letter-spacing: 0.24em;
    text-transform: uppercase;
    color: var(--ice-blue);
    margin-bottom: 4px;
}

.sidebar-coords {
    font-family: "Cormorant Garamond", serif;
    font-style: italic;
    font-size: 0.78rem;
    color: rgba(240, 236, 228, 0.5);
    letter-spacing: 0.06em;
}

/* =============================================================
   CONTENT — viewport windows
   ============================================================= */
.content {
    margin-left: var(--sidebar-width);
    padding: 80px 80px 160px;
    position: relative;
    z-index: 10;
    max-width: 1080px;
}

.viewport {
    position: relative;
    margin-bottom: var(--section-gap);
    padding: 72px 64px;
    border: 1px solid rgba(201, 184, 150, 0.4);
    border-radius: 4px;
    background: linear-gradient(to bottom,
        rgba(26, 26, 62, 0.2),
        rgba(10, 10, 26, 0.45) 50%,
        rgba(26, 26, 62, 0.2));
    opacity: 0;
    transform: translateY(20px);
    filter: blur(4px);
    transition: opacity 1.2s ease, transform 1.2s ease, filter 1.2s ease;
}

.viewport.revealed {
    opacity: 1;
    transform: translateY(0);
    filter: blur(0);
}

.viewport::before {
    /* corner markers like viewport readouts */
    content: "";
    position: absolute;
    top: -1px;
    left: -1px;
    width: 14px;
    height: 14px;
    border-top: 1px solid var(--starlight-gold);
    border-left: 1px solid var(--starlight-gold);
}

.viewport::after {
    content: "";
    position: absolute;
    bottom: -1px;
    right: -1px;
    width: 14px;
    height: 14px;
    border-bottom: 1px solid var(--starlight-gold);
    border-right: 1px solid var(--starlight-gold);
}

.filigree {
    width: 100%;
    max-width: 400px;
    height: 40px;
    margin: 0 auto 32px;
    opacity: 0.85;
}

.filigree svg {
    width: 100%;
    height: 100%;
    display: block;
}

.eyebrow {
    font-family: "Source Sans 3", sans-serif;
    font-size: 0.78rem;
    font-weight: 600;
    letter-spacing: 0.32em;
    text-transform: uppercase;
    color: var(--ice-blue);
    margin-bottom: 20px;
    display: inline-block;
    position: relative;
    padding-left: 24px;
}

.eyebrow::before {
    content: "";
    position: absolute;
    left: 0;
    top: 50%;
    width: 14px;
    height: 1px;
    background: var(--ice-blue);
}

h1, h2, h3, h4,
.h1, .h2, .h3, .h4 {
    font-family: "Playfair Display", "Cormorant Garamond", serif;
    color: var(--starlight-gold);
    letter-spacing: 0.08em;
    line-height: 1.15;
    font-weight: 500;
    margin-bottom: 28px;
    text-shadow: 0 0 30px rgba(201, 184, 150, 0.15);
}

.h1 { font-size: 4.8rem; font-weight: 400; }
.h2 { font-size: 3.4rem; font-weight: 500; }
.h3 { font-size: 2.4rem; font-weight: 600; }
.h4 { font-size: 1.4rem; font-weight: 600; letter-spacing: 0.1em; }

.lede {
    font-family: "Cormorant Garamond", "Playfair Display", serif;
    font-size: 1.45rem;
    font-style: italic;
    line-height: 1.7;
    color: rgba(240, 236, 228, 0.9);
    margin-bottom: 36px;
    max-width: 720px;
}

.body {
    font-size: 1.05rem;
    line-height: 1.85;
    color: var(--pearl-white);
    margin-bottom: 24px;
    max-width: 720px;
    font-weight: 300;
}

/* Pull quotes */
.pull-quote {
    position: relative;
    margin: 40px 0 40px 32px;
    padding: 20px 24px 20px 32px;
    border-left: 1px solid var(--starlight-gold);
    font-family: "Cormorant Garamond", serif;
    font-style: italic;
    font-size: 1.6rem;
    line-height: 1.5;
    color: rgba(240, 236, 228, 0.88);
    max-width: 620px;
}

.pull-quote::before {
    content: "";
    position: absolute;
    left: -1px;
    top: 0;
    width: 1px;
    height: 100%;
    background: linear-gradient(to bottom, transparent, var(--nebula-rose), transparent);
    opacity: 0.6;
}

.pull-quote cite {
    display: block;
    margin-top: 12px;
    font-style: normal;
    font-family: "Source Sans 3", sans-serif;
    font-size: 0.8rem;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: var(--ice-blue);
    opacity: 0.8;
}

.pull-quote-alt {
    border-left-color: var(--nebula-rose);
}

.caption {
    font-family: "Cormorant Garamond", serif;
    font-style: italic;
    font-size: 1.1rem;
    color: rgba(168, 196, 212, 0.75);
    margin-top: 20px;
    letter-spacing: 0.03em;
}

.caption-final {
    text-align: center;
    margin-top: 36px;
    color: rgba(201, 184, 150, 0.8);
}

/* Card rows ----------------------------------------------------- */
.card-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 24px;
    margin-top: 40px;
}

.card {
    padding: 28px 24px;
    background: rgba(26, 26, 62, 0.55);
    border: 1px solid rgba(201, 184, 150, 0.25);
    border-radius: 3px;
    position: relative;
    transition: transform 0.5s ease, border-color 0.5s ease, background 0.5s ease;
}

.card:hover {
    transform: translateY(-3px);
    border-color: var(--nebula-rose);
    background: rgba(26, 26, 62, 0.75);
}

.card-eyebrow {
    font-family: "Cormorant Garamond", serif;
    font-style: italic;
    font-size: 0.9rem;
    color: var(--nebula-rose);
    letter-spacing: 0.12em;
    margin-bottom: 8px;
}

.card-title {
    font-family: "Playfair Display", serif;
    font-size: 1.3rem;
    color: var(--starlight-gold);
    margin-bottom: 12px;
    letter-spacing: 0.05em;
    font-weight: 500;
    line-height: 1.25;
}

.card-body {
    font-size: 0.98rem;
    line-height: 1.7;
    color: rgba(240, 236, 228, 0.82);
}

/* Spec list ----------------------------------------------------- */
.spec-list {
    list-style: none;
    margin: 40px 0 16px;
    max-width: 680px;
    border-top: 1px solid rgba(201, 184, 150, 0.2);
}

.spec-list li {
    display: flex;
    gap: 24px;
    padding: 18px 4px;
    border-bottom: 1px solid rgba(201, 184, 150, 0.15);
    transition: background 0.4s ease;
}

.spec-list li:hover {
    background: rgba(196, 122, 138, 0.05);
}

.spec-label {
    flex: 0 0 160px;
    font-family: "Source Sans 3", sans-serif;
    font-size: 0.78rem;
    font-weight: 600;
    letter-spacing: 0.22em;
    text-transform: uppercase;
    color: var(--ice-blue);
    padding-top: 3px;
}

.spec-value {
    flex: 1;
    font-family: "Cormorant Garamond", serif;
    font-style: italic;
    font-size: 1.15rem;
    color: var(--pearl-white);
}

/* Chamber grid -------------------------------------------------- */
.chamber-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 32px;
    margin-top: 48px;
}

.chamber {
    position: relative;
    padding: 32px 28px 28px;
    background: rgba(10, 10, 26, 0.6);
    border: 1px solid rgba(201, 184, 150, 0.3);
    border-radius: 3px;
    overflow: hidden;
    transition: border-color 0.5s ease;
}

.chamber::after {
    content: "";
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 2px;
    background: linear-gradient(to right, transparent, var(--nebula-rose), transparent);
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 0.6s ease-out;
}

.chamber:hover {
    border-color: var(--nebula-rose);
}

.chamber:hover::after {
    transform: scaleX(1);
}

.chamber-number {
    font-family: "Playfair Display", serif;
    font-size: 3rem;
    font-weight: 400;
    color: rgba(201, 184, 150, 0.35);
    display: block;
    margin-bottom: 4px;
    letter-spacing: 0.05em;
}

.chamber-title {
    font-family: "Playfair Display", serif;
    font-size: 1.35rem;
    font-weight: 500;
    color: var(--starlight-gold);
    margin-bottom: 12px;
    letter-spacing: 0.06em;
}

.chamber-desc {
    font-size: 0.98rem;
    line-height: 1.7;
    color: rgba(240, 236, 228, 0.82);
    font-weight: 300;
}

/* Log entries --------------------------------------------------- */
.log-entries {
    margin-top: 40px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.log-entry {
    padding: 22px 28px;
    background: rgba(26, 26, 62, 0.35);
    border-left: 1px solid rgba(201, 184, 150, 0.3);
    transition: border-color 0.4s ease, background 0.4s ease, padding-left 0.4s ease;
}

.log-entry:hover {
    border-left-color: var(--nebula-rose);
    background: rgba(26, 26, 62, 0.6);
    padding-left: 34px;
}

.log-date {
    font-family: "Source Sans 3", sans-serif;
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.28em;
    text-transform: uppercase;
    color: var(--ice-blue);
    margin-bottom: 10px;
}

.log-text {
    font-family: "Cormorant Garamond", serif;
    font-style: italic;
    font-size: 1.22rem;
    line-height: 1.6;
    color: var(--pearl-white);
    max-width: 640px;
}

/* Coda flame ---------------------------------------------------- */
.coda-flame {
    width: 40px;
    height: 64px;
    margin: 48px auto 0;
    animation: flame-flicker 3.2s ease-in-out infinite;
    transform-origin: center bottom;
}

.coda-flame svg {
    width: 100%;
    height: 100%;
    display: block;
    filter: drop-shadow(0 0 10px rgba(196, 122, 138, 0.6));
}

/* =============================================================
   LINK / INTERACTIVE UNDERLINE-DRAW
   ============================================================= */
a:not(.nav-item) {
    position: relative;
    color: var(--ice-blue);
    text-decoration: none;
    transition: color 0.4s ease;
}

a:not(.nav-item)::after {
    content: "";
    position: absolute;
    left: 0;
    bottom: -2px;
    width: 100%;
    height: 1px;
    background: var(--starlight-gold);
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 0.4s ease-out, background 0.4s ease, height 0.4s ease;
}

a:not(.nav-item):hover { color: var(--starlight-gold); }
a:not(.nav-item):hover::after { transform: scaleX(1); }
a:not(.nav-item):active::after { background: var(--nebula-rose); height: 2px; }

/* =============================================================
   SCROLL-DEPTH THEMING
   ============================================================= */
body.scroll-deep .candle-glow   { filter: blur(14px); transform: scale(1.15); }
body.scroll-deeper .candle-glow { filter: blur(18px); opacity: 0.85; }

/* =============================================================
   RESPONSIVE
   ============================================================= */
@media (max-width: 900px) {
    :root {
        --sidebar-width: 0px;
        --section-gap: 80px;
    }
    .sidebar {
        width: 100%;
        height: auto;
        position: relative;
        transform: translateY(-20px);
    }
    .sidebar.revealed { transform: translateY(0); }
    .sidebar-nav { flex-direction: row; flex-wrap: wrap; gap: 4px; }
    .nav-item { flex: 1 1 40%; padding: 10px 12px; }
    .heartbeat { display: none; }
    .content { margin-left: 0; padding: 48px 28px 120px; }
    .viewport { padding: 48px 28px; }
    .h1 { font-size: 2.8rem; }
    .h2 { font-size: 2.2rem; }
    .h3 { font-size: 1.8rem; }
    .cursor-torch { display: none; }
    body { cursor: auto; }
}
