/* =========================================================================
   ESTILO — "Panel de Estación"
   Paleta inspirada en el dial ámbar de un VFO retroiluminado, el verde
   fósforo de un S-meter, y el latón de los conectores de un transceptor.
   ========================================================================= */

@import url('https://fonts.googleapis.com/css2?family=Oswald:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500;700&display=swap');

:root {
  --bg-void: #14181c;
  --bg-panel: #1b2025;
  --bg-panel-raised: #232a31;
  --line: rgba(193, 122, 74, 0.22);
  --line-strong: rgba(193, 122, 74, 0.45);

  --amber: #ffb43d;
  --amber-dim: #b8792a;
  --phosphor: #5ddc85;
  --phosphor-dim: #2f8a54;
  --alert: #e0524c;
  --brass: #c17a4a;

  --text: #e8e2d6;
  --text-dim: #9aa0a6;
  --text-faint: #a2aab1;

  --font-display: 'Oswald', 'Arial Narrow', sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, 'Courier New', monospace;
  --font-body: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;

  --radius: 4px;
}

* { box-sizing: border-box; }
html { color-scheme: dark; }

body {
  margin: 0;
  background: var(--bg-void);
  color: var(--text);
  font-family: var(--font-body);
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}

/* Mapamundi de fondo, fijo detrás de todo el sitio — mismo dibujo que
   antes vivía solo en el hero, ahora ambientando toda la página. Se
   actualiza cada minuto (línea de grisáceo real según la hora). */
#fondoMapaMundi {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  z-index: -1;
  pointer-events: none;
}

a { color: var(--amber); }

::selection { background: var(--amber-dim); color: #14181c; }

/* Respeta preferencia de movimiento reducido */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}

/* ---- Layout general ------------------------------------------------- */

.envoltorio {
  max-width: 1320px;
  margin: 0 auto;
  padding: 20px 20px 60px;
}

/* ---- Encabezado / Hero ------------------------------------------------ */

.hero {
  position: relative;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: rgba(27,32,37,0.55);
  backdrop-filter: blur(1px);
  overflow: hidden;
  margin-bottom: 18px;
}

.hero__contenido {
  position: relative;
  z-index: 2;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: flex-end;
  gap: 20px;
  padding: 18px 24px 16px;
  background: linear-gradient(180deg, rgba(20,24,28,0.35) 0%, rgba(20,24,28,0.88) 78%);
}

.hero__estacion {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.eyebrow {
  font-family: var(--font-display);
  font-size: 10px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--brass);
}

.hero__indicativo {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(22px, 3.6vw, 32px);
  letter-spacing: 0.03em;
  color: var(--text);
  text-transform: uppercase;
}

.hero__qth {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-dim);
}

.hero__reloj {
  text-align: right;
}

.hero__reloj-etiqueta {
  font-family: var(--font-display);
  font-size: 10px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--brass);
  margin-bottom: 2px;
}

.hero__reloj-digitos {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: clamp(30px, 6vw, 56px);
  color: var(--amber);
  letter-spacing: 0.02em;
  text-shadow: 0 0 18px rgba(255,180,61,0.55), 0 0 46px rgba(255,180,61,0.18);
  font-variant-numeric: tabular-nums;
  line-height: 1;
}

.hero__reloj-fecha {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-dim);
  margin-top: 3px;
}

/* ---- Tira de reloj mundial --------------------------------------------- */

.tira-mundial {
  position: relative;
  z-index: 2;
  display: flex;
  flex-wrap: wrap;
  gap: 0;
  border-top: 1px solid var(--line);
  background: rgba(20,24,28,0.9);
}

.ciudad {
  flex: 1 1 100px;
  padding: 7px 12px;
  border-right: 1px solid var(--line);
  min-width: 100px;
}

.ciudad:last-child { border-right: none; }

.ciudad__nombre {
  font-family: var(--font-display);
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-dim);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ciudad__bandera-img {
  width: 15px;
  height: 11px;
  vertical-align: middle;
  margin-right: 4px;
  border-radius: 1px;
  box-shadow: 0 0 0 1px rgba(255,255,255,0.08);
}

