/*
 * The status page look: the same neutral grayscale tokens as the Tillcast web
 * apps (web/ui/src/theme.css, OKLCH, shadcn names), with no brand colour. Status
 * colours appear only on small dots and always next to a word.
 *
 * The dark tokens are written twice because plain CSS cannot share them between
 * a media query and an attribute: the media block serves visitors who chose
 * nothing, the attribute block those who chose dark. test/theme.test.ts keeps
 * the two identical and checks the contrast of every pair in both themes.
 */

@font-face {
  font-family: "Geist Variable";
  font-style: normal;
  font-display: swap;
  font-weight: 100 900;
  src: url("geist-latin-ext-wght-normal-824f485b5d.woff2") format("woff2-variations");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

@font-face {
  font-family: "Geist Variable";
  font-style: normal;
  font-display: swap;
  font-weight: 100 900;
  src: url("geist-latin-wght-normal-19f9c92546.woff2") format("woff2-variations");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  color-scheme: light;
  --radius: 0.5rem;
  --background: oklch(1 0 0);
  --foreground: oklch(0.16 0 0);
  --card: oklch(0.985 0 0);
  --muted: oklch(0.965 0 0);
  --muted-foreground: oklch(0.47 0 0);
  --border: oklch(0.92 0 0);
  --input: oklch(0.62 0 0);
  --ring: oklch(0.16 0 0);
  --link: oklch(0.16 0 0);
  --mark: oklch(0.42 0 0);
  --success: oklch(0.45 0.12 150);
  --warning: oklch(0.47 0.1 70);
  --destructive: oklch(0.5 0.19 27);
  --info: oklch(0.45 0.09 235);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --background: oklch(0.16 0 0);
    --foreground: oklch(0.97 0 0);
    --card: oklch(0.2 0 0);
    --muted: oklch(0.25 0 0);
    --muted-foreground: oklch(0.72 0 0);
    --border: oklch(0.3 0 0);
    --input: oklch(0.55 0 0);
    --ring: oklch(0.97 0 0);
    --link: oklch(0.97 0 0);
    --mark: oklch(0.8 0 0);
    --success: oklch(0.78 0.16 150);
    --warning: oklch(0.82 0.14 85);
    --destructive: oklch(0.72 0.16 27);
    --info: oklch(0.78 0.1 235);
  }
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --background: oklch(0.16 0 0);
  --foreground: oklch(0.97 0 0);
  --card: oklch(0.2 0 0);
  --muted: oklch(0.25 0 0);
  --muted-foreground: oklch(0.72 0 0);
  --border: oklch(0.3 0 0);
  --input: oklch(0.55 0 0);
  --ring: oklch(0.97 0 0);
  --link: oklch(0.97 0 0);
  --mark: oklch(0.8 0 0);
  --success: oklch(0.78 0.16 150);
  --warning: oklch(0.82 0.14 85);
  --destructive: oklch(0.72 0.16 27);
  --info: oklch(0.78 0.1 235);
}

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

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

body {
  margin: 0;
  background: var(--background);
  color: var(--foreground);
  font-family: "Geist Variable", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 1rem;
  line-height: 1.5;
}

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

a {
  color: var(--link);
  text-decoration: underline;
  text-underline-offset: 0.2em;
}

:focus-visible {
  outline: 2px solid var(--ring);
  outline-offset: 2px;
}

main:focus-visible {
  outline-offset: -2px;
}

.skip {
  position: absolute;
  left: 1rem;
  top: -4rem;
  padding: 0.5rem 0.75rem;
  background: var(--background);
  border: 1px solid var(--input);
  border-radius: var(--radius);
}

.skip:focus {
  top: 0.5rem;
}

.site-header {
  border-bottom: 1px solid var(--border);
}

.header-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-height: 3.5rem;
}

.wordmark {
  margin: 0;
  font-weight: 650;
  letter-spacing: -0.01em;
}

.wordmark-sub {
  font-weight: 400;
  color: var(--muted-foreground);
}

h1 {
  margin: 2rem 0 1rem;
  font-size: 1.75rem;
  line-height: 1.2;
  letter-spacing: -0.02em;
}

h2 {
  margin: 0;
  font-size: 1.25rem;
  line-height: 1.3;
}

h3 {
  margin: 0;
  font-size: 1rem;
  line-height: 1.4;
}

section {
  margin-top: 2.5rem;
}

.section-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.muted {
  color: var(--muted-foreground);
  font-size: 0.875rem;
}

.notice {
  padding: 0.75rem 1rem;
  border: 1px solid var(--input);
  border-radius: var(--radius);
  background: var(--card);
}

.button {
  min-height: 2.5rem;
  padding: 0.25rem 0.875rem;
  font: inherit;
  font-size: 0.875rem;
  color: var(--foreground);
  background: var(--background);
  border: 1px solid var(--input);
  border-radius: var(--radius);
  cursor: pointer;
}

.button[aria-pressed="true"] {
  background: var(--foreground);
  color: var(--background);
  border-color: var(--foreground);
}

#period {
  display: flex;
  gap: 0.5rem;
}

#period[hidden] {
  display: none;
}

