/* =============================================
   layer-2.id — Isometric Protocol Architecture
   ============================================= */

:root {
    --midnight: #12121e;
    --parchment: #f0ece0;
    --indigo: #6c63ff;
    --copper: #c87941;
    --slate: #3a3a5c;
    --soft-graphite: #b0aaa0;
    --frost: #e8e4dc;
    --vermilion: #d64545;
    --iso-angle: 30deg;
}

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

html {
    scroll-behavior: smooth;
}

body {
    background: var(--parchment);
    color: var(--frost);
    font-family: 'IBM Plex Sans', -apple-system, sans-serif;
    font-weight: 400;
    font-size: clamp(1rem, 1.2vw, 1.125rem);
    line-height: 1.72;
    overflow-x: hidden;
}

/* ---- Isometric Grid ---- */
.iso-grid {
    position: absolute;
    inset: 0;
    background:
        radial-gradient(circle, var(--slate) 1px, transparent 1px);
    background-size: 20px 20px;
    opacity: 0;
    transition: opacity 1.2s ease;
    pointer-events: none;
}

.iso-grid.visible {
    opacity: 0.15;
}

.iso-grid.fading {
    opacity: 0.05;
    mask-image: linear-gradient(to bottom, rgba(0,0,0,0.1), transparent);
    -webkit-mask-image: linear-gradient(to bottom, rgba(0,0,0,0.1), transparent);
}

/* ---- Layer Section Base ---- */
.layer-section {
    position: relative;
    min-height: 90vh;
    padding: 100px 20% 100px 20%;
    display: flex;
    align-items: flex-start;
    gap: 40px;
    transition: background-color 0.5s ease;
}

/* Progressive darkening */
.surface-layer { background: var(--parchment); }
[data-layer="1"] { background: #e4ded2; }
[data-layer="2"] { background: #c8c2b6; color: var(--frost); }
[data-layer="3"] { background: #5a5a72; }
[data-layer="4"] { background: #2a2a3e; }
.foundation-layer { background: var(--midnight); }

/* ---- Ghost Numbers ---- */
.ghost-number {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-family: 'Bebas Neue', sans-serif;
    font-size: clamp(8rem, 15vw, 14rem);
    color: var(--indigo);
    opacity: 0.06;
    pointer-events: none;
    line-height: 1;
    z-index: 0;
}

/* ---- Layer Content ---- */
.layer-content {
    flex: 1;
    z-index: 2;
    opacity: 0;
    transform: translateX(-30px);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

.layer-content.visible {
    opacity: 1;
    transform: translateX(0);
}

.layer-label {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.85rem;
    letter-spacing: 0.04em;
    color: var(--indigo);
    display: block;
    margin-bottom: 12px;
}

.layer-heading {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 700;
    font-size: clamp(2.5rem, 4vw, 4rem);
    letter-spacing: -0.01em;
    margin-bottom: 24px;
}

.surface-layer .layer-heading,
[data-layer="1"] .layer-heading {
    color: #1a1a2e;
}

[data-layer="2"] .layer-heading,
[data-layer="3"] .layer-heading,
[data-layer="4"] .layer-heading,
.foundation-layer .layer-heading {
    color: var(--frost);
}

.layer-content p {
    margin-bottom: 20px;
    max-width: 55ch;
}

[data-layer="1"] .layer-content p { color: #3a3a3a; }
[data-layer="2"] .layer-content p { color: var(--soft-graphite); }
[data-layer="3"] .layer-content p,
[data-layer="4"] .layer-content p { color: var(--soft-graphite); }

/* ---- Margin Annotations ---- */
.margin-annotation {
    width: 120px;
    flex-shrink: 0;
    position: sticky;
    top: 30vh;
    z-index: 2;
    opacity: 0;
    transition: opacity 0.8s ease 0.6s;
}

.margin-annotation.visible {
    opacity: 1;
}

.margin-annotation svg {
    width: 120px;
    height: 120px;
}

/* ---- Floor Plates ---- */
.floor-plate {
    height: 40px;
    background:
        radial-gradient(circle, var(--slate) 1px, transparent 1px);
    background-size: 20px 20px;
    opacity: 0.15;
    transform: skewY(-4deg);
    border-top: 2px solid var(--copper);
    border-bottom: 1px solid rgba(58,58,92,0.2);
    transition: box-shadow 0.3s ease;
}

.floor-plate.glow {
    box-shadow: 0 0 20px rgba(108,99,255,0.2);
}

/* =============================================
   HERO: THE SURFACE
   ============================================= */
.surface-layer {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
}

.hero-content {
    text-align: center;
    z-index: 2;
    position: relative;
}

.wireframe-cube {
    width: 200px;
    height: 200px;
    margin: 0 auto 30px;
}

.cube-edge {
    stroke-dasharray: 200;
    stroke-dashoffset: 200;
    transition: stroke-dashoffset 0.3s ease;
}

.cube-edge.drawn {
    stroke-dashoffset: 0;
}

.hero-title {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 700;
    font-size: clamp(2.5rem, 5vw, 4rem);
    letter-spacing: 0.1em;
    color: #1a1a2e;
    opacity: 0;
    transition: opacity 0.8s ease;
}

.hero-title.visible {
    opacity: 1;
}

.hero-subtitle {
    font-family: 'IBM Plex Sans', sans-serif;
    font-weight: 400;
    font-size: 16px;
    color: var(--soft-graphite);
    margin-top: 16px;
    opacity: 0;
    transition: opacity 0.6s ease;
}

.hero-subtitle.visible {
    opacity: 1;
}

.scroll-chevron {
    position: absolute;
    bottom: 40px;
    left: 50%;
    transform: translateX(-50%);
    animation: chevPulse 2s ease-in-out infinite;
}

@keyframes chevPulse {
    0%, 100% { opacity: 0.3; }
    50% { opacity: 0.7; }
}

/* =============================================
   FOUNDATION
   ============================================= */
.foundation-layer {
    min-height: 60vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 80px 20%;
}

.foundation-rule {
    width: 0;
    height: 1px;
    background: var(--frost);
    margin-bottom: 40px;
    transition: width 1s ease;
}

.foundation-rule.drawn {
    width: 60%;
}

.foundation-content {
    max-width: 600px;
    text-align: center;
    opacity: 0;
    transition: opacity 0.8s ease;
}

.foundation-content.visible {
    opacity: 1;
}

.foundation-content p {
    font-family: 'IBM Plex Sans', sans-serif;
    font-weight: 300;
    font-size: clamp(1rem, 1.3vw, 1.2rem);
    line-height: 1.8;
    color: var(--soft-graphite);
}

/* ---- Responsive ---- */
@media (max-width: 768px) {
    .layer-section {
        padding: 80px 8% 80px 8%;
        flex-direction: column;
    }

    .margin-annotation {
        position: static;
        width: 80px;
        margin: 0 auto;
    }

    .floor-plate {
        transform: none;
        height: 2px;
    }
}
