/* ============================================================================
   meta.css — Meta page (#02) page-specific styles.
   Composed from components.css; only genuinely irreducible page styles live here.
   Mobile-first (min-width). Zero new hardcoded hex except rgba transparency noted.
   See documents/designs/wireframes/02-Meta.md + Design-System.md.
============================================================================ */

/* ── Page wrapper ─────────────────────────────────────────── */
.meta-page {
    --meta-page-x-padding: var(--space-4);

    width: 100%;
    max-width: calc(var(--page-max-width) + (2 * var(--meta-page-x-padding)));
    margin: 0 auto;
    padding: var(--space-6) var(--meta-page-x-padding) var(--space-16);
}

/* ── Header ───────────────────────────────────────────────── */
.meta-hero {
    margin-bottom: var(--space-8);
}

/* Material Symbols heredan el font-size del contenedor; los fijamos a 1.1em
   para que acompañen al texto en cada chip/label de la página. */
.stat-pill .material-symbols-outlined,
.wr-badge .material-symbols-outlined,
.trend-badge .material-symbols-outlined,
.detail-section__label .material-symbols-outlined,
.community-link .material-symbols-outlined {
    font-size: 1.1em;
    line-height: 1;
}

.meta-hero__title {
    font-size: var(--font-size-3xl);
    font-weight: 800;
    line-height: var(--line-tight);
    margin-bottom: var(--space-2);
    color: var(--text);
}

.meta-hero__sub {
    font-size: var(--font-size-base);
    color: var(--text-muted);
    margin-bottom: var(--space-5);
    max-width: 52ch;
}

.meta-hero__pills {
    display: flex;
    gap: var(--space-2);
    flex-wrap: wrap;
}

/* Stat pills (summary in hero) */
.stat-pill {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-1) var(--space-3);
    border-radius: var(--radius-full);
    background: var(--surface);
    border: 1px solid var(--border);
    font-size: var(--font-size-sm);
    font-weight: 600;
    color: var(--text);
}

.stat-pill .material-symbols-outlined { color: var(--brand); }

/* Diversity pill: color-coded by meta health */
.diversity-pill--diverse   { background: var(--color-success-soft); border-color: var(--green-700); color: var(--green-300); }
.diversity-pill--balanced  { background: rgba(34, 197, 94, 0.08); border-color: var(--green-800, #166534); color: var(--green-400, #4ade80); }
.diversity-pill--moderate  { background: rgba(234, 179, 8, 0.10); border-color: rgba(234, 179, 8, 0.30); color: #facc15; }
.diversity-pill--concentrated { background: rgba(239, 68, 68, 0.10); border-color: rgba(239, 68, 68, 0.30); color: #f87171; }
.diversity-pill .material-symbols-outlined { color: inherit; }

/* ── Sticky filter bar ────────────────────────────────────── */
.meta-filters {
    position: sticky;
    top: 48px; /* mobile nav height */
    z-index: var(--z-sticky);
    /* --bg (#0f172a) at 90% — needed for backdrop-filter; can't use var() inside rgba() */
    background: rgba(15, 23, 42, 0.90);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--border);
    margin: 0 calc(-1 * var(--space-4)) var(--space-8);
    padding: var(--space-2) var(--space-4);
    display: flex;
    align-items: center;
    gap: var(--space-2);
    overflow-x: auto;
    scrollbar-width: none;
}

.meta-filters::-webkit-scrollbar { display: none; }

.meta-filters__sep {
    width: 1px;
    height: 1.2em;
    background: var(--border);
    flex-shrink: 0;
    margin: 0 var(--space-1);
    align-self: center;
}

.meta-filters__label {
    font-size: var(--font-size-xs);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-faint);
    white-space: nowrap;
    flex-shrink: 0;
    padding-right: var(--space-1);
}

/* ── Color group section ──────────────────────────────────── */
.color-group {
    margin-bottom: var(--space-12);
}

/* ── Color pip (game color dot) ───────────────────────────── */
.color-pip {
    display: inline-block;
    width: 9px;
    height: 9px;
    border-radius: var(--radius-full);
    border: 1px solid var(--border);
    flex-shrink: 0;
}

/* ── Archetype card grid ──────────────────────────────────── */
.arch-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-3);
}

