/* ============================================
   concengine.net — Styles
   Retro horizontal-scroll technical panorama
   1972 Olivetti showroom aesthetic
   ============================================ */

/* --- CSS Custom Properties (Design Tokens) --- */
:root {
    --color-buttercream: #FAF3E8;
    --color-warm-linen: #F0E6D4;
    --color-terracotta: #B8735A;
    --color-dusty-rose: #C4A58E;
    --color-deep-espresso: #3B2F24;
    --color-warm-charcoal: #5A4A3C;
    --color-soft-apricot: #E8C8A0;
    --color-muted-sage: #B5C4A8;
    --color-pale-mauve: #D4B8C4;

    --font-headline: 'Fraunces', serif;
    --font-body: 'Libre Franklin', sans-serif;
    --font-mono: 'DM Mono', monospace;
}

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

html {
    overflow-x: hidden;
    overflow-y: hidden;
    height: 100%;
    text-rendering: optimizeLegibility;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    background-color: var(--color-buttercream);
    color: var(--color-warm-charcoal);
    font-family: var(--font-body);
    height: 100vh;
    overflow: hidden;
    position: relative;
}

/* --- Dot-Grid Background Overlay --- */
/* Vintage graph paper: 2px dots at 24px intervals in Dusty Rose at 6% opacity */
.dot-grid-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
    background-image: radial-gradient(circle, var(--color-dusty-rose) 1px, transparent 1px);
    background-size: 24px 24px;
    opacity: 0.06;
}

/* --- Progress Bar --- */
/* 2px terracotta line at bottom, grows left to right */
.progress-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    height: 2px;
    width: 0%;
    background-color: var(--color-terracotta);
    z-index: 100;
    transition: width 0.3s ease-out;
}

/* --- Dot Navigation --- */
/* 7 tiny circles, 8px diameter, fixed bottom-center */
.dot-nav {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 12px;
    z-index: 100;
    align-items: center;
}

.dot-nav-btn {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    border: 1px solid var(--color-terracotta);
    background: transparent;
    cursor: pointer;
    padding: 0;
    transition: background-color 0.3s ease, transform 0.3s ease;
    position: relative;
}

.dot-nav-btn span {
    display: none;
}

.dot-nav-btn.active {
    background-color: var(--color-terracotta);
}

.dot-nav-btn:hover {
    transform: scale(1.4);
}

/* --- Horizontal Track --- */
.horizontal-track {
    display: flex;
    flex-wrap: nowrap;
    height: 100vh;
    overflow-x: auto;
    overflow-y: hidden;
    scroll-snap-type: x mandatory;
    scrollbar-width: none;
    -ms-overflow-style: none;
    scroll-behavior: auto;
}

.horizontal-track::-webkit-scrollbar {
    display: none;
}

/* --- Panel Base --- */
.panel {
    min-width: 100vw;
    height: 100vh;
    position: relative;
    scroll-snap-align: start;
    overflow: hidden;
    flex-shrink: 0;
}

/* Alternating backgrounds: Buttercream / Warm Linen */
.panel:nth-child(odd) {
    background-color: var(--color-buttercream);
}

.panel:nth-child(even) {
    background-color: var(--color-warm-linen);
}

/* --- Panel Divider --- */
/* 4px vertical hairlines in dusty rose between panels */
.panel-divider {
    position: absolute;
    left: 0;
    top: 0;
    width: 4px;
    height: 100%;
    background-color: var(--color-dusty-rose);
    z-index: 2;
}

/* First panel has no left divider */
.panel-1 .panel-divider {
    display: none;
}

/* --- Panel Content Layout --- */
/* Off-center vertical split: 55% illustration / 45% text, alternating */
.panel-content {
    display: flex;
    width: 100%;
    height: 100%;
    position: relative;
    z-index: 1;
}

.panel-text-left {
    flex-direction: row;
}

.panel-text-right {
    flex-direction: row;
}

/* --- Text Area --- */
/* Text left-aligned, generous margins (at least 12% of viewport width) */
.text-area {
    width: 45%;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 0 6vw;
    position: relative;
}

.panel-text-left .text-area {
    width: 45%;
    padding-left: 12vw;
    padding-right: 4vw;
}

.panel-text-right .text-area {
    width: 45%;
    padding-right: 12vw;
    padding-left: 4vw;
}

