/* ===================================================
   a6c.quest - Luxury Hardware for the Digital Frontier
   Leather x Circuitboard Maximalist Design
   =================================================== */

/* CSS Custom Properties */
:root {
    --deep-cognac: #2C1810;
    --warm-parchment: #F5E6D0;
    --hot-pink: #FF6B9D;
    --electric-gold: #FFD93D;
    --matrix-green: #6BCB77;
    --tangerine-burst: #FF8C42;
    --violet-luxe: #C77DFF;
    --espresso-leather: #1A0E08;
    --toffee: #8B5E3C;
    --champagne-fizz: #FFF0CC;

    --font-heading: 'Libre Baskerville', 'Georgia', serif;
    --font-body: 'Lato', 'Helvetica Neue', sans-serif;
    --font-mono: 'IBM Plex Mono', 'Courier New', monospace;
}

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

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

body {
    font-family: var(--font-body);
    color: var(--warm-parchment);
    background: var(--espresso-leather);
    overflow-x: hidden;
}

.svg-defs {
    position: absolute;
    width: 0;
    height: 0;
    overflow: hidden;
}

/* ===================================================
   CHAMBER BASE STYLES
   =================================================== */

.chamber {
    position: relative;
    width: 100%;
    min-height: 100vh;
    overflow: hidden;
}

/* Leather Grain Overlay */
.leather-grain-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(145deg, #2C1810 0%, #8B5E3C 40%, #2C1810 100%);
    opacity: 0.08;
    filter: url(#leather-grain);
    pointer-events: none;
    z-index: 1;
}

/* Circuit Pattern Overlay */
.circuit-pattern-overlay {
    position: absolute;
    inset: 0;
    background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cpath d='M10 60 H50 V30 H80' fill='none' stroke='%238B5E3C' stroke-width='1' opacity='0.15'/%3E%3Cpath d='M60 10 V50 H100 V90' fill='none' stroke='%238B5E3C' stroke-width='1' opacity='0.15'/%3E%3Cpath d='M30 110 H70 V80 H110' fill='none' stroke='%238B5E3C' stroke-width='1' opacity='0.15'/%3E%3Ccircle cx='50' cy='60' r='3' fill='%238B5E3C' opacity='0.12'/%3E%3Ccircle cx='80' cy='30' r='3' fill='%238B5E3C' opacity='0.12'/%3E%3Ccircle cx='100' cy='50' r='3' fill='%238B5E3C' opacity='0.12'/%3E%3C/svg%3E") repeat;
    pointer-events: none;
    z-index: 1;
}

/* Background Particles */
.particles {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 2;
}

.particle {
    position: absolute;
    width: 2px;
    height: 2px;
    border-radius: 50%;
    opacity: 0.15;
    animation: float-up linear infinite;
}

@keyframes float-up {
    0% {
        transform: translateY(0) translateX(0);
        opacity: 0;
    }
    10% {
        opacity: 0.15;
    }
    90% {
        opacity: 0.15;
    }
    100% {
        transform: translateY(-100vh) translateX(20px);
        opacity: 0;
    }
}

/* ===================================================
   CHAMBER 1: THE FOYER
   =================================================== */

#chamber-foyer {
    background: var(--espresso-leather);
    display: flex;
    align-items: center;
    justify-content: flex-start;
    box-shadow: inset 0 2px 4px rgba(255, 240, 200, 0.15), inset 0 -2px 4px rgba(0, 0, 0, 0.3);
}

.foyer-content {
    position: relative;
    z-index: 10;
    padding-left: 8%;
    max-width: 40%;
}

.brand-wordmark {
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: clamp(48px, 6vw, 80px);
    color: var(--warm-parchment);
    letter-spacing: -0.015em;
    line-height: 1.1;
    text-shadow: 2px 2px 0px var(--hot-pink);
    margin-bottom: 16px;
}

.brand-tagline {
    font-family: var(--font-heading);
    font-weight: 400;
    font-style: italic;
    font-size: clamp(18px, 2.5vw, 32px);
    color: var(--hot-pink);
    letter-spacing: 0.02em;
    line-height: 1.4;
}