/* ── Archetype card ───────────────────────────────────────── */
/*
  The 5-card fan with spread transforms is irreducible page-specific CSS:
  the home page uses a different 3-card fan (.archetype-card__fan in components.css).
*/
.arch-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    cursor: pointer;
    transition: border-color var(--transition-fast),
                box-shadow var(--transition-fast),
                transform var(--transition-fast);
    user-select: none;
    outline: none;
}

.arch-card:hover {
    border-color: var(--brand);
    box-shadow: 0 6px 24px var(--brand-ring);
    transform: translateY(-2px);
}

.arch-card:focus-visible {
    box-shadow: var(--focus-ring);
}

.arch-card.is-active {
    border-color: var(--brand);
    box-shadow: 0 0 0 2px var(--brand-ring);
}

/* Card fan area (mobile size: 54×76px cards) */
.arch-card__fan {
    position: relative;
    height: 100px;
    background: linear-gradient(180deg, var(--surface-elevated) 0%, var(--surface) 100%);
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

.fan-img {
    position: absolute;
    width: 54px;
    height: 76px;
    border-radius: var(--radius-sm);
    object-fit: cover;
    box-shadow: var(--shadow-md);
    top: 50%;
    left: 50%;
    transform-origin: bottom center;
    transition: transform var(--transition-fast);
}

/* 5-card fan spread — mobile */
.fan-img:nth-child(1) { transform: translate(calc(-50% - 46px), -58%) rotate(-14deg); z-index: 1; }
.fan-img:nth-child(2) { transform: translate(calc(-50% - 22px), -58%) rotate(-7deg);  z-index: 2; }
.fan-img:nth-child(3) { transform: translate(-50%, -58%) rotate(0deg);                z-index: 3; }
.fan-img:nth-child(4) { transform: translate(calc(-50% + 22px), -58%) rotate(7deg);   z-index: 2; }
.fan-img:nth-child(5) { transform: translate(calc(-50% + 46px), -58%) rotate(14deg);  z-index: 1; }

.arch-card:hover .fan-img:nth-child(1) { transform: translate(calc(-50% - 54px), -60%) rotate(-16deg); }
.arch-card:hover .fan-img:nth-child(2) { transform: translate(calc(-50% - 26px), -60%) rotate(-8deg); }
.arch-card:hover .fan-img:nth-child(3) { transform: translate(-50%, -62%) rotate(0deg); }
.arch-card:hover .fan-img:nth-child(4) { transform: translate(calc(-50% + 26px), -60%) rotate(8deg); }
.arch-card:hover .fan-img:nth-child(5) { transform: translate(calc(-50% + 54px), -60%) rotate(16deg); }

.fan-empty {
    width: 54px;
    height: 76px;
    border-radius: var(--radius-sm);
    background: var(--surface-elevated);
    border: 1px dashed var(--border);
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -58%);
    z-index: 3;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-faint);
    font-size: var(--font-size-xl);
}

/* Card info */
.arch-card__body {
    padding: var(--space-3) var(--space-4) var(--space-4);
}

.arch-card__name {
    font-size: var(--font-size-sm);
    font-weight: 700;
    line-height: var(--line-tight);
    margin-bottom: var(--space-1);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: var(--text);
}

.arch-card__color-row {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    margin-bottom: var(--space-3);
}

.arch-card__color-name {
    font-size: var(--font-size-xs);
    color: var(--text-muted);
    font-weight: 500;
}

.arch-card__stats {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    flex-wrap: wrap;
}

