/* =====================================================================
   ESAForum — Forum Index Premium Styles (forum-index.css) v4
   Scoped enhancements for the category index page only.
   Relies on CSS variables defined in theme.css.
   ===================================================================== */

/* --primary-rgb is defined globally in theme.css (loaded first); do not
   redefine it here to keep theme ownership of core tokens. */

/* ── Hero banner ─────────────────────────────────────────────────────── */
.fi-hero {
    position: relative;
    border-radius: 22px;
    overflow: hidden;
    border: 1px solid rgba(var(--primary-rgb), .28);
    margin-bottom: 30px;
    background:
        linear-gradient(125deg, rgba(var(--primary-rgb), .22) 0%, rgba(var(--accent-rgb),.10) 40%, rgba(10,12,22,0) 70%),
        linear-gradient(180deg, var(--surface-2) 0%, var(--surface) 100%);
    box-shadow: 0 0 0 1px rgba(var(--primary-rgb), .10), 0 24px 60px rgba(0,0,0,.55);
}

/* Diagonal stripe texture on the right */
.fi-hero::before {
    content: '';
    position: absolute;
    right: 0; top: 0; bottom: 0;
    width: 55%;
    pointer-events: none;
    background:
        repeating-linear-gradient(
            135deg,
            rgba(var(--primary-rgb), .055) 0 2px,
            transparent 2px 24px
        );
    mask-image: linear-gradient(90deg, transparent 0%, #000 50%);
    -webkit-mask-image: linear-gradient(90deg, transparent 0%, #000 50%);
}

/* Subtle radial glow in top-left corner */
.fi-hero::after {
    content: '';
    position: absolute;
    left: -60px; top: -60px;
    width: 340px; height: 340px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(var(--primary-rgb), .14) 0%, transparent 70%);
    pointer-events: none;
}

.fi-hero-inner {
    position: relative;
    z-index: 1;
    padding: 44px 48px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 36px;
    flex-wrap: wrap;
}

.fi-hero h1 {
    font-size: 36px;
    margin: 0 0 10px;
    letter-spacing: -.035em;
    line-height: 1.15;
}

.fi-hero p {
    color: var(--text-dim);
    margin: 0;
    max-width: 500px;
    font-size: 15.5px;
    line-height: 1.65;
}

/* ── Hero eyebrow pill ───────────────────────────────────────────────── */
.fi-eyebrow {
    margin-bottom: 14px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 14px;
    border-radius: 30px;
    background: rgba(var(--primary-rgb), .12);
    border: 1px solid rgba(var(--primary-rgb), .30);
    color: var(--primary-2);
    font-size: 12.5px;
    font-weight: 600;
    letter-spacing: .03em;
}

.fi-eyebrow-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--green);
    box-shadow: 0 0 8px var(--green);
    flex-shrink: 0;
}

/* Stat pills in the hero */
.fi-hero-stats {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    align-items: center;
}

.fi-stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 80px;
    padding: 14px 16px;
    border-radius: 16px;
    background: rgba(255,255,255,.04);
    border: 1px solid rgba(255,255,255,.07);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    transition: border-color .2s, background .2s;
}

.fi-stat:hover {
    background: rgba(var(--primary-rgb), .10);
    border-color: rgba(var(--primary-rgb), .30);
}

.fi-stat b {
    display: block;
    font-size: 28px;
    font-weight: 800;
    color: #fff;
    letter-spacing: -.03em;
    line-height: 1.05;
}

.fi-stat span {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: var(--text-mute);
    margin-top: 4px;
}

.fi-stat.fi-stat-online b {
    color: var(--green);
    text-shadow: 0 0 16px rgba(46,230,166,.45);
}

/* ── Category section ────────────────────────────────────────────────── */
.fi-category {
    margin-bottom: 32px;
}

.fi-cat-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 0;
    padding: 0;
    position: relative;
}

/* The accent bar + label row */
.fi-cat-bar {
    display: flex;
    align-items: center;
    gap: 0;
    flex: 1;
    min-width: 0;
    border-radius: 12px 12px 0 0;
    overflow: hidden;
    background: linear-gradient(90deg, rgba(var(--primary-rgb), .15) 0%, var(--surface-2) 55%, var(--surface-2) 100%);
    border: 1px solid var(--border);
    border-bottom: none;
    padding: 0;
}

.fi-cat-accent {
    width: 5px;
    align-self: stretch;
    flex-shrink: 0;
    background: var(--grad-primary);
    border-radius: 0;
}

.fi-cat-label {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 13px 18px;
    flex: 1;
    min-width: 0;
}

.fi-cat-ico {
    width: 24px;
    height: 24px;
    border-radius: 6px;
    display: block;
    flex-shrink: 0;
}

