/*
 * status.nucarium.com. One stylesheet, no script, no font file.
 *
 * The two palettes and the tokens come from the marketing site (apps/web:
 * src/styles/global.css and DESIGN.md). Light is "husk", the green hull of a
 * fresh walnut; dark is "heartwood", walnut timber. The page follows the
 * reader's system setting.
 *
 * The typefaces are whatever the reader's system has. This page is read when
 * something may be wrong, so it asks for as little as it can.
 */

/* ------------------------------------------------------------------ *
 * Colour. Two palettes of raw values, then tokens that point at one or
 * the other. Rules below use the tokens only.
 * ------------------------------------------------------------------ */

:root {
  --husk-paper: #e7edd6;
  --husk-raised: #f5f7ec;
  --husk-sunken: #d8e0c1;
  --husk-ink: #21160e;
  --husk-ink-soft: #4a3a2b;
  --husk-rule: #a9b68a;
  --husk-edge: #66684a;
  --husk-accent: #2c5a1e;
  --husk-wait: #8a4b00;
  --husk-fail: #a32a1c;

  --heartwood-paper: #261b13;
  --heartwood-raised: #30231a;
  --heartwood-sunken: #1b130d;
  --heartwood-ink: #f1ecdd;
  --heartwood-ink-soft: #cdbfa9;
  --heartwood-rule: #5a4a3a;
  --heartwood-edge: #9a8a72;
  --heartwood-accent: #b7d36b;
  --heartwood-wait: #f2b544;
  --heartwood-fail: #ff8a73;

  color-scheme: light dark;

  --paper: var(--husk-paper);
  --raised: var(--husk-raised);
  --sunken: var(--husk-sunken);
  --ink: var(--husk-ink);
  --ink-soft: var(--husk-ink-soft);
  --rule: var(--husk-rule);
  --edge: var(--husk-edge);
  --accent: var(--husk-accent);
  --wait: var(--husk-wait);
  --fail: var(--husk-fail);

  --font-display: Georgia, "Times New Roman", serif;
  --font-sans: system-ui, -apple-system, "Segoe UI", Arial, sans-serif;
  --font-mono: ui-monospace, Menlo, Consolas, monospace;

  --text-xs: 0.8125rem;
  --text-sm: 0.9375rem;
  --text-base: 1.0625rem;
  --text-lg: 1.25rem;
  --text-xl: 1.5rem;
  --text-2xl: clamp(1.875rem, 1.45rem + 1.9vw, 2.75rem);
  --text-3xl: clamp(2.25rem, 1.4rem + 3.7vw, 4rem);

  --radius-lg: 1.25rem;
  --radius-full: 999px;

  --measure: 38rem;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: var(--heartwood-paper);
    --raised: var(--heartwood-raised);
    --sunken: var(--heartwood-sunken);
    --ink: var(--heartwood-ink);
    --ink-soft: var(--heartwood-ink-soft);
    --rule: var(--heartwood-rule);
    --edge: var(--heartwood-edge);
    --accent: var(--heartwood-accent);
    --wait: var(--heartwood-wait);
    --fail: var(--heartwood-fail);
  }
}

/* ------------------------------------------------------------------ *
 * Base
 * ------------------------------------------------------------------ */

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

html {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-sans);
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scrollbar-color: var(--edge) var(--paper);
}

body {
  margin: 0;
  min-height: 100dvh;
  font-size: var(--text-base);
  line-height: 1.6;
  overflow-wrap: break-word;
}

h1,
h2 {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: -0.012em;
  text-wrap: balance;
}

p,
ul {
  margin: 0;
}

p,
li {
  text-wrap: pretty;
}

a {
  color: inherit;
  text-decoration-line: underline;
  text-decoration-thickness: 0.0625em;
  text-underline-offset: 0.2em;
}

a:hover {
  text-decoration-thickness: 0.125em;
}

time {
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 3px;
  border-radius: 0.25rem;
}

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

/* ------------------------------------------------------------------ *
 * Layout pieces
 * ------------------------------------------------------------------ */

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

/* The shell: a sturdy outline around something that lives inside. */
.shell {
  border: 2px solid var(--ink);
  border-radius: var(--radius-lg);
  background: var(--raised);
}

.glyph {
  flex: none;
  width: 1.25rem;
  height: 1.25rem;
}

/* ------------------------------------------------------------------ *
 * Top of the page
 * ------------------------------------------------------------------ */

.top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.25rem 1.5rem;
  padding-block: 0.75rem;
}

.wordmark {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding-block: 0.5rem;
  font-family: var(--font-display);
  font-size: var(--text-xl);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.25;
  text-decoration: none;
}

.wordmark svg {
  width: 1.75rem;
  height: 1.75rem;
  color: var(--accent);
}

.where {
  color: var(--ink-soft);
  font-size: var(--text-sm);
}

/* ------------------------------------------------------------------ *
 * Now. The colour of the signal follows the status; the headline and the
 * sentences under it say the same thing in words.
 * ------------------------------------------------------------------ */

body {
  --signal: var(--ink-soft);
}

.is-operational {
  --signal: var(--accent);
}

