/* luminous.day - Earth-toned Memphis Bento Grid */

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

html {
    scroll-behavior: smooth;
    overflow-x: hidden;
}

body {
    font-family: 'Quicksand', sans-serif;
    font-weight: 500;
    color: #5c4033;
    background-color: #f5e6d0;
    background-image: repeating-radial-gradient(circle at 12px 12px, rgba(139, 115, 85, 0.15) 0px, rgba(139, 115, 85, 0.15) 3px, transparent 3px, transparent 24px);
    background-size: 24px 24px;
    line-height: 1.65;
    letter-spacing: 0.01em;
    font-size: clamp(1rem, 1.8vw, 1.25rem);
}

/* ===== TRAY INDICATOR ===== */
#tray-indicator {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1000;
    display: grid;
    grid-template-columns: repeat(3, 10px);
    grid-template-rows: repeat(2, 10px);
    gap: 3px;
    padding: 6px;
    background: rgba(245, 230, 208, 0.9);
    border: 1px solid #8b7355;
    border-radius: 4px;
}

.indicator-cell {
    width: 10px;
    height: 10px;
    background: #d4c9a8;
    border-radius: 2px;
    transition: background 0.3s ease;
}

.indicator-cell.active {
    background: #d4a574;
    box-shadow: 0 0 6px rgba(212, 165, 116, 0.6);
}

