:root {
  --green-light:  #EAF3DE;
  --green-mid:    #3B6D11;
  --green-dark:   #27500A;
  --green-border: #97C459;
  --green-hero1:  #0d2408;
  --green-hero2:  #1e4d0a;
  --green-hero3:  #3B6D11;
  --blue-light:   #E6F1FB;
  --blue-mid:     #185FA5;
  --blue-dark:    #0C447C;
  --text:         #1a1a1a;
  --text-sec:     #555;
  --text-ter:     #999;
  --border:       #e5e5e5;
  --border-sec:   #d9d9d9;
  --border-ter:   #f0f0f0;
  --bg-sec:       #f8f8f8;
  --activa-bg:    #EAF3DE; --activa-text:   #27500A;
  --aplazada-bg:  #FEF3E2; --aplazada-text: #92400E;
  --cancel-bg:    #FEE2E2; --cancel-text:   #991B1B;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, sans-serif;
  color: var(--text);
  background: #fff;
  font-size: 14px;
  line-height: 1.4;
  -webkit-font-smoothing: antialiased;
}

/* ── Hero ── */
.site-hero {
  background: linear-gradient(175deg, var(--green-hero1) 0%, var(--green-hero2) 45%, var(--green-hero3) 100%);
  position: relative;
  overflow: hidden;
  padding: 36px 20px 60px;
}
.site-hero.has-image {
  background-size: cover;
  background-position: center;
}
.site-hero.has-image::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(175deg, rgba(13,36,8,0.78) 0%, rgba(30,77,10,0.62) 100%);
  z-index: 1;
}
.hero-video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  z-index: 0;
  transition: opacity 1.5s ease-in-out;
}
.hero-video.fade-out {
  opacity: 0;
}
.hero-content { position: relative; z-index: 2; }

