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

html {
    scroll-behavior: smooth;
    font-size: 16px;
}

body {
    background-color: #0f0d0b;
    color: #e8dcc6;
    font-family: 'Cormorant Garamond', serif;
    font-weight: 400;
    font-size: 1.125rem;
    line-height: 1.72;
    letter-spacing: 0.01em;
    overflow-x: hidden;
    margin-left: 180px;
    background-image:
        repeating-linear-gradient(to bottom, transparent, transparent 47px, rgba(138, 112, 52, 0.08) 47px, rgba(138, 112, 52, 0.08) 48px),
        repeating-linear-gradient(to right, transparent, transparent 79px, rgba(138, 112, 52, 0.08) 79px, rgba(138, 112, 52, 0.08) 80px);
}

/* === NAVIGATION RAIL === */
#nav-rail {
    position: fixed;
    top: 0;
    left: 0;
    width: 180px;
    height: 100vh;
    background-color: #1c1714;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    align-items: center;
    padding: 60px 0 40px;
    z-index: 100;
    border-right: 1px solid rgba(138, 112, 52, 0.15);
}

.nav-labels {
    display: flex;
    flex-direction: column;
    gap: 48px;
    align-items: center;
}

.nav-label {
    font-family: 'Josefin Sans', sans-serif;
    font-weight: 300;
    font-size: 0.75rem;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: #8a7034;
    text-decoration: none;
    position: relative;
    transition: color 0.3s ease;
}

.nav-label::after {
    content: '';
    position: absolute;
    bottom: -4px;
    left: 0;
    width: 100%;
    height: 1px;
    background: #c9a84c;
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 0.6s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.nav-label.active {
    color: #c9a84c;
    font-weight: 600;
}

.nav-label.active::after {
    transform: scaleX(1);
}

.nav-monogram {
    opacity: 0.7;
}

/* === PANELS === */
.panel {
    min-height: 100vh;
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 80px 60px;
}

/* === SECTION TITLES === */
.section-title {
    font-family: 'Poiret One', cursive;
    font-size: clamp(2rem, 4vw, 3.5rem);
    font-weight: 400;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: #c9a84c;
    margin-bottom: 60px;
    position: relative;
}

.animate-underline::after {
    content: '';
    position: absolute;
    bottom: -6px;
    left: 0;
    width: 100%;
    height: 1px;
    background: #c9a84c;
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 0.7s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.animate-underline.revealed::after {
    transform: scaleX(1);
}

/* === PANEL I: FOYER === */
.panel-foyer {
    height: 100vh;
    overflow: hidden;
}

.foyer-sunburst {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -30%);
    opacity: 0;
    animation: fadeIn 0.8s ease-in 0.3s forwards;
}

.foyer-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 30px;
    z-index: 1;
}

.foyer-monogram {
    opacity: 0;
    animation: fadeIn 0.6s ease-in 1s forwards;
}

.foyer-title {
    font-family: 'Poiret One', cursive;
    font-size: clamp(2.5rem, 6vw, 5.5rem);
    font-weight: 400;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: #c9a84c;
    line-height: 1.08;
}

.char {
    opacity: 0;
    display: inline-block;
    animation: charReveal 0.1s ease forwards;
}

.foyer-subtitle {
    font-family: 'Josefin Sans', sans-serif;
    font-weight: 300;
    font-size: 0.875rem;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: #9c8e78;
    opacity: 0;
    animation: fadeIn 0.6s ease-in 1.7s forwards;
}

.chevron-fan {
    position: absolute;
    bottom: 40px;
    opacity: 0;
    animation: fadeIn 0.6s ease-in 2s forwards;
}

@keyframes fadeIn {
    to { opacity: 1; }
}

@keyframes charReveal {
    to { opacity: 1; }
}

/* === PANEL II: BRIEFING === */
.panel-briefing {
    padding-top: 120px;
    padding-bottom: 120px;
}

.briefing-grid {
    display: grid;
    grid-template-columns: 2fr 3fr 2fr;
    gap: 32px;
    max-width: 1100px;
    width: 100%;
    align-items: start;
}

