/* =====================================================================
   estacaído.info — identidad EDITORIAL ("medios"): titulares serif,
   filetes finos, papel + tinta + rojo de cabecera, tarjetas planas.
   Tema claro/oscuro cuidado en ambos (no una simple inversión).
   ===================================================================== */

:root {
  /* Papel cálido + tinta + rojo editorial. Neutros con sesgo cálido (elegidos,
     no un gris "por defecto"). */
  --bg: #faf6ee;
  --bg-grad: none;
  --card: #fffdf8;
  --card-soft: #f3ecdf;
  --text: #1b1a17;
  --muted: #6f685f;
  --border: #e4dccb;
  --rule: #1b1a17;            /* filete fuerte de cabecera (tinta) */
  --shadow: 0 1px 2px rgba(70,55,30,.05);

  --ok: #157a43;      --ok-soft: #e6f1e8;
  --degraded: #a86611; --degraded-soft: #f6ecd6;
  --down: #b3261e;    --down-soft: #f7e4e0;
  --nodata: #9b9284;  --nodata-soft: #efeade;
  --accent: #b3261e;  /* rojo editorial: cabecera, enlaces, CTA */

  --font-head: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, "Times New Roman", serif;
  --font-body: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;

  --r-card: 7px;
  --r-input: 6px;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #15130f;
    --bg-grad: none;
    --card: #1d1a15;
    --card-soft: #24201a;
    --text: #ece4d6;
    --muted: #9b9184;
    --border: #322d24;
    --rule: #4a4238;
    --shadow: 0 1px 2px rgba(0,0,0,.4);
    --ok: #58c081;    --ok-soft: #143020;
    --degraded: #e6a844; --degraded-soft: #33260f;
    --down: #f0736a;  --down-soft: #351a19;
    --nodata: #8a8276; --nodata-soft: #24211b;
    --accent: #ef6f66;
  }
}
:root[data-theme="dark"] {
  --bg: #15130f; --bg-grad: none;
  --card: #1d1a15; --card-soft: #24201a;
  --text: #ece4d6; --muted: #9b9184; --border: #322d24; --rule: #4a4238;
  --shadow: 0 1px 2px rgba(0,0,0,.4);
  --ok: #58c081; --ok-soft: #143020;
  --degraded: #e6a844; --degraded-soft: #33260f;
  --down: #f0736a; --down-soft: #351a19;
  --nodata: #8a8276; --nodata-soft: #24211b;
  --accent: #ef6f66;
}
:root[data-theme="light"] {
  --bg: #faf6ee; --bg-grad: none;
  --card: #fffdf8; --card-soft: #f3ecdf;
  --text: #1b1a17; --muted: #6f685f; --border: #e4dccb; --rule: #1b1a17;
  --shadow: 0 1px 2px rgba(70,55,30,.05);
  --ok: #157a43; --ok-soft: #e6f1e8;
  --degraded: #a86611; --degraded-soft: #f6ecd6;
  --down: #b3261e; --down-soft: #f7e4e0;
  --nodata: #9b9284; --nodata-soft: #efeade;
  --accent: #b3261e;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

/* Titulares con serif editorial (el resto del texto y las etiquetas, en sans). */
h1, .section-title, .op-name, .modal h2,
.city-related h2, .city-zone h2, .city-faq h2, .faq-item h3 {
  font-family: var(--font-head);
  font-weight: 700;
  letter-spacing: -.01em;
}
a { color: var(--accent); }

/* ---------- Cabecera / mancheta ---------- */
.site-header { padding: 26px 20px 0; }
.header-inner {
  max-width: 1100px; margin: 0 auto;
  border-bottom: 1px solid var(--rule); padding-bottom: 16px;
}
.title-row { display: flex; align-items: flex-end; justify-content: space-between; gap: 14px; }
h1 { margin: 0; font-size: clamp(1.7rem, 4.5vw, 2.6rem); line-height: 1.05; text-wrap: balance; }
.theme-toggle {
  border: 1px solid var(--border); background: var(--card); color: var(--text);
  border-radius: var(--r-input); width: 40px; height: 40px; font-size: 1.1rem; cursor: pointer;
  flex: 0 0 auto;
}
.theme-toggle:hover { border-color: var(--accent); }

/* Resumen global: filete lateral rojo, aire de "titular de portada". */
.global-summary {
  margin-top: 16px; display: inline-flex; align-items: center; gap: 12px;
  background: var(--card); border: 1px solid var(--border); border-left: 4px solid var(--nodata);
  border-radius: var(--r-card); padding: 12px 18px; font-weight: 600; font-size: 1.05rem;
}
.summary-row { margin-top: 16px; display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }

/* CTA de reporte: sólido, rojo editorial (llamada fuerte). */
.report-btn {
  border: 1px solid var(--accent); background: var(--accent); color: #fff;
  border-radius: var(--r-input); padding: 10px 16px; font-size: .92rem; font-weight: 700; cursor: pointer;
}
.report-btn:hover { filter: brightness(1.06); }
.report-btn.secondary { background: var(--card); border-color: var(--border); color: var(--muted); }
.report-btn.secondary:hover { border-color: var(--accent); color: var(--accent); filter: none; }

.global-dot { width: 14px; height: 14px; border-radius: 50%; background: var(--nodata); flex: 0 0 auto; }
.global-summary.OK { border-left-color: var(--ok); }
.global-summary.DEGRADADO { border-left-color: var(--degraded); }
.global-summary.CAIDA { border-left-color: var(--down); }
.global-summary.OK .global-dot { background: var(--ok); }
.global-summary.DEGRADADO .global-dot { background: var(--degraded); }
.global-summary.CAIDA .global-dot { background: var(--down); }
.global-summary.SIN_DATOS .global-dot { background: var(--nodata); }

/* ---------- Etiquetas de sección (antetítulos) ---------- */
.section-title { margin: 0; font-size: 1.5rem; }
.section-sub { margin: 6px 0 0; color: var(--muted); font-size: .92rem; max-width: 70ch; }

/* ---------- Tira de operadoras (resumen nacional) ---------- */
.strip-title {
  margin: 20px 0 9px; font-size: .72rem; font-weight: 700; letter-spacing: .1em;
  text-transform: uppercase; color: var(--accent);
}
.operators-strip { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 8px; }
.strip-op {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 10px 13px; border-radius: var(--r-card); font-size: .9rem; font-weight: 700;
  background: var(--card); border: 1px solid var(--border);
}
.strip-op-name { color: var(--text); }
.strip-nets { display: inline-flex; align-items: center; gap: 12px; flex: 0 0 auto; }
.strip-net { display: inline-flex; align-items: center; gap: 5px; font-size: 1rem; }
.strip-dot { width: 11px; height: 11px; border-radius: 50%; background: var(--nodata); flex: 0 0 auto; box-shadow: 0 0 0 2px color-mix(in srgb, var(--nodata) 25%, transparent); }
.strip-dot.OK { background: var(--ok); box-shadow: 0 0 0 2px var(--ok-soft); }
.strip-dot.DEGRADADO { background: var(--degraded); box-shadow: 0 0 0 2px var(--degraded-soft); }
.strip-dot.CAIDA { background: var(--down); box-shadow: 0 0 0 2px var(--down-soft); }
.strip-dot.SIN_DATOS { background: var(--nodata); box-shadow: 0 0 0 2px var(--nodata-soft); }

/* ---------- Layout ---------- */
.container { max-width: 1100px; margin: 0 auto; padding: 22px 20px 40px; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; margin-top: 16px; }
.loading { color: var(--muted); }

/* ---------- Tarjeta de operador (plana, con filete lateral) ---------- */
.op-card {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--r-card);
  padding: 18px 18px 14px; position: relative; border-left: 4px solid var(--nodata);
}
.op-card.OK { border-left-color: var(--ok); }
.op-card.DEGRADADO { border-left-color: var(--degraded); }
.op-card.CAIDA { border-left-color: var(--down); }
.op-card.SIN_DATOS { border-left-color: var(--nodata); }

