/* === RESET & BASE === */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    scroll-snap-type: y mandatory;
    overflow-y: scroll;
    overflow-x: hidden;
}

body {
    background-color: #e8dfd2;
    color: #2c2520;
    font-family: 'Libre Baskerville', Georgia, serif;
    -webkit-font-smoothing: antialiased;
}

/* === SAND RIPPLE TEXTURE === */
body::before {
    content: '';
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: repeating-linear-gradient(
        179.5deg,
        #ddd5c5 0px,
        transparent 2px,
        rgba(44,37,32,0.03) 2px,
        rgba(44,37,32,0.03) 3px
    );
    pointer-events: none;
    z-index: 1;
}

/* === CURSOR TORCH === */
#cursor-torch {
    position: fixed;
    width: 400px;
    height: 400px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(200,217,209,0.07) 0%, transparent 70%);
    pointer-events: none;
    transform: translate(-50%, -50%);
    transition: left 150ms ease-out, top 150ms ease-out;
    z-index: 100;
    will-change: transform;
    display: none;
}

/* === NAVIGATION DOTS === */
#nav-dots {
    position: fixed;
    right: 2vw;
    top: 50%;
    transform: translateY(-50%);
    z-index: 200;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.nav-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #c4b8a0;
    cursor: pointer;
    position: relative;
    transition: background-color 0.4s ease;
}

.nav-dot.active {
    background: #4a7c6f;
}

.nav-label {
    position: absolute;
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.75rem;
    color: #8b7e6f;
    white-space: nowrap;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.nav-dot:hover .nav-label {
    opacity: 1;
}

/* === PLATES (General) === */
.plate {
    width: 100%;
    height: 100vh;
    position: relative;
    scroll-snap-align: start;
    overflow: hidden;
    z-index: 2;
}

#plates {
    height: 100vh;
    overflow-y: scroll;
    scroll-snap-type: y mandatory;
    scroll-behavior: smooth;
}

/* === PLATE 1: HORIZON === */
.plate-horizon {
    background-color: #e8dfd2;
    display: flex;
    align-items: center;
    justify-content: center;
}

.horizon-content {
    position: absolute;
    top: 58%;
    left: 0;
    width: 100%;
    padding: 0 4vw;
    transform: translateY(-50%);
}

.hero-title {
    font-family: 'Oswald', sans-serif;
    font-weight: 700;
    font-size: clamp(4rem, 18vw, 14rem);
    text-transform: uppercase;
    letter-spacing: -0.02em;
    line-height: 0.88;
    color: #2c2520;
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 2s ease, transform 2s ease;
}

.hero-title.visible {
    opacity: 1;
    transform: translateY(0);
}

.hero-suffix {
    display: block;
    font-family: 'Barlow Condensed', sans-serif;
    font-weight: 600;
    font-size: clamp(1rem, 4.5vw, 3.5rem);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #4a7c6f;
    margin-left: 12vw;
    margin-top: 0.2em;
    opacity: 0;
    transform: translateY(10px);
    transition: opacity 1.5s ease 0.8s, transform 1.5s ease 0.8s;
}

.hero-suffix.visible {
    opacity: 1;
    transform: translateY(0);
}

.tide-line {
    position: absolute;
    bottom: -2rem;
    left: 0;
    height: 1px;
    width: 0;
    background-color: #b09470;
    transition: width 3s ease 1.2s;
}

.tide-line.visible {
    width: 70%;
}

/* === PLATE 2: EROSION === */
.plate-erosion {
    background-color: #e8dfd2;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    padding-bottom: 15vh;
}

.erosion-content {
    max-width: 38ch;
    text-align: left;
}

