/* limiter.dev -- Hydraulic Pressure System / Neomorphic Industrial */

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

:root {
    --bg-base: #e8e2da;
    --neo-highlight: #f5f0e8;
    --neo-shadow: #c4bdb5;
    --text-primary: #3d3a36;
    --text-secondary: #7a7470;
    --gauge-bezel: #a69e94;
    --bezel-light: #d4cdc5;
    --safe: #5a8a5a;
    --warning: #c4922a;
    --danger: #c4522a;
    --pipe: #b8b0a8;
    --accent-glow: #d4a854;
    --allow-bg: #e8f0e8;
    --deny-bg: #f0e8e8;
    --font-display: 'DM Sans', sans-serif;
    --font-body: 'Source Serif 4', serif;
    --font-mono: 'IBM Plex Mono', monospace;
}

html { scroll-behavior: smooth; }

body {
    background: var(--bg-base);
    color: var(--text-primary);
    font-family: var(--font-body);
    font-weight: 400;
    font-size: 17px;
    line-height: 1.7;
    overflow-x: hidden;
}

/* ---- Noise Layer ---- */
.noise-layer {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 9999;
}

/* ---- Vertical Pipe ---- */
.pipe-line {
    position: fixed;
    left: 40px;
    top: 0;
    width: 2px;
    height: 100vh;
    background: var(--pipe);
    z-index: 50;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: space-evenly;
}

.pipe-junction {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--bg-base);
    box-shadow: 3px 3px 6px var(--neo-shadow), -3px -3px 6px var(--neo-highlight);
    position: relative;
    transition: background 0.6s ease;
}

.pipe-junction.filled {
    background: var(--accent-glow);
    box-shadow: 0 0 8px rgba(212, 168, 84, 0.4), 3px 3px 6px var(--neo-shadow), -3px -3px 6px var(--neo-highlight);
}

.pipe-junction::after {
    content: attr(data-label);
    position: absolute;
    left: 24px;
    top: 50%;
    transform: translateY(-50%);
    font-family: var(--font-display);
    font-size: 9px;
    font-weight: 600;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: var(--gauge-bezel);
    white-space: nowrap;
}

/* ---- Pressure Scale (right nav) ---- */
.pressure-scale {
    position: fixed;
    right: 24px;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    flex-direction: column;
    gap: 16px;
    z-index: 100;
}

.scale-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--bg-base);
    box-shadow: 2px 2px 4px var(--neo-shadow), -2px -2px 4px var(--neo-highlight);
    transition: box-shadow 0.3s ease, background 0.3s ease;
    text-decoration: none;
}

.scale-dot.active {
    background: var(--accent-glow);
    box-shadow: 0 0 6px rgba(212, 168, 84, 0.5), 2px 2px 4px var(--neo-shadow);
}

/* ---- Sections ---- */
.section {
    min-height: 100vh;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: clamp(3rem, 6vw, 6rem) clamp(2rem, 4vw, 4rem);
    padding-left: 80px;
}

/* ---- Intake Manifold ---- */
.intake-section {
    flex-direction: column;
    gap: clamp(2rem, 4vw, 4rem);
}

.intake-inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: clamp(2rem, 4vw, 3rem);
}

.title-panel {
    background: var(--bg-base);
    box-shadow: 8px 8px 16px var(--neo-shadow), -8px -8px 16px var(--neo-highlight);
    border-radius: 20px;
    padding: clamp(2rem, 4vw, 3.5rem) clamp(3rem, 6vw, 5rem);
    text-align: center;
    opacity: 0;
    transform: scale(0.98);
    transition: opacity 0.8s ease-out, transform 0.8s ease-out;
}

.title-panel.visible {
    opacity: 1;
    transform: scale(1);
}

.site-title {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: clamp(2.5rem, 6vw, 4.5rem);
    letter-spacing: -0.02em;
    color: var(--text-primary);
    line-height: 1.1;
}

.site-subtitle {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: clamp(1rem, 2vw, 1.5rem);
    letter-spacing: 0.1em;
    color: var(--gauge-bezel);
    text-transform: uppercase;
    margin-top: 0.25rem;
}

.hero-gauge {
    width: clamp(160px, 30vw, 240px);
    height: clamp(160px, 30vw, 240px);
}

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

.gauge-needle {
    transform-origin: 120px 120px;
    transform: rotate(-135deg);
    transition: transform 2s cubic-bezier(0.16, 1, 0.3, 1);
    will-change: transform;
}