.site-logo {
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1;
  display: inline-block;
}
.logo-trail    { color: #fff; }
.logo-asturias { color: #a8d96a; }
.logo-asturias2{ color: #97C459; }
.logo-tld      { color: rgba(255,255,255,0.45); font-weight: 400; font-size: 20px; }

.hero-tagline {
  color: rgba(255,255,255,0.7);
  font-size: 13px;
  margin-top: 7px;
}
.hero-mountains {
  position: absolute;
  bottom: 0; left: 0;
  width: 100%; height: 160px;
  pointer-events: none;
}

/* ── Site tabs (nav strip debajo del hero) ── */
.site-tabs {
  display: flex;
  justify-content: center;
  background: #fff;
  border-bottom: 1px solid var(--border);
  padding: 0 8px;
}
.site-tabs a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 500;
  padding: 11px 14px;
  text-decoration: none;
  color: var(--text-sec);
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: color 0.15s, border-color 0.15s;
  -webkit-tap-highlight-color: transparent;
  white-space: nowrap;
}
.site-tabs a:hover { color: var(--text); }
.site-tabs a.active {
  color: var(--green-mid);
  border-bottom-color: var(--green-mid);
  font-weight: 600;
}
.site-tabs svg {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
}

@media (min-width: 640px) {
  .site-hero    { padding: 60px 28px 80px; }
  .site-logo    { font-size: 34px; }
  .logo-tld     { font-size: 28px; }
  .hero-tagline { font-size: 16px; margin-top: 10px; }
  .site-nav a   { font-size: 13px; padding: 7px 16px; }
}
@media (min-width: 960px) {
  .site-hero    { padding: 120px 40px 140px; }
  .site-logo    { font-size: 52px; }
  .logo-tld     { font-size: 40px; }
  .hero-tagline { font-size: 20px; margin-top: 16px; }
  .site-nav     { margin-top: 24px; }
  .site-nav a   { font-size: 14px; padding: 8px 20px; }
}

/* ── Próxima carrera bar ── */
#proxima-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  background: var(--green-light);
  border-bottom: 1px solid var(--green-border);
  padding: 10px 16px;
  font-size: 13px;
  min-height: 42px;
}
.proxima-left {
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
}
.proxima-dot   { color: var(--green-mid); font-size: 20px; flex-shrink: 0; line-height: 1; }
.proxima-label { color: var(--green-mid); font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; flex-shrink: 0; }
.proxima-name  { font-weight: 600; color: var(--green-dark); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.proxima-date  { color: var(--green-mid); flex-shrink: 0; white-space: nowrap; font-weight: 500; }
.proxima-count {
  font-size: 11px; color: var(--green-mid); font-weight: 700;
  flex-shrink: 0; white-space: nowrap;
  background: rgba(59,109,17,0.13);
  padding: 3px 9px; border-radius: 20px;
}

/* ── Layout ── */
.page-outer { max-width: 1200px; margin: 0 auto; }
.page-layout { display: flex; align-items: flex-start; }
.main-col { flex: 1; min-width: 0; max-width: 760px; }
.sidebar  { display: none; }

@media (min-width: 960px) {
  .page-layout { gap: 40px; padding: 0 32px; }
  .sidebar {
    display: block;
    width: 320px;
    flex-shrink: 0;
  }
  .sidebar-sticky { position: sticky; top: 16px; padding-top: 16px; }
  
  /* Filtros wrap en escritorio */
  .filtros-row { flex-wrap: wrap; }
}

/* ── Sidebar Widgets ── */
.sidebar-widget {
  background: #fdfdfd;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 24px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.03);
}
.widget-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--green-dark);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.widget-title::before {
  content: '';
  display: block;
  width: 8px; height: 8px;
  background: var(--activa-bg);
  border-radius: 50%;
}
.widget-item {
  display: block;
  padding: 10px 0;
  border-bottom: 1px solid var(--border-ter);
  text-decoration: none;
  color: inherit;
  transition: opacity 0.2s;
}
.widget-item:last-child { border-bottom: none; padding-bottom: 0; }
a.widget-item:hover { opacity: 0.7; }
.widget-item-date { font-size: 11px; color: var(--green-mid); font-weight: 700; margin-bottom: 2px; }
.widget-item-name { font-size: 13px; font-weight: 600; line-height: 1.35; margin-bottom: 4px; }
.widget-item-lugar { font-size: 11px; color: var(--text-sec); }

/* ── Filtros + Búsqueda sticky ── */
.filtros-wrapper {
  position: sticky;
  top: 0;
  background: #fff;
  z-index: 10;
  border-bottom: 1px solid var(--border);
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}

/* Búsqueda */
.search-row { padding: 10px 16px; }
.search-input-wrap { position: relative; display: flex; align-items: center; }
.search-icon {
  position: absolute; left: 11px;
  width: 16px; height: 16px;
  color: var(--text-ter); pointer-events: none;
}
#buscador {
  width: 100%;
  padding: 9px 36px 9px 34px;
  border: 1px solid var(--border-sec);
  border-radius: 8px;
  font-size: 16px; /* ≥16px evita el auto-zoom de iOS Safari al hacer foco */
  color: var(--text);
  background: var(--bg-sec);
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
  -webkit-appearance: none;
}
@media (min-width: 640px) {
  #buscador { font-size: 14px; }
}
#buscador::placeholder { color: var(--text-ter); }
#buscador:focus {
  border-color: var(--green-mid);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(59,109,17,0.1);
}
.search-clear {
  position: absolute; right: 8px;
  background: var(--border-sec); border: none;
  border-radius: 50%; width: 20px; height: 20px;
  font-size: 10px; color: var(--text-sec);
  cursor: pointer; display: none;
  align-items: center; justify-content: center;
  line-height: 1; padding: 0; transition: background 0.1s;
}
.search-clear.visible { display: flex; }
.search-clear:hover { background: var(--border); }

/* Pills */
.filtros-sep { height: 1px; background: var(--border-ter); margin: 0 16px; }
.filtros-row {
  padding: 8px 16px;
  display: flex; gap: 6px;
  overflow-x: auto; scrollbar-width: none;
  align-items: center;
}
#filtros-mes {
  flex-wrap: wrap;
}
.filtros-row::-webkit-scrollbar { display: none; }
.pills-group { display: flex; gap: 6px; }
.filtros-spacer { flex-grow: 1; min-width: 16px; }


