/* ==========================================================================
   home.css - Página de inicio
   ========================================================================== */

/* ---------- Hero ---------- */
.hero {
    position: relative;
    background: var(--hero-glow), var(--bg);
    border-bottom: 1px solid var(--line);
    overflow: hidden;
}

/* Trama de "fibra de carbono" hecha con CSS (sin imágenes de terceros) */
.hero::before {
    content: '';
    position: absolute;
    inset: 0;
    background-image:
        linear-gradient(45deg, rgba(255,255,255,0.03) 25%, transparent 25%, transparent 75%, rgba(255,255,255,0.03) 75%),
        linear-gradient(45deg, rgba(255,255,255,0.03) 25%, transparent 25%, transparent 75%, rgba(255,255,255,0.03) 75%);
    background-size: 14px 14px;
    background-position: 0 0, 7px 7px;
    -webkit-mask-image: linear-gradient(180deg, #000, transparent 85%);
    mask-image: linear-gradient(180deg, #000, transparent 85%);
    pointer-events: none;
}
[data-theme="light"] .hero::before { opacity: 0.35; filter: invert(1); }

.hero-grid {
    position: relative;
    display: grid;
    grid-template-columns: 1.1fr 0.9fr;
    gap: clamp(28px, 5vw, 64px);
    align-items: center;
    padding-block: clamp(36px, 7vw, 88px);
}

.hero h1 {
    margin: 0 0 16px;
    font-size: clamp(2.2rem, 5.6vw, 4.2rem);
    line-height: 1.04;
    letter-spacing: -0.03em;
    font-weight: 800;
}
.hero-accent {
    background: linear-gradient(90deg, var(--brand-strong), var(--gold));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}
.hero-lead { margin: 0 0 28px; font-size: clamp(1rem, 1.6vw, 1.2rem); color: var(--text-dim); max-width: 52ch; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; }

/* ---------- Tarjeta próxima sesión ---------- */
.next-card {
    background: color-mix(in srgb, var(--bg-card) 92%, transparent);
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    padding: clamp(20px, 3vw, 30px);
    box-shadow: var(--shadow);
    position: relative;
}
.next-card::before {
    content: '';
    position: absolute;
    left: 0; top: 24px; bottom: 24px;
    width: 4px;
    border-radius: 0 4px 4px 0;
    background: var(--brand);
}
.next-label {
    margin: 0 0 8px;
    display: flex; align-items: center; gap: 8px;
    font-size: 0.78rem; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase;
    color: var(--text-dim);
}
.pulse {
    width: 9px; height: 9px; border-radius: 50%;
    background: var(--brand);
    box-shadow: 0 0 0 0 rgba(225, 6, 0, 0.6);
    animation: pulse 1.8s infinite;
}
@keyframes pulse { 70% { box-shadow: 0 0 0 10px rgba(225, 6, 0, 0); } 100% { box-shadow: 0 0 0 0 rgba(225, 6, 0, 0); } }

.next-title { margin: 0; font-size: clamp(1.25rem, 2.4vw, 1.6rem); line-height: 1.2; }
.next-title.skeleton { width: 70%; height: 1.6em; }
.next-sub { margin: 4px 0 18px; color: var(--text-dim); font-size: 0.95rem; }

.next-count {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
    margin-bottom: 18px;
}
.next-count > div {
    background: var(--bg-elev);
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    padding: 12px 4px 8px;
    text-align: center;
}
.next-count span {
    display: block;
    font-size: clamp(1.5rem, 3.4vw, 2.2rem);
    font-weight: 800;
    line-height: 1.1;
    font-variant-numeric: tabular-nums;
}
.next-count small { color: var(--text-faint); font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.08em; }
.next-count.is-done { grid-template-columns: 1fr; }
.next-count.is-done div { padding: 16px; font-weight: 700; }

.next-schedule { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; font-size: 0.88rem; }
.next-schedule li {
    display: flex; justify-content: space-between; gap: 12px;
    padding: 7px 10px; border-radius: 6px; color: var(--text-dim);
}
.next-schedule li.is-next { background: var(--brand-soft); color: var(--text); font-weight: 600; }
.next-schedule li.is-past { opacity: 0.5; text-decoration: line-through; }
.next-schedule time { white-space: nowrap; }
.next-tz { margin: 12px 0 0; font-size: 0.75rem; color: var(--text-faint); }

/* ---------- Noticias ---------- */
.news-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 18px; }
.news-item {
    display: flex; flex-direction: column; gap: 10px;
    text-decoration: none;
    background: var(--bg-card); border: 1px solid var(--line); border-radius: var(--radius);
    padding: 20px;
    transition: transform 0.2s var(--ease), border-color 0.2s;
}
.news-item:hover { transform: translateY(-3px); border-color: var(--brand); }
.news-item h3 { margin: 0; font-size: 1.05rem; line-height: 1.35; }
.news-item p { margin: 0; color: var(--text-dim); font-size: 0.9rem; }
.news-item .news-meta { margin-top: auto; font-size: 0.76rem; color: var(--text-faint); }

/* ---------- Tiles ---------- */
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 18px; }
.tile {
    display: block; text-decoration: none;
    background: var(--bg-card); border: 1px solid var(--line); border-radius: var(--radius);
    padding: 24px;
    transition: transform 0.2s var(--ease), border-color 0.2s, background 0.2s;
}
.tile:hover { transform: translateY(-4px); border-color: var(--brand); background: var(--bg-card-hover); }
.tile-icon { font-size: 1.8rem; display: block; margin-bottom: 12px; }
.tile h3 { margin: 0 0 6px; font-size: 1.15rem; }
.tile p { margin: 0; color: var(--text-dim); font-size: 0.92rem; }