/* Win-rate badge (uses success palette, no explicit border needed) */
.wr-badge {
    display: inline-flex;
    align-items: center;
    gap: var(--space-1);
    padding: 0.18rem var(--space-2);
    border-radius: var(--radius-sm);
    font-size: var(--font-size-xs);
    font-weight: 800;
    font-variant-numeric: tabular-nums;
    background: var(--color-success-soft);
    color: var(--green-300);
    white-space: nowrap;
}

.arch-card__deck-count {
    font-size: var(--font-size-xs);
    color: var(--text-muted);
    font-weight: 500;
    font-variant-numeric: tabular-nums;
}

.arch-card__share {
    margin-left: auto;
    font-size: var(--font-size-sm);
    font-weight: 800;
    color: var(--brand);
    font-variant-numeric: tabular-nums;
}

/* Trend badges: week-over-week deck count change */
.trend-badge {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    padding: 0.15rem var(--space-1);
    border-radius: var(--radius-sm);
    font-size: var(--font-size-xs);
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}
.trend-badge--up   { background: var(--color-success-soft); color: var(--green-300); }
.trend-badge--down { background: rgba(239, 68, 68, 0.10);   color: #f87171; }
.trend-badge--new  { background: rgba(139, 92, 246, 0.12);  color: #c4b5fd; }

/* ── Archetype detail panel ───────────────────────────────── */
/*
  Grid-spanning expand panel. grid-column: 1 / -1 makes it span the full
  arch-grid row regardless of column count. Irreducible — tied to .arch-grid layout.
*/
.arch-detail {
    display: none;
    background: var(--surface-elevated);
    border: 1px solid var(--brand);
    border-radius: var(--radius-lg);
    padding: var(--space-6);
    margin-top: var(--space-2);
    grid-column: 1 / -1;
    animation: detailOpen 0.18s ease;
}

@keyframes detailOpen {
    from { opacity: 0; transform: translateY(-6px); }
    to   { opacity: 1; transform: translateY(0); }
}

.arch-detail.is-open { display: block; }

/* Detail header */
.detail-head {
    display: flex;
    flex-direction: column;
    gap: var(--space-4);
    margin-bottom: var(--space-6);
}

.detail-head__titles h3 {
    font-size: var(--font-size-xl);
    font-weight: 800;
    color: var(--text);
    margin-bottom: var(--space-1);
    line-height: var(--line-tight);
}

.detail-head__meta {
    font-size: var(--font-size-sm);
    color: var(--text-muted);
}

.detail-head__meta strong { color: var(--color-success); }

.detail-head__actions {
    display: flex;
    gap: var(--space-2);
    flex-wrap: wrap;
}

.detail-head__actions .btn--primary,
.detail-head__actions .btn--secondary { flex: 1; justify-content: center; }

/* Detail section */
.detail-section { margin-bottom: var(--space-5); }

.detail-section__label {
    font-size: var(--font-size-xs);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.09em;
    color: var(--text-muted);
    margin-bottom: var(--space-3);
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

/* Core + Synergy side-by-side grid (mobile: stacked; ≥768px: 2 columns) */
.detail-card-grid {
    display: grid;
    gap: var(--space-5);
    margin-bottom: var(--space-5);
}

.detail-card-grid .detail-section { margin-bottom: 0; }

/* Inside the grid the core row wraps instead of scrolling */
.detail-card-grid .core-row {
    flex-wrap: wrap;
    overflow-x: visible;
    padding-bottom: 0;
}

/* Core cards scrollable row (standalone, outside the grid) */
.core-row {
    display: flex;
    gap: var(--space-2);
    overflow-x: auto;
    padding-bottom: var(--space-2);
    scrollbar-width: thin;
    scrollbar-color: var(--border) transparent;
}

.core-card {
    flex-shrink: 0;
    width: 84px;
    text-decoration: none;
    color: inherit;
}

.core-card img {
    width: 84px;
    height: 118px;
    object-fit: cover;
    border-radius: var(--radius-sm);
    display: block;
    box-shadow: var(--shadow-md);
    transition: transform var(--transition-fast);
    border: 1px solid var(--border);
}

.core-card:hover img { transform: translateY(-3px) scale(1.03); }
.core-card:focus-visible img { box-shadow: var(--focus-ring); outline: none; }

.core-card__name {
    font-size: 0.62rem;
    font-weight: 600;
    margin-top: var(--space-1);
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: var(--text-muted);
}

/* Synergy / flex slot chips */
.synergy-cloud {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2);
}

.synergy-chip {
    display: inline-flex;
    align-items: center;
    gap: var(--space-1);
    padding: 0.22rem var(--space-3);
    border-radius: var(--radius-sm);
    background: var(--surface);
    border: 1px solid var(--border);
    font-size: var(--font-size-sm);
    font-weight: 600;
    text-decoration: none;
    color: var(--text-muted);
    transition: border-color var(--transition-fast), color var(--transition-fast);
    white-space: nowrap;
}

.synergy-chip:hover { border-color: var(--brand); color: var(--text); text-decoration: none; }
.synergy-chip:focus-visible { outline: none; box-shadow: var(--focus-ring); }

.synergy-pct {
    font-size: var(--font-size-xs);
    font-weight: 800;
    color: var(--brand);
    font-variant-numeric: tabular-nums;
}

/* Variation rows */
.variations-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
}

.variation-row {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-2) var(--space-3);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    transition: border-color var(--transition-fast);
}

