/*
 * The status page (status.ruzagency.com), Ruza'Gency charter "Constellation + Or".
 * A night band carries the lockup and the links to the apps; the overall state sits on a
 * panel that straddles the band. Then the services in their groups, each with one bar per day,
 * the planned maintenances and the history. No shadow: surfaces stand out by a rule and their
 * colour. Round geometry (discs, pills, radii of 12 to 16 px); DM Sans everywhere, never a
 * fixed-width font. Light "paper" and dark "night" follow the system. The dots and bars take
 * the banner's colours (spec §2.1); tinted text takes a shade readable on each background
 * (contrast of 4.5:1 at least).
 */

@font-face {
  font-family: "DM Sans";
  font-style: normal;
  font-display: swap;
  font-weight: 100 1000;
  src: url("/assets/dm-sans-latin-ext-opsz-normal.5d18d31d23.woff2") format("woff2");
  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: "DM Sans";
  font-style: normal;
  font-display: swap;
  font-weight: 100 1000;
  src: url("/assets/dm-sans-latin-opsz-normal.ca72d2bcea.woff2") format("woff2");
  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 dark;
  --page: #fbf7f2;
  --surface: #ffffff;
  --well: #f3eee6;
  --ink: #241a08;
  --text: #58544d;
  --muted: #6b665f;
  --rule: #e9e7e3;
  --gold: #795800;
  --gold-rule: #966e00;
  --wash: #f3eada;
  --tip: #241a08;
  --tip-ink: #fbf7f2;

  /* The band: night in both themes. */
  --band: #241a08;
  --band-ink: #fbf7f2;
  --band-muted: #d7cfc2;
  --band-rule: rgba(251, 247, 242, 0.34);
  --band-hover: rgba(251, 247, 242, 0.1);

  /* Dots: the banner's colours, the same in both themes. */
  --dot-info: #2563eb;
  --dot-warning: #f59e0b;
  --dot-danger: #dc2626;
  --dot-critical: #b91c1c;
  --dot-maintenance: #7c3aed;
  --dot-ok: #15803d;
  --dot-unknown: #a7a29a;

  /* Tinted text on the paper. */
  --text-info: #1d4ed8;
  --text-warning: #b45309;
  --text-danger: #b91c1c;
  --text-critical: #991b1b;
  --text-maintenance: #6d28d9;
  --text-ok: #15803d;
  --text-unknown: #6b665f;

  /* Bars: 3:1 at least on the paper. */
  --bar-ok: #16a34a;
  --bar-info: #2563eb;
  --bar-warning: #d97706;
  --bar-danger: #ef4444;
  --bar-critical: #991b1b;
  --bar-maintenance: #7c3aed;
  --bar-none: #ddd8d0;
}

@media (prefers-color-scheme: dark) {
  :root {
    --page: #0a0703;
    --surface: #1b1812;
    --well: #15120d;
    --ink: #fbf7f2;
    --text: #d7d4d0;
    --muted: #a7a29a;
    --rule: #2c2822;
    --gold: #f0c75e;
    --gold-rule: #b98a2e;
    --wash: #261e0e;
    --tip: #fbf7f2;
    --tip-ink: #241a08;

    --text-info: #60a5fa;
    --text-warning: #f59e0b;
    --text-danger: #f87171;
    --text-critical: #ef4444;
    --text-maintenance: #a78bfa;
    --text-ok: #4ade80;
    --text-unknown: #a7a29a;

    --bar-ok: #22c55e;
    --bar-info: #60a5fa;
    --bar-warning: #f59e0b;
    --bar-danger: #f87171;
    --bar-critical: #dc2626;
    --bar-maintenance: #a78bfa;
    --bar-none: #39342d;
  }
}

