/* ============================================
   lovable.dev — Glassmorphism + Bento-Box
   ============================================ */

/* --- Design Palette Reference ---
   Primary Warm Parchment: #F5E6D0
   Frosted White: rgba(255,255,255,0.25)
   Deep Ink: #2B1810
   Rose Quartz: #E8A0BF
   Amber Glow: #F0C27F
   Crystal Violet: #B8A9C9
   Sage Frost: #A8C5A0
   Warm Shadow: #3D2914
*/

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

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

body {
    font-family: 'DM Sans', sans-serif;
    font-weight: 400;
    color: #2B1810;
    background: #F5E6D0;
    line-height: 1.7;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

/* --- Paper Texture Background --- */
#paper-bg {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    pointer-events: none;
    background: #F5E6D0;
}

#paper-grain-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    filter: url(#paper-grain);
    opacity: 0.08;
    background: #F5E6D0;
}

.amber-spot {
    position: absolute;
    width: 350px;
    height: 350px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(240, 194, 127, 0.15) 0%, transparent 70%);
    transform: translate(-50%, -50%);
}

/* --- Menu Pill --- */
#menu-pill {
    position: fixed;
    top: 24px;
    right: 24px;
    z-index: 100;
    width: 56px;
    height: 56px;
    border-radius: 28px;
    border: 1px solid rgba(255, 255, 255, 0.4);
    background: rgba(255, 255, 255, 0.25);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.06);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.3s ease, background 0.3s ease;
}

#menu-pill:hover {
    transform: scale(1.08);
    background: rgba(255, 255, 255, 0.35);
}

/* --- Menu Overlay --- */
#menu-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 200;
    background: rgba(255, 255, 255, 0.25);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 1;
    transition: opacity 0.4s ease;
}

#menu-overlay.hidden {
    opacity: 0;
    pointer-events: none;
}

#menu-content {
    text-align: center;
    position: relative;
}

#menu-close {
    position: absolute;
    top: -80px;
    right: 0;
    width: 48px;
    height: 48px;
    border-radius: 24px;
    border: 1px solid rgba(255, 255, 255, 0.4);
    background: rgba(255, 255, 255, 0.25);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.3s ease;
}

#menu-close:hover {
    transform: scale(1.1);
}

nav {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.menu-link {
    font-family: 'Outfit', sans-serif;
    font-weight: 700;
    font-size: clamp(2rem, 5vw, 3.5rem);
    color: #2B1810;
    text-decoration: none;
    letter-spacing: -0.03em;
    transition: opacity 0.3s ease;
}

.menu-link:hover {
    opacity: 0.6;
}

/* --- Typography --- */
.gradient-text {
    background: linear-gradient(135deg, #E8A0BF, #F0C27F);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.caveat-text {
    font-family: 'Caveat', cursive;
    font-weight: 400;
}

/* --- Bento Sections --- */
.bento-section {
    position: relative;
    z-index: 1;
    padding: 24px;
}

/* --- Bento Grid --- */
.bento-grid {
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    gap: 24px;
    max-width: 1200px;
    margin: 0 auto;
}

/* --- Bento Cell (Glassmorphism) --- */
.bento-cell {
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.25);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 255, 255, 0.4);
    box-shadow: 0 8px 32px rgba(61, 41, 20, 0.08);
    position: relative;
    overflow: hidden;
    transition: backdrop-filter 0.6s ease;
}

/* --- Frosted Glass Light Refraction --- */
.cell-refraction {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
}

.cell-refraction::before {
    content: '';
    position: absolute;
    top: -20%;
    left: -10%;
    width: 140%;
    height: 8px;
    background: linear-gradient(
        90deg,
        rgba(232, 160, 191, 0.15),
        rgba(240, 194, 127, 0.15),
        rgba(168, 197, 160, 0.12),
        rgba(184, 169, 201, 0.15),
        rgba(232, 160, 191, 0.1)
    );
    transform: rotate(-35deg);
    transform-origin: center;
    border-radius: 4px;
    opacity: 0.3;
}

