/* ========================================
   IMAGINARY WORLDS - MAIN STYLESHEET
   ======================================== */

/* ===== READING PROGRESS BAR ===== */
.reading-progress-bar {
    position: fixed;
    top: 0;
    left: 0;
    height: 5px;
    width: 0%;
    background: linear-gradient(90deg, #6B21A8 0%, #9333EA 50%, #A855F7 100%);
    z-index: 10000;
    transition: width 0.1s ease-out;
    box-shadow: 0 2px 4px rgba(107, 33, 168, 0.3);
}

/* ===== CSS VARIABLES ===== */
:root {
    /* Light Mode Colors */
    --color-primary: #7C3AED;        /* Darker Purple */
    --color-secondary: #D946EF;      /* Purple-Magenta */
    --color-accent: #3B82F6;         /* Blue */
    --color-gold: #F59E0B;           /* Orange-Gold */

    --color-bg-primary: #FFFFFF;
    --color-bg-secondary: #F9FAFB;
    --color-bg-tertiary: #F3F4F6;

    --color-text-primary: #1F2937;
    --color-text-secondary: #6B7280;
    --color-text-tertiary: #9CA3AF;

    --color-border: #E5E7EB;
    --color-shadow: rgba(0, 0, 0, 0.1);

    /* Gradients */
    --gradient-primary: linear-gradient(135deg, #7C3AED 0%, #D946EF 100%);
    --gradient-accent: linear-gradient(135deg, #3B82F6 0%, #7C3AED 100%);
    --gradient-gold: linear-gradient(135deg, #F59E0B 0%, #EA580C 100%);

    /* Spacing */
    --spacing-xs: 0.5rem;
    --spacing-sm: 1rem;
    --spacing-md: 1.5rem;
    --spacing-lg: 2rem;
    --spacing-xl: 3rem;
    --spacing-2xl: 4rem;

    /* Typography */
    --font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    --font-size-sm: 0.875rem;
    --font-size-base: 1rem;
    --font-size-lg: 1.125rem;
    --font-size-xl: 1.25rem;
    --font-size-2xl: 1.5rem;
    --font-size-3xl: 1.875rem;
    --font-size-4xl: 2.25rem;
    --font-size-5xl: 3rem;

    /* Border Radius */
    --radius-sm: 0.375rem;
    --radius-md: 0.5rem;
    --radius-lg: 0.75rem;
    --radius-xl: 1rem;

    /* Transitions */
    --transition-fast: 0.15s ease;
    --transition-base: 0.3s ease;
    --transition-slow: 0.5s ease;

    /* Z-index layers */
    --z-dropdown: 1000;
    --z-sticky: 1020;
    --z-fixed: 1030;
    --z-modal-backdrop: 1040;
    --z-modal: 1050;
    --z-popover: 1060;
    --z-tooltip: 1070;
}

/* Dark Mode Variables */
.dark-mode {
    --color-primary: #A78BFA;
    --color-secondary: #E879F9;
    --color-accent: #60A5FA;
    --color-gold: #FB923C;

    --color-bg-primary: #0F172A;
    --color-bg-secondary: #1E293B;
    --color-bg-tertiary: #334155;

    --color-text-primary: #F1F5F9;
    --color-text-secondary: #CBD5E1;
    --color-text-tertiary: #94A3B8;

    --color-border: #334155;
    --color-shadow: rgba(0, 0, 0, 0.3);
}

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

html {
    scroll-behavior: smooth;
    font-size: 16px;
    /* Dark paint before body styles apply — prevents white flash on page
       navigation. Update if light theme is re-enabled. */
    background-color: #0F172A;
}

body {
    font-family: var(--font-family);
    font-size: var(--font-size-base);
    line-height: 1.6;
    color: var(--color-text-primary);
    background-color: var(--color-bg-primary);
    transition: background-color var(--transition-base), color var(--transition-base);
    overflow-x: hidden;
}

img {
    max-width: 100%;
    height: auto;
    display: block;
}

/* The browser's own [hidden] rule is a plain `display: none`, so any component
   that declares its own `display` wins and the attribute silently does nothing.
   .user-menu-button (display: inline-flex) hit exactly that. */
[hidden] {
    display: none !important;
}

a {
    color: var(--color-primary);
    text-decoration: none;
    transition: color var(--transition-fast);
}

a:hover {
    color: var(--color-secondary);
}

h1, h2, h3, h4, h5, h6 {
    font-weight: 700;
    line-height: 1.2;
    margin-bottom: var(--spacing-md);
}

h1 { font-size: var(--font-size-5xl); }
h2 { font-size: var(--font-size-4xl); }
h3 { font-size: var(--font-size-3xl); }
h4 { font-size: var(--font-size-2xl); }
h5 { font-size: var(--font-size-xl); }
h6 { font-size: var(--font-size-lg); }

/* ===== CONTAINER ===== */
.container {
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 var(--spacing-lg);
}

@media (max-width: 768px) {
    .container {
        padding: 0 var(--spacing-md);
    }
}

/* ===== HEADER ===== */
.site-header {
    position: sticky;
    top: 0;
    z-index: var(--z-sticky);
    border-bottom: 1px solid var(--color-border);
    backdrop-filter: blur(10px);
    transition: all var(--transition-base);
    background: linear-gradient(
        135deg,
        rgba(236, 72, 153, 0.15),
        rgba(139, 92, 246, 0.15),
        rgba(59, 130, 246, 0.15),
        rgba(236, 72, 153, 0.15)
    );
    background-size: 400% 400%;
    animation: gradientShift 15s ease infinite;
}

.dark-mode .site-header {
    background: linear-gradient(
        135deg,
        rgba(236, 72, 153, 0.25),
        rgba(139, 92, 246, 0.25),
        rgba(59, 130, 246, 0.25),
        rgba(236, 72, 153, 0.25)
    );
    background-size: 400% 400%;
    animation: gradientShift 15s ease infinite;
}

@keyframes gradientShift {
    0% {
        background-position: 0% 50%;
    }
    50% {
        background-position: 100% 50%;
    }
    100% {
        background-position: 0% 50%;
    }
}

.header-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: var(--spacing-md) var(--spacing-lg);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--spacing-lg);
}

.logo h1 {
    font-size: var(--font-size-2xl);
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin: 0;
}

/* Logo is now an image */
.logo {
    min-width: 0;        /* allow the logo to shrink first if the row is tight */
    flex-shrink: 1;
    overflow: hidden;
}

.logo a {
    display: inline-flex;
    align-items: center;
    max-width: 100%;
}

.logo-heading {
    margin: 0;
    line-height: 0;
}

.logo-img {
    height: 60px;   /* 150% of the original 40px */
    width: auto;
    max-width: 100%;
    display: block;
}

.main-nav {
    display: flex;
    align-items: center;
    gap: var(--spacing-lg);
}

.main-nav a {
    color: var(--color-text-primary);
    font-weight: 500;
    padding: var(--spacing-xs) var(--spacing-sm);
    border-radius: var(--radius-md);
    transition: all var(--transition-fast);
}

.main-nav a:hover {
    color: var(--color-primary);
    background: var(--color-bg-tertiary);
}

/* ===== NAV DROPDOWNS =====
   Board Games and Digital Games each open a list of every game on hover, and
   on keyboard focus through :focus-within. The lists are built by
   components.js from data/games-index.json; without them the parent link still
   goes to the homepage section, so nothing depends on the menu existing. */
.nav-dropdown {
    position: relative;
    /* A flex item, so the link inside keeps the same box as the nav links that
       are not wrapped — inline padding would not count towards the row height
       and the bar would sit lower and shorter. */
    display: flex;
    align-items: center;
}

.nav-dropdown-menu {
    position: absolute;
    top: 100%;
    left: 0;
    margin: 0;
    padding: var(--spacing-xs) 0;
    min-width: 200px;
    list-style: none;
    background: var(--color-bg-secondary);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    box-shadow: 0 12px 28px rgba(0, 0, 0, 0.45);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-4px);
    transition: opacity var(--transition-fast), transform var(--transition-fast), visibility var(--transition-fast);
    z-index: var(--z-dropdown, 100);
}

/* A gap-free strip under the trigger, so moving the pointer down to the list
   does not pass over dead space and close the menu. */
.nav-dropdown::after {
    content: "";
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    height: var(--spacing-sm);
}

.nav-dropdown.has-menu:hover .nav-dropdown-menu,
.nav-dropdown.has-menu:focus-within .nav-dropdown-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.nav-dropdown-menu a {
    display: block;
    padding: var(--spacing-xs) var(--spacing-md);
    border-radius: 0;
    font-weight: 400;
    white-space: nowrap;
}

/* Hover-only menus are useless on touch, and the parent link already works. */
@media (hover: none) {
    .nav-dropdown-menu {
        display: none;
    }
}

.header-actions {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    flex-shrink: 0;   /* keep the user + menu buttons on screen; shrink the logo instead */
}

/* Round user/account button (meeple). Placeholder until auth is built. */
.user-menu-button {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--color-bg-tertiary);
    border: 2px solid var(--color-border);
    color: var(--color-text-primary);
    cursor: pointer;
    padding: 0;
    transition: color var(--transition-fast), border-color var(--transition-fast), transform var(--transition-fast);
}

