/* Tema "ajedrez": claro y espacioso, tipografia Fraunces + Inter.
   Paleta: marfil (casillas claras), tinta, verde tablero y dorado. */

:root {
    --bg: #f6f3ec;
    --surface: #ffffff;
    --surface-2: #efebe1;
    --ink: #1c1b18;
    --muted: #6b675e;
    --line: #e2ddd0;
    --accent: #2f5d46;
    --accent-ink: #ffffff;
    --accent-soft: #e3ece5;
    --gold: #b8892b;
    --warn: #a86400;
    --sq-light: #ece6d6;
    --sq-dark: #d9d0b9;
    --radius: 18px;
    --shadow: 0 1px 2px rgba(28, 27, 24, .04), 0 8px 24px rgba(28, 27, 24, .06);
    --wrap: 1120px;
    --serif: 'Fraunces', Georgia, 'Times New Roman', serif;
    --sans: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg: #14161a;
        --surface: #1c1f24;
        --surface-2: #181b1f;
        --ink: #ece8df;
        --muted: #9a968d;
        --line: #2b2f36;
        --accent: #7fb89a;
        --accent-ink: #0f1a14;
        --accent-soft: #1f2d26;
        --gold: #d9ae55;
        --warn: #e0a64a;
        --sq-light: #1b1e23;
        --sq-dark: #20242a;
        --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px rgba(0, 0, 0, .25);
    }
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
    margin: 0;
    background: var(--bg);
    color: var(--ink);
    font: 400 17px/1.65 var(--sans);
    -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; display: block; }
a { color: inherit; }
h1, h2, h3 { font-family: var(--serif); font-weight: 650; line-height: 1.15; margin: 0; letter-spacing: -.01em; }
h2 { font-size: clamp(1.6rem, 3vw, 2.1rem); }
h3 { font-size: 1.2rem; }
p { margin: 0; }
[hidden] { display: none !important; }

.wrap { width: 100%; max-width: var(--wrap); margin: 0 auto; padding: 0 24px; }
.narrow { max-width: 760px; }
.muted { color: var(--muted); }
.small { font-size: .88rem; }
.lead { font-size: clamp(1.05rem, 2vw, 1.2rem); color: var(--muted); max-width: 62ch; }
.eyebrow { font-size: .8rem; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; color: var(--accent); margin-bottom: 14px; }
.link { color: var(--accent); font-weight: 600; text-decoration: none; }
.link:hover { text-decoration: underline; }

/* Botones */
.actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 32px; }
.actions-end { justify-content: flex-end; margin-top: 0; align-items: center; }
.btn {
    display: inline-flex; align-items: center; justify-content: center;
    min-height: 48px; padding: 0 22px; border-radius: 999px;
    font-weight: 600; font-size: .98rem; text-decoration: none;
    border: 1.5px solid transparent; transition: transform .15s, background .15s, border-color .15s;
}
.btn:hover { transform: translateY(-1px); }
.btn-primary { background: var(--accent); color: var(--accent-ink); }
.btn-ghost { border-color: var(--line); background: var(--surface); }
.btn-ghost:hover { border-color: var(--accent); }