.foyer-circuit-trace {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    z-index: 5;
    pointer-events: none;
}

.circuit-path-main {
    stroke-dasharray: 1600;
    stroke-dashoffset: 0;
}

/* Scroll indicator */
.scroll-indicator {
    position: absolute;
    bottom: 40px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 10;
    animation: bob 2s ease-in-out infinite;
}

.scroll-chevron {
    display: block;
    width: 24px;
    height: 24px;
    border-right: 3px solid var(--electric-gold);
    border-bottom: 3px solid var(--electric-gold);
    transform: rotate(45deg);
    opacity: 0.8;
}

@keyframes bob {
    0%, 100% { transform: translateX(-50%) translateY(0); }
    50% { transform: translateX(-50%) translateY(12px); }
}

/* ===================================================
   CIRCUIT NODE ANIMATIONS
   =================================================== */

.circuit-node {
    transition: all 0.3s ease;
}

.pulse-pink {
    animation: pulse-pink-anim 3s ease-in-out infinite;
}

.pulse-gold {
    animation: pulse-gold-anim 3s ease-in-out infinite 0.5s;
}

.pulse-green {
    animation: pulse-green-anim 3s ease-in-out infinite 1s;
}

.pulse-orange {
    animation: pulse-orange-anim 3s ease-in-out infinite 1.5s;
}

.pulse-violet {
    animation: pulse-violet-anim 3s ease-in-out infinite 2s;
}