.tone-info { --dot: var(--dot-info); --tint: var(--text-info); --bar: var(--bar-info); }
.tone-warning { --dot: var(--dot-warning); --tint: var(--text-warning); --bar: var(--bar-warning); --glyph-ink: #451a03; }
.tone-danger { --dot: var(--dot-danger); --tint: var(--text-danger); --bar: var(--bar-danger); }
.tone-critical { --dot: var(--dot-critical); --tint: var(--text-critical); --bar: var(--bar-critical); }
.tone-maintenance { --dot: var(--dot-maintenance); --tint: var(--text-maintenance); --bar: var(--bar-maintenance); }
.tone-ok { --dot: var(--dot-ok); --tint: var(--text-ok); --bar: var(--bar-ok); }
.tone-unknown { --dot: var(--dot-unknown); --tint: var(--text-unknown); }
.tone-none { --bar: var(--bar-none); }

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

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

body {
  margin: 0;
  background-color: var(--page);
  color: var(--text);
  font-family: "DM Sans", -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 1rem;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

code,
kbd,
samp,
pre {
  font-family: inherit;
}

::selection {
  background-color: var(--wash);
  color: var(--ink);
}

a {
  color: var(--gold);
  text-decoration: none;
  border-radius: 8px;
}

a:hover {
  text-decoration: underline;
  text-underline-offset: 0.2em;
}

a:focus-visible,
summary:focus-visible {
  outline: 2px solid var(--gold-rule);
  outline-offset: 2px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.page {
  max-width: 48rem;
  margin: 0 auto;
  padding: 0 1rem;
}

/* ---- The band: the lockup, the title, the apps ---- */

.band {
  position: relative;
  overflow: hidden;
  background-color: var(--band);
  background-image: radial-gradient(circle at 82% -20%, rgba(240, 199, 94, 0.16), transparent 42%);
  color: var(--band-ink);
}

.orbits {
  position: absolute;
  top: 50%;
  left: calc(50% + 17rem);
  width: 30rem;
  height: 30rem;
  transform: translateY(-50%);
  pointer-events: none;
}

.orbits circle {
  fill: none;
  stroke: #f0c75e;
  stroke-opacity: 0.16;
  stroke-width: 1.25;
}

.orbits .moon {
  fill: #f0c75e;
  fill-opacity: 0.5;
  stroke: none;
}

.band .bar {
  position: relative;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem 1rem;
  max-width: 48rem;
  margin: 0 auto;
  padding: 1.25rem 1rem 4.5rem;
}

.lockup {
  order: 1;
  margin: 0;
  line-height: 0;
}

.lockup img {
  width: auto;
  height: 2.25rem;
}

.band h1 {
  order: 3;
  flex: 1 1 100%;
  margin: 0.5rem 0 0;
  color: var(--band-ink);
  font-size: 1.375rem;
  font-weight: 600;
  line-height: 1.25;
  letter-spacing: -0.01em;
}

.apps {
  order: 2;
  display: flex;
  gap: 0.5rem;
  margin-left: auto;
}

.apps a {
  padding: 0.375rem 0.875rem;
  border: 1px solid var(--band-rule);
  border-radius: 999px;
  color: var(--band-ink);
  font-size: 0.8125rem;
  font-weight: 600;
  line-height: 1.25rem;
  white-space: nowrap;
}

.apps a:hover {
  border-color: rgba(251, 247, 242, 0.6);
  background-color: var(--band-hover);
  text-decoration: none;
}

.band a:focus-visible {
  outline-color: #f0c75e;
}

/* ---- The overall state, on its panel ---- */

.glyph {
  display: block;
  flex: none;
  width: 1rem;
  height: 1rem;
}

.glyph circle {
  fill: var(--dot);
}

.glyph path {
  fill: none;
  stroke: var(--glyph-ink, #ffffff);
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.summary {
  position: relative;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 0.875rem;
  margin-top: -2.875rem;
  padding: 1.25rem 1.25rem;
  border: 1px solid var(--rule);
  border-radius: 1rem;
  background-color: var(--surface);
}

.summary:not(.tone-ok) {
  border-color: color-mix(in srgb, var(--dot) 45%, var(--rule));
  background-color: color-mix(in srgb, var(--dot) 6%, var(--surface));
}

.summary .glyph {
  width: 1.75rem;
  height: 1.75rem;
}

.headline {
  flex: 1 1 12rem;
  margin: 0;
  color: var(--ink);
  font-size: 1.1875rem;
  font-weight: 600;
  line-height: 1.35;
  letter-spacing: -0.01em;
  overflow-wrap: anywhere;
}

.window {
  margin: 0 0 0 auto;
  color: var(--muted);
  font-size: 0.9375rem;
  font-weight: 500;
  white-space: nowrap;
}

.w60,
.w90 {
  display: none;
}

.note {
  margin: 1rem 0 0;
  color: var(--muted);
  font-size: 0.875rem;
}

/* ---- What is in progress ---- */

h2 {
  margin: 0 0 1rem;
  color: var(--ink);
  font-size: 1.25rem;
  font-weight: 700;
  line-height: 1.3;
  letter-spacing: -0.01em;
}

.current {
  margin-top: 2.5rem;
}

.current .item {
  padding: 1.25rem;
  border: 1px solid color-mix(in srgb, var(--dot) 40%, var(--rule));
  border-radius: 1rem;
  background-color: color-mix(in srgb, var(--dot) 5%, var(--surface));
}

.current .item + .item {
  margin-top: 1rem;
}

/* ---- The services, in their groups, a bar per day ---- */

.groups {
  margin-top: 3rem;
}

.group + .group {
  margin-top: 2.75rem;
}

.group > summary {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.375rem 0.75rem;
  width: fit-content;
  max-width: 100%;
  padding-right: 0.25rem;
  border-radius: 8px;
  cursor: pointer;
  list-style: none;
}

.group > summary::-webkit-details-marker {
  display: none;
}

.group h2 {
  margin: 0;
}

.gstate {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  color: var(--tint);
  font-size: 0.875rem;
  font-weight: 600;
}

.chevron {
  width: 1rem;
  height: 1rem;
  transition: transform 0.18s ease;
}

.chevron path {
  fill: none;
  stroke: var(--muted);
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.group:not([open]) .chevron {
  transform: rotate(-90deg);
}

.services {
  display: grid;
  gap: 1.75rem;
  margin: 1.5rem 0 0;
  padding: 0;
  list-style: none;
}

/* On a phone the state goes under the name; on a wider screen, beside it. */
.row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.125rem 0.5rem;
  margin: 0 0 0.625rem;
  font-size: 0.9375rem;
  line-height: 1.4;
}

.row .name {
  min-width: 0;
  color: var(--ink);
  font-weight: 500;
}

.row .state {
  order: 3;
  flex: 1 1 100%;
  padding-left: 1.5rem;
  color: var(--tint);
  font-size: 0.875rem;
  font-weight: 600;
}

.uptime {
  order: 2;
  margin-left: auto;
  padding-left: 0.75rem;
  color: var(--muted);
  font-size: 0.8125rem;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.days {
  display: flex;
  gap: 3px;
  height: 2.125rem;
}

.d {
  position: relative;
  flex: 1 1 0;
  min-width: 0;
  border-radius: 999px;
  background-color: var(--bar);
}

/* A phone shows 30 days, a tablet 60, a screen 90. */
.d:nth-child(-n + 60) {
  display: none;
}

/* Not an opacity: the tip, drawn by the bar, would fade with it. */
.d:hover {
  background-color: color-mix(in srgb, var(--bar) 65%, var(--page));
}

/* The tip: a day and what touched it, over the bar; held inside the strip at its ends. */
.d:hover::after {
  content: attr(data-tip);
  position: absolute;
  bottom: calc(100% + 0.5rem);
  left: 50%;
  z-index: 2;
  width: max-content;
  max-width: 17rem;
  padding: 0.5rem 0.75rem;
  border-radius: 0.75rem;
  background-color: var(--tip);
  color: var(--tip-ink);
  font-size: 0.8125rem;
  font-weight: 500;
  line-height: 1.45;
  white-space: pre-line;
  transform: translateX(-50%);
  pointer-events: none;
}

.d:nth-child(n + 61):nth-child(-n + 68):hover::after {
  left: 0;
  transform: none;
}

.d:nth-last-child(-n + 8):hover::after {
  right: 0;
  left: auto;
  transform: none;
}

.legend {
  margin-top: 2.25rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--rule);
  color: var(--muted);
  font-size: 0.8125rem;
}

.legend ul {
  display: flex;
  flex-wrap: wrap;
  gap: 0.375rem 1.25rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

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

.key {
  width: 0.375rem;
  height: 0.875rem;
  border-radius: 999px;
  background-color: var(--bar);
}

.legend p {
  margin: 0.625rem 0 0;
}

.legend ul + p {
  margin-top: 1rem;
}

/* ---- Planned maintenances, history ---- */

.block {
  margin-top: 3.5rem;
}

.empty {
  margin: 0;
  padding: 2rem 1rem;
  border-radius: 1rem;
  background-color: var(--well);
  color: var(--text);
  font-size: 0.9375rem;
  text-align: center;
}

.dot {
  display: inline-block;
  flex: none;
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 50%;
  background-color: var(--dot);
}

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

.item h3,
.item .title {
  margin: 0;
  color: var(--ink);
  font-size: 1.0625rem;
  font-weight: 600;
  line-height: 1.4;
  overflow-wrap: anywhere;
}

.meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 0.75rem;
  margin: 0.625rem 0 0;
  font-size: 0.875rem;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.125rem 0.625rem;
  border: 1px solid var(--rule);
  border-radius: 999px;
  color: var(--tint);
  font-size: 0.875rem;
  font-weight: 500;
  line-height: 1.6;
  white-space: nowrap;
}

.on {
  color: var(--muted);
}

.facts {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1.75rem;
  margin: 0.75rem 0 0;
  font-size: 0.9375rem;
}

.facts div {
  display: flex;
  flex-wrap: wrap;
  gap: 0 0.5rem;
}

.facts dt {
  color: var(--muted);
}

.facts dd {
  margin: 0;
  color: var(--text);
}

/* The thread: a vertical rule and hollow discs, from the newest to the oldest. */
.thread {
  margin: 1rem 0 0 0.3125rem;
  padding: 0 0 0 1.125rem;
  list-style: none;
  border-left: 2px solid var(--rule);
}

.thread li {
  position: relative;
  padding-bottom: 1rem;
}

.thread li:last-child {
  padding-bottom: 0;
}

.thread li::before {
  content: "";
  position: absolute;
  top: 0.4rem;
  left: calc(-1.125rem - 7px);
  width: 12px;
  height: 12px;
  border: 2px solid var(--gold-rule);
  border-radius: 50%;
  background-color: var(--page);
}

.current .thread li::before {
  background-color: var(--surface);
}

.when {
  display: flex;
  flex-wrap: wrap;
  gap: 0 0.5rem;
  margin: 0;
  font-size: 0.8125rem;
  line-height: 1.5rem;
}

.kind {
  color: var(--ink);
  font-weight: 600;
}

.at {
  color: var(--muted);
}

.message {
  margin: 0.125rem 0 0;
  overflow-wrap: anywhere;
}

/* History: a day, then its items, folded. */
.day {
  margin: 1.75rem 0 0;
  color: var(--muted);
  font-size: 0.875rem;
  font-weight: 600;
}

.day:first-of-type {
  margin-top: 0;
}

.past {
  padding: 0.875rem 0;
}

.past summary {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.375rem 0.75rem;
  border-radius: 8px;
  cursor: pointer;
  list-style: none;
}

.past summary::-webkit-details-marker {
  display: none;
}

/* The fold's chevron, in gold: right when folded, down when open. */
.past summary::before {
  content: "";
  width: 0.4375rem;
  height: 0.4375rem;
  margin: 0 0.125rem 0 0.125rem;
  border-right: 2px solid var(--gold-rule);
  border-bottom: 2px solid var(--gold-rule);
  transform: rotate(-45deg);
  transition: transform 0.18s ease;
}

.past[open] summary::before {
  transform: rotate(45deg);
}

.past .title {
  font-size: 1rem;
}

.past .meta .chip {
  display: none;
}

/* ---- Footer ---- */

.foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem 2rem;
  margin-top: 4rem;
  padding: 1.5rem 0 3rem;
  border-top: 1px solid var(--rule);
  color: var(--muted);
  font-size: 0.875rem;
}

.legal {
  margin: 0;
}

.lang {
  display: inline-flex;
  gap: 0.25rem;
  padding: 0.1875rem;
  border: 1px solid var(--rule);
  border-radius: 999px;
}

.lang a {
  padding: 0.125rem 0.75rem;
  border-radius: 999px;
  color: var(--text);
  font-size: 0.8125rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-decoration: none;
}

.lang a[aria-current] {
  background-color: var(--ink);
  color: var(--page);
}

@media (min-width: 30rem) {
  .lockup img {
    height: 2.125rem;
  }

  .row {
    flex-wrap: nowrap;
  }

  .row .state,
  .uptime {
    order: 0;
  }

  .row .state {
    flex: none;
    padding-left: 0;
  }

  .d:nth-child(-n + 60) {
    display: block;
  }

  .d:nth-child(-n + 30) {
    display: none;
  }

  .d:nth-child(n + 61):nth-child(-n + 68):hover::after {
    left: 50%;
    transform: translateX(-50%);
  }

  .d:nth-child(n + 31):nth-child(-n + 42):hover::after {
    left: 0;
    transform: none;
  }

  .w30 {
    display: none;
  }

  .w60 {
    display: inline;
  }
}

@media (min-width: 48rem) {
  .band .bar {
    flex-wrap: nowrap;
    padding: 1.5rem 1.5rem 4.75rem;
  }

  .band h1 {
    order: 2;
    flex: none;
    margin: 0;
    padding-left: 1rem;
    border-left: 1px solid var(--band-rule);
    color: var(--band-muted);
    font-size: 1rem;
    font-weight: 500;
    line-height: 1.75rem;
    letter-spacing: 0;
  }

  .apps {
    order: 3;
  }

  .apps a {
    padding: 0.4375rem 1rem;
    font-size: 0.875rem;
  }

  .page {
    padding: 0 1.5rem;
  }

  .summary {
    padding: 1.375rem 1.75rem;
  }

  .headline {
    font-size: 1.3125rem;
  }

  .d:nth-child(-n + 30) {
    display: block;
  }

  .d:nth-child(n + 31):nth-child(-n + 42):hover::after {
    left: 50%;
    transform: translateX(-50%);
  }

  .d:nth-child(-n + 14):hover::after {
    left: 0;
    transform: none;
  }

  .d:nth-last-child(-n + 14):hover::after {
    right: 0;
    left: auto;
    transform: none;
  }

  .w60 {
    display: none;
  }

  .w90 {
    display: inline;
  }
}

@media (prefers-reduced-motion: reduce) {
  .chevron,
  .past summary::before {
    transition: none;
  }
}
