/* status.gallafy.com (docs/adr/0601). The colour values are the app's own
   tokens, copied from apps/web/src/app/globals.css (:root and .dark), whose
   contrast ratios docs/adr/0131 computes; apps/web/scripts/__tests__/
   statusPage.test.ts fails if a value here drifts from that file. */

@font-face {
  font-family: "Anek Devanagari";
  src: url("anek-latin.var.woff2") format("woff2");
  font-weight: 300 800;
  font-display: optional;
}

:root {
  --background: 0 0% 100%;
  --foreground: 0 0% 3.9%;
  --card: 0 0% 100%;
  --muted: 0 0% 96.1%;
  --muted-foreground: 0 0% 40%;
  --border: 0 0% 89.8%;
  --brand: 172 60% 26%;
  --brand-foreground: 0 0% 98%;
  --brand-subtle: 172 44% 96%;
  --success: 142 71% 28%;
  --warning: 32 95% 30%;
  --destructive: 0 70% 40%;
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --background: 0 0% 3.9%;
    --foreground: 0 0% 98%;
    --card: 0 0% 3.9%;
    --muted: 0 0% 14.9%;
    --muted-foreground: 0 0% 63.9%;
    --border: 0 0% 14.9%;
    --brand: 170 48% 62%;
    --brand-foreground: 0 0% 9%;
    --brand-subtle: 174 30% 11%;
    --success: 142 60% 52%;
    --warning: 40 92% 62%;
    --destructive: 0 84% 68%;
  }
}

*,
*::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:
    "Anek Devanagari",
    system-ui,
    -apple-system,
    "Segoe UI",
    Roboto,
    "Noto Sans",
    "Noto Sans Devanagari",
    sans-serif;
  font-size: 1rem;
  line-height: 1.55;
}

a {
  color: hsl(var(--brand));
  text-underline-offset: 0.18em;
}

a:focus-visible,
.cta:focus-visible {
  outline: 2px solid hsl(var(--brand));
  outline-offset: 2px;
}

h1,
h2,
h3 {
  line-height: 1.25;
  text-wrap: balance;
  margin: 0;
}

p {
  text-wrap: pretty;
}

.wrap {
  width: 100%;
  max-width: 52rem;
  margin: 0 auto;
  padding: 0 1rem;
}

@media (min-width: 640px) {
  .wrap {
    padding: 0 1.5rem;
  }
}

.skip {
  position: absolute;
  left: -999px;
  top: 0;
}

.skip:focus {
  left: 1rem;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  top: 0.5rem;
  z-index: 10;
  background: hsl(var(--background));
  padding: 0.5rem 0.75rem;
}

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

.small {
  font-size: 0.875rem;
}

/* Header */
.top {
  border-bottom: 1px solid hsl(var(--border));
}

.top-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-height: 4rem;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.625rem;
  min-height: 44px;
  color: hsl(var(--foreground));
  text-decoration: none;
}

.brand img {
  display: block;
  height: 2rem;
  width: auto;
}

.brand-tag {
  font-weight: 600;
  color: hsl(var(--muted-foreground));
  border-left: 1px solid hsl(var(--border));
  padding-left: 0.625rem;
}

.cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  min-width: 7rem;
  padding: 0.5rem 1rem;
  border-radius: 0.5rem;
  background: hsl(var(--brand));
  color: hsl(var(--brand-foreground));
  font-weight: 600;
  text-decoration: none;
  white-space: normal;
  text-align: center;
}

/* Headline */
main {
  padding-top: 2rem;
  padding-bottom: 3rem;
}

.overall {
  display: flex;
  gap: 0.875rem;
  align-items: flex-start;
  padding: 1.25rem;
  border: 1px solid hsl(var(--border));
  border-left-width: 4px;
  border-radius: 0.75rem;
  background: hsl(var(--card));
}

.overall--operational {
  border-left-color: hsl(var(--success));
}
.overall--degraded,
.overall--maintenance {
  border-left-color: hsl(var(--warning));
}
.overall--down {
  border-left-color: hsl(var(--destructive));
}
.overall--unknown {
  border-left-color: hsl(var(--muted-foreground));
}

.overall h1 {
  font-size: 1.625rem;
  font-weight: 700;
}

@media (min-width: 640px) {
  .overall h1 {
    font-size: 2rem;
  }
}

.overall-sub {
  margin: 0.375rem 0 0;
}