/* ---- Flow Meter Section ---- */
.flow-section {
    display: block;
    padding-top: clamp(4rem, 8vw, 8rem);
    padding-bottom: clamp(4rem, 8vw, 8rem);
}

.flow-column {
    max-width: 560px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: clamp(1.5rem, 3vw, 2.5rem);
}

.concept-card {
    background: var(--bg-base);
    box-shadow: 8px 8px 16px var(--neo-shadow), -8px -8px 16px var(--neo-highlight);
    border-radius: 20px;
    padding: clamp(1.5rem, 3vw, 2rem);
    position: relative;
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.6s ease-out, transform 0.6s ease-out, box-shadow 0.2s ease;
}

.concept-card.visible {
    opacity: 1;
    transform: translateY(0);
}

.concept-card:hover {
    box-shadow: 10px 10px 20px var(--neo-shadow), -10px -10px 20px var(--neo-highlight);
}

.card-title {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: clamp(1.1rem, 2vw, 1.4rem);
    letter-spacing: -0.01em;
    color: var(--text-primary);
    margin-bottom: 0.75rem;
}

.card-body {
    font-family: var(--font-body);
    font-weight: 400;
    font-size: 17px;
    line-height: 1.7;
    color: #5a5550;
}

.card-label {
    display: block;
    margin-top: 1rem;
    font-family: var(--font-mono);
    font-weight: 500;
    font-size: 11px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-secondary);
}

/* ---- Pressure Chamber ---- */
.chamber-section {
    flex-direction: column;
    gap: clamp(2rem, 4vw, 3rem);
}

.chamber-inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: clamp(2rem, 4vw, 3rem);
}

.main-gauge {
    width: clamp(260px, 50vw, 400px);
    height: clamp(260px, 50vw, 400px);
}

.main-gauge-svg {
    width: 100%;
    height: 100%;
}

.main-needle {
    transform-origin: 200px 200px;
    transform: rotate(-135deg);
    transition: transform 2s cubic-bezier(0.16, 1, 0.3, 1);
    will-change: transform;
}

.threshold-label {
    opacity: 0;
    transition: opacity 0.6s ease;
}

.threshold-label.active {
    opacity: 1;
}

.satellite-gauges {
    display: flex;
    gap: clamp(1rem, 2vw, 2rem);
    flex-wrap: wrap;
    justify-content: center;
}

.satellite {
    width: 120px;
    height: 120px;
    opacity: 0;
    transform: scale(0.9);
    transition: opacity 0.5s ease-out, transform 0.5s ease-out;
}

.satellite.visible {
    opacity: 1;
    transform: scale(1);
}

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

.sat-needle {
    transform-origin: 60px 60px;
    transform: rotate(-135deg);
    transition: transform 1.5s cubic-bezier(0.16, 1, 0.3, 1);
    will-change: transform;
}

/* ---- Valve Assembly ---- */
.valve-section {
    padding-top: clamp(4rem, 8vw, 6rem);
    padding-bottom: clamp(4rem, 8vw, 6rem);
}

.valve-inner {
    display: flex;
    align-items: stretch;
    gap: clamp(1rem, 2vw, 2rem);
    max-width: 900px;
    width: 100%;
}

.pathway {
    flex: 1;
    border-radius: 20px;
    padding: clamp(1.5rem, 3vw, 2rem);
    opacity: 0;
    transition: opacity 0.6s ease-out, transform 0.6s ease-out;
}

.allow-path {
    background: var(--allow-bg);
    box-shadow: inset 4px 4px 8px rgba(90, 138, 90, 0.1), inset -4px -4px 8px rgba(255, 255, 255, 0.5);
    transform: translateX(-20px);
}

.deny-path {
    background: var(--deny-bg);
    box-shadow: inset 4px 4px 8px rgba(196, 82, 42, 0.08), inset -4px -4px 8px rgba(255, 255, 255, 0.5);
    transform: translateX(20px);
}

.pathway.visible {
    opacity: 1;
    transform: translateX(0);
}

.path-title {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: clamp(1.1rem, 2vw, 1.4rem);
    color: var(--text-primary);
    margin-bottom: 0.75rem;
}

.path-body {
    font-size: 15px;
    line-height: 1.7;
    color: #5a5550;
}

.code-label {
    font-family: var(--font-mono);
    font-weight: 500;
    font-size: 13px;
    color: var(--danger);
    letter-spacing: 0.02em;
}