.erosion-text {
    font-family: 'Libre Baskerville', Georgia, serif;
    font-size: clamp(1rem, 1.15vw, 1.2rem);
    line-height: 1.72;
    letter-spacing: 0.01em;
    color: #2c2520;
    clip-path: polygon(0 100%, 0 100%, 0 100%, 0 100%);
    transition: clip-path 1.5s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.erosion-text.visible {
    clip-path: polygon(0 0, 100% 0, 100% 100%, 0 100%);
}

/* === PLATE 3: STRATA === */
.plate-strata {
    display: flex;
    flex-direction: column;
    background-color: #e8dfd2;
}

.strata-band {
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

.strata-foundation {
    flex: 5;
    background-color: #d6ccba;
    transform: translateX(-100%);
    transition: transform 1.2s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.strata-liquidity {
    flex: 3;
    background-color: #5b8a9a;
    background-color: rgba(91,138,154,0.15);
    position: relative;
}

.strata-speculation {
    flex: 2;
    background-color: #3d4a50;
    background-color: rgba(61,74,80,0.08);
    transform: translateX(100%);
    transition: transform 1.2s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.strata-foundation.visible,
.strata-speculation.visible {
    transform: translateX(0);
}

.strata-label {
    font-family: 'Barlow Condensed', sans-serif;
    font-weight: 600;
    font-size: clamp(1.2rem, 3vw, 2.4rem);
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #4a7c6f;
}

.sine-wave {
    position: absolute;
    top: 50%;
    left: 0;
    width: 100%;
    height: 60px;
    transform: translateY(-50%);
    opacity: 0.6;
}

/* Copper patina edge between sections */
.plate-strata .strata-band + .strata-band {
    box-shadow: inset 0 2px 0 0 #4a7c6f;
}

/* === PLATE 4: TIDEPOOL === */
.plate-tidepool {
    background-color: #c8d9d1;
    position: relative;
}

.tidepool-icon {
    position: absolute;
    transform: translate(-50%, -50%);
    will-change: transform;
    transition: none;
}

.tidepool-icon svg {
    display: block;
}

/* Liquidity flow animation */
@keyframes dashFlow {
    to { stroke-dashoffset: -28; }
}

.liquidity-flow {
    animation: dashFlow 4s linear infinite;
}

/* === PLATE 5: DRIFT === */
.plate-drift {
    background-color: #e8dfd2;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    padding-bottom: 10vh;
    padding-left: 6vw;
    padding-right: 6vw;
}

.drift-line {
    width: 70%;
    height: 1px;
    background-color: #4a7c6f;
    margin-bottom: 2rem;
    transition: width 60s linear;
}

.drift-line.receding {
    width: 0%;
}

.drift-text {
    font-family: 'Libre Baskerville', Georgia, serif;
    font-size: clamp(1rem, 1.15vw, 1.2rem);
    line-height: 1.72;
    color: #2c2520;
    opacity: 0;
    transition: opacity 2s ease;
    margin-bottom: 4rem;
}

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

.drift-meta {
    position: absolute;
    bottom: 3vh;
    right: 4vw;
    text-align: right;
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.75rem;
    color: #8b7e6f;
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}

.meta-rule {
    border: none;
    border-top: 1px solid #c4b8a0;
    width: 40px;
    margin-left: auto;
}

.meta-line {
    display: block;
}

/* === COLOR REFERENCE: #000 #fff intentionally unused per design ===
   === #3d4a50 storm slate, #5b8a9a tidal pool, #ddd5c5 sand ripple === */

/* === BACKGROUND GRID === */
#bg-grid {
    opacity: 1;
}

/* === RESPONSIVE === */
@media (max-width: 768px) {
    .horizon-content {
        padding: 0 6vw;
    }

    .hero-title {
        font-size: clamp(3rem, 15vw, 12rem);
    }

    .tidepool-icon {
        position: relative !important;
        left: 50% !important;
        top: auto !important;
        margin-bottom: 8vh;
        transform: translateX(-50%) !important;
    }

    .plate-tidepool {
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        padding: 6vh 0;
    }
}

/* Touch device: hide cursor torch */
@media (hover: none) {
    #cursor-torch {
        display: none !important;
    }
}
