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

html, body {
    height: 100vh;
    overflow: hidden;
    background: #d4c8b8;
    color: #1a1714;
    font-family: 'Cormorant Garamond', Georgia, serif;
}

/* === GRIMOIRE (Horizontal Scroll Container) === */
.grimoire {
    display: flex;
    overflow-x: auto;
    overflow-y: hidden;
    scroll-snap-type: x mandatory;
    height: 100vh;
    width: 100vw;
    scrollbar-width: none;
}

.grimoire::-webkit-scrollbar {
    display: none;
}

/* === PANELS === */
.panel {
    min-width: 100vw;
    height: 100vh;
    scroll-snap-align: start;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #d4c8b8;
    flex-shrink: 0;
}

.panel--seance {
    background: #1a1714;
}

/* === PANEL BORDERS === */
.panel-border {
    position: absolute;
    inset: 20px;
    border: 2px solid #3d3530;
    pointer-events: none;
    z-index: 2;
}

.panel-border--dark {
    border-color: #6b5e54;
}

.corner {
    position: absolute;
    width: 24px;
    height: 24px;
}

.corner::before,
.corner::after {
    content: '';
    position: absolute;
    background: #3d3530;
}

.panel-border--dark .corner::before,
.panel-border--dark .corner::after {
    background: #6b5e54;
}

.corner--tl { top: -2px; left: -2px; }
.corner--tr { top: -2px; right: -2px; }
.corner--bl { bottom: -2px; left: -2px; }
.corner--br { bottom: -2px; right: -2px; }

.corner--tl::before { width: 24px; height: 2px; top: 0; left: 0; }
.corner--tl::after { width: 2px; height: 24px; top: 0; left: 0; }
.corner--tr::before { width: 24px; height: 2px; top: 0; right: 0; }
.corner--tr::after { width: 2px; height: 24px; top: 0; right: 0; }
.corner--bl::before { width: 24px; height: 2px; bottom: 0; left: 0; }
.corner--bl::after { width: 2px; height: 24px; bottom: 0; left: 0; }
.corner--br::before { width: 24px; height: 2px; bottom: 0; right: 0; }
.corner--br::after { width: 2px; height: 24px; bottom: 0; right: 0; }

/* Corner rosettes */
.corner::after {
    border-radius: 0;
}

/* === PANEL CONTENT === */
.panel-content {
    position: relative;
    z-index: 1;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px;
}

/* === ENTRANCE PANEL === */
.entrance-content {
    opacity: 0;
    animation: fadeReveal 1.5s ease-in 0.3s forwards;
}

.site-title {
    font-family: 'Playfair Display', Georgia, serif;
    font-weight: 400;
    font-style: italic;
    font-size: clamp(2.5rem, 5vw, 4.5rem);
    color: #1a1714;
    letter-spacing: 0.02em;
    margin-bottom: 2rem;
}

.specimen-fern {
    opacity: 0;
    animation: fadeReveal 2s ease-out 1.8s forwards;
    margin-bottom: 2rem;
}

.entrance-ornament {
    font-family: 'Cormorant Garamond', serif;
    font-size: 1.8rem;
    color: #9c8e82;
    margin-bottom: 1.5rem;
    opacity: 0;
    animation: fadeReveal 1s ease-out 3.5s forwards;
}

.entrance-instruction {
    font-family: 'IM Fell English', Georgia, serif;
    font-style: italic;
    font-size: 0.85rem;
    color: #9c8e82;
    letter-spacing: 0.03em;
    opacity: 0;
    animation: fadeReveal 1s ease-out 4s forwards;
}

/* === SPECIMEN PANELS === */
.specimen-layout {
    flex-direction: row;
    align-items: center;
    justify-content: center;
    gap: 5vw;
    padding: 80px;
}

.specimen-illustration {
    position: relative;
    flex-shrink: 0;
    opacity: 0;
    transition: opacity 0.8s ease-out;
}

.specimen-illustration.revealed {
    opacity: 1;
}

.mounting-tape {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    width: 40px;
    height: 1px;
    background: #9c8e82;
}

.mounting-tape--top { top: -8px; }
.mounting-tape--bottom { bottom: -8px; }

.specimen-text {
    max-width: 480px;
    opacity: 0;
    transition: opacity 0.8s ease-out 0.4s;
}

.specimen-text.revealed {
    opacity: 1;
}

.specimen-name {
    font-family: 'Playfair Display', Georgia, serif;
    font-weight: 700;
    font-size: clamp(1.5rem, 3vw, 2.5rem);
    color: #1a1714;
    letter-spacing: 0.02em;
    margin-bottom: 0.3rem;
}

.specimen-latin {
    font-family: 'Playfair Display', Georgia, serif;
    font-style: italic;
    font-weight: 400;
    font-size: clamp(1rem, 2vw, 1.3rem);
    color: #6b5e54;
    margin-bottom: 1rem;
}

.specimen-rule {
    width: 30%;
    height: 1px;
    background: #9c8e82;
    margin-bottom: 1.5rem;
}

.specimen-description {
    font-family: 'Cormorant Garamond', Georgia, serif;
    font-weight: 300;
    font-style: italic;
    font-size: clamp(1rem, 2vw, 1.3rem);
    line-height: 1.85;
    color: #3d3530;
    margin-bottom: 1.5rem;
}

