/* ============================================
   bada.quest — styles.css
   Light-academia bento-box with frost & bubbles
   ============================================ */

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

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

body {
    background-color: #FFFDF7;
    color: #4A3F35;
    font-family: 'DM Sans', sans-serif;
    font-weight: 400;
    font-size: clamp(0.95rem, 1.1vw, 1.1rem);
    letter-spacing: 0.005em;
    line-height: 1.65;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* --- CSS CUSTOM PROPERTIES --- */
:root {
    --shadow-resting: 0 8px 32px rgba(61, 43, 31, 0.06), 0 2px 8px rgba(61, 43, 31, 0.04);
    --shadow-hover: 0 16px 48px rgba(61, 43, 31, 0.08), 0 4px 12px rgba(61, 43, 31, 0.05);
    --frost-bg: rgba(255, 253, 247, 0.72);
    --frost-border: 1px solid rgba(180, 168, 152, 0.25);
    --frost-blur: blur(24px) saturate(1.4);
    --bounce-ease: cubic-bezier(0.34, 1.56, 0.64, 1);
    --smooth-ease: cubic-bezier(0.23, 1, 0.32, 1);
    --color-espresso: #3D2B1F;
    --color-charcoal: #4A3F35;
    --color-taupe: #8C7E6F;
    --color-honey: #D4A853;
    --color-rose: #C4908A;
    --color-sage: #7A8B6F;
    --color-ivory: #FFFDF7;
}

/* --- PAPER TEXTURE OVERLAY --- */
.paper-texture {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 9999;
    opacity: 0.025;
}

/* --- GLOBAL TYPOGRAPHY --- */
h1, h2, h3, blockquote {
    font-family: 'Fraunces', serif;
    color: var(--color-espresso);
    letter-spacing: -0.015em;
    line-height: 1.15;
}

.mono-label {
    font-family: 'IBM Plex Mono', monospace;
    font-weight: 400;
    font-size: 0.85rem;
    color: var(--color-sage);
    text-transform: none;
}

a {
    color: var(--color-espresso);
    text-decoration: none;
    background-image: linear-gradient(var(--color-honey), var(--color-honey));
    background-position: 0 100%;
    background-repeat: no-repeat;
    background-size: 0% 2px;
    transition: background-size 300ms ease;
}

a:hover {
    background-size: 100% 2px;
}

/* --- BACKGROUND BUBBLES (fixed, drift behind all content) --- */
.background-bubbles {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
    overflow: hidden;
}

/* --- BUBBLE BASE STYLES --- */
.bubble {
    border-radius: 50%;
    position: absolute;
    background: radial-gradient(circle at 35% 35%,
        rgba(255, 255, 255, 0.6) 0%,
        rgba(212, 168, 83, 0.12) 40%,
        rgba(196, 144, 138, 0.08) 70%,
        rgba(122, 139, 111, 0.05) 100%
    );
    border: 1px solid rgba(255, 255, 255, 0.4);
    will-change: transform;
}

/* Specular highlight on every bubble */
.bubble::before {
    content: '';
    position: absolute;
    width: 30%;
    height: 30%;
    top: 18%;
    left: 22%;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.7) 0%, transparent 70%);
}

/* Background bubble positions and sizes */
.bubble-bg-1 {
    width: 160px; height: 160px;
    top: 15%; left: 8%;
    animation: bubbleFloat 10s ease-in-out infinite;
}
.bubble-bg-2 {
    width: 90px; height: 90px;
    top: 45%; right: 5%;
    animation: bubbleFloat 7s ease-in-out infinite 1s;
}
.bubble-bg-3 {
    width: 120px; height: 120px;
    bottom: 25%; left: 15%;
    animation: bubbleFloat 9s ease-in-out infinite 2s;
}
.bubble-bg-4 {
    width: 70px; height: 70px;
    top: 60%; left: 65%;
    animation: bubbleFloat 8s ease-in-out infinite 3s;
}
.bubble-bg-5 {
    width: 200px; height: 200px;
    top: 30%; right: 15%;
    animation: bubbleFloat 12s ease-in-out infinite 0.5s;
    opacity: 0.5;
}
.bubble-bg-6 {
    width: 50px; height: 50px;
    bottom: 10%; right: 30%;
    animation: bubbleFloat 6s ease-in-out infinite 4s;
}
.bubble-bg-7 {
    width: 100px; height: 100px;
    top: 75%; left: 42%;
    animation: bubbleFloat 11s ease-in-out infinite 1.5s;
    opacity: 0.4;
}

