:root {
  --bg: #0f1420;
  --surface: #171e2e;
  --surface-alt: #1e2740;
  --ink: #e8eaf0;
  --muted: #8791a8;
  --divider: #2a3350;

  --up: #3ddc97;
  --down: #ff5c72;
  --maintenance: #f5a623;
  --suspended: #9d7bff;

  --font-display: "Fraunces", Georgia, serif;
  --font-body: "IBM Plex Sans", system-ui, sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, monospace;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  line-height: 1.5;
}

a { color: inherit; }

/* === MASTHEAD === */
.masthead {
  border-bottom: 1px solid var(--divider);
  padding: 48px 24px 32px;
  background:
    radial-gradient(600px 220px at 12% -10%, rgba(61, 220, 151, 0.12), transparent 70%),
    var(--bg);
}

.masthead-inner { max-width: 880px; margin: 0 auto; }

.masthead-title {
  display: flex;
  align-items: center;
  gap: 12px;
}

.masthead-title h1 {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: clamp(1.8rem, 4vw, 2.6rem);
  margin: 0;
  letter-spacing: -0.01em;
}

.masthead-sub {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 0.95rem;
}

.masthead-meta {
  margin-top: 20px;
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}

.summary-pill {
  font-family: var(--font-mono);
  font-size: 0.82rem;
  padding: 5px 12px;
  border-radius: 999px;
  border: 1px solid var(--divider);
  background: var(--surface);
  color: var(--muted);
}

.summary-pill[data-state="all-ok"] { color: var(--up); border-color: color-mix(in srgb, var(--up) 35%, var(--divider)); }
.summary-pill[data-state="incident"] { color: var(--down); border-color: color-mix(in srgb, var(--down) 35%, var(--divider)); }

.updated-at {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--muted);
}

.live-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--up);
  box-shadow: 0 0 0 0 rgba(61, 220, 151, 0.6);
  animation: pulse 2.2s infinite;
  flex: none;
}

@keyframes pulse {
  0%   { box-shadow: 0 0 0 0 rgba(61, 220, 151, 0.55); }
  70%  { box-shadow: 0 0 0 8px rgba(61, 220, 151, 0); }
  100% { box-shadow: 0 0 0 0 rgba(61, 220, 151, 0); }
}

@media (prefers-reduced-motion: reduce) {
  .live-dot { animation: none; }
}

/* === OFFLINE BANNER === */
.offline-banner {
  display: none;
  max-width: 880px;
  margin: 20px auto 0;
  padding: 10px 16px;
  border: 1px solid color-mix(in srgb, var(--maintenance) 40%, var(--divider));
  background: color-mix(in srgb, var(--maintenance) 10%, var(--surface));
  color: var(--maintenance);
  border-radius: 6px;
  font-size: 0.85rem;
}

.offline-banner.visible { display: block; }

/* === CATEGORIES === */
main {
  max-width: 880px;
  margin: 0 auto;
  padding: 40px 24px 60px;
}

.loading-msg { color: var(--muted); font-family: var(--font-mono); font-size: 0.9rem; }

.category-card {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--divider);
  border-radius: 4px;
  margin-top: 34px;
}

.category-card:first-child { margin-top: 22px; }

.category-tab {
  position: absolute;
  top: -23px;
  left: 18px;
  margin: 0;
  background: var(--surface-alt);
  border: 1px solid var(--divider);
  border-bottom: none;
  border-radius: 6px 8px 0 0;
  padding: 7px 16px 9px;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1rem;
  color: var(--ink);
}

.category-tab::after {
  content: "";
  position: absolute;
  top: 0;
  right: -1px;
  width: 10px;
  height: 100%;
  background: var(--bg);
  clip-path: polygon(0 0, 100% 0, 0 100%);
  border-right: 1px solid var(--divider);
}

.service-list { padding-top: 8px; }

.service-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 18px;
  border-bottom: 1px solid var(--divider);
  flex-wrap: wrap;
}

.service-row:last-child { border-bottom: none; }

.service-name {
  font-size: 0.95rem;
}

.service-name a {
  text-decoration: none;
  border-bottom: 1px dotted var(--muted);
}

.service-name a:hover { color: var(--up); border-color: var(--up); }

.status-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex: none;
}

.status-dot[data-state="up"] { background: var(--up); }
.status-dot[data-state="down"] { background: var(--down); }
.status-dot[data-state="maintenance"] { background: var(--maintenance); }
.status-dot[data-state="suspended"] { background: var(--suspended); }

.status-dot[data-unconfirmed="true"] {
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--maintenance) 45%, transparent);
}

.status-label[data-state="up"] { color: var(--up); }
.status-label[data-state="down"] { color: var(--down); }
.status-label[data-state="maintenance"] { color: var(--maintenance); }
.status-label[data-state="suspended"] { color: var(--suspended); }

.status-latency {
  font-family: var(--font-mono);
  color: var(--muted);
  font-size: 0.78rem;
}

.service-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.history-btn {
  background: transparent;
  border: 1px solid var(--divider);
  color: var(--muted);
  border-radius: 6px;
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 0.9rem;
  transition: border-color 0.15s, color 0.15s, background 0.15s;
}

.history-btn:hover {
  color: var(--ink);
  border-color: var(--up);
  background: var(--surface-alt);
}

/* === MODAL HISTORIQUE === */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(6, 9, 16, 0.72);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 100;
}

.modal-overlay[hidden] { display: none; }

.modal {
  background: var(--surface);
  border: 1px solid var(--divider);
  border-radius: 8px;
  width: 100%;
  max-width: 460px;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  padding: 20px 22px 22px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.modal-header h3 {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.15rem;
  margin: 0;
}

.modal-close {
  background: transparent;
  border: none;
  color: var(--muted);
  font-size: 1.1rem;
  cursor: pointer;
  line-height: 1;
  padding: 4px;
}

.modal-close:hover { color: var(--ink); }

.modal-sub {
  margin: 4px 0 14px;
  color: var(--muted);
  font-size: 0.78rem;
  font-family: var(--font-mono);
}

.modal-body {
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.incident-row {
  border: 1px solid var(--divider);
  border-radius: 6px;
  padding: 10px 12px;
  font-size: 0.85rem;
}

.incident-type {
  font-weight: 600;
  font-size: 0.8rem;
  display: inline-block;
  margin-bottom: 4px;
}

.incident-type[data-state="down"] { color: var(--down); }
.incident-type[data-state="maintenance"] { color: var(--maintenance); }
.incident-type[data-state="suspended"] { color: var(--suspended); }

.incident-time {
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 0.76rem;
}

.incident-detail {
  color: var(--muted);
  font-size: 0.78rem;
  margin-top: 4px;
}

.modal-empty {
  color: var(--muted);
  font-size: 0.85rem;
  text-align: center;
  padding: 24px 0;
}

/* === FOOTER === */
.site-footer {
  max-width: 880px;
  margin: 0 auto;
  padding: 0 24px 40px;
  color: var(--muted);
  font-size: 0.8rem;
}

/* === RESPONSIVE === */
@media (max-width: 520px) {
  .masthead { padding: 36px 18px 26px; }
  main { padding: 32px 18px 48px; }
  .service-row { padding: 12px 14px; }
}

/* Focus visibility */
a:focus-visible, button:focus-visible {
  outline: 2px solid var(--up);
  outline-offset: 2px;
}
