/* ============================================================
   BBOTTL.com — Styles
   Retro-analog meets digital-clarity
   ============================================================ */

/* --- CSS Custom Properties --- */
:root {
    --deep-ground: #0f1926;
    --primary-surface: #1a2a40;
    --ethereal-blue: #7ec8e3;
    --pale-ice: #c4e4f2;
    --marble-cream: #e8e0d4;
    --candle-amber: #d4a953;
    --text-primary: #eaf2f8;
    --text-secondary: #8a9bb0;
    --error-coral: #d46a6a;

    --font-headline: 'Space Grotesk', sans-serif;
    --font-body: 'Inter', sans-serif;
    --font-mono: 'IBM Plex Mono', monospace;

    --spring-enter: cubic-bezier(0.34, 1.56, 0.64, 1);
    --spring-exit: cubic-bezier(0.22, 0.61, 0.36, 1);

    --seam-color: rgba(126, 200, 227, 0.4);
    --glow-x: 50%;
    --glow-y: 50%;
}

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

html {
    scroll-behavior: smooth;
    font-size: 16px;
}

body {
    background-color: var(--deep-ground);
    color: var(--text-primary);
    font-family: var(--font-body);
    font-weight: 400;
    line-height: 1.65;
    overflow-x: hidden;
}

/* --- Navigation --- */
#main-nav {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    padding: 20px 40px;
    transition: padding 0.4s var(--spring-exit), 
                background-color 0.4s var(--spring-exit),
                backdrop-filter 0.4s var(--spring-exit);
}

#main-nav.scrolled {
    padding: 8px 40px;
    background-color: rgba(15, 25, 38, 0.85);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
}

.nav-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    max-width: 1400px;
    margin: 0 auto;
}

.nav-logo {
    font-family: var(--font-headline);
    font-weight: 700;
    font-size: 1.5rem;
    letter-spacing: -0.02em;
    color: var(--ethereal-blue);
}

.nav-links {
    display: flex;
    list-style: none;
    gap: 32px;
}

.nav-links a {
    font-family: var(--font-mono);
    font-size: 0.8rem;
    color: var(--text-secondary);
    text-decoration: none;
    position: relative;
    transition: color 0.3s var(--spring-exit);
}

.nav-links a::after {
    content: '';
    position: absolute;
    bottom: -4px;
    left: 0;
    width: 0;
    height: 1px;
    background: var(--ethereal-blue);
    transition: width 0.4s var(--spring-enter);
}

.nav-links a:hover {
    color: var(--text-primary);
}

.nav-links a:hover::after {
    width: 100%;
}

/* --- Step Tracker --- */
#step-tracker {
    position: fixed;
    right: 24px;
    top: 50%;
    transform: translateY(-50%);
    z-index: 999;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.step-dot {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 1px solid var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: border-color 0.4s var(--spring-enter),
                background-color 0.4s var(--spring-enter),
                transform 0.4s var(--spring-enter);
    cursor: pointer;
}

.step-dot span {
    font-family: var(--font-mono);
    font-size: 0.6rem;
    color: var(--text-secondary);
    transition: color 0.4s var(--spring-enter);
}

.step-dot.active {
    border-color: var(--ethereal-blue);
    background-color: rgba(126, 200, 227, 0.1);
    transform: scale(1.15);
}

.step-dot.active span {
    color: var(--ethereal-blue);
}

/* --- Split Section Layout --- */
.split-section {
    display: flex;
    min-height: 100vh;
    position: relative;
}

.panel {
    position: relative;
    overflow: hidden;
}

.panel-left {
    width: 40%;
    position: relative;
}

.panel-right {
    width: 60%;
    display: flex;
    align-items: center;
}

.split-section.reverse .panel-left {
    width: 60%;
    order: 1;
}

.split-section.reverse .panel-right {
    width: 40%;
    order: 2;
}

.panel-content {
    padding: 120px 60px 80px 60px;
    max-width: 38em;
}

.split-section.reverse .panel-left .panel-content {
    margin-left: auto;
    padding-right: 80px;
}

