/* ─────────────────────────────────────────────────────────────────────────
   Estado de los servicios · Zemios
   Sin framework. Los tokens de color y los estados son los mismos en toda
   la página: verde = operativo, ámbar = degradado, rojo = caído.
   ───────────────────────────────────────────────────────────────────────── */

:root {
  --page-max: 1160px;

  --bg: #f4f6f9;
  --surface: rgba(255, 255, 255, 0.82);
  --surface-solid: #ffffff;
  --line: #e3e7ed;
  --line-soft: #eef1f5;

  --ink: #0d1117;
  --ink-2: #4b5563;
  --ink-3: #7b8794;

  --ok: #0f8a4d;
  --ok-soft: #e6f5ec;
  --warn: #a46500;
  --warn-soft: #fdf3e0;
  --bad: #c02626;
  --bad-soft: #fdeceb;

  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 1px 2px rgba(13, 17, 23, 0.04), 0 8px 24px -12px rgba(13, 17, 23, 0.12);
}

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

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family:
    ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial,
    "Noto Sans", sans-serif;
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: rgba(47, 109, 246, 0.12);
}

/* Ambiente: color difuso de fondo, sin marco ni bordes. */
.ambient {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(60rem 32rem at 12% -8%, rgba(47, 109, 246, 0.13), transparent 62%),
    radial-gradient(48rem 28rem at 92% 4%, rgba(15, 138, 77, 0.11), transparent 60%),
    radial-gradient(40rem 26rem at 50% 108%, rgba(164, 101, 0, 0.07), transparent 62%);
  filter: blur(12px);
}

h1,
h2,
h3 {
  margin: 0;
  line-height: 1.2;
  letter-spacing: -0.02em;
  font-weight: 650;
}

p {
  margin: 0;
}

a {
  color: inherit;
}

img {
  max-width: 100%;
}

:focus-visible {
  outline: 2px solid #2f6df6;
  outline-offset: 3px;
  border-radius: 4px;
}

/* ── Barra superior: píldora flotante, fija al hacer scroll ────────────── */

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  padding: 12px clamp(16px, 4vw, 32px) 0;
}

.topbar__inner {
  max-width: var(--page-max);
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 18px;
  border: 1px solid rgba(227, 231, 237, 0.9);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.78);
  backdrop-filter: blur(14px) saturate(1.4);
  -webkit-backdrop-filter: blur(14px) saturate(1.4);
  box-shadow: 0 1px 2px rgba(13, 17, 23, 0.04), 0 10px 30px -18px rgba(13, 17, 23, 0.35);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  text-decoration: none;
  color: var(--ink);
}

.brand:hover .brand__logo {
  opacity: 0.72;
}

.brand__logo {
  display: block;
  height: 18px;
  width: auto;
  transition: opacity 0.15s ease;
}

.brand__sep {
  color: var(--ink-3);
}

.brand__page {
  color: var(--ink-2);
  font-weight: 500;
  white-space: nowrap;
}

.topbar__live {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  color: var(--ink-2);
  font-size: 14px;
  white-space: nowrap;
}

.topbar__state {
  font-weight: 560;
}

.topbar__ago {
  color: var(--ink-3);
}

/* ── Estados: punto + texto. El color nunca va solo. ───────────────────── */

.dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  flex: none;
  background: var(--ink-3);
}

.dot--operational {
  background: var(--ok);
}
.dot--degraded {
  background: #d18b00;
}
.dot--outage {
  background: var(--bad);
}
.dot--muted {
  background: var(--ink-3);
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 4px 11px 4px 9px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
}

.pill--operational {
  background: var(--ok-soft);
  color: var(--ok);
}
.pill--degraded {
  background: var(--warn-soft);
  color: var(--warn);
}
.pill--outage {
  background: var(--bad-soft);
  color: var(--bad);
}
.pill--muted {
  background: var(--line-soft);
  color: var(--ink-3);
}

/* ── Página ────────────────────────────────────────────────────────────── */

.page {
  max-width: var(--page-max);
  margin: 0 auto;
  padding: clamp(28px, 6vw, 64px) clamp(16px, 4vw, 32px) 40px;
}

.section {
  margin-top: clamp(32px, 6vw, 56px);
}

.section__title {
  font-size: 19px;
}