.fi-cat-title {
    font-size: 13px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: .10em;
    color: #fff;
    /* Allow long category names (with emoji) to wrap rather than truncate */
    white-space: normal;
    overflow-wrap: break-word;
    word-break: break-word;
    min-width: 0;
}

.fi-cat-count {
    margin-left: auto;
    font-size: 11.5px;
    color: var(--primary-2);
    font-weight: 700;
    background: rgba(var(--primary-rgb), .12);
    border: 1px solid rgba(var(--primary-rgb), .22);
    padding: 3px 12px;
    border-radius: 20px;
    white-space: nowrap;
    flex-shrink: 0;
    margin-right: 14px;
    letter-spacing: .02em;
}

/* Forum list — flush against the cat-head bottom border */
.fi-forum-list {
    display: flex;
    flex-direction: column;
    border-radius: 0 0 16px 16px;
    overflow: hidden;
    border: 1px solid var(--border);
    border-top: none;
    background: var(--surface);
}

/* ── Forum rows ──────────────────────────────────────────────────────── */
.fi-row {
    display: grid;
    grid-template-columns: 60px 1fr 148px 256px;
    align-items: stretch;   /* stretch so stat+last boxes fill row height */
    gap: 20px;
    padding: 18px 22px 18px 24px;
    background: var(--surface);
    border-top: 1px solid var(--border-soft);
    position: relative;
    overflow: hidden;
    transition: background .16s ease, border-color .16s ease;
    cursor: default;
}

.fi-row:first-child {
    border-top: none;
}

/* Left accent stripe — colored by forum's --fc variable */
.fi-row::before {
    content: '';
    position: absolute;
    left: 0; top: 0; bottom: 0;
    width: 4px;
    background: var(--fc, var(--grad-primary));
    opacity: .6;
    transition: opacity .16s ease, width .16s ease;
    border-radius: 0 2px 2px 0;
}

/* Hover: subtle background shift + accent brightens */
/* No hover light on the row — only the folder icon animates (per user request).
   Background stays flat; the left accent bar does not brighten/grow. */

/* Icon tile */
.fi-icon {
    width: 52px;
    height: 52px;
    border-radius: 14px;
    display: grid;
    place-items: center;
    overflow: hidden;
    background: var(--fc-soft, var(--surface-2));
    border: 1px solid rgba(255,255,255,.07);
    flex-shrink: 0;
    align-self: center;   /* center icon vertically even with stretch rows */
    transition: box-shadow .18s ease, transform .2s cubic-bezier(.34,1.56,.64,1);
}

.fi-icon img {
    width: 100%;
    height: 100%;
    display: block;
}

.fi-row:hover .fi-icon {
    /* No glow — only the folder lift/scale animation (per user request) */
    transform: translateY(-2px) scale(1.04);
}

/* Info block */
.fi-info {
    min-width: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.fi-info h3 {
    margin: 0 0 3px;
    font-size: 16px;
    font-weight: 700;
    letter-spacing: -.01em;
    line-height: 1.25;
}

.fi-info h3 a {
    color: #fff;
    transition: color .15s;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    /* Canonical min-width fix: inline-flex can exceed container on narrow screens */
    max-width: 100%;
    min-width: 0;
    overflow-wrap: break-word;
    word-break: break-word;
}

.fi-info h3 a:hover {
    color: var(--primary-2);
}

.fi-desc {
    margin: 0 0 2px;
    font-size: 13px;
    color: var(--text-mute);
    line-height: 1.5;
    /* ensure any inner content cannot overflow the info column */
    max-width: 100%;
    overflow: hidden;
}
.fi-desc p { margin: 0 0 4px; }
/* Banner / general images: constrained width, never overflow */
.fi-desc img {
    max-width: 100%;
    width: auto;
    height: auto;
    max-height: 150px;
    border-radius: 8px;
    margin: 4px 0;
    display: block;
}
.fi-desc a { color: var(--primary); }
.fi-desc span { color: inherit; }
/* keep emoji images (ipsEmoji) inline-sized, override block display above */
.fi-desc .ipsEmoji,
.fi-desc img[alt$="emoji"],
.fi-desc img.ipsEmoji {
    max-width: none;
    max-height: 1.2em;
    height: 1.2em;
    width: auto;
    vertical-align: -0.2em;
    display: inline;
    border-radius: 0;
    margin: 0;
}

/* ── Sub-forum chips ─────────────────────────────────────────────────── */
.fi-subforums {
    margin-top: 8px;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
}

.fi-subforums-label {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: var(--text-mute);
    white-space: nowrap;
    margin-right: 2px;
    flex-shrink: 0;
    line-height: 24px;
}

.fi-sf-chip {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 10px 3px 7px;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-dim);
    background: rgba(var(--primary-rgb), .07);
    border: 1px solid rgba(var(--primary-rgb), .18);
    transition:
        background .15s ease,
        border-color .15s ease,
        color .15s ease,
        transform .15s ease,
        box-shadow .15s ease;
    white-space: nowrap;
    line-height: 1.4;
}

