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

:root {
  --bg: #070319;
  --bg-secondary: rgba(14, 8, 44, 0.6);
  --panel: rgba(21, 14, 56, 0.85);
  --panel-border: rgba(138, 108, 255, 0.35);
  --text: #f5f7ff;
  --muted: #a7adff;
  --green: #2de8b5;
  --orange: #ffad5a;
  --red: #ff477e;
  --unknown: #7e86a6;
  --shadow: 0 20px 50px rgba(0, 0, 0, 0.35);
  --glow: 0 0 30px rgba(120, 75, 255, 0.4);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Chakra Petch", "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  background: radial-gradient(circle at 20% 20%, rgba(90, 0, 200, 0.2), transparent 55%),
    radial-gradient(circle at 80% 0%, rgba(0, 236, 188, 0.18), transparent 45%), var(--bg);
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
}

.background-grid {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image: linear-gradient(rgba(148, 121, 255, 0.06) 1px, transparent 1px),
    linear-gradient(90deg, rgba(148, 121, 255, 0.06) 1px, transparent 1px);
  background-size: 60px 60px;
  opacity: 0.7;
  filter: blur(0.3px);
  z-index: -2;
}

.background-orb {
  position: fixed;
  width: 500px;
  height: 500px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(120, 75, 255, 0.65), transparent 70%);
  top: -180px;
  right: -150px;
  filter: blur(5px);
  z-index: -3;
  animation: float 20s ease-in-out infinite;
}

@keyframes float {
  0%,
  100% {
    transform: translate3d(0, 0, 0);
  }
  50% {
    transform: translate3d(-40px, 30px, 0);
  }
}

.hero {
  padding: 6rem clamp(2rem, 5vw, 6rem) 3rem;
  position: relative;
  text-align: left;
  max-width: 1200px;
  margin: 0 auto;
}

.hero__badge {
  display: inline-flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.35rem 0.9rem;
  background: linear-gradient(135deg, rgba(45, 232, 181, 0.45), rgba(81, 96, 255, 0.55));
  border: 1px solid rgba(79, 56, 255, 0.6);
  border-radius: 999px;
  font-size: 0.85rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text);
  box-shadow: var(--glow);
}

.hero h1 {
  font-size: clamp(3rem, 6vw, 5rem);
  font-weight: 700;
  line-height: 1.05;
  margin: 1.5rem 0 1rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.hero h1 span {
  color: #8f6bff;
  text-shadow: 0 0 40px rgba(143, 107, 255, 0.7);
}

.hero p {
  font-size: 1.1rem;
  color: var(--muted);
  margin-bottom: 2rem;
}

.hero__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem 1.5rem;
  font-family: "JetBrains Mono", monospace;
  font-size: 0.95rem;
  color: var(--muted);
}

main {
  position: relative;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 clamp(1.5rem, 4vw, 4rem) 5rem;
  display: grid;
  gap: 3rem;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: 30px;
  padding: clamp(1.5rem, 3vw, 2.5rem);
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
}

.panel::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 30px;
  border: 1px solid rgba(45, 232, 181, 0.05);
  pointer-events: none;
}

.panel h2 {
  margin: 0 0 1.2rem;
  font-size: 1.7rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1.2rem;
  font-family: "JetBrains Mono", monospace;
  font-size: 0.85rem;
}

.legend__item {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.35rem 0.75rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.legend__item::before {
  content: "";
  width: 0.85rem;
  height: 0.85rem;
  border-radius: 999px;
  background: currentColor;
}

.legend__item--green {
  color: var(--green);
}

.legend__item--orange {
  color: var(--orange);
}

.legend__item--red {
  color: var(--red);
}

.legend__item--unknown {
  color: var(--unknown);
}

.services {
  display: grid;
  gap: 2.5rem;
}

.service-card {
  display: grid;
  gap: 1.5rem;
  padding: clamp(1.5rem, 4vw, 3rem);
  border-radius: 28px;
  border: 1px solid rgba(79, 56, 255, 0.35);
  background: linear-gradient(135deg, rgba(19, 12, 49, 0.9), rgba(18, 7, 41, 0.75));
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
}

.service-card::before {
  content: attr(data-service-code);
  position: absolute;
  font-family: "JetBrains Mono", monospace;
  font-size: 0.75rem;
  top: 1.2rem;
  right: 1.5rem;
  letter-spacing: 0.3em;
  color: rgba(255, 255, 255, 0.2);
}

.service-card__header {
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
}

.service-card h4 {
  margin: 0.5rem 0 0.2rem;
  font-size: 0.95rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.7);
}

.service-card__title {
  font-size: clamp(1.8rem, 3vw, 2.3rem);
  margin: 0;
}

.service-card__subtitle {
  font-family: "JetBrains Mono", monospace;
  font-size: 0.95rem;
  color: var(--muted);
}

.status-pill {
  align-self: flex-start;
  padding: 0.35rem 0.9rem;
  border-radius: 999px;
  font-family: "JetBrains Mono", monospace;
  font-size: 0.85rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  border: 1px solid transparent;
}

