/* Estilos específicos de la portada pública (templates/public/home.php).
   Se carga junto a base.css. Diseño de bandas a todo el ancho con hero
   fotográfico, inspirado en la web antigua de cronosports.com. */

html { scroll-behavior: smooth; }
.container { max-width: 1140px; margin: 0 auto; padding: 0 1.25rem; }
section[id] { scroll-margin-top: 96px; }


/* ── Cabecera pegajosa ── */
.header {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 50;
    transition: box-shadow .2s;
}
.header.scrolled { box-shadow: 0 2px 14px rgba(0,0,0,.1); }
.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding-top: 0.625rem;
    padding-bottom: 0.625rem;
    /* La cabecera aprovecha más ancho que el resto de secciones (que usan
       .container, tope 1140px) — así el logo queda más a la izquierda y las
       banderas + el acceso de organizadores más a la derecha, dejando sitio
       de sobra para que el nav quepa en una sola fila. */
    max-width: 1600px;
    padding-left: 2rem;
    padding-right: 2rem;
}
.header .brand { flex-shrink: 0; }
.main-nav { display: flex; gap: 1.75rem; flex-wrap: wrap; justify-content: center; }
.main-nav a {
    color: var(--text);
    text-decoration: none;
    font-size: 0.9375rem;
    font-weight: 600;
    transition: color .15s;
}
.main-nav a:hover { color: var(--brand); }
.lang-switcher { display: flex; gap: 0.5rem; }
.lang-switcher a {
    display: block;
    line-height: 0;
    opacity: 0.45;
    border-radius: 3px;
    overflow: hidden;
    box-shadow: 0 0 0 1px var(--border);
    transition: opacity .15s;
}
.lang-switcher a:hover,
.lang-switcher a.active { opacity: 1; }
.lang-switcher svg { display: block; width: 28px; height: auto; }

/* ── Acceso de organizadores: icono discreto, junto al selector de idioma ── */
.organizer-login-link {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    flex-shrink: 0;
    border-radius: 50%;
    color: var(--muted);
    border: 1px solid var(--border);
    transition: color .15s, border-color .15s, background .15s;
}
.organizer-login-link:hover {
    color: var(--brand);
    border-color: var(--brand);
    background: #f0faf5;
}
.organizer-login-link svg { width: 17px; height: 17px; }

/* ── Hero fotográfico a pantalla completa ── */
.hero {
    position: relative;
    height: max(540px, calc(100svh - 150px));
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}
.hero-slide {
    position: absolute;
    inset: 0;
    background-size: cover;
    background-position: center;
    opacity: 0;
    transition: opacity 1.4s ease;
    transform: scale(1.04);
}
.hero-slide.active { opacity: 1; }
.hero::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, rgba(9, 26, 19, 0.62), rgba(9, 26, 19, 0.38));
}
.hero-content {
    position: relative;
    z-index: 1;
    text-align: center;
    color: #fff;
    padding: 0 1.25rem;
    max-width: 820px;
}
.hero-content h1 {
    font-size: clamp(2.1rem, 5vw, 3.4rem);
    font-weight: 800;
    letter-spacing: -0.02em;
    margin-bottom: 1rem;
    text-shadow: 0 2px 18px rgba(0,0,0,.4);
}
.hero-content p {
    font-size: clamp(1rem, 2vw, 1.25rem);
    opacity: 0.94;
    max-width: 640px;
    margin: 0 auto 1.75rem;
    text-shadow: 0 1px 10px rgba(0,0,0,.45);
    transition: opacity .3s ease;
}
.hero-content p.fading { opacity: 0; }
@media (prefers-reduced-motion: reduce) {
    .hero-content p { transition: none; }
}
.hero-cta { display: flex; gap: 0.875rem; justify-content: center; flex-wrap: wrap; }
.btn-hero {
    display: inline-block;
    background: var(--brand);
    color: #fff;
    text-decoration: none;
    font-weight: 700;
    font-size: 1rem;
    padding: 0.8rem 1.75rem;
    border-radius: 999px;
    transition: background .15s, transform .15s;
}
.btn-hero:hover { background: var(--brand-dk); transform: translateY(-2px); }

/* ── Bandas ── */
/* Borde superior en todas las bandas: marca el límite entre secciones sin
   depender de que alternen bien blanco/gris (la de Resultados es condicional
   — si no hay carreras finalizadas, dos bandas del mismo color pueden quedar
   seguidas, y así se ven igualmente separadas). */
.band { padding: 4.25rem 0; border-top: 1px solid var(--border); }
.band-gray { background: #eef2f0; }
.section-title {
    text-align: center;
    font-size: clamp(1.5rem, 3vw, 1.9rem);
    font-weight: 800;
    letter-spacing: -0.01em;
    margin-bottom: 2rem;
    position: relative;
    padding-bottom: 0.875rem;
}
.section-title::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 56px;
    height: 4px;
    border-radius: 2px;
    background: var(--brand);
}
.section-title-left { text-align: left; }
.section-title-left::after { left: 0; transform: none; }
.section-intro {
    color: var(--muted);
    text-align: center;
    max-width: 640px;
    margin: -1.25rem auto 2rem;
}

