/* ==========================================================================
   RRIPPL.com v2 - Sonic Propagation / Oscilloscope Aesthetic
   Colors: Void Black #08090C, Phosphor Amber #E8A524, Signal Teal #2EC4B6,
           Trace Gray #3A3D45, Parchment Warm #F0E6D3, Deep Sienna #8B4513,
           Resonance Red #C0392B
   Fonts: Anybody (headlines), Instrument Sans (body), Share Tech Mono (data)
   ========================================================================== */

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

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

body {
    background-color: #08090C;
    color: #F0E6D3;
    font-family: 'Instrument Sans', sans-serif;
    font-weight: 400;
    font-size: clamp(16px, 1.2vw, 20px);
    line-height: 1.7;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

/* --- Typography --- */
.section-heading {
    font-family: 'Anybody', sans-serif;
    font-weight: 700;
    font-stretch: 125%;
    font-size: clamp(40px, 6vw, 88px);
    letter-spacing: -0.02em;
    color: #E8A524;
    line-height: 1.1;
    margin-bottom: 0.4em;
}

.section-subheading {
    font-family: 'Anybody', sans-serif;
    font-weight: 700;
    font-stretch: 110%;
    font-size: clamp(28px, 4vw, 56px);
    letter-spacing: -0.02em;
    color: #F0E6D3;
    line-height: 1.15;
    margin-bottom: 0.4em;
}

.body-text {
    font-family: 'Instrument Sans', sans-serif;
    font-weight: 400;
    font-size: clamp(16px, 1.2vw, 20px);
    line-height: 1.7;
    color: #F0E6D3;
    max-width: 640px;
    margin-bottom: 1em;
}

.mono-text {
    font-family: 'Share Tech Mono', monospace;
    font-weight: 400;
    font-size: 13px;
    letter-spacing: 0.08em;
    color: #E8A524;
    text-transform: uppercase;
}

.data-annotation {
    display: block;
    margin-top: 0.5em;
    opacity: 0.7;
}

/* --- Ambient Canvas (persistent background, scroll-velocity reactive) --- */
#ambient-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    pointer-events: none;
}

/* --- Signal Amplitude Bars (left edge, vertical column reacting to scroll velocity) --- */
#amplitude-bars {
    position: fixed;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    z-index: 10;
    display: flex;
    flex-direction: column-reverse;
    gap: 3px;
    padding: 8px 6px;
}

.amp-bar {
    width: 4px;
    height: 12px;
    background-color: #E8A524;
    box-shadow: 0 0 8px #E8A524;
    opacity: 0.15;
    transition: opacity 0.15s ease, transform 0.15s ease;
    transform: scaleX(1);
    border-radius: 1px;
}

.amp-bar.active {
    opacity: 1;
    transform: scaleX(2.5);
}

/* --- Waveform Navigation Bar (top, cursor-reactive oscilloscope trace) --- */
#waveform-nav {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 40px;
    z-index: 100;
    background: linear-gradient(to bottom, rgba(8, 9, 12, 0.95), rgba(8, 9, 12, 0));
    padding: 0 40px;
}

#nav-waveform {
    width: 100%;
    height: 40px;
}

#nav-labels {
    position: absolute;
    top: 0;
    left: 40px;
    right: 40px;
    height: 40px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    pointer-events: none;
}

.nav-label {
    font-family: 'Share Tech Mono', monospace;
    font-size: 11px;
    letter-spacing: 0.1em;
    color: #E8A524;
    opacity: 0;
    transition: opacity 0.3s ease, color 0.3s ease;
    pointer-events: auto;
    cursor: pointer;
    padding: 4px 8px;
}

#waveform-nav:hover .nav-label {
    opacity: 0.8;
}

.nav-label:hover {
    opacity: 1 !important;
    color: #2EC4B6;
}

.nav-label.active-section {
    opacity: 1 !important;
    color: #2EC4B6;
}

/* --- Sections --- */
.full-section {
    position: relative;
    min-height: 100vh;
    width: 100%;
    z-index: 1;
    overflow: hidden;
}

.section-opening {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
}

.section-content {
    min-height: 80vh;
    padding: 10vh 5vw 8vh 50px;
    position: relative;
}

.section-closing {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
}

/* --- Diagonal clip-path transitions (seismograph-needle angle, ~3deg) --- */
.diagonal-slice-in {
    position: absolute;
    top: -3vw;
    left: -2%;
    right: -2%;
    height: 8vw;
    background: #08090C;
    transform: skewY(-2.5deg);
    transform-origin: top left;
    z-index: 2;
    pointer-events: none;
}

