/* p9.rs — Blobitecture meets geological typography */

:root {
    --bg-light: #f5f0e8;
    --bg-mid: #3b3a30;
    --bg-dark: #2a2922;
    --bg-warm: #5c3d2e;
    --accent-sienna: #c4703f;
    --accent-copper: #6b8f71;
    --text-dark: #2e2d26;
    --text-light: #f5f0e8;
    --font-heading: 'Libre Baskerville', 'Georgia', serif;
    --font-body: 'Source Serif 4', 'Georgia', serif;
    --font-accent: 'DM Sans', 'Helvetica Neue', sans-serif;
}

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

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

body {
    background-color: var(--bg-light);
    color: var(--text-dark);
    font-family: var(--font-body);
    font-weight: 400;
    line-height: 1.75;
    overflow-x: hidden;
}

/* ---- Grid System: Asymmetric 5-Column Ma Layout ---- */

.stratum {
    position: relative;
    min-height: 100vh;
    overflow: hidden;
    transition: background-color 0.8s ease;
}

.stratum-grid {
    display: grid;
    grid-template-columns: 1fr 2fr 0.5fr 2fr 1fr;
    min-height: 100vh;
    align-items: center;
    padding: 4rem 0;
}

.col-2 {
    grid-column: 2 / 3;
}

.col-3 {
    grid-column: 3 / 4;
    text-align: center;
}

.col-4 {
    grid-column: 4 / 5;
}

/* ---- Stratum 1: Surface ---- */

.stratum-surface {
    background-color: var(--bg-light);
}

.stratum-surface .stratum-grid {
    align-items: start;
    padding-top: 35vh;
}

.domain-name {
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: clamp(3rem, 7vw, 9rem);
    letter-spacing: 0.02em;
    line-height: 1.15;
    color: var(--text-dark);
}

.tagline {
    margin-top: 8rem;
    font-family: var(--font-heading);
    font-style: italic;
    font-weight: 400;
    font-size: 1rem;
    line-height: 1.75;
    max-width: 42ch;
    color: var(--text-dark);
    opacity: 0.8;
}

/* ---- Stratum 2: Subsoil ---- */

.stratum-subsoil {
    background-color: var(--bg-mid);
    color: var(--text-light);
}

/* ---- Stratum 3: Bedrock ---- */

.stratum-bedrock {
    background-color: var(--bg-dark);
    color: var(--text-light);
    min-height: 120vh;
}

.stratum-bedrock .stratum-grid {
    display: block;
    padding: 8rem 0;
}

/* ---- Stratum 4: Magma ---- */

.stratum-magma {
    background-color: var(--bg-warm);
    color: var(--text-light);
}

/* ---- Stratum 5: Core ---- */

.stratum-core {
    background-color: var(--bg-light);
    color: var(--text-dark);
}

.stratum-core .stratum-grid {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
}

.core-statement {
    font-family: var(--font-heading);
    font-style: italic;
    font-weight: 400;
    font-size: 1.2rem;
    line-height: 1.75;
    text-align: center;
    color: var(--text-dark);
}

.core-void {
    height: 12rem;
}

.core-domain-repeat {
    text-align: center;
}

.domain-echo {
    font-family: var(--font-heading);
    font-weight: 400;
    font-size: 0.75rem;
    letter-spacing: 0.4em;
    color: var(--bg-mid);
}

/* ---- Blob Shapes ---- */

.blob {
    position: relative;
    width: 100%;
    min-height: 350px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 3rem;
}

.blob-primary {
    border-radius: 40% 60% 55% 45% / 50% 40% 60% 50%;
    border: 1.5px solid rgba(196, 112, 63, 0.25);
    background: rgba(196, 112, 63, 0.06);
}

.blob-secondary {
    border-radius: 55% 45% 40% 60% / 45% 55% 50% 50%;
    border: 1.5px solid rgba(107, 143, 113, 0.20);
    background: rgba(107, 143, 113, 0.04);
}

.blob-content {
    position: relative;
    z-index: 1;
    max-width: 38ch;
}

.blob-text {
    font-family: var(--font-heading);
    font-weight: 400;
    font-size: clamp(0.95rem, 1.4vw, 1.15rem);
    line-height: 1.75;
    color: var(--text-light);
}

.blob-content--numeral {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
}

.large-numeral {
    font-family: var(--font-heading);
    font-weight: 400;
    font-size: clamp(8rem, 14vw, 14rem);
    line-height: 1;
    color: var(--text-light);
    opacity: 0.15;
    transform: translate(10%, -5%);
}