.variation-row:hover { border-color: var(--brand); }

.variation-name {
    flex: 1;
    font-size: var(--font-size-sm);
    font-weight: 600;
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: var(--text);
}

.variation-tier {
    font-size: var(--font-size-xs);
    font-weight: 700;
    padding: 0.15rem var(--space-2);
    border-radius: var(--radius-sm);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    flex-shrink: 0;
}

.tier-budget  { background: var(--color-success-soft); color: var(--green-300); }
.tier-mid     { background: var(--brand-soft);         color: var(--brand); }
.tier-premium { background: var(--color-warning-soft); color: var(--amber-300); }

/* Community link */
.community-link {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    font-size: var(--font-size-sm);
    font-weight: 600;
    color: var(--brand);
    text-decoration: none;
    transition: opacity var(--transition-fast);
}

.community-link:hover { opacity: 0.8; color: var(--brand); text-decoration: none; }
.community-link:focus-visible { outline: none; box-shadow: var(--focus-ring); border-radius: var(--radius-sm); }

/* ── Card Momentum ────────────────────────────────────────── */
.momentum-section {
    margin-top: var(--space-10);
    margin-bottom: var(--space-4);
}

.momentum-header {
    display: flex;
    align-items: baseline;
    gap: var(--space-3);
    margin-bottom: var(--space-4);
    flex-wrap: wrap;
}

.momentum-header__title {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    font-size: var(--font-size-lg);
    font-weight: 700;
    color: var(--text);
    margin: 0;
}

.momentum-header__title .material-symbols-outlined {
    font-size: 1.2em;
    color: var(--brand);
}

.momentum-header__sub {
    font-size: var(--font-size-sm);
    color: var(--text-muted);
}

.momentum-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: var(--space-4);
}

.momentum-col__label {
    display: flex;
    align-items: center;
    gap: var(--space-1);
    font-size: var(--font-size-xs);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-bottom: var(--space-2);
}

.momentum-col__label .material-symbols-outlined { font-size: 1.1em; }
.momentum-col__label--up   { color: var(--green-300); }
.momentum-col__label--down { color: #f87171; }

.momentum-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
}

.momentum-item {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-2) var(--space-3);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
}

.momentum-item__img-link { flex-shrink: 0; line-height: 0; }

.momentum-item__img,
.momentum-item__img-placeholder {
    width: 36px;
    height: 50px;
    object-fit: cover;
    border-radius: var(--radius-sm);
    flex-shrink: 0;
}

.momentum-item__img-placeholder {
    background: var(--surface-raised);
}