/* --- Opening Waveform SVG --- */
.opening-wave-svg {
    position: absolute;
    top: 50%;
    left: 0;
    width: 100%;
    height: 200px;
    transform: translateY(-50%);
    z-index: 1;
}

/* --- Logotype --- */
#logotype-container {
    position: relative;
    z-index: 5;
    text-align: center;
}

#logotype {
    font-family: 'Anybody', sans-serif;
    font-weight: 700;
    font-stretch: 125%;
    font-size: clamp(60px, 12vw, 160px);
    letter-spacing: 0.05em;
    color: #E8A524;
    display: inline-block;
}

.logo-letter {
    display: inline-block;
    opacity: 0;
    text-shadow: 0 0 20px rgba(232, 165, 36, 0.6), 0 0 40px rgba(232, 165, 36, 0.3);
}

.logo-letter.visible {
    animation: phosphorWarmup 0.15s steps(4) forwards;
}

@keyframes phosphorWarmup {
    0% { opacity: 0; }
    25% { opacity: 1; }
    50% { opacity: 0.3; }
    75% { opacity: 0.9; }
    100% { opacity: 1; }
}

#subtitle {
    margin-top: 1.5em;
    font-size: 14px;
    letter-spacing: 0.15em;
    min-height: 1.5em;
}

#subtitle .cursor-blink {
    display: inline-block;
    width: 8px;
    height: 14px;
    background: #E8A524;
    margin-left: 2px;
    vertical-align: middle;
    animation: cursorBlink 0.8s step-end infinite;
}

@keyframes cursorBlink {
    0%, 50% { opacity: 1; }
    51%, 100% { opacity: 0; }
}

/* --- Seismograph Paper Texture (faint horizontal ruled lines) --- */
.seismograph-texture {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: repeating-linear-gradient(
        to bottom,
        transparent,
        transparent 7px,
        rgba(58, 61, 69, 0.05) 7px,
        rgba(58, 61, 69, 0.05) 8px
    );
    pointer-events: none;
    z-index: 0;
}

/* --- Chladni Watermarks (SVG-based, different mode pattern per section) --- */
.chladni-watermark {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 600px;
    height: 600px;
    pointer-events: none;
    z-index: 0;
    opacity: 0.15;
}

.chladni-watermark svg {
    width: 100%;
    height: 100%;
}

/* --- Diagonal Content Layout --- */
.diagonal-container {
    position: relative;
    z-index: 3;
    transform: rotate(-1.5deg);
    padding: 4vh 0;
}

.diagonal-container.offset-right {
    transform: rotate(1.5deg);
    text-align: right;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}

.diagonal-container.offset-right .content-card {
    text-align: left;
}

/* --- Content Cards (scroll-triggered reveal with directional transforms) --- */
.content-card {
    max-width: 620px;
    padding: 2em 2.5em;
    margin: 2em 0;
    position: relative;
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.6s ease-out, transform 0.6s ease-out;
    background: rgba(8, 9, 12, 0.4);
}

.content-card[data-reveal="left"] {
    transform: translateX(-40px) translateY(20px);
}

.content-card[data-reveal="right"] {
    transform: translateX(40px) translateY(20px);
}

.content-card[data-reveal="center"] {
    transform: translateY(40px) scale(0.97);
}

.content-card.revealed {
    opacity: 1;
    transform: translateX(0) translateY(0) scale(1);
}

/* Border draw animation on hover (Signal Teal, clockwise from top-left, 600ms) */
.content-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    border: 1px solid transparent;
    pointer-events: none;
    transition: none;
}

.content-card:hover::before {
    animation: borderDraw 0.6s ease forwards;
}

@keyframes borderDraw {
    0% {
        border-color: transparent;
        clip-path: polygon(0 0, 0 0, 0 0, 0 0);
    }
    25% {
        clip-path: polygon(0 0, 100% 0, 100% 0, 0 0);
        border-color: #2EC4B6;
    }
    50% {
        clip-path: polygon(0 0, 100% 0, 100% 100%, 100% 100%);
    }
    75% {
        clip-path: polygon(0 0, 100% 0, 100% 100%, 0 100%);
    }
    100% {
        clip-path: polygon(0 0, 100% 0, 100% 100%, 0 100%);
        border-color: #2EC4B6;
    }
}

/* --- Trace Lines (SVG line-draw animation) --- */
.trace-line {
    width: 300px;
    height: 2px;
    margin: 1em 0;
    overflow: visible;
}