.fi-sf-chip:hover {
    background: rgba(var(--primary-rgb), .18);
    border-color: var(--primary);
    color: #fff;
    transform: translateY(-1px);
    box-shadow: 0 3px 10px rgba(var(--primary-rgb), .25);
}

.fi-sf-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--fc, var(--primary));
    flex-shrink: 0;
    opacity: .85;
    box-shadow: 0 0 5px var(--fc, var(--primary));
}

/* Stats block */
.fi-stats {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;   /* vertically center content within stretched cell */
    text-align: center;
    /* No boxed background/border — just the numbers (per user request) */
    background: none;
    border: none;
    padding: 12px 10px;
    gap: 0;
    min-width: 0;
}

.fi-stats-row {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 5px 0;
    width: 100%;
}

.fi-stats-row b {
    display: block;
    font-size: 20px;
    font-weight: 800;
    color: #fff;
    letter-spacing: -.025em;
    line-height: 1.1;
}

.fi-stats-row span {
    font-size: 10.5px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: var(--text-mute);
    margin-top: 2px;
}

.fi-stats-sep {
    height: 1px;
    background: var(--border-soft);
    width: 65%;
    margin: 7px auto;
}

/* Last post block */
.fi-last {
    display: flex;
    align-items: center;
    gap: 11px;
    /* No boxed background/border — just the last-post text (per user request) */
    background: none;
    border: none;
    padding: 11px 14px;
    min-width: 0;
    font-size: 13px;
    overflow: hidden;   /* prevent avatar or topic text from blowing out */
}

.fi-last-ava {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    object-fit: cover;
    flex-shrink: 0;
    box-shadow: 0 0 0 2px var(--surface-3);
    display: block;
}

.fi-last-meta {
    min-width: 0;
    flex: 1;
}

.fi-last-topic {
    display: block;
    font-size: 13px;
    font-weight: 700;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    transition: color .14s;
    line-height: 1.3;
    margin-bottom: 4px;
}

.fi-last-topic:hover {
    color: var(--primary-2);
}

.fi-last-by {
    display: block;
    font-size: 11.5px;
    color: var(--text-mute);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.4;
}

.fi-last-author {
    color: var(--text-dim);
    font-weight: 600;
    font-size: 11.5px;
    transition: color .14s;
}

.fi-last-author:hover {
    color: var(--primary-2);
}

.fi-last-empty {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-mute);
    font-size: 12.5px;
    padding: 2px 0;
}

/* ── Sidebar widget upgrades ─────────────────────────────────────────── */
.fi-widget {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin-bottom: 18px;
    overflow: hidden;
    transition: border-color .2s;
}

.fi-widget:hover {
    border-color: var(--surface-3);
}

.fi-widget-head {
    padding: 12px 16px;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .09em;
    color: var(--text-dim);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 8px;
    background: linear-gradient(90deg, rgba(var(--primary-rgb), .07), transparent 60%);
}

.fi-widget-head .fi-pill {
    margin-left: auto;
    background: var(--surface-3);
    color: var(--text-dim);
    padding: 2px 9px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 700;
}

/* ── Board stats grid in sidebar ─────────────────────────────────────── */
.fi-board-stats {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    padding: 14px 16px;
}

.fi-bs-item {
    background: var(--bg-1);
    border: 1px solid var(--border-soft);
    border-radius: 12px;
    padding: 12px 12px 10px;
    text-align: center;
    transition: border-color .15s, background .15s;
}

.fi-bs-item:hover {
    background: var(--surface-2);
    border-color: rgba(var(--primary-rgb), .22);
}

.fi-bs-val {
    font-size: 22px;
    font-weight: 800;
    color: #fff;
    letter-spacing: -.03em;
    line-height: 1.1;
    display: block;
}

.fi-bs-val.online {
    color: var(--green);
    text-shadow: 0 0 14px rgba(46,230,166,.4);
}

.fi-bs-label {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .07em;
    color: var(--text-mute);
    margin-top: 3px;
    display: block;
}

/* ── Stagger animations via data-delay ───────────────────────────────── */
[data-delay="1"] { transition-delay: .05s; }
[data-delay="2"] { transition-delay: .10s; }
[data-delay="3"] { transition-delay: .15s; }
[data-delay="4"] { transition-delay: .20s; }
[data-delay="5"] { transition-delay: .25s; }

/* Reveal animation — works with existing scroll-reveal JS */
[data-reveal]:not(.fade-up) { opacity: 0; transform: translateY(14px); }
[data-reveal].fade-up { opacity: 1; transform: none; transition: opacity .45s ease, transform .45s ease; }