.section__hint {
  margin-top: 4px;
  color: var(--ink-3);
  font-size: 14px;
}

.empty {
  color: var(--ink-3);
  font-size: 14px;
}

/* ── Cabecera principal ────────────────────────────────────────────────── */

.hero {
  padding-top: clamp(8px, 2vw, 20px);
}

.hero__eyebrow {
  color: var(--ink-3);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.hero__title {
  margin-top: 10px;
  font-size: clamp(26px, 5vw, 44px);
  letter-spacing: -0.03em;
  text-wrap: balance;
}

.hero__title--ok {
  color: var(--ok);
}
.hero__title--warn {
  color: var(--warn);
}
.hero__title--bad {
  color: var(--bad);
}

.hero__meta {
  margin-top: 10px;
  color: var(--ink-2);
  font-size: 15px;
}

.hero__banner {
  margin-top: 18px;
  padding: 14px 16px;
  border-radius: var(--radius-sm);
  font-size: 15px;
  border: 1px solid transparent;
}

.hero__banner--degraded {
  background: var(--warn-soft);
  border-color: rgba(164, 101, 0, 0.22);
  color: #7a4b00;
}

.hero__banner--outage {
  background: var(--bad-soft);
  border-color: rgba(192, 38, 38, 0.22);
  color: #8f1d1d;
}

/* ── Tarjetas de producto ──────────────────────────────────────────────── */

.products {
  margin-top: 20px;
  display: grid;
  /* 2 columnas: cuatro productos quedan en 2x2, equilibrado y sin que el
     subtítulo de ninguna tarjeta tenga que partirse en dos líneas. */
  grid-template-columns: repeat(auto-fit, minmax(440px, 1fr));
  gap: 16px;
}

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-width: 0;
}

.card__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.card__head > :first-child {
  flex: 1 1 auto;
  min-width: 0;
}

.card__head .pill {
  flex: none;
}

.card__name {
  font-size: 17px;
  font-weight: 640;
  overflow-wrap: anywhere;
}

.card__blurb {
  margin-top: 2px;
  color: var(--ink-3);
  font-size: 14px;
}

.card__list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 2px;
  border-top: 1px solid var(--line-soft);
  padding-top: 12px;
}

.row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 6px 0;
  flex-wrap: wrap;
}

.row__label {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  color: var(--ink-2);
  font-size: 14px;
}

