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

/* ── Local RGB alias for translucent accent usage ────────────────────── */
:root {
    --primary-rgb: 124, 92, 255;
}

/* ── 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(47,107,255,.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;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.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 160px 260px;
    align-items: center;
    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 */
.fi-row:hover {
    background: var(--surface-2);
}

.fi-row:hover::before {
    opacity: 1;
    width: 5px;
}

/* 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;
    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 {
    box-shadow: 0 0 0 2px rgba(var(--primary-rgb), .38), 0 6px 18px rgba(0,0,0,.4);
    transform: translateY(-2px) scale(1.04);
}

/* Info block */
.fi-info {
    min-width: 0;
}

.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;
}

.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;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ── 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;
    text-align: center;
    background: var(--bg-1);
    border: 1px solid var(--border-soft);
    border-radius: 12px;
    padding: 11px 10px;
    gap: 0;
    transition: border-color .16s ease;
}

.fi-row:hover .fi-stats {
    border-color: rgba(var(--primary-rgb), .18);
}

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

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

.fi-stats-row span {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .07em;
    color: var(--text-mute);
}

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

/* Last post block */
.fi-last {
    display: flex;
    align-items: center;
    gap: 11px;
    background: var(--bg-1);
    border: 1px solid var(--border-soft);
    border-radius: 12px;
    padding: 11px 14px;
    min-width: 0;
    font-size: 13px;
    transition: border-color .16s ease;
}

.fi-row:hover .fi-last {
    border-color: rgba(var(--primary-rgb), .18);
}

.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: 600;
    color: #fff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    transition: color .14s;
    line-height: 1.35;
    margin-bottom: 3px;
}

.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;
}

.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) {
    .fi-row { grid-template-columns: 52px 1fr 140px; }
    .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; }
}

@media (max-width: 680px) {
    .fi-row { grid-template-columns: 46px 1fr; padding: 13px 14px; }
    .fi-stats { display: none; }
    .fi-hero-inner { padding: 22px 18px; gap: 20px; }
    .fi-hero h1 { font-size: 21px; }
    .fi-hero-stats { gap: 4px; }
    .fi-stat { min-width: 56px; padding: 8px 10px; }
    .fi-stat b { font-size: 19px; }
    .fi-cat-bar { border-radius: 10px 10px 0 0; }
    .fi-forum-list { border-radius: 0 0 12px 12px; }
    .fi-subforums { gap: 5px; }
    .fi-sf-chip { font-size: 11.5px; }
    .fi-subforums-label { display: none; }
}

/* ── 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
   Added: tablet (≤768px) and phone (≤480px) breakpoints.
   These only govern forum-index-scoped classes.
   ===================================================================== */

/* ── Tablet: stack main column above sidebar ──────────────────────── */
@media (max-width: 768px) {
    /* Stack .col-main and .col-side vertically */
    .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;
    }
    .col-side {
        margin-top: 24px;
    }

    /* 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: force 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-column layout (icon + info), hide stats+last */
    .fi-row {
        grid-template-columns: 46px 1fr;
        padding: 14px 16px;
        gap: 14px;
    }
    .fi-stats,
    .fi-last {
        display: none;
    }

    /* Category header: allow title to wrap, no overflow */
    .fi-cat-title {
        white-space: normal;
        word-break: break-word;
    }
    .fi-cat-bar {
        flex-wrap: wrap;
    }
    .fi-cat-count {
        margin-right: 10px;
    }

    /* Subforum chips: wrap naturally */
    .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: tighten further for 320–480px screens ─────────────────── */
@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: tight 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-desc {
        font-size: 12px;
        white-space: normal;
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    /* 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;
    }
}