/* Stagger for fi-row inside a revealed category */
.fi-category.fade-up .fi-row:nth-child(1) { animation: fiRowIn .35s ease both .05s; }
.fi-category.fade-up .fi-row:nth-child(2) { animation: fiRowIn .35s ease both .10s; }
.fi-category.fade-up .fi-row:nth-child(3) { animation: fiRowIn .35s ease both .15s; }
.fi-category.fade-up .fi-row:nth-child(4) { animation: fiRowIn .35s ease both .20s; }
.fi-category.fade-up .fi-row:nth-child(5) { animation: fiRowIn .35s ease both .25s; }
.fi-category.fade-up .fi-row:nth-child(n+6) { animation: fiRowIn .35s ease both .30s; }

@keyframes fiRowIn {
    from { opacity: 0; transform: translateX(-8px); }
    to   { opacity: 1; transform: none; }
}

/* ── Responsive ─────────────────────────────────────────────────────── */
@media (max-width: 1100px) {
    /* Drop the last-post column; keep stats */
    .fi-row { grid-template-columns: 52px 1fr 136px; }
    .fi-last { display: none; }
    .fi-hero-inner { padding: 32px 32px; }
    .fi-hero h1 { font-size: 28px; }
}

@media (max-width: 980px) {
    .fi-hero-inner { padding: 28px 24px; }
    .fi-hero h1 { font-size: 24px; }
    .fi-stat b { font-size: 22px; }
    .fi-stat { min-width: 64px; padding: 10px 12px; }
}

/* ── SFX click target — make the whole row keyboard/pointer reachable ── */
.fi-row.sfx-click {
    cursor: pointer;
}

/* ── Discord CTA widget ──────────────────────────────────────────────── */
.fi-discord-cta {
    background: linear-gradient(135deg, rgba(88,101,242,.18), rgba(var(--primary-rgb),.10));
    border-color: rgba(88,101,242,.32);
}

.fi-discord-cta:hover {
    border-color: rgba(88,101,242,.55);
}

/* ── Newest member divider ───────────────────────────────────────────── */
.fi-divider {
    height: 1px;
    background: var(--border);
    margin: 12px 0;
}

/* ===== Video/image hero background ===== */
.fi-hero--media { position:relative; overflow:hidden; min-height:300px; display:flex; align-items:center; }
.fi-hero-bg { position:absolute; inset:0; width:100%; height:100%; object-fit:cover; background-size:cover; background-position:center; z-index:0; }
.fi-hero-overlay { position:absolute; inset:0; z-index:1; }
.fi-hero--media .fi-hero-inner { position:relative; z-index:2; width:100%; }
.fi-hero--media h1, .fi-hero--media p { text-shadow:0 2px 12px rgba(0,0,0,.6); }
.fi-hero--off { min-height:0; }

/* =====================================================================
   MOBILE RESPONSIVENESS — Forum Board Index
   Breakpoints: tablet (≤768px) and phone (≤480px and ≤360px).
   These only govern forum-index-scoped classes.
   ===================================================================== */

/* ── Tablet/narrow-desktop (≤980px): restore sidebar that theme.css hides,
      stack it below the main column so it's always visible on this page ── */
@media (max-width: 980px) {
    .row {
        display: flex !important;
        flex-direction: column !important;
    }
    .col-main,
    .col-side {
        width: 100% !important;
        max-width: 100% !important;
        flex: none !important;
        min-width: 0 !important;
        display: block !important;   /* counteract theme.css display:none on col-side */
    }
    .col-side {
        margin-top: 24px;
    }
}