/* ============================================
   HERO SECTION
   ============================================ */
#hero {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding-top: 80px;
}

.bento-grid--hero {
    grid-template-rows: 1fr 1fr;
}

.hero-cell {
    grid-column: 1 / 9;
    grid-row: 1 / 3;
    padding: 48px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-height: 400px;
}

.hero-headline {
    font-family: 'Outfit', sans-serif;
    font-weight: 700;
    font-size: clamp(3rem, 10vw, 7rem);
    letter-spacing: -0.03em;
    line-height: 1.05;
    position: relative;
    z-index: 2;
}

.hero-counter {
    margin-top: 32px;
    display: flex;
    align-items: center;
    gap: 16px;
    position: relative;
    z-index: 2;
}

.counter-label {
    font-size: clamp(0.85rem, 1.5vw, 1.1rem);
    color: #2B1810;
    opacity: 0.6;
    transform: rotate(-2deg);
    display: inline-block;
}

.counter-digits {
    display: flex;
    gap: 2px;
    height: 48px;
    overflow: hidden;
}

.digit-column {
    width: 32px;
    height: 48px;
    overflow: hidden;
    position: relative;
}

.digit-strip {
    display: flex;
    flex-direction: column;
    transition: transform 1.2s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.digit-strip span {
    font-family: 'Outfit', sans-serif;
    font-weight: 700;
    font-size: 2.5rem;
    line-height: 48px;
    text-align: center;
    display: block;
    height: 48px;
    color: #2B1810;
}

/* Hand annotation */
.hand-annotation {
    position: absolute;
    z-index: 3;
    opacity: 0;
}

.hero-arrow {
    bottom: 48px;
    right: 80px;
}

/* Companion cells */
.companion-cell {
    padding: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.companion-top {
    grid-column: 9 / 13;
    grid-row: 1 / 2;
}

.companion-bottom {
    grid-column: 9 / 13;
    grid-row: 2 / 3;
}

.tagline {
    font-size: clamp(1.2rem, 2.5vw, 1.8rem);
    color: #2B1810;
    transform: rotate(-2deg);
    text-align: center;
    line-height: 1.4;
}

/* Crystal cluster */
.crystal-cluster {
    animation: crystal-rotate 20s linear infinite;
}

@keyframes crystal-rotate {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* Crystal junctions */
.crystal-junction {
    position: absolute;
    z-index: 5;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.6s ease, transform 0.8s ease;
}

.crystal-junction--1 {
    top: 50%;
    left: calc(66.66% + 12px);
    transform: translate(-50%, -50%) scale(0.3);
}

.crystal-junction--2 {
    bottom: -20px;
    left: 30%;
    transform: scale(0.3);
}

.crystal-junction--3 {
    bottom: -16px;
    right: 25%;
    transform: scale(0.3);
}

.crystal-junction--4 {
    bottom: -24px;
    left: 50%;
    transform: translateX(-50%) scale(0.3);
}

.crystal-junction.grown {
    opacity: 0.8;
    transform: scale(1);
}

.crystal-junction--1.grown {
    transform: translate(-50%, -50%) scale(1);
}

.crystal-junction--4.grown {
    transform: translateX(-50%) scale(1);
}

/* ============================================
   CONCEPTS SECTION
   ============================================ */
#concepts {
    padding-top: 40px;
    padding-bottom: 60px;
}

.bento-grid--concepts {
    grid-template-columns: repeat(12, 1fr);
}

.concept-cell {
    grid-column: span 3;
    padding: 32px 24px;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 16px;
    min-height: 180px;
    justify-content: center;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.concept-cell:hover {
    border-color: rgba(168, 197, 160, 0.6);
    box-shadow: 0 8px 32px rgba(61, 41, 20, 0.1);
}

.concept-icon {
    flex-shrink: 0;
}

.concept-word {
    font-family: 'Outfit', sans-serif;
    font-weight: 700;
    font-size: clamp(1.8rem, 5vw, 3.2rem);
    letter-spacing: -0.03em;
    line-height: 1.1;
    color: #2B1810;
}

.word-carousel {
    height: 28px;
    overflow: hidden;
    position: relative;
}

.carousel-track {
    display: flex;
    flex-direction: column;
    transition: transform 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.carousel-word {
    font-family: 'Caveat', cursive;
    font-size: clamp(0.85rem, 1.5vw, 1.1rem);
    color: #B8A9C9;
    height: 28px;
    line-height: 28px;
    display: block;
    opacity: 0.5;
}

.carousel-word.active {
    opacity: 1;
}

/* ============================================
   SHOWCASE SECTION
   ============================================ */
#showcase {
    padding-top: 40px;
    padding-bottom: 60px;
}

.bento-grid--showcase {
    grid-template-columns: repeat(12, 1fr);
    grid-template-rows: auto;
}

.showcase-cell {
    grid-column: 1 / 9;
    padding: 40px;
    min-height: 360px;
}

.section-headline {
    font-family: 'Outfit', sans-serif;
    font-weight: 700;
    font-size: clamp(1.8rem, 5vw, 3.2rem);
    letter-spacing: -0.03em;
    line-height: 1.1;
    color: #2B1810;
    margin-bottom: 32px;
    position: relative;
    z-index: 2;
}

.showcase-scroll {
    overflow-x: auto;
    overflow-y: hidden;
    position: relative;
    z-index: 2;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.showcase-scroll::-webkit-scrollbar {
    display: none;
}

.showcase-track {
    display: flex;
    gap: 16px;
    padding-bottom: 8px;
}

.showcase-card {
    flex-shrink: 0;
    width: 200px;
    padding: 24px 20px;
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.35);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    display: flex;
    flex-direction: column;
    gap: 12px;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.showcase-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 40px rgba(61, 41, 20, 0.1);
    border-color: #A8C5A0;
}

.card-name {
    font-family: 'Outfit', sans-serif;
    font-weight: 700;
    font-size: 1.6rem;
    letter-spacing: -0.03em;
    color: #2B1810;
}

.star-rating {
    display: flex;
    gap: 4px;
}

.star {
    width: 18px;
    height: 18px;
    fill: rgba(240, 194, 127, 0.2);
    transition: fill 0.3s ease;
}

.star.filled {
    fill: #F0C27F;
}

.card-version {
    font-size: 0.95rem;
    color: #B8A9C9;
}

/* Sidebar cell */
.sidebar-cell {
    grid-column: 9 / 13;
    grid-row: 1 / 2;
    padding: 40px 24px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 32px;
    min-height: 360px;
}

.sidebar-label {
    font-family: 'DM Sans', sans-serif;
    font-weight: 500;
    font-size: 0.75rem;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: #2B1810;
    opacity: 0.5;
    writing-mode: vertical-rl;
    text-orientation: mixed;
}

.version-counter {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.version-counter .caveat-text {
    font-size: 0.9rem;
    color: #2B1810;
    opacity: 0.5;
    transform: rotate(2deg);
}

.version-number {
    font-family: 'Outfit', sans-serif;
    font-weight: 700;
    font-size: 1.4rem;
    color: #2B1810;
    transition: opacity 0.3s ease;
}

/* ============================================
   CLOSING SECTION
   ============================================ */
#closing {
    padding-top: 60px;
    padding-bottom: 120px;
    min-height: 80vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    position: relative;
}

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

.closing-cell {
    grid-column: 1 / -1;
    padding: 80px 48px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    min-height: 350px;
    position: relative;
}

.closing-headline {
    font-family: 'Outfit', sans-serif;
    font-weight: 700;
    font-size: clamp(2.5rem, 8vw, 5.5rem);
    letter-spacing: -0.03em;
    line-height: 1.1;
    color: #2B1810;
    position: relative;
    z-index: 2;
    display: flex;
    flex-wrap: wrap;
    gap: 0 0.3em;
    justify-content: center;
}

.closing-word {
    display: inline-block;
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

.closing-word.visible {
    opacity: 1;
    transform: translateY(0);
}

.love-word {
    background: linear-gradient(135deg, #E8A0BF, #F0C27F);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    position: relative;
}

.love-circle-annotation {
    position: absolute;
    z-index: 3;
    pointer-events: none;
    top: 50%;
    right: 10%;
    transform: translate(0, -55%);
}

.draw-circle {
    transition: stroke-dashoffset 1.5s ease-in-out;
}

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

.draw-path {
    transition: stroke-dashoffset 1s ease-in-out;
}

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

.closing-arrow {
    bottom: 100px;
    left: 15%;
}

.closing-sub {
    font-size: clamp(1rem, 2vw, 1.4rem);
    color: #2B1810;
    opacity: 0;
    transform: translateY(15px) rotate(-1deg);
    transition: opacity 0.8s ease 1.5s, transform 0.8s ease 1.5s;
    margin-top: 24px;
    position: relative;
    z-index: 2;
}

.closing-sub.visible {
    opacity: 0.7;
    transform: translateY(0) rotate(-1deg);
}

/* Golden hour overlay */
.golden-hour-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 60%;
    background: radial-gradient(
        ellipse at 50% 100%,
        rgba(240, 194, 127, 0) 0%,
        rgba(240, 194, 127, 0) 100%
    );
    pointer-events: none;
    z-index: 0;
    transition: background 1.5s ease;
}

.golden-hour-overlay.warm {
    background: radial-gradient(
        ellipse at 50% 100%,
        rgba(240, 194, 127, 0.2) 0%,
        rgba(240, 194, 127, 0) 70%
    );
}

/* ============================================
   ANIMATIONS — Entry States
   ============================================ */
[data-animate] {
    opacity: 0;
    transition: opacity 0.8s ease, transform 0.8s ease, backdrop-filter 0.6s ease;
}

[data-animate="fade-blur"] {
    filter: blur(8px);
    transform: scale(0.97);
}

[data-animate="slide-left"] {
    transform: translateX(-60px);
}

[data-animate="slide-right"] {
    transform: translateX(60px);
}

[data-animate].in-view {
    opacity: 1;
    filter: blur(0);
    transform: translateX(0) scale(1);
}

/* ============================================
   RESPONSIVE — Mobile
   ============================================ */
@media (max-width: 768px) {
    .bento-section {
        padding: 16px;
    }

    .bento-grid {
        gap: 16px;
    }

    .bento-grid--hero {
        grid-template-columns: 1fr;
        grid-template-rows: auto auto auto;
    }

    .hero-cell {
        grid-column: 1 / -1;
        grid-row: 1 / 2;
        padding: 32px 24px;
        min-height: 280px;
    }

    .companion-top {
        grid-column: 1 / -1;
        grid-row: 2 / 3;
    }

    .companion-bottom {
        grid-column: 1 / -1;
        grid-row: 3 / 4;
    }

    .bento-grid--concepts {
        grid-template-columns: repeat(2, 1fr);
    }

    .concept-cell {
        grid-column: span 1;
        min-height: 140px;
        padding: 24px 16px;
    }

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

    .showcase-cell {
        grid-column: 1 / -1;
        padding: 24px;
        min-height: auto;
    }

    .sidebar-cell {
        grid-column: 1 / -1;
        grid-row: auto;
        min-height: auto;
        padding: 32px 24px;
        writing-mode: initial;
    }

    .sidebar-label {
        writing-mode: horizontal-tb;
    }

    .closing-cell {
        padding: 48px 24px;
    }

    .crystal-junction {
        display: none;
    }

    .love-circle-annotation {
        width: 120px;
        right: 5%;
    }

    .hero-arrow,
    .closing-arrow {
        display: none;
    }
}

@media (max-width: 480px) {
    .bento-grid--concepts {
        grid-template-columns: 1fr;
    }

    .concept-cell {
        grid-column: 1 / -1;
    }

    .showcase-card {
        width: 160px;
    }
}