.ciudad__hora {
  font-family: var(--font-mono);
  font-size: 16px;
  font-weight: 500;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

/* La ciudad marcada como "local" se destaca: más grande y en ámbar */
.ciudad--local {
  flex-basis: 150px;
  background: rgba(255,180,61,0.07);
}
.ciudad--local .ciudad__nombre { color: var(--brass); }
.ciudad--local .ciudad__hora {
  font-size: 24px;
  font-weight: 700;
  color: var(--amber);
}

/* ---- Solapas ------------------------------------------------------------- */

.solapas-nav {
  display: flex;
  gap: 6px;
  margin-bottom: 12px;
}

.solapa-boton {
  font-family: var(--font-display);
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-dim);
  background: var(--bg-panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 9px 18px;
  cursor: pointer;
}
.solapa-boton:hover { color: var(--text); border-color: var(--line-strong); }
.solapa-boton--activa {
  color: var(--bg-void);
  background: var(--amber);
  border-color: var(--amber);
  font-weight: 600;
}

.oculto { display: none !important; }

/* ---- Grilla de paneles -------------------------------------------------- */

.grilla {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(255px, 1fr));
  gap: 12px;
  align-items: start;
}

.panel {
  position: relative;
  background: var(--bg-panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 16px 14px;
}

/* Tornillos de rack — motivo de firma repetido en cada panel */
.panel::before,
.panel::after {
  content: "";
  position: absolute;
  top: 8px;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--brass);
  opacity: 0.55;
  box-shadow: 0 1px 1px rgba(0,0,0,0.4) inset;
}
.panel::before { left: 9px; }
.panel::after { right: 9px; }

.panel__cabecera {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 10px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--line);
}

.panel__titulo {
  font-family: var(--font-display);
  font-size: 13px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text);
  font-weight: 600;
}

.panel__nota {
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--text-faint);
}

.panel--ancho { grid-column: span 2; }

@media (max-width: 720px) {
  .panel--ancho { grid-column: span 1; }
}

/* Paneles de tamaño fijo: todos los de la fila miden lo mismo, y si el
   contenido no entra, hace scroll adentro en vez de romper el tamaño. */
.panel--fijo,
.panel--fijo-grande {
  display: flex;
  flex-direction: column;
}
.panel--fijo { height: 300px; }
.panel--fijo-grande { height: 490px; }

.panel--fijo .panel__cabecera,
.panel--fijo-grande .panel__cabecera {
  flex-shrink: 0;
}

.panel__cuerpo {
  flex: 1 1 auto;
  min-height: 0; /* imprescindible para que el scroll interno funcione dentro de flex */
  overflow-y: auto;
  padding-right: 4px;
}
.panel__cuerpo::-webkit-scrollbar { width: 6px; }
.panel__cuerpo::-webkit-scrollbar-thumb { background: var(--line-strong); border-radius: 3px; }

.panel__cuerpo--sin-scroll { overflow: hidden; }
.panel__cuerpo--centrado { display: flex; flex-direction: column; align-items: center; justify-content: center; }

.vhf-imagen {
  max-width: 100%;
  max-height: 360px;
  width: auto;
  object-fit: contain;
  border-radius: 4px;
  border: 1px solid var(--line);
  display: block;
  margin: 0 auto;
}

/* ---- Badge de modo demo -------------------------------------------------- */

.badge-demo {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--bg-void);
  background: var(--amber);
  padding: 2px 6px;
  border-radius: 2px;
  vertical-align: middle;
  margin-left: 8px;
}

/* ---- Bandas HF ------------------------------------------------------------ */

.banda-fila {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 5px 0;
  border-bottom: 1px dashed var(--line);
}
.banda-fila:last-child { border-bottom: none; }

.banda-fila__nombre {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 14px;
  color: var(--text);
}

.banda-fila__periodo-doble {
  display: flex;
  gap: 14px;
  font-family: var(--font-display);
  font-size: 10.5px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-dim);
}
.banda-fila__periodo-doble span { display: inline-flex; align-items: center; gap: 5px; }