.user-menu-button:hover {
    color: var(--color-primary);
    border-color: var(--color-primary);
    transform: translateY(-1px);
}

/* Lit when signed in — the meeple glows teal on every page so you can see at a
   glance that you have a session. Set by components.js from the demo flag
   account.js writes; becomes the real session check when auth lands. */
.user-menu-button.is-signed-in {
    background: linear-gradient(135deg, #14B8A6 0%, #06B6D4 100%);
    border-color: #5EEAD4;
    color: #06231F;
    box-shadow: 0 0 0 3px rgba(45, 212, 191, 0.22), 0 0 16px rgba(45, 212, 191, 0.5);
}

.user-menu-button.is-signed-in:hover {
    color: #06231F;
    border-color: #99F6E4;
    box-shadow: 0 0 0 3px rgba(45, 212, 191, 0.3), 0 0 22px rgba(45, 212, 191, 0.65);
}

.user-menu-button .meeple-icon {
    width: 22px;
    height: 22px;
    display: block;
}

.icon-button {
    background: transparent;
    border: 1px solid var(--color-border);
    color: var(--color-text-primary);
    padding: var(--spacing-xs) var(--spacing-sm);
    border-radius: var(--radius-md);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: var(--spacing-xs);
    font-size: var(--font-size-base);
    transition: all var(--transition-fast);
}

.icon-button:hover {
    background: var(--color-bg-tertiary);
    border-color: var(--color-primary);
}

.lang-flag {
    font-size: 1.25rem;
}

.ko-fi-button {
    background: #ffffff;
    padding: 6px 16px;
    border-radius: var(--radius-lg);
    font-weight: 700;
    flex-shrink: 0;   /* don't let the header squeeze the Ko-fi logo */
    /* Stack logo over "Support me" — narrower + a touch taller so it
       doesn't crowd the top bar */
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1px;
    line-height: 1.1;
    transition: all var(--transition-fast);
    border: none;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.ko-fi-button:hover {
    background: #f3f4f6;
    transform: translateY(-1px);
}

/* "Support me" in the Imaginary Worlds logo gradient */
.ko-fi-text {
    font-size: var(--font-size-sm);
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.kofi-logo {
    height: 26px;
    width: auto;
    max-width: none;   /* keep aspect ratio — don't let it get squished */
    display: block;
}

.ko-fi-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px var(--color-shadow);
}

.mobile-menu-toggle {
    display: none;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: var(--spacing-xs);
}

.hamburger {
    width: 24px;
    height: 2px;
    background: var(--color-text-primary);
    position: relative;
    display: block;
    transition: var(--transition-base);
}

.hamburger::before,
.hamburger::after {
    content: '';
    position: absolute;
    width: 100%;
    height: 2px;
    background: var(--color-text-primary);
    transition: var(--transition-base);
}

.hamburger::before {
    top: -8px;
}

.hamburger::after {
    bottom: -8px;
}

/* Mobile Menu — slides in from the right (where the hamburger button is) */
.mobile-menu {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    background: rgba(15, 23, 42, 0.95);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    z-index: var(--z-fixed);
    transform: translateX(100%);
    transition: transform var(--transition-base);
}

.mobile-menu.active {
    transform: translateX(0);
}

.mobile-menu-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--spacing-lg);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.mobile-menu-logo {
    font-size: var(--font-size-xl);
    font-weight: 700;
    color: var(--color-text-primary);
}

.mobile-menu-close {
    background: transparent;
    border: none;
    color: var(--color-text-primary);
    font-size: 2rem;
    cursor: pointer;
    padding: 0.5rem;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition-fast);
}

.mobile-menu-close:hover {
    color: var(--color-primary);
    transform: rotate(90deg);
}

