/* ============================================
   gabs.news - Cottagecore News Mosaic
   Palette: Terracotta-Warm
   Typography: Nunito + Quicksand (Rounded-Sans)
   Animation: Blur-Focus System
   ============================================ */

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

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

body {
    font-family: 'Quicksand', sans-serif;
    font-weight: 400;
    color: #6B4D33;
    background-color: #FAF3EB;
    line-height: 1.65;
    letter-spacing: 0.005em;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

a {
    color: #C4704E;
    text-decoration: none;
    transition: color 0.3s ease;
}

a:hover {
    color: #8B5E3C;
}

/* --- Navigation Bar --- */
#nav-bar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 56px;
    background-color: #FFF8F0;
    border-bottom: 1px solid rgba(212, 165, 116, 0.25);
    z-index: 100;
    transition: box-shadow 0.4s ease, backdrop-filter 0.4s ease;
}

#nav-bar.scrolled {
    box-shadow: 0 2px 12px rgba(93, 58, 26, 0.08);
}

@supports (backdrop-filter: blur(8px)) {
    #nav-bar.scrolled {
        backdrop-filter: blur(8px);
        background-color: rgba(255, 248, 240, 0.9);
    }
}

.nav-inner {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 24px;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.nav-logo {
    font-family: 'Nunito', sans-serif;
    font-weight: 700;
    font-size: 22px;
    color: #5B3A1A;
    letter-spacing: -0.01em;
}

.nav-logo:hover {
    color: #C4704E;
}

.nav-links {
    display: flex;
    gap: 28px;
    flex-wrap: wrap;
}

.nav-link {
    font-family: 'Quicksand', sans-serif;
    font-weight: 500;
    font-size: 15px;
    color: #6B4D33;
    letter-spacing: 0.005em;
    padding: 4px 0;
    position: relative;
}

.nav-link::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0;
    height: 2px;
    background-color: #C4704E;
    border-radius: 1px;
    transition: width 0.3s ease;
}

.nav-link:hover::after {
    width: 100%;
}

.nav-link:hover {
    color: #5B3A1A;
}

/* --- Bubble Layer --- */
#bubble-layer {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 1;
    overflow: hidden;
}

.bubble {
    position: absolute;
    border-radius: 50%;
    background: radial-gradient(circle at 35% 35%, rgba(196, 112, 78, 0.08), transparent 70%);
    border: 1px solid rgba(196, 112, 78, 0.15);
    animation: bubble-float linear infinite;
    will-change: transform;
}

@supports (backdrop-filter: blur(2px)) {
    .bubble {
        backdrop-filter: blur(2px);
    }
}

@keyframes bubble-float {
    0% {
        transform: translateY(100vh) translateX(0);
        opacity: 0;
    }
    10% {
        opacity: 1;
    }
    90% {
        opacity: 1;
    }
    100% {
        transform: translateY(-80vh) translateX(20px);
        opacity: 0;
    }
}

/* --- Main Tile Grid --- */
#tile-grid {
    position: relative;
    z-index: 2;
    max-width: 1400px;
    margin: 0 auto;
    padding: 80px 24px 60px;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 24px;
}

/* --- Tile Base Styles --- */
.tile {
    background-color: #FAF3EB;
    border-radius: 8px;
    border: 1px solid rgba(196, 112, 78, 0.3);
    overflow: hidden;
    position: relative;
    transition: transform 0.3s ease, box-shadow 0.3s ease, background-color 0.3s ease;
    cursor: pointer;
}

.tile:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 24px rgba(93, 58, 26, 0.1);
    background-color: #FFF8F0;
}

/* Tile variations for handmade patchwork feel */
.tile:nth-child(3n+1) {
    background-color: #FAF3EB;
}

.tile:nth-child(3n+2) {
    background-color: #FFF8F0;
}

.tile:nth-child(3n) {
    background-color: #F5EDE3;
}

.tile:nth-child(3n):hover,
.tile:nth-child(3n+1):hover,
.tile:nth-child(3n+2):hover {
    background-color: #FFF8F0;
}

/* --- Tile Sizing --- */
.tile-featured {
    grid-column: 1 / -1;
    min-height: 40vh;
}

.tile-span2 {
    grid-column: span 2;
}

.tile-3x4 {
    min-height: 320px;
}

.tile-4x3 {
    min-height: 260px;
}

.tile-1x1 {
    min-height: 240px;
}

/* --- Tile Content --- */
.tile-content {
    padding: 28px 24px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    height: 100%;
}

.tile-content-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 32px 28px;
    z-index: 2;
}

.tile-category {
    font-family: 'Nunito', sans-serif;
    font-weight: 600;
    font-size: 12px;
    color: #A07850;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.tile-category-garden {
    color: #7A9B6D;
}

.tile-title {
    font-family: 'Nunito', sans-serif;
    font-weight: 700;
    font-size: 22px;
    color: #5B3A1A;
    letter-spacing: -0.01em;
    line-height: 1.2;
}

.tile-featured .tile-title {
    font-size: 36px;
}

.tile-content-overlay .tile-title {
    color: #FFF8F0;
}

.tile-excerpt {
    font-family: 'Quicksand', sans-serif;
    font-weight: 400;
    font-size: 16px;
    color: #6B4D33;
    line-height: 1.65;
    letter-spacing: 0.005em;
}

.tile-content-overlay .tile-excerpt {
    color: rgba(255, 248, 240, 0.85);
}

.tile-excerpt-poem {
    font-family: 'Quicksand', sans-serif;
    font-weight: 300;
    font-size: 18px;
    color: #8B5E3C;
    font-style: oblique 8deg;
    line-height: 1.8;
}