/* ── Resultados antiguos (más de 12 meses): lista compacta, sin póster ── */
.resultados-antiguos-titulo {
    font-size: 1.05rem;
    font-weight: 600;
    text-align: center;
    margin: 2.5rem 0 1rem;
    color: var(--text);
}
.resultados-antiguos-list {
    list-style: none;
    max-width: 640px;
    margin: 0 auto;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}
.resultados-antiguos-list li {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 1rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 0.65rem 1rem;
}
.resultados-antiguos-list a {
    color: var(--text);
    text-decoration: none;
    font-weight: 500;
}
.resultados-antiguos-list a:hover { color: var(--brand); text-decoration: underline; }
.resultados-antiguos-fecha {
    color: var(--muted);
    font-size: 0.85rem;
    white-space: nowrap;
}

/* ── Carreras abiertas ── */
.races {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    justify-content: center;
    gap: 1.5rem;
}
.race-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 14px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transition: transform .2s, box-shadow .2s;
}
.race-card:hover { transform: translateY(-4px); box-shadow: 0 12px 28px rgba(0,0,0,.12); }
.race-poster-frame {
    position: relative;
    width: 100%;
    height: 280px;
    overflow: hidden;
    background: var(--bg);
}
.race-poster-bg {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    filter: blur(18px) brightness(0.92);
    /* Ligeramente ampliado para que el desenfoque no deje bordes claros */
    transform: scale(1.15);
}
.race-poster {
    position: relative;
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
}
.race-poster-placeholder {
    width: 100%;
    height: 280px;
    background: linear-gradient(135deg, var(--brand), var(--brand-dk));
    display: flex;
    align-items: center;
    justify-content: center;
}
.race-poster-placeholder svg { width: 42px; height: 42px; opacity: 0.85; }
.race-body {
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    flex: 1;
}
.race-card h3 { font-size: 1.0625rem; font-weight: 700; }
.race-meta {
    font-size: 0.875rem;
    color: var(--muted);
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}
.race-meta span { display: flex; align-items: center; gap: 0.4rem; }
.race-card a.btn {
    margin-top: auto;
    display: inline-block;
    text-align: center;
    background: var(--brand);
    color: #fff;
    text-decoration: none;
    padding: 0.625rem;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.9375rem;
    transition: background .15s;
}
.race-card a.btn:hover { background: var(--brand-dk); }
.empty-state {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 2rem;
    text-align: center;
    color: var(--muted);
}

/* ── Servicios ── */
.services {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 1.5rem;
}
/* 9 tarjetas: en escritorio se fuerzan 3 columnas fijas (3 filas de 3,
   simétrico) en vez de dejar que auto-fill meta 4 y deje una suelta. */
@media (min-width: 900px) {
    .services { grid-template-columns: repeat(3, 1fr); }
}
.service-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 1.75rem;
    transition: transform .2s, box-shadow .2s;
}
.service-card:hover { transform: translateY(-4px); box-shadow: 0 12px 28px rgba(0,0,0,.1); }
.service-icon {
    width: 52px;
    height: 52px;
    border-radius: 12px;
    background: #ecfdf5;
    color: var(--brand);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1rem;
}
.service-icon svg { width: 28px; height: 28px; }
.service-card h3 { font-size: 1.0625rem; font-weight: 700; margin-bottom: 0.375rem; }
.service-card p { font-size: 0.9rem; color: var(--muted); line-height: 1.55; }