.op-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.op-name { margin: 0; font-size: 1.25rem; }
.pill {
  display: inline-flex; align-items: center; gap: 6px; font-size: .78rem; font-weight: 700;
  padding: 5px 11px; border-radius: 999px; white-space: nowrap;
  font-family: var(--font-body); letter-spacing: 0;
}
.pill .pdot { width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.pill.OK { color: var(--ok); background: var(--ok-soft); }
.pill.DEGRADADO { color: var(--degraded); background: var(--degraded-soft); }
.pill.CAIDA { color: var(--down); background: var(--down-soft); }
.pill.SIN_DATOS { color: var(--nodata); background: var(--nodata-soft); }

/* aviso en lenguaje llano */
.aviso {
  margin-top: 12px; padding: 10px 12px; border-radius: var(--r-input);
  background: var(--degraded-soft); color: var(--degraded);
  border: 1px solid color-mix(in srgb, var(--degraded) 30%, transparent);
  font-size: .86rem; font-weight: 600; line-height: 1.45;
}
.conf-note { font-size: .74rem; color: var(--muted); margin: 0 0 6px; }

/* filas de red (fibra / móvil) */
.red-rows { margin-top: 14px; display: flex; flex-direction: column; gap: 8px; }
.red-row {
  display: flex; align-items: center; gap: 10px; padding: 11px 12px;
  background: var(--card-soft); border-radius: var(--r-input);
}
.red-ico { font-size: 1.15rem; width: 22px; text-align: center; flex: 0 0 auto; }
.red-main { flex: 1 1 auto; min-width: 0; }
.red-label { font-size: .74rem; color: var(--muted); font-weight: 700; text-transform: uppercase; letter-spacing: .04em; }
.red-verdict { font-size: .96rem; font-weight: 700; }
.red-row.OK .red-verdict { color: var(--ok); }
.red-row.DEGRADADO .red-verdict { color: var(--degraded); }
.red-row.CAIDA .red-verdict { color: var(--down); }
.red-row.SIN_DATOS .red-verdict { color: var(--muted); }
.red-state { font-size: 1.15rem; flex: 0 0 auto; }

/* punto de confianza */
.conf { display: inline-flex; align-items: center; gap: 5px; font-size: .68rem; color: var(--muted); margin-top: 2px; }
.conf-dot { width: 9px; height: 9px; border-radius: 50%; border: 1.5px solid var(--muted); position: relative; }
.conf-alta .conf-dot { background: var(--muted); }
.conf-media .conf-dot { background: linear-gradient(90deg, var(--muted) 50%, transparent 50%); }
.conf-baja .conf-dot { background: transparent; }

/* botón + / detalles técnicos */
.more-btn {
  margin-top: 12px; width: 100%; border: 1px solid var(--border); background: transparent;
  color: var(--muted); border-radius: var(--r-input); padding: 8px; cursor: pointer; font-size: .82rem; font-weight: 600;
}
.more-btn:hover { border-color: var(--accent); color: var(--accent); }
.tech { margin-top: 12px; border-top: 1px solid var(--border); padding-top: 12px; display: none; }
.tech.open { display: block; }
.tech h4 { margin: 10px 0 4px; font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-family: var(--font-body); }
.tech ul { margin: 0; padding-left: 16px; }
.tech li { font-size: .82rem; color: var(--text); line-height: 1.55; }
.tech .warn { color: var(--down); font-weight: 700; }
.sparkline { margin-top: 12px; min-height: 40px; }
.spark-empty, .spark-loading { font-size: .75rem; color: var(--muted); }

/* ---------- Páginas de ciudad (SEO) — aire editorial, filetes ---------- */
.city-related { margin-top: 30px; padding-top: 8px; border-top: 1px solid var(--border); }
.city-related h2 { font-size: 1.2rem; margin: 12px 0 8px; }
.city-links { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.city-links a { text-decoration: none; font-size: .94rem; }
.city-links a:hover { text-decoration: underline; }
.city-links.inline { flex-direction: row; flex-wrap: wrap; gap: 10px 16px; }
.city-zone { margin-top: 30px; }
.city-zone h2 { font-size: 1.2rem; margin: 0 0 4px; }
.city-links-group { margin-top: 16px; }
.city-links-group h3 { font-size: .95rem; margin: 0 0 6px; color: var(--muted); }
.city-faq { margin-top: 30px; padding-top: 8px; border-top: 1px solid var(--border); }
.city-faq h2 { font-size: 1.3rem; margin: 12px 0 14px; }
.faq-item { margin-bottom: 18px; }
.faq-item h3 { font-size: 1.02rem; margin: 0 0 4px; }
.faq-item p { margin: 0; font-size: .92rem; color: var(--muted); max-width: 70ch; }
.breadcrumb { font-size: .74rem; color: var(--muted); margin: 0 0 10px; text-transform: uppercase; letter-spacing: .06em; }
.breadcrumb a { text-decoration: none; }
.breadcrumb a:hover { text-decoration: underline; }
.ad-slot { margin: 22px 0; min-height: 90px; display: flex; align-items: center; justify-content: center; }

/* ---------- Tu servicio ---------- */
#miservicio-section { margin-bottom: 34px; }
.servicio-panel {
  margin-top: 14px; display: flex; flex-direction: column; gap: 10px;
  background: var(--card); border: 1px solid var(--border); border-radius: var(--r-card); padding: 16px;
}
.servicio-row {
  display: flex; align-items: center; gap: 12px; padding: 13px 14px;
  background: var(--card-soft); border-radius: var(--r-input); border-left: 4px solid var(--nodata);
}
.servicio-row.OK { border-left-color: var(--ok); }
.servicio-row.DEGRADADO { border-left-color: var(--degraded); }
.servicio-row.CAIDA { border-left-color: var(--down); }
.servicio-row.SIN_DATOS { border-left-color: var(--nodata); }
.servicio-ico { font-size: 1.5rem; flex: 0 0 auto; line-height: 1; }
.servicio-main { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 5px; }
.servicio-label { font-size: .7rem; color: var(--muted); font-weight: 700; text-transform: uppercase; letter-spacing: .06em; }
.servicio-op {
  padding: 8px 10px; border-radius: var(--r-input); font-size: .95rem; font-weight: 600;
  border: 1px solid var(--border); background: var(--card); color: var(--text); max-width: 100%;
  font-family: var(--font-body);
}
.servicio-pill { flex: 0 0 auto; }
#servicio-notes:empty { display: none; }
#servicio-more { margin-top: 4px; }
.servicio-ubi { margin-top: 14px; font-size: .9rem; }
.servicio-ubi > summary { cursor: pointer; color: var(--accent); padding: 6px 0; font-weight: 600; list-style: revert; }
.servicio-ubi .mizona-selects { margin-top: 10px; }
#servicio-zone:not(:empty) { margin-top: 14px; }

/* selectores de ubicación */
.mizona-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; }
.mizona-selects { display: flex; flex-wrap: wrap; gap: 8px; }
#mizona-provincia, #mizona-select {
  padding: 9px 12px; border-radius: var(--r-input); font-size: .88rem;
  border: 1px solid var(--border); background: var(--card-soft); color: var(--text); max-width: 100%;
  font-family: var(--font-body);
}
#mizona-select:disabled { opacity: .6; cursor: not-allowed; }