.banner {
  display: flex;
  align-items: center;
  min-height: 3.5rem;
  padding: 0.75rem 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--card);
  font-size: 1.125rem;
  font-weight: 550;
}

.state {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.dot {
  flex: none;
  width: 0.625rem;
  height: 0.625rem;
  border-radius: 50%;
  background: var(--muted-foreground);
}

.dot-operational {
  background: var(--success);
}

.dot-maintenance {
  background: var(--info);
}

.dot-degraded,
.dot-partial_outage {
  background: var(--warning);
}

.dot-major_outage {
  background: var(--destructive);
}

.dot-unknown {
  background: var(--muted-foreground);
}

.services,
.legend,
.corrections,
.updates {
  margin: 0;
  padding: 0;
  list-style: none;
}

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

.service:last-child {
  border-bottom: 1px solid var(--border);
}

.service-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.availability {
  margin: 0.25rem 0 0.75rem;
  color: var(--muted-foreground);
  font-size: 0.875rem;
}

/* One mark per day. Height and fill differ by level, so colour is never the
 * only signal; the words are in the legend, the title and the daily table. */
.bar {
  display: flex;
  align-items: flex-end;
  gap: 1px;
  height: 1.75rem;
}

.day {
  flex: 1 1 0;
  min-width: 2px;
  border-radius: 1px;
  background: var(--mark);
}

.bar .day-ok {
  height: 100%;
}

.bar .day-partial {
  height: 66%;
}

.bar .day-bad {
  height: 33%;
}

.bar .day-none {
  height: 12%;
}

.day-none,
.day-gap {
  background: var(--input);
}

/* A day with an hour or more without data: grey like "no data", and half height,
 * a height no other mark has, so it is told apart by shape and not by lightness. */
.bar .day-gap {
  height: 50%;
}

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1.25rem;
  margin-top: 1rem;
  font-size: 0.875rem;
}

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

.legend .day {
  flex: none;
  width: 0.5rem;
  min-width: 0;
}

.legend .day-ok {
  height: 1rem;
}

.legend .day-gap {
  height: 0.5rem;
}

.legend .day-partial {
  height: 0.66rem;
}

.legend .day-bad {
  height: 0.33rem;
}

.legend .day-none {
  height: 0.12rem;
}

details {
  margin-top: 0.75rem;
  font-size: 0.875rem;
}

summary {
  cursor: pointer;
  min-height: 1.5rem;
}

.table-scroll {
  max-height: 16rem;
  margin-top: 0.5rem;
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-variant-numeric: tabular-nums;
}

caption {
  padding: 0.5rem;
  text-align: left;
  color: var(--muted-foreground);
}

th,
td {
  padding: 0.375rem 0.5rem;
  text-align: left;
  border-top: 1px solid var(--border);
  font-weight: 400;
}

thead th {
  font-weight: 600;
}

/* A date such as 2026-10-11 must not break at its hyphens on a phone: the table scrolls inside its region. */
tbody th[scope="row"] {
  white-space: nowrap;
}

.incident {
  padding: 1rem 0;
  border-top: 1px solid var(--border);
}

.incident-meta {
  margin: 0.25rem 0 0;
  color: var(--muted-foreground);
  font-size: 0.875rem;
}

.updates {
  margin-top: 0.75rem;
}

.updates li {
  padding: 0.5rem 0 0.5rem 0.75rem;
  border-left: 2px solid var(--border);
}

.update-head,
.update-text {
  margin: 0;
}

.update-text {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.corrections li {
  margin-top: 0.5rem;
  font-size: 0.875rem;
}

.site-footer {
  margin-top: 3rem;
  padding-block: 1.5rem;
  border-top: 1px solid var(--border);
  font-size: 0.875rem;
}

.site-footer p {
  margin: 0.25rem 0;
}

@media (prefers-reduced-motion: no-preference) {
  .button {
    transition: background-color 120ms ease-out;
  }
}

@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;
  }
}

@media (max-width: 30rem) {
  h1 {
    font-size: 1.5rem;
  }

  .banner {
    font-size: 1rem;
  }
}

.banner:empty {
  display: none;
}

/* Text typed by an operator can hold a long word or address; it must wrap, not
 * push the page sideways (WCAG 1.4.10 reflow, 1.4.4 resize text). */
.incident h3,
.incident-meta,
.corrections li,
.service-head h3 {
  overflow-wrap: anywhere;
}

/* Windows high contrast: the marks are backgrounds, which forced colours would
 * flatten. Keep their shape and give them the system's text colour. */
@media (forced-colors: active) {
  .day,
  .dot {
    forced-color-adjust: none;
    background: CanvasText;
  }

  .day-none,
  .day-gap {
    background: GrayText;
  }
}

@media print {
  :root {
    color-scheme: light;
    --background: oklch(1 0 0);
    --foreground: oklch(0 0 0);
    --card: oklch(1 0 0);
    --muted-foreground: oklch(0.35 0 0);
    --border: oklch(0.7 0 0);
    --input: oklch(0.5 0 0);
    --mark: oklch(0.3 0 0);
  }

  .day,
  .dot {
    print-color-adjust: exact;
    -webkit-print-color-adjust: exact;
  }

  #theme,
  #period,
  .skip {
    display: none;
  }
}
