/* ==========================================================================
   opensource.bid — Surreal Auction of Open Source
   Colors: #1A1840 #D0A040 #F0ECE8 #E06858 #808890 #7850A0 #E8E0D0
   Fonts: Caveat (handwritten), Source Serif 4 (body)
   ========================================================================== */

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

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

body {
    background: #1A1840;
    color: #F0ECE8;
    font-family: 'Source Serif 4', 'Georgia', serif;
    font-weight: 400;
    font-size: clamp(15px, 1vw, 17px);
    line-height: 1.8;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

/* --- Grid Overlay (Fixed) --- */
.grid-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 100;
    pointer-events: none;
}

.grid-line {
    stroke: #808890;
    stroke-width: 0.5;
    opacity: 0.05;
    transition: opacity 0.3s ease;
}

.grid-line.brightened {
    opacity: 0.12;
}

.grid-label {
    font-family: 'Source Serif 4', serif;
    font-size: 11px;
    fill: #808890;
    opacity: 0.25;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

/* Grid line draw animation */
.grid-line {
    stroke-dasharray: 2000;
    stroke-dashoffset: 2000;
    animation: drawGridLine 1500ms ease-out forwards;
}

.h-line:nth-child(1) { animation-delay: 0ms; }
.h-line:nth-child(2) { animation-delay: 60ms; }
.h-line:nth-child(3) { animation-delay: 120ms; }
.h-line:nth-child(4) { animation-delay: 180ms; }
.h-line:nth-child(5) { animation-delay: 240ms; }
.h-line:nth-child(6) { animation-delay: 300ms; }
.h-line:nth-child(7) { animation-delay: 360ms; }
.v-line:nth-child(8) { animation-delay: 100ms; }
.v-line:nth-child(9) { animation-delay: 160ms; }
.v-line:nth-child(10) { animation-delay: 220ms; }
.v-line:nth-child(11) { animation-delay: 280ms; }
.v-line:nth-child(12) { animation-delay: 340ms; }
.v-line:nth-child(13) { animation-delay: 400ms; }
.v-line:nth-child(14) { animation-delay: 460ms; }

@keyframes drawGridLine {
    to {
        stroke-dashoffset: 0;
    }
}

/* --- Auction Hall Entrance (Hero) --- */
.auction-hall {
    position: relative;
    width: 100%;
    height: 100vh;
    min-height: 600px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #1A1840 0%, #1A1840 60%, #2a2060 100%);
    overflow: hidden;
    perspective: 1000px;
    transform-style: preserve-3d;
}

/* Amber washes */
.amber-wash {
    position: absolute;
    border-radius: 50%;
    background: radial-gradient(ellipse at center, rgba(208, 160, 64, 0.12) 0%, transparent 70%);
    pointer-events: none;
    opacity: 0;
    animation: bloomWash 3000ms ease-in-out forwards;
}

.wash-1 {
    width: 600px;
    height: 600px;
    top: -10%;
    right: -5%;
    animation-delay: 800ms;
}

.wash-2 {
    width: 400px;
    height: 400px;
    bottom: 10%;
    left: -5%;
    animation-delay: 1200ms;
}

.wash-3 {
    width: 500px;
    height: 500px;
    top: 40%;
    left: 50%;
    transform: translateX(-50%);
    animation-delay: 1600ms;
}

@keyframes bloomWash {
    0% { opacity: 0; transform: scale(0.6); }
    100% { opacity: 1; transform: scale(1); }
}

/* --- Depth Layers --- */
.depth-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
}

.layer-bg {
    z-index: 1;
    transform: translateZ(-80px) scale(1.08);
}

.layer-mid {
    z-index: 2;
    transform: translateZ(-40px) scale(1.04);
}

.layer-fg {
    z-index: 3;
    transform: translateZ(0px);
    pointer-events: auto;
    flex-direction: column;
    text-align: center;
}

/* --- Impossible Objects (Hero) --- */
.impossible-obj {
    position: absolute;
    opacity: 0;
    animation: fadeInObj 600ms ease-out forwards;
    transition: transform 0.3s ease;
}

.impossible-obj:hover {
    transform: scale(1.05);
}

.impossible-obj svg path,
.impossible-obj svg line,
.impossible-obj svg rect,
.impossible-obj svg circle,
.impossible-obj svg ellipse {
    transition: stroke 0.3s ease;
}

.obj-1 {
    top: 15%;
    left: 8%;
    animation-delay: 1400ms;
}

.obj-2 {
    top: 55%;
    right: 10%;
    animation-delay: 1600ms;
}

.obj-3 {
    bottom: 20%;
    left: 25%;
    animation-delay: 1800ms;
}

.obj-4 {
    top: 10%;
    right: 20%;
    animation-delay: 1200ms;
}

.obj-5 {
    bottom: 15%;
    right: 30%;
    animation-delay: 1000ms;
}

@keyframes fadeInObj {
    0% { opacity: 0; transform: translateY(20px); }
    100% { opacity: 0.8; transform: translateY(0); }
}