/* Cabecera */
.topbar { position: sticky; top: 0; z-index: 50; background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.topbar-inner { display: flex; align-items: center; justify-content: space-between; gap: 16px; height: 68px; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; }
.brand-mark { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 10px; background: var(--ink); color: var(--bg); font-size: 22px; line-height: 1; }
.brand-text { display: flex; flex-direction: column; line-height: 1.1; }
.brand-name { font-family: var(--serif); font-weight: 650; font-size: 1.15rem; }
.brand-sub { font-size: .72rem; color: var(--muted); letter-spacing: .02em; margin-top: 2px; }
.footer-sub { color: var(--muted); font-size: .9rem; margin: -4px 0 10px; }
.nav { display: flex; align-items: center; gap: 4px; }
.nav a { text-decoration: none; padding: 8px 12px; border-radius: 999px; font-size: .95rem; color: var(--muted); }
.nav a:hover { color: var(--ink); background: var(--surface-2); }
.nav .nav-cta { background: var(--accent); color: var(--accent-ink); font-weight: 600; margin-left: 6px; }
.nav .nav-cta:hover { background: var(--accent); color: var(--accent-ink); }

/* Hero con tablero de fondo */
.hero { position: relative; overflow: hidden; padding: clamp(72px, 12vw, 140px) 0 clamp(64px, 10vw, 120px); }
.board {
    position: absolute; inset: 0 -10% 0 45%;
    background: conic-gradient(var(--sq-dark) 25%, var(--sq-light) 0 50%, var(--sq-dark) 0 75%, var(--sq-light) 0) 0 0 / 96px 96px;
    mask-image: linear-gradient(90deg, transparent, #000 45%);
    -webkit-mask-image: linear-gradient(90deg, transparent, #000 45%);
    opacity: .7; transform: perspective(900px) rotateY(-18deg);
}
.hero-inner { position: relative; }
.hero h1 { font-size: clamp(2.4rem, 6vw, 4.4rem); max-width: 14ch; margin-bottom: 24px; }

/* Secciones */
.section { padding: clamp(56px, 8vw, 96px) 0; }
.section-alt { background: var(--surface-2); }
.section-tight { padding-top: 16px; padding-bottom: clamp(56px, 8vw, 96px); }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; margin-bottom: 32px; }
.split { display: grid; grid-template-columns: 1.4fr 1fr; gap: 32px; align-items: center; }
.split .lead { margin-top: 16px; }

/* Torneo destacado */
.feature {
    display: grid; grid-template-columns: 170px 1fr; gap: 36px; align-items: center;
    padding: 36px; border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow);
    text-decoration: none; border: 1px solid var(--line); transition: border-color .15s, transform .15s;
    position: relative;
}
.feature:hover { border-color: var(--accent); transform: translateY(-2px); }
.feature-date { display: flex; flex-direction: column; align-items: center; padding: 22px 0; border-radius: 14px; background: var(--accent-soft); color: var(--accent); }
.feature-day { font-family: var(--serif); font-size: 4rem; font-weight: 650; line-height: 1; margin: 4px 0; }
.feature-body h3 { font-size: clamp(1.4rem, 3vw, 1.9rem); margin: 12px 0 10px; }
.feature-body .muted { margin-bottom: 18px; }

/* Lista de torneos */
.ev-list { list-style: none; margin: 16px 0 0; padding: 0; display: grid; gap: 10px; }
.ev-card {
    position: relative; display: grid; grid-template-columns: 64px 1fr auto; gap: 20px; align-items: center;
    padding: 16px 20px; border-radius: 14px; background: var(--surface); border: 1px solid var(--line);
    text-decoration: none; transition: border-color .15s;
}
.ev-card:hover { border-color: var(--accent); }
.ev-date { display: flex; flex-direction: column; align-items: center; line-height: 1.1; }
.ev-dow, .ev-mon { font-size: .72rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.ev-day { font-family: var(--serif); font-size: 1.7rem; font-weight: 650; }
.ev-title { display: block; font-weight: 600; font-size: 1.02rem; text-decoration: none; }
/* Todo el recuadro lleva al torneo; los links internos (fuente) quedan por encima. */
.stretched { text-decoration: none; color: inherit; }
.stretched::after { content: ''; position: absolute; inset: 0; border-radius: inherit; }
.ev-card:hover .ev-title, .feature:hover h3 a { color: var(--accent); }
.ev-src { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; margin-top: 8px; font-size: .82rem; color: var(--muted); }
.feature-body .ev-src { margin: -6px 0 18px; }
.src-link { position: relative; z-index: 1; color: var(--muted); text-decoration: underline; text-underline-offset: 2px; }
.src-link:hover { color: var(--accent); }
.chip-auto { background: var(--surface-2); color: var(--muted); border: 1px solid var(--line); }
.ev-meta { display: flex; flex-wrap: wrap; gap: 4px 14px; margin-top: 4px; color: var(--muted); font-size: .9rem; }
.ev-arrow { color: var(--muted); font-size: 1.2rem; }

.chips { display: flex; gap: 8px; margin-bottom: 14px; }
.chip { display: inline-block; font-size: .75rem; font-weight: 600; letter-spacing: .04em; padding: 4px 10px; border-radius: 999px; background: var(--accent-soft); color: var(--accent); }
.chip-warn { background: color-mix(in srgb, var(--warn) 14%, transparent); color: var(--warn); }

/* Comunidad */
.community { padding: clamp(56px, 8vw, 96px) 0; background: var(--ink); color: var(--bg); }
.community .lead { color: color-mix(in srgb, var(--bg) 72%, transparent); margin-top: 16px; }
.community .eyebrow { color: var(--gold); }
.community .btn-primary { background: var(--gold); color: #1c1b18; }
.community .btn-ghost { background: transparent; border-color: color-mix(in srgb, var(--bg) 30%, transparent); color: var(--bg); }
.community .muted { color: color-mix(in srgb, var(--bg) 60%, transparent); margin-top: 16px; }
.community-inner { display: grid; grid-template-columns: 1.2fr 1fr; gap: 56px; align-items: center; }
.community-points { list-style: none; margin: 0; padding: 0; display: grid; gap: 22px; }
.community-points li { display: flex; gap: 16px; align-items: flex-start; }
.community-points strong { display: block; font-weight: 600; }
.community-points span { color: color-mix(in srgb, var(--bg) 65%, transparent); font-size: .95rem; }
.pt-icon { flex: none; display: grid; place-items: center; width: 44px; height: 44px; border-radius: 12px; background: color-mix(in srgb, var(--bg) 10%, transparent); color: var(--gold) !important; font-size: 24px !important; }

/* Noticias */
.news { display: grid; grid-template-columns: repeat(3, 1fr); gap: 28px; }
.news-card { text-decoration: none; display: flex; flex-direction: column; gap: 14px; }
.news-img { aspect-ratio: 16 / 10; border-radius: 14px; overflow: hidden; background: var(--surface-2); display: grid; place-items: center; font-size: 48px; color: var(--muted); }
.news-img img { width: 100%; height: 100%; object-fit: cover; transition: transform .3s; }
.news-card:hover img { transform: scale(1.03); }
.news-card h3 { font-size: 1.12rem; margin-top: 6px; }
.news-card:hover h3 { color: var(--accent); }

/* Paginas internas */
.page-hero { padding: clamp(56px, 8vw, 96px) 0 32px; }
.page { padding-top: clamp(40px, 6vw, 72px); padding-bottom: clamp(56px, 8vw, 96px); }
.page-title { font-size: clamp(2rem, 5vw, 3.2rem); margin-bottom: 16px; }
.back { display: inline-block; margin-bottom: 28px; color: var(--muted); text-decoration: none; }
.back:hover { color: var(--ink); }
.media { margin: 28px 0; border-radius: var(--radius); overflow: hidden; background: var(--surface-2); }
.media iframe { width: 100%; aspect-ratio: 16 / 9; border: 0; display: block; }
.media.map iframe { aspect-ratio: 4 / 3; }
.body-text { margin-top: 36px; font-size: 1.08rem; max-width: 65ch; }
.facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 28px 40px; margin: 44px 0 0; padding: 32px 0 0; border-top: 1px solid var(--line); }
.facts dt { font-size: .8rem; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); margin-bottom: 4px; }
.facts dd { margin: 0; font-weight: 500; }
.facts a { color: var(--accent); }
.note { margin-top: 40px; }

.filters { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 20px; }
.filter { font: inherit; font-size: .9rem; padding: 8px 16px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); cursor: pointer; }
.filter[aria-pressed="true"] { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.group { margin-top: 40px; }
.group-title { font-family: var(--sans); font-size: .85rem; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
.empty { padding: 40px; border-radius: var(--radius); border: 1px dashed var(--line); color: var(--muted); text-align: center; margin-top: 24px; }
.past { margin-top: 64px; }
.past summary { cursor: pointer; font-weight: 600; color: var(--muted); padding: 12px 0; }
.past .ev-card { background: transparent; }

/* Directorio */
.cards { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 320px), 1fr)); gap: 20px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 28px; display: flex; flex-direction: column; gap: 10px; }
.card-kicker { font-size: .78rem; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--accent); }
.card-text { color: var(--muted); font-size: .96rem; }
.card-more { margin-top: auto; padding-top: 10px; }
.card-more summary { cursor: pointer; font-weight: 600; font-size: .92rem; color: var(--accent); }
.channels { list-style: none; margin: 12px 0 0; padding: 0; display: grid; gap: 6px; font-size: .92rem; overflow-wrap: anywhere; }
.channels .muted { display: inline-block; min-width: 80px; font-size: .82rem; }
.channels a { color: var(--accent); }