/* ── Banda de estadísticas sobre foto ── */
.stats-band {
    background-image: linear-gradient(rgba(9, 26, 19, 0.78), rgba(9, 26, 19, 0.78)), url('/img/slide-2.jpg');
    background-size: cover;
    background-position: center;
    background-attachment: fixed;
    padding: 4.5rem 0;
}
.stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
    gap: 2rem 1rem;
}
.stat { text-align: center; color: #fff; }
.stat-num {
    display: block;
    font-size: clamp(2rem, 4vw, 2.75rem);
    font-weight: 800;
    letter-spacing: -0.02em;
    font-variant-numeric: tabular-nums;
}
.stat-label {
    display: block;
    font-size: 0.875rem;
    opacity: 0.88;
    margin-top: 0.375rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* ── Conócenos ── */
.about-grid {
    display: grid;
    grid-template-columns: 1.1fr 0.9fr;
    gap: 3rem;
    align-items: center;
}
.about-text { line-height: 1.7; margin-bottom: 1rem; color: var(--text); }
.about-photo img,
.about-photo video {
    width: 100%;
    height: auto;
    display: block;
    border-radius: 14px;
    box-shadow: 0 16px 40px rgba(0,0,0,.18);
}

/* ── FAQ (acordeón) ── */
.faq-list {
    max-width: 760px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 0.875rem;
}
.faq-item {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    overflow: hidden;
}
.faq-question {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    text-align: left;
    background: none;
    border: none;
    cursor: pointer;
    padding: 1.125rem 1.375rem;
    font-size: 1rem;
    font-weight: 700;
    color: var(--text);
    font-family: inherit;
}
.faq-chevron {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
    color: var(--brand);
    transition: transform .25s;
}
.faq-item.open .faq-chevron { transform: rotate(180deg); }
.faq-answer {
    display: grid;
    grid-template-rows: 0fr;
    transition: grid-template-rows .25s ease;
}
.faq-item.open .faq-answer { grid-template-rows: 1fr; }
.faq-answer p {
    overflow: hidden;
    min-height: 0;
    color: var(--muted);
    line-height: 1.6;
    padding: 0 1.375rem;
}
.faq-item.open .faq-answer p { padding: 0 1.375rem 1.125rem; }

/* ── Contacto (formulario) ── */
.container-narrow { max-width: 640px; }
.contact-form {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 2rem;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}
.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.25rem;
}
.form-group { display: flex; flex-direction: column; gap: 0.4rem; }
.form-group label {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text);
}
.form-opcional { font-weight: 400; color: var(--muted); }
.form-group input,
.form-group textarea {
    border: 1px solid #d1d5db;
    border-radius: 8px;
    padding: 0.625rem 0.875rem;
    font-size: 0.9375rem;
    font-family: inherit;
    color: var(--text);
    background: var(--surface);
    outline: none;
    transition: border-color .15s;
}
.form-group input:focus,
.form-group textarea:focus { border-color: var(--brand); }
.form-group textarea { resize: vertical; }
.form-check {
    display: flex;
    align-items: flex-start;
    gap: 0.625rem;
    font-size: 0.875rem;
    color: var(--muted);
    cursor: pointer;
}
.form-check input { width: auto; margin-top: 0.2rem; }
.form-check a { color: var(--brand); }
.contact-form .btn-hero {
    align-self: flex-start;
    border: none;
    cursor: pointer;
}
/* Honeypot: invisible para una persona (fuera de pantalla), pero presente en
   el HTML para que un bot que rellena todos los campos lo delate. */
.hp-field {
    position: absolute;
    left: -9999px;
    top: -9999px;
}
.form-msg {
    padding: 0.875rem 1.125rem;
    border-radius: 10px;
    font-size: 0.9375rem;
    margin-bottom: 1.25rem;
}
.form-msg-success { background: #f0fdf4; border: 1px solid #bbf7d0; color: #15803d; }
.form-msg-error { background: #fef2f2; border: 1px solid #fecaca; color: #b91c1c; }
@media (max-width: 640px) {
    .form-row { grid-template-columns: 1fr; }
    .contact-form { padding: 1.5rem; }
}

/* ── Footer oscuro ── */
footer {
    background: #10231b;
    color: #cfe3da;
    font-size: 0.875rem;
}
.footer-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
    padding-top: 1.75rem;
    padding-bottom: 1.75rem;
}
footer nav { display: flex; gap: 1.5rem; flex-wrap: wrap; }
footer a { color: #cfe3da; text-decoration: none; }
footer a:hover { color: #fff; text-decoration: underline; }
.footer-social { display: flex; align-items: center; }
.footer-social:hover { text-decoration: none; }
.footer-social svg { width: 20px; height: 20px; display: block; color: #cfe3da; transition: color .15s; }
.footer-social:hover svg { color: #fff; }

/* ── Aparición al hacer scroll (solo con JS activo) ── */
html.js .reveal {
    opacity: 0;
    transform: translateY(18px);
    transition: opacity .6s ease, transform .6s ease;
}
html.js .reveal.visible { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    html.js .reveal { opacity: 1; transform: none; transition: none; }
    .hero-slide { transition: none; }
}

/* ── Móvil ── */
@media (max-width: 900px) {
    .header-inner { flex-wrap: wrap; padding-left: 1.25rem; padding-right: 1.25rem; }
    .main-nav { order: 3; width: 100%; gap: 1rem 1.25rem; padding: 0.25rem 0 0.375rem; }
    .about-grid { grid-template-columns: 1fr; gap: 2rem; }
    /* background-attachment: fixed rinde mal en móvil */
    .stats-band { background-attachment: scroll; }
}
@media (max-width: 640px) {
    .header .brand img { height: 44px !important; }
    .lang-switcher svg { width: 24px; }
    .hero { height: max(480px, calc(100svh - 180px)); }
    .band { padding: 3rem 0; }
}