/* --- Vertical Seam --- */
.vertical-seam {
    position: absolute;
    top: 0;
    bottom: 0;
    left: 40%;
    width: 1px;
    background: var(--seam-color);
    z-index: 10;
    animation: seam-pulse 4s ease-in-out infinite;
}

.split-section.reverse .vertical-seam {
    left: 60%;
}

@keyframes seam-pulse {
    0%, 100% { opacity: 0.4; }
    50% { opacity: 0.8; }
}

/* --- Marble Backgrounds --- */
.marble-bg {
    background:
        radial-gradient(ellipse at 20% 50%, #1a2a40 0%, transparent 70%),
        radial-gradient(ellipse at 80% 20%, #1e3350 0%, transparent 60%),
        radial-gradient(ellipse at 50% 80%, #162538 0%, transparent 65%),
        radial-gradient(ellipse at 70% 60%, rgba(126, 200, 227, 0.03) 0%, transparent 50%),
        linear-gradient(135deg, #0f1926 0%, #1a2a40 50%, #0f1926 100%);
    background-size: 200% 200%, 200% 200%, 200% 200%, 100% 100%, 100% 100%;
    animation: marble-shift 60s ease-in-out infinite;
}

.marble-bg-full {
    background:
        radial-gradient(ellipse at 30% 40%, #1a2a40 0%, transparent 70%),
        radial-gradient(ellipse at 70% 70%, #1e3350 0%, transparent 60%),
        radial-gradient(ellipse at 50% 20%, #162538 0%, transparent 65%),
        radial-gradient(ellipse at 60% 50%, rgba(126, 200, 227, 0.04) 0%, transparent 50%),
        linear-gradient(180deg, #0f1926 0%, #1a2a40 40%, #0f1926 100%);
    background-size: 200% 200%, 200% 200%, 200% 200%, 100% 100%, 100% 100%;
    animation: marble-shift 60s ease-in-out infinite;
}

@keyframes marble-shift {
    0% { background-position: 0% 0%, 100% 100%, 50% 50%, 0% 0%, 0% 0%; }
    33% { background-position: 30% 70%, 70% 30%, 20% 80%, 0% 0%, 0% 0%; }
    66% { background-position: 70% 30%, 30% 70%, 80% 20%, 0% 0%, 0% 0%; }
    100% { background-position: 0% 0%, 100% 100%, 50% 50%, 0% 0%, 0% 0%; }
}

/* Marble noise overlay */
.marble-bg::before,
.marble-bg-full::before {
    content: '';
    position: absolute;
    inset: 0;
    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.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.04'/%3E%3C/svg%3E");
    background-repeat: repeat;
    background-size: 256px 256px;
    pointer-events: none;
    z-index: 1;
}

/* --- Candle Glow Effects --- */
.candle-glow-layer {
    position: absolute;
    inset: 0;
    background: radial-gradient(circle 200px at var(--glow-x) var(--glow-y), rgba(212, 169, 83, 0.1), transparent 70%);
    pointer-events: none;
    z-index: 5;
    transition: background 0.15s ease;
}

.candle-glow-center {
    position: absolute;
    inset: 0;
    background: radial-gradient(circle 300px at 50% 50%, rgba(212, 169, 83, 0.08), transparent 70%);
    pointer-events: none;
    z-index: 2;
    animation: candle-flicker 3s steps(5) infinite;
}

@keyframes candle-flicker {
    0% { opacity: 0.06; }
    20% { opacity: 0.12; }
    40% { opacity: 0.08; }
    60% { opacity: 0.11; }
    80% { opacity: 0.07; }
    100% { opacity: 0.06; }
}

.panel-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(to bottom, rgba(15, 25, 38, 0.3) 0%, transparent 30%, transparent 70%, rgba(15, 25, 38, 0.3) 100%);
    pointer-events: none;
    z-index: 3;
}

/* --- Bottle Silhouettes --- */
.bottle-silhouettes {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 20px;
    opacity: 0.15;
    z-index: 2;
}

.bottle-svg {
    height: 50%;
    max-height: 350px;
}

.bottle-flask {
    transform: rotate(-5deg) translateY(20px);
}

.bottle-carboy {
    transform: rotate(3deg) translateY(-10px);
}

.process-bottles {
    flex-direction: column;
    gap: 40px;
}

.process-bottles .bottle-svg {
    height: 30%;
    max-height: 220px;
}

.bottle-vial {
    transform: rotate(-3deg) translateX(-20px);
}

.bottle-amphora {
    transform: rotate(4deg) translateX(15px);
}

.philosophy-bottles {
    justify-content: center;
}

.philosophy-bottles .bottle-svg {
    height: 60%;
    max-height: 400px;
    opacity: 1;
}

/* --- Bottle Diagram --- */
.bottle-diagram {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 4;
}

.diagram-svg {
    height: 70%;
    max-height: 500px;
}

.diagram-label {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 11px;
}

/* SVG draw animation */
.draw-line {
    stroke-dasharray: 1000;
    stroke-dashoffset: 1000;
    transition: stroke-dashoffset 2s var(--spring-exit);
}

.draw-line.drawn {
    stroke-dashoffset: 0;
}

/* --- Collection Grid --- */
.collection-grid {
    position: absolute;
    inset: 0;
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-rows: 1fr 1fr;
    gap: 2px;
    padding: 80px 30px;
    z-index: 4;
}

.collection-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px;
    position: relative;
}

.collection-item svg {
    height: 120px;
    opacity: 0.5;
    transition: opacity 0.5s var(--spring-enter), transform 0.5s var(--spring-enter);
}

.collection-item:hover svg {
    opacity: 0.9;
    transform: translateY(-5px);
}

.collection-item .mono-text {
    margin-top: 12px;
    font-size: 0.7rem;
    color: var(--text-secondary);
    text-align: center;
}

/* --- Typography --- */
.hero-title {
    font-family: var(--font-headline);
    font-weight: 700;
    font-size: clamp(2.5rem, 5vw, 5rem);
    letter-spacing: -0.04em;
    line-height: 1.1;
    color: var(--text-primary);
    margin-bottom: 24px;
}

.section-title {
    font-family: var(--font-headline);
    font-weight: 600;
    font-size: clamp(1.8rem, 3.5vw, 3rem);
    letter-spacing: -0.02em;
    line-height: 1.15;
    color: var(--text-primary);
    margin-bottom: 20px;
}

.chapter-label {
    margin-bottom: 24px;
}

.chapter-label .mono-text {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--candle-amber);
}

.mono-text {
    font-family: var(--font-mono);
    font-size: 0.85rem;
}

.body-text {
    font-family: var(--font-body);
    font-weight: 400;
    font-size: 1.05rem;
    line-height: 1.65;
    color: var(--text-primary);
    margin-bottom: 24px;
    max-width: 38em;
}

.caption-text {
    font-family: var(--font-body);
    font-weight: 400;
    font-size: 0.9rem;
    line-height: 1.55;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.annotation {
    color: var(--text-secondary);
    font-size: 0.8rem;
    opacity: 0.7;
}

/* --- Decorative Rule --- */
.decorative-rule {
    width: 80px;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--ethereal-blue), transparent);
    margin: 24px 0;
}

/* --- Tech Annotations --- */
.tech-annotation {
    display: flex;
    gap: 20px;
    margin-bottom: 32px;
    align-items: flex-start;
}

.step-number {
    width: 36px;
    height: 36px;
    min-width: 36px;
    border-radius: 50%;
    border: 1px solid var(--ethereal-blue);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-top: 2px;
}

.step-number span {
    font-family: var(--font-mono);
    font-size: 0.7rem;
    color: var(--ethereal-blue);
}

.step-content {
    flex: 1;
}

.step-title {
    font-family: var(--font-headline);
    font-weight: 600;
    font-size: 1.1rem;
    letter-spacing: -0.01em;
    color: var(--text-primary);
    margin-bottom: 6px;
}

/* --- Card Bracket --- */
.card-bracket {
    position: relative;
    padding: 32px;
    margin: 32px 0;
}

.bracket-corner {
    position: absolute;
    width: 16px;
    height: 16px;
    border-color: var(--text-secondary);
    border-style: solid;
    border-width: 0;
}

.bracket-corner.top-left {
    top: 0;
    left: 0;
    border-top-width: 1px;
    border-left-width: 1px;
}

.bracket-corner.top-right {
    top: 0;
    right: 0;
    border-top-width: 1px;
    border-right-width: 1px;
}

.bracket-corner.bottom-left {
    bottom: 0;
    left: 0;
    border-bottom-width: 1px;
    border-left-width: 1px;
}

.bracket-corner.bottom-right {
    bottom: 0;
    right: 0;
    border-bottom-width: 1px;
    border-right-width: 1px;
}

.quote-text {
    font-family: var(--font-body);
    font-weight: 400;
    font-size: 1.1rem;
    line-height: 1.7;
    color: var(--pale-ice);
    font-style: normal;
    margin-bottom: 12px;
}

.quote-text em {
    color: var(--candle-amber);
    font-style: italic;
}

/* --- Interstitial Sections --- */
.interstitial {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
    text-align: center;
    padding: 80px 40px;
}

.interstitial-text {
    font-family: var(--font-headline);
    font-weight: 700;
    font-size: clamp(2.5rem, 5vw, 5rem);
    letter-spacing: -0.04em;
    line-height: 1.2;
    color: var(--text-primary);
    position: relative;
    z-index: 5;
    opacity: 0;
    transform: scale(0.95);
    transition: opacity 0.8s var(--spring-enter), transform 0.8s var(--spring-enter);
}

.interstitial-text.visible {
    opacity: 1;
    transform: scale(1);
}

/* --- Footer --- */
.footer-section {
    min-height: 70vh;
}

.footer-meta {
    margin-top: 60px;
    text-align: center;
    position: relative;
    z-index: 5;
}

.footer-meta .mono-text {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.footer-meta .decorative-rule {
    margin: 16px auto;
}

.footer-year {
    margin-top: 8px;
    font-size: 0.7rem;
    color: var(--text-secondary);
    opacity: 0.6;
}

/* --- Typewriter Animation --- */
.typewriter-hidden {
    visibility: hidden;
}

.typewriter-cursor::after {
    content: '▊';
    color: var(--ethereal-blue);
    animation: blink-cursor 0.8s steps(1) infinite;
    font-size: 0.85em;
}

@keyframes blink-cursor {
    0%, 50% { opacity: 1; }
    51%, 100% { opacity: 0; }
}

/* --- Scroll Reveal --- */
.reveal-up {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.7s var(--spring-enter), transform 0.7s var(--spring-enter);
}

.reveal-up.visible {
    opacity: 1;
    transform: translateY(0);
}

/* --- Responsive --- */
@media (max-width: 900px) {
    .split-section {
        flex-direction: column;
    }

    .panel-left,
    .panel-right,
    .split-section.reverse .panel-left,
    .split-section.reverse .panel-right {
        width: 100%;
        order: unset;
    }

    .panel-left {
        min-height: 40vh;
    }

    .panel-right {
        min-height: auto;
    }

    .vertical-seam {
        display: none;
    }

    .panel-content {
        padding: 60px 24px;
    }

    .split-section.reverse .panel-left .panel-content {
        margin-left: 0;
        padding-right: 24px;
    }

    #step-tracker {
        display: none;
    }

    .nav-links {
        gap: 16px;
    }

    .nav-links a {
        font-size: 0.7rem;
    }

    #main-nav {
        padding: 12px 20px;
    }

    #main-nav.scrolled {
        padding: 8px 20px;
    }

    .collection-grid {
        padding: 40px 16px;
    }
}

@media (max-width: 600px) {
    .nav-links {
        display: none;
    }

    .hero-title {
        font-size: clamp(2rem, 8vw, 3rem);
    }

    .interstitial-text {
        font-size: clamp(1.8rem, 7vw, 3rem);
    }
}