.momentum-item__info {
    flex: 1;
    min-width: 0;
}

.momentum-item__name {
    display: block;
    font-size: var(--font-size-sm);
    font-weight: 600;
    color: var(--text);
    text-decoration: none;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.momentum-item__name:hover { color: var(--brand); }

.momentum-item__counts {
    font-size: var(--font-size-xs);
    color: var(--text-muted);
    font-variant-numeric: tabular-nums;
    margin-top: 2px;
}
.momentum-item__counts-label {
    display: block;
    font-size: 0.65rem;
    color: var(--text-disabled, var(--text-muted));
    opacity: 0.75;
    line-height: 1;
    margin-top: 1px;
}

.momentum-item__badge {
    flex-shrink: 0;
    font-size: var(--font-size-sm);
    font-weight: 800;
    font-variant-numeric: tabular-nums;
    padding: 0.15rem var(--space-2);
    border-radius: var(--radius-sm);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1px;
}
.momentum-item__badge-label {
    font-size: 0.6rem;
    font-weight: 500;
    opacity: 0.7;
    line-height: 1;
}

.momentum-item__badge--up   { background: var(--color-success-soft); color: var(--green-300); }
.momentum-item__badge--down { background: rgba(239, 68, 68, 0.10); color: #f87171; }

/* Patreon promo: separación del último color-group (reemplaza el inline 2rem) */
.meta-promo { margin-top: var(--space-8); }

/* ── Responsive (mobile-first breakpoints) ────────────────── */
@media (min-width: 480px) {
    .meta-hero__title { font-size: var(--font-size-4xl); }
    .detail-head__actions .btn--primary,
    .detail-head__actions .btn--secondary { flex: unset; }
}

@media (min-width: 768px) {
    .momentum-grid { grid-template-columns: 1fr 1fr; }
    .meta-filters { top: 60px; }

    /* Larger fan cards on tablet+ */
    .arch-card__fan { height: 120px; }
    .fan-img { width: 62px; height: 88px; }
    .fan-img:nth-child(1) { transform: translate(calc(-50% - 50px), -60%) rotate(-14deg); }
    .fan-img:nth-child(2) { transform: translate(calc(-50% - 24px), -60%) rotate(-7deg); }
    .fan-img:nth-child(3) { transform: translate(-50%, -60%) rotate(0deg); }
    .fan-img:nth-child(4) { transform: translate(calc(-50% + 24px), -60%) rotate(7deg); }
    .fan-img:nth-child(5) { transform: translate(calc(-50% + 50px), -60%) rotate(14deg); }
    .arch-card:hover .fan-img:nth-child(1) { transform: translate(calc(-50% - 58px), -62%) rotate(-16deg); }
    .arch-card:hover .fan-img:nth-child(2) { transform: translate(calc(-50% - 28px), -62%) rotate(-8deg); }
    .arch-card:hover .fan-img:nth-child(3) { transform: translate(-50%, -64%) rotate(0deg); }
    .arch-card:hover .fan-img:nth-child(4) { transform: translate(calc(-50% + 28px), -62%) rotate(8deg); }
    .arch-card:hover .fan-img:nth-child(5) { transform: translate(calc(-50% + 58px), -62%) rotate(16deg); }

    .arch-grid { grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: var(--space-4); }

    /* Core + Synergy side-by-side: Core auto-width (wrapping cards), Synergy fills rest */
    .detail-card-grid { grid-template-columns: auto 1fr; align-items: start; }

    /* Detail header becomes a row on tablet+ */
    .detail-head { flex-direction: row; align-items: flex-start; justify-content: space-between; }
    .detail-head__actions .btn--primary,
    .detail-head__actions .btn--secondary { flex: unset; }
}

@media (min-width: 1024px) {
    .meta-page {
        --meta-page-x-padding: var(--space-5);

        padding: var(--space-8) var(--meta-page-x-padding) var(--space-20);
    }
    .arch-grid { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
}