/* ── Tablet (≤768px): hero + row layout refinements ── */
@media (max-width: 768px) {

    /* Hero: reduce height, stack inner to single column */
    .fi-hero--media {
        min-height: 220px;
    }
    .fi-hero-inner {
        flex-direction: column;
        align-items: flex-start;
        padding: 28px 24px;
        gap: 20px;
    }
    .fi-hero h1 {
        font-size: 22px;
    }
    .fi-hero p {
        font-size: 14px;
        max-width: 100%;
    }

    /* Stats pills: 2×2 grid on tablet */
    .fi-hero-stats {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 8px;
        width: 100%;
    }
    .fi-stat {
        min-width: 0;
        padding: 12px 10px;
    }
    .fi-stat b {
        font-size: 22px;
    }

    /* Forum rows: 2-col grid (icon | info+stats stacked), hide last-post column */
    .fi-row {
        grid-template-columns: 48px 1fr;
        grid-auto-rows: auto;
        align-items: start;
        row-gap: 4px;
        padding: 14px 14px 14px 16px;
        gap: 12px;
    }
    .fi-icon {
        width: 44px;
        height: 44px;
        grid-row: 1;
        grid-column: 1;
    }
    .fi-info {
        grid-column: 2;
        grid-row: 1;
    }
    /* Stats: shown inline below the info text, spanning column 2 */
    .fi-stats {
        display: flex !important;
        grid-column: 2;
        grid-row: 2;
        flex-direction: row;
        gap: 16px;
        padding: 4px 0 0;
        border: none !important;
        background: none !important;
        justify-content: flex-start;
    }
    .fi-stats-sep { display: none; }
    .fi-stats-row {
        flex-direction: row;
        gap: 5px;
        align-items: baseline;
        padding: 0;
        width: auto;
    }
    .fi-stats-row b { font-size: 14px; }
    .fi-stats-row span { font-size: 11px; color: var(--text-mute); }
    /* Hide last-post block entirely on tablet (no room) */
    .fi-last { display: none; }

    /* Category header: allow long titles with emoji to wrap */
    .fi-cat-bar {
        flex-wrap: wrap;
    }
    .fi-cat-count {
        margin-right: 10px;
    }

    /* Subforum chips: wrap naturally, allow long names to break */
    .fi-subforums {
        flex-wrap: wrap;
        gap: 5px;
    }
    .fi-sf-chip {
        white-space: normal;
        word-break: break-word;
    }

    /* Prevent any horizontal scroll */
    .fi-category,
    .fi-forum-list,
    .fi-row,
    .fi-hero {
        max-width: 100%;
        overflow-x: hidden;
    }
}

/* ── Phone (≤480px): tighten further ─────────────────────────────── */
@media (max-width: 480px) {
    /* Hero: compact height and text */
    .fi-hero--media {
        min-height: 200px;
    }
    .fi-hero {
        border-radius: 14px;
        margin-bottom: 20px;
    }
    .fi-hero-inner {
        padding: 20px 16px;
        gap: 16px;
    }
    .fi-hero h1 {
        font-size: 19px;
        letter-spacing: -.02em;
    }
    .fi-hero p {
        font-size: 13px;
    }
    .fi-eyebrow {
        font-size: 11.5px;
        padding: 5px 11px;
    }

    /* Hero stats: 2×2 grid, smaller text */
    .fi-hero-stats {
        grid-template-columns: 1fr 1fr;
        gap: 6px;
        width: 100%;
    }
    .fi-stat {
        padding: 10px 8px;
        border-radius: 12px;
    }
    .fi-stat b {
        font-size: 18px;
    }
    .fi-stat span {
        font-size: 10px;
    }

    /* Forum rows: tighter phone layout */
    .fi-row {
        grid-template-columns: 40px 1fr;
        padding: 12px 12px 12px 14px;
        gap: 10px;
    }
    .fi-icon {
        width: 40px;
        height: 40px;
        border-radius: 10px;
    }
    .fi-info h3 {
        font-size: 14px;
    }
    .fi-info h3 a {
        font-size: 14px;
    }
    /* Banner-image descriptions: clamp text to 2 lines but NOT when there's an img */
    .fi-desc {
        font-size: 12px;
    }
    /* Only clamp purely-text descriptions (no block images inside) */
    .fi-desc:not(:has(img:not(.ipsEmoji))) {
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
        overflow: hidden;
    }

    /* Category header */
    .fi-cat-title {
        font-size: 11.5px;
    }
    .fi-cat-count {
        font-size: 10.5px;
        padding: 2px 8px;
        margin-right: 8px;
    }
    .fi-cat-bar {
        border-radius: 8px 8px 0 0;
    }
    .fi-forum-list {
        border-radius: 0 0 10px 10px;
    }
    .fi-category {
        margin-bottom: 22px;
    }

    /* Subforum chips: smaller */
    .fi-sf-chip {
        font-size: 11px;
        padding: 2px 8px 2px 6px;
    }
    .fi-subforums-label {
        display: none;
    }

    /* Sidebar widgets: tighter padding */
    .fi-widget-head {
        font-size: 11px;
        padding: 10px 14px;
    }
    .fi-board-stats {
        grid-template-columns: 1fr 1fr;
        gap: 8px;
        padding: 12px 14px;
    }
    .fi-bs-val {
        font-size: 18px;
    }
    .fi-bs-label {
        font-size: 10px;
    }

    /* Prevent horizontal scroll on all key containers */
    .fi-category,
    .fi-forum-list,
    .fi-row,
    .fi-hero,
    .fi-subforums {
        max-width: 100%;
        overflow-x: hidden;
    }
}