/* --- Visual Area --- */
/* 55% width for illustration area */
.visual-area {
    width: 55%;
    height: 100%;
    position: relative;
}

.panel-text-left .visual-area {
    width: 55%;
}

.panel-text-right .visual-area {
    width: 55%;
}

/* --- Typography --- */

/* Panel numbers: DM Mono, uppercase, dusty rose */
.panel-number {
    font-family: var(--font-mono);
    font-size: clamp(0.65rem, 0.8vw, 0.8rem);
    font-weight: 400;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--color-dusty-rose);
    margin-bottom: 16px;
    display: block;
}

/* Headlines: Fraunces, 600 weight, deep espresso */
.panel-title {
    font-family: var(--font-headline);
    font-weight: 600;
    font-size: clamp(2.2rem, 5vw, 4.5rem);
    letter-spacing: 0.01em;
    color: var(--color-deep-espresso);
    margin-bottom: 20px;
    line-height: 1.1;
}

/* Captions: Libre Franklin, 400 weight, warm charcoal */
.panel-caption {
    font-family: var(--font-body);
    font-weight: 400;
    font-size: clamp(0.9rem, 1.2vw, 1.15rem);
    line-height: 1.65;
    letter-spacing: 0.015em;
    color: var(--color-warm-charcoal);
    max-width: 380px;
}

/* --- Shapes Base --- */
.shape-group {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    transition: transform 0.4s ease-out, filter 0.4s ease-out;
}

/* Hover-lift: entire group lifts 8px with warm shadow */
.shape-group:hover {
    transform: translateY(-8px);
    filter: drop-shadow(0 12px 32px rgba(59, 47, 36, 0.08));
}

.shape {
    position: absolute;
    /* Spring easing for hover-out settle */
    transition: transform 0.5s cubic-bezier(0.34, 1.56, 0.64, 1),
                box-shadow 0.5s cubic-bezier(0.34, 1.56, 0.64, 1),
                opacity 0.6s ease;
}

/* Shape types: CSS-only rendering */
.rounded-rect {
    border-radius: 20px;
}

.circle {
    border-radius: 50%;
}

.half-circle {
    border-radius: 200px 200px 0 0;
}

.quarter-circle {
    border-radius: 100% 0 0 0;
}

/* Shape fill colors: flat matte, no shadows, no borders */
.shape-apricot {
    background-color: var(--color-soft-apricot);
}

.shape-sage {
    background-color: var(--color-muted-sage);
}

.shape-mauve {
    background-color: var(--color-pale-mauve);
}

/* --- Hover exploded-view effect --- */
/* Individual shapes separate 2-4px from group center on hover */
.shape-group:hover .shape:nth-child(1) {
    transform: translate(-3px, -3px);
}

.shape-group:hover .shape:nth-child(2) {
    transform: translate(3px, -2px);
}

.shape-group:hover .shape:nth-child(3) {
    transform: translate(-2px, 3px);
}

.shape-group:hover .shape:nth-child(4) {
    transform: translate(4px, 2px);
}

.shape-group:hover .shape:nth-child(5) {
    transform: translate(-3px, 4px);
}

.shape-group:hover .shape:nth-child(6) {
    transform: translate(2px, -4px);
}

/* --- Connecting Lines --- */
/* Thin 1-2px lines in Dusty Rose, gentle curves via rotation */
.connecting-line {
    position: absolute;
    pointer-events: none;
}

.line-1 {
    width: 180px;
    height: 1px;
    background-color: var(--color-dusty-rose);
    top: 45%;
    left: 20%;
    transform: rotate(15deg);
}

.line-1::after {
    content: '';
    position: absolute;
    width: 120px;
    height: 1px;
    background-color: var(--color-dusty-rose);
    top: 60px;
    left: 40px;
    transform: rotate(-25deg);
}

.line-2 {
    width: 140px;
    height: 1px;
    background-color: var(--color-dusty-rose);
    top: 40%;
    left: 35%;
    transform: rotate(-8deg);
}

.line-2::after {
    content: '';
    position: absolute;
    width: 100px;
    height: 1px;
    background-color: var(--color-dusty-rose);
    top: 50px;
    left: 20px;
    transform: rotate(18deg);
}