/* Pie */
.footer { border-top: 1px solid var(--line); padding: 56px 0 32px; }
.footer-inner { display: flex; justify-content: space-between; gap: 32px; flex-wrap: wrap; }
.footer-inner > div:first-child { max-width: 46ch; }
.footer-brand { font-family: var(--serif); font-weight: 650; font-size: 1.1rem; margin-bottom: 8px; }
.footer-links { display: flex; flex-direction: column; gap: 8px; }
.footer-links a { color: var(--muted); text-decoration: none; }
.footer-links a:hover { color: var(--ink); }
.footer-meta { margin-top: 40px; font-size: .8rem; }

@media (max-width: 860px) {
    .community-inner, .split { grid-template-columns: 1fr; gap: 36px; }
    .actions-end { justify-content: flex-start; }
    .news { grid-template-columns: 1fr 1fr; }
    .board { inset: 0 -30% 0 30%; opacity: .45; }
}

@media (max-width: 600px) {
    body { font-size: 16px; }
    .wrap { padding: 0 16px; }
    .nav a:not(.nav-cta) { display: none; }
    .brand-name { font-size: 1.05rem; }
    .brand-sub { display: none; }
    .news { grid-template-columns: 1fr; }
    .feature { grid-template-columns: 1fr; gap: 20px; padding: 24px; }
    .feature-date { flex-direction: row; gap: 10px; justify-content: center; padding: 12px; }
    .feature-day { font-size: 2.2rem; margin: 0; }
    .ev-card { grid-template-columns: 52px 1fr; gap: 14px; padding: 14px; }
    .ev-arrow { display: none; }
    .section-head { flex-direction: column; gap: 8px; margin-bottom: 24px; }
    .btn { width: 100%; }
    .board { opacity: .3; }
}

