/* ====================================================================
   Lunovia Groups — Bento Box Editorial Design System
   Asymmetrical • Art-Directed • Dynamic Spans • Optical Depth
   ==================================================================== */

.bento-section {
    position: relative;
    width: 100%;
    margin: 0;
}

.bento-header {
    margin-bottom: var(--space-2xl);
    display: flex;
    flex-direction: column;
    gap: var(--space-xs);
}

.bento-grid {
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    grid-auto-rows: minmax(180px, auto);
    gap: 1.25rem;
    position: relative;
    width: 100%;
}

/* Base Bento Tile */
.bento-tile {
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    background-color: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    box-shadow: var(--card-shadow);
    padding: clamp(1.5rem, 2.5vw, 2.75rem);
    overflow: hidden;
    transition: 
        border-color var(--duration-normal) var(--ease-gentle),
        background-color var(--duration-normal) var(--ease-gentle),
        box-shadow var(--duration-normal) var(--ease-gentle),
        transform var(--duration-slow) var(--ease-cinematic);
    isolation: isolate;
}

.bento-tile:hover {
    border-color: var(--border-medium);
    background-color: var(--bg-elevated);
    box-shadow: var(--card-shadow-hover);
}

/* Column Spans (1 to 12) */
.bento-col-1  { grid-column: span 1; }
.bento-col-2  { grid-column: span 2; }
.bento-col-3  { grid-column: span 3; }
.bento-col-4  { grid-column: span 4; }
.bento-col-5  { grid-column: span 5; }
.bento-col-6  { grid-column: span 6; }
.bento-col-7  { grid-column: span 7; }
.bento-col-8  { grid-column: span 8; }
.bento-col-9  { grid-column: span 9; }
.bento-col-10 { grid-column: span 10; }
.bento-col-11 { grid-column: span 11; }
.bento-col-12 { grid-column: span 12; }

/* Row Spans (1 to 4) */
.bento-row-1 { grid-row: span 1; }
.bento-row-2 { grid-row: span 2; }
.bento-row-3 { grid-row: span 3; }
.bento-row-4 { grid-row: span 4; }

/* Size Presets */
.bento-preset-hero {
    min-height: 440px;
    padding: clamp(2rem, 3.5vw, 3.5rem);
}

.bento-preset-tall {
    min-height: 480px;
}

.bento-preset-wide {
    min-height: 240px;
}

.bento-preset-medium {
    min-height: 280px;
}

.bento-preset-small {
    min-height: 200px;
    padding: 1.5rem;
}

/* Theme Overrides inside specific tiles */
.bento-theme-dark {
    --bg-surface: #131519;
    --bg-elevated: #191c22;
    --text-primary: #f2f2f5;
    --text-secondary: #9ea2ac;
    --text-muted: #6b6f79;
    --text-accent: #ffffff;
    --border-subtle: rgba(255, 255, 255, 0.08);
    --border-medium: rgba(255, 255, 255, 0.18);
}

.bento-theme-light {
    --bg-surface: #ffffff;
    --bg-elevated: #f4f3f0;
    --text-primary: #121316;
    --text-secondary: #42454e;
    --text-muted: #727682;
    --text-accent: #050507;
    --border-subtle: rgba(0, 0, 0, 0.09);
    --border-medium: rgba(0, 0, 0, 0.18);
}

/* Tile Internal Layout & Elements */
.bento-tile-bg {
    position: absolute;
    inset: 0;
    z-index: 0;
    overflow: hidden;
}

.bento-tile-bg img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.8s cubic-bezier(0.16, 1, 0.3, 1), filter var(--duration-slow) var(--ease-gentle);
    filter: brightness(0.85) contrast(1.05);
}

.bento-tile:hover .bento-tile-bg img {
    transform: scale(1.08);
    filter: brightness(0.92) contrast(1.08);
}

.bento-tile-bg::after {
    content: '';
    position: absolute;
    inset: 0;
    background: var(--image-overlay);
    pointer-events: none;
}

/* Contrast Preservation for Cards with Media */
.bento-tile:has(.bento-tile-bg) .bento-tile-title,
.bento-tile.has-media .bento-tile-title {
    color: #ffffff !important;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.7);
}

.bento-tile:has(.bento-tile-bg) .bento-tile-subtitle,
.bento-tile.has-media .bento-tile-subtitle {
    color: rgba(255, 255, 255, 0.88) !important;
    text-shadow: 0 1px 4px rgba(0, 0, 0, 0.7);
}

.bento-tile:has(.bento-tile-bg) .bento-tile-body,
.bento-tile.has-media .bento-tile-body {
    color: rgba(255, 255, 255, 0.9) !important;
    text-shadow: 0 1px 4px rgba(0, 0, 0, 0.7);
}

.bento-tile:has(.bento-tile-bg) .bento-tile-cta,
.bento-tile.has-media .bento-tile-cta {
    color: #ffffff !important;
    background: rgba(255, 255, 255, 0.16);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    padding: 0.5rem 1rem;
    border-radius: var(--radius-pill);
    border: 1px solid rgba(255, 255, 255, 0.35);
    width: fit-content;
}

.bento-tile:has(.bento-tile-bg) .bento-tile-cta:hover,
.bento-tile.has-media .bento-tile-cta:hover {
    background: rgba(255, 255, 255, 0.28);
    border-color: rgba(255, 255, 255, 0.6);
}

.bento-tile-content {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    height: 100%;
    gap: 1.5rem;
}

.bento-tile-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
}