.line-3 {
    width: 160px;
    height: 1px;
    background-color: var(--color-dusty-rose);
    top: 50%;
    left: 30%;
    transform: rotate(5deg);
}

.line-3::after {
    content: '';
    position: absolute;
    width: 90px;
    height: 1px;
    background-color: var(--color-dusty-rose);
    top: -40px;
    left: 80px;
    transform: rotate(-30deg);
}

.line-4 {
    width: 200px;
    height: 1px;
    background-color: var(--color-dusty-rose);
    top: 45%;
    left: 20%;
    transform: rotate(-15deg);
}

.line-4::after {
    content: '';
    position: absolute;
    width: 150px;
    height: 1px;
    background-color: var(--color-dusty-rose);
    top: 80px;
    left: 30px;
    transform: rotate(20deg);
}

.line-5 {
    width: 180px;
    height: 1px;
    background-color: var(--color-dusty-rose);
    top: 50%;
    left: 40%;
    transform: rotate(10deg);
    opacity: 0.5;
}

.line-5::after {
    content: '';
    position: absolute;
    width: 130px;
    height: 1px;
    background-color: var(--color-dusty-rose);
    top: 40px;
    left: 50px;
    transform: rotate(-15deg);
    opacity: 0.4;
}

.line-6 {
    width: 150px;
    height: 1px;
    background-color: var(--color-dusty-rose);
    top: 42%;
    left: 30%;
    transform: rotate(-5deg);
}

.line-6::after {
    content: '';
    position: absolute;
    width: 100px;
    height: 1px;
    background-color: var(--color-dusty-rose);
    top: 50px;
    left: 30px;
    transform: rotate(12deg);
}

.line-7 {
    width: 170px;
    height: 1px;
    background-color: var(--color-dusty-rose);
    top: 48%;
    left: 25%;
    transform: rotate(8deg);
}

.line-7::after {
    content: '';
    position: absolute;
    width: 110px;
    height: 1px;
    background-color: var(--color-dusty-rose);
    top: -30px;
    left: 60px;
    transform: rotate(-20deg);
}

/* --- Concentric Rings --- */
/* Ambient pulsing ring motifs, very low opacity */
.concentric-rings {
    position: absolute;
    pointer-events: none;
    transform: translate(-50%, -50%);
}

.concentric-rings::before,
.concentric-rings::after {
    content: '';
    position: absolute;
    border-radius: 50%;
    border: solid var(--color-dusty-rose);
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

/* Subtle rings: smaller, 10% opacity */
.rings-subtle {
    width: 200px;
    height: 200px;
    opacity: 0.1;
    border-radius: 50%;
    border: 0.5px solid var(--color-dusty-rose);
    animation: ringPulse 8s ease-in-out infinite 1.5s;
}

.rings-subtle::before {
    width: 120px;
    height: 120px;
    border-width: 2px;
    animation: ringPulse 8s ease-in-out infinite;
}

.rings-subtle::after {
    width: 180px;
    height: 180px;
    border-width: 1px;
    animation: ringPulse 8s ease-in-out infinite 0.5s;
}

/* Large rings: bigger, 12% opacity */
.rings-large {
    width: 320px;
    height: 320px;
    opacity: 0.12;
    border-radius: 50%;
    border: 0.5px solid var(--color-dusty-rose);
    animation: ringPulse 8s ease-in-out infinite 2s;
}

.rings-large::before {
    width: 160px;
    height: 160px;
    border-width: 3px;
    animation: ringPulse 8s ease-in-out infinite;
}

.rings-large::after {
    width: 280px;
    height: 280px;
    border-width: 1px;
    animation: ringPulse 8s ease-in-out infinite 1s;
}

/* Ring pulse: 2% scale expansion over 8 seconds */
@keyframes ringPulse {
    0%, 100% {
        transform: translate(-50%, -50%) scale(1);
    }
    50% {
        transform: translate(-50%, -50%) scale(1.02);
    }
}

/* --- Scanline Overlay --- */
/* CRT scan-lines: 1px lines at 4px intervals, 3% opacity */
.scanline-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
    background: repeating-linear-gradient(
        to bottom,
        transparent,
        transparent 3px,
        var(--color-dusty-rose) 3px,
        var(--color-dusty-rose) 4px
    );
    opacity: 0.03;
}