.blob-large {
    min-height: 450px;
}

/* Blob Morphing Animations */

@keyframes blobMorphA {
    0%   { border-radius: 40% 60% 55% 45% / 50% 40% 60% 50%; }
    25%  { border-radius: 55% 45% 60% 40% / 40% 55% 45% 55%; }
    50%  { border-radius: 45% 55% 40% 60% / 55% 45% 55% 45%; }
    75%  { border-radius: 60% 40% 45% 55% / 45% 60% 40% 60%; }
    100% { border-radius: 40% 60% 55% 45% / 50% 40% 60% 50%; }
}

@keyframes blobMorphB {
    0%   { border-radius: 55% 45% 40% 60% / 45% 55% 50% 50%; }
    25%  { border-radius: 45% 55% 55% 45% / 55% 40% 60% 40%; }
    50%  { border-radius: 60% 40% 45% 55% / 40% 60% 45% 55%; }
    75%  { border-radius: 40% 60% 60% 40% / 50% 45% 55% 50%; }
    100% { border-radius: 55% 45% 40% 60% / 45% 55% 50% 50%; }
}

@keyframes blobMorphC {
    0%   { border-radius: 45% 55% 50% 50% / 55% 40% 55% 45%; }
    25%  { border-radius: 55% 45% 45% 55% / 40% 60% 40% 60%; }
    50%  { border-radius: 50% 50% 55% 45% / 60% 45% 50% 50%; }
    75%  { border-radius: 40% 60% 50% 50% / 50% 50% 60% 40%; }
    100% { border-radius: 45% 55% 50% 50% / 55% 40% 55% 45%; }
}

.blob-morph-a {
    animation: blobMorphA 20s ease-in-out infinite;
}

.blob-morph-b {
    animation: blobMorphB 22s ease-in-out infinite;
}

.blob-morph-c {
    animation: blobMorphC 18s ease-in-out infinite;
}

/* ---- Parallelogram Containers ---- */

.parallelogram-stack {
    display: flex;
    flex-direction: column;
    gap: 4rem;
    padding: 0 8%;
}

.parallelogram {
    transform: skewX(-4deg);
    border: 1px solid rgba(245, 240, 232, 0.1);
    padding: 2.5rem 3rem;
    background: rgba(245, 240, 232, 0.03);
    transition: background 0.4s ease;
}

.parallelogram:hover {
    background: rgba(245, 240, 232, 0.06);
}

.parallelogram--1 {
    margin-left: 5%;
    max-width: 55%;
}

.parallelogram--2 {
    margin-left: 20%;
    max-width: 55%;
}

.parallelogram--3 {
    margin-left: 35%;
    max-width: 55%;
}

.parallelogram-inner {
    transform: skewX(4deg);
}

.overline {
    display: block;
    font-family: var(--font-accent);
    font-weight: 500;
    font-size: 0.7rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--accent-sienna);
    margin-bottom: 0.75rem;
}

.parallelogram h2 {
    font-family: var(--font-heading);
    font-weight: 400;
    font-size: clamp(1.8rem, 3.5vw, 2.8rem);
    letter-spacing: 0.02em;
    line-height: 1.15;
    color: var(--text-light);
    margin-bottom: 1rem;
}

.parallelogram p {
    font-family: var(--font-body);
    font-weight: 400;
    font-size: clamp(1rem, 1.4vw, 1.15rem);
    line-height: 1.75;
    max-width: 42ch;
    color: rgba(245, 240, 232, 0.8);
}

/* ---- Badge Stack ---- */

.badge-stack {
    display: flex;
    flex-direction: column;
    gap: 3rem;
    padding-top: 4rem;
}

.badge {
    transform: skewX(-4deg);
    border: 1px solid rgba(196, 112, 63, 0.3);
    padding: 0.8rem 1.5rem;
    font-family: var(--font-accent);
    font-weight: 500;
    font-size: 0.7rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--accent-sienna);
    background: rgba(196, 112, 63, 0.08);
    display: inline-block;
    width: fit-content;
}

/* ---- Magma Stratum Content ---- */

.stratum-magma h2 {
    font-family: var(--font-heading);
    font-weight: 400;
    font-size: clamp(1.8rem, 3.5vw, 2.8rem);
    letter-spacing: 0.02em;
    line-height: 1.15;
    color: var(--text-light);
    margin-bottom: 1.5rem;
}

.stratum-magma p {
    font-family: var(--font-body);
    font-weight: 400;
    font-size: clamp(1rem, 1.4vw, 1.15rem);
    line-height: 1.75;
    max-width: 42ch;
    color: rgba(245, 240, 232, 0.8);
}