@keyframes bubbleFloat {
    0%   { transform: translateY(0) translateX(0) scale(1); }
    25%  { transform: translateY(-10px) translateX(5px) scale(1.02); }
    50%  { transform: translateY(-15px) translateX(-3px) scale(1.03); }
    75%  { transform: translateY(-8px) translateX(4px) scale(1.01); }
    100% { transform: translateY(0) translateX(0) scale(1); }
}

/* --- HERO SECTION --- */
.hero {
    width: 100%;
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    position: relative;
    z-index: 1;
}

.hero-cell {
    width: 100%;
    max-width: 1120px;
    height: calc(100vh - 48px);
    border-radius: 20px;
    background: var(--frost-bg);
    border: var(--frost-border);
    backdrop-filter: var(--frost-blur);
    -webkit-backdrop-filter: var(--frost-blur);
    box-shadow: var(--shadow-resting);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
    opacity: 0;
    animation: heroFadeIn 600ms ease-out 100ms forwards;
}

@keyframes heroFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* Hero bubbles container */
.hero-bubbles {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.hero-bubble {
    position: absolute;
    opacity: 0;
    transition: transform 350ms var(--smooth-ease), filter 350ms var(--smooth-ease);
}

/* Three hero bubbles: 80px, 140px, 56px — drift from edges */
.hero-bubble-1 {
    width: 80px; height: 80px;
    top: 20%; left: 15%;
    animation: heroBubbleDrift1 1.2s var(--smooth-ease) 200ms forwards,
               bubbleFloat 8s ease-in-out 1.6s infinite;
}
.hero-bubble-2 {
    width: 140px; height: 140px;
    top: 55%; right: 12%;
    animation: heroBubbleDrift2 1.2s var(--smooth-ease) 400ms forwards,
               bubbleFloat 10s ease-in-out 1.8s infinite;
}
.hero-bubble-3 {
    width: 56px; height: 56px;
    bottom: 25%; left: 55%;
    animation: heroBubbleDrift3 1.2s var(--smooth-ease) 300ms forwards,
               bubbleFloat 6s ease-in-out 1.7s infinite;
}

@keyframes heroBubbleDrift1 {
    from { transform: translateX(-100px); opacity: 0; }
    to   { transform: translateX(0); opacity: 1; }
}
@keyframes heroBubbleDrift2 {
    from { transform: translateY(100px); opacity: 0; }
    to   { transform: translateY(0); opacity: 1; }
}
@keyframes heroBubbleDrift3 {
    from { transform: translateX(80px) translateY(60px); opacity: 0; }
    to   { transform: translateX(0) translateY(0); opacity: 1; }
}

/* Hero title: Fraunces weight 300, bounce-enter at 1.4s */
.hero-title {
    font-family: 'Fraunces', serif;
    font-weight: 300;
    font-size: clamp(2.8rem, 8vw, 5.6rem);
    color: var(--color-espresso);
    letter-spacing: -0.015em;
    line-height: 1.15;
    opacity: 0;
    transform: translateY(30px) scale(0.92);
    animation: bounceEnterHero 700ms var(--bounce-ease) 1.4s forwards;
    position: relative;
    z-index: 2;
}

@keyframes bounceEnterHero {
    from {
        transform: translateY(30px) scale(0.92);
        opacity: 0;
    }
    to {
        transform: translateY(0) scale(1);
        opacity: 1;
    }
}

/* Hero subtitle: DM Sans, fades in 400ms after title */
.hero-subtitle {
    font-family: 'DM Sans', sans-serif;
    font-weight: 400;
    font-size: clamp(1rem, 1.8vw, 1.3rem);
    color: var(--color-taupe);
    margin-top: 16px;
    letter-spacing: 0.02em;
    opacity: 0;
    animation: subtitleFadeIn 500ms ease-out 2.1s forwards;
    position: relative;
    z-index: 2;
}

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

/* --- SECTION DIVIDERS --- */
.section-divider {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 120px;
    max-width: 1120px;
    margin: 0 auto;
    padding: 0 24px;
    position: relative;
    z-index: 1;
}

.divider-line {
    flex: 1;
    height: 1px;
    background: rgba(180, 168, 152, 0.3);
}

.divider-bubble {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    margin: 0 16px;
    background: var(--frost-bg);
    border: 1px solid rgba(180, 168, 152, 0.25);
    backdrop-filter: var(--frost-blur);
    -webkit-backdrop-filter: var(--frost-blur);
    flex-shrink: 0;
}

/* --- BENTO GRID SYSTEM --- */
.chapter {
    position: relative;
    z-index: 1;
    padding: 0 24px;
}

.bento-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    max-width: 1120px;
    margin: 0 auto;
}