@keyframes pulse-pink-anim {
    0%, 100% { filter: drop-shadow(0 0 4px #FF6B9D); }
    50% { filter: drop-shadow(0 0 16px #FF6B9D) drop-shadow(0 0 32px rgba(255, 107, 157, 0.3)); }
}

@keyframes pulse-gold-anim {
    0%, 100% { filter: drop-shadow(0 0 4px #FFD93D); }
    50% { filter: drop-shadow(0 0 16px #FFD93D) drop-shadow(0 0 32px rgba(255, 217, 61, 0.3)); }
}

@keyframes pulse-green-anim {
    0%, 100% { filter: drop-shadow(0 0 4px #6BCB77); }
    50% { filter: drop-shadow(0 0 16px #6BCB77) drop-shadow(0 0 32px rgba(107, 203, 119, 0.3)); }
}

@keyframes pulse-orange-anim {
    0%, 100% { filter: drop-shadow(0 0 4px #FF8C42); }
    50% { filter: drop-shadow(0 0 16px #FF8C42) drop-shadow(0 0 32px rgba(255, 140, 66, 0.3)); }
}

@keyframes pulse-violet-anim {
    0%, 100% { filter: drop-shadow(0 0 4px #C77DFF); }
    50% { filter: drop-shadow(0 0 16px #C77DFF) drop-shadow(0 0 32px rgba(199, 125, 255, 0.3)); }
}

/* Data flow dots */
.data-flow-dot {
    opacity: 0.9;
}

/* ===================================================
   CHAMBER 2: THE ATELIER
   =================================================== */

#chamber-atelier {
    background: linear-gradient(160deg, var(--espresso-leather) 0%, #2C1810 50%, var(--espresso-leather) 100%);
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-rows: 1fr 1fr;
    gap: 32px;
    padding: 60px 5%;
    box-shadow: inset 0 2px 4px rgba(255, 240, 200, 0.15), inset 0 -2px 4px rgba(0, 0, 0, 0.3);
}

.z-connector {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    z-index: 3;
    pointer-events: none;
}

.z-quadrant {
    position: relative;
    z-index: 5;
    display: flex;
    align-items: center;
    justify-content: center;
}

.z-upper-left { justify-content: flex-start; align-items: flex-start; padding-top: 40px; padding-left: 20px; }
.z-upper-right { justify-content: flex-end; align-items: flex-start; padding-top: 40px; padding-right: 20px; }
.z-lower-left { justify-content: flex-start; align-items: flex-end; padding-bottom: 40px; padding-left: 20px; }
.z-lower-right { justify-content: flex-end; align-items: flex-end; padding-bottom: 40px; padding-right: 20px; }

/* Circuit Cluster */
.circuit-cluster {
    width: 300px;
    height: 250px;
}

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

.circuit-label {
    font-family: var(--font-mono);
    font-size: 10px;
    fill: var(--matrix-green);
    opacity: 0.7;
}

/* Parchment Panel */
.parchment-panel {
    background: var(--warm-parchment);
    padding: 40px 36px;
    border-radius: 8px;
    max-width: 420px;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.35);
    border: 2px dashed var(--electric-gold);
    position: relative;
    transition: box-shadow 0.3s ease;
}

.parchment-panel:hover {
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.35), inset 0 4px 8px rgba(0, 0, 0, 0.1);
}

.parchment-panel .body-text {
    font-family: var(--font-body);
    font-weight: 400;
    font-size: 17px;
    line-height: 1.65;
    letter-spacing: 0.01em;
    color: var(--deep-cognac);
    margin-bottom: 16px;
}

.parchment-panel .body-text:last-child {
    margin-bottom: 0;
}

/* Section Divider */
.section-divider {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 10;
    height: 30px;
}

.section-divider svg {
    width: 100%;
    height: 20px;
}

.divider-gradient-band {
    height: 4px;
    background: linear-gradient(90deg, var(--hot-pink), var(--electric-gold), var(--matrix-green));
    opacity: 0.6;
}

/* ===================================================
   CARD-FLIP SYSTEM
   =================================================== */

.card-flip {
    width: 320px;
    height: 420px;
    perspective: 1200px;
    cursor: pointer;
}

.card-inner {
    position: relative;
    width: 100%;
    height: 100%;
    transform-style: preserve-3d;
    transition: transform 0.7s cubic-bezier(0.4, 0, 0.2, 1);
}

.card-flip.flipped .card-inner {
    transform: rotateY(180deg);
}

.card-front, .card-back {
    position: absolute;
    inset: 0;
    backface-visibility: hidden;
    border-radius: 8px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 32px;
    text-align: center;
}

/* Card Front - Leather texture */
.card-front {
    background: linear-gradient(145deg, #3D2418 0%, #2C1810 60%, #1A0E08 100%);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.35),
                inset 0 2px 4px rgba(255, 240, 200, 0.15),
                inset 0 -2px 4px rgba(0, 0, 0, 0.3);
    border: 2px dashed var(--electric-gold);
    transition: box-shadow 0.3s ease;
}

.card-flip:hover .card-front {
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.4),
                inset 0 4px 8px rgba(255, 240, 200, 0.1),
                inset 0 -4px 8px rgba(0, 0, 0, 0.4);
}

.card-circuit-emboss {
    position: absolute;
    inset: 0;
    background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cpath d='M10 60 H50 V30 H80' fill='none' stroke='%238B5E3C' stroke-width='1' opacity='0.12'/%3E%3Cpath d='M60 10 V50 H100 V90' fill='none' stroke='%238B5E3C' stroke-width='1' opacity='0.12'/%3E%3Ccircle cx='50' cy='60' r='2' fill='%238B5E3C' opacity='0.1'/%3E%3Ccircle cx='100' cy='50' r='2' fill='%238B5E3C' opacity='0.1'/%3E%3C/svg%3E") repeat;
    opacity: 0.5;
    pointer-events: none;
}

.card-title {
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: 36px;
    color: var(--warm-parchment);
    letter-spacing: -0.015em;
    line-height: 1.1;
    text-shadow: 2px 2px 0px var(--hot-pink);
    margin-bottom: 12px;
    position: relative;
    z-index: 2;
}

.card-subtitle {
    font-family: var(--font-heading);
    font-weight: 400;
    font-style: italic;
    font-size: 20px;
    color: var(--electric-gold);
    margin-bottom: 12px;
    position: relative;
    z-index: 2;
}

.card-mono-label {
    font-family: var(--font-mono);
    font-size: 13px;
    color: var(--matrix-green);
    opacity: 0.7;
    position: relative;
    z-index: 2;
}

/* Card Back - Candy gradient */
.card-back {
    background: linear-gradient(135deg, #FF6B9D, #C77DFF, #FFD93D);
    transform: rotateY(180deg);
}

.card-back-circuit {
    position: absolute;
    inset: 0;
    background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cpath d='M10 60 H50 V30 H80' fill='none' stroke='white' stroke-width='1.5' opacity='0.25'/%3E%3Cpath d='M60 10 V50 H100 V90' fill='none' stroke='white' stroke-width='1.5' opacity='0.25'/%3E%3Cpath d='M30 110 H70 V80 H110' fill='none' stroke='white' stroke-width='1.5' opacity='0.25'/%3E%3Ccircle cx='50' cy='60' r='3' fill='white' opacity='0.2'/%3E%3Ccircle cx='80' cy='30' r='3' fill='white' opacity='0.2'/%3E%3Ccircle cx='100' cy='50' r='3' fill='white' opacity='0.2'/%3E%3C/svg%3E") repeat;
    opacity: 0.6;
    pointer-events: none;
}

.card-back-title {
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: 32px;
    color: white;
    letter-spacing: -0.015em;
    line-height: 1.1;
    margin-bottom: 16px;
    position: relative;
    z-index: 2;
}

.card-back-text {
    font-family: var(--font-body);
    font-weight: 400;
    font-size: 16px;
    line-height: 1.65;
    color: white;
    position: relative;
    z-index: 2;
}

.card-mono-back {
    margin-top: 16px;
    color: rgba(255, 255, 255, 0.7);
}

/* Card rotation variants */
.card-rotate-pos {
    transform: rotate(2deg);
}

.card-rotate-neg {
    transform: rotate(-2deg);
}

/* Card entry animation */
.card-entry {
    opacity: 0;
    transform: scale(0.92);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

.card-entry.visible {
    opacity: 1;
    transform: scale(1);
}

.card-entry.visible.card-rotate-pos {
    transform: scale(1) rotate(2deg);
}

.card-entry.visible.card-rotate-neg {
    transform: scale(1) rotate(-2deg);
}

/* ===================================================
   CHAMBER 3: THE GALLERY
   =================================================== */

#chamber-gallery {
    background: linear-gradient(180deg, var(--espresso-leather) 0%, #2C1810 50%, var(--espresso-leather) 100%);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 5%;
    box-shadow: inset 0 2px 4px rgba(255, 240, 200, 0.15), inset 0 -2px 4px rgba(0, 0, 0, 0.3);
}

.section-heading {
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: clamp(40px, 5vw, 64px);
    color: var(--warm-parchment);
    letter-spacing: -0.015em;
    line-height: 1.1;
    text-shadow: 2px 2px 0px var(--hot-pink);
    margin-bottom: 48px;
    text-align: center;
    position: relative;
    z-index: 5;
}

.card-grid {
    display: grid;
    grid-template-columns: repeat(3, 320px);
    grid-template-rows: repeat(2, 420px);
    gap: 40px;
    position: relative;
    z-index: 5;
}

/* ===================================================
   CHAMBER 4: THE CONVERGENCE
   =================================================== */

#chamber-convergence {
    background: radial-gradient(ellipse at center, #2C1810 0%, var(--espresso-leather) 70%);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 5%;
    box-shadow: inset 0 2px 4px rgba(255, 240, 200, 0.15), inset 0 -2px 4px rgba(0, 0, 0, 0.3);
}

.convergence-circuits {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    z-index: 3;
    pointer-events: none;
}

.convergence-panel {
    position: absolute;
    z-index: 5;
    background: linear-gradient(145deg, #3D2418 0%, #2C1810 100%);
    padding: 36px 32px;
    border-radius: 8px;
    max-width: 340px;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.35),
                inset 0 2px 4px rgba(255, 240, 200, 0.15),
                inset 0 -2px 4px rgba(0, 0, 0, 0.3);
    border: 2px dashed var(--electric-gold);
    transition: box-shadow 0.3s ease;
}

.convergence-panel:hover {
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.4),
                inset 0 4px 8px rgba(255, 240, 200, 0.1),
                inset 0 -4px 8px rgba(0, 0, 0, 0.4);
}

.panel-left {
    top: 15%;
    left: 5%;
}

.panel-right {
    top: 15%;
    right: 5%;
}

.panel-heading {
    font-family: var(--font-heading);
    font-weight: 400;
    font-style: italic;
    font-size: 24px;
    color: var(--hot-pink);
    margin-bottom: 16px;
    line-height: 1.3;
}

.convergence-panel .body-text {
    font-family: var(--font-body);
    font-weight: 400;
    font-size: 17px;
    line-height: 1.65;
    letter-spacing: 0.01em;
    color: var(--warm-parchment);
}

.convergence-card-wrapper {
    position: relative;
    z-index: 10;
}

.card-culminating {
    width: 360px;
    height: 460px;
}

.convergence-gradient-wash {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 120px;
    background: linear-gradient(0deg, rgba(255, 107, 157, 0.1) 0%, rgba(255, 217, 61, 0.05) 50%, transparent 100%);
    z-index: 2;
    pointer-events: none;
}

.convergence-footer {
    position: absolute;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 10;
    text-align: center;
}

.footer-text {
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: 18px;
    color: var(--warm-parchment);
    opacity: 0.6;
    margin-bottom: 8px;
}

.footer-circuit {
    width: 200px;
    height: 10px;
    display: block;
    margin: 0 auto;
}

/* ===================================================
   CORNER ORNAMENTS
   =================================================== */

.corner-ornament {
    opacity: 0.6;
}

/* ===================================================
   RESPONSIVE ADJUSTMENTS
   =================================================== */

@media (max-width: 1100px) {
    .card-grid {
        grid-template-columns: repeat(2, 300px);
        grid-template-rows: repeat(3, 400px);
        gap: 32px;
    }

    .card-flip {
        width: 300px;
        height: 400px;
    }

    #chamber-atelier {
        padding: 40px 3%;
        gap: 24px;
    }

    .parchment-panel {
        max-width: 360px;
        padding: 30px 28px;
    }

    .panel-left,
    .panel-right {
        position: relative;
        top: auto;
        left: auto;
        right: auto;
        max-width: 90%;
        margin: 16px auto;
    }

    #chamber-convergence {
        padding-top: 240px;
    }
}

@media (max-width: 768px) {
    .foyer-content {
        padding-left: 6%;
        max-width: 80%;
    }

    #chamber-atelier {
        grid-template-columns: 1fr;
        grid-template-rows: auto;
        padding: 40px 5%;
    }

    .z-upper-left,
    .z-upper-right,
    .z-lower-left,
    .z-lower-right {
        justify-content: center;
        align-items: center;
        padding: 20px 0;
    }

    .card-grid {
        grid-template-columns: 1fr;
        grid-template-rows: auto;
        gap: 24px;
    }

    .card-flip {
        width: 90vw;
        max-width: 320px;
        height: 400px;
    }

    .card-rotate-pos,
    .card-rotate-neg {
        transform: none;
    }

    .card-entry.visible.card-rotate-pos,
    .card-entry.visible.card-rotate-neg {
        transform: scale(1);
    }

    #chamber-gallery {
        min-height: auto;
        padding: 60px 5% 80px;
    }

    #chamber-convergence {
        padding-top: 300px;
        min-height: auto;
        padding-bottom: 100px;
    }

    .convergence-panel {
        max-width: 85vw;
    }

    .circuit-cluster {
        width: 260px;
        height: 200px;
    }

    .card-culminating {
        width: 90vw;
        max-width: 340px;
        height: 440px;
    }
}

@media (max-width: 480px) {
    .brand-wordmark {
        font-size: 40px;
    }

    .brand-tagline {
        font-size: 16px;
    }

    .section-heading {
        font-size: 32px;
    }

    .card-title {
        font-size: 28px;
    }

    .card-back-title {
        font-size: 26px;
    }
}
