/* ============================================
   BBOTTL.com - Wabi-Sabi Ceramic Atelier
   ============================================ */

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

html {
    scroll-behavior: smooth;
    scroll-snap-type: y proximity;
    overflow-x: hidden;
}

body {
    background-color: #f4efe4;
    color: #3d3630;
    font-family: 'Source Serif 4', Georgia, serif;
    font-weight: 400;
    font-size: 18px;
    line-height: 1.8;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

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

/* --- Typography --- */
.section-title {
    font-family: 'Cormorant Garamond', 'Times New Roman', serif;
    font-weight: 300;
    font-size: clamp(2.5rem, 6vw, 5.5rem);
    letter-spacing: 0.04em;
    line-height: 1.15;
    color: #3d3630;
}

.body-text {
    font-family: 'Source Serif 4', Georgia, serif;
    font-weight: 400;
    font-size: 18px;
    line-height: 1.8;
    color: #3d3630;
    max-width: 540px;
}

.shelf-label {
    font-family: 'DM Mono', 'Courier New', monospace;
    font-weight: 400;
    font-size: 13px;
    letter-spacing: 0.06em;
    color: #8a7e72;
    text-transform: uppercase;
    display: block;
    margin-bottom: 24px;
}

.caption-text {
    font-family: 'DM Mono', 'Courier New', monospace;
    font-weight: 400;
    font-size: 13px;
    letter-spacing: 0.06em;
    color: #8a7e72;
    display: block;
}

/* --- Shelf (Section) Base --- */
.shelf {
    position: relative;
    min-height: 100vh;
    scroll-snap-align: start;
    overflow: hidden;
}

/* --- Grain overlay on every shelf --- */
.shelf-grain {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 1;
    opacity: 0.04;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='200'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.75' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='200' height='200' filter='url(%23n)' opacity='1'/%3E%3C/svg%3E");
    background-repeat: repeat;
}

/* --- Border-animate line (gold trace on enter) --- */
.shelf-border-line {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 10;
    border: 1px solid transparent;
    transition: border-color 0.8s ease;
}

.shelf-border-line::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 0;
    height: 1px;
    background: #c9a84c;
    transition: width 1.2s ease;
}

.shelf.in-view .shelf-border-line::before {
    width: 100%;
}

/* --- Wobble line divider --- */
.wobble-line {
    width: 100%;
    max-width: 280px;
    height: 1px;
    margin: 32px 0;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='280' height='2' viewBox='0 0 280 2'%3E%3Cpath d='M0 1 C20 0.5, 40 1.5, 60 1 C80 0.5, 100 1.5, 120 1 C140 0.5, 160 1.5, 180 1 C200 0.5, 220 1.5, 240 1 C260 0.5, 275 1.2, 280 1' stroke='%238a7e72' stroke-width='1' fill='none' stroke-dasharray='8 12'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-size: contain;
}

/* --- Thumbprint watermark --- */
.thumbprint {
    position: absolute;
    width: 400px;
    height: 400px;
    border-radius: 50%;
    pointer-events: none;
    z-index: 0;
    opacity: 0.08;
    background: radial-gradient(ellipse at center,
        #c4a882 0%, #c4a882 20%, transparent 20.5%,
        transparent 24%, #c4a882 24%, #c4a882 26%, transparent 26.5%,
        transparent 30%, #c4a882 30%, #c4a882 32%, transparent 32.5%,
        transparent 36%, #c4a882 36%, #c4a882 38%, transparent 38.5%,
        transparent 42%, #c4a882 42%, #c4a882 44%, transparent 44.5%,
        transparent 48%, #c4a882 48%, #c4a882 50%, transparent 50.5%,
        transparent 54%, #c4a882 54%, #c4a882 56%, transparent 56.5%,
        transparent 60%, #c4a882 60%, #c4a882 62%, transparent 62.5%,
        transparent 66%, #c4a882 66%, #c4a882 68%, transparent 68.5%,
        transparent 100%
    );
}