/* ---------- Análisis automático en directo ---------- */
#analisis-section { margin-bottom: 36px; }
.analisis-cards { margin-top: 14px; display: flex; flex-direction: column; gap: 12px; }
.analisis-ok {
  background: var(--ok-soft); color: var(--ok); border: 1px solid color-mix(in srgb, var(--ok) 30%, transparent);
  border-radius: var(--r-card); padding: 14px 16px; font-weight: 600; font-size: .95rem;
}
.analisis-card {
  background: var(--card); border: 1px solid var(--border); border-left: 5px solid var(--nodata);
  border-radius: var(--r-card); padding: 16px 18px;
}
.analisis-card.DEGRADADO { border-left-color: var(--degraded); }
.analisis-card.CAIDA { border-left-color: var(--down); }
.analisis-head { display: flex; flex-wrap: wrap; align-items: center; gap: 9px; }
.analisis-ico { font-size: 1.25rem; }
.analisis-conf { font-size: .68rem; font-weight: 700; padding: 3px 9px; border-radius: 999px; text-transform: uppercase; letter-spacing: .05em; }
.conf-badge-alta { background: var(--down-soft); color: var(--down); }
.conf-badge-media { background: var(--degraded-soft); color: var(--degraded); }
.conf-badge-baja { background: var(--nodata-soft); color: var(--muted); }
.analisis-tag { font-size: .68rem; font-weight: 700; padding: 3px 9px; border-radius: 999px; background: var(--card-soft); border: 1px solid var(--border); color: var(--muted); }
/* La conclusión, con un pelín de aire tipográfico "de artículo". */
.analisis-narrative { margin: 11px 0 0; font-size: 1.02rem; line-height: 1.6; color: var(--text); }