/* --- BENTO CELL BASE --- */
.bento-cell {
    border-radius: 20px;
    background: var(--frost-bg);
    border: var(--frost-border);
    backdrop-filter: var(--frost-blur);
    -webkit-backdrop-filter: var(--frost-blur);
    box-shadow: var(--shadow-resting);
    padding: 24px;
    position: relative;
    overflow: hidden;
    /* Bounce-enter initial state */
    opacity: 0;
    transform: translateY(24px) scale(0.96);
    transition: transform 650ms var(--bounce-ease),
                opacity 400ms ease-out,
                box-shadow 350ms var(--smooth-ease);
    transition-delay: calc(var(--cell-index, 0) * 80ms);
}

/* Revealed state (toggled by IntersectionObserver) */
.bento-cell.visible {
    opacity: 1;
    transform: translateY(0) scale(1);
}

/* Hover lift effect */
.bento-cell:hover {
    transform: translateY(-4px) scale(1);
    box-shadow: var(--shadow-hover);
}

.bento-cell.visible:hover {
    transform: translateY(-4px) scale(1);
}

/* --- CELL LABELS --- */
.cell-label {
    display: block;
    margin-bottom: 12px;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

/* --- CELL HEADINGS --- */
.cell-heading {
    font-family: 'Fraunces', serif;
    font-weight: 500;
    font-size: clamp(1.6rem, 4vw, 2.8rem);
    color: var(--color-espresso);
    letter-spacing: -0.015em;
    line-height: 1.15;
    margin-bottom: 12px;
}

/* --- CELL BODY TEXT --- */
.cell-body {
    font-family: 'DM Sans', sans-serif;
    font-weight: 400;
    color: var(--color-charcoal);
    line-height: 1.65;
}

/* --- PHOTO CELLS --- */
.photo-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    min-height: 160px;
}

.illustration-photo {
    width: 100%;
    max-width: 320px;
    height: auto;
    filter: saturate(0.85) contrast(0.95) brightness(1.05) sepia(0.08);
}

/* ============================================
   CHAPTER 1: THE BEGINNING
   2x2 photo | 1x1 + 1x1 text | 2x1 wide text
   ============================================ */
.bento-beginning {
    grid-template-columns: repeat(4, 1fr);
    grid-template-rows: repeat(3, minmax(180px, auto));
}