/* --- Registration Marks --- */
/* Print-shop style "+" marks in DM Mono */
.registration-mark {
    position: absolute;
    font-family: var(--font-mono);
    font-size: 10px;
    color: var(--color-dusty-rose);
    opacity: 0.3;
    letter-spacing: 0;
    pointer-events: none;
    z-index: 2;
}

/* --- Panel Entrance Animations --- */
/* Shapes start invisible, fade in staggered when panel is in view */
.panel .shape {
    opacity: 0;
}

.panel .text-area .panel-number,
.panel .text-area .panel-title,
.panel .text-area .panel-caption {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.5s ease, transform 0.5s ease;
}

/* Active (visible) panel: shapes fade in with 100ms stagger */
.panel.in-view .shape:nth-child(1) { opacity: 1; transition-delay: 0ms; }
.panel.in-view .shape:nth-child(2) { opacity: 1; transition-delay: 100ms; }
.panel.in-view .shape:nth-child(3) { opacity: 1; transition-delay: 200ms; }
.panel.in-view .shape:nth-child(4) { opacity: 1; transition-delay: 300ms; }
.panel.in-view .shape:nth-child(5) { opacity: 1; transition-delay: 400ms; }
.panel.in-view .shape:nth-child(6) { opacity: 1; transition-delay: 500ms; }

/* Restore original opacity for fading-right shapes in exhaust panel */
.panel.in-view .fading-right:nth-child(1) { opacity: 0.7; }
.panel.in-view .fading-right:nth-child(2) { opacity: 0.5; }
.panel.in-view .fading-right:nth-child(3) { opacity: 0.3; }
.panel.in-view .fading-right:nth-child(4) { opacity: 0.4; }
.panel.in-view .fading-right:nth-child(5) { opacity: 0.2; }

/* Text slides up from 20px below, fading in, 200ms after last shape */
.panel.in-view .text-area .panel-number {
    opacity: 1;
    transform: translateY(0);
    transition-delay: 700ms;
}

.panel.in-view .text-area .panel-title {
    opacity: 1;
    transform: translateY(0);
    transition-delay: 800ms;
}

.panel.in-view .text-area .panel-caption {
    opacity: 1;
    transform: translateY(0);
    transition-delay: 900ms;
}

/* Connecting lines fade in */
.panel .connecting-line {
    opacity: 0;
    transition: opacity 0.6s ease;
}

.panel.in-view .connecting-line {
    opacity: 1;
    transition-delay: 300ms;
}

/* Registration marks fade in */
.panel .registration-mark {
    opacity: 0;
    transition: opacity 0.6s ease;
}

.panel.in-view .registration-mark {
    opacity: 0.3;
    transition-delay: 600ms;
}

/* Concentric rings fade in */
.panel .concentric-rings {
    opacity: 0;
    transition: opacity 0.8s ease;
}

.panel.in-view .concentric-rings.rings-subtle {
    opacity: 0.1;
    transition-delay: 200ms;
}

.panel.in-view .concentric-rings.rings-large {
    opacity: 0.12;
    transition-delay: 200ms;
}

/* --- Specific Panel Overrides --- */

/* Panel 1: entering shapes from left */
.panel-1.in-view .shape.entering-left {
    opacity: 1;
}

/* Ignition core: warm ambient glow */
.ignition-core {
    box-shadow: 0 0 60px rgba(232, 200, 160, 0.3);
}

/* --- Responsive: Stack to vertical on narrow viewports --- */
@media (max-width: 768px) {
    .panel-content {
        flex-direction: column;
    }

    .panel-text-left,
    .panel-text-right {
        flex-direction: column;
    }

    .text-area,
    .panel-text-left .text-area,
    .panel-text-right .text-area {
        width: 100%;
        height: 40%;
        padding: 8vw;
    }

    .visual-area,
    .panel-text-left .visual-area,
    .panel-text-right .visual-area {
        width: 100%;
        height: 60%;
    }

    .dot-nav {
        bottom: 16px;
        gap: 8px;
    }
}

@media (max-width: 480px) {
    .panel-title {
        font-size: clamp(1.8rem, 8vw, 2.5rem);
    }

    .panel-caption {
        font-size: clamp(0.85rem, 3.5vw, 1rem);
    }

    .text-area,
    .panel-text-left .text-area,
    .panel-text-right .text-area {
        padding: 6vw;
    }
}
