/* ========================================
   BENTO STATIC - Custom Styles
   A bright and airy Bootstrap 5 bento grid
   ======================================== */

/* ----------------------------------------
   CSS Custom Properties (Color Theming)
   ---------------------------------------- */
:root {
    /* Primary Colors */
    --bs-primary: #6366f1;
    --bs-primary-rgb: 99, 102, 241;

    /* Background Colors */
    --bg-page: #f8fafc;
    --bg-block: #ffffff;
    --bg-block-hover: #f1f5f9;

    /* Text Colors */
    --text-primary: #1e293b;
    --text-muted: #64748b;

    /* Accent Colors */
    --accent-gradient-start: #6366f1;
    --accent-gradient-end: #a855f7;

    /* Shadows */
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.04);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -4px rgba(0, 0, 0, 0.05);

    /* Border Radius */
    --radius-sm: 12px;
    --radius-md: 16px;
    --radius-lg: 24px;

    /* Grid Configuration */
    --grid-gap: 16px;
    --block-min-size: 160px;
}

/* ----------------------------------------
   Base Styles
   ---------------------------------------- */
body {
    background-color: var(--bg-page);
    color: var(--text-primary);
    font-family: system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    min-height: 100vh;
}

/* Skip Link for Accessibility */
.skip-link {
    position: absolute;
    top: -100%;
    left: 50%;
    transform: translateX(-50%);
    background: var(--bs-primary);
    color: white;
    padding: 0.75rem 1.5rem;
    border-radius: var(--radius-sm);
    text-decoration: none;
    font-weight: 600;
    z-index: 9999;
    transition: top 0.2s ease;
}

.skip-link:focus {
    top: 1rem;
    color: white;
    outline: 3px solid rgba(99, 102, 241, 0.5);
    outline-offset: 2px;
}

/* ----------------------------------------
   Bento Grid Layout
   ---------------------------------------- */
.bento-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(var(--block-min-size), 1fr));
    grid-auto-flow: dense;
    /* Fill empty spaces automatically */
    gap: var(--grid-gap);
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 1rem;
}

/* Grid sizing for larger screens */
@media (min-width: 768px) {
    .bento-grid {
        grid-template-columns: repeat(4, 1fr);
        --grid-gap: 20px;
    }
}

@media (min-width: 1200px) {
    .bento-grid {
        grid-template-columns: repeat(6, 1fr);
        --grid-gap: 24px;
    }
}

/* ----------------------------------------
   Bento Block Base
   ---------------------------------------- */
.bento-block {
    background: var(--bg-block);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    position: relative;
    text-decoration: none;
    color: inherit;
}

.bento-block:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

/* Focus styles for keyboard navigation */
.bento-block:focus {
    outline: 3px solid var(--bs-primary);
    outline-offset: 2px;
}

.bento-block:focus:not(:focus-visible) {
    outline: none;
}

.bento-block:focus-visible {
    outline: 3px solid var(--bs-primary);
    outline-offset: 2px;
}