.mobile-nav {
    display: flex;
    flex-direction: column;
    padding: var(--spacing-lg);
}

.mobile-nav a {
    color: var(--color-text-primary);
    font-size: var(--font-size-xl);
    font-weight: 600;
    padding: var(--spacing-md);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    transition: var(--transition-fast);
}

.mobile-nav a:hover {
    color: var(--color-primary);
    padding-left: calc(var(--spacing-md) + 0.5rem);
}

/* ===== MOBILE GAME LISTS =====
   The same two lists as the desktop dropdowns. A phone has no hover, so the
   arrow opens the list while the label keeps working as a link. */
.mobile-nav-row {
    display: flex;
    align-items: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.mobile-nav-row a {
    flex: 1;
    border-bottom: none;
}

.mobile-nav-expand {
    flex-shrink: 0;
    width: 48px;
    height: 48px;
    background: none;
    border: none;
    color: var(--color-text-primary);
    font-size: var(--font-size-lg);
    line-height: 1;
    cursor: pointer;
}

.mobile-nav-expand::before {
    content: "▾";
    display: block;
    transition: transform var(--transition-fast);
}

.mobile-nav-expand[aria-expanded="true"]::before {
    transform: rotate(180deg);
}

.mobile-nav-sub {
    margin: 0;
    padding: 0;
    list-style: none;
}

.mobile-nav-sub a {
    display: block;
    font-size: var(--font-size-md);
    font-weight: 400;
    padding-left: calc(var(--spacing-md) * 2);
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

@media (max-width: 1024px) {
    .main-nav {
        display: none;
    }

    .mobile-menu-toggle {
        display: block;
    }

    .mobile-menu {
        display: block;
    }
}

@media (max-width: 640px) {
    /* Keep "Support me" under the Ko-fi logo inside the button on mobile */
    .lang-code {
        display: none;
    }

    /* Tighten the header so the logo + Ko-fi button + menu all fit the row */
    .header-container {
        padding: var(--spacing-sm) var(--spacing-md);
        gap: var(--spacing-sm);
    }

    .logo h1 {
        font-size: var(--font-size-xl);
    }

    /* Trim the wordmark so the meeple + menu still fit a narrow phone row */
    .logo-img {
        height: 48px;
    }

    /* Slim the Ko-fi button so the row has slack on ~320–360px phones */
    .ko-fi-button {
        padding: 4px 10px;
    }

    .kofi-logo {
        height: 22px;
    }
}

/* The media modal markup ships in the shared footer, but only game pages load
   game-page.css (which styles + toggles it). Hide it everywhere else so its
   controls don't leak onto the homepage. */
.media-modal {
    display: none;
}

/* ===== HERO SECTION ===== */
.hero-section {
    position: relative;
    min-height: 90vh;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    overflow: hidden;
    background: var(--gradient-primary);
}

.parallax-bg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 120%;
    background-image: url('../images/parallax/hero-bg.jpg');
    background-size: cover;
    background-position: center;
    opacity: 0.2;
    z-index: 0;
}

.hero-content {
    position: relative;
    z-index: 1;
    color: white;
    max-width: 800px;
    padding: var(--spacing-2xl) var(--spacing-lg);
}

.hero-title {
    font-size: clamp(2.5rem, 5vw, 4rem);
    margin-bottom: var(--spacing-md);
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
}

.hero-subtitle {
    font-size: clamp(1.125rem, 2vw, 1.5rem);
    margin-bottom: var(--spacing-xl);
    opacity: 0.95;
}

.hero-cta {
    display: flex;
    gap: var(--spacing-md);
    justify-content: center;
    flex-wrap: wrap;
}

.cta-button {
    padding: var(--spacing-md) var(--spacing-xl);
    border-radius: var(--radius-lg);
    font-weight: 600;
    font-size: var(--font-size-lg);
    transition: all var(--transition-base);
    display: inline-block;
}

.cta-button.primary {
    background: white;
    color: var(--color-primary);
}

.cta-button.primary:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
}

.cta-button.secondary {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border: 2px solid white;
}

.cta-button.secondary:hover {
    background: rgba(255, 255, 255, 0.3);
}

.scroll-indicator {
    position: absolute;
    bottom: var(--spacing-xl);
    left: 50%;
    transform: translateX(-50%);
    animation: bounce 2s infinite;
}

.scroll-arrow {
    font-size: var(--font-size-3xl);
    color: white;
    opacity: 0.7;
}

@keyframes bounce {
    0%, 20%, 50%, 80%, 100% {
        transform: translateY(0);
    }
    40% {
        transform: translateY(-10px);
    }
    60% {
        transform: translateY(-5px);
    }
}

@media (max-width: 768px) {
    .hero-section {
        min-height: 70vh;
    }

    .hero-cta {
        flex-direction: column;
    }

    .cta-button {
        width: 100%;
    }
}

/* ===== FEATURED SECTIONS ===== */
.featured-section {
    padding: var(--spacing-2xl) 0;
    background: var(--color-bg-primary);
}

.featured-section:nth-child(even) {
    background: var(--color-bg-secondary);
}

/* Force both game sections to the dark bg so the (lighter) cards always stand
   out — overrides the featured-section zebra striping, which otherwise matches
   the card colour on even sections. Layers: section #0F172A / card #1E293B /
   info tags #334155. */
.board-games-section.featured-section,
.digital-games-section.featured-section {
    background: var(--color-bg-primary);
}

.board-games-section {
    padding-bottom: var(--spacing-md);
}

/* Thin divider between the board + digital sections (they share the dark bg
   now, so this keeps them visually separate segments). */
.digital-games-section {
    border-top: 1px solid var(--color-border);
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--spacing-xl);
}

/* Date / A–Z switch beside a section heading. The section header is already
   flex with space-between, so this simply takes the right-hand end. */
.sort-switch {
    display: inline-flex;
    gap: 2px;
    padding: 3px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    background: rgba(255, 255, 255, 0.03);
}

.sort-switch button {
    padding: 6px 14px;
    border: none;
    border-radius: calc(var(--radius-md) - 3px);
    background: transparent;
    color: var(--color-text-secondary);
    font-size: var(--font-size-sm);
    font-weight: 600;
    cursor: pointer;
    transition: background var(--transition-fast), color var(--transition-fast);
}

.sort-switch button:hover {
    color: var(--color-text-primary);
}

.sort-switch button[aria-pressed="true"] {
    background: var(--color-primary);
    color: #fff;
}

.section-header h2 {
    margin: 0;
    color: var(--color-text-primary);
}

