/* ============================================
   opensource.bid — Styles
   Maximalist Hexagonal Auction House
   ============================================ */

:root {
    --ground: #3D2B1F;
    --primary-surface: #C4603A;
    --secondary-surface: #B8978C;
    --light-ground: #E8C4A8;
    --accent-warm: #D4856A;
    --accent-cool: #5B8A72;
    --text-primary: #F5EDE3;
    --text-muted: #8C7A6B;
    --deep-shadow: #1A120D;
    --fluid-weight: clamp(400, calc(400 + 500 * ((100vw - 320px) / 1600)), 900);
}

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

html {
    scroll-behavior: smooth;
}

body {
    background-color: var(--ground);
    color: var(--text-primary);
    font-family: 'Source Serif 4', Georgia, serif;
    font-size: clamp(0.85rem, 1.2vw, 1.05rem);
    line-height: 1.55;
    overflow-x: hidden;
}

/* Grain overlay */
body::after {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    filter: url(#grain);
    opacity: 0.08;
    pointer-events: none;
    z-index: 9999;
}

/* ============================================
   HEXAGON BASE
   ============================================ */
.hex {
    clip-path: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%);
    aspect-ratio: 1 / 1.1547;
    position: absolute;
    transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.hex-inner {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 15%;
}

.grain-fill {
    position: relative;
    overflow: hidden;
}

/* ============================================
   SECTION 1: THE PORTICO
   ============================================ */
.section-portico {
    width: 100%;
    height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

.section-portico::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    filter: url(#grain);
    opacity: 0.15;
    pointer-events: none;
    z-index: 1;
}

.portico-honeycomb {
    position: relative;
    width: min(90vw, 700px);
    height: min(90vw, 700px);
    display: flex;
    align-items: center;
    justify-content: center;
}

.hex-cluster {
    position: relative;
    width: 100%;
    height: 100%;
}

/* Center hex */
.hex-center {
    width: 40%;
    left: 30%;
    top: 25%;
    background: var(--ground);
    z-index: 3;
}

.hex-center .hex-inner {
    background: linear-gradient(135deg, var(--ground) 0%, #2a1c13 100%);
}

/* Surrounding hexes positioned around center */
.hex-surround {
    width: 30%;
    z-index: 2;
}

.hex-s1 { left: 35%; top: 0%; }
.hex-s1 .hex-inner { background: #C4603A; }

.hex-s2 { left: 60%; top: 15%; }
.hex-s2 .hex-inner { background: #D4856A; }

.hex-s3 { left: 60%; top: 45%; }
.hex-s3 .hex-inner { background: #B8978C; }

.hex-s4 { left: 35%; top: 60%; }
.hex-s4 .hex-inner { background: #C4856A; }

.hex-s5 { left: 10%; top: 45%; }
.hex-s5 .hex-inner { background: #E8C4A8; }

.hex-s6 { left: 10%; top: 15%; }
.hex-s6 .hex-inner { background: #C4603A; opacity: 0.7; }

.wordmark {
    font-family: 'Fraunces', serif;
    font-variation-settings: 'SOFT' 100, 'WONK' 1, 'opsz' 144;
    font-weight: var(--fluid-weight);
    font-size: clamp(1.6rem, 5vw, 3.5rem);
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--text-primary);
    line-height: 1.1;
}

.wordmark .dot {
    color: var(--accent-warm);
}

/* Rosette */
.rosette {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 80%;
    height: 80%;
    transform: translate(-50%, -50%);
    border: 1px solid var(--accent-warm);
    border-radius: 50%;
    opacity: 0.3;
    box-shadow: 0 0 8px rgba(212, 133, 106, 0.4);
    animation: rotateRosette 120s linear infinite;
    z-index: 1;
    pointer-events: none;
}

.rosette::before,
.rosette::after {
    content: '';
    position: absolute;
    top: 10%;
    left: 10%;
    width: 80%;
    height: 80%;
    border: 1px solid var(--accent-warm);
    border-radius: 50%;
    opacity: 0.5;
}

.rosette::after {
    top: 20%;
    left: 20%;
    width: 60%;
    height: 60%;
}

@keyframes rotateRosette {
    from { transform: translate(-50%, -50%) rotate(0deg); }
    to { transform: translate(-50%, -50%) rotate(360deg); }
}

.portico-tagline {
    font-family: 'Source Serif 4', Georgia, serif;
    font-size: clamp(1rem, 2vw, 1.4rem);
    font-weight: 400;
    color: var(--light-ground);
    margin-top: 2rem;
    letter-spacing: 0.02em;
    opacity: 0.9;
    z-index: 2;
    text-align: center;
}

.scroll-indicator {
    position: absolute;
    bottom: 2rem;
    right: 2rem;
    z-index: 10;
}

.scroll-hex {
    width: 40px;
    height: 46px;
    background: var(--accent-warm);
    clip-path: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--deep-shadow);
    font-size: 1.2rem;
    animation: pulse 2s ease-in-out infinite;
    cursor: pointer;
}

@keyframes pulse {
    0%, 100% { opacity: 0.6; transform: translateY(0); }
    50% { opacity: 1; transform: translateY(5px); }
}

/* ============================================
   SECTION 2: THE GALLERY
   ============================================ */
.section-gallery {
    padding: 4rem 1rem;
    position: relative;
}

.gallery-grid {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    max-width: 1200px;
    margin: 0 auto;
    gap: 0;
}

.gallery-hex {
    width: 180px;
    clip-path: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%);
    aspect-ratio: 1 / 1.1547;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 0;
    margin: -12px 2px;
    position: relative;
    cursor: default;
    opacity: 0;
    transform: scale(0.8);
    transition: background-color 0.3s ease;
}

.gallery-hex.visible {
    opacity: 1;
    transform: scale(1);
}

.gallery-hex:hover {
    transform: scale(1.05);
    z-index: 5;
}

.gallery-hex-content {
    padding: 25%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
}

.gallery-hex .repo-name {
    font-family: 'Source Serif 4', Georgia, serif;
    font-weight: 600;
    font-size: clamp(0.65rem, 0.9vw, 0.8rem);
    color: var(--text-primary);
    line-height: 1.2;
}

.gallery-hex .repo-date {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 500;
    font-size: 0.6rem;
    color: var(--light-ground);
    opacity: 0.7;
    letter-spacing: 0.06em;
    font-variant-numeric: tabular-nums;
}

.gallery-hex .repo-bids {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 500;
    font-size: 0.6rem;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    border: 1px solid var(--light-ground);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-primary);
    letter-spacing: 0.06em;
}

/* Decorative hex (pattern fill) */
.gallery-hex.decorative {
    cursor: default;
}

.gallery-hex.decorative .hex-pattern-fill {
    width: 100%;
    height: 100%;
    position: absolute;
    top: 0;
    left: 0;
}

/* Even row offset */
.gallery-row-even {
    transform: translateX(92px);
}

/* Badge for new listings */
.badge-new {
    position: absolute;
    top: 20%;
    right: 15%;
    font-family: 'Space Grotesk', sans-serif;
    font-size: 0.5rem;
    font-weight: 500;
    background: var(--accent-cool);
    color: var(--text-primary);
    padding: 2px 5px;
    border-radius: 2px;
    letter-spacing: 0.06em;
    z-index: 2;
}

/* ============================================
   SECTION 3: THE ATRIUM
   ============================================ */
.section-atrium {
    background: var(--light-ground);
    padding: 6rem 2rem;
    position: relative;
}

.atrium-content {
    max-width: 720px;
    margin: 0 auto;
    text-align: center;
}

.atrium-text {
    font-family: 'Source Serif 4', Georgia, serif;
    font-size: clamp(1.05rem, 1.8vw, 1.35rem);
    font-weight: 400;
    color: var(--ground);
    line-height: 1.75;
}

.atrium-text em {
    font-family: 'Fraunces', serif;
    font-variation-settings: 'SOFT' 100, 'WONK' 1;
    font-weight: 600;
    font-style: italic;
    color: var(--primary-surface);
}

/* ============================================
   SECTION 4: THE ARCHIVE
   ============================================ */
.section-archive {
    padding: 6rem 2rem;
    position: relative;
    overflow: hidden;
    min-height: 80vh;
}

.archive-grid {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 1.5rem;
    max-width: 1200px;
    margin: 0 auto;
    position: relative;
    z-index: 2;
}

.mega-hex {
    width: min(350px, 85vw);
    aspect-ratio: 1 / 1.1547;
    clip-path: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%);
    position: relative;
    opacity: 0;
    transform: scale(0.8);
}

.mega-hex.visible {
    opacity: 1;
    transform: scale(1);
}

.mega-hex-1 { background: var(--primary-surface); }
.mega-hex-2 { background: var(--secondary-surface); }
.mega-hex-3 { background: var(--accent-warm); }

.mega-hex-inner {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 20%;
    position: relative;
    z-index: 2;
}

.fractal-pattern {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='30' height='52'%3E%3Cpolygon points='15,0 30,9 30,26 15,35 0,26 0,9' fill='none' stroke='%238C7A6B' stroke-width='0.5'/%3E%3Cpolygon points='15,17 30,26 30,43 15,52 0,43 0,26' fill='none' stroke='%238C7A6B' stroke-width='0.5'/%3E%3C/svg%3E");
    opacity: 0.3;
    z-index: 1;
    pointer-events: none;
}

.collection-title {
    font-family: 'Fraunces', serif;
    font-variation-settings: 'SOFT' 100, 'WONK' 1, 'opsz' 72;
    font-weight: 700;
    font-size: clamp(1.1rem, 2.2vw, 1.6rem);
    color: var(--text-primary);
    margin-bottom: 0.5rem;
    text-shadow: 1px 1px 3px rgba(26, 18, 13, 0.4);
}

.collection-desc {
    font-family: 'Source Serif 4', Georgia, serif;
    font-size: clamp(0.8rem, 1vw, 0.95rem);
    color: var(--text-primary);
    opacity: 0.85;
    margin-bottom: 0.75rem;
    line-height: 1.5;
}

.collection-count {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 500;
    font-size: 0.75rem;
    letter-spacing: 0.08em;
    color: var(--light-ground);
    text-transform: uppercase;
    font-variant-numeric: tabular-nums;
}

/* Bubbles */
.bubble-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 8;
    overflow: hidden;
}

.bubble {
    position: fixed;
    border-radius: 50%;
    background: rgba(212, 133, 106, 0.2);
    border: 1px solid var(--light-ground);
    box-shadow: inset 4px -4px 12px rgba(26, 18, 13, 0.3);
    animation: floatUp var(--duration) linear var(--delay) infinite,
               wobble var(--wobble-dur) ease-in-out var(--delay) infinite;
    pointer-events: none;
}

@keyframes floatUp {
    0% { bottom: -150px; opacity: var(--bubble-opacity); }
    90% { opacity: var(--bubble-opacity); }
    100% { bottom: 110vh; opacity: 0; }
}

@keyframes wobble {
    0%, 100% { transform: translateX(0) scale(var(--bubble-scale, 1)); }
    50% { transform: translateX(30px) scale(var(--bubble-scale, 1)); }
}

/* ============================================
   SECTION 5: THE CLOSING
   ============================================ */
.section-closing {
    padding: 6rem 2rem 4rem;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 40vh;
}

.closing-hex {
    width: 180px;
    aspect-ratio: 1 / 1.1547;
    clip-path: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%);
    background: var(--accent-warm);
    opacity: 0.8;
}

.closing-hex-inner {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 20%;
}

.colophon {
    font-family: 'Fraunces', serif;
    font-variation-settings: 'SOFT' 100, 'WONK' 1;
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--deep-shadow);
    letter-spacing: 0.03em;
}

.colophon-year {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 500;
    font-size: 0.7rem;
    color: var(--ground);
    letter-spacing: 0.1em;
    margin-top: 0.25rem;
}

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 768px) {
    .gallery-hex {
        width: 130px;
    }
    .gallery-row-even {
        transform: translateX(67px);
    }
    .archive-grid {
        flex-direction: column;
        align-items: center;
    }
}

@media (max-width: 480px) {
    .gallery-hex {
        width: 110px;
    }
    .gallery-row-even {
        transform: translateX(57px);
    }
    .hex-center {
        width: 50%;
        left: 25%;
    }
    .hex-surround {
        width: 35%;
    }
}