.checked {
  margin: 0.375rem 0 0;
  font-size: 0.875rem;
  color: hsl(var(--muted-foreground));
}

.dot {
  flex: none;
  width: 0.875rem;
  height: 0.875rem;
  margin-top: 0.55rem;
  border-radius: 999px;
}

.dot--operational {
  background: hsl(var(--success));
}
.dot--degraded,
.dot--maintenance {
  background: hsl(var(--warning));
}
.dot--down {
  background: hsl(var(--destructive));
}
.dot--unknown {
  background: hsl(var(--muted-foreground));
}

.stale {
  margin: 1rem 0 0;
  padding: 0.75rem 1rem;
  border: 1px solid hsl(var(--warning));
  border-radius: 0.5rem;
}

.stale[hidden] {
  display: none;
}

section {
  margin-top: 2.5rem;
}

section > h2 {
  font-size: 1.25rem;
  font-weight: 700;
}

.how {
  margin: 0.375rem 0 0;
}

/* Rows */
.components {
  list-style: none;
  margin: 1rem 0 0;
  padding: 0;
  border: 1px solid hsl(var(--border));
  border-radius: 0.75rem;
}

.comp {
  padding: 1rem 1.25rem 1.125rem;
}

.comp + .comp {
  border-top: 1px solid hsl(var(--border));
}

.comp-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.25rem 0.75rem;
}

.comp-head h3 {
  font-size: 1.0625rem;
  font-weight: 600;
}

.comp-line {
  margin: 0.25rem 0 0;
}

.comp-what {
  margin: 0.125rem 0 0;
  font-size: 0.9375rem;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  font-size: 0.875rem;
  font-weight: 600;
  white-space: nowrap;
}

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

.chip--operational {
  color: hsl(var(--success));
}
.chip--degraded,
.chip--maintenance {
  color: hsl(var(--warning));
}
.chip--down {
  color: hsl(var(--destructive));
}
.chip--unknown,
.chip--note {
  color: hsl(var(--muted-foreground));
}

/* 90 bars at 640 px and up; the last 30 below it, where 90 would be slivers. */
.bars {
  display: flex;
  gap: 2px;
  height: 2rem;
  margin-top: 0.75rem;
}

.bar {
  flex: 1 1 0;
  min-width: 0;
  border-radius: 2px;
}

.bar--operational {
  background: hsl(var(--success));
}
.bar--degraded {
  background: hsl(var(--warning));
}
.bar--down {
  background: hsl(var(--destructive));
}
.bar--nodata {
  background: hsl(var(--muted));
  box-shadow: inset 0 0 0 1px hsl(var(--border));
}

.axis {
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
  margin-top: 0.375rem;
}

.axis > span {
  white-space: nowrap;
}

.axis > .axis-mid {
  white-space: normal;
  text-align: center;
}

.axis-short {
  display: none;
}

@media (max-width: 639.98px) {
  .bar:nth-child(-n + 60) {
    display: none;
  }
  .axis-long {
    display: none;
  }
  .axis-short {
    display: inline;
  }
  .bars {
    gap: 3px;
  }
  /* The uptime line gets its own row under the axis ends. */
  .axis {
    flex-wrap: wrap;
  }
  .axis > .axis-mid {
    order: 3;
    flex-basis: 100%;
    text-align: left;
  }
}

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.25rem;
  list-style: none;
  margin: 0.875rem 0 0;
  padding: 0;
  font-size: 0.875rem;
}

.legend li {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
}

.swatch {
  display: inline-block;
  width: 0.75rem;
  height: 0.75rem;
  border-radius: 2px;
}

/* Incidents */
.incident {
  margin-top: 1rem;
  padding: 1rem 1.25rem;
  border: 1px solid hsl(var(--border));
  border-radius: 0.75rem;
}

.incidents--open .incident {
  border-left: 4px solid hsl(var(--warning));
}

.incident-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.25rem 0.75rem;
}

.incident-head h3 {
  font-size: 1.0625rem;
  font-weight: 600;
}

.incident p {
  margin: 0.375rem 0 0;
}

.help p {
  margin: 0.375rem 0 0;
}

/* Footer */
.foot {
  border-top: 1px solid hsl(var(--border));
  color: hsl(var(--muted-foreground));
  font-size: 0.875rem;
  padding: 1.25rem 0 calc(1.25rem + env(safe-area-inset-bottom));
}

.foot p {
  margin: 0;
}

@media print {
  .cta,
  .skip {
    display: none;
  }
}
