/* ============================================================
   aei.st - Cabinet of Curiosities
   Goblincore aesthetic / Z-pattern layout / Marble texture
   ============================================================ */

/* ----- CSS Custom Properties ----- */
:root {
    --deep-bg: #0F0D0A;
    --panel-surface: #E8DFD0;
    --marble-vein: #B8ADA0;
    --brass: #A89060;
    --moss: #5E6B4A;
    --text-primary: #E8DFD0;
    --text-secondary: #C4B8A8;
    --text-tertiary: #7A6E5E;
    --brass-hover: #C8A860;
    --brass-mid: #8B9A6A;
    --oxidized: #6B8070;
    --dark-wood: #2A1F14;
    --vein-light: #D0C8B8;
    --dark-marble: #1A1710;
    --exit-bg: #14110D;
    --frame-border: #8B7D6B;

    --highlight-x: 50%;
    --highlight-y: 50%;
}

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

html {
    scroll-behavior: smooth;
}

body {
    background-color: var(--deep-bg);
    color: var(--text-primary);
    font-family: 'Lora', serif;
    font-weight: 400;
    font-size: clamp(15px, 1.2vw, 18px);
    line-height: 1.72;
    overflow-x: hidden;
}

/* ----- SVG Filters (hidden) ----- */
.svg-filters {
    position: absolute;
    width: 0;
    height: 0;
    overflow: hidden;
}

/* ----- Haeckel Background ----- */
.haeckel-bg {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
    opacity: 0;
    transition: opacity 3s ease;
}

.haeckel-bg.visible {
    opacity: 1;
}

.haeckel-radiolarian {
    position: absolute;
    opacity: 0.03;
}

.haeckel-1 {
    width: 280px;
    height: 280px;
    top: 5%;
    right: 8%;
}

.haeckel-2 {
    width: 220px;
    height: 220px;
    top: 25%;
    left: 5%;
}

.haeckel-3 {
    width: 180px;
    height: 180px;
    top: 45%;
    right: 15%;
}

.haeckel-4 {
    width: 200px;
    height: 200px;
    top: 60%;
    left: 10%;
}

.haeckel-5 {
    width: 160px;
    height: 160px;
    top: 75%;
    right: 5%;
}

.haeckel-6 {
    width: 240px;
    height: 240px;
    top: 85%;
    left: 20%;
}

/* Intensified Haeckel for Archive section */
.haeckel-bg.archive-intensity .haeckel-radiolarian {
    opacity: 0.06;
}

/* ----- Fixed Header ----- */
.site-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
    height: 40px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 40px;
    border-bottom: 1px solid var(--brass);
    background: rgba(15, 13, 10, 0.85);
    backdrop-filter: blur(4px);
}

.header-domain {
    font-family: 'Cormorant Garamond', serif;
    font-weight: 600;
    font-size: 16px;
    color: var(--text-primary);
    letter-spacing: 0.06em;
    font-variant: small-caps;
}

.header-explore {
    font-family: 'EB Garamond', serif;
    font-weight: 400;
    font-size: 13px;
    color: var(--text-tertiary);
    letter-spacing: 0.12em;
    font-variant: small-caps;
    cursor: default;
}

/* ----- Typography ----- */
.section-heading {
    font-family: 'Cormorant Garamond', serif;
    font-weight: 600;
    font-size: clamp(36px, 5vw, 68px);
    color: var(--text-primary);
    letter-spacing: -0.01em;
    line-height: 1.12;
    margin-bottom: 28px;
}

.specimen-label {
    font-family: 'Playfair Display', serif;
    font-weight: 500;
    font-style: italic;
    font-size: clamp(20px, 2.5vw, 32px);
    color: var(--brass);
    letter-spacing: 0.04em;
    margin-bottom: 16px;
}

.body-text {
    font-family: 'Lora', serif;
    font-weight: 400;
    font-size: clamp(15px, 1.2vw, 18px);
    color: var(--text-secondary);
    line-height: 1.72;
    margin-bottom: 18px;
}

.body-text:last-child {
    margin-bottom: 0;
}

.taxonomy-label {
    font-family: 'EB Garamond', serif;
    font-weight: 400;
    font-size: clamp(11px, 0.9vw, 13px);
    color: var(--text-tertiary);
    letter-spacing: 0.12em;
    font-variant: small-caps;
    display: block;
    margin-bottom: 12px;
}