/* --- Site Title --- */
.site-title {
    font-family: 'Caveat', cursive;
    font-weight: 700;
    font-size: clamp(28px, 3.5vw, 56px);
    color: #F0ECE8;
    letter-spacing: 0.02em;
    opacity: 0;
    transform: scale(0.5);
    animation: titleGrow 800ms cubic-bezier(0.34, 1.56, 0.64, 1) 500ms forwards;
    text-shadow: 0 0 60px rgba(208, 160, 64, 0.3);
    transition: transform 0.2s ease, color 0.2s ease;
}

.site-title:hover {
    transform: scale(1.02) rotate(1deg);
    color: #D0A040;
}

@keyframes titleGrow {
    0% { opacity: 0; transform: scale(0.5); }
    100% { opacity: 1; transform: scale(1); }
}

.site-subtitle {
    font-family: 'Source Serif 4', serif;
    font-size: clamp(14px, 1.2vw, 18px);
    color: #D0A040;
    margin-top: 16px;
    opacity: 0;
    animation: fadeUp 600ms ease-out 1300ms forwards;
    letter-spacing: 0.04em;
}

@keyframes fadeUp {
    0% { opacity: 0; transform: translateY(12px); }
    100% { opacity: 0.8; transform: translateY(0); }
}

/* --- Surreal Interludes --- */
.surreal-interlude {
    position: relative;
    width: 100%;
    min-height: 50vh;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 60px;
    padding: 80px 40px;
    overflow: hidden;
}