/* Extras del sitio en Django */
.preview { background: var(--warn); color: #fff; text-align: center; padding: 8px; font-weight: 600; }
.paginas { display: flex; gap: 12px; justify-content: center; margin-top: 40px; }
.news-list .news-card { flex-direction: row; gap: 20px; align-items: center; }
.news-list .news-img { width: 160px; flex: none; }
@media (max-width: 600px) { .news-list .news-card { flex-direction: column; align-items: stretch; } .news-list .news-img { width: 100%; } }

/* Aviso de deteccion automatica en la pagina del torneo */
.auto-note { margin-top: 28px; padding: 16px 20px; border-radius: 14px; background: var(--surface-2); border: 1px solid var(--line); font-size: .95rem; }
.auto-note strong { display: block; margin-bottom: 2px; }
.auto-note a { color: var(--accent); font-weight: 600; }
.auto-note.warn { border-color: color-mix(in srgb, var(--warn) 45%, transparent); background: color-mix(in srgb, var(--warn) 8%, var(--surface)); }
.auto-note.warn strong { color: var(--warn); }

/* Auspiciante: colores propios de la marca (Raiz de Tres, campania AJ26), iguales en claro y oscuro */
.sponsor { padding: 28px 0; background: var(--bg); }
.sponsor-label { font-size: .72rem; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); margin-bottom: 10px; }
.sponsor-card {
    --sp-bg: #0c2347; --sp-ink: #ffffff; --sp-soft: #b9c7de; --sp-gold: #f5bf2a;
    position: relative; overflow: hidden; display: grid; grid-template-columns: auto 1fr auto; gap: 28px; align-items: center;
    padding: 26px 32px; border-radius: var(--radius); background: var(--sp-bg); color: var(--sp-ink);
}
.sponsor-card::before {
    content: '\265E'; position: absolute; right: 22%; top: 50%; transform: translateY(-50%);
    font-size: 220px; line-height: 1; color: #112d58; pointer-events: none;
}
.sponsor-card > * { position: relative; }
.sponsor-photo { width: 92px; height: 92px; border-radius: 50%; object-fit: cover; border: 3px solid var(--sp-gold); }
.sponsor-kicker { font-size: .74rem; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: var(--sp-gold); }
.sponsor-title { font-family: var(--serif); font-size: clamp(1.45rem, 3vw, 1.9rem); font-weight: 650; line-height: 1.15; margin: 4px 0 6px; }
.sponsor-title em { color: var(--sp-gold); }
.sponsor-text { color: var(--sp-soft); font-size: .95rem; }
.sponsor-text strong { color: var(--sp-ink); font-weight: 600; }
.sponsor-actions { display: flex; flex-direction: column; gap: 10px; align-items: stretch; }
.sponsor-actions .btn { min-height: 44px; }
.btn-sponsor { background: var(--sp-gold); color: #0c2347; }
.btn-sponsor-ghost, .btn-sponsor-ghost:hover { background: transparent; border-color: rgba(255, 255, 255, .35); color: var(--sp-ink); }
.sponsor-brand { display: flex; align-items: center; justify-content: center; gap: 8px; font-size: .82rem; color: var(--sp-soft); text-decoration: none; }
.sponsor-brand svg { width: 30px; height: auto; }
@media (max-width: 860px) {
    .sponsor-card { grid-template-columns: auto 1fr; padding: 22px; gap: 18px 20px; }
    .sponsor-actions { grid-column: 1 / -1; flex-direction: row; flex-wrap: wrap; }
    .sponsor-actions .btn { flex: 1 1 180px; }
    .sponsor-brand { flex-basis: 100%; }
    .sponsor-photo { width: 72px; height: 72px; }
    .sponsor-card::before { right: -20px; font-size: 180px; }
}
@media (max-width: 480px) {
    .sponsor-card { grid-template-columns: 1fr; }
    .sponsor-photo { width: 64px; height: 64px; }
}

/* Auspiciante arriba: version compacta de una linea */
.sponsor-top { padding: 14px 0 0; }
.sponsor-top .sponsor-card { padding: 12px 20px; gap: 18px; grid-template-columns: auto 1fr auto; }
.sponsor-top .sponsor-card::before { font-size: 120px; right: 30%; }
.sponsor-top .sponsor-photo { width: 52px; height: 52px; border-width: 2px; }
.sponsor-top .sponsor-title { font-size: 1.2rem; margin: 0; }
.sponsor-top .sponsor-kicker { font-size: .66rem; }
.sponsor-top .sponsor-text, .sponsor-top .sponsor-brand, .sponsor-top .btn-sponsor-ghost { display: none; }
.sponsor-top .sponsor-actions { flex-direction: row; }
.sponsor-top .sponsor-actions .btn { min-height: 40px; padding: 0 18px; width: auto; }
.sponsor-tag { position: absolute; top: 6px; right: 12px; font-size: .6rem; letter-spacing: .12em; text-transform: uppercase; color: var(--sp-soft); }
@media (max-width: 860px) {
    .sponsor-top .sponsor-card { grid-template-columns: auto 1fr auto; padding: 12px 14px; }
    .sponsor-top .sponsor-actions { grid-column: auto; }
    .sponsor-top .sponsor-actions .btn { flex: none; }
}
@media (max-width: 480px) {
    .sponsor-top .sponsor-card { grid-template-columns: auto 1fr; gap: 10px 12px; }
    .sponsor-top .sponsor-actions { grid-column: 1 / -1; }
    .sponsor-top .sponsor-actions .btn { width: 100%; }
    .sponsor-top .sponsor-kicker { font-size: .6rem; padding-right: 58px; }
}

/* Club organizador dentro del torneo */
.club { margin-top: 40px; padding: 24px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--line); }
.club-label { font-size: .75rem; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; color: var(--accent); }
.club-name { font-size: 1.35rem; margin: 6px 0 2px; }
.club-desc { margin-top: 12px; }
.club-contacts { list-style: none; margin: 14px 0 0; padding: 0; display: grid; gap: 6px; font-size: .95rem; }
.club-contacts a { color: var(--accent); }