.trace-line line {
    transition: stroke-dashoffset 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.trace-line.drawn line {
    stroke-dashoffset: 0;
}

.trace-line-mid {
    margin-left: 80px;
}

.offset-right .trace-line-mid {
    margin-left: 0;
    margin-right: 80px;
}

/* --- Seismograph Strip Sections (decorative waveform bands) --- */
.seismo-strip {
    position: relative;
    width: 100%;
    height: 60px;
    z-index: 1;
    overflow: hidden;
}

.seismo-svg {
    width: 100%;
    height: 100%;
}

/* --- Frequency Spectrum Strips (thin vertical bars, drifting left-to-right) --- */
.spectrum-strip {
    position: relative;
    width: 100%;
    height: 50px;
    z-index: 1;
    overflow: hidden;
}

.spectrum-bars {
    display: flex;
    align-items: flex-end;
    height: 100%;
    width: 200%;
    animation: spectrumDrift 20s linear infinite;
}

.spectrum-bar {
    width: 2px;
    margin-right: 2px;
    background: #E8A524;
    opacity: 0.5;
    border-radius: 1px 1px 0 0;
    flex-shrink: 0;
}

@keyframes spectrumDrift {
    from { transform: translateX(0); }
    to { transform: translateX(-50%); }
}

/* --- Closing Section --- */
.closing-wave-svg {
    position: absolute;
    top: 30%;
    left: 0;
    width: 100%;
    height: 200px;
    z-index: 1;
}

#closing-content {
    position: relative;
    z-index: 5;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.closing-card {
    text-align: center;
    max-width: 560px;
}

.closing-card .body-text {
    max-width: 560px;
}

#heartbeat-line {
    width: 80%;
    max-width: 800px;
    height: 100px;
    margin: 3em 0 1.5em;
    position: relative;
}

#heartbeat-svg {
    width: 100%;
    height: 100%;
}

#closing-signal {
    font-size: 14px;
    letter-spacing: 0.15em;
    min-height: 1.5em;
}

/* --- Topographic Contours (closing section, Deep Sienna at low opacity) --- */
.topographic-contours {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
    opacity: 0.08;
    background:
        radial-gradient(ellipse 90% 70% at 50% 60%, transparent 20%, #8B4513 20.3%, transparent 20.6%),
        radial-gradient(ellipse 80% 60% at 50% 60%, transparent 30%, #8B4513 30.3%, transparent 30.6%),
        radial-gradient(ellipse 70% 50% at 50% 60%, transparent 40%, #8B4513 40.3%, transparent 40.6%),
        radial-gradient(ellipse 60% 40% at 50% 60%, transparent 50%, #8B4513 50.3%, transparent 50.6%),
        radial-gradient(ellipse 50% 30% at 50% 60%, transparent 60%, #8B4513 60.3%, transparent 60.6%),
        radial-gradient(ellipse 40% 25% at 50% 60%, transparent 70%, #8B4513 70.3%, transparent 70.6%);
}

/* --- Links (underline-draw animation in Signal Teal, left-to-right) --- */
a {
    color: #2EC4B6;
    text-decoration: none;
    position: relative;
    display: inline-block;
}

a::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 0;
    height: 1px;
    background: #2EC4B6;
    transition: width 0.4s ease;
}

a:hover::after {
    width: 100%;
}

/* --- Custom Scrollbar --- */
::-webkit-scrollbar {
    width: 4px;
}

::-webkit-scrollbar-track {
    background: #08090C;
}

::-webkit-scrollbar-thumb {
    background: #3A3D45;
    border-radius: 2px;
}

::-webkit-scrollbar-thumb:hover {
    background: #E8A524;
}

/* --- Responsive --- */
@media (max-width: 768px) {
    .section-content {
        padding: 8vh 20px 6vh 30px;
    }

    .diagonal-container {
        transform: rotate(-0.5deg);
    }

    .diagonal-container.offset-right {
        transform: rotate(0.5deg);
    }

    .content-card {
        max-width: 100%;
        padding: 1.5em 1.5em;
    }

    .chladni-watermark {
        width: 300px;
        height: 300px;
    }

    #amplitude-bars {
        display: none;
    }

    #waveform-nav {
        padding: 0 15px;
    }

    .nav-label {
        font-size: 9px;
    }

    .trace-line-mid {
        margin-left: 20px;
    }

    .diagonal-slice-in {
        height: 6vw;
    }
}