/* ===== TRAY (SECTION) BASE ===== */
.tray {
    min-height: 100vh;
    padding: clamp(8px, 1.5vw, 20px);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

/* ===== BENTO GRID BASE ===== */
.bento-grid {
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    gap: clamp(6px, 1.2vw, 16px);
    width: 100%;
    max-width: 1400px;
    height: 90vh;
}

/* ===== COMPARTMENT BASE ===== */
.compartment {
    border: 2px solid #8b7355;
    border-radius: clamp(4px, 0.8vw, 12px);
    padding: clamp(12px, 2vw, 28px);
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    transition: transform 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

/* ===== TRAY 1 — DAWN (HERO) ===== */
#tray-dawn {
    background: #f5e6d0;
}

.tray1-grid {
    grid-template-areas:
        "main main main main main main main main light light light light"
        "main main main main main main main main fish fish fish fish";
    grid-template-rows: 1fr 1fr;
}

.tray1-main {
    grid-area: main;
    background: #f5e6d0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.domain-title {
    font-family: 'Nunito', sans-serif;
    font-weight: 800;
    font-size: clamp(3.5rem, 8vw, 7rem);
    color: #3d2b1f;
    letter-spacing: -0.02em;
    line-height: 0.95;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0;
}

.mag-letter {
    display: inline-block;
    transition: transform 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    will-change: transform;
}

.mag-letter.dot {
    color: #2a9d8f;
}

.tagline {
    font-family: 'Quicksand', sans-serif;
    font-weight: 500;
    font-size: clamp(1rem, 2vw, 1.5rem);
    color: #8b7355;
    margin-top: 1.5rem;
}

.tray1-light {
    grid-area: light;
    background: #e8d5bc;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
}

.label-mono {
    font-family: 'Source Code Pro', monospace;
    font-weight: 400;
    font-size: clamp(0.7rem, 1vw, 0.9rem);
    color: #8b7355;
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

.ambient-gradient {
    width: 80%;
    height: 60%;
    border-radius: 50%;
    background: linear-gradient(135deg, #d4a574, #c47a5a, #deb89a, #b89a7e);
    background-size: 400% 400%;
    animation: ambientShift 60s ease infinite;
    filter: blur(8px);
    opacity: 0.8;
}

@keyframes ambientShift {
    0% { background-position: 0% 50%; }
    25% { background-position: 100% 0%; }
    50% { background-position: 100% 100%; }
    75% { background-position: 0% 100%; }
    100% { background-position: 0% 50%; }
}

.tray1-fish {
    grid-area: fish;
    background: #d4c9a8;
    display: flex;
    align-items: center;
    justify-content: center;
}

.bobbing-fish {
    animation: bobFish 4s ease-in-out infinite;
}

@keyframes bobFish {
    0%, 100% { transform: rotate(12deg) translateY(0); }
    50% { transform: rotate(12deg) translateY(-12px); }
}

/* ===== TRAY 2 — MORNING (CONCEPT) ===== */
#tray-morning {
    background: #e8d5bc;
}

.tray2-grid {
    grid-template-areas:
        "a a a a b b b b c c c c"
        "d d d d e e e e c c c c"
        "m m m m m m m m m m m m";
    grid-template-rows: 2fr 2fr 1fr;
}

.tray2-cell:nth-child(1) { grid-area: a; background: #f5e6d0; }
.tray2-cell:nth-child(2) { grid-area: b; background: #deb89a; }
.tray2-cell:nth-child(3) { grid-area: d; background: #d4c9a8; }
.tray2-cell:nth-child(4) { grid-area: e; background: #e8d5bc; border-color: #b89a7e; }
.tray2-tall { grid-area: c; background: #c47a5a; }
.tray2-marquee { grid-area: m; background: #f5e6d0; padding: 0; }

.gather-cell {
    opacity: 0;
    transform: scale(0.9) translateY(30px);
    transition: opacity 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.275),
                transform 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.gather-cell.gathered {
    opacity: 1;
    transform: scale(1) translateY(0);
}

.gather-cell[data-index="0"] { transition-delay: 0s; }
.gather-cell[data-index="1"] { transition-delay: 0.08s; }
.gather-cell[data-index="2"] { transition-delay: 0.16s; }
.gather-cell[data-index="3"] { transition-delay: 0.24s; }
.gather-cell[data-index="4"] { transition-delay: 0.32s; }
.gather-cell[data-index="5"] { transition-delay: 0.4s; }

.tray2-tall .poetic-text {
    color: #f5e6d0;
}

.poetic-text {
    font-family: 'Quicksand', sans-serif;
    font-weight: 500;
    font-size: clamp(0.85rem, 1.4vw, 1.1rem);
    color: #5c4033;
    text-align: center;
    margin-top: 12px;
    line-height: 1.5;
}

/* Marquee */
.marquee-track {
    width: 100%;
    height: 100%;
    overflow: hidden;
    display: flex;
    align-items: center;
}

.marquee-content {
    display: flex;
    align-items: center;
    gap: 24px;
    animation: marqueeScroll 30s linear infinite;
    white-space: nowrap;
    padding: 0 12px;
}

@keyframes marqueeScroll {
    0% { transform: translateX(0); }
    100% { transform: translateX(-50%); }
}

/* ===== TRAY 3 — MIDDAY (GALLERY) ===== */
#tray-midday {
    background: #deb89a;
}

.tray3-grid {
    grid-template-areas:
        "a a a a a b b b b b b b"
        "c c c c d d d d e e e e";
    grid-template-rows: 1fr 1fr;
}

.tray3-cell:nth-child(1) { grid-area: a; }
.tray3-cell:nth-child(2) { grid-area: b; }
.tray3-cell:nth-child(3) { grid-area: c; }
.tray3-cell:nth-child(4) { grid-area: d; }
.tray3-cell:nth-child(5) { grid-area: e; }

.gallery-cell {
    border-radius: clamp(12px, 2vw, 24px);
    transition: background-color 0.4s ease, transform 0.3s ease;
    cursor: pointer;
}

.gallery-cell[data-bg="#e8d5bc"] { background: #e8d5bc; }
.gallery-cell[data-bg="#d4c9a8"] { background: #d4c9a8; }
.gallery-cell[data-bg="#deb89a"] { background: #deb89a; border-color: #a0522d; }
.gallery-cell[data-bg="#f5e6d0"] { background: #f5e6d0; }

.gallery-cell:hover {
    background-color: #2a9d8f !important;
}

.gallery-cell:hover .gallery-fish {
    filter: hue-rotate(160deg) saturate(1.4) brightness(1.1);
}

.gallery-cell:hover .fish-name,
.gallery-cell:hover .field-note {
    color: #f5e6d0;
}

.gallery-fish {
    transition: filter 0.4s ease;
    max-width: 100%;
    max-height: 50%;
}

.fish-name {
    font-family: 'Baloo 2', cursive;
    font-weight: 700;
    font-size: clamp(0.75rem, 1.2vw, 1rem);
    color: #a0522d;
    margin-top: 8px;
    transition: color 0.4s ease;
}

.field-note {
    font-family: 'Quicksand', sans-serif;
    font-weight: 500;
    font-size: clamp(0.75rem, 1.1vw, 0.95rem);
    color: #5c4033;
    text-align: center;
    margin-top: 6px;
    transition: color 0.4s ease;
}

/* ===== TRAY 4 — AFTERNOON (INTERACTIVE) ===== */
#tray-afternoon {
    background: #d4c9a8;
}

.tray4-grid {
    grid-template-areas:
        "f f f f f f f f i1 i1 i1 i1"
        "f f f f f f f f i2 i2 i2 i2"
        "f f f f f f f f i3 i3 i3 i3";
    grid-template-rows: 1fr 1fr 1fr;
}

.tray4-field {
    grid-area: f;
    background: #3d2b1f;
    position: relative;
    cursor: crosshair;
    overflow: hidden;
}

.tray4-info:nth-of-type(2) { grid-area: i1; background: #e8d5bc; }
.tray4-info:nth-of-type(3) { grid-area: i2; background: #deb89a; }
.tray4-info:nth-of-type(4) { grid-area: i3; background: #d4c9a8; border-color: #a0522d; }

.tray4-info h3 {
    font-family: 'Nunito', sans-serif;
    font-weight: 700;
    font-size: clamp(1.2rem, 2vw, 1.8rem);
    color: #3d2b1f;
    margin-bottom: 8px;
}

.info-text {
    font-family: 'Quicksand', sans-serif;
    font-weight: 500;
    font-size: clamp(0.8rem, 1.2vw, 1rem);
    color: #5c4033;
    line-height: 1.6;
}

.info-text em {
    font-style: italic;
    color: #a0522d;
}

/* Magnetic field fish */
.field-fish {
    position: absolute;
    transition: transform 1.5s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    pointer-events: none;
    opacity: 0.9;
}

/* ===== TRAY 5 — DUSK (FOOTER) ===== */
.tray-dusk {
    min-height: 50vh;
}

#tray-dusk {
    background: linear-gradient(90deg, #deb89a 0%, #c47a5a 100%);
}

.tray5-grid {
    grid-template-areas:
        "s s s s s s s s s s cr cr";
    grid-template-rows: 1fr;
    height: 40vh;
}

.tray5-school {
    grid-area: s;
    background: linear-gradient(90deg, rgba(222, 184, 154, 0.3), rgba(196, 122, 90, 0.3));
    position: relative;
    overflow: hidden;
}

.tray5-credits {
    grid-area: cr;
    background: #3d2b1f;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
}

.footer-domain {
    font-family: 'Nunito', sans-serif;
    font-weight: 700;
    font-size: clamp(0.8rem, 1.2vw, 1rem);
    color: #d4a574;
}

.footer-year {
    font-family: 'Source Code Pro', monospace;
    font-size: 0.75rem;
    color: #8b7355;
}

/* Swimming fish in school */
.school-fish {
    position: absolute;
    animation-timing-function: linear;
    animation-iteration-count: infinite;
    pointer-events: none;
}

@keyframes swimRight {
    0% { transform: translateX(-120px); }
    100% { transform: translateX(calc(100vw + 120px)); }
}

/* Coral reef decorative blobs */
.coral-blob {
    position: absolute;
    border-radius: 60% 40% 70% 30% / 50% 60% 40% 50%;
    opacity: 0.4;
    pointer-events: none;
}

/* ===== TERRAZZO PATTERN ===== */
.terrazzo {
    background-image:
        radial-gradient(circle at 15% 25%, #c47a5a 3px, transparent 3px),
        radial-gradient(circle at 45% 65%, #a0522d 4px, transparent 4px),
        radial-gradient(circle at 75% 15%, #2a9d8f 3px, transparent 3px),
        radial-gradient(circle at 85% 75%, #c47a5a 5px, transparent 5px),
        radial-gradient(circle at 35% 85%, #2a9d8f 4px, transparent 4px),
        radial-gradient(circle at 55% 35%, #a0522d 3px, transparent 3px),
        radial-gradient(circle at 25% 55%, #c47a5a 4px, transparent 4px),
        radial-gradient(circle at 65% 45%, #2a9d8f 3px, transparent 3px);
}

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
    .bento-grid {
        grid-template-columns: repeat(4, 1fr);
        height: auto;
        min-height: 90vh;
    }

    .tray1-grid {
        grid-template-areas:
            "main main main main"
            "light light fish fish";
        grid-template-rows: 2fr 1fr;
    }

    .tray2-grid {
        grid-template-areas:
            "a a b b"
            "c c d d"
            "e e e e"
            "m m m m";
        grid-template-rows: 1fr 1fr 1fr 0.5fr;
    }

    .tray3-grid {
        grid-template-areas:
            "a a b b"
            "c c d d"
            "e e e e";
        grid-template-rows: 1fr 1fr 1fr;
    }

    .tray4-grid {
        grid-template-areas:
            "f f f f"
            "f f f f"
            "i1 i1 i1 i1"
            "i2 i2 i2 i2"
            "i3 i3 i3 i3";
        grid-template-rows: 1fr 1fr auto auto auto;
    }

    .tray5-grid {
        grid-template-areas:
            "s s s s"
            "cr cr cr cr";
        grid-template-rows: 1fr auto;
        height: auto;
        min-height: 40vh;
    }

    .domain-title {
        font-size: clamp(2.5rem, 10vw, 4rem);
    }
}
