/**
 * Apollo Groups — Directory Listing Styles
 *
 * Editorial-style listing with hero, tabs, trending, featured, grid cards.
 * FORBIDDEN: "group" on frontend — use "comuna" or "núcleo" only.
 *
 * @package Apollo\Groups
 * @since   3.0.0
 */

/* ═══════ VARIABLES ═══════ */
:root {
    --ff-main: "Space Grotesk", system-ui, sans-serif;
    --ff-mono: "Space Mono", monospace;
    --ff-fun: "Syne", sans-serif;
    --primary: FF9820;
    --ink: #121214;
    --smoke: #666;
    --ghost: #999;
    --mist: #c0c0c0;
    --bg: #ffffff;
    --surface: #fafafa;
    --border: rgba(var(--rgb-d),0.07);
    --border-hover: rgba(var(--rgb-d),0.14);
    --radius: 18px;
    --r-lg: 24px;
    --pill: 100px;
    --ease: cubic-bezier(.16,1,.3,1);
}

/* ═══════ RESETS ═══════ */
* { box-sizing: border-box; margin: 0; padding: 0; outline: none; }
body {
    background: var(--bg); color: var(--ink);
    font-family: var(--ff-main); font-size: 14px; line-height: 1.5;
    -webkit-font-smoothing: antialiased; overflow-x: hidden; min-height: 100dvh;
}
a { text-decoration: none; color: inherit; }
ul { list-style: none; }
img { display: block; max-width: 100%; }

/* ═══════ LOADER ═══════ */
.loader {
    position: fixed; inset: 0; background: var(--ink); z-index: 9999;
    display: flex; align-items: center; justify-content: center;
}
.loader span {
    font-family: var(--ff-mono); font-size: 10px; text-transform: uppercase;
    letter-spacing: .2em; color: rgba(var(--rgb-t),.3);
}

/* ═══════ CONTAINER ═══════ */
.wrap { max-width: 1280px; margin: 0 auto; padding: 0 20px; }

/* ═══════ HERO ═══════ */
.hero { padding: 60px 0 0; position: relative; overflow: hidden; }

.hero-bg-text {
    position: absolute; top: -20px; left: -10px;
    font-family: var(--ff-fun); font-size: min(28vw, 320px);
    color: transparent; -webkit-text-stroke: 1px rgba(var(--rgb-d),.04);
    white-space: nowrap; pointer-events: none; z-index: 0;
    line-height: .85; -webkit-user-select: none; user-select: none;
}

.hero-inner { position: relative; z-index: 2; }

.hero-label {
    font-family: var(--ff-mono); font-size: 10px; text-transform: uppercase;
    letter-spacing: .2em; color: var(--ghost); margin-bottom: 16px;
    display: flex; align-items: center; gap: 8px;
}
.hero-label::before { content: ''; width: 24px; height: 1px; background: var(--mist); }

.hero-title {
    font-size: clamp(42px, 10vw, 80px); font-weight: 800;
    letter-spacing: -.05em; line-height: .88; margin-bottom: 16px;
}
.hero-title .thin { font-weight: 300; color: var(--smoke); }

.hero-desc {
    font-size: 16px; color: var(--smoke); max-width: 480px;
    line-height: 1.6; margin-bottom: 32px;
}

/* ═══════ STATS STRIP ═══════ */
.stats-strip {
    display: flex; gap: 40px; padding: 24px 0;
    border-top: 1px solid var(--border); border-bottom: 1px solid var(--border);
    margin-bottom: 40px;
}
.stat { display: flex; flex-direction: column; }
.stat-num {
    font-family: var(--ff-mono); font-size: 28px; font-weight: 700;
    letter-spacing: -.03em; line-height: 1;
}
.stat-label {
    font-family: var(--ff-mono); font-size: 10px; text-transform: uppercase;
    letter-spacing: .1em; color: var(--ghost); margin-top: 4px;
}