/* ===== SHARE BUTTON ===== */
/* Used on game pages (injected by game-loader.js) and on blog posts. Behaviour
   lives in assets/js/share.js: native share sheet where the browser has one,
   clipboard copy where it does not. */
.share-button {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    background: transparent;
    color: var(--color-text-secondary);
    font-family: inherit;
    font-size: var(--font-size-sm);
    font-weight: 600;
    cursor: pointer;
    transition: color var(--transition-fast), border-color var(--transition-fast),
                background var(--transition-fast);
}

.share-button:hover {
    color: var(--color-text-primary);
    border-color: var(--color-primary);
    background: rgba(255, 255, 255, 0.04);
}

.share-button svg {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

/* Fixed width so the row does not reflow when the label turns into
   "Link copied" for two seconds after a clipboard fallback. */
.share-label {
    min-width: 5.5em;
    text-align: center;
}

/* "under construction" suffix on a section heading. Lives in its own <span>
   because language.js assigns textContent to the [data-i18n] node, which would
   wipe any sibling markup placed inside it. The dash is here rather than in the
   translation strings so lang/*.json stay clean. */
.section-status {
    font-weight: 300;
    font-size: 0.5em;
    color: var(--color-text-secondary);
    letter-spacing: 0.02em;
    white-space: nowrap;
}

.section-status::before {
    content: " — ";
}

.view-all {
    color: var(--color-primary);
    font-weight: 600;
    font-size: var(--font-size-lg);
    transition: var(--transition-fast);
}

.view-all:hover {
    color: var(--color-secondary);
    transform: translateX(5px);
}

/* ===== GAME CARDS ===== */
/* Carousel Wrapper */
.carousel-wrapper {
    position: relative;
    user-select: none; /* Prevent text selection during swipe */
}

/* Draggable, snap-to-card carousel track. All cards are preloaded in a single
   horizontal row the user drags (mouse or touch). Cards fade/clip against the
   edges via the mask; scroll-snap keeps whole cards in view once released. */
.games-carousel {
    --carousel-fade: 48px;
    display: flex;
    gap: var(--spacing-md);
    overflow-x: auto;
    overflow-y: hidden;
    scroll-snap-type: x mandatory;
    scroll-behavior: smooth;
    scroll-padding-left: var(--carousel-fade);
    padding: 10px var(--carousel-fade) 14px;
    -webkit-overflow-scrolling: touch;
    touch-action: pan-y;              /* vertical touch = page scroll; horizontal handled in JS */
    overscroll-behavior-x: contain;
    cursor: grab;
    /* Fade cards in/out as they enter/leave at the edges */
    -webkit-mask-image: linear-gradient(to right, transparent 0, #000 var(--carousel-fade), #000 calc(100% - var(--carousel-fade)), transparent 100%);
    mask-image: linear-gradient(to right, transparent 0, #000 var(--carousel-fade), #000 calc(100% - var(--carousel-fade)), transparent 100%);
    scrollbar-width: none;           /* Firefox */
    -ms-overflow-style: none;        /* IE/Edge */
}

.games-carousel::-webkit-scrollbar {
    display: none;                   /* Chrome/Safari */
}

/* While mouse-dragging: free follow, no snap fighting the pointer */
.games-carousel.dragging {
    cursor: grabbing;
    scroll-behavior: auto;
    scroll-snap-type: none;
}

/* Homepage carousel cards: fixed footprint + snap alignment.
   Lighter panel tone + subtle border so cards don't blend into the page bg. */
.games-carousel .game-card {
    flex: 0 0 380px;
    max-width: 85vw;
    scroll-snap-align: start;
    background: var(--color-bg-secondary);
    border: 1px solid var(--color-border);
}

.games-carousel .game-info {
    overflow: hidden;
    padding-top: 14px;                 /* moved the title up ~10px */
}

/* Title grows to at most 2 lines (game-loader shrinks the font to fit).
   Auto height keeps 1-line names tight instead of reserving a blank line.
   Roomier line-height so descenders (g, y, p) aren't clipped. */
.games-carousel .game-info h3 {
    font-size: 1.5rem;
    line-height: 1.3;
    max-height: 3.9rem;               /* cap at ~2 lines */
    margin-bottom: var(--spacing-xs); /* tighter space below the title */
    overflow: hidden;
}

/* Max 3 info boxes on one line; equal width + height, centered text.
   Extra bottom margin nudges the description clear of the info boxes. */
.games-carousel .game-meta {
    flex-wrap: nowrap;
    align-items: stretch;
    overflow: hidden;
    margin-bottom: var(--spacing-md);
}

.games-carousel .game-meta .meta-item {
    flex: 1 1 0;
    min-width: 0;
    min-height: 2.4em;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Description fills the remaining space and clamps — absorbs the slack so a
   1- vs 2-line title can never push the card past its fixed height */
.games-carousel .game-description {
    flex: 0 1 auto;
    min-height: 0;
    display: -webkit-box;
    -webkit-line-clamp: 4;
    -webkit-box-orient: vertical;
    overflow: hidden;
    margin-bottom: 0;
}

/* Buttons sit at the very bottom; slack lands above them. The 48px keeps the
   description off the buttons — the cards size to their content, so this is
   also what makes each card 48px taller. */
.games-carousel .game-actions {
    margin-top: auto;
    padding-top: 24px;
}

/* No fixed height. The carousel is a flex row, so every card already stretches
   to the tallest one in it — a hard 540px only added empty space under the
   buttons. The description still clamps at four lines, and .game-actions keeps
   margin-top:auto so the buttons stay on one line at the bottom of each card. */

/* ===== SIDE BORDER DECORATIONS =====
   Shown on every /board-games/ and /digital-games/ page (body gets a
   page-* class from components.js). Fixed-size art (720×1290, no scaling)
   pinned in the gutters, behind the content: the inner edge meets the
   content edge first, then snaps out to the screen edges as it widens.
   Left is the original, right is mirrored. */
.page-board-games,
.page-digital-games {
    /* Let the borders (behind content) show; page colour comes from <html> */
    background-color: transparent;
    position: relative;   /* containing block so borders span the full page */
}

.page-board-games::before,
.page-board-games::after,
.page-digital-games::before,
.page-digital-games::after {
    content: "";
    position: absolute;          /* scrolls with the page */
    top: 120px;                  /* start below the sticky top bar (116px with the 60px logo) */
    bottom: 0;                   /* ...and repeat down to the page bottom */
    width: 720px;
    background-size: 100% 1290px; /* fixed tile height — no scaling, repeats */
    background-repeat: repeat-y;
    opacity: 0.25;               /* 75% transparent — lets the blue show through */
    z-index: -1;                 /* behind all page content */
    pointer-events: none;
}

/* Pin: inner edge at the content edge, but never past the viewport edge */
.page-board-games::before,
.page-digital-games::before {
    left: min(0px, calc((100vw - 1280px) / 2 - 720px));
}

.page-board-games::after,
.page-digital-games::after {
    right: min(0px, calc((100vw - 1280px) / 2 - 720px));
    transform: scaleX(-1);  /* mirror on the right */
}

.page-board-games::before,
.page-board-games::after {
    background-image: url("../images/Border-analog.jpg");
}

.page-digital-games::before,
.page-digital-games::after {
    background-image: url("../images/Border-digital.jpg");
}

.digital-games-carousel .play-button {
    margin-top: auto;
    align-self: flex-start;
}

/* Carousel Dots */
.carousel-dots {
    display: flex;
    justify-content: center;
    gap: var(--spacing-md);
    margin-top: var(--spacing-lg);
    margin-bottom: 0;
}

.carousel-dot {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--color-border);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.carousel-dot:hover {
    background: var(--color-text-secondary);
    transform: scale(1.1);
}

.carousel-dot.active {
    background: var(--color-primary);
    transform: scale(1.3);
}

@media (max-width: 768px) {
    .carousel-dot {
        width: 18px;
        height: 18px;
    }
}

.game-card {
    background: var(--color-bg-primary);
    border-radius: var(--radius-xl);
    overflow: hidden;
    box-shadow: 0 4px 6px var(--color-shadow);
    transition: all var(--transition-base);
    display: flex;
    flex-direction: column;
    width: 380px;
}

.game-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 25px var(--color-shadow);
}

.game-image {
    position: relative;
    width: 100%;
    aspect-ratio: 16/9;
    background: var(--gradient-accent);
    overflow: hidden;
}

.game-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.placeholder-image {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: var(--font-size-3xl);
    font-weight: bold;
    color: rgba(255, 255, 255, 0.7);
    position: relative;
    overflow: hidden;
}

/* Gradient patterns for different content types */
.game-card .placeholder-image {
    background: linear-gradient(135deg, #8B5CF6 0%, #EC4899 100%);
}

.indie-card .placeholder-image {
    background: linear-gradient(135deg, #3B82F6 0%, #8B5CF6 100%);
}

.blog-card .placeholder-image {
    background: linear-gradient(135deg, #EC4899 0%, #8B5CF6 60%, #3B82F6 100%);
}

.model-card .placeholder-image {
    background: linear-gradient(135deg, #FCD34D 0%, #F59E0B 100%);
}

/* Add subtle pattern overlay */
.placeholder-image::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image:
        repeating-linear-gradient(
            45deg,
            transparent,
            transparent 10px,
            rgba(255, 255, 255, 0.05) 10px,
            rgba(255, 255, 255, 0.05) 20px
        );
    pointer-events: none;
}

/* Add glow effect on hover */
.game-card:hover .placeholder-image,
.blog-card:hover .placeholder-image,
.model-card:hover .placeholder-image,
.featured-blog-post:hover .featured-blog-image {
    filter: brightness(1.1);
}

.game-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity var(--transition-base);
}

.game-card:hover .game-overlay {
    opacity: 1;
}

.overlay-button {
    background: white;
    color: var(--color-primary);
    padding: var(--spacing-sm) var(--spacing-lg);
    border-radius: var(--radius-lg);
    font-weight: 600;
}

.game-info {
    padding: var(--spacing-lg);
    display: flex;
    flex-direction: column;
    flex: 1;
}

.game-info h3 {
    margin-bottom: var(--spacing-sm);
    color: var(--color-text-primary);
}

.game-meta {
    display: flex;
    gap: var(--spacing-md);
    margin-bottom: var(--spacing-sm);
    flex-wrap: wrap;
}

.meta-item {
    font-size: var(--font-size-sm);
    color: var(--color-text-secondary);
    background: var(--color-bg-tertiary);
    padding: var(--spacing-xs) var(--spacing-sm);
    border-radius: var(--radius-sm);
}

.game-description {
    color: var(--color-text-secondary);
    font-size: var(--font-size-sm);
    line-height: 1.5;
    margin-bottom: var(--spacing-md);
    /* Removed 3-line truncation to prevent conflicts with game detail pages */
}

/* Board Game Card Enhancements */
.game-image-wrapper {
    position: relative;
    width: 100%;
    aspect-ratio: 16/9;
    background: var(--gradient-accent);
    overflow: hidden;
}

.game-image-wrapper img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.status-badge {
    position: absolute;
    top: var(--spacing-sm);
    right: var(--spacing-sm);
    padding: 4px 12px;
    border-radius: var(--radius-sm);
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    z-index: 2;
    /* Lift the badge off the image so it doesn't blend in */
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.55);
}

/* Badge = how far along the game is, one stage per card:
   mockup (red, not playable) → prototype (orange, owner plays it locally) →
   early access (blue, playable) → released (green, out on our own) →
   published (violet, out through a publisher / for sale), plus archived (grey)
   for anything shelved. A release that gets updated later shows its version
   inside the badge. */
.status-badge.mockup {
    background: #ef4444;
    color: white;
}

.status-badge.prototype {
    background: #f59e0b;
    color: white;
}

.status-badge.early-access {
    background: #3b82f6;
    color: white;
}

.status-badge.released {
    background: #10b981;
    color: white;
}

.status-badge.published {
    background: #8b5cf6;
    color: white;
}

.status-badge.archived {
    background: #6b7280;
    color: white;
}

.status-badge .badge-version {
    opacity: 0.85;
    letter-spacing: 0;
    text-transform: none;   /* keep "v1.2" lowercase inside an uppercase badge */
}

.game-tags {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    padding: 6px 8px;
    background: linear-gradient(to top, rgba(0,0,0,0.85), transparent);
    z-index: 2;
}

/* Status badge sits at the bottom-left of the image, on the tag row */
.game-tags .status-badge {
    position: static;
    top: auto;
    right: auto;
    flex-shrink: 0;
}

.game-tags .tag-list {
    display: flex;
    gap: 4px;
    min-width: 0;
    overflow: hidden;
}

.game-tags .tag {
    background: rgba(30, 30, 30, 0.95);
    color: white;
    padding: 2px 8px;
    border-radius: var(--radius-sm);
    font-size: 10px;
    font-weight: 600;
    white-space: nowrap;
}

.game-actions {
    display: flex;
    gap: var(--spacing-sm);
    margin-top: auto;
}

.game-btn {
    flex: 1;
    padding: 10px 16px;
    border-radius: var(--radius-md);
    font-size: 14px;
    font-weight: 600;
    border: none;
    cursor: pointer;
    transition: all var(--transition-fast);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    white-space: nowrap;
}

/* Card button colour = what it costs you.
   green = free (play it, print & play), magenta = costs money,
   blue = a file to download. */
.game-btn.free {
    background: #10b981;
    color: white;
}

.game-btn.free:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.4);
    background: #059669;
}

.game-btn.download {
    background: #3b82f6;
    color: white;
}

.game-btn.download:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.4);
    background: #2563eb;
}

