/* memorial.wiki - The Geode of Remembrance */
/* Fonts: Fraunces (display), Source Serif 4 (body), Nunito Sans (labels) */
/* Palette: Earth-tones with Neon Crystalline Accents */

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

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

body {
    background-color: #1C1410;
    color: #F2E6D9;
    font-family: 'Source Serif 4', Georgia, serif;
    font-size: 18px;
    line-height: 1.9;
    overflow-x: hidden;
    position: relative;
}

/* Geological Grain Texture Overlay */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1000;
    opacity: 0.04;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 400 400' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='g'%3E%3CfeTurbulence baseFrequency='0.65' numOctaves='4' type='fractalNoise' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23g)'/%3E%3C/svg%3E");
    background-repeat: repeat;
    background-size: 400px 400px;
}

/* Crystalline Mesh Background */
#crystalline-mesh {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 0;
    pointer-events: none;
    will-change: transform;
}

.mesh-group {
    animation: mesh-rotate 120s linear infinite;
    transform-origin: 500px 500px;
}

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

/* Grain SVG texture (hidden, used as reference) */
#grain-texture {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: -1;
    opacity: 0;
}

/* ======================== */
/* STRATUM SECTIONS         */
/* ======================== */

.stratum {
    position: relative;
    z-index: 1;
    overflow: hidden;
}

.stratum-content {
    position: relative;
    z-index: 2;
}

/* SECTION 1: The Surface */
#the-surface {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #1C1410;
    clip-path: polygon(0 0, 100% 0, 100% calc(100% - 3.5vw), 0 100%);
    z-index: 1;
}

.surface-content {
    text-align: center;
    padding: 2rem;
    padding-left: calc(2rem - 5vw);
}

.site-title {
    font-family: 'Fraunces', Georgia, serif;
    font-weight: 600;
    font-size: clamp(56px, 12vw, 160px);
    letter-spacing: -0.03em;
    color: #F2E6D9;
    opacity: 0;
    animation: fadeIn 1.5s ease-out 0.3s forwards;
    font-variation-settings: 'WONK' 1;
}

.surface-tagline {
    font-family: 'Nunito Sans', sans-serif;
    font-weight: 600;
    font-size: 13px;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: #9B8B7A;
    margin-top: 1.5rem;
    opacity: 0;
    animation: fadeIn 1s ease-out 2.5s forwards;
}

.surface-vein {
    width: 280px;
    max-width: 60vw;
    height: 2px;
    margin: 1.5rem auto;
    background: linear-gradient(90deg, transparent 0%, #00E5A0 20%, #00E5A0 80%, transparent 100%);
    transform: scaleX(0) rotate(7deg);
    transform-origin: left center;
    animation: veinDraw 1.2s ease-out 1s forwards, pulse-glow 4s ease-in-out 2.2s infinite;
    box-shadow: 0 0 15px rgba(0,229,160,0.3);
}

/* SECTION 2: The First Stratum */
#first-stratum {
    background-color: #3D2E1F;
    padding: 14vw 2rem 10vw;
    margin-top: -12.3vw;
    clip-path: polygon(0 12.3vw, 100% 0, 100% calc(100% - 5vw), 0 100%);
    z-index: 2;
}

.first-stratum-content {
    max-width: 640px;
    margin: 0 auto;
}

.crystal-motif-right {
    position: absolute;
    right: 5%;
    top: 30%;
    width: 300px;
    height: 400px;
    opacity: 0.08;
    clip-path: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%);
    background: linear-gradient(135deg, #E8A435, #00E5A0);
    animation: crystal-spin 120s linear infinite;
    will-change: transform;
}

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

.section-label {
    font-family: 'Nunito Sans', sans-serif;
    font-weight: 600;
    font-size: 11px;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: #9B8B7A;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.facet-diamond {
    display: inline-block;
    width: 8px;
    height: 8px;
    background: #E8A435;
    transform: rotate(45deg);
    box-shadow: 0 0 8px rgba(232,164,53,0.4);
    animation: pulse-diamond 4s ease-in-out infinite;
}

.facet-diamond.small {
    width: 6px;
    height: 6px;
}

@keyframes pulse-diamond {
    0%, 100% { box-shadow: 0 0 6px rgba(232,164,53,0.3); }
    50% { box-shadow: 0 0 14px rgba(232,164,53,0.7); }
}

.section-heading {
    font-family: 'Fraunces', Georgia, serif;
    font-weight: 600;
    font-size: clamp(36px, 5vw, 56px);
    letter-spacing: -0.03em;
    color: #F2E6D9;
    margin-bottom: 2rem;
    font-variation-settings: 'WONK' 1;
}