.pill {
  border-radius: 20px; padding: 5px 13px;
  font-size: 12px; font-weight: 400;
  border: 1px solid var(--border-sec);
  background: #fff; color: var(--text-sec);
  cursor: pointer; white-space: nowrap;
  flex-shrink: 0; line-height: 1.4;
  transition: border-color 0.1s, background 0.1s, color 0.1s;
}
.pill:hover { border-color: #aaa; color: var(--text); }
.pill.active {
  background: var(--green-light);
  border-color: var(--green-mid);
  color: var(--green-dark);
  font-weight: 600;
}

/* Contador */
.results-count {
  padding: 7px 16px;
  font-size: 11px; color: var(--text-ter);
  border-bottom: 1px solid var(--border-ter);
  min-height: 30px; display: flex; align-items: center;
}
.results-count strong { color: var(--text-sec); font-weight: 600; }

/* ── Mes header ── */
.mes-header {
  font-size: 13px; font-weight: 800;
  text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--text-sec);
  padding: 24px 16px 8px;
}

/* ── Carrera row ── */
a.carrera-row,
div.carrera-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-ter);
  text-decoration: none;
  color: inherit;
  transition: transform 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275), box-shadow 0.2s ease, background 0.1s ease;
  position: relative;
}
a.carrera-row { cursor: pointer; }
div.carrera-row { cursor: default; }
a.carrera-row:hover { background: var(--bg-sec); }
a.carrera-row:hover .carrera-chevron { opacity: 0.7; }

@media (min-width: 960px) {
  a.carrera-row { border-radius: 8px; margin: 0 4px; padding: 12px; }
  div.carrera-row { border-radius: 8px; margin: 0 4px; padding: 12px; }
  a.carrera-row:hover {
    transform: translateY(-3px) scale(1.01);
    box-shadow: 0 12px 24px rgba(0,0,0,0.08);
    background: #fff;
    border-bottom-color: transparent;
    z-index: 2;
  }
}

.carrera-fecha {
  min-width: 38px; text-align: center;
  flex-shrink: 0; padding-top: 2px;
  align-self: flex-start;
}
.carrera-dia {
  font-size: 22px; font-weight: 700;
  line-height: 1; color: var(--text);
}
.carrera-mes-abr {
  font-size: 10px; font-weight: 600;
  text-transform: uppercase; color: var(--text-ter);
  letter-spacing: 0.04em; margin-top: 2px;
}

.carrera-info { flex: 1; min-width: 0; }
.carrera-nombre { font-size: 14px; font-weight: 600; line-height: 1.35; }
.carrera-lugar {
  font-size: 12px; color: var(--text-sec);
  margin-top: 3px;
  display: flex; align-items: center; gap: 4px;
}
.carrera-lugar-dot {
  width: 3px; height: 3px; border-radius: 50%;
  background: var(--text-ter); flex-shrink: 0;
  display: inline-block;
}
.carrera-badges { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 7px; }

.badge {
  font-size: 10px; padding: 2px 8px;
  border-radius: 20px; font-weight: 600;
}
.badge-activa   { background: var(--activa-bg);   color: var(--activa-text); }
.badge-aplazada { background: var(--aplazada-bg); color: var(--aplazada-text); }
.badge-cancelada{ background: var(--cancel-bg);   color: var(--cancel-text); }
.badge-web      { background: var(--green-light);  color: var(--green-dark); }
.badge-dist     { background: var(--blue-light);   color: var(--blue-dark); }

/* Cards con web oficial — borde izquierdo verde sutil */
a.carrera-row.has-web {
  border-left: 2px solid var(--green-border);
  padding-left: 14px;
}
a.carrera-row.has-web .carrera-chevron {
  color: var(--green-mid);
  opacity: 0.7;
}
a.carrera-row.has-web:hover .carrera-chevron {
  opacity: 1;
}



.carrera-chevron {
  color: var(--text-ter); font-size: 20px;
  flex-shrink: 0; opacity: 0.35;
  transition: opacity 0.1s; font-weight: 300;
  align-self: center;
  width: 16px;
  display: flex; align-items: center; justify-content: center;
}

/* Pasadas */
a.carrera-row.past,
div.carrera-row.past { opacity: 0.42; }

/* Highlight búsqueda */
mark {
  background: #FEF08A; color: inherit;
  border-radius: 2px; padding: 0 1px;
}

/* Estado vacío */
.empty-state {
  padding: 56px 24px; text-align: center; color: var(--text-sec);
}
.empty-icon { font-size: 42px; margin-bottom: 14px; opacity: 0.35; }
.empty-state p { font-size: 15px; font-weight: 500; margin-bottom: 6px; }
.empty-state small { font-size: 12px; color: var(--text-ter); }
.link-año { background: none; border: none; padding: 0; color: var(--green-mid); font-size: inherit; font-weight: 600; cursor: pointer; text-decoration: underline; }

