/* ============================================
   saram.ai — Marble Observatory Design
   ============================================ */

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

html {
    scroll-behavior: smooth;
    overflow-x: hidden;
}

body {
    background: #0A0E1A;
    color: #C8D8E8;
    font-family: 'Source Serif 4', Georgia, serif;
    font-size: 1.125rem;
    line-height: 1.75;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

/* --- Typography --- */
.hero-title {
    font-family: 'Abril Fatface', serif;
    font-size: clamp(3.5rem, 9vw, 8rem);
    font-weight: 400;
    color: #C8D8E8;
    text-shadow:
        1px 1px 0 #2A354888,
        -1px -1px 0 #0A0E1A88,
        0 0 40px #4A8BC233;
    letter-spacing: 0.02em;
    position: relative;
    z-index: 3;
    text-align: center;
}

.section-heading {
    font-family: 'Cormorant Garamond', serif;
    font-weight: 600;
    font-size: clamp(1.5rem, 3vw, 2.5rem);
    letter-spacing: 0.04em;
    color: #8EAFC4;
    margin-bottom: 1.5rem;
}

.body-text {
    font-family: 'Source Serif 4', Georgia, serif;
    font-weight: 400;
    font-size: 1.125rem;
    line-height: 1.75;
    color: #A0B8CC;
    max-width: 52ch;
    margin-bottom: 1.5rem;
}

.dm-mono,
.accent-label {
    font-family: 'DM Mono', monospace;
    font-weight: 400;
    font-size: 0.75rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: #6B8BA4;
}

.display-text {
    font-family: 'Abril Fatface', serif;
    font-size: clamp(2rem, 5vw, 4rem);
    font-weight: 400;
    color: #C8D8E8;
    text-shadow: 0 0 40px #4A8BC233;
}

/* --- Marble Texture System --- */
.marble-texture {
    position: absolute;
    inset: 0;
    background:
        linear-gradient(135deg, #1A2233, #2A3548, #1A2233);
    z-index: 0;
}

.marble-texture::before {
    content: '';
    position: absolute;
    inset: 0;
    background:
        repeating-linear-gradient(17deg, transparent, transparent 120px, #4A8BC20A 120px, #4A8BC20A 121px),
        repeating-linear-gradient(143deg, transparent, transparent 80px, #4A8BC20D 80px, #4A8BC20D 81px),
        repeating-linear-gradient(89deg, transparent, transparent 200px, #3D4F6611 200px, #3D4F6611 201px);
    z-index: 1;
}

.marble-texture::after {
    content: '';
    position: absolute;
    inset: 0;
    background:
        repeating-linear-gradient(37deg, transparent, transparent 150px, #4A8BC208 150px, #4A8BC208 152px),
        repeating-linear-gradient(163deg, transparent, transparent 95px, #2E6B9E0A 95px, #2E6B9E0A 96px),
        repeating-linear-gradient(71deg, transparent, transparent 250px, #3D4F6609 250px, #3D4F6609 251px);
    filter: url(#marble-noise-light);
    z-index: 2;
}

/* --- Hero Section --- */
#hero {
    position: relative;
    height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.hero-glow {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 60vw;
    height: 60vh;
    background: radial-gradient(ellipse at 50% 50%, #2E6B9E22, transparent 70%);
    z-index: 1;
    animation: glow 20s ease-in-out infinite alternate;
    pointer-events: none;
}

@keyframes glow {
    0% { opacity: 0.3; transform: translate(-50%, -50%) scale(1); }
    100% { opacity: 0.7; transform: translate(-50%, -50%) scale(1.1); }
}

.hero-subtitle {
    position: relative;
    z-index: 3;
    margin-top: 2rem;
    opacity: 0;
    animation: fadeInUp 2s cubic-bezier(0.23, 1, 0.32, 1) 1.5s forwards;
}

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

/* Scroll indicator */
.scroll-indicator {
    position: absolute;
    bottom: 3rem;
    left: 50%;
    transform: translateX(-50%);
    z-index: 3;
    opacity: 0;
    animation: fadeInUp 2s cubic-bezier(0.23, 1, 0.32, 1) 2.5s forwards;
}

.scroll-line {
    width: 1px;
    height: 48px;
    background: linear-gradient(to bottom, #6B8BA4, transparent);
    animation: scrollPulse 3s ease-in-out infinite;
}

@keyframes scrollPulse {
    0%, 100% { opacity: 0.3; transform: scaleY(1); }
    50% { opacity: 0.8; transform: scaleY(1.2); }
}

/* Hero fossils */
.fossil {
    position: absolute;
    opacity: 0.4;
    z-index: 2;
    pointer-events: none;
}

.fossil-fern {
    width: 120px;
    height: 180px;
    right: 8vw;
    top: 15vh;
}

.fossil-ammonite {
    width: 100px;
    height: 100px;
    left: 6vw;
    bottom: 20vh;
}

/* --- Revelation Zone --- */
#revelation-zone {
    position: relative;
}

.revelation-panel {
    position: relative;
    height: 100vh;
    overflow: hidden;
}

/* Sealed panel state */
.panel-sealed {
    position: absolute;
    inset: 0;
    z-index: 2;
    overflow: hidden;
    transition: clip-path 1.2s cubic-bezier(0.23, 1, 0.32, 1);
    clip-path: inset(0 0 0 0);
}

.panel-sealed.revealed {
    clip-path: inset(0 0 100% 0);
}

.panel-seam {
    position: absolute;
    left: 12vw;
    right: 12vw;
    top: 50%;
    height: 2px;
    background: linear-gradient(90deg, transparent, #4A8BC244, #4A8BC266, #4A8BC244, transparent);
    transform: translateY(-50%);
    z-index: 5;
    opacity: 0;
    transition: opacity 0.8s cubic-bezier(0.23, 1, 0.32, 1);
}

.panel-sealed.revealing .panel-seam {
    opacity: 1;
    box-shadow: 0 0 20px #4A8BC244, 0 0 40px #2E6B9E22;
}

/* Brass clasp */
.brass-clasp {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 6;
    transition: opacity 0.6s cubic-bezier(0.23, 1, 0.32, 1);
}

.panel-sealed.revealed .brass-clasp {
    opacity: 0;
}

.clasp-circle {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    border: 2px solid #B8926A;
    box-shadow:
        0 0 0 1px #8C6D4F,
        inset 0 2px 4px #0A0E1A44,
        0 2px 8px #0A0E1A66;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(145deg, #B8926A, #8C6D4F);
    transition: transform 0.8s cubic-bezier(0.23, 1, 0.32, 1);
}

.panel-sealed.revealing .clasp-circle {
    transform: rotate(90deg);
}

.clasp-bar {
    width: 20px;
    height: 3px;
    background: #1A2233;
    border-radius: 1px;
    box-shadow: inset 0 1px 0 #2A354888;
}

/* Panel fossil overlays */
.panel-fossil {
    position: absolute;
    width: 80px;
    height: 120px;
    opacity: 0;
    z-index: 3;
    transition: opacity 1s cubic-bezier(0.23, 1, 0.32, 1) 0.4s;
}

.panel-sealed.revealing .panel-fossil {
    opacity: 0.5;
}

.revelation-panel[data-panel="1"] .panel-fossil {
    right: 15vw;
    top: 20%;
}

.revelation-panel[data-panel="2"] .panel-fossil {
    left: 10vw;
    bottom: 25%;
}

.revelation-panel[data-panel="3"] .panel-fossil {
    right: 12vw;
    bottom: 15%;
}

/* Panel fossil SVG stroke animation */
.panel-fossil path {
    stroke-dasharray: 600;
    stroke-dashoffset: 600;
    transition: stroke-dashoffset 2s cubic-bezier(0.23, 1, 0.32, 1) 0.4s;
}

.panel-sealed.revealing .panel-fossil path {
    stroke-dashoffset: 0;
}

/* Verdigris patina on hover */
.brass-clasp:hover .clasp-circle {
    box-shadow:
        0 0 0 1px #8C6D4F,
        inset 0 2px 4px #0A0E1A44,
        0 2px 8px #0A0E1A66,
        0 0 15px #2E6B5E33;
}

/* Panel content */
.panel-content {
    position: absolute;
    inset: 0;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    background:
        radial-gradient(ellipse at 50% 50%, #2E6B9E15, transparent 70%),
        linear-gradient(135deg, #1A2233, #2A3548, #1A2233);
}

.panel-inner {
    position: relative;
    max-width: 52ch;
    padding: 0 12vw;
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.6s cubic-bezier(0.23, 1, 0.32, 1) 0.6s,
                transform 0.6s cubic-bezier(0.23, 1, 0.32, 1) 0.6s;
}

.revelation-panel.is-revealed .panel-inner {
    opacity: 1;
    transform: translateY(0);
}

.panel-glow {
    position: absolute;
    top: -50%;
    left: -30%;
    width: 160%;
    height: 200%;
    background: radial-gradient(ellipse at 50% 50%, #2E6B9E11, transparent 60%);
    pointer-events: none;
    z-index: -1;
}

/* --- Deep Chamber --- */
#deep-chamber {
    position: relative;
    min-height: 300vh;
    overflow: hidden;
}

.chamber-gradient {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 200vh;
    background: linear-gradient(to bottom, #1A2233, #0A0E1A);
    z-index: 0;
}

.chamber-content {
    position: relative;
    z-index: 2;
    padding-top: 30vh;
}

.floating-text {
    position: sticky;
    text-align: center;
    padding: 8vh 12vw;
    opacity: 0;
    transition: opacity 1.2s cubic-bezier(0.23, 1, 0.32, 1);
    will-change: transform;
}

.floating-text.visible {
    opacity: 1;
}

.chamber-floor {
    position: relative;
    z-index: 2;
    text-align: center;
    padding: 20vh 12vw 10vh;
    opacity: 0.5;
}

/* --- Particle System --- */
.particle-field {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
    opacity: 0;
    transition: opacity 1s ease;
}

.particle-field.active {
    opacity: 1;
}

.particle {
    position: absolute;
    border-radius: 50%;
    background: #4A8BC244;
    animation: drift var(--drift-duration) linear infinite;
    animation-delay: var(--drift-delay);
}

@keyframes drift {
    0% {
        transform: translate(0, 0) scale(1);
        opacity: 0;
    }
    10% {
        opacity: 0.6;
    }
    50% {
        opacity: 0.3;
    }
    90% {
        opacity: 0.5;
    }
    100% {
        transform: translate(var(--drift-x), var(--drift-y)) scale(0.5);
        opacity: 0;
    }
}

/* --- Responsive --- */
@media (max-width: 768px) {
    .hero-title {
        font-size: clamp(2.5rem, 12vw, 5rem);
    }

    .panel-inner {
        padding: 0 6vw;
    }

    .floating-text {
        padding: 6vh 6vw;
    }

    .fossil-fern,
    .fossil-ammonite {
        display: none;
    }

    .brass-clasp .clasp-circle {
        width: 36px;
        height: 36px;
    }

    .clasp-bar {
        width: 14px;
        height: 2px;
    }
}

@media (max-width: 480px) {
    .body-text {
        font-size: 1rem;
        line-height: 1.65;
    }

    .section-heading {
        font-size: clamp(1.25rem, 5vw, 1.75rem);
    }

    .panel-inner {
        padding: 0 5vw;
    }
}