.body-text {
    font-family: 'Source Serif 4', Georgia, serif;
    font-size: 18px;
    font-weight: 400;
    line-height: 1.9;
    color: #C4A882;
    margin-bottom: 1.5rem;
}

/* SECTION 3: The Specimen Hall */
#specimen-hall {
    background-color: #1C1410;
    padding: 14vw 2rem 10vw;
    margin-top: -12.3vw;
    clip-path: polygon(0 0, 100% 7vw, 100% calc(100% - 3vw), 0 100%);
    z-index: 3;
}

.specimen-hall-content {
    max-width: 900px;
    margin: 0 auto;
}

.specimen-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    margin-top: 2.5rem;
}

.specimen-card {
    position: relative;
    border: 1px solid transparent;
    border-image: linear-gradient(135deg, #E8A435 0%, transparent 40%, transparent 60%, #00E5A0 100%) 1;
    background: #3D2E1F;
    transition: transform 300ms ease, box-shadow 400ms ease;
    animation: pulse-glow 4s ease-in-out infinite;
    will-change: box-shadow, opacity;
}

.specimen-card:nth-child(odd) {
    transform: translateX(24px);
}

.specimen-card:nth-child(even) {
    transform: translateX(-24px);
}

.specimen-card:nth-child(1) { animation-delay: 0s; }
.specimen-card:nth-child(2) { animation-delay: 0.5s; }
.specimen-card:nth-child(3) { animation-delay: 1s; }
.specimen-card:nth-child(4) { animation-delay: 1.5s; }

.specimen-card:hover {
    transform: scale(1.02) rotate(-0.5deg);
    box-shadow: 0 0 40px rgba(0,229,160,0.2);
    border-image: linear-gradient(180deg, #E8A435 0%, transparent 40%, transparent 60%, #00E5A0 100%) 1;
}

.specimen-card:hover .facet-diamond {
    background: #00E5A0;
}

.specimen-card-inner {
    padding: 2rem;
    box-shadow: inset 0 0 30px rgba(0,229,160,0.06);
    transition: box-shadow 400ms ease;
}

.specimen-card:hover .specimen-card-inner {
    box-shadow: inset 0 0 40px rgba(0,229,160,0.12);
}

.specimen-label-text {
    font-family: 'Nunito Sans', sans-serif;
    font-weight: 600;
    font-size: 11px;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: #9B8B7A;
    margin-bottom: 0.75rem;
}

.specimen-title {
    font-family: 'Fraunces', Georgia, serif;
    font-weight: 600;
    font-size: 22px;
    letter-spacing: -0.02em;
    color: #F2E6D9;
    margin-bottom: 0.75rem;
    font-variation-settings: 'WONK' 1;
}

.specimen-description {
    font-family: 'Source Serif 4', Georgia, serif;
    font-size: 15px;
    line-height: 1.8;
    color: #C4A882;
    margin-bottom: 1rem;
}

.specimen-meta {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-family: 'Nunito Sans', sans-serif;
    font-weight: 600;
    font-size: 11px;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: #9B8B7A;
}

/* SECTION 4: The Deep Vein */
#deep-vein {
    background-color: #1C1410;
    padding: 10vw 2rem;
    margin-top: -8vw;
    clip-path: polygon(0 5vw, 100% 0, 100% calc(100% - 5vw), 0 100%);
    z-index: 4;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 40vh;
}

.deep-vein-content {
    text-align: center;
    max-width: 800px;
    margin: 0 auto;
}

.deep-vein-quote {
    font-family: 'Source Serif 4', Georgia, serif;
    font-style: italic;
    font-size: clamp(20px, 3vw, 28px);
    line-height: 1.7;
    color: #C4A882;
    opacity: 0.9;
}

.deep-vein-line {
    width: 200px;
    height: 2px;
    margin: 2rem auto 0;
    background: linear-gradient(90deg, transparent 0%, #00E5A0 20%, #00E5A0 80%, transparent 100%);
    animation: pulse-glow 4s ease-in-out infinite;
    transform: rotate(-5deg);
}

/* SECTION 5: The Bedrock (Footer) */
#the-bedrock {
    background-color: #0E0A07;
    padding: 12vw 2rem 6rem;
    margin-top: -8vw;
    clip-path: polygon(0 8vw, 100% 0, 100% 100%, 0 100%);
    z-index: 5;
}

.bedrock-content {
    text-align: center;
}

.bedrock-crystal-icon {
    margin-bottom: 1.5rem;
    opacity: 0.7;
    animation: pulse-glow-icon 4s ease-in-out infinite;
}

@keyframes pulse-glow-icon {
    0%, 100% { opacity: 0.6; filter: drop-shadow(0 0 4px rgba(0,229,160,0.1)); }
    50% { opacity: 0.9; filter: drop-shadow(0 0 12px rgba(0,229,160,0.3)); }
}

.bedrock-domain {
    font-family: 'Fraunces', Georgia, serif;
    font-weight: 600;
    font-size: 24px;
    letter-spacing: -0.02em;
    color: #F2E6D9;
    margin-bottom: 0.5rem;
    font-variation-settings: 'WONK' 1;
}

.bedrock-tagline {
    font-family: 'Nunito Sans', sans-serif;
    font-weight: 600;
    font-size: 11px;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: #9B8B7A;
    margin-bottom: 2rem;
}

.bedrock-vein {
    width: 120px;
    height: 1px;
    margin: 0 auto;
    background: linear-gradient(90deg, transparent 0%, #00E5A0 20%, #00E5A0 80%, transparent 100%);
    animation: pulse-glow 4s ease-in-out infinite;
    transform: rotate(3deg);
}

/* Rose Quartz accent for visited state */
.specimen-card:visited .specimen-title,
.specimen-meta .facet-diamond.small {
    color: #E87D8A;
}

.deep-vein-quote::first-letter {
    color: #E87D8A;
}

/* ======================== */
/* NEON VEIN SEPARATORS     */
/* ======================== */

.neon-vein-separator {
    position: relative;
    z-index: 10;
    height: 2px;
    margin: -1vw 5vw;
    background: linear-gradient(90deg, transparent 0%, #00E5A0 20%, #00E5A0 80%, transparent 100%);
    opacity: 0.3;
    animation: pulse-glow 4s ease-in-out infinite;
    will-change: box-shadow, opacity;
}

.vein-1 {
    transform: rotate(7deg);
    animation-delay: 0s;
    margin-left: 10vw;
    margin-right: 15vw;
}

.vein-2 {
    transform: rotate(-3deg);
    animation-delay: 0.8s;
    margin-left: 20vw;
    margin-right: 10vw;
}

.vein-3 {
    transform: rotate(5deg);
    animation-delay: 1.6s;
    margin-left: 8vw;
    margin-right: 25vw;
    margin-top: 0.5vw;
}

.vein-4 {
    transform: rotate(-7deg);
    animation-delay: 2.4s;
    margin-left: 15vw;
    margin-right: 12vw;
}

.vein-5 {
    transform: rotate(4deg);
    animation-delay: 3.2s;
    margin-left: 12vw;
    margin-right: 18vw;
}

/* ======================== */
/* ANIMATIONS               */
/* ======================== */

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes veinDraw {
    from { transform: scaleX(0) rotate(7deg); }
    to { transform: scaleX(1) rotate(7deg); }
}

@keyframes pulse-glow {
    0%, 100% {
        box-shadow: 0 0 15px rgba(0,229,160,0.08);
        opacity: 0.85;
    }
    50% {
        box-shadow: 0 0 35px rgba(0,229,160,0.25);
        opacity: 1;
    }
}

/* Scroll-triggered reveals */
.stratum-reveal {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 800ms ease-out, transform 800ms ease-out;
}

.stratum-reveal.visible {
    opacity: 1;
    transform: translateY(0);
}

/* ======================== */
/* RESPONSIVE               */
/* ======================== */

@media (max-width: 768px) {
    .specimen-grid {
        grid-template-columns: 1fr;
    }

    .specimen-card:nth-child(odd),
    .specimen-card:nth-child(even) {
        transform: translateX(0);
    }

    .specimen-card:hover {
        transform: scale(1.01) rotate(-0.3deg);
    }

    .crystal-motif-right {
        width: 150px;
        height: 200px;
        right: -5%;
        top: 15%;
    }

    #first-stratum {
        padding: 18vw 1.5rem 12vw;
    }

    #specimen-hall {
        padding: 18vw 1.5rem 12vw;
    }

    .surface-content {
        padding-left: 2rem;
    }

    .neon-vein-separator {
        margin-left: 3vw;
        margin-right: 3vw;
    }

    .vein-1, .vein-2, .vein-3, .vein-4, .vein-5 {
        margin-left: 5vw;
        margin-right: 5vw;
    }
}

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

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

    .body-text {
        font-size: 16px;
    }

    .specimen-card-inner {
        padding: 1.25rem;
    }

    .specimen-title {
        font-size: 18px;
    }

    .specimen-description {
        font-size: 14px;
    }
}