.estado-punto {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.estado-punto--buena { background: var(--phosphor); box-shadow: 0 0 8px rgba(93,220,133,0.7); }
.estado-punto--regular { background: var(--amber); box-shadow: 0 0 8px rgba(255,180,61,0.6); }
.estado-punto--mala { background: var(--alert); box-shadow: 0 0 8px rgba(224,82,76,0.6); }
.estado-punto--sindatos { background: var(--text-faint); box-shadow: none; }

.indices-solares {
  display: flex;
  gap: 12px;
  margin-top: 8px;
  padding-top: 6px;
  border-top: 1px solid var(--line);
  flex-wrap: wrap;
}

.indice {
  font-family: var(--font-mono);
}
.indice__valor {
  font-size: 17px;
  font-weight: 700;
  color: var(--phosphor);
}
.indice__etiqueta {
  font-size: 9px;
  color: var(--text-faint);
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

/* ---- QRZ / tarjeta de estación --------------------------------------------- */

.tarjeta-qrz {
  display: flex;
  gap: 12px;
  align-items: center;
}
.tarjeta-qrz__foto {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: var(--bg-panel-raised);
  border: 1px solid var(--line-strong);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-size: 20px;
  color: var(--brass);
  flex-shrink: 0;
}
.tarjeta-qrz__nombre { font-weight: 600; }
.tarjeta-qrz__qth { color: var(--text-dim); font-size: 13px; }
.boton {
  display: inline-block;
  margin-top: 12px;
  font-family: var(--font-display);
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--bg-void);
  background: var(--amber);
  padding: 8px 14px;
  border-radius: 3px;
  text-decoration: none;
  border: none;
  cursor: pointer;
}
.boton:hover { background: #ffc35e; }
.boton--fantasma {
  background: transparent;
  color: var(--amber);
  border: 1px solid var(--amber-dim);
}
.boton--chico { margin-top: 8px; padding: 6px 12px; font-size: 10px; }

.separador-panel {
  border-top: 1px dashed var(--line);
  margin: 8px 0;
}

/* ---- eQSL ------------------------------------------------------------------- */

.eqsl-estado {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: var(--radius);
  background: var(--bg-panel-raised);
  border: 1px solid var(--line);
}
.eqsl-estado--hay-nuevas { border-color: var(--phosphor-dim); background: rgba(93,220,133,0.08); }
.eqsl-estado__numero {
  font-family: var(--font-mono);
  font-size: 26px;
  font-weight: 700;
  color: var(--phosphor);
}
.eqsl-estado__texto { font-size: 13px; color: var(--text-dim); }

/* ---- Listas genéricas (satélites, APRS, LDA) --------------------------------- */

.lista-item {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 6px 0;
  border-bottom: 1px dashed var(--line);
  font-size: 13px;
}
.lista-item:last-child { border-bottom: none; }
.lista-item__principal { color: var(--text); font-weight: 500; }
.lista-item__secundario { color: var(--text-dim); font-family: var(--font-mono); font-size: 12px; }
.lista-item__meta { text-align: right; font-family: var(--font-mono); font-size: 12px; color: var(--brass); white-space: nowrap; }

.vacio {
  color: var(--text-faint);
  font-size: 13px;
  font-style: italic;
  padding: 8px 0;
}

/* ---- APRS: lista + mapa propio ------------------------------------------------ */

.aprs-layout {
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: 16px;
  align-items: start;
}

@media (max-width: 720px) {
  .aprs-layout { grid-template-columns: 1fr; }
}

.aprs-mapa {
  height: 240px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--bg-panel-raised);
}

.aprs-lista-scroll {
  max-height: 300px;
  overflow-y: auto;
  padding-right: 4px;
}
.aprs-lista-scroll::-webkit-scrollbar { width: 6px; }
.aprs-lista-scroll::-webkit-scrollbar-thumb { background: var(--line-strong); border-radius: 3px; }

.aprs-leyenda {
  display: flex;
  gap: 18px;
  margin-top: 8px;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-dim);
}
.aprs-leyenda span { display: inline-flex; align-items: center; gap: 6px; }
.aprs-leyenda i { display: inline-block; width: 9px; height: 9px; border-radius: 50%; }
.aprs-leyenda i.marcador-estacion { background: var(--amber); box-shadow: 0 0 6px rgba(255,180,61,0.7); }
.aprs-leyenda i.marcador-aprs { background: var(--phosphor); box-shadow: 0 0 6px rgba(93,220,133,0.7); }

