/* Page de statut Vocaway : couleurs de la marque (vert pr-600). Thème du système par défaut, ou choix du visiteur
   (data-theme sur <html>, posé par theme-init.js). */
:root {
  color-scheme: light;
  --bg: #f7f8f6;
  --surface: #ffffff;
  --border: #e2e6df;
  --text: #141513;
  --text-2: #4a5047;
  --muted: #6b7168;
  --brand: #3a7326;
  --up: #3a7326;
  --up-soft: #e9f6e4;
  --degraded: #b54708;
  --degraded-soft: #fef6ee;
  --down: #d92d20;
  --down-soft: #fef3f2;
  --empty: #dfe3dc;
  --loading-soft: #f2f4f1;
}

/* Sombre : choisi par le visiteur, ou thème du système quand il n'a rien choisi. Mêmes valeurs dans les deux blocs. */
:root[data-theme='dark'] {
  color-scheme: dark;
  --bg: #0c0e0b;
  --surface: #141613;
  --border: #262a24;
  --text: #f5f6f4;
  --text-2: #c4c9c0;
  --muted: #8d9389;
  --brand: #6cbf4f;
  --up: #55a938;
  --up-soft: #16260f;
  --degraded: #f79009;
  --degraded-soft: #2b1b07;
  --down: #f04438;
  --down-soft: #2d1210;
  --empty: #2a2f27;
  --loading-soft: #1b1e19;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) {
    color-scheme: dark;
    --bg: #0c0e0b;
    --surface: #141613;
    --border: #262a24;
    --text: #f5f6f4;
    --text-2: #c4c9c0;
    --muted: #8d9389;
    --brand: #6cbf4f;
    --up: #55a938;
    --up-soft: #16260f;
    --degraded: #f79009;
    --degraded-soft: #2b1b07;
    --down: #f04438;
    --down-soft: #2d1210;
    --empty: #2a2f27;
    --loading-soft: #1b1e19;
  }
}

* {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 Inter, ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}

a {
  color: inherit;
}

h1,
h2,
p {
  margin: 0;
}

.wrap {
  width: 100%;
  max-width: 820px;
  margin: 0 auto;
  padding: 0 16px;
}

.muted {
  color: var(--muted);
}

.top {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.top-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}

.logo img {
  display: block;
  height: 24px;
  width: auto;
}

/* Logo clair ou sombre selon le thème effectif. */
.logo-dark {
  display: none !important;
}
:root[data-theme='dark'] .logo-light {
  display: none !important;
}
:root[data-theme='dark'] .logo-dark {
  display: block !important;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) .logo-light {
    display: none !important;
  }
  :root:not([data-theme='light']) .logo-dark {
    display: block !important;
  }
}

.controls {
  display: flex;
  align-items: center;
  gap: 8px;
}

.top-label {
  margin-inline-end: 8px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-2);
}

.lang select {
  height: 36px;
  padding: 0 28px 0 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface)
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236b7168' stroke-width='2'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E")
    no-repeat right 10px center;
  color: var(--text);
  font: inherit;
  font-size: 14px;
  appearance: none;
  cursor: pointer;
}
[dir='rtl'] .lang select {
  padding: 0 10px 0 28px;
  background-position: left 10px center;
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text-2);
  cursor: pointer;
}
.icon-btn:hover,
.lang select:hover {
  border-color: var(--muted);
}
.icon-btn:focus-visible,
.lang select:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--brand) 35%, transparent);
  outline-offset: 1px;
}
.icon-btn svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
/* Lune en clair (passer en sombre), soleil en sombre (passer en clair). */
.icon-sun {
  display: none;
}
:root[data-theme='dark'] .icon-sun {
  display: block;
}
:root[data-theme='dark'] .icon-moon {
  display: none;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) .icon-sun {
    display: block;
  }
  :root:not([data-theme='light']) .icon-moon {
    display: none;
  }
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

@media (max-width: 600px) {
  .top-label {
    display: none;
  }
}

main {
  display: flex;
  flex-direction: column;
  gap: 20px;
  padding-top: 32px !important;
}

/* Annonces (maintenance prévue, incident, information) */
.announcements {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.announcements:empty {
  display: none;
}
.announcement {
  padding: 16px 20px;
  border: 1px solid var(--border);
  border-inline-start: 4px solid var(--brand);
  border-radius: 12px;
  background: var(--surface);
}
.announcement[data-kind='MAINTENANCE'] {
  border-inline-start-color: var(--degraded);
}
.announcement[data-kind='INCIDENT'] {
  border-inline-start-color: var(--down);
}
.announcement-kind {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}
.announcement-title {
  margin: 2px 0 4px;
  font-size: 16px;
  font-weight: 600;
}
.announcement-body {
  margin: 0;
  font-size: 14px;
  color: var(--text-2);
  white-space: pre-line;
}
.announcement-when {
  margin-top: 6px;
  font-size: 13px;
  color: var(--muted);
}

/* Bandeau d'état global */
.overall {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 20px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--loading-soft);
}