/* ── AdSense (desactivado hasta activar anuncios) ── */
.ad-slot        { display: none; }
/* Activar cuando se integre AdSense:
.ad-slot {
  background: var(--bg-sec);
  border-top: 1px solid var(--border-ter);
  border-bottom: 1px solid var(--border-ter);
  display: flex; align-items: center; justify-content: center;
  color: var(--text-ter); font-size: 11px;
}
.ad-inline {
  min-height: 260px; margin: 12px 16px;
  border-radius: 8px; border: 1px dashed var(--border-sec);
}
@media (min-width: 640px) {
  .ad-inline {
    min-height: 100px; margin: 12px 0;
    border-radius: 0; border-left: none; border-right: none;
  }
}
.ad-sidebar-unit {
  min-height: 260px; width: 100%;
  border-radius: 8px; border: 1px dashed var(--border-sec);
}
*/

/* ── Footer ── */
.site-footer {
  padding: 28px 16px; text-align: center;
  font-size: 11px; color: var(--text-ter);
  border-top: 1px solid var(--border-ter); margin-top: 16px;
  display: flex; flex-direction: column; gap: 4px;
}
.site-footer a { color: var(--green-mid); text-decoration: none; }
.site-footer a:hover { text-decoration: underline; }
.footer-copy { color: var(--text-ter); }
.footer-about {
  font-size: 12px;
  color: var(--text-sec);
  max-width: 600px;
  margin: 0 auto 8px;
  line-height: 1.6;
}
.footer-about strong { color: var(--text); font-weight: 600; }

/* ── Detalle de carrera ── */
.carrera-detail-page {
  max-width: 680px;
  margin: 0 auto;
  padding: 20px 16px 60px;
}

.detail-breadcrumb {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-ter);
  margin-bottom: 28px;
  flex-wrap: wrap;
}
.detail-breadcrumb a { color: var(--text-sec); text-decoration: none; }
.detail-breadcrumb a:hover { text-decoration: underline; }
.detail-breadcrumb [aria-current] { color: var(--text); }

.detail-header { margin-bottom: 24px; }

.detail-title {
  font-size: 26px;
  font-weight: 700;
  color: var(--text);
  line-height: 1.25;
  margin-bottom: 8px;
}
.detail-lugar {
  font-size: 15px;
  color: var(--text-sec);
  margin-bottom: 12px;
}
.detail-badges { display: flex; flex-wrap: wrap; gap: 6px; }

.detail-facts {
  background: var(--bg-sec);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px 20px;
  margin-bottom: 28px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.detail-fact { display: flex; gap: 16px; align-items: baseline; }
.detail-fact dt {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-ter);
  min-width: 76px;
  flex-shrink: 0;
}
.detail-fact dd { font-size: 14px; color: var(--text); font-weight: 500; }
.detail-web-link { color: var(--green-mid); text-decoration: none; word-break: break-all; }
.detail-web-link:hover { text-decoration: underline; }

.detail-cta { margin-bottom: 28px; display: flex; flex-direction: column; gap: 12px; }
@media (min-width: 640px) {
  .detail-cta { flex-direction: row; flex-wrap: wrap; justify-content: center; }
}

.detail-btn-web,
.detail-btn-google,
.detail-btn-cal {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-weight: 600;
  font-size: 15px;
  padding: 14px 24px;
  border-radius: 8px;
  font-family: inherit;
}
@media (min-width: 640px) {
  .detail-btn-web,
  .detail-btn-google,
  .detail-btn-cal { display: inline-flex; justify-content: unset; }
}

