/* ===========================================
   RRIDDL.com - Ethereal Blue Bento Narrative
   Muji-inspired digital space
   =========================================== */

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

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'IBM Plex Sans', sans-serif;
    font-weight: 300;
    font-size: 15px;
    line-height: 1.75;
    letter-spacing: 0.01em;
    color: #2C3E50;
    background-color: #F0F4F8;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* --- Typography --- */
h2 {
    font-family: 'Space Mono', monospace;
    font-weight: 700;
    font-size: 36px;
    letter-spacing: 0.08em;
    line-height: 1.3;
    color: #2C3E50;
}

h3 {
    font-family: 'Space Mono', monospace;
    font-weight: 700;
    font-size: 20px;
    letter-spacing: 0.08em;
    line-height: 1.3;
    color: #2C3E50;
    margin-bottom: 8px;
}

.body-text {
    font-family: 'IBM Plex Sans', sans-serif;
    font-weight: 300;
    font-size: 15px;
    line-height: 1.75;
    letter-spacing: 0.01em;
    color: #2C3E50;
}

.body-text.small {
    font-size: 13px;
    line-height: 1.65;
}

.meta-label {
    font-family: 'Space Mono', monospace;
    font-size: 10px;
    font-weight: 400;
    letter-spacing: 0.25em;
    text-transform: uppercase;
    color: #C8D6E5;
    display: block;
    margin-bottom: 12px;
}

.contact-address {
    font-family: 'Space Mono', monospace;
    font-size: 18px;
    font-weight: 400;
    letter-spacing: 0.08em;
    color: #5DADE2;
    margin-top: 8px;
}

/* --- Navigation --- */
#top-nav {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    height: 40px;
}

.nav-rule {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background-color: #5DADE2;
}

.nav-links {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 40px;
    height: 40px;
    opacity: 0;
    transition: opacity 400ms ease;
    background-color: rgba(240, 244, 248, 0.95);
}

#top-nav:hover .nav-links {
    opacity: 1;
}

.nav-links a {
    font-family: 'Space Mono', monospace;
    font-size: 11px;
    font-weight: 400;
    letter-spacing: 0.3em;
    text-transform: uppercase;
    color: #2C3E50;
    text-decoration: none;
    transition: color 300ms ease;
}

.nav-links a:hover {
    color: #5DADE2;
}

/* --- Bento Sections --- */
.bento-section {
    position: relative;
    min-height: 100vh;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: 0 40px;
    padding-top: calc(40vh - 120px);
    overflow: hidden;
}

.section-label {
    position: absolute;
    top: 60px;
    left: 12px;
    font-family: 'Space Mono', monospace;
    font-size: 9px;
    font-weight: 400;
    letter-spacing: 0.25em;
    color: #C8D6E5;
    writing-mode: vertical-rl;
    transform: rotate(180deg);
}

/* --- Section Divider --- */
.section-divider {
    width: 60%;
    max-width: 600px;
    height: 1px;
    margin: 0 auto;
    background: linear-gradient(90deg, rgba(200, 214, 229, 0) 0%, rgba(200, 214, 229, 0.3) 20%, #C8D6E5 50%, rgba(200, 214, 229, 0.3) 80%, rgba(200, 214, 229, 0) 100%);
}

/* --- Bento Grid Base --- */
.bento-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 2px;
    width: 100%;
    max-width: 1100px;
    background-color: #C8D6E5;
    border-radius: 2px;
    perspective: 1000px;
    transition: transform 0.3s ease-out;
}

/* --- Bento Cell Base --- */
.bento-cell {
    background-color: #E8EEF4;
    position: relative;
    overflow: hidden;
    transition: transform 0.15s ease-out, background-color 400ms ease, box-shadow 300ms ease;
    transform-style: preserve-3d;
    will-change: transform;
}

.bento-cell:hover {
    background-color: #D4E1ED;
    box-shadow: inset 0 0 0 1px #AED6F1;
}

.cell-content {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 24px;
    transition: transform 0.2s ease-out;
}

/* --- Hero Grid Layout --- */
.hero-grid {
    grid-template-columns: repeat(4, 1fr);
    grid-template-rows: 200px 180px;
}