.interlude-1 {
    background: linear-gradient(180deg, #1A1840 0%, #1e1c4a 50%, #1A1840 100%);
}

.interlude-2 {
    background: linear-gradient(180deg, #1A1840 0%, #201840 50%, #1A1840 100%);
}

.interlude-content {
    max-width: 400px;
    opacity: 0;
    transition: opacity 0.6s ease, transform 0.6s ease;
}

.interlude-content.visible {
    opacity: 1;
    transform: translateX(0) !important;
}

.layer-left {
    transform: translateX(-40px);
}

.layer-right {
    transform: translateX(40px);
}

.interlude-text {
    font-family: 'Caveat', cursive;
    font-weight: 400;
    font-size: clamp(24px, 2.5vw, 40px);
    color: #D0A040;
    line-height: 1.4;
}

.interlude-illustration {
    display: block;
    max-width: 100%;
    height: auto;
}

.interlude-label {
    font-family: 'Source Serif 4', serif;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

/* --- Bid Gallery --- */
.bid-gallery {
    position: relative;
    max-width: 900px;
    margin: 0 auto;
    padding: 80px 40px;
    perspective: 1000px;
    transform-style: preserve-3d;
}

.gallery-title {
    font-family: 'Caveat', cursive;
    font-weight: 700;
    font-size: clamp(28px, 3.5vw, 56px);
    color: #D0A040;
    text-align: center;
    margin-bottom: 60px;
    opacity: 0;
    transition: opacity 0.6s ease, transform 0.6s ease;
    transform: translateY(20px);
}

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

.gallery-secondary {
    background: linear-gradient(180deg, transparent 0%, rgba(120, 80, 160, 0.05) 50%, transparent 100%);
}

/* --- Bid Cards --- */
.bid-card {
    position: relative;
    margin-bottom: 60px;
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.5s ease, transform 0.5s ease;
    cursor: pointer;
}

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

.bid-card.wobble {
    animation: wobbleIn 200ms ease-out;
}

@keyframes wobbleIn {
    0% { transform: rotate(-1deg); }
    50% { transform: rotate(1deg); }
    100% { transform: rotate(0deg); }
}

.bid-card-inner {
    display: flex;
    gap: 40px;
    align-items: center;
    background: rgba(232, 224, 208, 0.04);
    border: 1px solid rgba(208, 160, 64, 0.15);
    border-radius: 2px;
    padding: 40px;
    transition: transform 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94),
                box-shadow 0.4s ease,
                background 0.3s ease;
}

.bid-card:hover .bid-card-inner {
    transform: translateY(-4px);
    box-shadow: 0 20px 60px rgba(26, 24, 64, 0.6), 0 0 30px rgba(208, 160, 64, 0.08);
    background: rgba(232, 224, 208, 0.06);
}

/* Alternate card layout direction */
.bid-card:nth-child(even) .bid-card-inner {
    flex-direction: row-reverse;
}

.bid-card-illustration {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.bid-card-illustration svg {
    transition: transform 0.3s ease;
}

.bid-card:hover .bid-card-illustration svg {
    transform: scale(1.05);
}

/* Hover: line illustrations gain amber stroke */
.bid-card:hover .bid-card-illustration svg path,
.bid-card:hover .bid-card-illustration svg line,
.bid-card:hover .bid-card-illustration svg rect,
.bid-card:hover .bid-card-illustration svg ellipse,
.bid-card:hover .bid-card-illustration svg circle {
    stroke: #D0A040;
    transition: stroke 0.3s ease;
}

.bid-card-content {
    flex: 1;
}

.bid-item-title {
    font-family: 'Caveat', cursive;
    font-weight: 700;
    font-size: clamp(22px, 2.5vw, 36px);
    color: #F0ECE8;
    margin-bottom: 12px;
    transition: transform 0.2s ease;
}

.bid-card:hover .bid-item-title {
    transform: rotate(0.5deg) scale(1.01);
}

.bid-item-desc {
    font-family: 'Source Serif 4', serif;
    font-size: clamp(15px, 1vw, 17px);
    color: rgba(240, 236, 232, 0.7);
    line-height: 1.8;
    margin-bottom: 20px;
}

.bid-item-label {
    font-family: 'Source Serif 4', serif;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.bid-amount {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.bid-label {
    font-family: 'Source Serif 4', serif;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #808890;
}

.bid-value {
    font-family: 'Caveat', cursive;
    font-weight: 400;
    font-size: clamp(24px, 2.5vw, 40px);
    color: #E06858;
    transition: color 0.3s ease;
}

.bid-card:hover .bid-value {
    color: #D0A040;
}

/* --- Zoom Focus --- */
.bid-card.zoomed .bid-card-inner {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(1);
    z-index: 1001;
    max-width: 800px;
    width: 90vw;
    background: #E8E0D0;
    border-color: #D0A040;
    box-shadow: 0 40px 120px rgba(0, 0, 0, 0.8);
}

.bid-card.zoomed .bid-item-title {
    color: #1A1840;
}

.bid-card.zoomed .bid-item-desc {
    color: rgba(26, 24, 64, 0.8);
}

.bid-card.zoomed .bid-label {
    color: #1A1840;
}

.zoom-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(26, 24, 64, 0.6);
    z-index: 1000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.4s ease;
}

.zoom-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

/* --- Closing Lot (Footer) --- */
.closing-lot {
    position: relative;
    width: 100%;
    min-height: 80vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: linear-gradient(180deg, #1A1840 0%, #0f0e28 100%);
    overflow: hidden;
    padding: 80px 40px;
}

.vanishing-grid {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
}

.vanishing-svg {
    width: 100%;
    max-width: 800px;
    height: auto;
    opacity: 0.6;
}

.closing-content {
    position: relative;
    z-index: 2;
    text-align: center;
    max-width: 600px;
}

.closing-title {
    font-family: 'Caveat', cursive;
    font-weight: 700;
    font-size: clamp(28px, 3.5vw, 56px);
    color: #D0A040;
    margin-bottom: 24px;
}

.closing-desc {
    font-family: 'Source Serif 4', serif;
    font-size: clamp(15px, 1vw, 17px);
    color: rgba(240, 236, 232, 0.6);
    line-height: 1.8;
    margin-bottom: 40px;
}

.closing-domain {
    font-family: 'Caveat', cursive;
    font-weight: 700;
    font-size: clamp(24px, 2.5vw, 40px);
    color: #F0ECE8;
    margin-bottom: 12px;
    transition: transform 0.2s ease;
}

.closing-domain:hover {
    transform: scale(1.02) rotate(1deg);
    color: #D0A040;
}

.closing-note {
    font-family: 'Source Serif 4', serif;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: #808890;
    margin-top: 20px;
}

/* --- Duotone Section Washes --- */
.bid-gallery::before {
    content: '';
    position: absolute;
    top: 0;
    left: -50vw;
    width: 200vw;
    height: 100%;
    background: linear-gradient(180deg, transparent 0%, rgba(208, 160, 64, 0.03) 30%, rgba(120, 80, 160, 0.02) 70%, transparent 100%);
    pointer-events: none;
    z-index: -1;
}

/* --- Responsive --- */
@media (max-width: 768px) {
    .bid-card-inner {
        flex-direction: column !important;
        padding: 28px;
        gap: 24px;
    }

    .bid-card-illustration svg {
        width: 150px;
        height: 150px;
    }

    .surreal-interlude {
        flex-direction: column;
        gap: 30px;
        padding: 60px 24px;
    }

    .interlude-content {
        max-width: 100%;
    }

    .bid-gallery {
        padding: 60px 24px;
    }

    .closing-lot {
        padding: 60px 24px;
    }

    .layer-bg .impossible-obj,
    .layer-mid .impossible-obj {
        transform: scale(0.7);
    }

    .bid-card.zoomed .bid-card-inner {
        width: 95vw;
        padding: 24px;
    }
}

@media (max-width: 480px) {
    .bid-card-illustration svg {
        width: 120px;
        height: 120px;
    }

    .impossible-obj {
        display: none;
    }

    .layer-bg,
    .layer-mid {
        display: none;
    }
}

/* --- Parallax scroll modifier classes (applied via JS) --- */
.parallax-bg {
    will-change: transform;
}

.parallax-mid {
    will-change: transform;
}

/* --- Selection color --- */
::selection {
    background: rgba(208, 160, 64, 0.3);
    color: #F0ECE8;
}