.valve-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 80px;
}

.valve-svg {
    width: 80px;
    height: 120px;
}

.handwheel {
    transform-origin: 40px 12px;
    transition: transform 0.6s ease;
}

.valve-flow {
    transition: fill 0.6s ease, opacity 0.6s ease;
}

.flow-dots {
    display: flex;
    gap: 8px;
    margin-top: 1rem;
}

.dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    opacity: 0.4;
}

.allow-dots .dot {
    background: var(--safe);
    animation: flowDown 2s ease-in-out infinite;
}

.deny-dots .dot {
    background: var(--danger);
    animation: flowUp 2s ease-in-out infinite;
}

.allow-dots .dot:nth-child(2) { animation-delay: 0.3s; }
.allow-dots .dot:nth-child(3) { animation-delay: 0.6s; }
.deny-dots .dot:nth-child(2) { animation-delay: 0.3s; }
.deny-dots .dot:nth-child(3) { animation-delay: 0.6s; }

@keyframes flowDown {
    0%, 100% { transform: translateY(0); opacity: 0.4; }
    50% { transform: translateY(6px); opacity: 0.8; }
}

@keyframes flowUp {
    0%, 100% { transform: translateY(0); opacity: 0.4; }
    50% { transform: translateY(-6px); opacity: 0.8; }
}

/* ---- Overflow Drain ---- */
.drain-section {
    flex-direction: column;
    gap: clamp(1.5rem, 3vw, 2.5rem);
}

.drain-inner {
    max-width: 700px;
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: clamp(1.5rem, 3vw, 2rem);
}

.horizontal-pipe {
    width: 100%;
    height: 2px;
    background: var(--pipe);
    position: relative;
}

.horizontal-pipe::before,
.horizontal-pipe::after {
    content: '';
    position: absolute;
    top: -5px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--bg-base);
    box-shadow: 2px 2px 4px var(--neo-shadow), -2px -2px 4px var(--neo-highlight);
}

.horizontal-pipe::before { left: 0; }
.horizontal-pipe::after { right: 0; }

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

.drain-text {
    font-family: var(--font-body);
    font-weight: 400;
    font-size: 17px;
    line-height: 1.7;
    color: #5a5550;
    max-width: 560px;
}

.drain-grate {
    width: 200px;
    height: 24px;
    background: repeating-linear-gradient(
        90deg,
        var(--pipe) 0px,
        var(--pipe) 4px,
        transparent 4px,
        transparent 12px
    );
    border-radius: 4px;
    opacity: 0.5;
}

.pipe-stamps {
    display: flex;
    gap: clamp(1rem, 2vw, 2rem);
    flex-wrap: wrap;
    justify-content: center;
}

.stamp {
    font-family: var(--font-display);
    font-weight: 600;
    font-size: 9px;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: var(--gauge-bezel);
    text-shadow: 1px 1px 0 var(--neo-highlight), -1px -1px 0 var(--neo-shadow);
}

/* ---- Responsive ---- */
@media (max-width: 768px) {
    .pipe-line {
        display: none;
    }

    .section {
        padding-left: clamp(1rem, 3vw, 2rem);
    }

    .valve-inner {
        flex-direction: column;
    }

    .valve-icon {
        order: -1;
        width: auto;
    }

    .valve-svg {
        transform: rotate(90deg);
    }

    .allow-path {
        transform: translateY(-20px);
    }

    .deny-path {
        transform: translateY(20px);
    }

    .satellite-gauges {
        gap: 0.75rem;
    }

    .satellite {
        width: 80px;
        height: 80px;
    }

    .pressure-scale {
        right: 12px;
        gap: 12px;
    }

    .scale-dot {
        width: 8px;
        height: 8px;
    }
}

/* ---- Reduced Motion ---- */
@media (prefers-reduced-motion: reduce) {
    .title-panel { opacity: 1; transform: scale(1); transition: none; }
    .concept-card { opacity: 1; transform: translateY(0); transition: none; }
    .gauge-needle { transition: none; }
    .main-needle { transition: none; }
    .sat-needle { transition: none; }
    .pathway { opacity: 1; transform: translateX(0); transition: none; }
    .satellite { opacity: 1; transform: scale(1); transition: none; }
    .pipe-junction { transition: none; }
    .handwheel { transition: none; }
    .valve-flow { transition: none; }
    .allow-dots .dot,
    .deny-dots .dot { animation: none; }
    .threshold-label { opacity: 1; transition: none; }
}
