/*
  Sitio web desarrollado para Bio-Bio TV por Nikolay Stagnaro, con el apoyo de Jorge Ramírez.
  Última actualización: 2026-06-25
*/
@font-face {
  font-family: 'Prometo';
  src: url('fonts/fonnts.com-Prometo.otf') format('opentype');
  font-style: normal;
  font-weight: 400;
  font-display: swap;
}

@font-face {
  font-family: 'Prometo';
  src: url('fonts/fonnts.com-Prometo_Medium.otf') format('opentype');
  font-style: normal;
  font-weight: 500;
  font-display: swap;
}

@font-face {
  font-family: 'Prometo';
  src: url('fonts/fonnts.com-Prometo_Bold.otf') format('opentype');
  font-style: normal;
  font-weight: 700;
  font-display: swap;
}

@font-face {
  font-family: 'Prometo';
  src: url('fonts/fonnts.com-Prometo_XBold.otf') format('opentype');
  font-style: normal;
  font-weight: 800 900;
  font-display: swap;
}

:root {
  --alert: #d9272e;
  --alert-dark: #a9151b;
  --panel: rgba(10, 22, 34, 0.94);
  --panel-solid: #0a1622;
  --screen-bg: rgba(3, 10, 18, 0.88);
  --text: #ffffff;
  --muted: #b9c6d2;
  --yellow: #ffcc2f;
  --line: rgba(255, 255, 255, 0.16);
  --safe-x: clamp(20px, 4vw, 84px);
  --safe-y: clamp(18px, 4vh, 64px);
  --gap: clamp(18px, 2.4vw, 42px);
}

* { box-sizing: border-box; }

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  background: transparent !important;
  font-family: 'Prometo', Arial, Helvetica, sans-serif;
}

body {
  position: relative;
}

.earthquake-overlay {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  height: 100svh;
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(560px, 1.55fr) minmax(300px, 0.75fr);
  grid-template-rows: auto 1fr auto;
  gap: var(--gap);
  padding: var(--safe-y) var(--safe-x);
  background:
    linear-gradient(90deg, rgba(3, 10, 18, 0.98) 0%, rgba(3, 10, 18, 0.94) 58%, rgba(3, 10, 18, 0.78) 100%),
    var(--screen-bg);
  color: var(--text);
  opacity: 1;
  transform: translateY(0);
  transition: opacity 250ms ease, transform 250ms ease;
}

.earthquake-overlay::before {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(circle at 16% 16%, rgba(217, 39, 46, 0.22), transparent 30%),
    linear-gradient(135deg, transparent 0 48%, rgba(255, 255, 255, 0.045) 48% 49%, transparent 49% 100%);
}

.earthquake-overlay::after {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: clamp(10px, 1vw, 20px);
  background: var(--alert);
  box-shadow: 0 0 32px rgba(217, 39, 46, 0.56);
}

.earthquake-overlay.hidden {
  opacity: 0;
  transform: translateY(12px);
}

.info-panel,
.map-panel {
  position: relative;
  z-index: 1;
}

.info-panel {
  grid-column: 1 / 2;
  grid-row: 1 / 4;
  min-width: 0;
  display: grid;
  grid-template-rows: auto auto auto auto 1fr auto;
  align-content: stretch;
  gap: clamp(18px, 2.6vh, 42px);
  padding: clamp(28px, 4vw, 74px);
  border: 1px solid var(--line);
  border-left: clamp(8px, 0.8vw, 16px) solid var(--alert);
  background: linear-gradient(180deg, rgba(10, 22, 34, 0.96), rgba(10, 22, 34, 0.86));
  box-shadow: 0 22px 70px rgba(0, 0, 0, 0.42);
  overflow: hidden;
}

.info-panel::before {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  height: 4px;
  background: linear-gradient(90deg, var(--yellow), var(--alert));
}

.tag {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: fit-content;
  max-width: 100%;
  padding: clamp(10px, 1.1vw, 18px) clamp(14px, 1.55vw, 28px);
  border-left: clamp(6px, 0.6vw, 12px) solid var(--yellow);
  background: var(--alert);
  color: #fff;
  font-size: clamp(16px, 1.35vw, 30px);
  font-weight: 900;
  line-height: 1;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  white-space: nowrap;
}

.mag-row {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: clamp(16px, 2vw, 34px);
  align-items: center;
  min-width: 0;
}

.magnitude {
  min-width: clamp(112px, 10vw, 210px);
  padding: clamp(18px, 2vw, 34px) clamp(14px, 1.5vw, 28px);
  background: linear-gradient(180deg, var(--alert), var(--alert-dark));
  color: #fff;
  text-align: center;
  font-size: clamp(54px, 6.3vw, 128px);
  font-weight: 900;
  line-height: 0.95;
  letter-spacing: -0.06em;
  box-shadow: 0 14px 38px rgba(217, 39, 46, 0.3);
  transition: opacity 220ms ease, transform 220ms ease;
}

.headline {
  min-width: 0;
  font-size: clamp(42px, 5.4vw, 104px);
  font-weight: 900;
  line-height: 0.98;
  letter-spacing: -0.045em;
  overflow-wrap: anywhere;
  text-wrap: balance;
  transition: opacity 220ms ease, transform 220ms ease;
}

.detail {
  width: fit-content;
  max-width: 100%;
  color: #e8eff5;
  font-size: clamp(28px, 3.1vw, 64px);
  font-weight: 800;
  line-height: 1.05;
  white-space: normal;
}

#time {
  color: var(--yellow);
  font-size: clamp(38px, 4.4vw, 88px);
  letter-spacing: -0.04em;
}