.game-btn.premium {
    background: linear-gradient(135deg, #ec4899 0%, #8b5cf6 100%);
    color: white;
}

.game-btn.premium:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(236, 72, 153, 0.4);
}

.game-btn .price {
    font-weight: 700;
    margin-left: 2px;
}

.game-badge {
    position: absolute;
    top: var(--spacing-sm);
    right: var(--spacing-sm);
    padding: var(--spacing-xs) var(--spacing-sm);
    border-radius: var(--radius-sm);
    font-size: var(--font-size-sm);
    font-weight: 600;
    color: white;
    /* Lift the badge off the image so it doesn't blend in */
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.55);
}

.game-badge.jam-entry {
    background: var(--color-accent);
}

.game-badge.in-dev {
    background: var(--color-gold);
    color: var(--color-text-primary);
}

.game-badge.playable {
    background: var(--color-secondary);
}

.game-badge.deprecated {
    background: #6b7280;
    color: white;
}

.play-button {
    display: inline-block;
    margin-top: var(--spacing-md);
    padding: var(--spacing-xs) var(--spacing-md);
    background: var(--gradient-primary);
    color: white;
    border-radius: var(--radius-md);
    font-weight: 600;
    font-size: var(--font-size-sm);
    transition: var(--transition-fast);
}

