/*
 * The public status page (internal/statuspage): phones first, light only,
 * on Sirius2's design tokens (/static/sirius2/tokens.css). Every value falls
 * back to a plain one, so the page still reads well without the tokens.
 * --accent is the site's accent colour, set on <body>; white text on it is
 * guaranteed 4.5:1 (internal/settings), so it is also AA on white.
 */
*,
*::before,
*::after {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  font-family: var(--s2-font-family-sans, system-ui, -apple-system, "Segoe UI", sans-serif);
  font-size: var(--s2-font-size-350, 0.875rem);
  line-height: 1.5;
  color: var(--s2-color-text, #303030);
  background: var(--s2-color-bg, #f1f1f1);
}

a {
  color: var(--accent, #2563eb);
}

:focus-visible {
  outline: 2px solid var(--accent, #2563eb);
  outline-offset: 2px;
}

.wrap {
  width: 100%;
  max-width: 45rem;
  margin: 0 auto;
  padding: 0 var(--s2-space-400, 1rem);
}

/* Header: the logo and the site's name. */
.site {
  background: var(--s2-color-bg-surface, #fff);
  border-bottom: 1px solid var(--s2-color-border, #e3e3e3);
}

.site .wrap {
  display: flex;
  align-items: center;
  gap: var(--s2-space-300, 0.75rem);
  padding-top: var(--s2-space-400, 1rem);
  padding-bottom: var(--s2-space-400, 1rem);
}

.logo {
  width: 2rem;
  height: 2rem;
  object-fit: contain;
  flex: none;
}

/* The type scale (Sirius2's sizes): the site name 1.5rem; section headings
   1.25rem; card titles (checks, incidents, History) 1rem; body text
   0.875rem, also an update (its status, time and message); meta lines and sub-headings in a card
   0.8125rem;
   labels, badges and the footer 0.75rem. */
h1 {
  margin: 0;
  font-size: var(--s2-font-size-600, 1.5rem);
  font-weight: var(--s2-font-weight-semibold, 600);
  overflow-wrap: anywhere;
}

main.wrap {
  padding-top: var(--s2-space-600, 1.5rem);
  padding-bottom: var(--s2-space-600, 1.5rem);
}

/* The overall status: a filled banner, coloured by level. The accent is for
   good news only; bad news uses the design system's critical and caution. */
.banner,
.notice {
  border-radius: var(--s2-border-radius-300, 0.75rem);
  padding: var(--s2-space-400, 1rem) var(--s2-space-500, 1.25rem);
}

.banner p,
.notice p {
  margin: 0;
  text-align: center;
  font-weight: var(--s2-font-weight-semibold, 600);
  font-size: var(--s2-font-size-500, 1.25rem);
}

.banner--operational {
  background: var(--accent, #2563eb);
  color: #fff;
}

.banner--maintenance {
  background: var(--s2-color-bg-fill-info, #91d0ff);
  color: var(--s2-color-text-info-on-bg-fill, #00527c);
}

.banner--degraded {
  background: var(--s2-color-bg-fill-caution, #ffe600);
  color: var(--s2-color-text-caution-on-bg-fill, #4f4700);
}

/* One scale for an incident's weight, on the banner, badges, strips and the
   calendar's dots: minor (degraded) yellow, major (partial outage) amber,
   critical (major outage) red. */
.banner--partial {
  background: var(--s2-color-bg-fill-warning, #ffb800);
  color: var(--s2-color-text-warning-on-bg-fill, #251a00);
}

.banner--major {
  background: var(--s2-color-bg-fill-critical, #c70a24);
  color: var(--s2-color-text-critical-on-bg-fill, #fff);
}

.banner--unknown,
.notice {
  background: var(--s2-color-bg-surface, #fff);
  color: var(--s2-color-text-secondary, #616161);
  border: 1px solid var(--s2-color-border, #e3e3e3);
}

footer.wrap {
  padding-bottom: var(--s2-space-800, 2rem);
  color: var(--s2-color-text-secondary, #616161);
  font-size: var(--s2-font-size-300, 0.75rem);
}

footer p {
  margin: 0;
}

/* One row: the history link on the left (front page), the time on the right. */
footer.wrap {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--s2-space-200, 0.5rem) var(--s2-space-400, 1rem);
  padding-top: var(--s2-space-600, 1.5rem);
}

footer.wrap a {
  font-size: var(--s2-font-size-350, 0.875rem);
}

#updated {
  margin-left: auto;
}

@media (min-width: 48rem) {
  main.wrap {
    padding-top: var(--s2-space-800, 2rem);
  }
}

/* The site's name links home; it reads as the heading, not as a link. */
.home {
  color: inherit;
  text-decoration: none;
}

/* Sections under the banner: active incidents, maintenance. */
.section {
  margin-top: var(--s2-space-800, 2rem);
}

h2 {
  margin: 0 0 var(--s2-space-300, 0.75rem);
  font-size: var(--s2-font-size-500, 1.25rem);
  font-weight: var(--s2-font-weight-semibold, 600);
}

.incident,
.window {
  background: var(--s2-color-bg-surface, #fff);
  border: 1px solid var(--s2-color-border, #e3e3e3);
  border-radius: var(--s2-border-radius-300, 0.75rem);
  padding: var(--s2-space-400, 1rem);
  margin-bottom: var(--s2-space-300, 0.75rem);
}

/* The impact as a coloured edge, from the design system (never the accent). */
/* An active incident's impact, and maintenance in progress: a strip along
   the card's top edge, clipped by its rounded corners. */
.incident,
.window {
  position: relative;
  overflow: hidden;
}

.incident--critical::before,
.incident--major::before,
.incident--minor::before,
.window--now::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 4px;
  background: var(--s2-color-bg-fill-critical, #c70a24);
}

.incident--minor::before {
  background: var(--s2-color-bg-fill-caution, #ffe600);
}

.incident--major::before {
  background: var(--s2-color-bg-fill-warning, #ffb800);
}

.window--now::before {
  background: var(--s2-color-bg-fill-info, #91d0ff);
}

/* An incident's head: its title with the impact as a badge after it, and its
   status in the top-right corner. "Affects …" is the subtitle below. */
.incident-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--s2-space-300, 0.75rem);
}

.incident-title {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: var(--s2-space-100, 0.25rem) var(--s2-space-200, 0.5rem);
  min-width: 0;
}

.incident-head > .status {
  flex: none;
  color: var(--s2-color-text-secondary, #616161);
  font-size: var(--s2-font-size-325, 0.8125rem);
  font-weight: var(--s2-font-weight-semibold, 600);
}


.title-link {
  color: inherit;
  text-decoration: none;
}

.title-link:hover {
  text-decoration: underline;
}

h3 {
  margin: 0;
  font-size: var(--s2-font-size-400, 1rem);
  font-weight: var(--s2-font-weight-semibold, 600);
  overflow-wrap: anywhere;
}

.meta {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s2-space-100, 0.25rem) var(--s2-space-300, 0.75rem);
  margin: var(--s2-space-100, 0.25rem) 0 0;
  color: var(--s2-color-text-secondary, #616161);
  font-size: var(--s2-font-size-325, 0.8125rem);
}

.impact {
  flex: none;
  padding: 0.125rem var(--s2-space-200, 0.5rem);
  border-radius: 999px;
  background: var(--s2-color-bg-fill-secondary, #f1f1f1);
  color: var(--s2-color-text-secondary, #616161);
  font-size: var(--s2-font-size-300, 0.75rem);
  font-weight: var(--s2-font-weight-semibold, 600);
  line-height: 1.4;
}

.impact--critical {
  background: var(--s2-color-bg-fill-critical, #c70a24);
  color: var(--s2-color-text-critical-on-bg-fill, #fff);
}

.impact--major {
  background: var(--s2-color-bg-fill-warning, #ffb800);
  color: var(--s2-color-text-warning-on-bg-fill, #251a00);
}

.impact--minor {
  background: var(--s2-color-bg-fill-caution, #ffe600);
  color: var(--s2-color-text-caution-on-bg-fill, #4f4700);
}



.next {
  margin: var(--s2-space-200, 0.5rem) 0 0;
  font-size: var(--s2-font-size-325, 0.8125rem);
}

/* The timeline, newest first. Messages keep their line breaks. */
.timeline {
  list-style: none;
  display: grid;
  gap: var(--s2-space-200, 0.5rem);
  margin: var(--s2-space-400, 1rem) 0 0;
  padding: 0;
}

/* Each update: a card inside the incident's, on a quieter surface. */
.update {
  padding: var(--s2-space-300, 0.75rem) var(--s2-space-400, 1rem);
  border-radius: var(--s2-border-radius-200, 0.5rem);
  background: var(--s2-color-bg-surface-secondary, #f7f7f7);
}

.update-head {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0 var(--s2-space-300, 0.75rem);
  margin: 0;
  font-size: var(--s2-font-size-350, 0.875rem); /* as the message */
}

.update-head strong {
  font-weight: var(--s2-font-weight-semibold, 600);
}

.update-head time,
.dates {
  color: var(--s2-color-text-secondary, #616161);
}

.message {
  margin: var(--s2-space-100, 0.25rem) 0 0;
  font-size: var(--s2-font-size-350, 0.875rem); /* body text: it's what people read */
  line-height: 1.5;
  white-space: pre-line;
  overflow-wrap: anywhere;
}

.back {
  margin: 0 0 var(--s2-space-300, 0.75rem);
}

/* The front page's link to an incident's whole timeline. */
.more {
  margin: var(--s2-space-300, 0.75rem) 0 0;
  font-size: var(--s2-font-size-350, 0.875rem);
}

.dates {
  margin: var(--s2-space-200, 0.5rem) 0 0;
  font-size: var(--s2-font-size-325, 0.8125rem);
}

.postmortem {
  overflow-wrap: anywhere;
}

/* A public check's row: state, 90 daily bars, figures and a 7-day graph. */
.check {
  background: var(--s2-color-bg-surface, #fff);
  border: 1px solid var(--s2-color-border, #e3e3e3);
  border-radius: var(--s2-border-radius-300, 0.75rem);
  padding: var(--s2-space-400, 1rem);
  margin-bottom: var(--s2-space-300, 0.75rem);
}

.check-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--s2-space-300, 0.75rem);
}

.state {
  flex: none;
  font-size: var(--s2-font-size-325, 0.8125rem);
  font-weight: var(--s2-font-weight-semibold, 600);
  color: var(--s2-color-text-secondary, #616161);
}

.state--failing {
  color: var(--s2-color-text-critical, #8e0b21);
}

.bars {
  display: block;
  width: 100%;
  height: 1.5rem;
  margin-top: var(--s2-space-300, 0.75rem);
}

/* Day colours: good days in the accent, bad ones in the design system's
   caution and critical, days without data neutral. */
.bar--good {
  fill: var(--accent, #2563eb);
}

.bar--fair {
  fill: var(--s2-color-bg-fill-caution, #ffe600);
}

.bar--poor {
  fill: var(--s2-color-bg-fill-critical, #c70a24);
}

.bar--none {
  fill: var(--s2-color-border, #e3e3e3);
}

.figures {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: var(--s2-space-100, 0.25rem) var(--s2-space-300, 0.75rem);
  margin: var(--s2-space-200, 0.5rem) 0 0;
  color: var(--s2-color-text-secondary, #616161);
  font-size: var(--s2-font-size-325, 0.8125rem);
}

.figures strong {
  color: var(--s2-color-text, #303030);
}

.graph {
  margin-top: var(--s2-space-300, 0.75rem);
}

.graph svg {
  display: block;
  width: 100%;
  height: 2.5rem;
  border-bottom: 1px solid var(--s2-color-border, #e3e3e3);
}

.graph path {
  fill: none;
  stroke: var(--s2-color-icon-info, #2563eb); /* as the admin's sparklines */
  stroke-width: 1.5;
  stroke-linejoin: round;
  stroke-linecap: round;
}

/* A check's page: a taller graph, and the 90 days as a table. */
.graph--large svg {
  height: 7.5rem;
}

.days {
  width: 100%;
  border-collapse: collapse;
  background: var(--s2-color-bg-surface, #fff);
  border: 1px solid var(--s2-color-border, #e3e3e3);
  border-radius: var(--s2-border-radius-300, 0.75rem);
  font-size: var(--s2-font-size-325, 0.8125rem);
  font-variant-numeric: tabular-nums;
}

.days th,
.days td {
  padding: var(--s2-space-200, 0.5rem) var(--s2-space-300, 0.75rem);
  text-align: right;
  border-bottom: 1px solid var(--s2-color-border, #e3e3e3);
}

.days th:first-child {
  text-align: left;
  font-weight: normal;
}

.days thead th {
  color: var(--s2-color-text-secondary, #616161);
  font-weight: var(--s2-font-weight-semibold, 600);
}

.days .day--none td {
  color: var(--s2-color-text-secondary, #616161);
}

.days .day--poor td {
  color: var(--s2-color-text-critical, #8e0b21);
  font-weight: var(--s2-font-weight-semibold, 600);
}

/* History and recently resolved incidents: compact entries. */
.entry {
  background: var(--s2-color-bg-surface, #fff);
  border: 1px solid var(--s2-color-border, #e3e3e3);
  border-radius: var(--s2-border-radius-300, 0.75rem);
  padding: var(--s2-space-300, 0.75rem) var(--s2-space-400, 1rem);
  margin-bottom: var(--s2-space-200, 0.5rem);
}

.month {
  margin-top: var(--s2-space-400, 1rem);
}

.quiet {
  color: var(--s2-color-text-secondary, #616161);
  margin: 0 0 var(--s2-space-300, 0.75rem);
}

.history-link {
  margin: var(--s2-space-300, 0.75rem) 0 0;
}

.pager {
  display: flex;
  justify-content: space-between;
  margin-top: var(--s2-space-600, 1.5rem);
}

/* A card: the 90 days on a check's page, like a check's row. */
.card {
  background: var(--s2-color-bg-surface, #fff);
  border: 1px solid var(--s2-color-border, #e3e3e3);
  border-radius: var(--s2-border-radius-300, 0.75rem);
  padding: var(--s2-space-400, 1rem);
}

/* A check's page: its 90 days as a heatmap, a column per week. Good days in
   the accent (good news), bad ones in caution and critical, no data neutral. */
.heatmap {
  display: grid;
  grid-auto-flow: column;
  grid-template-rows: repeat(7, auto);
  grid-template-columns: repeat(var(--weeks, 14), 1fr);
  gap: 3px;
}

/* The day's label sits in the top-left corner, small and muted. */
.cell {
  position: relative;
  display: block;
  aspect-ratio: 1;
  min-width: 0.75rem;
  box-sizing: border-box;
  padding: 0.3em 0.4em;
  border-radius: 2px;
  font-size: clamp(0.5rem, 1.4vw, 0.6875rem);
  font-variant-numeric: tabular-nums;
  line-height: 1;
  color: var(--s2-color-text-secondary, #616161);
}

.cell--good,
.cell--poor {
  color: rgb(255 255 255 / 0.8);
}

.cell--fair {
  color: rgb(0 0 0 / 0.55);
}

/* The day's figures on hover, above the square. Squares in the last weeks
   anchor it to their right edge so it stays on the card. */
.cell[data-tip]:hover {
  outline: 2px solid var(--s2-color-text, #303030);
  outline-offset: 1px;
  z-index: 1;
}

.cell[data-tip]:hover::after {
  content: attr(data-tip);
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  padding: var(--s2-space-100, 0.25rem) var(--s2-space-200, 0.5rem);
  border-radius: var(--s2-border-radius-200, 0.5rem);
  background: var(--s2-color-bg-inverse, #1a1a1a);
  color: var(--s2-color-text-inverse, #fff);
  font-size: var(--s2-font-size-300, 0.75rem);
  white-space: nowrap;
  pointer-events: none;
}

.cell[data-tip]:nth-child(-n + 21):hover::after {
  left: 0;
  transform: none;
}

.cell[data-tip]:nth-last-child(-n + 21):hover::after {
  left: auto;
  right: 0;
  transform: none;
}

.legend .cell {
  font-size: 0;
}

.cell--good {
  background: var(--accent, #2563eb);
}

.cell--fair {
  background: var(--s2-color-bg-fill-caution, #ffe600);
}

.cell--poor {
  background: var(--s2-color-bg-fill-critical, #c70a24);
}

.cell--none {
  background: var(--s2-color-border, #e3e3e3);
}

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s2-space-100, 0.25rem) var(--s2-space-400, 1rem);
  margin: var(--s2-space-300, 0.75rem) 0 0;
  color: var(--s2-color-text-secondary, #616161);
  font-size: var(--s2-font-size-300, 0.75rem);
}

.legend > span {
  display: inline-flex;
  align-items: center;
  gap: var(--s2-space-100, 0.25rem);
}

.legend .cell {
  width: 0.75rem;
}

.card h2 {
  font-size: var(--s2-font-size-400, 1rem);
}

.failures-title {
  margin: var(--s2-space-600, 1.5rem) 0 var(--s2-space-200, 0.5rem);
  color: var(--s2-color-text-secondary, #616161);
  font-size: var(--s2-font-size-325, 0.8125rem);
}

.legend + .quiet {
  margin-top: var(--s2-space-400, 1rem);
}

/* The 1st of a month shows the month, a landmark in the grid. */
.cell--month {
  font-weight: var(--s2-font-weight-semibold, 600);
}

/* A day with incidents: a dot in the square's corner in the worst one's
   impact, ringed so it shows on a red square too; the square links to it. */
a.cell {
  text-decoration: none;
}

.marker {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 50%;
  box-shadow: 0 0 0 2px var(--s2-color-bg-surface, #fff);
  background: var(--s2-color-text-secondary, #616161);
}

.marker--minor {
  background: var(--s2-color-bg-fill-caution, #ffe600);
}

/* On a yellow (99%+) day the white ring alone barely separates a yellow or
   amber dot from the square: outline it in the text colour. */
.cell--fair .marker {
  box-shadow: 0 0 0 1.5px var(--s2-color-bg-surface, #fff), 0 0 0 2.5px var(--s2-color-text, #303030);
}

.marker--major {
  background: var(--s2-color-bg-fill-warning, #ffb800);
}

.marker--critical {
  background: var(--s2-color-bg-fill-critical, #c70a24);
}

.legend .cell .marker {
  width: 0.375rem;
  height: 0.375rem;
  box-shadow: none;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

/* A window's message sits under its subtitle, as an incident's updates do. */
.window-message {
  margin-top: var(--s2-space-300, 0.75rem);
}