/* ---- Diagonal Lines ---- */

.diagonal-line {
    position: absolute;
    height: 1px;
    transform: rotate(-4deg);
    transform-origin: left;
    pointer-events: none;
}

.diagonal-line--sienna {
    background-color: rgba(196, 112, 63, 0.12);
}

.diagonal-line--copper {
    background-color: rgba(107, 143, 113, 0.10);
}

.line-s1-a {
    top: 75%;
    left: 5%;
    width: 35%;
}

.line-s1-b {
    top: 85%;
    left: 55%;
    width: 30%;
}

.line-s2-a {
    top: 20%;
    left: 10%;
    width: 40%;
}

.line-s2-b {
    top: 60%;
    left: 50%;
    width: 35%;
}

.line-s2-c {
    top: 80%;
    left: 5%;
    width: 25%;
}

.line-s3-a {
    top: 15%;
    left: 60%;
    width: 30%;
}

.line-s3-b {
    top: 85%;
    left: 10%;
    width: 45%;
}

.line-s4-a {
    top: 25%;
    left: 5%;
    width: 30%;
}

.line-s4-b {
    top: 50%;
    left: 55%;
    width: 35%;
}

.line-s4-c {
    top: 75%;
    left: 15%;
    width: 25%;
}

/* Diagonal line draw animation */
.diagonal-line {
    transform: rotate(-4deg) scaleX(0);
    transition: transform 1.5s cubic-bezier(0.65, 0, 0.35, 1);
}

.diagonal-line.visible {
    transform: rotate(-4deg) scaleX(1);
}

/* ---- Rotating Glyph ---- */

.rotating-glyph {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    width: 24px;
    height: 24px;
    cursor: pointer;
    z-index: 100;
    opacity: 0.5;
    transition: opacity 0.3s ease;
}

.rotating-glyph:hover {
    opacity: 0.85;
}

.rotating-glyph svg {
    display: block;
    animation: glyphRotate 30s linear infinite;
}

.rotating-glyph polygon {
    fill: var(--accent-sienna);
}

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

/* ---- Reveal Animations ---- */

.reveal-left,
.reveal-right,
.reveal-center {
    opacity: 0;
    transition: opacity 1.2s cubic-bezier(0.25, 0.46, 0.45, 0.94),
                transform 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.reveal-left {
    transform: translateX(-40px);
}

.reveal-right {
    transform: translateX(40px);
}

.reveal-center {
    transform: translateY(20px);
}

.reveal-left.visible,
.reveal-right.visible,
.reveal-center.visible {
    opacity: 1;
    transform: translateX(0) translateY(0);
}

/* Stagger for parallelogram stack */
.parallelogram--2.reveal-left {
    transition-delay: 200ms;
}

.parallelogram--3.reveal-left {
    transition-delay: 400ms;
}

/* ---- Reduced Motion ---- */

@media (prefers-reduced-motion: reduce) {
    .blob-morph-a,
    .blob-morph-b,
    .blob-morph-c {
        animation: none;
    }

    .rotating-glyph svg {
        animation: none;
    }

    .reveal-left,
    .reveal-right,
    .reveal-center {
        opacity: 1;
        transform: none;
        transition: none;
    }

    .diagonal-line {
        transform: rotate(-4deg) scaleX(1);
        transition: none;
    }
}

/* ---- Responsive ---- */

@media (max-width: 768px) {
    .stratum-grid {
        grid-template-columns: 1rem 1fr 0.25fr 1fr 1rem;
        padding: 3rem 0;
    }

    .stratum-surface .stratum-grid {
        padding-top: 25vh;
    }

    .domain-name {
        font-size: clamp(2.5rem, 12vw, 4rem);
    }

    .tagline {
        margin-top: 4rem;
    }

    .large-numeral {
        font-size: clamp(5rem, 20vw, 8rem);
    }

    .blob {
        min-height: 250px;
        padding: 2rem;
    }

    .parallelogram-stack {
        padding: 0 1rem;
    }

    .parallelogram--1,
    .parallelogram--2,
    .parallelogram--3 {
        margin-left: 0;
        max-width: 100%;
    }

    .parallelogram--2 {
        margin-left: 5%;
    }

    .parallelogram--3 {
        margin-left: 10%;
    }

    .parallelogram {
        padding: 1.5rem 2rem;
    }

    .badge-stack {
        gap: 2rem;
        padding-top: 2rem;
    }
}