.play-button:hover {
    transform: translateY(-2px);
}

.play-button.disabled {
    background: var(--color-bg-tertiary);
    color: var(--color-text-tertiary);
    cursor: not-allowed;
}

/* ===== BLOG SECTION ===== */
.blog-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: var(--spacing-xl);
}

.blog-card {
    background: var(--color-bg-primary);
    border-radius: var(--radius-xl);
    overflow: hidden;
    box-shadow: 0 4px 6px var(--color-shadow);
    transition: all var(--transition-base);
}

.blog-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 25px var(--color-shadow);
}

.blog-image {
    display: block;
    aspect-ratio: 16/9;
    background: var(--gradient-accent);
    text-decoration: none;
    cursor: pointer;
    overflow: hidden;
}

.blog-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.blog-content {
    padding: var(--spacing-lg);
    padding-bottom: calc(var(--spacing-lg) + 30px);
}

.blog-meta {
    display: flex;
    gap: var(--spacing-md);
    margin-bottom: var(--spacing-sm);
    font-size: var(--font-size-sm);
}

.blog-date {
    color: var(--color-text-secondary);
}

.blog-category {
    background: var(--gradient-primary);
    color: white;
    padding: 2px var(--spacing-sm);
    border-radius: var(--radius-sm);
    font-weight: 600;
}

.blog-content h3 {
    margin-bottom: var(--spacing-sm);
    font-size: var(--font-size-xl);
}

.blog-content h3 a {
    color: var(--color-text-primary);
}

.blog-content h3 a:hover {
    color: var(--color-primary);
}

.blog-excerpt {
    color: var(--color-text-secondary);
    margin-bottom: var(--spacing-md);
    line-height: 1.6;
}

.read-more {
    color: var(--color-primary);
    font-weight: 600;
    transition: var(--transition-fast);
}

.read-more:hover {
    color: var(--color-secondary);
}

/* Blog Read More Button (Gold, bottom-left) */
.blog-read-more {
    color: var(--color-gold);
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 600;
    transition: all var(--transition-fast);
    margin-top: auto;
}

.blog-read-more:hover {
    color: #FFD700;
    transform: translateX(4px);
}

/* Featured Blog Post */
.featured-blog-post {
    display: grid;
    grid-template-columns: 400px 1fr;
    gap: 0;
    background: var(--color-bg-primary);
    border-radius: var(--radius-xl);
    overflow: hidden;
    box-shadow: 0 4px 6px var(--color-shadow);
    transition: all var(--transition-base);
    max-height: 300px;
}

.featured-blog-post:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 25px var(--color-shadow);
}

.featured-blog-image {
    aspect-ratio: 4/3;
    background: var(--gradient-accent);
    height: 100%;
    width: 100%;
    overflow: hidden;
}

/* The gradient above stays visible until an image loads, and shows through if
   one never does. The global `img` rule sets height:auto, which would letterbox
   inside the fixed aspect-ratio box — hence the explicit fill. */
.featured-blog-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.featured-blog-content {
    padding: var(--spacing-lg);
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    min-width: 0;               /* let the grid item shrink to its column (no overflow) */
}

.featured-blog-content h3,
.featured-blog-content .blog-excerpt {
    overflow-wrap: anywhere;    /* never let a long word push past the edge */
}

.featured-blog-content h3 {
    font-size: var(--font-size-2xl);
    margin-bottom: var(--spacing-md);
}

.featured-blog-content .blog-excerpt {
    font-size: var(--font-size-base);
    line-height: 1.7;
    margin-bottom: var(--spacing-md);
    flex-grow: 1;
}

/* Load More Button */
.load-more-container {
    display: flex;
    justify-content: center;
    margin-top: var(--spacing-xl);
}

.load-more-button {
    background: var(--gradient-primary);
    border: none;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all var(--transition-base);
    box-shadow: 0 4px 12px rgba(139, 92, 246, 0.3);
    color: white;
}

.load-more-button:hover {
    transform: translateY(2px) scale(1.1);
    box-shadow: 0 6px 20px rgba(139, 92, 246, 0.5);
}

.load-more-button svg {
    animation: bounce 2s ease-in-out infinite;
}

@keyframes bounce {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(5px);
    }
}

.load-more-button.hidden {
    display: none;
}

/* ===== 3D MODELS SECTION ===== */
.model-category {
    margin-bottom: var(--spacing-md);
}

.model-category:last-child {
    margin-bottom: 0;
}

.model-category .carousel-wrapper {
    min-height: auto;
}