/* Boton flotante de WhatsApp (bot de Jaque Serrano) */
.wsp-float {
    position: fixed; right: 18px; bottom: 18px; z-index: 50; display: inline-flex; align-items: center; gap: 8px;
    padding: 12px 18px 12px 14px; border-radius: 999px; background: #25d366; color: #0b2e1a;
    font-weight: 600; text-decoration: none; box-shadow: 0 6px 20px rgba(0, 0, 0, .22); transition: transform .15s;
}
.wsp-float:hover { transform: translateY(-2px); }
.wsp-float svg { width: 26px; height: 26px; }
@media (max-width: 600px) { .wsp-float span { display: none; } .wsp-float { padding: 14px; } }
.footer { padding-bottom: 80px; }
.sponsor-top { padding: 0 0 8px; }
.sponsor-top:not(.sponsor-dentro) { margin-bottom: 28px; }
.sponsor-dentro { padding: 0; margin-top: 28px; background: transparent; }

/* Localidades */
.chips-loc { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 12px; }
.chips-loc-top { margin: 0 0 24px; color: var(--muted); font-size: .9rem; }
.chip-loc { display: inline-block; padding: 8px 16px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); text-decoration: none; font-weight: 500; font-size: .95rem; }
.chip-loc:hover { border-color: var(--accent); color: var(--accent); }
.ev-list.past .ev-card { background: transparent; }

.migas { font-size: .85rem; color: var(--muted); margin-bottom: 14px; }
.migas a { color: var(--muted); }