.thumbprint-1 {
    top: -80px;
    right: -120px;
    transform: rotate(25deg);
}

.thumbprint-2 {
    bottom: -100px;
    left: -80px;
    transform: rotate(-15deg);
}

/* --- Shelf transition animation --- */
.shelf {
    transform: scale(0.98);
    opacity: 0;
    transition: transform 0.9s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.9s ease;
}

.shelf.in-view {
    transform: scale(1);
    opacity: 1;
}

/* First shelf visible immediately */
.shelf-wheel {
    transform: scale(1);
    opacity: 1;
}


/* ============================================
   SHELF 1: THE WHEEL
   ============================================ */
.shelf-wheel {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background-color: #f4efe4;
    min-height: 100vh;
    position: relative;
}

.bottle-wheel-container {
    position: relative;
    z-index: 2;
    width: clamp(180px, 30vw, 300px);
}

.bottle-svg-main {
    width: 100%;
    height: auto;
}

#bottle-path {
    stroke-dasharray: 2000;
    stroke-dashoffset: 2000;
}

.bottle-drawing #bottle-path {
    animation: drawBottle 5s cubic-bezier(0.25, 0.1, 0.25, 1) forwards;
}

@keyframes drawBottle {
    0% { stroke-dashoffset: 2000; }
    15% { stroke-dashoffset: 1700; }
    85% { stroke-dashoffset: 200; }
    100% { stroke-dashoffset: 0; }
}

.wheel-tagline {
    font-family: 'Cormorant Garamond', serif;
    font-weight: 300;
    font-size: clamp(1.2rem, 3vw, 2rem);
    letter-spacing: 0.04em;
    color: #3d3630;
    margin-top: 48px;
    opacity: 0;
    transition: opacity 1.5s ease 4.5s;
    z-index: 2;
}

.bottle-drawing ~ .wheel-tagline {
    opacity: 1;
}

.scroll-hint {
    position: absolute;
    bottom: 40px;
    left: 50%;
    transform: translateX(-50%);
    opacity: 0;
    animation: fadeInScroll 1s ease 6s forwards;
    z-index: 2;
}

.scroll-hint svg {
    animation: bobDown 2s ease-in-out infinite;
}

@keyframes fadeInScroll {
    to { opacity: 0.6; }
}

@keyframes bobDown {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(8px); }
}

/* Magnetic cursor effect on bottle */
.bottle-wheel-container {
    transition: transform 0.3s ease-out;
}


/* ============================================
   SHELF 2: THE KILN
   ============================================ */
.shelf-kiln {
    background-color: #f4efe4;
    display: flex;
    align-items: center;
}

.kiln-layout {
    display: flex;
    width: 100%;
    min-height: 100vh;
    position: relative;
    z-index: 2;
}

.kiln-left {
    width: 60%;
    position: relative;
    overflow: hidden;
}

.kiln-heat-area {
    position: absolute;
    inset: 0;
    background-color: #b8763e;
}

.kiln-amber-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, #b8763e 0%, #c4a882 50%, #b8763e 100%);
    opacity: 0.3;
}

.kiln-shimmer {
    position: absolute;
    inset: 0;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='300' height='300'%3E%3Cfilter id='s'%3E%3CfeTurbulence type='turbulence' baseFrequency='0.015 0.08' numOctaves='2' seed='5'/%3E%3C/filter%3E%3Crect width='300' height='300' filter='url(%23s)' opacity='0.15'/%3E%3C/svg%3E");
    background-repeat: repeat;
    animation: shimmerMove 8s ease-in-out infinite alternate;
    opacity: 0.5;
    mix-blend-mode: overlay;
}

@keyframes shimmerMove {
    0% { transform: translateY(0) scaleY(1); }
    100% { transform: translateY(-15px) scaleY(1.02); }
}

.kiln-divider {
    width: 4px;
    flex-shrink: 0;
    z-index: 3;
}