.tile-meta {
    font-family: 'Nunito', sans-serif;
    font-weight: 600;
    font-size: 13px;
    color: #A07850;
    margin-top: auto;
}

.tile-content-overlay .tile-meta {
    color: rgba(255, 248, 240, 0.7);
}

/* --- Tile Image --- */
.tile-image-wrap {
    position: absolute;
    inset: 0;
    overflow: hidden;
    border-radius: 8px;
}

.tile-placeholder-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    filter: sepia(15%) saturate(90%) brightness(102%) contrast(95%);
}

.tile-image-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(to bottom, transparent 50%, rgba(90, 58, 26, 0.85) 100%);
    border-radius: 8px;
}

/* --- Breath Elements --- */
.breath-element {
    grid-column: 1 / -1;
    height: 200px;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #F5EDE3;
    border-radius: 8px;
    border: none;
    overflow: hidden;
}

.breath-motif {
    width: 400px;
    max-width: 80%;
    height: auto;
    opacity: 0.4;
    transition: opacity 0.8s ease;
}

.breath-element.in-view .breath-motif {
    opacity: 0.7;
}

/* --- Blur-Focus Animation System --- */
.tile-blur {
    filter: blur(8px);
    opacity: 0.3;
    transform: scale(0.97);
    transition: filter 0.6s ease-out, opacity 0.6s ease-out, transform 0.6s ease-out;
}

.tile-blur.in-view {
    filter: blur(0);
    opacity: 1;
    transform: scale(1);
}

/* Breath elements get slower, deeper blur */
.breath-element.tile-blur {
    filter: blur(16px);
    transform: scale(0.92);
    transition: filter 1.2s ease-out, opacity 1.2s ease-out, transform 1.2s ease-out;
}

.breath-element.tile-blur.in-view {
    filter: blur(0);
    opacity: 1;
    transform: scale(1);
}

/* Override hover transforms when still blurred */
.tile-blur:not(.in-view):hover {
    transform: scale(0.97);
    box-shadow: none;
}

/* --- Footer --- */
#site-footer {
    position: relative;
    z-index: 2;
    background-color: #3D2512;
    padding: 60px 24px 40px;
    margin-top: 40px;
}

.footer-inner {
    max-width: 1400px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 24px;
    text-align: center;
}

.footer-logo {
    font-family: 'Nunito', sans-serif;
    font-weight: 700;
    font-size: 24px;
    color: #FAF3EB;
}

.footer-tagline {
    font-family: 'Quicksand', sans-serif;
    font-weight: 400;
    font-size: 16px;
    color: #D4A574;
    margin-top: 8px;
}

.footer-links {
    display: flex;
    gap: 24px;
    flex-wrap: wrap;
    justify-content: center;
}

.footer-link {
    font-family: 'Quicksand', sans-serif;
    font-weight: 500;
    font-size: 15px;
    color: #D4A574;
}

.footer-link:hover {
    color: #FAF3EB;
}

.footer-copy {
    font-family: 'Quicksand', sans-serif;
    font-weight: 400;
    font-size: 13px;
    color: rgba(212, 165, 116, 0.6);
    margin-top: 12px;
}

/* --- Responsive --- */
@media (max-width: 768px) {
    #tile-grid {
        grid-template-columns: 1fr;
        padding: 72px 16px 40px;
        gap: 20px;
    }

    .tile-span2 {
        grid-column: span 1;
    }

    .tile-featured {
        min-height: 50vh;
    }

    .tile-featured .tile-title {
        font-size: 28px;
    }

    .tile-content {
        padding: 32px 20px;
    }

    .tile-3x4,
    .tile-4x3,
    .tile-1x1 {
        min-height: auto;
    }

    .nav-links {
        gap: 16px;
    }

    .nav-link {
        font-size: 14px;
    }

    .breath-element {
        height: 150px;
    }

    .breath-motif {
        width: 300px;
    }
}

@media (max-width: 480px) {
    .nav-inner {
        padding: 0 16px;
    }

    .nav-logo {
        font-size: 18px;
    }

    .nav-links {
        gap: 12px;
    }

    .nav-link {
        font-size: 13px;
    }

    .tile-title {
        font-size: 20px;
    }

    .tile-featured .tile-title {
        font-size: 24px;
    }

    .tile-excerpt {
        font-size: 15px;
    }
}

/* --- Pull Quote (used within tiles) --- */
.tile-pullquote {
    font-family: 'Quicksand', sans-serif;
    font-weight: 300;
    font-size: 24px;
    font-style: oblique 8deg;
    color: #8B5E3C;
    line-height: 1.5;
    padding: 16px 0;
    border-left: 3px solid rgba(196, 112, 78, 0.3);
    padding-left: 20px;
}

/* --- Accent Colors: Dried Lavender #9B7EA8 & Muted Terracotta Border #C4956A --- */
.tile-category-culture {
    color: #9B7EA8;
}

.tile:nth-child(5n) {
    border-color: rgba(196, 149, 106, 0.3);
}

/* Breath element border uses #C4956A at low opacity */
.breath-element {
    border: 1px solid #C4956A;
    border-color: rgba(196, 149, 106, 0.2);
}

/* Lavender accent for motif illustrations */
.breath-motif-accent {
    stroke: #9B7EA8;
}

/* --- Selection --- */
::selection {
    background-color: rgba(196, 112, 78, 0.2);
    color: #5B3A1A;
}

/* --- Scrollbar --- */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: #FAF3EB;
}

::-webkit-scrollbar-thumb {
    background: #D4A574;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #C4704E;
}