.model-category .carousel-dots {
    margin-top: var(--spacing-md);
    margin-bottom: 0;
}

.model-category h3 {
    font-size: var(--font-size-xl);
    color: var(--color-text-primary);
    margin-bottom: var(--spacing-sm);
    font-weight: 700;
}

.models-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 20px;
    transition: opacity 0.3s ease-in-out;
    justify-items: center;
}

.models-grid.transitioning {
    opacity: 0;
}

/* Center alignment for models grid with fewer cards */
.models-grid.cards-1 {
    grid-template-columns: 180px;
    justify-content: center;
}

.models-grid.cards-2 {
    grid-template-columns: repeat(2, 180px);
    justify-content: center;
}

.models-grid.cards-3 {
    grid-template-columns: repeat(3, 180px);
    justify-content: center;
}

.models-grid.cards-4 {
    grid-template-columns: repeat(4, 180px);
    justify-content: center;
}

.models-grid.cards-5 {
    grid-template-columns: repeat(5, 180px);
    justify-content: center;
}

/* Main page 3D models grid - single row of 6 */
.models-grid-home {
    display: grid;
    grid-template-columns: repeat(6, 180px);
    gap: 20px;
    justify-content: center;
    margin: 0 auto;
}

@media (max-width: 1200px) {
    .models-grid-home {
        grid-template-columns: repeat(4, 180px);
    }
}

@media (max-width: 800px) {
    .models-grid-home {
        grid-template-columns: repeat(3, 180px);
    }
}

@media (max-width: 600px) {
    .models-grid-home {
        grid-template-columns: repeat(2, 180px);
    }
}

.model-card {
    background: var(--color-bg-primary);
    border-radius: var(--radius-sm);
    overflow: hidden;
    box-shadow: 0 1px 4px var(--color-shadow);
    transition: all var(--transition-base);
    cursor: pointer;
    width: 180px;
}

.model-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 20px var(--color-shadow);
}

.model-image {
    position: relative;
    aspect-ratio: 1/1;
    background: var(--gradient-gold);
    overflow: hidden;
}

.collection-badge {
    position: absolute;
    top: 4px;
    right: 4px;
    padding: 2px 6px;
    background: rgba(236, 72, 153, 0.9);
    color: white;
    border-radius: 3px;
    font-size: 8px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.2px;
}

.model-info {
    padding: 6px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 4px;
}

.model-name {
    font-size: 11px;
    font-weight: 600;
    color: var(--color-text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.model-price {
    font-size: 11px;
    font-weight: 700;
    color: var(--color-primary);
    white-space: nowrap;
    flex-shrink: 0;
}

.model-price.free {
    color: #22c55e;
}

/* Service Sections */
.services-container {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--spacing-xl);
}

.service-card {
    background: var(--color-bg-primary);
    border-radius: var(--radius-xl);
    padding: var(--spacing-xl);
    text-align: center;
    box-shadow: 0 4px 12px var(--color-shadow);
    transition: all var(--transition-base);
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: center;
}

.service-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 20px var(--color-shadow);
}

.service-card h3 {
    font-size: var(--font-size-3xl);
    color: var(--color-text-primary);
    margin-bottom: var(--spacing-md);
    font-weight: 700;
    min-height: calc(var(--font-size-3xl) * 1.2);
    display: flex;
    align-items: center;
    justify-content: center;
}

.service-card p {
    font-size: var(--font-size-lg);
    color: var(--color-text-secondary);
    margin-bottom: auto;
    line-height: 1.6;
    min-height: calc(var(--font-size-lg) * 1.6 * 3);
}

.service-image {
    width: 100%;
    aspect-ratio: 3/2;
    background: var(--gradient-gold);
    border-radius: var(--radius-md);
    margin-top: var(--spacing-lg);
    overflow: hidden;
}

.service-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.service-image .placeholder-image {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: var(--font-size-xl);
    color: white;
    font-weight: 600;
}

.service-button {
    display: inline-flex;
    align-items: center;
    gap: var(--spacing-sm);
    background: var(--gradient-primary);
    color: white;
    padding: var(--spacing-md) var(--spacing-xl);
    border-radius: var(--radius-lg);
    font-size: var(--font-size-base);
    font-weight: 700;
    border: none;
    cursor: pointer;
    transition: all var(--transition-base);
    box-shadow: 0 4px 12px rgba(var(--color-accent-rgb), 0.3);
}

.service-button:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(var(--color-accent-rgb), 0.4);
}

.service-button.ai-button {
    background: var(--gradient-accent);
}

/* ===== SUPPORT SECTION ===== */
.support-section {
    padding: var(--spacing-2xl) 0;
    background: var(--gradient-primary);
    color: white;
    text-align: center;
}

.support-content h2 {
    color: white;
    margin-bottom: var(--spacing-md);
}

.support-content p {
    font-size: var(--font-size-lg);
    margin-bottom: var(--spacing-xl);
    opacity: 0.95;
}

.ko-fi-button.large {
    font-size: var(--font-size-xl);
    padding: var(--spacing-md) var(--spacing-2xl);
    background: white;
    color: var(--color-primary);
}

/* ===== FOOTER ===== */
.site-footer {
    background: var(--color-bg-secondary);
    padding: var(--spacing-xl) 0 var(--spacing-md);
    border-top: 1px solid var(--color-border);
}

.footer-content {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: var(--spacing-lg);
    margin-bottom: var(--spacing-md);
}

/* Latest Updates list (replaces the old newsletter form) */
.footer-updates {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: var(--spacing-xs);
}

.footer-updates li {
    display: flex;
    flex-direction: column;
    line-height: 1.3;
}

.footer-updates a {
    color: var(--color-text-primary);
    font-size: var(--font-size-sm);
    font-weight: 600;
}

.footer-updates a:hover {
    color: var(--color-primary);
}

.footer-updates .update-date {
    font-size: 0.7rem;
    color: var(--color-text-tertiary);
}

.footer-section h3,
.footer-section h4 {
    margin-bottom: var(--spacing-sm);
    color: var(--color-text-primary);
}

.footer-section p {
    color: var(--color-text-secondary);
}

/* The base .ko-fi-button stacks its logo over the label for the top bar, and is
   a block-level flex container — in a footer column that would stretch across
   the whole track. Here it reads better as a compact row. */
.footer-section .ko-fi-button {
    display: inline-flex;
    flex-direction: row;
    gap: 8px;
    margin-top: var(--spacing-md);
    padding: 8px 16px;
    font-size: var(--font-size-sm);
}