.overall h1 {
  font-size: 18px;
  line-height: 26px;
  font-weight: 600;
}

.overall p {
  font-size: 14px;
  color: var(--text-2);
}

.overall-dot {
  flex: none;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--muted);
}

.overall[data-state='up'] {
  background: var(--up-soft);
  border-color: color-mix(in srgb, var(--up) 35%, transparent);
}
.overall[data-state='up'] .overall-dot {
  background: var(--up);
  box-shadow: 0 0 0 5px color-mix(in srgb, var(--up) 20%, transparent);
}
.overall[data-state='degraded'] {
  background: var(--degraded-soft);
  border-color: color-mix(in srgb, var(--degraded) 35%, transparent);
}
.overall[data-state='degraded'] .overall-dot {
  background: var(--degraded);
}
.overall[data-state='down'],
.overall[data-state='error'] {
  background: var(--down-soft);
  border-color: color-mix(in srgb, var(--down) 35%, transparent);
}
.overall[data-state='down'] .overall-dot,
.overall[data-state='error'] .overall-dot {
  background: var(--down);
}

/* Cartes */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px;
}

.card-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 4px;
}

.card-head h2 {
  font-size: 16px;
  font-weight: 600;
}

.card-head .muted {
  font-size: 13px;
}

/* Services */
.services,
.incidents {
  list-style: none;
  margin: 0;
  padding: 0;
}

.service {
  padding: 16px 0;
  border-bottom: 1px solid var(--border);
}

.service:last-child {
  border-bottom: 0;
}

.service-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.service-name {
  font-weight: 600;
}

.service-meta {
  font-size: 13px;
  color: var(--muted);
}

.pill {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  background: var(--loading-soft);
  color: var(--muted);
}
.pill::before {
  content: '';
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
}
.pill[data-state='up'] {
  background: var(--up-soft);
  color: var(--up);
}
.pill[data-state='degraded'] {
  background: var(--degraded-soft);
  color: var(--degraded);
}
.pill[data-state='down'] {
  background: var(--down-soft);
  color: var(--down);
}

.bars {
  display: flex;
  gap: 2px;
  height: 32px;
}

.bar {
  flex: 1 1 0;
  min-width: 0;
  border-radius: 2px;
  background: var(--empty);
}
.bar[data-state='up'] {
  background: var(--up);
}
.bar[data-state='degraded'] {
  background: var(--degraded);
}
.bar[data-state='down'] {
  background: var(--down);
}

.legend {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 8px;
  font-size: 12px;
  color: var(--muted);
}

.legend-30 {
  display: none;
}

.legend-keys {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  justify-content: center;
  gap: 4px 10px;
}

.key {
  display: inline-block;
  width: 9px;
  height: 9px;
  margin-inline-end: -6px;
  border-radius: 2px;
  background: var(--empty);
}
.key[data-state='up'] {
  background: var(--up);
}
.key[data-state='degraded'] {
  background: var(--degraded);
}
.key[data-state='down'] {
  background: var(--down);
}

/* Sur mobile : 30 derniers jours, pour garder des barres lisibles. */
@media (max-width: 600px) {
  .bar:nth-child(-n + 60) {
    display: none;
  }
  .legend-90 {
    display: none;
  }
  .legend-30 {
    display: inline;
  }
  .legend-keys {
    display: none;
  }
}

/* Incidents */
.incident {
  display: flex;
  gap: 12px;
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
}

.incident:last-child {
  border-bottom: 0;
}

.incident-dot {
  flex: none;
  width: 8px;
  height: 8px;
  margin-top: 7px;
  border-radius: 50%;
  background: var(--down);
}
.incident-dot[data-state='degraded'] {
  background: var(--degraded);
}
.incident-dot[data-resolved='true'] {
  background: var(--muted);
}

.incident-title {
  font-weight: 600;
}

.incident-meta {
  color: var(--muted);
  font-size: 13px;
}

.empty {
  padding: 14px 0 4px;
  font-size: 14px;
  color: var(--muted);
}

.footer-note {
  font-size: 13px;
  text-align: center;
}

.footer {
  display: flex;
  justify-content: center;
  gap: 8px;
  padding: 24px 16px 40px !important;
  font-size: 13px;
}

.footer a {
  text-decoration: none;
}
.footer a:hover {
  text-decoration: underline;
}