.detail-btn-web {
  background: var(--green-mid);
  color: #fff;
  text-decoration: none;
  border: none;
  transition: background 0.15s;
}
.detail-btn-web:hover { background: var(--green-dark); color: #fff; }

.detail-btn-google {
  background: var(--bg-sec);
  color: var(--text);
  text-decoration: none;
  border: 1px solid var(--border-sec);
  transition: background 0.15s;
}
.detail-btn-google:hover { background: var(--border); }

.detail-btn-cal {
  background: var(--bg-sec);
  color: var(--text);
  border: 1px solid var(--border-sec);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.detail-btn-cal:hover {
  background: var(--green-light);
  border-color: var(--green-mid);
  color: var(--green-dark);
}
.detail-btn-cal[aria-expanded="true"] { background: var(--green-light); border-color: var(--green-border); color: var(--green-dark); }
.cal-chevron { margin-left: auto; flex-shrink: 0; transition: transform 0.2s ease; }
.detail-btn-cal[aria-expanded="true"] .cal-chevron { transform: rotate(180deg); }

.cal-dropdown-wrap { position: relative; }
.cal-dropdown-wrap .detail-btn-cal { width: 100%; }
@media (min-width: 640px) { .cal-dropdown-wrap .detail-btn-cal { width: auto; } }

@keyframes calFadeIn {
  from { opacity: 0; transform: translateY(-6px); }
  to   { opacity: 1; transform: translateY(0); }
}
.cal-menu {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  background: #fff;
  border: 1px solid var(--border-sec);
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0,0,0,.13), 0 2px 6px rgba(0,0,0,.06);
  z-index: 200;
  overflow: hidden;
  animation: calFadeIn 0.15s ease;
}
@media (min-width: 640px) { .cal-menu { right: auto; min-width: 230px; } }

.cal-option {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 13px 16px;
  color: var(--text);
  text-decoration: none;
  background: none;
  border: none;
  cursor: pointer;
  font-family: inherit;
  text-align: left;
  transition: background 0.12s;
}
.cal-option:hover { background: var(--bg-sec); }
.cal-option + .cal-option { border-top: 1px solid var(--border-ter); }
.cal-option svg { flex-shrink: 0; }
.cal-option-text { display: flex; flex-direction: column; gap: 1px; }
.cal-option-label { font-size: 14px; font-weight: 600; line-height: 1.2; }
.cal-option-sub { font-size: 12px; color: var(--text-ter); line-height: 1.2; }
.cal-option:hover .cal-option-sub { color: var(--text-sec); }

.detail-desc {
  margin-bottom: 32px;
  padding: 20px;
  background: var(--bg-sec);
  border-radius: 10px;
  border-left: 3px solid var(--green-border);
}
.detail-desc p {
  margin: 0;
  font-size: 15px;
  line-height: 1.7;
  color: var(--text-sec);
}
.detail-desc strong { color: var(--text); }

.detail-related {
  margin-bottom: 28px;
  padding-top: 24px;
  border-top: 1px solid var(--border-ter);
}
.detail-related h3 {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  margin: 0 0 12px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.detail-related ul {
  list-style: none;
  margin: 0 0 12px;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.detail-related li a {
  display: block;
  padding: 8px 12px;
  border-radius: 8px;
  text-decoration: none;
  color: var(--text);
  font-size: 14px;
  font-weight: 500;
  background: var(--bg-sec);
  transition: background 0.15s;
}
.detail-related li a:hover { background: var(--green-light); color: var(--green-dark); }
.related-meta { font-weight: 400; color: var(--text-ter); font-size: 13px; }
.related-more {
  display: inline-block;
  font-size: 13px;
  font-weight: 500;
  color: var(--green-mid);
  text-decoration: none;
}
.related-more:hover { text-decoration: underline; }

.detail-back {
  padding-top: 24px;
  border-top: 1px solid var(--border-ter);
}
.detail-back a {
  color: var(--green-mid);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
}
.detail-back a:hover { text-decoration: underline; }

@media (min-width: 640px) {
  .carrera-detail-page { padding: 32px 24px 80px; }
  .detail-title { font-size: 32px; }
  .detail-facts { flex-direction: row; flex-wrap: wrap; }
  .detail-fact { flex: 1 1 200px; flex-direction: column; gap: 4px; }
  .detail-fact dt { min-width: unset; }
}
@media (min-width: 960px) {
  .carrera-detail-page { padding: 40px 24px 100px; }
  .detail-title { font-size: 38px; }
}

/* ── Botón Volver Arriba ── */
.btn-top {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background-color: var(--green-mid);
  color: white;
  border: none;
  box-shadow: 0 4px 12px rgba(59, 109, 17, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  opacity: 0;
  visibility: hidden;
  transform: translateY(20px);
  transition: all 0.3s ease;
  z-index: 100;
}
.btn-top.visible {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}
.btn-top:hover {
  background-color: var(--green-dark);
  transform: translateY(-2px);
}
.btn-top svg {
  width: 20px;
  height: 20px;
}