/* ═══════ TAB SYSTEM ═══════ */
.tabs {
    display: flex; gap: 0; margin-bottom: 40px;
    border-bottom: 1px solid var(--border);
}
.tab {
    font-family: var(--ff-mono); font-size: 11px; text-transform: uppercase;
    letter-spacing: .1em; padding: 14px 24px; cursor: pointer;
    color: var(--ghost); border-bottom: 2px solid transparent;
    transition: all .3s var(--ease); background: none;
    border-top: 0; border-left: 0; border-right: 0;
}
.tab:hover { color: var(--ink); }
.tab.active { color: var(--ink); border-bottom-color: var(--ink); }
.tab .tab-count {
    display: inline-flex; align-items: center; justify-content: center;
    min-width: 20px; height: 18px; padding: 0 6px; border-radius: 100px;
    font-size: 9px; font-weight: 700; margin-left: 8px;
    background: rgba(var(--rgb-d),.06);
}
.tab.active .tab-count { background: var(--ink); color: #fff; }

/* ═══════ SEARCH BAR ═══════ */
.search-bar {
    display: flex; gap: 12px; margin-bottom: 48px; align-items: center;
}
.search-input {
    flex: 1; height: 48px; padding: 0 20px;
    border: 1px solid var(--border); border-radius: var(--pill);
    font-family: var(--ff-main); font-size: 14px; color: var(--ink);
    background: var(--card); transition: all .3s var(--ease);
}
.search-input::placeholder { color: var(--mist); }
.search-input:focus { border-color: var(--ink); background: #fff; box-shadow: 0 0 0 3px rgba(var(--rgb-d),.04); }

.btn-create {
    height: 48px; padding: 0 28px; border: none; border-radius: var(--pill);
    background: var(--ink); color: #fff; font-family: var(--ff-mono);
    font-size: 11px; text-transform: uppercase; letter-spacing: .08em;
    cursor: pointer; transition: all .3s var(--ease); display: flex;
    align-items: center; gap: 8px; white-space: nowrap;
}
.btn-create:hover {
    background: #000; transform: translateY(-1px);
    box-shadow: 0 8px 24px rgba(var(--rgb-d),.15);
}

/* ═══════ FEATURED CARD ═══════ */
.featured {
    display: grid; grid-template-columns: 1fr; gap: 0;
    margin-bottom: 56px; border-radius: var(--r-lg); overflow: hidden;
    border: 1px solid var(--border); position: relative;
    cursor: pointer; transition: all .5s var(--ease);
}
.featured:hover {
    box-shadow: 0 32px 80px -20px rgba(var(--rgb-d),.1);
    transform: translateY(-3px);
}

.featured-cover { height: 280px; overflow: hidden; position: relative; }
.featured-cover img {
    width: 100%; height: 100%; object-fit: cover;
    filter: grayscale(100%); transition: filter .6s var(--ease), transform .6s var(--ease);
}
.featured:hover .featured-cover img { filter: grayscale(0%); transform: scale(1.03); }

.featured-cover::after {
    content: ''; position: absolute; inset: 0;
    background: linear-gradient(to bottom, transparent 30%, rgba(var(--rgb-d),.7) 100%);
}

.featured-badge {
    position: absolute; top: 20px; left: 20px; z-index: 3;
    font-family: var(--ff-mono); font-size: 9px; text-transform: uppercase;
    letter-spacing: .15em; background: var(--primary); color: #fff;
    padding: 5px 14px; border-radius: var(--pill);
}

.featured-overlay {
    position: absolute; bottom: 0; left: 0; right: 0;
    padding: 32px; z-index: 3;
}

.featured-type {
    font-family: var(--ff-mono); font-size: 10px; text-transform: uppercase;
    letter-spacing: .15em; color: rgba(var(--rgb-t),.6); margin-bottom: 8px;
}

.featured-name {
    font-size: clamp(28px, 5vw, 42px); font-weight: 800; color: #fff;
    letter-spacing: -.03em; line-height: .95; margin-bottom: 10px;
}

.featured-desc {
    font-size: 14px; color: rgba(var(--rgb-t),.7); max-width: 500px;
    margin-bottom: 16px; line-height: 1.5;
}

.featured-meta { display: flex; align-items: center; gap: 16px; }

.featured-avatars { display: flex; }
.featured-avatars .av {
    width: 28px; height: 28px; border-radius: 50%;
    border: 2px solid rgba(var(--rgb-d),.8); margin-right: -8px; overflow: hidden;
}
.featured-avatars .av img {
    width: 100%; height: 100%; object-fit: cover; filter: grayscale(100%);
}
.featured:hover .featured-avatars .av img { filter: grayscale(0%); transition: filter .4s; }

.featured-stat {
    font-family: var(--ff-mono); font-size: 11px; color: rgba(var(--rgb-t),.5);
    display: flex; align-items: center; gap: 4px;
}
.featured-stat i { font-size: 13px; }

/* ═══════ GRID ═══════ */
.grid { display: grid; grid-template-columns: 1fr; gap: 20px; margin-bottom: 80px; }
@media(min-width:640px) { .grid { grid-template-columns: repeat(2, 1fr); } }
@media(min-width:1024px) { .grid { grid-template-columns: repeat(3, 1fr); } }

/* ═══════ CARD ═══════ */
.card {
    position: relative; border: 1px solid var(--border);
    border-radius: var(--r-lg); overflow: hidden;
    cursor: pointer; transition: all .4s var(--ease); background: #fff;
}
.card:hover {
    border-color: var(--border-hover);
    box-shadow: 0 20px 60px -16px rgba(var(--rgb-d),.08);
    transform: translateY(-4px);
}

.card-index {
    position: absolute; top: 12px; right: 16px; z-index: 4;
    font-family: var(--ff-mono); font-size: 48px; font-weight: 700;
    color: rgba(var(--rgb-t),.12); line-height: 1; pointer-events: none;
    transition: color .3s;
}
.card:hover .card-index { color: rgba(var(--rgb-t),.25); }

.card-cover { height: 180px; overflow: hidden; position: relative; }
.card-cover img {
    width: 100%; height: 100%; object-fit: cover;
    filter: grayscale(100%); transition: all .5s var(--ease);
}
.card:hover .card-cover img { filter: grayscale(0%); transform: scale(1.05); }

.card-cover::after {
    content: ''; position: absolute; inset: 0;
    background: linear-gradient(to bottom, transparent 40%, rgba(var(--rgb-d),.6) 100%);
}

/* Type pill on cover */
.card-type {
    position: absolute; top: 14px; left: 14px; z-index: 3;
    font-family: var(--ff-mono); font-size: 9px; text-transform: uppercase;
    letter-spacing: .12em; padding: 4px 12px; border-radius: var(--pill);
    -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
}
.card-type.comuna {
    background: rgba(var(--rgb-t),.15); color: #fff;
    border: 1px solid rgba(var(--rgb-t),.2);
}
.card-type.nucleo {
    background: rgba(var(--rgb-t),.9); color: var(--ink);
    border: 1px solid rgba(var(--rgb-t),.3);
}

/* Live indicator */
.card-live {
    position: absolute; top: 14px; right: 14px; z-index: 3;
    display: flex; align-items: center; gap: 5px;
    font-family: var(--ff-mono); font-size: 9px; color: rgba(var(--rgb-t),.7);
}
.card-live .dot { width: 6px; height: 6px; border-radius: 50%; background: #4ade80; }
.card-live .dot.pulse { animation: livePulse 2s ease-in-out infinite; }

@keyframes livePulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(74,222,128,.5); }
    50% { box-shadow: 0 0 0 4px rgba(74,222,128,0); }
}

/* Card body */
.card-body { padding: 20px; }

.card-name {
    font-size: 18px; font-weight: 700; letter-spacing: -.02em;
    margin-bottom: 4px; line-height: 1.15;
}

.card-desc {
    font-size: 12px; color: var(--smoke); line-height: 1.5;
    margin-bottom: 16px;
    display: -webkit-box; -webkit-line-clamp: 2;
    -webkit-box-orient: vertical; overflow: hidden;
}

.card-footer {
    display: flex; align-items: center; justify-content: space-between;
    padding-top: 14px; border-top: 1px solid var(--border);
}

.card-avatars { display: flex; align-items: center; }
.card-avatars .av {
    width: 24px; height: 24px; border-radius: 50%; border: 2px solid #fff;
    margin-right: -6px; overflow: hidden; background: #eee;
}
.card-avatars .av img {
    width: 100%; height: 100%; object-fit: cover;
    filter: grayscale(100%); transition: filter .3s;
}
.card:hover .card-avatars .av img { filter: grayscale(0%); }

.card-avatars .av-more {
    width: 24px; height: 24px; border-radius: 50%; border: 2px solid #fff;
    margin-right: -6px; background: var(--ink); color: #fff;
    font-family: var(--ff-mono); font-size: 8px; font-weight: 700;
    display: flex; align-items: center; justify-content: center;
}

.card-members {
    font-family: var(--ff-mono); font-size: 10px; color: var(--ghost);
    display: flex; align-items: center; gap: 4px;
}
.card-members i { font-size: 12px; }

/* ═══════ TRENDING STRIP ═══════ */
.trending-section { margin-bottom: 56px; }
.section-label {
    font-family: var(--ff-mono); font-size: 10px; text-transform: uppercase;
    letter-spacing: .15em; color: var(--ghost); margin-bottom: 16px;
    display: flex; align-items: center; gap: 8px;
}
.section-label i { color: var(--primary); font-size: 14px; }

.trending-scroll {
    display: flex; gap: 14px; overflow-x: auto; padding-bottom: 12px;
    scrollbar-width: none; -webkit-overflow-scrolling: touch;
}
.trending-scroll::-webkit-scrollbar { display: none; }

.trending-chip {
    flex-shrink: 0; display: flex; align-items: center; gap: 10px;
    padding: 12px 18px; border: 1px solid var(--border); border-radius: var(--r);
    background: #fff; cursor: pointer; transition: all .3s var(--ease);
    min-width: 200px;
}
.trending-chip:hover {
    border-color: var(--ink); transform: translateY(-2px);
    box-shadow: 0 8px 20px -8px rgba(var(--rgb-d),.08);
}

.trending-chip-icon {
    width: 40px; height: 40px; border-radius: 12px; overflow: hidden;
    flex-shrink: 0; background: #eee;
}
.trending-chip-icon img {
    width: 100%; height: 100%; object-fit: cover;
    filter: grayscale(100%); transition: filter .3s;
}
.trending-chip:hover .trending-chip-icon img { filter: grayscale(0%); }

.trending-chip-info { display: flex; flex-direction: column; min-width: 0; }
.trending-chip-name {
    font-size: 13px; font-weight: 600;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.trending-chip-meta {
    font-family: var(--ff-mono); font-size: 9px; color: var(--ghost);
    text-transform: uppercase; letter-spacing: .05em;
}

/* ═══════ CREATE CTA ═══════ */
.create-cta {
    text-align: center; padding: 60px 20px;
    border: 1px dashed var(--border); border-radius: var(--r-lg);
    margin-bottom: 80px; cursor: pointer; transition: all .3s var(--ease);
}
.create-cta:hover { border-color: var(--ink); background: var(--card); }
.create-cta i { font-size: 32px; color: var(--mist); margin-bottom: 12px; display: block; }
.create-cta h3 { font-size: 16px; font-weight: 600; margin-bottom: 4px; }
.create-cta p { font-family: var(--ff-mono); font-size: 11px; color: var(--ghost); }

/* ═══════ GSAP ═══════ */
.g-fade { opacity: 0; transform: translateY(30px); }

/* ═══════ RESPONSIVE ═══════ */
@media (max-width: 640px) {
    .stats-strip { gap: 24px; flex-wrap: wrap; }
    .stat-num { font-size: 22px; }
    .search-bar { flex-direction: column; }
    .btn-create { width: 100%; justify-content: center; }
    .featured-cover { height: 200px; }
    .featured-overlay { padding: 20px; }
    .featured-name { font-size: 24px; }
}

@media (min-width: 1024px) {
    .hero { padding-top: 100px; }
}

/* ═══════ BOTTOM SPACE ═══════ */
.bottom-space { height: 120px; }
