/* Homizy status page. Tokens from the website (src/index.css, docs/design-system.md) and the
   backoffice (src/app/globals.css): Aeonik, Homizy yellow, rounded-xl cards with a 2px border,
   the backoffice dark palette. Colours are only ever used through these variables. */

@font-face { font-family: Aeonik; src: url("/fonts/aeonik-regular.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: Aeonik; src: url("/fonts/aeonik-medium.woff2") format("woff2"); font-weight: 500; font-display: swap; }
@font-face { font-family: Aeonik; src: url("/fonts/aeonik-semibold.woff2") format("woff2"); font-weight: 600; font-display: swap; }
@font-face { font-family: Aeonik; src: url("/fonts/aeonik-bold.woff2") format("woff2"); font-weight: 700; font-display: swap; }

:root {
  --background: 0 0% 100%;
  --foreground: 0 0% 13.7%;
  --card: 0 0% 100%;
  --muted: 45 10% 96%;
  --muted-foreground: 0 0% 45%;
  --border: 45 20% 90%;
  --primary: 47 99% 50%;
  --off-white: 40 33% 96%;
  --state-up: 145 58% 45%;
  --state-partial: 34 100% 50%;
  --state-down: 2 100% 64%;
  --state-unknown: 0 0% 72%;
  --state-maintenance: 271 82% 51%;
  --state-nodata: 45 20% 90%;
  --radius: 0.75rem;
}

@media (prefers-color-scheme: dark) {
  :root {
    --background: 0 0% 7%;
    --foreground: 0 0% 96%;
    --card: 0 0% 10%;
    --muted: 0 0% 13%;
    --muted-foreground: 0 0% 58%;
    --border: 0 0% 16%;
    --off-white: 0 0% 10%;
    --state-up: 145 58% 40%;
    --state-unknown: 0 0% 40%;
    --state-nodata: 0 0% 18%;
  }
}

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

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

body {
  margin: 0;
  background: hsl(var(--background));
  color: hsl(var(--foreground));
  font-family: Aeonik, ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 16px;
  line-height: 1.5;
  text-rendering: optimizeLegibility;
}

a { color: inherit; }
a:focus-visible, button:focus-visible { outline: 2px solid hsl(var(--primary)); outline-offset: 2px; }

.container { width: 100%; max-width: 920px; margin: 0 auto; padding: 0 16px; }
@media (min-width: 768px) { .container { padding: 0 2rem; } }

/* Header */
.site-header { border-bottom: 2px solid hsl(var(--foreground) / 0.08); background: hsl(var(--background)); }
.header-row { display: flex; align-items: center; justify-content: space-between; height: 72px; }
.brand img { display: block; height: 32px; width: auto; }
@media (prefers-color-scheme: dark) { .brand img { filter: invert(1); } }

.lang { display: flex; gap: 4px; }
.lang button {
  font: inherit; font-size: 13px; font-weight: 500;
  padding: 4px 10px; border-radius: 4px; cursor: pointer;
  border: 2px solid hsl(var(--foreground) / 0.15);
  background: hsl(var(--card)); color: hsl(var(--foreground));
}
.lang button[aria-pressed="true"] { background: hsl(var(--primary)); border-color: hsl(var(--primary)); color: hsl(0 0% 0%); }

/* Title and banner */
.page-title { font-size: 2rem; font-weight: 700; letter-spacing: -0.02em; line-height: 1.15; margin: 40px 0 20px; }
@media (min-width: 768px) { .page-title { font-size: 2.5rem; margin-top: 56px; } }

.banner {
  display: flex; align-items: center; gap: 16px;
  padding: 20px 24px; border-radius: var(--radius);
  border: 2px solid hsl(var(--foreground) / 0.15);
  background: hsl(var(--off-white));
  margin-bottom: 32px;
}
.banner[data-state="operational"] { box-shadow: 4px 4px 0 hsl(var(--primary)); }
.banner-dot { flex: none; width: 16px; height: 16px; border-radius: 50%; background: hsl(var(--state-unknown)); }
.banner[data-state="operational"] .banner-dot { background: hsl(var(--state-up)); }
.banner[data-state="partial"] .banner-dot { background: hsl(var(--state-partial)); }
.banner[data-state="major"] .banner-dot { background: hsl(var(--state-down)); }
.banner[data-state="maintenance"] .banner-dot { background: hsl(var(--state-maintenance)); }
.banner-text { margin: 0; font-size: 1.25rem; font-weight: 600; }
.banner-sub { margin: 2px 0 0; font-size: 14px; color: hsl(var(--muted-foreground)); }

/* Sections */
.block { margin-bottom: 32px; }
.block h2, .section-title { font-size: 1.25rem; font-weight: 600; margin: 0 0 12px; }

.card {
  border: 2px solid hsl(var(--foreground) / 0.15);
  border-radius: var(--radius);
  background: hsl(var(--card));
  overflow: hidden;
}

.component { padding: 20px 24px; }
.component + .component { border-top: 2px solid hsl(var(--foreground) / 0.08); }

.component-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.component-title { min-width: 0; }
.component-name { font-weight: 500; margin: 0; }
.component-desc { margin: 2px 0 0; font-size: 14px; color: hsl(var(--muted-foreground)); }
.component-meta { display: flex; align-items: center; gap: 12px; flex: none; }
.uptime { font-size: 14px; color: hsl(var(--muted-foreground)); font-variant-numeric: tabular-nums; }
@media (max-width: 640px) {
  .component { padding: 16px; }
  .component-head { flex-wrap: wrap; row-gap: 6px; }
  .component-title { flex: 1 1 100%; }
  .component-meta { width: 100%; justify-content: space-between; }
  .banner { padding: 16px; }
}

.chip {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12px; font-weight: 500; line-height: 1;
  padding: 5px 8px; border-radius: 4px;
  background: hsl(var(--muted)); color: hsl(var(--foreground));
}
.chip::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: hsl(var(--state-unknown)); }
.chip[data-state="up"]::before { background: hsl(var(--state-up)); }
.chip[data-state="partial"]::before { background: hsl(var(--state-partial)); }
.chip[data-state="down"]::before { background: hsl(var(--state-down)); }
.chip[data-state="maintenance"]::before { background: hsl(var(--state-maintenance)); }

/* 90-day bars */
.bars { display: flex; gap: 2px; height: 32px; align-items: stretch; }
.bar { flex: 1 1 0; min-width: 2px; border-radius: 2px; background: hsl(var(--state-nodata)); }
.bar[data-state="up"] { background: hsl(var(--state-up)); }
.bar[data-state="partial"] { background: hsl(var(--state-partial)); }
.bar[data-state="down"] { background: hsl(var(--state-down)); }
.bar[data-state="maintenance"] { background: hsl(var(--state-maintenance)); }
.bar[data-state="unknown"] {
  background: repeating-linear-gradient(135deg, hsl(var(--state-unknown)) 0 3px, hsl(var(--state-nodata)) 3px 6px);
}
.bar:hover { opacity: 0.75; }
@media (max-width: 640px) { .bars .bar:nth-child(-n+60) { display: none; } }

.bars-axis { display: flex; justify-content: space-between; font-size: 12px; color: hsl(var(--muted-foreground)); margin-top: 6px; }
.axis-short { display: none; }
@media (max-width: 640px) { .axis-long { display: none; } .axis-short { display: inline; } }

/* Response times (expandable) */
:root { --chart-line: 271 82% 51%; }
@media (prefers-color-scheme: dark) { :root { --chart-line: 267 72% 75%; } }
.rt { margin-top: 12px; }
.rt summary {
  display: inline-flex; align-items: center; gap: 6px; cursor: pointer; list-style: none;
  font-size: 14px; font-weight: 500; color: hsl(var(--muted-foreground));
}
.rt summary::-webkit-details-marker { display: none; }
.rt summary::before {
  content: ""; width: 7px; height: 7px; margin: 0 2px;
  border-right: 2px solid currentColor; border-bottom: 2px solid currentColor;
  transform: rotate(-45deg); transition: transform 150ms ease-in-out;
}
.rt[open] summary::before { transform: rotate(45deg); }
.rt summary:hover { color: hsl(var(--foreground)); }
.rt summary:focus-visible { outline: 2px solid hsl(var(--primary)); outline-offset: 2px; border-radius: 4px; }
.rt-body { margin-top: 12px; }
.rt-chart { display: block; width: 100%; height: auto; }
.rt-grid { stroke: hsl(var(--foreground) / 0.12); stroke-width: 1; }
.rt-axis { fill: hsl(var(--muted-foreground)); font-size: 11px; font-family: inherit; }
.rt-line { fill: none; stroke: hsl(var(--chart-line)); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.rt-dot { fill: hsl(var(--chart-line)); }
.rt-fail { fill: hsl(var(--state-down)); }
.rt-hit { fill: transparent; cursor: crosshair; }
.rt-note, .rt-msg { margin: 6px 0 0; font-size: 12px; color: hsl(var(--muted-foreground)); }

/* Incidents */
.incident { padding: 20px 24px; }
.incident + .incident { border-top: 2px solid hsl(var(--foreground) / 0.08); }
.incident h3 { margin: 0 0 4px; font-size: 1rem; font-weight: 600; }
.incident p { margin: 0; font-size: 14px; color: hsl(var(--muted-foreground)); }

/* Legend and footer */
.legend { display: flex; flex-wrap: wrap; gap: 8px 20px; list-style: none; padding: 0; margin: 8px 0 48px; font-size: 13px; color: hsl(var(--muted-foreground)); }
.legend li { display: flex; align-items: center; gap: 6px; }
.swatch { width: 12px; height: 12px; border-radius: 2px; background: hsl(var(--state-nodata)); }
.swatch[data-state="up"] { background: hsl(var(--state-up)); }
.swatch[data-state="partial"] { background: hsl(var(--state-partial)); }
.swatch[data-state="down"] { background: hsl(var(--state-down)); }
.swatch[data-state="maintenance"] { background: hsl(var(--state-maintenance)); }
.swatch[data-state="unknown"] { background: repeating-linear-gradient(135deg, hsl(var(--state-unknown)) 0 3px, hsl(var(--state-nodata)) 3px 6px); }

.site-footer { border-top: 2px solid hsl(var(--foreground) / 0.08); padding: 24px 0; font-size: 14px; color: hsl(var(--muted-foreground)); }
.footer-row { display: flex; justify-content: space-between; gap: 12px; }

/* Tooltip */
.tooltip {
  position: fixed; z-index: 10; pointer-events: none;
  max-width: 240px; padding: 8px 10px; border-radius: 8px;
  background: hsl(var(--foreground)); color: hsl(var(--background));
  font-size: 13px; line-height: 1.35;
}
.tooltip strong { display: block; font-weight: 600; }

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