/* ---------- Teaser de ciudades/municipios en la home ---------- */
.city-teaser { margin-top: 36px; padding-top: 8px; border-top: 1px solid var(--border); }
.chip-links { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.chip-link {
  display: inline-block; padding: 7px 14px; border-radius: 999px; font-size: .85rem;
  background: var(--card-soft); border: 1px solid var(--border); color: var(--text);
  text-decoration: none; transition: background .15s, border-color .15s;
}
.chip-link:hover { background: var(--card); border-color: var(--accent); }
.see-all-link { display: inline-block; margin-top: 14px; font-size: .9rem; font-weight: 600; color: var(--accent); text-decoration: none; }
.see-all-link:hover { text-decoration: underline; }

/* ---------- Página /ciudades ---------- */
.buscador-ciudades {
  width: 100%; padding: 13px 16px; border-radius: var(--r-input); font-size: 1rem;
  border: 1px solid var(--border); background: var(--card); color: var(--text);
  margin: 8px 0 28px; font-family: var(--font-body);
}
.provincia-group { margin-bottom: 28px; }
.provincia-title {
  font-size: 1.1rem; margin: 0 0 12px; padding-bottom: 6px;
  border-bottom: 1px solid var(--rule); color: var(--text); font-family: var(--font-head);
}
.ciudad-item { margin-bottom: 16px; }
.ciudad-item h3 { font-size: .98rem; margin: 0 0 6px; }

/* ---------- Modal registrar incidencia ---------- */
.modal-overlay {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(20, 15, 8, .5); backdrop-filter: blur(3px);
  display: flex; align-items: center; justify-content: center; padding: 16px;
}
.modal-overlay[hidden] { display: none; }
.modal {
  background: var(--card); color: var(--text); border: 1px solid var(--border);
  border-top: 4px solid var(--accent); border-radius: var(--r-card);
  box-shadow: 0 20px 60px rgba(20,15,8,.28); padding: 24px;
  width: 100%; max-width: 440px; position: relative; max-height: 90vh; overflow-y: auto;
}
.modal h2 { margin: 0 0 4px; font-size: 1.5rem; }
.modal-sub { margin: 0 0 16px; color: var(--muted); font-size: .9rem; }
.modal-close {
  position: absolute; top: 14px; right: 14px; border: none; background: transparent;
  color: var(--muted); font-size: 1.2rem; cursor: pointer; line-height: 1;
}
.field { display: block; margin-bottom: 16px; }
.field > span { display: block; font-size: .9rem; font-weight: 700; margin-bottom: 7px; }
.field em { color: var(--muted); font-weight: 400; font-style: normal; }
.field select, .field input {
  width: 100%; padding: 11px 12px; border-radius: var(--r-input); font-size: .95rem;
  border: 1px solid var(--border); background: var(--card-soft); color: var(--text);
  font-family: var(--font-body);
}
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  border: 1px solid var(--border); background: var(--card-soft); color: var(--text);
  border-radius: 999px; padding: 9px 14px; font-size: .9rem; cursor: pointer; font-weight: 600;
}
.chip[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: #fff; }
.modal-submit {
  width: 100%; margin-top: 4px; border: none; background: var(--accent); color: #fff;
  border-radius: var(--r-input); padding: 13px; font-size: 1rem; font-weight: 700; cursor: pointer;
}
.modal-submit:hover { filter: brightness(1.06); }
.report-feedback { margin: 12px 0 0; font-size: .88rem; font-weight: 600; text-align: center; }
.report-feedback.ok { color: var(--ok); }
.report-feedback.err { color: var(--down); }

/* ---------- Pie ---------- */
.site-footer { max-width: 1100px; margin: 0 auto; padding: 24px 20px 48px; color: var(--muted); font-size: .84rem; }
.site-footer > p:first-child { border-top: 1px solid var(--rule); padding-top: 18px; }
.site-footer a { color: var(--accent); }
.disclaimer { max-width: 78ch; line-height: 1.65; }

@media (max-width: 560px) {
  .grid { grid-template-columns: 1fr; }
  .site-header { padding: 18px 16px 0; }
  .container { padding: 18px 16px 40px; }
  h1 { font-size: 1.6rem; }
  .operators-strip { grid-template-columns: 1fr; }
  .strip-op { font-size: .95rem; padding: 12px 14px; }
  .global-summary { width: 100%; justify-content: flex-start; font-size: 1rem; }
  .summary-row { flex-direction: column; align-items: stretch; gap: 8px; }
  .report-btn { width: 100%; text-align: center; padding: 12px 16px; }
  .mizona-head { flex-direction: column; align-items: stretch; }
  .mizona-selects { flex-direction: column; }
  #mizona-provincia, #mizona-select, #mizona-operador { width: 100%; }
}