.row__meta {
  color: var(--ink-3);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.row__state {
  font-weight: 560;
  font-size: 13px;
}

.row__state--operational {
  color: var(--ok);
}
.row__state--degraded {
  color: var(--warn);
}
.row__state--outage {
  color: var(--bad);
}

.card__note {
  color: var(--ink-3);
  font-size: 13px;
  padding-top: 2px;
}

.card__link {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  align-self: flex-start;
  min-height: 24px;
  font-size: 14px;
  font-weight: 560;
  text-decoration: none;
  color: var(--ink-2);
}

.card__link:hover {
  color: var(--ink);
  text-decoration: underline;
}

/* ── Paneles ───────────────────────────────────────────────────────────── */

.panel {
  margin-top: 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

/* Disponibilidad */

.table-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.uptime {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.uptime th,
.uptime td {
  padding: 12px 18px;
  text-align: right;
  white-space: nowrap;
}

.uptime th:first-child,
.uptime td:first-child {
  text-align: left;
}

.uptime thead th {
  color: var(--ink-3);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  background: rgba(244, 246, 249, 0.6);
  border-bottom: 1px solid var(--line);
}

.uptime tbody tr + tr td {
  border-top: 1px solid var(--line-soft);
}

.uptime__name {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  font-weight: 560;
}

.uptime__value {
  font-variant-numeric: tabular-nums;
}

.uptime__value--warn {
  color: var(--warn);
}
.uptime__value--bad {
  color: var(--bad);
}

/* Historial */

.history {
  padding: 20px 18px 18px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.history__row {
  display: grid;
  grid-template-columns: 130px 1fr;
  align-items: center;
  gap: 16px;
  padding: 0.4em 1em;
}

.history__row > :last-child {
  min-width: 0;
}

.history__label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 560;
}

.bars {
  display: flex;
  gap: 2px;
  align-items: flex-end;
  overflow-x: auto;
  padding-bottom: 2px;
  scrollbar-width: thin;
}

.bar {
  flex: 1 0 6px;
  height: 30px;
  border-radius: 3px;
  background: var(--ok);
  min-width: 6px;
}

.bar--degraded {
  background: #d18b00;
}
.bar--outage {
  background: var(--bad);
}
.bar--empty {
  background: var(--line-soft);
}

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  padding: 14px 18px;
  border-top: 1px solid var(--line-soft);
  color: var(--ink-3);
  font-size: 13px;
}

.legend__item {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.legend__swatch {
  width: 10px;
  height: 10px;
  border-radius: 3px;
}

/* Incidentes */

.incidents {
  display: flex;
  flex-direction: column;
}

.incident {
  padding: 18px;
  display: flex;
  gap: 14px;
  align-items: flex-start;
}

.incident + .incident {
  border-top: 1px solid var(--line-soft);
}

.incident__body {
  min-width: 0;
  flex: 1;
}

.incident__title {
  font-size: 15px;
  font-weight: 600;
  overflow-wrap: anywhere;
}

.incident__meta {
  margin-top: 2px;
  color: var(--ink-3);
  font-size: 13px;
}

.incident__updates {
  margin: 10px 0 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.incident__update {
  display: flex;
  gap: 10px;
  color: var(--ink-2);
  font-size: 14px;
}

.incident__update time {
  color: var(--ink-3);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  min-width: 108px;
}

.all-good {
  padding: 22px 18px;
  display: flex;
  align-items: center;
  gap: 11px;
  color: var(--ok);
  font-weight: 560;
}

/* ── Pie ───────────────────────────────────────────────────────────────── */

.footer {
  max-width: var(--page-max);
  margin: 0 auto;
  padding: 8px clamp(16px, 4vw, 32px) 48px;
  color: var(--ink-3);
  font-size: 13px;
}

.footer__meta {
  margin-top: 4px;
}

/* ── Adaptación a pantallas medianas ──────────────────────────────────── */

@media (max-width: 900px) {
  .products {
    grid-template-columns: 1fr;
  }
}

/* ── Adaptación a pantallas pequeñas ───────────────────────────────────── */

@media (max-width: 560px) {
  /* La barra se queda solo con el logo: el rótulo "Estado" y la hora estorban. */
  .brand__sep,
  .brand__page,
  .topbar__ago {
    display: none;
  }

  .topbar__inner {
    padding: 8px 14px;
  }

  .card {
    padding: 16px;
  }

  /* La tabla de disponibilidad se convierte en filas apiladas: sin scroll
     horizontal y con la etiqueta de cada ventana a la izquierda. */
  .uptime,
  .uptime tbody,
  .uptime tr,
  .uptime td {
    display: block;
    width: 100%;
  }

  .uptime thead {
    display: none;
  }

  .uptime tbody tr {
    padding: 12px 18px;
    border-top: 1px solid var(--line-soft);
  }

  .uptime tbody tr:first-child {
    border-top: 0;
  }

  .uptime tbody tr + tr td {
    border-top: 0;
  }

  .uptime td {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 16px;
    padding: 3px 0;
    text-align: right;
  }

  .uptime td::before {
    content: attr(data-label);
    color: var(--ink-3);
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    text-align: left;
  }

  .uptime td:first-child {
    padding-bottom: 8px;
  }

  .uptime td:first-child::before {
    display: none;
  }

  /* El histórico: etiqueta arriba y barras debajo. */
  .history__row {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .history {
    padding: 16px 14px 14px;
    gap: 16px;
  }

  .bar {
    flex: 1 0 8px;
    min-width: 8px;
  }

  .legend {
    padding: 12px 14px;
    gap: 12px;
  }

  .incident {
    padding: 16px 14px;
    gap: 10px;
  }

  .incident__update {
    flex-direction: column;
    gap: 2px;
  }

  .incident__update time {
    min-width: 0;
  }
}

@media (max-width: 380px) {
  .brand__logo {
    height: 16px;
  }

  .hero__title {
    font-size: 24px;
  }

  .bar {
    flex: 1 0 6px;
    min-width: 6px;
  }
}

@media (prefers-reduced-motion: reduce) {
  * {
    animation: none !important;
    transition: none !important;
  }
}
