/* lowball.dev - Fairycore Auction House */

/* ===== CSS Custom Properties ===== */
:root {
    --moth-wing: #f5f0eb;
    --velvet-umber: #2a1f2d;
    --foxglove: #9b6b9e;
    --pressed-rose: #c2787e;
    --tarnished-gold: #c4a35a;
    --deep-umber: #3d2b1f;
    --warm-charcoal: #4a3f35;
    --dew-drop: #e8d4f0;
    --brass: #8a6b4a;
    --parchment: #f0e6d8;

    --font-headline: 'Cormorant Garamond', 'Georgia', serif;
    --font-body: 'Nunito', 'Helvetica Neue', sans-serif;
    --font-accent: 'Caveat', cursive;

    --cell-border: rgba(138, 115, 89, 0.25);
    --cell-padding: clamp(1.2rem, 3vw, 2.4rem);
    --chamber-gap: clamp(4rem, 8vh, 8rem);
}

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

html {
    scroll-behavior: smooth;
}

body {
    background-color: var(--moth-wing);
    color: var(--deep-umber);
    font-family: var(--font-body);
    font-weight: 400;
    font-size: clamp(0.95rem, 1.8vw, 1.15rem);
    line-height: 1.72;
    overflow-x: hidden;
}

/* ===== SVG Filters (Hidden) ===== */
.svg-filters {
    position: absolute;
    width: 0;
    height: 0;
    overflow: hidden;
}

/* ===== Noise Texture Overlay ===== */
.chamber::before,
.bento-cell::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.65' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
    background-size: 256px 256px;
    opacity: 0.04;
    pointer-events: none;
    z-index: 1;
}

.bento-cell::before {
    opacity: 0.05;
    border-radius: inherit;
}

/* ===== Chamber Base ===== */
.chamber {
    position: relative;
    padding: clamp(2rem, 5vw, 4rem);
}

.chamber-inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    position: relative;
    z-index: 2;
}