/* ----- Marble Slab ----- */
.marble-slab {
    position: relative;
    background-color: var(--panel-surface);
    border-radius: 6px;
    border: 2px solid var(--frame-border);
    box-shadow:
        inset 0 0 0 1px var(--vein-light),
        0 8px 24px rgba(20, 15, 10, 0.25),
        0 3px 8px rgba(10, 8, 5, 0.4);
    overflow: hidden;
}

/* Marble veining via layered gradients */
.marble-slab::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background:
        radial-gradient(ellipse at 20% 30%, rgba(184, 173, 160, 0.12) 0%, transparent 60%),
        radial-gradient(ellipse at 80% 70%, rgba(208, 200, 184, 0.10) 0%, transparent 50%),
        linear-gradient(30deg, transparent 40%, rgba(184, 173, 160, 0.08) 45%, transparent 50%),
        linear-gradient(140deg, transparent 30%, rgba(208, 200, 184, 0.06) 35%, transparent 40%),
        linear-gradient(85deg, transparent 50%, rgba(184, 173, 160, 0.05) 52%, transparent 55%);
    pointer-events: none;
    z-index: 1;
}

/* Marble shimmer highlight that follows cursor */
.marble-slab::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: radial-gradient(
        circle 200px at var(--highlight-x) var(--highlight-y),
        rgba(255, 255, 255, 0.03) 0%,
        transparent 100%
    );
    pointer-events: none;
    z-index: 2;
}

/* Unique veining variations per section */
.entrance-slab::before {
    background:
        radial-gradient(ellipse at 50% 50%, rgba(184, 173, 160, 0.15) 0%, transparent 70%),
        linear-gradient(45deg, transparent 35%, rgba(184, 173, 160, 0.10) 40%, transparent 45%),
        linear-gradient(160deg, transparent 45%, rgba(208, 200, 184, 0.08) 50%, transparent 55%);
}

.feature-slab::before {
    background:
        radial-gradient(ellipse at 30% 20%, rgba(208, 200, 184, 0.10) 0%, transparent 50%),
        radial-gradient(ellipse at 70% 80%, rgba(184, 173, 160, 0.08) 0%, transparent 60%),
        linear-gradient(120deg, transparent 25%, rgba(184, 173, 160, 0.12) 30%, transparent 35%),
        linear-gradient(60deg, transparent 55%, rgba(208, 200, 184, 0.06) 60%, transparent 65%);
}

.card-slab:nth-child(1)::before {
    background:
        radial-gradient(ellipse at 60% 40%, rgba(184, 173, 160, 0.14) 0%, transparent 55%),
        linear-gradient(75deg, transparent 30%, rgba(208, 200, 184, 0.09) 35%, transparent 40%);
}

.archive-slab::before {
    background:
        radial-gradient(ellipse at 15% 25%, rgba(184, 173, 160, 0.10) 0%, transparent 45%),
        radial-gradient(ellipse at 85% 75%, rgba(208, 200, 184, 0.12) 0%, transparent 50%),
        linear-gradient(35deg, transparent 20%, rgba(184, 173, 160, 0.08) 25%, transparent 30%),
        linear-gradient(155deg, transparent 60%, rgba(208, 200, 184, 0.07) 65%, transparent 70%),
        linear-gradient(95deg, transparent 40%, rgba(184, 173, 160, 0.05) 42%, transparent 46%);
}

.exit-slab {
    background-color: var(--dark-marble);
    border-color: #3A3228;
}

.exit-slab::before {
    background:
        radial-gradient(ellipse at 40% 60%, rgba(90, 80, 65, 0.12) 0%, transparent 60%),
        linear-gradient(110deg, transparent 40%, rgba(60, 52, 40, 0.10) 45%, transparent 50%);
}

/* Aged paper overlay for archive section */
.archive-slab .archive-content {
    position: relative;
}

/* ----- Rooms ----- */
.room {
    position: relative;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1;
    padding: 60px 40px;
}

/* ----- Room 1: Entrance Hall ----- */
.room-entrance {
    flex-direction: column;
    gap: 40px;
}

.entrance-slab {
    padding: 60px 80px;
    text-align: center;
    opacity: 0;
    animation: slabFadeIn 1.5s ease forwards;
}