/* ── Narrow phone (≤360px): minimal adjustments ───────────────────── */
@media (max-width: 360px) {
    .fi-hero-inner {
        padding: 16px 12px;
    }
    .fi-hero h1 {
        font-size: 17px;
    }
    .fi-row {
        padding: 10px 10px 10px 12px;
        gap: 8px;
    }
    .fi-icon {
        width: 36px;
        height: 36px;
        border-radius: 8px;
    }
    .fi-info h3,
    .fi-info h3 a {
        font-size: 13px;
    }
    .fi-stats-row b {
        font-size: 13px;
    }
    /* Legend items: smaller padding on very narrow screens */
    .fi-legend-item {
        font-size: 11px;
        padding: 4px 8px;
    }
    .fi-legend-count {
        padding: 1px 5px;
    }
}

/* =====================================================================
   MOBILE POLISH PASS — Forum index page
   ===================================================================== */

/* ── Remove expensive backdrop-filter on stat pills (mobile GPU) ── */
@media (max-width: 768px) {
    .fi-stat {
        backdrop-filter: none !important;
        -webkit-backdrop-filter: none !important;
    }
}

/* ── Sidebar: shoutbox height adjust on small phones ── */
@media (max-width: 480px) {
    .shout-messages { height: 180px; }
    .shout-form input { font-size: 14px; padding: 9px 10px; }
    .fi-board-stats { padding: 10px 12px; }
    .fi-bs-val { font-size: 16px; }
}

/* ── Group legend: wrap cleanly on all phone widths ── */
@media (max-width: 768px) {
    /* Legend container */
    .fi-legend {
        padding: 14px 16px;
        border-radius: 12px;
        margin: 18px 0 8px;
    }
    .fi-legend-head { gap: 8px; margin-bottom: 12px; }
    .fi-legend-title { font-size: 14px; }
    .fi-legend-sub { font-size: 11.5px; }
    /* Pill grid: wrap naturally */
    .fi-legend-grid { gap: 6px; }
    .fi-legend-item {
        font-size: 12.5px;
        padding: 5px 10px;
        /* Keep the whole pill on one line, but allow wrapping between pills */
        white-space: nowrap;
        min-height: 32px;
    }
}

@media (max-width: 480px) {
    .fi-legend { padding: 12px 14px; }
    .fi-legend-item {
        font-size: 11.5px;
        padding: 4px 9px;
        gap: 5px;
    }
    .fi-legend-dot { width: 7px; height: 7px; }
    .fi-legend-count { font-size: 10px; padding: 1px 5px; min-width: 16px; }
    /* Sub text: hide on smallest phones to keep pills compact */
    .fi-legend-sub { display: none; }
}

@media (max-width: 360px) {
    .fi-legend { padding: 10px 12px; }
    .fi-legend-grid { gap: 5px; }
    .fi-legend-item { font-size: 11px; padding: 4px 8px; }
}

/* ── Online strip: consistent avatar sizes ── */
@media (max-width: 480px) {
    .online-strip a img { width: 30px; height: 30px; border-radius: 8px; }
    .online-strip { gap: 5px; }
}

/* ── Rank list rows: compact on phone ── */
@media (max-width: 480px) {
    .rank-row { padding: 6px 4px; gap: 8px; }
    .rank-row .nm { font-size: 13px; }
    .rank-row .val { font-size: 11px; }
    .rank-row .rk { width: 20px; height: 20px; font-size: 11px; border-radius: 6px; }
}

/* ── Activity feed items ── */
@media (max-width: 480px) {
    .act-item { font-size: 12.5px; gap: 8px; }
    .act-item .ai-ico { width: 26px; height: 26px; font-size: 14px; }
    .act-item .ai-time { font-size: 11px; }
}

/* ── Forum category section: no overflow on narrow screens ── */
@media (max-width: 480px) {
    .fi-category,
    .fi-forum-list,
    .fi-cat-bar,
    .fi-row { overflow-x: hidden; }
    /* Category: slightly tighter margin */
    .fi-category { margin-bottom: 20px; }
}

/* ── Widget heads: ensure emoji + text don't overflow ── */
@media (max-width: 480px) {
    .fi-widget-head { white-space: normal; line-height: 1.4; }
    .fi-pill { flex-shrink: 0; }
}