.cell-hero-title {
    grid-column: 1 / 4;
    grid-row: 1 / 2;
    display: flex;
    align-items: center;
    justify-content: center;
}

.cell-hero-title .cell-content {
    align-items: center;
    justify-content: center;
}

#hero-title-wrapper {
    width: 100%;
    max-width: 560px;
}

#hero-blob-mask {
    width: 100%;
    height: auto;
    overflow: visible;
}

.hero-svg-text {
    font-family: 'Space Mono', monospace;
    font-size: 72px;
    font-weight: 700;
    letter-spacing: 0.15em;
    fill: #2C3E50;
}

.cell-hero-blob {
    grid-column: 4 / 5;
    grid-row: 1 / 2;
}

.cell-hero-blob .cell-content {
    align-items: center;
    justify-content: center;
}

.cell-hero-text {
    grid-column: 1 / 3;
    grid-row: 2 / 3;
}

.cell-hero-dots {
    grid-column: 3 / 4;
    grid-row: 2 / 3;
}

.cell-hero-empty-1 {
    grid-column: 4 / 5;
    grid-row: 2 / 3;
}

.cell-hero-empty-2 {
    display: none;
}

/* --- About Grid Layout --- */
.about-grid {
    grid-template-columns: repeat(4, 1fr);
    grid-template-rows: 160px 220px;
}

.cell-about-heading {
    grid-column: 1 / 3;
    grid-row: 1 / 2;
}

.cell-about-body {
    grid-column: 3 / 5;
    grid-row: 1 / 3;
}

.cell-about-blob {
    grid-column: 1 / 2;
    grid-row: 2 / 3;
}

.cell-about-blob .cell-content {
    align-items: center;
    justify-content: center;
}

.cell-about-meta {
    grid-column: 2 / 3;
    grid-row: 2 / 3;
}

.cell-about-accent {
    display: none;
}

/* --- Explore Grid Layout --- */
.explore-grid {
    grid-template-columns: repeat(4, 1fr);
    grid-template-rows: 200px 180px 160px;
}

.cell-explore-wide {
    grid-column: 1 / 4;
    grid-row: 1 / 2;
}

.cell-explore-square {
    grid-column: 4 / 5;
    grid-row: 1 / 2;
}

.cell-explore-square .cell-content {
    align-items: center;
    justify-content: center;
}

.cell-explore-tall {
    grid-column: 1 / 2;
    grid-row: 2 / 4;
}

.cell-explore-small-1 {
    grid-column: 2 / 3;
    grid-row: 2 / 3;
}

.cell-explore-small-2 {
    grid-column: 3 / 4;
    grid-row: 2 / 3;
}

.cell-explore-small-2 .cell-content {
    align-items: center;
    justify-content: center;
}

.cell-explore-medium {
    grid-column: 2 / 5;
    grid-row: 3 / 4;
}

/* --- Method Grid Layout --- */
.method-grid {
    grid-template-columns: repeat(4, 1fr);
    grid-template-rows: 140px 200px 180px;
}

.cell-method-title {
    grid-column: 1 / 3;
    grid-row: 1 / 2;
}

.cell-method-step-1 {
    grid-column: 3 / 5;
    grid-row: 1 / 2;
}

.cell-method-step-2 {
    grid-column: 1 / 2;
    grid-row: 2 / 3;
}

.cell-method-step-3 {
    grid-column: 2 / 3;
    grid-row: 2 / 3;
}

.cell-method-blob {
    grid-column: 3 / 5;
    grid-row: 2 / 3;
}

.cell-method-blob .cell-content {
    align-items: center;
    justify-content: center;
}

.cell-method-quote {
    grid-column: 1 / 5;
    grid-row: 3 / 4;
}

.cell-method-quote .cell-content {
    align-items: center;
    text-align: center;
}

.cell-method-quote .body-text {
    font-style: italic;
    font-weight: 300;
    font-size: 18px;
    max-width: 600px;
}

/* --- Contact Grid Layout --- */
.contact-grid {
    grid-template-columns: repeat(4, 1fr);
    grid-template-rows: 160px 200px;
}