/* ---------- Historia viva ---------- */
.hist-controls { display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; margin-bottom: 8px; }
.hist-controls .chips { margin: 0; }
.hist-order { padding: 9px 16px; font-size: 0.85rem; }
.hist-intro { margin: 10px 0 28px; color: var(--text-dim); max-width: 74ch; min-height: 1.6em; }

/* Tarjetas "ahora": un día como hoy + temporada en curso */
.ahora { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 16px; margin-bottom: 30px; }
.ahora-card {
    position: relative; display: flex; flex-direction: column; gap: 6px;
    background: var(--hero-glow), var(--bg-card);
    border: 1px solid var(--line); border-left: 4px solid var(--brand);
    border-radius: var(--radius); padding: 20px 22px;
}
.ahora-card .eyebrow { margin: 0; }
.ahora-card h3 { margin: 2px 0 0; font-size: 1.15rem; line-height: 1.3; }
.ahora-card p { margin: 0; color: var(--text-dim); font-size: 0.93rem; }
.ahora-card .link-btn {
    align-self: flex-start; margin-top: 8px; appearance: none; background: none; border: 0; padding: 0; cursor: pointer;
    color: var(--brand-strong); font: 600 0.9rem var(--font);
}
.ahora-card .link-btn:hover { text-decoration: underline; }

/* Línea vertical */
.hist {
    --line-x: 50%;
    list-style: none; margin: 0; padding: 0; position: relative;
}
.hist::before {
    content: ''; position: absolute; top: 0; bottom: 0; left: var(--line-x); width: 3px; transform: translateX(-50%);
    background: linear-gradient(180deg, var(--brand), var(--line) 12%, var(--line) 88%, transparent);
    border-radius: 3px;
}

.hist-item {
    position: relative; width: 50%; padding: 0 38px 30px 0;
    opacity: 0; transform: translateY(18px);
    transition: opacity 0.5s var(--ease), transform 0.5s var(--ease);
}
.hist-item.is-in { opacity: 1; transform: none; }
.hist-item:nth-child(even) { margin-left: 50%; padding: 0 0 30px 38px; }

/* Punto sobre la línea */
.hist-item::before {
    content: ''; position: absolute; top: 24px; right: -9px; width: 18px; height: 18px; border-radius: 50%;
    background: var(--bg); border: 4px solid var(--c, var(--brand)); box-shadow: 0 0 0 4px var(--bg-elev);
}
.hist-item:nth-child(even)::before { right: auto; left: -9px; }

.hist-card {
    background: var(--bg-card); border: 1px solid var(--line); border-top: 3px solid var(--c, var(--brand));
    border-radius: var(--radius); padding: 20px 22px;
    transition: border-color 0.2s, transform 0.2s var(--ease);
}
.hist-card:hover { transform: translateY(-3px); }
.hist-item.is-target .hist-card { border-color: var(--c, var(--brand)); box-shadow: 0 0 0 3px color-mix(in srgb, var(--c, var(--brand)) 35%, transparent); }