.kiln-right {
    width: 40%;
    padding: 120px 60px 120px 48px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    margin-left: -8%;
    padding-left: calc(8% + 48px);
}

.kiln-right .section-title {
    margin-bottom: 16px;
}

.kiln-right .body-text {
    margin-bottom: 24px;
}

.kiln-right .caption-text {
    margin-top: 16px;
}


/* ============================================
   SHELF 3: THE GLAZE
   ============================================ */
.shelf-glaze {
    background-color: #f4efe4;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 120px 0;
    transition: background-color 1.8s ease-in-out;
}

.glaze-header {
    padding-left: 12%;
    margin-bottom: 60px;
    position: relative;
    z-index: 2;
}

.glaze-scroll-container {
    width: 100%;
    overflow-x: auto;
    overflow-y: hidden;
    position: relative;
    z-index: 2;
    padding: 20px 0 40px;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    scrollbar-color: #c4a882 transparent;
}

.glaze-scroll-container::-webkit-scrollbar {
    height: 6px;
}

.glaze-scroll-container::-webkit-scrollbar-track {
    background: transparent;
}

.glaze-scroll-container::-webkit-scrollbar-thumb {
    background: #c4a882;
    border-radius: 3px;
}

.glaze-track {
    display: flex;
    gap: 28px;
    padding: 0 12%;
    width: max-content;
}

.glaze-tile {
    width: 280px;
    height: 340px;
    flex-shrink: 0;
    position: relative;
    scroll-snap-align: center;
    transform: rotate(var(--rotate, 0deg));
    transition: transform 0.4s ease;
    cursor: pointer;
    background: #f4efe4;
    border: 1px solid #c4a88240;
    padding: 16px;
    display: flex;
    flex-direction: column;
    box-shadow: 4px 6px 20px rgba(61, 54, 48, 0.08),
                -2px -1px 10px rgba(61, 54, 48, 0.03);
}

.glaze-tile:hover {
    transform: rotate(0deg) translateY(-4px);
}

.tile-color {
    flex: 1;
    border-radius: 0;
    position: relative;
}

.tile-crackle {
    position: absolute;
    inset: 16px;
    z-index: 2;
    pointer-events: none;
    opacity: 0.2;
    transition: opacity 0.4s ease;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='200'%3E%3Cfilter id='c'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.04' numOctaves='5' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='200' height='200' filter='url(%23c)' opacity='0.8'/%3E%3C/svg%3E");
    background-size: cover;
    mix-blend-mode: overlay;
}

.glaze-tile:hover .tile-crackle {
    opacity: 0.5;
}

.tile-label {
    font-family: 'DM Mono', monospace;
    font-size: 12px;
    letter-spacing: 0.08em;
    color: #3d3630;
    text-transform: uppercase;
    margin-top: 14px;
    display: block;
}

.tile-code {
    font-family: 'DM Mono', monospace;
    font-size: 11px;
    letter-spacing: 0.06em;
    color: #8a7e72;
    margin-top: 4px;
    display: block;
}


/* ============================================
   SHELF 4: THE CRACK
   ============================================ */
.shelf-crack {
    background-color: #f4efe4;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
}

.crack-container {
    position: relative;
    width: 100%;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2;
}

.kintsugi-crack-svg {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
    pointer-events: none;
}

.crack-main {
    opacity: 0;
    transition: opacity 1s ease;
}

.crack-branch,
.crack-fine {
    opacity: 0;
    transition: opacity 1.2s ease 0.5s;
}

.shelf-crack.in-view .crack-main {
    opacity: 1;
    animation: goldShimmer 3s ease-in-out infinite alternate;
}

.shelf-crack.in-view .crack-branch {
    opacity: 0.6;
}

.shelf-crack.in-view .crack-fine {
    opacity: 0.35;
}