.specimen-ornament {
    font-family: 'Cormorant Garamond', serif;
    font-size: 1.5rem;
    color: #9c8e82;
    text-align: center;
    margin: 2rem 0;
}

.specimen-attribution {
    font-family: 'IM Fell English', Georgia, serif;
    font-style: italic;
    font-size: clamp(0.75rem, 1.5vw, 0.95rem);
    color: #9c8e82;
    letter-spacing: 0.03em;
}

/* === SÉANCE PANEL === */
.seance-content {
    position: relative;
    overflow: hidden;
}

.seance-text {
    font-family: 'Cormorant Garamond', Georgia, serif;
    font-weight: 300;
    font-style: italic;
    font-size: clamp(1.2rem, 2.5vw, 1.8rem);
    color: #d4c8b8;
    line-height: 1.85;
    text-align: center;
    max-width: 600px;
    margin-bottom: 3rem;
    z-index: 2;
    position: relative;
}

.seance-text .char {
    opacity: 0;
    transition: opacity 0.4s ease-out;
}

.seance-text .char.visible {
    opacity: 1;
}

.seance-table {
    width: 250px;
    height: 250px;
    border: 1px solid #6b5e54;
    border-radius: 50%;
    position: relative;
    z-index: 2;
}

.candle {
    position: absolute;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #d4c8b8;
    top: 50%;
    left: 50%;
    transform: rotate(var(--angle)) translateY(-125px) rotate(calc(-1 * var(--angle)));
    animation: candleFlicker 3s ease-in-out infinite;
    animation-delay: var(--delay);
}

@keyframes candleFlicker {
    0%, 100% { box-shadow: 0 0 30px 15px #e8dfd455; }
    50% { box-shadow: 0 0 50px 25px #e8dfd433; }
}

.seance-curves {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
}

.flowing-curve {
    animation: curveBreathe 20s ease-in-out infinite;
}

.curve-2 { animation-delay: -7s; }
.curve-3 { animation-delay: -13s; }

@keyframes curveBreathe {
    0%, 100% { d: path("M0,300 C200,100 400,500 600,300 C800,100 1000,400 1000,300"); }
    50% { d: path("M0,300 C200,200 400,400 600,300 C800,200 1000,350 1000,300"); }
}

/* === GRIMOIRE PAGES PANEL === */
.grimoire-layout {
    flex-direction: row;
    gap: 0;
}

.grimoire-page {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px;
    height: calc(100vh - 80px);
}

.grimoire-page--left {
    background: #f0ebe4;
}

.grimoire-page--right {
    background: #d4c8b8;
    padding: 60px 50px;
    align-items: flex-start;
}

.grimoire-divider {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 1px;
    height: calc(100vh - 120px);
    position: relative;
}

.divider-line {
    flex: 1;
    width: 1px;
    background: #6b5e54;
}

.divider-diamond {
    font-size: 0.8rem;
    color: #6b5e54;
    padding: 8px 0;
    flex-shrink: 0;
}

.grimoire-line {
    font-family: 'IM Fell English', Georgia, serif;
    font-style: italic;
    font-size: clamp(0.85rem, 1.5vw, 1.05rem);
    color: #3d3530;
    line-height: 2.2;
    letter-spacing: 0.02em;
}

/* === EXIT PANEL === */
.exit-content {
    position: relative;
}

.exit-fog {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 300px;
    height: 400px;
    background: radial-gradient(ellipse at center, rgba(240, 235, 228, 0.6) 0%, rgba(212, 200, 184, 0) 70%);
    filter: blur(30px);
    z-index: 0;
}

.exit-text {
    font-family: 'Playfair Display', Georgia, serif;
    font-weight: 400;
    font-style: italic;
    font-size: clamp(2rem, 4vw, 3.5rem);
    color: #6b5e54;
    letter-spacing: 0.02em;
    margin-bottom: 2rem;
    z-index: 1;
    position: relative;
}

.exit-ornament {
    font-family: 'Cormorant Garamond', serif;
    font-size: 2rem;
    color: #9c8e82;
    margin-bottom: 1.5rem;
    z-index: 1;
    position: relative;
}

.exit-domain {
    font-family: 'IM Fell English', Georgia, serif;
    font-style: italic;
    font-size: clamp(0.75rem, 1.5vw, 0.95rem);
    color: #9c8e82;
    letter-spacing: 0.03em;
    z-index: 1;
    position: relative;
}

/* === SCROLL INDICATOR === */
.scroll-indicator {
    position: fixed;
    bottom: 12px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 12px;
    z-index: 100;
}

.scroll-dot {
    display: block;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #9c8e82;
    opacity: 0.4;
    transition: opacity 0.3s ease;
    cursor: pointer;
}

.scroll-dot.active {
    opacity: 1;
    background: #3d3530;
}

/* === ANIMATIONS === */
@keyframes fadeReveal {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* Panel reveal for non-entrance panels */
.panel--specimen .panel-content,
.panel--grimoire-pages .panel-content,
.panel--exit .panel-content {
    opacity: 0;
    transition: opacity 0.8s ease-out;
}

.panel--specimen.in-view .panel-content,
.panel--grimoire-pages.in-view .panel-content,
.panel--exit.in-view .panel-content {
    opacity: 1;
}

.panel--seance .seance-content {
    opacity: 0;
    transition: opacity 0.8s ease-out;
}

.panel--seance.in-view .seance-content {
    opacity: 1;
}