.cell-contact-heading {
    grid-column: 1 / 2;
    grid-row: 1 / 2;
}

.cell-contact-body {
    grid-column: 2 / 4;
    grid-row: 1 / 2;
}

.cell-contact-link {
    grid-column: 4 / 5;
    grid-row: 1 / 2;
}

.cell-contact-blob {
    grid-column: 1 / 2;
    grid-row: 2 / 3;
}

.cell-contact-blob .cell-content {
    align-items: center;
    justify-content: center;
}

.cell-contact-end {
    grid-column: 2 / 5;
    grid-row: 2 / 3;
}

/* --- SVG Blobs --- */
.cell-blob {
    width: 100%;
    max-width: 160px;
    height: auto;
}

.small-blob {
    max-width: 100px;
}

/* --- Blob Morphing Animation --- */
@keyframes morphBlob1 {
    0%, 100% {
        d: path("M100,30 C130,30 160,50 170,80 C180,110 170,140 150,160 C130,180 100,180 70,170 C40,160 20,130 25,100 C30,70 70,30 100,30Z");
    }
    50% {
        d: path("M100,35 C135,25 165,55 175,85 C185,115 165,145 145,165 C125,185 95,175 65,165 C35,155 15,125 20,95 C25,65 65,35 100,35Z");
    }
}

@keyframes morphBlob2 {
    0%, 100% {
        d: path("M100,25 C140,20 175,50 185,90 C195,130 175,165 145,180 C115,195 80,190 55,170 C30,150 15,115 25,80 C35,45 60,30 100,25Z");
    }
    50% {
        d: path("M100,30 C135,25 170,55 180,95 C190,135 170,170 140,185 C110,200 75,195 50,175 C25,155 10,120 20,85 C30,50 65,35 100,30Z");
    }
}

@keyframes morphBlobClip {
    0%, 100% {
        d: path("M50,100 C50,40 120,10 200,20 C280,30 350,10 420,30 C490,50 560,40 570,100 C580,160 510,190 430,180 C350,170 280,195 200,185 C120,175 50,160 50,100Z");
    }
    50% {
        d: path("M55,100 C55,45 125,15 205,25 C285,35 345,15 415,35 C485,55 555,45 565,105 C575,165 505,195 425,185 C345,175 275,200 195,190 C115,180 55,155 55,100Z");
    }
}

.morph-blob {
    animation: morphBlob1 20s ease-in-out infinite alternate;
}

.cell-about-blob .morph-blob {
    animation: morphBlob2 18s ease-in-out infinite alternate;
}

.cell-explore-square .morph-blob {
    animation: morphBlob1 22s ease-in-out infinite alternate;
}

.cell-explore-small-2 .morph-blob {
    animation: morphBlob2 16s ease-in-out infinite alternate;
}

.cell-method-blob .morph-blob {
    animation: morphBlob1 25s ease-in-out infinite alternate;
}

.cell-contact-blob .morph-blob {
    animation: morphBlob2 19s ease-in-out infinite alternate;
}

#blob-clip-path {
    animation: morphBlobClip 20s ease-in-out infinite alternate;
}

/* --- Background Blobs --- */
.bg-blob {
    position: absolute;
    z-index: -1;
    pointer-events: none;
}

.bg-blob-1 {
    width: 500px;
    top: -80px;
    right: -120px;
}

.bg-blob-2 {
    width: 400px;
    bottom: -60px;
    left: -100px;
}

.bg-blob-3 {
    width: 450px;
    top: 50px;
    left: -80px;
}

.bg-blob-4 {
    width: 420px;
    bottom: -40px;
    right: -60px;
}

.bg-blob-5 {
    width: 380px;
    top: 100px;
    right: -90px;
}

.bg-blob-6 {
    width: 460px;
    bottom: -50px;
    left: -70px;
}

/* --- Floating Dots --- */
.floating-dots {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    pointer-events: none;
    z-index: 1;
}

.floating-dot {
    position: absolute;
    border-radius: 50%;
    background-color: #AED6F1;
}

@keyframes floatDot {
    0% {
        transform: translate(0, 0);
    }
    100% {
        transform: translate(var(--float-x), var(--float-y));
    }
}