@keyframes goldShimmer {
    0% { filter: url(#gold-glow); opacity: 0.85; }
    100% { filter: url(#gold-glow); opacity: 1; }
}

.crack-gold-bleed {
    position: absolute;
    top: 30%;
    left: 20%;
    width: 60%;
    height: 40%;
    background: radial-gradient(ellipse at center, #c9a84c15 0%, transparent 70%);
    pointer-events: none;
    z-index: 0;
}

.crack-text-container {
    position: relative;
    z-index: 3;
    padding: 120px 12% 120px 58%;
    max-width: 600px;
    margin-left: auto;
    margin-right: 8%;
}

.crack-label {
    color: #c9a84c;
}

.crack-text-fragment {
    margin-bottom: 8px;
}

.fragment-1 { transform: translateX(0); }
.fragment-2 { transform: translateX(8px) translateY(4px); }
.fragment-3 { transform: translateX(-4px) translateY(6px); }
.fragment-4 { transform: translateX(12px) translateY(2px); }

.golden-seam {
    height: 2px;
    background: linear-gradient(90deg, transparent 0%, #c9a84c 20%, #c9a84c 80%, transparent 100%);
    margin: 16px 0;
    opacity: 0;
    transition: opacity 1.2s ease;
}

.shelf-crack.in-view .golden-seam {
    opacity: 0.8;
    animation: goldShimmer 3s ease-in-out infinite alternate;
}

.seam-1 { width: 70%; margin-left: 15%; }
.seam-2 { width: 85%; margin-left: 5%; }
.seam-3 { width: 60%; margin-left: 25%; }


/* ============================================
   SHELF 5: THE COLLECTION
   ============================================ */
.shelf-collection {
    background-color: #f4efe4;
    padding: 120px 8% 120px 12%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-height: 100vh;
}

.collection-header {
    margin-bottom: 60px;
    position: relative;
    z-index: 2;
}

.collection-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 32px 24px;
    position: relative;
    z-index: 2;
    max-width: 1200px;
}

.collection-bottle {
    display: flex;
    flex-direction: column;
    align-items: center;
    cursor: pointer;
    position: relative;
}

.collection-bottle svg {
    width: 100%;
    max-width: 140px;
    height: auto;
    transition: transform 0.6s cubic-bezier(0.22, 1, 0.36, 1);
}

.collection-bottle:hover svg {
    transform: scale(1.04);
}

.collection-bottle .bottle-fill {
    transition: y 1.2s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.6s ease;
}

.collection-bottle:hover .bottle-fill {
    opacity: 0.7;
}

.bottle-name {
    font-family: 'DM Mono', monospace;
    font-size: 11px;
    letter-spacing: 0.06em;
    color: #8a7e72;
    text-transform: uppercase;
    margin-top: 12px;
    text-align: center;
}

/* Asymmetric placement */
.bottle-amphora { grid-column: 1; margin-top: 40px; }
.bottle-carafe { grid-column: 2; margin-top: 0; }
.bottle-flask { grid-column: 3; margin-top: 60px; }
.bottle-vial { grid-column: 4; margin-top: 20px; }
.bottle-demijohn { grid-column: 5; margin-top: 50px; }
.bottle-apothecary { grid-column: 1; margin-top: -20px; }
.bottle-tokkuri { grid-column: 2; margin-top: 30px; }
.bottle-flacon { grid-column: 3; margin-top: -10px; }
.bottle-jug { grid-column: 4; margin-top: 40px; }
.bottle-pot { grid-column: 5; margin-top: 0; }


/* ============================================
   SHELF 6: THE MESSAGE
   ============================================ */
.shelf-message {
    background-color: #f4efe4;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    transition: background-color 2s ease;
}

.shelf-message.in-view {
    background-color: #1a2a3a;
}

.message-container {
    position: relative;
    z-index: 2;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 80px 20px;
}

.message-label {
    color: #8a7e72;
    transition: color 2s ease;
    text-align: center;
    margin-bottom: 40px;
}

.shelf-message.in-view .message-label {
    color: #8fa89a;
}

.message-bottle-wrapper {
    position: relative;
    width: clamp(260px, 40vw, 380px);
    height: clamp(400px, 60vh, 580px);
}

.message-bottle-outline {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
    pointer-events: none;
    transition: transform 0.8s ease;
}

.shelf-message.in-view .message-bottle-outline path {
    stroke: #f4efe433;
}

.message-text-container {
    position: absolute;
    inset: 0;
    z-index: 2;
    clip-path: polygon(
        50% 3%, 45.5% 4%, 43% 6%,
        42% 10%, 41.5% 14%, 41% 17%,
        38% 21%, 33% 28%, 27% 36%,
        22% 44%, 19% 54%, 18.5% 62%,
        18% 72%, 19% 80%, 21% 86%,
        26% 91%, 33% 95%, 43% 98%,
        50% 99%, 57% 98%, 67% 95%,
        74% 91%, 79% 86%, 81% 80%,
        82% 72%, 81.5% 62%, 81% 54%,
        78% 44%, 73% 36%, 67% 28%,
        62% 21%, 59% 17%, 58.5% 14%,
        58% 10%, 57% 6%, 54.5% 4%
    );
    overflow-y: auto;
    overflow-x: hidden;
    padding: 30% 18% 20% 18%;
    scrollbar-width: none;
}

.message-text-container::-webkit-scrollbar {
    display: none;
}

.message-scroll-content {
    min-height: 100%;
}

.message-text {
    font-family: 'Source Serif 4', Georgia, serif;
    font-size: 16px;
    line-height: 1.75;
    color: #3d3630;
    margin-bottom: 20px;
    transition: color 2s ease;
}

.shelf-message.in-view .message-text {
    color: #f4efe4cc;
}

.message-final {
    font-family: 'Cormorant Garamond', serif;
    font-weight: 300;
    font-size: 1.5rem;
    letter-spacing: 0.04em;
    margin-top: 20px;
}

.shelf-message.in-view .message-final {
    color: #c9a84c;
}

.message-signature {
    margin-top: 40px;
    text-align: center;
}

.message-signature .caption-text {
    transition: color 2s ease;
}

.shelf-message.in-view .message-signature .caption-text {
    color: #8fa89a;
}


/* ============================================
   Responsive
   ============================================ */
@media (max-width: 1024px) {
    .collection-grid {
        grid-template-columns: repeat(3, 1fr);
    }

    .bottle-amphora { grid-column: 1; }
    .bottle-carafe { grid-column: 2; }
    .bottle-flask { grid-column: 3; }
    .bottle-vial { grid-column: 1; }
    .bottle-demijohn { grid-column: 2; }
    .bottle-apothecary { grid-column: 3; }
    .bottle-tokkuri { grid-column: 1; }
    .bottle-flacon { grid-column: 2; }
    .bottle-jug { grid-column: 3; }
    .bottle-pot { grid-column: 1; }

    .crack-text-container {
        padding: 120px 8%;
        max-width: none;
        margin: 0;
    }
}

@media (max-width: 768px) {
    .kiln-layout {
        flex-direction: column;
    }

    .kiln-left {
        width: 100%;
        min-height: 40vh;
    }

    .kiln-divider {
        display: none;
    }

    .kiln-right {
        width: 100%;
        padding: 60px 8%;
        margin-left: 0;
    }

    .glaze-header {
        padding-left: 8%;
    }

    .glaze-track {
        padding: 0 8%;
    }

    .glaze-tile {
        width: 240px;
        height: 300px;
    }

    .shelf-collection {
        padding: 80px 6%;
    }

    .collection-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 24px 16px;
    }

    .bottle-amphora,
    .bottle-carafe,
    .bottle-flask,
    .bottle-vial,
    .bottle-demijohn,
    .bottle-apothecary,
    .bottle-tokkuri,
    .bottle-flacon,
    .bottle-jug,
    .bottle-pot {
        margin-top: 0;
    }

    .crack-text-container {
        padding: 80px 6%;
    }
}

@media (max-width: 480px) {
    .collection-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}