.status-pill--up {
  background: rgba(45, 232, 181, 0.15);
  border-color: rgba(45, 232, 181, 0.6);
  color: var(--green);
  box-shadow: 0 0 15px rgba(45, 232, 181, 0.25);
}

.status-pill--down {
  background: rgba(255, 71, 126, 0.12);
  border-color: rgba(255, 71, 126, 0.55);
  color: var(--red);
  box-shadow: 0 0 15px rgba(255, 71, 126, 0.2);
}

.status-pill--unknown {
  background: rgba(126, 134, 166, 0.12);
  border-color: rgba(126, 134, 166, 0.3);
  color: var(--unknown);
}

.service-card__metrics {
  display: grid;
  gap: 0.9rem;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  padding: 1.2rem;
  border-radius: 18px;
  background: rgba(10, 6, 29, 0.75);
  border: 1px solid rgba(145, 115, 255, 0.18);
}

.metric {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.metric span:first-child {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  color: rgba(255, 255, 255, 0.45);
}

.metric span:last-child {
  font-family: "JetBrains Mono", monospace;
  font-size: 1rem;
  color: var(--text);
}

.timeline {
  display: grid;
  grid-template-columns: 120px 1fr max-content; /* label | barre | uptime */
  align-items: center;
  row-gap: 0.75rem;
  column-gap: 1rem;
}

.day-row {
  display: contents; /* remplace le flex d’origine */
}

.day-row__label {
  font-family: "JetBrains Mono", monospace;
  font-size: 0.85rem;
  color: rgba(255, 255, 255, 0.6);
  margin: 0;
}

.day-row__line {
  width: 100%;               /* prend toute la colonne centrale */
  height: 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.18);
  position: relative;
  overflow: hidden;
}

.day-row__line::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: var(--line-color, rgba(255, 255, 255, 0.2));
  box-shadow: 0 0 18px var(--line-color, transparent);
  transform-origin: left;
  transform: scaleX(var(--uptime, 1));
  transition: transform 0.6s ease;
}

.day-row__meta {
  justify-self: end;
  white-space: nowrap;        /* évite les retours à la ligne */
  font-family: "JetBrains Mono", monospace;
  font-size: 0.8rem;
  color: rgba(255, 255, 255, 0.55);
  /* IMPORTANT : supprime l’ancienne largeur forcée */
  max-width: none;
}

.day-tooltip {
  position: fixed;
  z-index: 30;
  pointer-events: none;
  max-width: 260px;
  padding: 0.75rem 1rem;
  border-radius: 12px;
  background: rgba(21, 14, 56, 0.92);
  border: 1px solid rgba(138, 108, 255, 0.4);
  box-shadow: 0 15px 35px rgba(0, 0, 0, 0.3);
  font-family: "JetBrains Mono", monospace;
  font-size: 0.75rem;
  color: var(--text);
  opacity: 0;
  transform: translate3d(0, 10px, 0);
  transition: opacity 0.15s ease, transform 0.15s ease;
}

.day-tooltip[hidden] {
  display: none;
}

.day-tooltip--visible {
  opacity: 1;
  transform: translate3d(0, 0, 0);
}

.day-tooltip__title {
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  margin-bottom: 0.5rem;
  color: var(--muted);
}

.day-tooltip__list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.45rem;
}

.day-tooltip__item {
  line-height: 1.4;
}

.day-tooltip__notes {
  margin-top: 0.2rem;
  font-size: 0.7rem;
  color: rgba(255, 255, 255, 0.6);
}

.day-tooltip__empty {
  color: rgba(255, 255, 255, 0.7);
}

[data-state="green"] {
  --line-color: var(--green);
}

[data-state="orange"] {
  --line-color: var(--orange);
}

[data-state="red"] {
  --line-color: var(--red);
}

[data-state="unknown"] {
  --line-color: rgba(255, 255, 255, 0.15);
}

.toast {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  padding: 1rem 1.5rem;
  background: rgba(255, 71, 126, 0.9);
  color: var(--text);
  border-radius: 14px;
  font-family: "JetBrains Mono", monospace;
  font-size: 0.85rem;
  box-shadow: 0 20px 40px rgba(255, 71, 126, 0.3);
  z-index: 10;
}

@media (max-width: 900px) {
  .hero {
    padding: 4.5rem clamp(1.5rem, 6vw, 3rem) 2.5rem;
  }

  .timeline {
    display: grid;
    grid-template-columns: 110px 1fr max-content; /* date | barre | % */
    column-gap: 0.75rem;
    row-gap: 0.6rem;
    align-items: center;
  }

  /* chaque .day-row “se fond” dans la grille par ligne */
  .day-row { display: contents; }

  .day-row__label {
    font-size: 0.85rem;
    text-align: left;
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .day-row__line {
    width: 100%;
    height: 10px;
    margin: 0;
  }

  .day-row__meta {
    justify-self: end;
    white-space: nowrap;
    font-size: 0.75rem;
    max-width: none; /* supprime toute largeur forcée */
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* wrap agressif dans la tooltip */
.day-tooltip__item,
.day-tooltip__item > div,
.day-tooltip__notes {
  overflow-wrap: anywhere;   /* moderne */
  word-break: break-word;    /* fallback large support */
  white-space: normal;
}