@keyframes slabFadeIn {
    from {
        opacity: 0;
        transform: scale(0.98);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.entrance-title {
    font-family: 'Cormorant Garamond', serif;
    font-weight: 600;
    font-size: clamp(48px, 8vw, 72px);
    color: var(--text-primary);
    letter-spacing: -0.01em;
    line-height: 1.12;
    text-shadow: 1px 1px 0 #B8ADA0, -1px -1px 0 #0F0D0A;
    margin-bottom: 16px;
}

.entrance-tagline {
    font-family: 'Playfair Display', serif;
    font-weight: 500;
    font-style: italic;
    font-size: clamp(18px, 2.5vw, 28px);
    color: var(--brass);
    letter-spacing: 0.04em;
}

.scroll-arrow {
    animation: pulseDown 2s ease-in-out infinite;
    opacity: 0;
    animation-delay: 2s;
    animation-fill-mode: forwards;
}

@keyframes pulseDown {
    0%, 100% {
        transform: translateY(0);
        opacity: 0.7;
    }
    50% {
        transform: translateY(8px);
        opacity: 1;
    }
}

/* ----- Specimen Drawer Dividers ----- */
.specimen-drawer {
    height: 80px;
    background-color: var(--dark-wood);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    z-index: 1;
}

.drawer-line {
    width: 60%;
    height: 1px;
    background: var(--brass);
    opacity: 0.6;
}

/* ----- Z-Pattern Grid ----- */
.z-grid {
    width: 100%;
    max-width: 1280px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    column-gap: 32px;
    align-items: start;
}

.z-grid.z-left .z-content-primary {
    grid-column: 2 / 6;
    grid-row: 1;
}

.z-grid.z-left .z-diagonal-rule {
    grid-column: 5 / 9;
    grid-row: 1;
    align-self: center;
    height: 1px;
    background: var(--brass);
    opacity: 0.3;
    transform: rotate(30deg);
    transform-origin: left center;
}

.z-grid.z-left .z-content-secondary {
    grid-column: 8 / 12;
    grid-row: 1;
    align-self: end;
}

/* Z-right (Room 3 header) */
.z-grid.z-right {
    grid-template-rows: auto auto;
}

.z-grid.z-right .gallery-header {
    grid-column: 8 / 12;
    grid-row: 1;
    text-align: right;
    margin-bottom: 48px;
}

.z-grid.z-right .specimen-cards {
    grid-column: 2 / 12;
    grid-row: 2;
    display: flex;
    gap: 32px;
    justify-content: center;
    flex-wrap: wrap;
}

/* ----- Marble Slab Content Padding ----- */
.z-content-primary .marble-slab,
.z-content-secondary .marble-slab {
    padding: 40px;
}

/* ----- Specimen Frame (Room 2 right panel) ----- */
.specimen-frame {
    position: relative;
    padding: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.specimen-illustration {
    width: 100%;
    max-width: 260px;
    height: auto;
}

/* ----- Specimen Tag ----- */
.specimen-tag {
    position: relative;
    background: var(--panel-surface);
    padding: 10px 16px;
    margin-top: 20px;
    transform: rotate(1.5deg);
    box-shadow: 0 2px 6px rgba(20, 15, 10, 0.15);
    text-align: center;
}

.tag-pin {
    position: absolute;
    top: -6px;
    left: 50%;
    transform: translateX(-50%);
    width: 10px;
    height: 10px;
    border-radius: 50%;
    border: 1.5px solid var(--brass);
    background: var(--panel-surface);
}

.tag-string {
    position: absolute;
    top: -30px;
    left: 50%;
    width: 1px;
    height: 26px;
    background: var(--brass);
    opacity: 0.5;
}

.tag-text {
    font-family: 'Playfair Display', serif;
    font-weight: 500;
    font-style: italic;
    font-size: 14px;
    color: var(--dark-wood);
    display: block;
}

.tag-meta {
    font-family: 'EB Garamond', serif;
    font-weight: 400;
    font-size: 11px;
    color: var(--text-tertiary);
    letter-spacing: 0.12em;
    font-variant: small-caps;
    display: block;
    margin-top: 4px;
}

/* ----- Specimen Cards (Room 3) ----- */
.specimen-card {
    flex: 1 1 280px;
    max-width: 360px;
    transition: transform 350ms cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.specimen-card:hover {
    transform: scale(1.03);
}

.specimen-card:hover .card-slab {
    border-color: var(--brass-hover);
    transition: border-color 200ms ease;
}

.card-1 {
    transform: rotate(-1deg);
}

.card-2 {
    transform: rotate(0deg);
}

.card-3 {
    transform: rotate(1.5deg);
}

.card-1:hover {
    transform: rotate(-1deg) scale(1.03);
}

.card-2:hover {
    transform: rotate(0deg) scale(1.03);
}

.card-3:hover {
    transform: rotate(1.5deg) scale(1.03);
}

.card-slab {
    padding: 32px;
    transition: border-color 200ms ease;
}

.card-icon {
    margin-bottom: 16px;
}

/* ----- Room 4: Archive ----- */
.room-archive {
    padding: 80px 40px;
}

.archive-container {
    width: 100%;
    max-width: 1280px;
    margin: 0 auto;
}

.archive-slab {
    padding: 60px 80px;
    /* Column span 2-11 equivalent */
}

.archive-text {
    font-size: 18px;
    line-height: 1.72;
}

.brass-rule {
    border: none;
    height: 1px;
    background: var(--brass);
    opacity: 0.3;
    margin: 32px 0;
}

/* ----- Room 5: Exit ----- */
.room-exit {
    background-color: var(--exit-bg);
    flex-direction: column;
}

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

.exit-slab {
    padding: 60px;
    text-align: center;
}

.exit-heading {
    font-family: 'Cormorant Garamond', serif;
    font-weight: 600;
    font-size: clamp(28px, 4vw, 48px);
    color: var(--text-primary);
    letter-spacing: -0.01em;
    line-height: 1.12;
    margin-bottom: 20px;
}

.exit-text {
    font-family: 'Lora', serif;
    font-weight: 400;
    font-size: clamp(15px, 1.2vw, 18px);
    color: var(--text-secondary);
    line-height: 1.72;
    margin-bottom: 36px;
}

/* ----- Drawer Pull Button ----- */
.drawer-pull {
    display: inline-block;
    padding: 12px 40px;
    background: var(--brass);
    color: var(--deep-bg);
    text-decoration: none;
    font-family: 'EB Garamond', serif;
    font-weight: 400;
    font-size: 14px;
    letter-spacing: 0.12em;
    font-variant: small-caps;
    border-radius: 20px;
    box-shadow:
        inset 0 1px 2px rgba(255, 255, 255, 0.15),
        0 2px 6px rgba(10, 8, 5, 0.3);
    transition: background-color 200ms ease, color 200ms ease;
    position: relative;
    z-index: 3;
}

.drawer-pull:hover {
    background: var(--brass-hover);
}

/* ----- Scroll Reveal Animations ----- */
.reveal-element {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 400ms ease-out, transform 400ms ease-out;
}

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

/* Rotation preserved for cards */
.card-1.reveal-element.revealed {
    transform: translateY(0) rotate(-1deg);
}

.card-2.reveal-element.revealed {
    transform: translateY(0) rotate(0deg);
}

.card-3.reveal-element.revealed {
    transform: translateY(0) rotate(1.5deg);
}

/* ----- Responsive ----- */
@media (max-width: 768px) {
    .site-header {
        padding: 0 20px;
    }

    .room {
        padding: 40px 20px;
    }

    .z-grid {
        display: flex;
        flex-direction: column;
        gap: 32px;
    }

    .z-grid.z-left .z-diagonal-rule {
        display: none;
    }

    .z-grid.z-right .gallery-header {
        text-align: left;
    }

    .z-grid.z-right .specimen-cards {
        flex-direction: column;
        align-items: stretch;
    }

    .specimen-card {
        max-width: none;
    }

    .card-1, .card-2, .card-3 {
        transform: rotate(0deg);
    }

    .card-1:hover, .card-2:hover, .card-3:hover {
        transform: rotate(0deg) scale(1.03);
    }

    .card-1.reveal-element.revealed,
    .card-2.reveal-element.revealed,
    .card-3.reveal-element.revealed {
        transform: translateY(0) rotate(0deg);
    }

    .entrance-slab {
        padding: 40px 32px;
    }

    .archive-slab {
        padding: 40px 32px;
    }

    .exit-slab {
        padding: 40px 32px;
    }

    .specimen-tag {
        transform: rotate(0deg);
    }

    .drawer-pull {
        display: block;
        text-align: center;
        border-radius: 4px;
    }

    .specimen-drawer {
        height: 60px;
    }

    .drawer-line {
        width: 80%;
    }
}

@media (max-width: 480px) {
    .entrance-title {
        font-size: 42px;
    }

    .section-heading {
        font-size: 32px;
    }

    .z-content-primary .marble-slab,
    .z-content-secondary .marble-slab {
        padding: 24px;
    }

    .card-slab {
        padding: 24px;
    }
}