.meta {
  align-self: end;
  display: flex;
  gap: clamp(8px, 0.9vw, 16px);
  align-items: center;
  max-width: 100%;
  color: var(--muted);
  font-size: clamp(15px, 1.25vw, 26px);
  font-weight: 600;
  line-height: 1.2;
}

.status-dot {
  flex: 0 0 auto;
  width: clamp(12px, 1vw, 20px);
  height: clamp(12px, 1vw, 20px);
  border-radius: 50%;
  background: #42d681;
  box-shadow: 0 0 14px rgba(66, 214, 129, 0.8);
}

.status-dot.error {
  background: var(--yellow);
  box-shadow: 0 0 14px rgba(255, 204, 47, 0.7);
}

.changing {
  opacity: 0;
  transform: translateY(10px);
}

.map-panel {
  grid-column: 2 / 3;
  grid-row: 1 / 4;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  background: #08131e;
  box-shadow: 0 18px 54px rgba(0, 0, 0, 0.28);
}

.map-panel::before {
  content: 'UBICACIÓN REFERENCIAL';
  position: absolute;
  left: clamp(14px, 1.3vw, 28px);
  top: clamp(14px, 1.3vw, 28px);
  z-index: 701;
  padding: clamp(8px, 0.8vw, 14px) clamp(11px, 1.1vw, 20px);
  background: rgba(10, 22, 34, 0.88);
  color: #fff;
  border-left: clamp(4px, 0.4vw, 8px) solid var(--alert);
  font-size: clamp(11px, 0.82vw, 18px);
  font-weight: 900;
  line-height: 1;
  letter-spacing: 0.04em;
}

#map {
  width: 100%;
  height: 100%;
  background: #08131e;
}

.leaflet-container {
  background: #08131e;
  font-family: 'Prometo', Arial, Helvetica, sans-serif;
}

.custom-quake-marker {
  position: relative;
  width: clamp(22px, 1.9vw, 40px);
  height: clamp(22px, 1.9vw, 40px);
  border: clamp(3px, 0.28vw, 6px) solid #ffffff;
  border-radius: 50%;
  background: var(--alert);
  box-shadow: 0 0 30px rgba(217, 39, 46, 0.98);
}

.custom-quake-marker::before,
.custom-quake-marker::after {
  content: '';
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  background: #ffffff;
}

.custom-quake-marker::before {
  width: 180%;
  height: clamp(2px, 0.22vw, 5px);
}

.custom-quake-marker::after {
  width: clamp(2px, 0.22vw, 5px);
  height: 180%;
}

.map-coordinates {
  position: absolute;
  left: clamp(14px, 1.3vw, 28px);
  bottom: clamp(14px, 1.3vw, 28px);
  z-index: 700;
  max-width: calc(100% - 28px);
  padding: clamp(8px, 0.8vw, 14px) clamp(10px, 1vw, 18px);
  background: rgba(10, 22, 34, 0.88);
  color: #ffffff;
  font-family: 'Prometo', Arial, Helvetica, sans-serif;
  font-size: clamp(11px, 0.82vw, 18px);
  font-weight: 800;
  line-height: 1;
  letter-spacing: 0.02em;
  border-left: clamp(4px, 0.4vw, 8px) solid var(--alert);
}

@media (min-aspect-ratio: 21/9) {
  .earthquake-overlay {
    grid-template-columns: minmax(760px, 1.75fr) minmax(320px, 0.65fr);
  }
}

@media (max-width: 1080px) {
  .earthquake-overlay {
    grid-template-columns: 1fr;
    grid-template-rows: minmax(0, auto) minmax(190px, 0.42fr);
  }

  .info-panel {
    grid-column: 1;
    grid-row: 1;
  }

  .map-panel {
    grid-column: 1;
    grid-row: 2;
    min-height: 28vh;
  }
}

@media (max-width: 720px) {
  :root {
    --safe-x: 14px;
    --safe-y: 14px;
    --gap: 12px;
  }

  .earthquake-overlay {
    height: 100dvh;
  }

  .info-panel {
    padding: 18px;
    gap: 14px;
  }

  .mag-row {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .magnitude {
    width: fit-content;
    min-width: 110px;
    font-size: clamp(42px, 14vw, 76px);
  }

  .headline {
    font-size: clamp(32px, 10vw, 54px);
  }

  .detail {
    font-size: clamp(21px, 6vw, 34px);
  }

  #time {
    font-size: clamp(28px, 9vw, 48px);
  }

  .map-panel {
    min-height: 26vh;
  }
}

@media (max-height: 560px) and (orientation: landscape) {
  .earthquake-overlay {
    grid-template-columns: minmax(0, 1.45fr) minmax(160px, 0.55fr);
    grid-template-rows: 1fr;
    padding: 12px 18px;
    gap: 14px;
  }

  .info-panel,
  .map-panel {
    grid-row: 1;
  }

  .info-panel {
    grid-column: 1;
    padding: 18px;
    gap: 10px;
  }

  .map-panel {
    grid-column: 2;
    min-height: 0;
  }

  .tag { font-size: clamp(12px, 2vw, 16px); }
  .magnitude { font-size: clamp(34px, 6vw, 54px); min-width: 92px; padding: 14px; }
  .headline { font-size: clamp(26px, 5vw, 42px); }
  .detail { font-size: clamp(18px, 3.4vw, 28px); }
  #time { font-size: clamp(24px, 4.4vw, 36px); }
  .meta { font-size: 12px; }
}

/* Fuerza el uso de Prometo en todo el overlay, incluido Leaflet.
   Los archivos de fuente deben cargarse en /fonts con los nombres indicados en el README. */
*,
*::before,
*::after,
.leaflet-container,
.leaflet-container *,
.leaflet-popup-content {
  font-family: 'Prometo', Arial, Helvetica, sans-serif !important;
}