/* ── Themed category banner background (admin-set per category) ── */
.fi-cat-bar.has-banner {
    position: relative;
    background:
        linear-gradient(90deg, rgba(10,12,22,.92) 0%, rgba(10,12,22,.72) 45%, rgba(10,12,22,.55) 100%),
        var(--cat-bg) center/cover no-repeat;
    border-color: rgba(var(--primary-rgb), .35);
}
.fi-cat-bar.has-banner .fi-cat-title { color: #fff; text-shadow: 0 1px 6px rgba(0,0,0,.7); }
.fi-cat-emoji { font-size: 20px; line-height: 1; width: 24px; text-align: center; flex-shrink: 0; }

/* ── Per-forum banner background (admin-set per forum) — image fills the row,
      dark gradient keeps the left-side text readable (like a server card). ── */
.fi-row.has-banner {
    background:
        linear-gradient(90deg, var(--surface) 0%, var(--surface) 30%, rgba(10,12,22,.82) 55%, rgba(10,12,22,.55) 100%),
        var(--forum-bg) right center / cover no-repeat;
}
/* No hover brightening on banner rows either — banner stays static (per user request) */
.fi-row.has-banner .fi-info h3 a { text-shadow: 0 1px 6px rgba(0,0,0,.6); }
.fi-row.has-banner::before { opacity: 1; width: 5px; } /* keep accent visible over image */

/* Stronger per-forum accent: tint the icon tile with the forum colour */
.fi-icon { background: var(--fc-soft, var(--surface-2)); border-color: color-mix(in srgb, var(--fc, var(--primary)) 40%, transparent); }
.fi-icon-emoji { font-size: 26px; line-height: 1; display: grid; place-items: center; width: 100%; height: 100%; }

/* ── Board toolbar + "Continue where you left off" ── */
.fi-toolbar { display:flex; align-items:center; gap:12px; margin-bottom:16px; padding:10px 16px;
    background:var(--surface); border:1px solid var(--border); border-radius:12px; flex-wrap:wrap; }
.fi-toolbar-label { font-weight:800; font-size:13px; letter-spacing:.04em; color:var(--text); text-transform:uppercase; }
.fi-resume { margin-bottom:22px; }
.fi-resume-head { font-size:13px; font-weight:700; color:var(--text-dim); margin-bottom:10px; }
.fi-resume-grid { display:grid; grid-template-columns:repeat(auto-fill,minmax(220px,1fr)); gap:10px; }
.fi-resume-card { display:flex; flex-direction:column; gap:4px; padding:12px 14px; border-radius:12px;
    background:linear-gradient(135deg, rgba(var(--primary-rgb),.10), var(--surface));
    border:1px solid rgba(var(--primary-rgb),.22); text-decoration:none; transition:transform .14s ease, border-color .14s ease;
    min-width:0; overflow:hidden; }
.fi-resume-card:hover { transform:translateY(-2px); border-color:var(--primary); }
.fi-resume-title { font-weight:700; font-size:13.5px; color:var(--text); line-height:1.3;
    display:block; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.fi-resume-meta { font-size:11.5px; color:var(--text-mute); }

@media (max-width:600px){ .fi-resume-grid{ grid-template-columns:1fr; } .fi-toolbar-label{ font-size:12px; } }

/* =====================================================================
   DESKTOP POLISH (≥1024px) — Forum index refined spacing & hierarchy
   ===================================================================== */
@media (min-width: 1024px) {
    /* ── Forum rows: tighter accent on desktop, smoother hover ── */
    .fi-row {
        grid-template-columns: 60px 1fr 148px 256px;
        padding: 20px 26px 20px 28px;
        gap: 22px;
        transition: background .18s ease, box-shadow .18s ease;
    }
    /* No hover light on the row (desktop) — only the folder icon animates. */

    /* ── Icon tile: refined spring animation on hover ── */
    .fi-icon {
        width: 54px;
        height: 54px;
        border-radius: 15px;
        align-self: center;
        transition: box-shadow .2s ease, transform .22s cubic-bezier(.34,1.56,.64,1), border-color .18s ease;
    }
    .fi-row:hover .fi-icon {
        /* No glow — only the folder lift/scale animation (per user request) */
        transform: translateY(-3px) scale(1.06);
    }

    /* ── Forum name: slightly larger on desktop ── */
    .fi-info h3 { font-size: 16.5px; margin-bottom: 4px; }
    .fi-desc { font-size: 13px; line-height: 1.55; }

    /* ── Stats block: better padding + value size ── */
    .fi-stats { padding: 13px 14px; gap: 0; min-width: 0; }
    .fi-stats-row b { font-size: 21px; }
    .fi-stats-sep { margin: 8px auto; }

    /* ── Last post block: slightly more padding ── */
    .fi-last { padding: 12px 16px; gap: 12px; }
    .fi-last-ava { width: 38px; height: 38px; border-radius: 11px; }
    .fi-last-topic { font-size: 13.5px; margin-bottom: 5px; }
    .fi-last-by { font-size: 12px; }
    .fi-last-author { font-size: 12px; }

    /* ── Category header: richer look ── */
    .fi-cat-label { padding: 14px 20px; gap: 12px; }
    .fi-cat-title { font-size: 13.5px; letter-spacing: .09em; }
    .fi-cat-count { font-size: 12px; padding: 4px 14px; }
    .fi-cat-emoji { font-size: 21px; }

    /* ── Subforum chips: richer hover effect ── */
    .fi-sf-chip {
        font-size: 12.5px;
        padding: 4px 12px 4px 9px;
        gap: 6px;
    }
    .fi-sf-chip:hover {
        box-shadow: 0 4px 12px rgba(var(--primary-rgb), .28);
    }
    .fi-subforums { margin-top: 9px; gap: 7px; }

    /* ── Sidebar widgets: smoother border reveal on hover ── */
    .fi-widget { transition: border-color .2s ease, box-shadow .2s ease; }
    .fi-widget:hover {
        border-color: rgba(var(--primary-rgb), .22);
        box-shadow: 0 4px 20px rgba(0,0,0,.25);
    }

    /* ── Board stats grid: hover glow ── */
    .fi-bs-item:hover {
        box-shadow: 0 0 0 1px rgba(var(--primary-rgb), .22);
    }
    .fi-bs-val { font-size: 23px; }

    /* ── Resume cards: richer hover ── */
    .fi-resume-card:hover {
        box-shadow: 0 6px 20px rgba(var(--primary-rgb), .18);
    }

    /* ── Toolbar: cleaner look ── */
    .fi-toolbar { padding: 11px 18px; border-radius: 14px; }

    /* ── Hero: ensure stats pills don't stretch weirdly ── */
    .fi-hero-stats { gap: 8px; }
    .fi-stat { min-width: 86px; padding: 15px 18px; border-radius: 18px; }
    .fi-stat b { font-size: 30px; }
}

/* ════════════════ DE-CLUTTER / BREATHING ROOM (v16) ════════════════ */
/* Clamp forum descriptions to 2 lines on the board so rows stay uniform & airy */
.fi-row .fi-desc {
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
    overflow: hidden; line-height: 1.45; font-size: 12.5px; color: var(--text-mute);
    margin: 0;
}
.fi-row .fi-desc p { margin: 0; display: inline; }
/* banner rows: hide the (often image-heavy) description to keep the card clean */
.fi-row.has-banner .fi-desc { display: none; }

/* More space between categories & rows */
.fi-category { margin-bottom: 30px; }
/* fi-info gap — consolidate here; desktop polish row re-declares padding/gap */
.fi-info { gap: 5px; }

/* Sub-forum chips — keep the colored dot accent visible; tighten size slightly */
.fi-subforums { margin-top: 4px; gap: 6px; }
.fi-sf-chip {
    font-size: 11.5px;
    padding: 3px 10px 3px 8px;
    opacity: .92;
    /* Keep the translucent primary tint from the base rule — no surface-2 override */
    background: rgba(var(--primary-rgb), .08);
    border: 1px solid rgba(var(--primary-rgb), .20);
}
.fi-sf-chip:hover { opacity: 1; border-color: var(--primary); background: rgba(var(--primary-rgb), .17); color: #fff; }
/* "+N more" chip gets a warmer accent */
.fi-sf-more { color: var(--primary-2); font-weight: 700; background: rgba(var(--primary-rgb),.13); border-color: rgba(var(--primary-rgb),.28); }

@media (min-width: 1024px) {
    .fi-row { padding: 22px 26px; }
    .fi-info { gap: 6px; }
}

/* ── Sidebar widget body: consistent padding scoped to fi-widget ── */
.fi-widget .widget-body {
    padding: 14px 16px;
}
@media (min-width: 1024px) {
    .fi-widget .widget-body { padding: 16px 18px; }
}
@media (max-width: 480px) {
    .fi-widget .widget-body { padding: 12px 14px; }
}

/* ── Forum row h3 margin reset: avoid double spacing with fi-info gap ── */
.fi-info h3 { margin: 0; }
.fi-info h3 a { line-height: 1.3; }

/* ── fi-last-ava: add ring on hover for interactivity cue ── */
.fi-last-ava {
    transition: box-shadow .14s ease, transform .14s ease;
}
.fi-last a:hover .fi-last-ava,
.fi-last a:focus .fi-last-ava {
    box-shadow: 0 0 0 2px var(--primary);
    transform: scale(1.04);
}

/* ── Subforum chip dot: inherit forum color from --fc on the row ── */
.fi-sf-dot {
    background: var(--fc, var(--primary));
    box-shadow: none;  /* remove glow; keep the accent clean */
    opacity: 1;
}
.fi-sf-chip:hover .fi-sf-dot {
    box-shadow: 0 0 5px var(--fc, var(--primary));
}

/* ── Category count pill: align flush right within cat-bar ── */
.fi-cat-count { margin-left: auto; }

/* ── Hero text: ensure gradient text renders on overlay-mode hero ── */
.fi-hero--media .fi-hero-inner h1 .grad {
    background: var(--grad-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}