.bento-beginning .cell-large {
    grid-column: 1 / 3;
    grid-row: 1 / 3;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.bento-beginning .cell-large .cell-label {
    position: absolute;
    bottom: 16px;
    right: 20px;
    margin: 0;
}

.bento-beginning .cell-1x1-a {
    grid-column: 3 / 4;
    grid-row: 1 / 2;
}

.bento-beginning .cell-1x1-b {
    grid-column: 4 / 5;
    grid-row: 1 / 2;
}

.bento-beginning .cell-wide {
    grid-column: 3 / 5;
    grid-row: 2 / 3;
}

/* ============================================
   CHAPTER 2: THE JOURNEY
   Mixed bento: dotgrid, bubble, wide, photo, quote, frost
   ============================================ */
.bento-journey {
    grid-template-columns: repeat(4, 1fr);
    grid-template-rows: repeat(3, minmax(180px, auto));
}

/* Dot-grid cell: simulates premium notebook dot-grid pages */
.cell-journey-dotgrid {
    grid-column: 1 / 3;
    grid-row: 1 / 2;
    background-image:
        radial-gradient(circle, rgba(180, 168, 152, 0.12) 1px, transparent 1px);
    background-size: 32px 32px;
    background-color: rgba(255, 253, 247, 0.72);
}

/* Bubble feature cell */
.cell-bubble-feature {
    grid-column: 3 / 5;
    grid-row: 1 / 2;
    display: flex;
    align-items: center;
    justify-content: center;
}

.cell-bubble-feature .cell-label {
    position: absolute;
    bottom: 16px;
    right: 20px;
    margin: 0;
}

.feature-bubble {
    position: absolute;
    transition: transform 400ms var(--smooth-ease);
}

.feature-bubble-large {
    width: 140px;
    height: 140px;
    top: 50%;
    left: 40%;
    transform: translate(-50%, -50%);
    animation: bubbleFloat 10s ease-in-out infinite;
}

.feature-bubble-medium {
    width: 80px;
    height: 80px;
    top: 25%;
    left: 65%;
    animation: bubbleFloat 8s ease-in-out infinite 1s;
}

.feature-bubble-small {
    width: 48px;
    height: 48px;
    top: 60%;
    right: 15%;
    animation: bubbleFloat 7s ease-in-out infinite 2s;
}

/* Wide text cell */
.cell-journey-wide {
    grid-column: 1 / 3;
    grid-row: 2 / 3;
}

/* Photo cell */
.cell-journey-photo {
    grid-column: 3 / 4;
    grid-row: 2 / 3;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.cell-journey-photo .cell-label {
    position: absolute;
    bottom: 16px;
    right: 20px;
    margin: 0;
}

/* Quote cell */
.cell-journey-quote {
    grid-column: 4 / 5;
    grid-row: 2 / 3;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.cell-journey-quote .cell-label {
    margin-top: 12px;
    margin-bottom: 0;
}

.pull-quote {
    font-family: 'Fraunces', serif;
    font-style: italic;
    font-weight: 300;
    font-size: clamp(1.1rem, 2vw, 1.4rem);
    color: var(--color-espresso);
    line-height: 1.4;
    text-align: center;
}

/* Frost-lines cell: diagonal lines evoking frost on windowpane */
.cell-journey-frost {
    grid-column: 1 / 5;
    grid-row: 3 / 4;
    background-image:
        repeating-linear-gradient(
            45deg,
            transparent,
            transparent 40px,
            rgba(255, 255, 255, 0.5) 40px,
            rgba(255, 255, 255, 0.5) 41px
        );
}

/* ============================================
   CHAPTER 3: THE HORIZON
   Single wide cell with reflective quote + bubbles
   ============================================ */
.bento-horizon {
    grid-template-columns: 1fr;
    grid-template-rows: minmax(280px, auto);
}

.cell-horizon-quote {
    grid-column: 1 / -1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 60px 40px;
    position: relative;
    min-height: 360px;
}

.horizon-quote {
    font-family: 'Fraunces', serif;
    font-style: italic;
    font-weight: 300;
    font-size: clamp(1.6rem, 3.5vw, 2.6rem);
    color: var(--color-espresso);
    line-height: 1.45;
    text-align: center;
    letter-spacing: -0.01em;
    position: relative;
    z-index: 2;
}

.horizon-bubble {
    position: absolute;
    z-index: 1;
    transition: transform 400ms var(--smooth-ease);
}

.horizon-bubble-1 {
    width: 120px;
    height: 120px;
    top: 10%;
    left: 8%;
    animation: bubbleFloat 9s ease-in-out infinite;
}

.horizon-bubble-2 {
    width: 80px;
    height: 80px;
    bottom: 15%;
    right: 10%;
    animation: bubbleFloat 7s ease-in-out infinite 1.5s;
}

.horizon-bubble-3 {
    width: 50px;
    height: 50px;
    top: 60%;
    right: 35%;
    animation: bubbleFloat 8s ease-in-out infinite 3s;
}

/* --- FOOTER --- */
.site-footer {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 48px 24px 60px;
    position: relative;
    z-index: 1;
}

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

.footer-dot {
    color: var(--color-rose);
    font-size: 1rem;
}

/* ============================================
   RESPONSIVE: TABLET (< 768px)
   Grid collapses to 2 columns
   ============================================ */
@media (max-width: 768px) {
    .bento-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }

    .bento-beginning {
        grid-template-rows: auto;
    }

    .bento-beginning .cell-large {
        grid-column: 1 / 3;
        grid-row: 1 / 2;
    }

    .bento-beginning .cell-1x1-a {
        grid-column: 1 / 2;
        grid-row: 2 / 3;
    }

    .bento-beginning .cell-1x1-b {
        grid-column: 2 / 3;
        grid-row: 2 / 3;
    }

    .bento-beginning .cell-wide {
        grid-column: 1 / 3;
        grid-row: 3 / 4;
    }

    .bento-journey {
        grid-template-rows: auto;
    }

    .cell-journey-dotgrid {
        grid-column: 1 / 3;
        grid-row: 1 / 2;
    }

    .cell-bubble-feature {
        grid-column: 1 / 3;
        grid-row: 2 / 3;
        min-height: 200px;
    }

    .cell-journey-wide {
        grid-column: 1 / 3;
        grid-row: 3 / 4;
    }

    .cell-journey-photo {
        grid-column: 1 / 2;
        grid-row: 4 / 5;
    }

    .cell-journey-quote {
        grid-column: 2 / 3;
        grid-row: 4 / 5;
    }

    .cell-journey-frost {
        grid-column: 1 / 3;
        grid-row: 5 / 6;
    }

    .section-divider {
        height: 80px;
    }

    .cell-horizon-quote {
        padding: 40px 24px;
        min-height: 280px;
    }
}

/* ============================================
   RESPONSIVE: MOBILE (< 480px)
   Single stacked column with 12px gaps
   ============================================ */
@media (max-width: 480px) {
    .bento-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .bento-beginning .cell-large,
    .bento-beginning .cell-1x1-a,
    .bento-beginning .cell-1x1-b,
    .bento-beginning .cell-wide {
        grid-column: 1 / -1;
        grid-row: auto;
    }

    .cell-journey-dotgrid,
    .cell-bubble-feature,
    .cell-journey-wide,
    .cell-journey-photo,
    .cell-journey-quote,
    .cell-journey-frost {
        grid-column: 1 / -1;
        grid-row: auto;
    }

    .cell-bubble-feature {
        min-height: 200px;
    }

    .hero-cell {
        height: calc(100vh - 48px);
        border-radius: 16px;
    }

    .hero-title {
        font-size: clamp(2.2rem, 10vw, 3.2rem);
    }

    .cell-heading {
        font-size: clamp(1.3rem, 5vw, 1.8rem);
    }

    .horizon-quote {
        font-size: clamp(1.3rem, 5vw, 1.8rem);
    }

    .section-divider {
        height: 60px;
    }

    .cell-horizon-quote {
        padding: 32px 20px;
        min-height: 240px;
    }
}

/* ============================================
   PREFERS REDUCED MOTION
   Falls back to simple opacity transitions
   ============================================ */
@media (prefers-reduced-motion: reduce) {
    .bubble,
    .hero-bubble,
    .hero-title,
    .hero-subtitle,
    .hero-cell,
    .bento-cell {
        animation: none !important;
        transition: opacity 300ms ease-out !important;
    }

    .hero-cell {
        opacity: 1;
    }

    .hero-title {
        opacity: 1;
        transform: none;
    }

    .hero-subtitle {
        opacity: 1;
    }

    .hero-bubble {
        opacity: 1;
    }

    .bento-cell {
        opacity: 1;
        transform: none;
    }
}