.bento-tile-bottom {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.bento-tile-title {
    font-family: var(--font-editorial);
    font-size: clamp(1.25rem, 1.8vw, 1.85rem);
    font-weight: 400;
    line-height: 1.25;
    letter-spacing: -0.025em;
    color: var(--text-accent);
}

.bento-tile-subtitle {
    font-size: 0.85rem;
    font-weight: 500;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--text-muted);
}

.bento-tile-body {
    font-size: 0.95rem;
    line-height: 1.6;
    color: var(--text-secondary);
}

.bento-tile-cta {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.75rem;
    font-size: 0.825rem;
    font-weight: 500;
    letter-spacing: 0.04em;
    color: var(--text-accent);
    text-decoration: none;
    transition: opacity var(--duration-fast);
}

.bento-tile-cta svg {
    transition: transform var(--duration-fast) var(--ease-gentle);
}

.bento-tile-cta:hover svg {
    transform: translateX(4px);
}

/* Quote Bento Tile */
.bento-type-quote {
    justify-content: center;
}

.bento-type-quote .bento-tile-body {
    font-family: var(--font-editorial);
    font-size: clamp(1.15rem, 1.7vw, 1.5rem);
    font-style: italic;
    line-height: 1.45;
    color: var(--text-primary);
}

/* ====================================================================
   STEPPED CHAPTER VIEWPORT-FIT CALIBRATION (Ekrana Geniş ve Ferah Yayılım)
   ==================================================================== */
@media (min-width: 992px) {
    .stepped-chapter .bento-section {
        width: 100%;
        display: flex;
        flex-direction: column;
        justify-content: center;
    }

    .stepped-chapter .section-editorial-header {
        margin-bottom: clamp(1rem, 2.2vh, 1.75rem);
    }

    .stepped-chapter .section-editorial-header .text-heading-1,
    .stepped-chapter .section-editorial-header .text-display-large {
        font-size: clamp(1.75rem, 2.8vh, 2.45rem);
        line-height: 1.2;
    }

    .stepped-chapter .section-tag-editorial {
        font-size: 0.8rem;
        letter-spacing: 0.14em;
        margin-bottom: 0.35rem;
    }

    .stepped-chapter .bento-grid {
        grid-template-columns: repeat(12, 1fr);
        grid-auto-rows: minmax(0, 1fr);
        gap: clamp(1.15rem, 1.8vh, 1.65rem);
        width: 100%;
    }

    .stepped-chapter .bento-tile {
        padding: clamp(1.5rem, 2.4vh, 2.4rem);
        border-radius: var(--radius-xl);
    }

    /* Biz Kimiz (About) 2-row expansive balanced heights */
    #chapter-about .bento-preset-hero,
    #chapter-about .bento-preset-medium {
        min-height: clamp(210px, 27vh, 280px);
    }

    /* Grup Ekosistemi (Ecosystem) single-row side-by-side luxurious height */
    #chapter-ecosystem .bento-preset-medium,
    #chapter-ecosystem .bento-preset-hero {
        min-height: clamp(380px, 52vh, 500px);
        padding: clamp(2rem, 3.2vh, 2.8rem);
    }

    .stepped-chapter .bento-tile-content {
        gap: 0.85rem;
    }

    .stepped-chapter .bento-tile-title {
        font-size: clamp(1.35rem, 1.8vw, 1.85rem);
        line-height: 1.25;
        margin-bottom: 0.35rem;
    }

    #chapter-ecosystem .bento-tile-title {
        font-size: clamp(1.75rem, 2.4vw, 2.45rem);
        margin-bottom: 0.5rem;
    }

    .stepped-chapter .bento-tile-subtitle {
        font-size: 0.8rem;
        letter-spacing: 0.1em;
    }

    .stepped-chapter .bento-tile-body {
        font-size: clamp(0.925rem, 1.2vh, 1.05rem);
        line-height: 1.6;
        display: -webkit-box;
        -webkit-line-clamp: 4;
        -webkit-box-orient: vertical;
        overflow: hidden;
    }

    #chapter-ecosystem .bento-tile-body {
        font-size: clamp(1rem, 1.35vh, 1.125rem);
        line-height: 1.65;
        max-width: 90%;
    }

    .stepped-chapter .bento-tile-cta {
        margin-top: 0.75rem;
        font-size: 0.875rem;
        padding: 0.55rem 1.2rem;
    }

    #chapter-ecosystem .bento-tile-cta {
        font-size: 0.925rem;
        padding: 0.65rem 1.35rem;
    }
}

/* Responsive Collapse */
@media (max-width: 991px) {
    .bento-grid {
        grid-template-columns: repeat(6, 1fr);
    }

    .bento-col-12 { grid-column: span 6; }
    .bento-col-11 { grid-column: span 6; }
    .bento-col-10 { grid-column: span 6; }
    .bento-col-9  { grid-column: span 6; }
    .bento-col-8  { grid-column: span 6; }
    .bento-col-7  { grid-column: span 6; }
    .bento-col-6  { grid-column: span 6; }
    .bento-col-5  { grid-column: span 3; }
    .bento-col-4  { grid-column: span 3; }
    .bento-col-3  { grid-column: span 3; }
    .bento-col-2  { grid-column: span 3; }
    .bento-col-1  { grid-column: span 2; }
}

@media (max-width: 640px) {
    .bento-grid {
        display: flex;
        flex-direction: column;
        gap: 1rem;
    }

    .bento-tile {
        min-height: auto;
        padding: 1.5rem;
    }

    .bento-preset-hero {
        min-height: 320px;
    }
}