.card {
    background: #1c1714;
    border: 1px solid rgba(201, 168, 76, 0.3);
    border-radius: 4px;
    padding: 32px 24px;
    position: relative;
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

.card.revealed {
    opacity: 1;
    transform: translateY(0);
}

.card-left { margin-top: 40px; }
.card-center { margin-top: 0; }
.card-right { margin-top: 80px; }

.card-stepped-border {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 8px;
    background: repeating-linear-gradient(
        90deg,
        #c9a84c 0px, #c9a84c 8px,
        transparent 8px, transparent 12px,
        #c9a84c 12px, #c9a84c 16px,
        transparent 16px, transparent 24px
    );
    opacity: 0.5;
    border-radius: 4px 4px 0 0;
}

.card-title {
    font-family: 'Poiret One', cursive;
    font-size: 1.5rem;
    font-weight: 400;
    letter-spacing: 0.1em;
    color: #c9a84c;
    margin-bottom: 12px;
}

.card-ornament {
    width: 60px;
    height: 1px;
    background: #8a7034;
    margin-bottom: 16px;
}

.card-body {
    color: #e8dcc6;
    margin-bottom: 20px;
    font-size: 1rem;
    line-height: 1.7;
}

.card-body em {
    font-weight: 600;
    color: #c9a84c;
}

.card-data {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    border-top: 1px solid rgba(138, 112, 52, 0.2);
}

.data-label {
    font-family: 'Josefin Sans', sans-serif;
    font-weight: 300;
    font-size: 0.75rem;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: #9c8e78;
}

.data-value {
    font-family: 'DM Mono', monospace;
    font-size: 0.875rem;
    color: #c9a84c;
}

/* === PANEL III: ARCHIVE === */
.panel-archive {
    min-height: auto;
    height: auto;
    padding: 120px 60px;
    align-items: flex-start;
}

.archive-scroll {
    display: flex;
    gap: 24px;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    padding: 20px 0;
    width: 100%;
    scrollbar-width: thin;
    scrollbar-color: #1c1714 #8a7034;
}

.archive-scroll::-webkit-scrollbar {
    height: 4px;
}

.archive-scroll::-webkit-scrollbar-track {
    background: rgba(138, 112, 52, 0.2);
}

.archive-scroll::-webkit-scrollbar-thumb {
    background: #1c1714;
    border-radius: 2px;
}

.archive-panel {
    flex-shrink: 0;
    scroll-snap-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

.archive-photo {
    width: 240px;
    aspect-ratio: 3/4;
    border: 1px solid rgba(201, 168, 76, 0.4);
    border-radius: 2px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: radial-gradient(ellipse at center, #2a2118 0%, #0f0d0b 100%);
    position: relative;
    overflow: hidden;
}

.archive-photo::before {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(ellipse at center, transparent 40%, rgba(15, 13, 11, 0.7) 100%);
}

.archive-photo::after {
    content: '';
    position: absolute;
    inset: 0;
    opacity: 0.04;
    filter: url(#noise);
    background: #9c8e78;
}

.archive-number {
    font-family: 'Poiret One', cursive;
    font-size: 4rem;
    color: #c9a84c;
    opacity: 0.3;
    z-index: 1;
}

.archive-caption {
    font-family: 'Josefin Sans', sans-serif;
    font-weight: 300;
    font-size: 0.7rem;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: #9c8e78;
    text-align: center;
    max-width: 240px;
    font-variant: small-caps;
}

/* === PANEL IV: LEDGER === */
.panel-ledger {
    padding: 120px 60px;
    align-items: stretch;
    background-image: repeating-linear-gradient(
        to bottom,
        transparent,
        transparent 47px,
        rgba(138, 112, 52, 0.3) 47px,
        rgba(138, 112, 52, 0.3) 48px
    );
}

.panel-ledger .section-title {
    align-self: center;
}

.ledger-entries {
    max-width: 900px;
    width: 100%;
    margin: 0 auto;
}

.ledger-entry {
    padding: 32px 0;
    opacity: 0;
    transform: translateY(15px);
    transition: opacity 0.5s ease, transform 0.5s ease;
}

.ledger-entry.revealed {
    opacity: 1;
    transform: translateY(0);
}

.entry-left { text-align: left; padding-right: 30%; }
.entry-right { text-align: right; padding-left: 30%; }

.entry-ref {
    font-family: 'DM Mono', monospace;
    font-size: 0.875rem;
    color: #8a7034;
    display: block;
    margin-bottom: 8px;
}

.entry-heading {
    font-family: 'Poiret One', cursive;
    font-size: 1.4rem;
    font-weight: 400;
    letter-spacing: 0.1em;
    color: #c9a84c;
    margin-bottom: 12px;
    position: relative;
    display: inline-block;
}

.entry-text {
    color: #e8dcc6;
    font-size: 1rem;
    line-height: 1.72;
}

/* === PANEL V: CORRESPONDENCE === */
.panel-correspondence {
    padding: 120px 60px;
}

.letter-container {
    max-width: 640px;
    width: 100%;
}

.letter-date {
    font-family: 'Josefin Sans', sans-serif;
    font-weight: 300;
    font-size: 0.75rem;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: #9c8e78;
    margin-bottom: 40px;
}

.letter-greeting {
    font-family: 'Cormorant Garamond', serif;
    font-weight: 600;
    font-size: 1.25rem;
    color: #c9a84c;
    margin-bottom: 24px;
}

.letter-body {
    text-indent: 2em;
    margin-bottom: 20px;
    color: #e8dcc6;
}

.letter-closing {
    margin-top: 40px;
    font-style: italic;
    color: #9c8e78;
}

.letter-signature {
    font-family: 'Cormorant Garamond', serif;
    font-weight: 600;
    font-size: 1.25rem;
    color: #c9a84c;
    margin-top: 8px;
    margin-bottom: 30px;
}

.signature-flourish {
    margin-bottom: 40px;
}

.flourish-path {
    stroke-dasharray: 300;
    stroke-dashoffset: 300;
    transition: stroke-dashoffset 1.5s ease;
}

.signature-flourish.revealed .flourish-path {
    stroke-dashoffset: 0;
}

.wax-seal {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: radial-gradient(circle at 35% 35%, #a83a3a, #8b2e2e 50%, #6b2222);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(0,0,0,0.4), inset 0 1px 2px rgba(255,255,255,0.1);
    opacity: 0;
    transition: opacity 0.6s ease 1.6s;
}

.wax-seal.revealed {
    opacity: 1;
}

.seal-inner {
    font-family: 'Poiret One', cursive;
    font-size: 1rem;
    color: #e8dcc6;
    letter-spacing: 0.1em;
    opacity: 0.8;
}

/* === RESPONSIVE: MOBILE === */
@media (max-width: 768px) {
    body {
        margin-left: 0;
        margin-bottom: 48px;
    }

    #nav-rail {
        position: fixed;
        top: auto;
        bottom: 0;
        left: 0;
        width: 100%;
        height: 48px;
        flex-direction: row;
        padding: 0 16px;
        border-right: none;
        border-top: 1px solid rgba(138, 112, 52, 0.15);
    }

    .nav-labels {
        flex-direction: row;
        gap: 20px;
    }

    .nav-label {
        font-size: 0.6rem;
    }

    .nav-monogram {
        display: none;
    }

    .panel {
        padding: 60px 24px;
    }

    .briefing-grid {
        grid-template-columns: 1fr;
    }

    .card-left, .card-center, .card-right {
        margin-top: 0;
    }

    .entry-left, .entry-right {
        padding-left: 0;
        padding-right: 0;
        text-align: left;
    }

    .foyer-title {
        font-size: clamp(2rem, 8vw, 3.5rem);
    }
}

/* === REDUCED MOTION === */
@media (prefers-reduced-motion: reduce) {
    .char {
        opacity: 1;
        animation: none;
    }

    .foyer-sunburst,
    .foyer-monogram,
    .foyer-subtitle,
    .chevron-fan {
        opacity: 1;
        animation: none;
    }

    .card {
        opacity: 1;
        transform: none;
    }

    .ledger-entry {
        opacity: 1;
        transform: none;
    }

    .animate-underline::after {
        transform: scaleX(1);
    }

    .flourish-path {
        stroke-dashoffset: 0;
    }

    .wax-seal {
        opacity: 1;
    }
}