/* Block content wrapper */
.block-content {
    padding: 1.5rem;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

/* ----------------------------------------
   Block Sizes
   ---------------------------------------- */

/* Square Block (1x1) */
.block-square {
    aspect-ratio: 1 / 1;
}

/* Wide Block (2x1) - 16:9 approximation */
.block-wide {
    grid-column: span 2;
    aspect-ratio: 16 / 9;
}

/* Tall Block (1x2) - 9:16 approximation */
.block-tall {
    grid-row: span 2;
    aspect-ratio: 9 / 16;
}

/* Large Block (2x2) */
.block-large {
    grid-column: span 2;
    grid-row: span 2;
}

/* Full Width Block (spans all columns) */
.block-full {
    grid-column: 1 / -1;
}

/* Responsive adjustments */
@media (max-width: 767px) {

    .block-wide,
    .block-large {
        grid-column: span 2;
    }

    .block-tall {
        grid-column: span 1;
        grid-row: span 2;
    }

    .bento-block {
        border-radius: var(--radius-sm);
    }
}

@media (max-width: 480px) {

    .block-wide,
    .block-large,
    .block-tall {
        grid-column: 1 / -1;
        grid-row: span 1;
        aspect-ratio: auto;
        min-height: 200px;
    }

    .block-square {
        grid-column: span 1;
    }
}

/* ----------------------------------------
   Title & Subtitle Blocks
   ---------------------------------------- */
.block-title {
    background: linear-gradient(135deg, var(--accent-gradient-start) 0%, var(--accent-gradient-end) 100%);
    color: white;
}

.block-title .text-muted {
    color: rgba(255, 255, 255, 0.8) !important;
}

.block-subtitle {
    background: var(--bg-block);
    aspect-ratio: auto;
    min-height: auto;
    padding: 0;
}

.block-subtitle .block-content {
    padding: 1.25rem 1.5rem;
}

/* ----------------------------------------
   Divider Blocks
   ---------------------------------------- */
.block-divider {
    background: transparent;
    box-shadow: none;
    display: flex;
    align-items: center;
    justify-content: center;
    aspect-ratio: auto;
    min-height: 60px;
    padding: 0 1rem;
}

.block-divider:hover {
    transform: none;
    box-shadow: none;
}

.divider-line {
    flex: 1;
    border: none;
    border-top: 2px solid #e2e8f0;
    margin: 0;
}

.divider-with-icon {
    display: flex;
    align-items: center;
    width: 100%;
    gap: 1rem;
}

.divider-icon {
    color: var(--text-muted);
    font-size: 1.25rem;
}

/* ----------------------------------------
   Photo Blocks
   ---------------------------------------- */
.block-photo {
    padding: 0;
    display: block;
}

.block-photo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.block-photo:hover img {
    transform: scale(1.05);
}

.photo-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 1.5rem;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.6) 0%, transparent 100%);
    pointer-events: none;
}

.photo-label {
    color: white;
    font-weight: 600;
    font-size: 0.9rem;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

/* ----------------------------------------
   Feature Blocks (with Icons)
   ---------------------------------------- */
.block-feature {
    text-align: center;
}

.feature-icon {
    font-size: 2.5rem;
    color: var(--bs-primary);
}

/* ----------------------------------------
   Card Blocks
   ---------------------------------------- */
.block-card {
    padding: 0;
}

.block-card .card {
    height: 100%;
    border-radius: inherit;
    background: var(--bg-block);
}

.block-card .card-img-top {
    height: 50%;
    object-fit: cover;
    border-radius: var(--radius-md) var(--radius-md) 0 0;
}

.block-card .card-body {
    padding: 1.25rem;
}

.card-horizontal .card-body {
    padding: 1rem;
}

/* Gradient Card */
.bg-gradient-primary {
    background: linear-gradient(135deg, var(--accent-gradient-start) 0%, var(--accent-gradient-end) 100%) !important;
}

/* ----------------------------------------
   Link Blocks
   ---------------------------------------- */
.block-link {
    cursor: pointer;
}

.block-link .block-content {
    gap: 0.75rem;
}

.link-icon {
    font-size: 2rem;
    color: var(--bs-primary);
    transition: transform 0.2s ease;
}

.block-link:hover .link-icon {
    transform: scale(1.1);
}

.link-label {
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text-primary);
}

/* ----------------------------------------
   Button Customizations
   ---------------------------------------- */
.btn-primary {
    background: var(--bs-primary);
    border-color: var(--bs-primary);
}

.btn-primary:hover,
.btn-primary:focus {
    background: #4f46e5;
    border-color: #4f46e5;
}

.btn-outline-primary {
    color: var(--bs-primary);
    border-color: var(--bs-primary);
}

.btn-outline-primary:hover,
.btn-outline-primary:focus {
    background: var(--bs-primary);
    border-color: var(--bs-primary);
}

/* Focus styles for buttons */
.btn:focus {
    box-shadow: 0 0 0 0.25rem rgba(99, 102, 241, 0.25);
}

/* ----------------------------------------
   Footer
   ---------------------------------------- */
footer {
    background: var(--bg-block);
}

/* ----------------------------------------
   Utility Classes
   ---------------------------------------- */
.object-fit-cover {
    object-fit: cover;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .bento-block {
        border: 2px solid var(--text-primary);
    }

    .block-photo .photo-overlay {
        background: rgba(0, 0, 0, 0.8);
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {

    .bento-block,
    .bento-block:hover,
    .block-photo img,
    .link-icon {
        transition: none;
        transform: none;
    }

    .block-photo:hover img {
        transform: none;
    }
}

/* Print styles */
@media print {
    .bento-grid {
        display: block;
    }

    .bento-block {
        page-break-inside: avoid;
        margin-bottom: 1rem;
        box-shadow: none;
        border: 1px solid #e2e8f0;
    }
}