.is-degraded {
  --signal: var(--wait);
}

.is-down {
  --signal: var(--fail);
}

.now {
  padding-block: 2rem 3.5rem;
}

.address {
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  font-weight: 600;
  letter-spacing: 0.01em;
}

.signal {
  margin-top: 0.75rem;
}

.signal .glyph {
  display: block;
  width: 3rem;
  height: 3rem;
  margin-left: -0.375rem;
  color: var(--signal);
}

h1 {
  max-width: 16em;
  margin-top: 0.25rem;
  font-size: var(--text-3xl);
  line-height: 1.04;
}

/* A time in the headline is part of the sentence, so it may wrap with it. */
h1 time {
  white-space: normal;
}

.lede {
  max-width: var(--measure);
  margin-top: 1.25rem;
  color: var(--ink-soft);
  font-size: var(--text-lg);
  line-height: 1.5;
}

.checks {
  max-width: 44rem;
  margin-top: 2.25rem;
  padding: 0.5rem 1.25rem;
  list-style: none;
}

.checks li {
  display: flex;
  align-items: flex-start;
  gap: 0.875rem;
  padding-block: 0.875rem;
  font-size: var(--text-lg);
  line-height: 1.4;
}

.checks > * + * {
  border-top: 1px solid var(--rule);
}

.checks .glyph {
  margin-top: 0.2em;
}

.checks .is-ok .glyph {
  color: var(--accent);
}

.checks .is-failing {
  font-weight: 600;
}

.checks .is-failing .glyph {
  color: var(--fail);
}

.checks .is-unknown {
  color: var(--ink-soft);
}

/* ------------------------------------------------------------------ *
 * Bands
 * ------------------------------------------------------------------ */

.band {
  padding-block: 3.5rem;
  border-top: 1px solid var(--rule);
}

.sunken {
  border-top: 0;
  background: var(--sunken);
}

.cols {
  display: grid;
  gap: 1.75rem;
}

.cols > * {
  min-width: 0;
}

h2 {
  font-size: var(--text-2xl);
  line-height: 1.1;
}

.body > * + * {
  margin-top: 1.25rem;
}

.body > p {
  max-width: var(--measure);
}

.quiet {
  color: var(--ink-soft);
}

/* ------------------------------------------------------------------ *
 * The tape: one mark a day, oldest on the left. A bar is a day with no
 * problems, a broken bar a day with some, a dot a day with no record.
 * ------------------------------------------------------------------ */

.tape {
  display: flex;
  align-items: center;
  gap: clamp(1px, 0.25vw, 3px);
  height: 2.75rem;
}

.tape i {
  flex: 1 1 0;
  min-width: 0;
  max-width: 0.5rem;
  height: 100%;
  border-radius: var(--radius-full);
  background: var(--accent);
}

.tape .is-problems {
  background: linear-gradient(var(--fail) 0 36%, transparent 36% 64%, var(--fail) 64% 100%);
  border-radius: 0;
}

.tape .is-no_record {
  height: auto;
  aspect-ratio: 1;
  background: var(--edge);
  opacity: 0.55;
}

.tape-ends {
  display: flex;
  justify-content: space-between;
  margin-top: 0.5rem;
  color: var(--ink-soft);
  font-size: var(--text-xs);
}

.days {
  padding: 0;
  columns: 17rem;
  column-gap: 2.5rem;
  font-size: var(--text-sm);
  list-style: none;
}

.days li {
  padding-block: 0.3rem;
  break-inside: avoid;
}

.days .is-problems {
  font-weight: 600;
}

.days .is-no_record {
  color: var(--ink-soft);
}

.next {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1.75rem;
  padding: 0;
  list-style: none;
}

.next a {
  display: inline-flex;
  align-items: center;
  min-height: 2.75rem;
  font-weight: 600;
}

/* ------------------------------------------------------------------ *
 * Foot
 * ------------------------------------------------------------------ */

.foot {
  padding-block: 3rem 4rem;
  border-top: 1px solid var(--rule);
}

.sunken + .foot,
main:has(> .sunken:last-child) + .foot {
  border-top: 0;
}

.foot p {
  max-width: var(--measure);
}

.foot ul {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1.75rem;
  margin-top: 1.25rem;
  padding: 0;
  font-size: var(--text-sm);
  list-style: none;
}

.foot li a {
  display: inline-flex;
  align-items: center;
  min-height: 2.75rem;
}

.small {
  margin-top: 1rem;
  color: var(--ink-soft);
  font-size: var(--text-sm);
}

/* ------------------------------------------------------------------ *
 * Wider screens
 * ------------------------------------------------------------------ */

@media (width >= 48rem) {
  .wrap {
    padding-inline: 2.5rem;
  }

  .now {
    padding-block: 3.5rem 5rem;
  }

  .band {
    padding-block: 5rem;
  }

  .cols {
    grid-template-columns: minmax(0, 18rem) minmax(0, 1fr);
    gap: 3rem;
  }

  .checks {
    padding-inline: 1.75rem;
  }
}

@media print {
  .tape-wrap {
    display: none;
  }
}