.footer-section ul {
    list-style: none;
}

.footer-section ul li {
    margin-bottom: var(--spacing-xs);
}

.footer-section ul li a {
    color: var(--color-text-secondary);
    transition: var(--transition-fast);
}

.footer-section ul li a:hover {
    color: var(--color-primary);
}

.contact-list {
    list-style: none;
}

.contact-list li {
    margin-bottom: var(--spacing-sm);
    color: var(--color-text-secondary);
}

.contact-list strong {
    color: var(--color-text-primary);
    margin-right: var(--spacing-xs);
}

.contact-list a {
    color: var(--color-primary);
    transition: var(--transition-fast);
}

.contact-list a:hover {
    text-decoration: underline;
}

.newsletter-section p {
    font-size: var(--font-size-sm);
    margin-bottom: var(--spacing-sm);
}

.newsletter-form {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-xs);
}

.newsletter-input {
    padding: var(--spacing-xs) var(--spacing-sm);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    background: var(--color-bg-primary);
    color: var(--color-text-primary);
    font-size: var(--font-size-sm);
}

.newsletter-input:focus {
    outline: none;
    border-color: var(--color-primary);
}

.newsletter-button {
    padding: var(--spacing-xs) var(--spacing-sm);
    background: var(--gradient-primary);
    color: white;
    border: none;
    border-radius: var(--radius-md);
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition-base);
    font-size: var(--font-size-sm);
}

.newsletter-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(var(--color-accent-rgb), 0.3);
}

.newsletter-button:disabled {
    opacity: 0.6;
    cursor: default;
    transform: none;
    box-shadow: none;
}

.newsletter-message {
    font-size: var(--font-size-sm);
    line-height: 1.5;
    margin-top: var(--spacing-xs);
}

.newsletter-message.is-success {
    color: #34d399;
}

.newsletter-message.is-error {
    color: #f87171;
}

.footer-link {
    color: var(--color-primary);
    font-weight: 600;
}

.footer-bottom {
    text-align: center;
    padding-top: var(--spacing-md);
    border-top: 1px solid var(--color-border);
    color: var(--color-text-secondary);
    font-size: var(--font-size-sm);
}

.footer-credit {
    margin-top: var(--spacing-xs);
}

.footer-version {
    margin-top: var(--spacing-xs);
    font-size: 0.75rem;
    color: var(--color-text-tertiary);
    letter-spacing: 0.03em;
    opacity: 0.7;
}

.footer-credit a {
    color: var(--color-primary);
}

/* ===== SEARCH MODAL ===== */
.search-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    z-index: var(--z-modal);
    justify-content: center;
    align-items: flex-start;
    padding-top: 10vh;
}

.search-modal.active {
    display: flex;
}

.search-modal-content {
    background: var(--color-bg-primary);
    width: 100%;
    max-width: 600px;
    border-radius: var(--radius-xl);
    padding: var(--spacing-lg);
    position: relative;
}

.search-close {
    position: absolute;
    top: var(--spacing-md);
    right: var(--spacing-md);
    background: transparent;
    border: none;
    font-size: var(--font-size-3xl);
    cursor: pointer;
    color: var(--color-text-secondary);
}

.search-input {
    width: 100%;
    padding: var(--spacing-md);
    border: 2px solid var(--color-border);
    border-radius: var(--radius-lg);
    font-size: var(--font-size-lg);
    background: var(--color-bg-secondary);
    color: var(--color-text-primary);
    margin-bottom: var(--spacing-md);
}

.search-input:focus {
    outline: none;
    border-color: var(--color-primary);
}

.search-results {
    max-height: 400px;
    overflow-y: auto;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
    h1 { font-size: var(--font-size-4xl); }
    h2 { font-size: var(--font-size-3xl); }
    h3 { font-size: var(--font-size-2xl); }

    .blog-grid {
        grid-template-columns: 1fr;
    }

    .models-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: var(--spacing-sm);
    }

    .services-container {
        grid-template-columns: 1fr;
        gap: var(--spacing-md);
    }

    .service-card {
        min-height: 250px;
    }

    .service-button {
        font-size: var(--font-size-base);
        padding: var(--spacing-sm) var(--spacing-lg);
    }

    .featured-blog-post {
        grid-template-columns: minmax(0, 1fr);  /* 0 min so a wide word can't stretch the track */
        max-height: none;
    }

    .featured-blog-image {
        min-height: 250px;
        aspect-ratio: 16/9;
    }

    /* Carousel: smaller side fade + narrower card so a whole card fits the
       viewport (was clipping on the right and sitting too far right) */
    .games-carousel {
        --carousel-fade: 16px;
    }

    .games-carousel .game-card {
        max-width: calc(100vw - 96px);
    }

    /* Info boxes: wrap to 2 lines so wide text fits, and a bit wider
       (tighter gap + less card padding) instead of clipping with an ellipsis */
    .games-carousel .game-info {
        padding-left: var(--spacing-sm);
        padding-right: var(--spacing-sm);
    }

    .games-carousel .game-meta {
        gap: var(--spacing-xs);
    }

    .games-carousel .game-meta .meta-item {
        white-space: normal;
        overflow: visible;
        text-overflow: clip;
        line-height: 1.2;
        font-size: 0.72rem;
        padding-left: 5px;
        padding-right: 5px;
    }

    /* Tighter tags + soft fade so a 3rd tag never hard-clips on narrow cards */
    .game-tags .tag {
        font-size: 9px;
        padding: 2px 6px;
    }

    .game-tags .tag-list {
        -webkit-mask-image: linear-gradient(to right, #000 88%, transparent);
        mask-image: linear-gradient(to right, #000 88%, transparent);
    }

    .section-header {
        flex-direction: column;
        align-items: flex-start;
        gap: var(--spacing-md);
    }
}

@media (min-width: 769px) and (max-width: 1024px) {
    .models-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

@media (max-width: 480px) {
    .models-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* ===== UTILITY CLASSES ===== */
.text-center {
    text-align: center;
}

.mt-0 { margin-top: 0; }
.mt-1 { margin-top: var(--spacing-xs); }
.mt-2 { margin-top: var(--spacing-sm); }
.mt-3 { margin-top: var(--spacing-md); }
.mt-4 { margin-top: var(--spacing-lg); }

.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: var(--spacing-xs); }
.mb-2 { margin-bottom: var(--spacing-sm); }
.mb-3 { margin-bottom: var(--spacing-md); }
.mb-4 { margin-bottom: var(--spacing-lg); }