/* ===== Chamber 1 - The Discovery ===== */
.chamber-discovery {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.gavel-rose {
    margin-bottom: 2rem;
}

.gavel-rose-svg {
    width: clamp(100px, 20vw, 180px);
    height: auto;
}

/* Path draw animation */
.gavel-rose-svg path {
    stroke-dasharray: 1000;
    stroke-dashoffset: 1000;
    animation: drawPath 3s ease forwards;
}

.gavel-stem { animation-delay: 0s; }
.gavel-head { animation-delay: 0.8s; stroke-dashoffset: 1000; }
.gavel-petals { animation-delay: 1.6s; stroke-dashoffset: 1000; }
.gavel-leaf1 { animation-delay: 2s; stroke-dashoffset: 1000; }
.gavel-leaf2 { animation-delay: 2.3s; stroke-dashoffset: 1000; }
.gavel-thorn { animation-delay: 2.6s; stroke-dashoffset: 1000; }

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

.site-title {
    font-family: var(--font-headline);
    font-weight: 300;
    font-size: clamp(3rem, 10vw, 6rem);
    letter-spacing: 0.12em;
    color: var(--deep-umber);
    opacity: 0;
    animation: fadeInTitle 1.5s ease 2s forwards;
}

.site-title span {
    display: inline-block;
    opacity: 0;
}

.site-tagline {
    font-family: var(--font-accent);
    color: var(--brass);
    font-size: clamp(1rem, 2.5vw, 1.4rem);
    transform: rotate(-2deg);
    margin-top: 1rem;
    opacity: 0;
    animation: fadeInTitle 1s ease 3.2s forwards;
}

@keyframes fadeInTitle {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ===== Wax Seal Dividers ===== */
.wax-seal-divider {
    display: flex;
    justify-content: center;
    padding: var(--chamber-gap) 0;
}

.wax-seal {
    width: 60px;
    height: 60px;
    opacity: 0.6;
    transition: opacity 0.3s ease;
}

.wax-seal-large {
    width: 80px;
    height: 80px;
    margin: 1.5rem 0;
}

/* ===== Bento Grid System ===== */
.bento-grid {
    display: grid;
    gap: 1px;
    max-width: 1200px;
    margin: 0 auto;
    position: relative;
    z-index: 2;
}

/* Chamber 2 Grid: 3 columns, 2 rows */
.bento-grid-2 {
    grid-template-columns: 2fr 2fr 1fr;
    grid-template-rows: auto auto;
}

.bento-grid-2 .bento-cell:nth-child(1) { grid-column: 1; grid-row: 1; }
.bento-grid-2 .bento-cell:nth-child(2) { grid-column: 2; grid-row: 1; }
.bento-grid-2 .bento-cell:nth-child(3) { grid-column: 3; grid-row: 1 / 3; }
.bento-grid-2 .bento-cell:nth-child(4) { grid-column: 1; grid-row: 2; }
.bento-grid-2 .bento-cell:nth-child(5) { grid-column: 2; grid-row: 2; }
.bento-grid-2 .bento-cell:nth-child(6) { grid-column: 3; grid-row: 3; display: none; }

/* Re-enable the 6th cell on wider screens */
@media (min-width: 768px) {
    .bento-grid-2 {
        grid-template-columns: 2fr 2fr 1fr;
        grid-template-rows: auto auto;
    }
    .bento-grid-2 .bento-cell:nth-child(6) {
        display: block;
        grid-column: 1 / 4;
        grid-row: 3;
    }
}

/* Chamber 3 Grid: 2 columns, 3 rows */
.bento-grid-3 {
    grid-template-columns: 1fr 1fr;
    grid-template-rows: auto auto auto;
}

.bento-grid-3 .cell-philosophy {
    grid-column: 1 / 3;
    grid-row: 1;
}

/* Chamber 4 Grid: 1fr 2fr */
.bento-grid-4 {
    grid-template-columns: 1fr 2fr;
    grid-template-rows: auto;
}

/* ===== Bento Cell ===== */
.bento-cell {
    position: relative;
    padding: var(--cell-padding);
    border: 1px solid var(--cell-border);
    background-color: var(--moth-wing);
    overflow: hidden;
    opacity: 0;
    transform: scale(0.96);
    transition: transform 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease;
}

.bento-cell.visible {
    opacity: 1;
    transform: scale(1);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

.bento-cell:hover {
    transform: translateY(-4px);
    border-color: rgba(138, 115, 89, 0.6);
    box-shadow: 0 4px 20px rgba(42, 31, 45, 0.06);
}

/* Accent tints per cell */
.bento-cell[data-accent='foxglove'] {
    background-color: rgba(155, 107, 158, 0.04);
}

.bento-cell[data-accent='rose'] {
    background-color: rgba(194, 120, 126, 0.04);
}

.bento-cell[data-accent='gold'] {
    background-color: rgba(196, 163, 90, 0.04);
}

/* ===== Corner Motifs ===== */
.corner-motif {
    position: absolute;
    width: 60px;
    height: 60px;
    z-index: 3;
}

.corner-top-right {
    top: 8px;
    right: 8px;
}

.corner-top-left {
    top: 8px;
    left: 8px;
}

.corner-bottom-right {
    bottom: 8px;
    right: 8px;
}

.corner-bottom-left {
    bottom: 8px;
    left: 8px;
}

/* ===== Lot Card Styling ===== */
.lot-number {
    display: block;
    font-family: var(--font-headline);
    font-style: italic;
    font-weight: 700;
    font-size: clamp(1.8rem, 4vw, 3rem);
    color: var(--deep-umber);
    letter-spacing: 0.06em;
    margin-bottom: 0.8rem;
    position: relative;
    z-index: 2;
}

.lot-number-large {
    font-size: clamp(2.4rem, 6vw, 4rem);
}

.lot-description {
    font-family: var(--font-body);
    font-weight: 400;
    font-size: clamp(0.95rem, 1.8vw, 1.15rem);
    line-height: 1.72;
    color: var(--warm-charcoal);
    margin-bottom: 1rem;
    position: relative;
    z-index: 2;
}

.lot-description-featured {
    font-size: clamp(1.1rem, 2.2vw, 1.3rem);
}

.lot-price {
    display: block;
    font-family: var(--font-accent);
    font-size: clamp(0.85rem, 2vw, 1.1rem);
    color: var(--brass);
    transform: rotate(-2deg);
    position: relative;
    z-index: 2;
}

.caveat-text {
    font-family: var(--font-accent);
}

/* ===== Chamber 3 - Philosophy Text ===== */
.cell-philosophy {
    padding: clamp(2rem, 4vw, 3.5rem);
}

.philosophy-text {
    font-family: var(--font-headline);
    font-style: italic;
    font-weight: 400;
    font-size: clamp(1.2rem, 2.5vw, 1.8rem);
    line-height: 1.8;
    color: var(--deep-umber);
    position: relative;
    z-index: 2;
    font-variation-settings: 'wght' 400;
    transition: font-variation-settings 0.1s ease;
}

/* ===== Chamber 4 - Bidding ===== */
.cell-bids {
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: rgba(155, 107, 158, 0.03);
}

.bid-progression {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    position: relative;
    z-index: 2;
}

.bid-item {
    display: block;
    font-family: var(--font-accent);
    font-size: clamp(1rem, 2.2vw, 1.4rem);
    color: var(--brass);
    opacity: 0.4;
    transition: opacity 0.6s ease, transform 0.6s ease;
    transform: translateX(-10px);
}

.bid-item.active {
    opacity: 1;
    transform: translateX(0);
}

/* Breathing border animation */
.cell-breathing-border {
    animation: borderBreathe 12s ease-in-out infinite;
}

@keyframes borderBreathe {
    0%, 100% { border-color: rgba(155, 107, 158, 0.5); }
    33% { border-color: rgba(194, 120, 126, 0.5); }
    66% { border-color: rgba(196, 163, 90, 0.5); }
}

.price-tag-moth {
    position: absolute;
    bottom: 20px;
    right: 20px;
    z-index: 3;
}

.moth-svg {
    width: 40px;
    height: 30px;
}

.flutter-moth {
    animation: flutter 4s ease-in-out infinite;
}

@keyframes flutter {
    0%, 100% { transform: rotate(-3deg); }
    50% { transform: rotate(3deg); }
}

/* ===== Chamber 5 - The Sold ===== */
.chamber-sold {
    background-color: var(--velvet-umber);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.chamber-sold::before {
    opacity: 0.08;
}

.chamber-sold-inner {
    text-align: center;
}

.sold-title {
    font-family: var(--font-headline);
    font-weight: 700;
    font-size: clamp(4rem, 12vw, 8rem);
    color: var(--tarnished-gold);
    letter-spacing: 0.06em;
    position: relative;
    z-index: 2;
}

.sold-tagline {
    font-family: var(--font-accent);
    color: var(--parchment);
    font-size: clamp(1rem, 2.5vw, 1.4rem);
    transform: rotate(-2deg);
    margin-top: 0.5rem;
    opacity: 0.8;
    position: relative;
    z-index: 2;
}

/* Drifting moth animation */
.drifting-moth {
    position: absolute;
    top: 50%;
    left: -60px;
    animation: drift 20s cubic-bezier(0.4, 0, 0.2, 1) infinite;
    z-index: 3;
}

.moth-svg-large {
    width: 50px;
    height: 35px;
}

@keyframes drift {
    0% { left: -60px; top: 40%; transform: rotate(-5deg); }
    25% { top: 30%; transform: rotate(3deg); }
    50% { left: 50%; top: 55%; transform: rotate(-2deg); }
    75% { top: 35%; transform: rotate(4deg); }
    100% { left: calc(100% + 60px); top: 45%; transform: rotate(-3deg); }
}

/* ===== Moth Navigation ===== */
.moth-nav {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    z-index: 100;
}

.moth-nav-trigger {
    background: rgba(245, 240, 235, 0.9);
    border: 1px solid var(--cell-border);
    border-radius: 50%;
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background-color 0.3s ease, transform 0.3s ease;
    position: relative;
    z-index: 101;
}

.moth-nav-trigger:hover {
    background: rgba(232, 212, 240, 0.9);
    transform: scale(1.1);
}

.moth-nav-icon {
    width: 28px;
    height: 20px;
}

.moth-nav-menu {
    position: absolute;
    bottom: 0;
    right: 0;
    width: 200px;
    height: 200px;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.moth-nav.open .moth-nav-menu {
    pointer-events: all;
    opacity: 1;
}

.constellation-lines {
    position: absolute;
    width: 200px;
    height: 200px;
    bottom: -75px;
    right: -75px;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.moth-nav.open .constellation-lines {
    opacity: 1;
}

.nav-star {
    position: absolute;
    bottom: 25px;
    right: 25px;
    display: flex;
    align-items: center;
    gap: 6px;
    text-decoration: none;
    opacity: 0;
    transform: scale(0);
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.moth-nav.open .nav-star {
    opacity: 1;
    transform: scale(1) translate(
        calc(cos(var(--nav-angle)) * 70px),
        calc(sin(var(--nav-angle)) * 70px)
    );
}

.nav-star-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--foxglove);
    display: block;
    transition: background 0.3s ease;
}

.nav-star:hover .nav-star-dot {
    background: var(--tarnished-gold);
}

.nav-star-label {
    font-family: var(--font-accent);
    font-size: 0.85rem;
    color: var(--brass);
    white-space: nowrap;
}

/* ===== Vine Border Fragments ===== */
.cell-philosophy::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 60%;
    height: 2px;
    background: linear-gradient(
        to right,
        rgba(155, 107, 158, 0.3),
        rgba(155, 107, 158, 0.1),
        transparent
    );
    z-index: 3;
}

/* ===== Mobile Responsive ===== */
@media (max-width: 767px) {
    .bento-grid-2 {
        grid-template-columns: 1fr;
    }

    .bento-grid-2 .bento-cell:nth-child(3) {
        grid-column: 1;
        grid-row: auto;
    }

    .bento-grid-3 {
        grid-template-columns: 1fr;
    }

    .bento-grid-3 .cell-philosophy {
        grid-column: 1;
    }

    .bento-grid-4 {
        grid-template-columns: 1fr;
    }

    .moth-nav {
        bottom: 1rem;
        right: 1rem;
    }
}

/* ===== Letter stagger animation ===== */
@keyframes letterFade {
    from { opacity: 0; transform: translateY(6px); }
    to { opacity: 1; transform: translateY(0); }
}

.site-title .letter {
    display: inline-block;
    opacity: 0;
    animation: letterFade 0.4s ease forwards;
}

/* ===== Scroll reveal for bid items ===== */
.bid-item:nth-child(1) { transition-delay: 0s; }
.bid-item:nth-child(2) { transition-delay: 0.15s; }
.bid-item:nth-child(3) { transition-delay: 0.3s; }
.bid-item:nth-child(4) { transition-delay: 0.45s; }
.bid-item:nth-child(5) { transition-delay: 0.6s; }
.bid-item:nth-child(6) { transition-delay: 0.75s; }