/* --- Dots Container (inside hero cell) --- */
.dots-container {
    position: relative;
    width: 100%;
    height: 100%;
}

.dots-container .inner-dot {
    position: absolute;
    border-radius: 50%;
    background-color: #AED6F1;
    animation: floatDot var(--duration) ease-in-out infinite alternate;
    animation-delay: var(--delay);
}

/* --- Content Reveal Animation --- */
@keyframes cellReveal {
    from {
        opacity: 0;
        transform: translateY(12px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.bento-cell[data-reveal] {
    opacity: 0;
}

.bento-cell[data-reveal].revealed {
    animation: cellReveal 600ms ease forwards;
}

/* --- Hero Title Animation --- */
.cell-hero-title {
    opacity: 1;
}

.cell-hero-title .cell-content {
    opacity: 1;
}

/* --- Responsive: Tablet --- */
@media (max-width: 900px) {
    .bento-section {
        padding: 0 24px;
        padding-top: calc(35vh - 80px);
    }

    .bento-grid {
        grid-template-columns: repeat(2, 1fr);
        max-width: 600px;
    }

    h2 {
        font-size: 28px;
    }

    .hero-svg-text {
        font-size: 48px;
    }

    /* Hero tablet */
    .hero-grid {
        grid-template-rows: 180px 160px 140px;
    }
    .cell-hero-title {
        grid-column: 1 / 3;
        grid-row: 1 / 2;
    }
    .cell-hero-blob {
        grid-column: 1 / 2;
        grid-row: 2 / 3;
    }
    .cell-hero-text {
        grid-column: 2 / 3;
        grid-row: 2 / 3;
    }
    .cell-hero-dots {
        grid-column: 1 / 2;
        grid-row: 3 / 4;
    }
    .cell-hero-empty-1 {
        grid-column: 2 / 3;
        grid-row: 3 / 4;
    }

    /* About tablet */
    .about-grid {
        grid-template-rows: 140px 180px 180px;
    }
    .cell-about-heading {
        grid-column: 1 / 3;
        grid-row: 1 / 2;
    }
    .cell-about-body {
        grid-column: 1 / 3;
        grid-row: 2 / 3;
    }
    .cell-about-blob {
        grid-column: 1 / 2;
        grid-row: 3 / 4;
    }
    .cell-about-meta {
        grid-column: 2 / 3;
        grid-row: 3 / 4;
    }

    /* Explore tablet */
    .explore-grid {
        grid-template-rows: 180px 160px 160px 140px;
    }
    .cell-explore-wide {
        grid-column: 1 / 3;
        grid-row: 1 / 2;
    }
    .cell-explore-square {
        grid-column: 1 / 2;
        grid-row: 2 / 3;
    }
    .cell-explore-tall {
        grid-column: 2 / 3;
        grid-row: 2 / 3;
    }
    .cell-explore-small-1 {
        grid-column: 1 / 2;
        grid-row: 3 / 4;
    }
    .cell-explore-small-2 {
        grid-column: 2 / 3;
        grid-row: 3 / 4;
    }
    .cell-explore-medium {
        grid-column: 1 / 3;
        grid-row: 4 / 5;
    }

    /* Method tablet */
    .method-grid {
        grid-template-rows: 120px 180px 180px 160px;
    }
    .cell-method-title {
        grid-column: 1 / 3;
        grid-row: 1 / 2;
    }
    .cell-method-step-1 {
        grid-column: 1 / 3;
        grid-row: 2 / 3;
    }
    .cell-method-step-2 {
        grid-column: 1 / 2;
        grid-row: 3 / 4;
    }
    .cell-method-step-3 {
        grid-column: 2 / 3;
        grid-row: 3 / 4;
    }
    .cell-method-blob {
        grid-column: 1 / 3;
        grid-row: 4 / 5;
    }
    .cell-method-quote {
        display: none;
    }

    /* Contact tablet */
    .contact-grid {
        grid-template-rows: 140px 180px 160px;
    }
    .cell-contact-heading {
        grid-column: 1 / 3;
        grid-row: 1 / 2;
    }
    .cell-contact-body {
        grid-column: 1 / 3;
        grid-row: 2 / 3;
    }
    .cell-contact-link {
        grid-column: 1 / 2;
        grid-row: 3 / 4;
    }
    .cell-contact-blob {
        grid-column: 2 / 3;
        grid-row: 3 / 4;
    }
    .cell-contact-end {
        display: none;
    }
}

/* --- Responsive: Mobile --- */
@media (max-width: 600px) {
    .bento-section {
        padding: 0 16px;
        padding-top: calc(30vh - 60px);
    }

    .bento-grid {
        grid-template-columns: 1fr;
        max-width: 400px;
    }

    h2 {
        font-size: 24px;
    }

    .hero-svg-text {
        font-size: 36px;
    }

    /* Hero mobile */
    .hero-grid {
        grid-template-rows: repeat(4, auto);
    }
    .cell-hero-title {
        grid-column: 1;
        grid-row: 1;
        min-height: 140px;
    }
    .cell-hero-blob {
        grid-column: 1;
        grid-row: 2;
        min-height: 160px;
    }
    .cell-hero-text {
        grid-column: 1;
        grid-row: 3;
        min-height: 100px;
    }
    .cell-hero-dots {
        grid-column: 1;
        grid-row: 4;
        min-height: 120px;
    }
    .cell-hero-empty-1 {
        display: none;
    }

    /* About mobile */
    .about-grid {
        grid-template-rows: repeat(4, auto);
    }
    .cell-about-heading {
        grid-column: 1;
        grid-row: 1;
        min-height: 100px;
    }
    .cell-about-body {
        grid-column: 1;
        grid-row: 2;
        min-height: 160px;
    }
    .cell-about-blob {
        grid-column: 1;
        grid-row: 3;
        min-height: 160px;
    }
    .cell-about-meta {
        grid-column: 1;
        grid-row: 4;
        min-height: 100px;
    }

    /* Explore mobile */
    .explore-grid {
        grid-template-rows: repeat(6, auto);
    }
    .cell-explore-wide {
        grid-column: 1;
        grid-row: 1;
        min-height: 160px;
    }
    .cell-explore-square {
        grid-column: 1;
        grid-row: 2;
        min-height: 160px;
    }
    .cell-explore-tall {
        grid-column: 1;
        grid-row: 3;
        min-height: 160px;
    }
    .cell-explore-small-1 {
        grid-column: 1;
        grid-row: 4;
        min-height: 80px;
    }
    .cell-explore-small-2 {
        grid-column: 1;
        grid-row: 5;
        min-height: 120px;
    }
    .cell-explore-medium {
        grid-column: 1;
        grid-row: 6;
        min-height: 120px;
    }

    /* Method mobile */
    .method-grid {
        grid-template-rows: repeat(5, auto);
    }
    .cell-method-title {
        grid-column: 1;
        grid-row: 1;
        min-height: 80px;
    }
    .cell-method-step-1 {
        grid-column: 1;
        grid-row: 2;
        min-height: 140px;
    }
    .cell-method-step-2 {
        grid-column: 1;
        grid-row: 3;
        min-height: 140px;
    }
    .cell-method-step-3 {
        grid-column: 1;
        grid-row: 4;
        min-height: 140px;
    }
    .cell-method-blob {
        grid-column: 1;
        grid-row: 5;
        min-height: 160px;
    }
    .cell-method-quote {
        display: none;
    }

    /* Contact mobile */
    .contact-grid {
        grid-template-rows: repeat(4, auto);
    }
    .cell-contact-heading {
        grid-column: 1;
        grid-row: 1;
        min-height: 80px;
    }
    .cell-contact-body {
        grid-column: 1;
        grid-row: 2;
        min-height: 120px;
    }
    .cell-contact-link {
        grid-column: 1;
        grid-row: 3;
        min-height: 100px;
    }
    .cell-contact-blob {
        grid-column: 1;
        grid-row: 4;
        min-height: 140px;
    }
    .cell-contact-end {
        display: none;
    }

    .nav-links {
        gap: 20px;
    }

    .nav-links a {
        font-size: 9px;
    }

    .section-label {
        left: 4px;
        top: 40px;
    }

    .bg-blob {
        width: 250px;
    }
}