.hist-top { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-bottom: 6px; }
.hist-year { font-size: 2rem; font-weight: 800; line-height: 1; letter-spacing: -0.02em; color: var(--c, var(--brand-strong)); }
.hist-badges { display: flex; gap: 6px; flex-wrap: wrap; }
.hist-badge {
    font-size: 0.68rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase;
    padding: 3px 9px; border-radius: 999px;
    color: var(--c, var(--brand-strong)); background: color-mix(in srgb, var(--c, var(--brand)) 14%, transparent);
}
.hist-badge--auto { color: var(--text-dim); background: var(--bg-elev); border: 1px dashed var(--line); }
.hist-date { margin: 0 0 4px; font-size: 0.8rem; color: var(--text-faint); }
.hist-card h3 { margin: 0 0 8px; font-size: 1.12rem; line-height: 1.3; }
.hist-card p { margin: 0; color: var(--text-dim); font-size: 0.94rem; line-height: 1.65; }
.hist-cambio {
    margin-top: 14px; padding: 12px 14px; border-radius: var(--radius-sm);
    background: color-mix(in srgb, var(--c, var(--brand)) 9%, var(--bg-elev)); border-left: 3px solid var(--c, var(--brand));
}
.hist-cambio strong { display: block; font-size: 0.74rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--c, var(--brand-strong)); margin-bottom: 4px; }
.hist-cambio span { color: var(--text); font-size: 0.9rem; line-height: 1.6; }

/* Colores por categoría */
.cat-hito { --c: var(--gold); }
.cat-seguridad { --c: var(--ok); }
.cat-tecnica { --c: #4da3ff; }
.cat-campeonato { --c: var(--brand-strong); }
[data-theme="light"] .cat-tecnica { --c: #1766c9; }

.hist-more { text-align: center; margin-top: 8px; }
.hist-note { margin-top: 28px; }
.hist-loading { list-style: none; }

@media (max-width: 760px) {
    .hist { --line-x: 14px; }
    .hist-item, .hist-item:nth-child(even) { width: 100%; margin-left: 0; padding: 0 0 24px 40px; }
    .hist-item::before, .hist-item:nth-child(even)::before { left: 5px; right: auto; top: 22px; }
    .hist-controls { flex-direction: column; align-items: stretch; }
    .hist-order { width: 100%; }
}
@media (prefers-reduced-motion: reduce) {
    .hist-item { opacity: 1; transform: none; }
}

/* ---------- CTA ---------- */
.cta {
    display: flex; align-items: center; justify-content: space-between; gap: 24px; flex-wrap: wrap;
    background: var(--hero-glow), var(--bg-card);
    padding: clamp(24px, 4vw, 44px);
}
.cta h2 { margin: 0 0 8px; font-size: clamp(1.4rem, 3vw, 2rem); }
.cta p { margin: 0; color: var(--text-dim); }
.cta-actions { display: flex; gap: 12px; flex-wrap: wrap; }

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
    .hero-grid { grid-template-columns: 1fr; }
}
@media (max-width: 520px) {
    .standings th, .standings td { padding: 10px 10px; }
    .hero-actions .btn { flex: 1 1 100%; }
}

/* ---------- Podio ---------- */
.podium { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.podium-item {
    display: flex; flex-direction: column; gap: 4px;
    background: var(--bg-card); border: 1px solid var(--line); border-radius: var(--radius);
    padding: 20px; position: relative; overflow: hidden;
}
.podium-item::after { content: ''; position: absolute; left: 0; right: 0; top: 0; height: 4px; background: var(--text-faint); }
.podium-1::after { background: var(--gold); }
.podium-2::after { background: #b8bcc8; }
.podium-3::after { background: #c27b3d; }
.podium-pos { font-size: 2.4rem; font-weight: 800; line-height: 1; color: var(--text-dim); }
.podium-1 .podium-pos { color: var(--gold); }
.podium-item strong { font-size: 1.1rem; }
.podium-item span:not(.podium-pos), .podium-item small { color: var(--text-dim); font-size: 0.88rem; }
@media (max-width: 700px) { .podium { grid-template-columns: 1fr; } .podium-item { flex-direction: row; align-items: center; gap: 12px; flex-wrap: wrap; } }