/* ---- Certificados permanentes LDA.ar ---------------------------------------------- */

.certificados-grilla {
  columns: 2;
  column-gap: 24px;
}
@media (max-width: 620px) {
  .certificados-grilla { columns: 1; }
}
.certificado-item {
  display: block;
  break-inside: avoid;
  padding: 7px 0;
  border-bottom: 1px dashed var(--line);
  color: var(--text);
  text-decoration: none;
  font-size: 13px;
}
.certificado-item:hover { color: var(--amber); }
.certificado-item::before { content: "▸ "; color: var(--brass); }

/* ---- Luna / EME ------------------------------------------------------------------ */

.luna-resumen {
  display: flex;
  align-items: center;
  gap: 10px;
}
.luna-icono { font-size: 26px; line-height: 1; }
.luna-nombre { font-weight: 600; font-size: 13.5px; }
.luna-detalle { color: var(--text-dim); font-size: 11px; font-family: var(--font-mono); }

/* Tema oscuro para los tiles y controles de Leaflet */
.aprs-mapa .leaflet-tile-pane { filter: brightness(0.62) invert(1) contrast(0.85) hue-rotate(180deg) saturate(0.6); }
.aprs-mapa .leaflet-container { background: #1b2025; border-radius: var(--radius); font-family: var(--font-mono); }
.aprs-mapa .leaflet-control-zoom a {
  background: var(--bg-panel-raised); color: var(--text); border-color: var(--line) !important;
}
.aprs-mapa .leaflet-control-attribution {
  background: rgba(20,24,28,0.75); color: var(--text-faint);
}
.aprs-mapa .leaflet-control-attribution a { color: var(--text-dim); }
.aprs-mapa .leaflet-popup-content-wrapper {
  background: var(--bg-panel-raised); color: var(--text); border: 1px solid var(--line-strong);
  font-family: var(--font-mono); font-size: 12px;
}
.aprs-mapa .leaflet-popup-tip { background: var(--bg-panel-raised); }

.marcador-estacion {
  width: 16px; height: 16px; border-radius: 50%;
  background: var(--amber); border: 2px solid #14181c;
  box-shadow: 0 0 10px rgba(255,180,61,0.8);
}
.marcador-aprs {
  width: 11px; height: 11px; border-radius: 50%;
  background: var(--phosphor); border: 2px solid #14181c;
  box-shadow: 0 0 6px rgba(93,220,133,0.8);
}

/* ---- WebSDR (solapa "SDR Web") ------------------------------------------------ */

.sdr-lista {
  display: flex;
  flex-direction: column;
}

.sdr-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 4px;
  border-bottom: 1px dashed var(--line);
  text-decoration: none;
  color: var(--text);
}
.sdr-item:last-child { border-bottom: none; }
.sdr-item:hover { background: rgba(255,180,61,0.06); }
.sdr-item:hover .sdr-item__nombre { color: var(--amber); }

.sdr-item__bandera {
  width: 22px;
  height: 16px;
  object-fit: cover;
  border-radius: 2px;
  box-shadow: 0 0 0 1px rgba(255,255,255,0.08);
  flex-shrink: 0;
}

.sdr-item__texto { min-width: 0; flex: 1 1 auto; }

.sdr-item__nombre {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 13px;
  letter-spacing: 0.02em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sdr-item__lugar { color: var(--text-dim); font-weight: 400; text-transform: none; }

.sdr-item__url {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-faint);
}

.sdr-item__flecha {
  font-family: var(--font-mono);
  color: var(--brass);
  flex-shrink: 0;
}

/* ---- Footer ------------------------------------------------------------------ */

.pie {
  margin-top: 28px;
  text-align: center;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-faint);
}
.pie a { color: var(--text-faint); }
