/* Willow RPC status. Tokens follow willow.tech (willow-website src/styles.css):
   white pages with thin rules, deep green for full-bleed moments, gold only for
   the verified state. Light and dark, with the dashboard's dark palette and its
   header toggle; the <head> script sets data-theme before first paint. */

@font-face {
  font-family: 'Schibsted Grotesk';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url(fonts/schibsted-grotesk-latin-400-normal.woff2) format('woff2');
}
@font-face {
  font-family: 'Schibsted Grotesk';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url(fonts/schibsted-grotesk-latin-700-normal.woff2) format('woff2');
}
@font-face {
  font-family: 'Newsreader Variable';
  font-style: normal;
  font-weight: 200 800;
  font-display: swap;
  src: url(fonts/newsreader-latin-opsz-normal.woff2) format('woff2-variations');
}
@font-face {
  font-family: 'JetBrains Mono';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url(fonts/jetbrains-mono-latin-400-normal.woff2) format('woff2');
}

:root {
  --bg: #ffffff;
  --surface-soft: #eef3f0;
  --text: #0f1814;
  --text-body: #3a4741;
  --text-muted: #5b6961;
  /* Small labels: 4.8:1 on white (AA). */
  --text-subtle: #66756d;
  --text-on-deep: #ffffff;
  --text-on-deep-muted: #d3e4dc;
  --border: #e1e8e3;
  --border-mid: #d8e2da;
  --border-strong: #c3cec7;
  --brand-green: #2f7a5c;
  --brand-deep: #1b513d;
  /* Links, the brand tag, group titles. */
  --accent: #2f7a5c;
  --accent-hover: #1b513d;
  --accent-soft: rgba(47, 122, 92, 0.28);
  --header-bg: #ffffff;
  --tip-bg: #0f1814;
  --tip-text: #ffffff;
  --brand-gold: #b7791f;
  --brand-gold-on-deep: #d0a94f;
  --error: #b42318;

  /* Status marks. Up is the brand green, down is the site's error red, no data
     is a hairline grey. Gold never marks a loss. */
  --up: #2f7a5c;
  --down: #b42318;
  --none: #e1e8e3;
  color-scheme: light;

  --font-sans: 'Schibsted Grotesk', system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --font-display: 'Newsreader Variable', 'Newsreader', Georgia, 'Times New Roman', serif;
  --font-mono: 'JetBrains Mono', ui-monospace, 'SF Mono', Menlo, monospace;
  --max-w: 1120px;
  --gutter: clamp(16px, 4vw, 40px);
  --radius: 12px;
}

/* Dark: the dashboard's deep surface (#0f1814), its bright green for marks and
   links, the error red's dark step. Deep green bands (the up banner, the footer)
   stay the brand's #1b513d. */
:root[data-theme='dark'] {
  --bg: #0f1814;
  --surface-soft: #16231d;
  --text: #f4f6f1;
  --text-body: #c9d2cc;
  --text-muted: #a7b3ac;
  --text-subtle: #8a9991;
  --border: #22312a;
  --border-mid: #2b3c34;
  --border-strong: #364a40;
  --accent: #4ea882;
  --accent-hover: #6fc29e;
  --accent-soft: rgba(78, 168, 130, 0.28);
  --header-bg: #0f1814;
  --tip-bg: #e4e9e5;
  --tip-text: #0f1814;
  --up: #4ea882;
  --down: #f97066;
  --none: #2b3c34;
  color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  margin: 0;
  background: var(--bg);
  overflow-x: hidden;
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); text-decoration: underline; }

code {
  font-family: var(--font-mono);
  font-size: 0.86em;
  color: var(--text);
  background: var(--surface-soft);
  border-radius: 6px;
  padding: 0.1em 0.35em;
  overflow-wrap: anywhere;
}

.container {
  width: 100%;
  max-width: var(--max-w);
  margin: 0 auto;
  padding-inline: var(--gutter);
}

/* Top bar */

.top {
  border-bottom: 1px solid var(--border);
  background: var(--header-bg);
}
.top-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  height: 64px;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--text);
}
.brand:hover { text-decoration: none; }
.brand .mark { color: var(--accent); }
.brand-tag {
  margin-left: 10px;
  padding-left: 12px;
  border-left: 1px solid var(--border-strong);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--accent);
}
.top-links { display: flex; align-items: center; gap: 24px; font-size: 14px; }
.top-links a { color: var(--text-muted); }
.top-links a:hover { color: var(--text); text-decoration: none; }

/* The dashboard's theme toggle: a round hairline button, a moon in light, a sun in dark. */
.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  padding: 0;
  flex-shrink: 0;
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--border-mid);
  border-radius: 999px;
  cursor: pointer;
  transition: color 0.15s ease, border-color 0.15s ease;
}
.theme-toggle:hover { color: var(--text); border-color: var(--border-strong); }
.theme-toggle:focus-visible {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.theme-toggle .icon-sun { display: none; }
[data-theme='dark'] .theme-toggle .icon-sun { display: block; }
[data-theme='dark'] .theme-toggle .icon-moon { display: none; }

/* Hero and banner */

.hero { padding-top: clamp(40px, 7vw, 72px); }
h1 {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: clamp(40px, 5vw, 60px);
  line-height: 1.02;
  letter-spacing: -0.02em;
  margin: 0 0 28px;
}
.banner {
  display: flex;
  align-items: center;
  gap: 16px;
  border-radius: var(--radius);
  padding: 20px 24px;
  border: 1px solid var(--border);
}
.banner-text { display: flex; flex-direction: column; gap: 2px; }
.banner-main { font-size: 20px; font-weight: 700; line-height: 1.3; }
.banner-sub { font-size: 14px; color: var(--text-muted); }
.banner--up {
  background: var(--brand-deep);
  border-color: var(--brand-deep);
  color: var(--text-on-deep);
}
.banner--up .banner-sub { color: var(--text-on-deep-muted); }
.banner--down { border-color: var(--down); box-shadow: inset 4px 0 0 var(--down); }
.banner--down .banner-main { color: var(--down); }
.banner--stale .banner-main,
.banner--loading .banner-text { color: var(--text-body); }
.seal { flex: none; }

/* Sections */

.section { padding-top: clamp(48px, 7vw, 80px); }
#incidents { padding-bottom: clamp(56px, 8vw, 96px); }
h2 {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: clamp(30px, 3.4vw, 40px);
  line-height: 1.08;
  letter-spacing: -0.015em;
  margin: 0 0 14px;
}
.lead {
  color: var(--text-body);
  max-width: 72ch;
  margin: 0 0 28px;
  text-wrap: pretty;
}

/* Chain rows */

.group { margin-top: 28px; }
.group-title {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--accent);
  margin: 0 0 4px;
}
.rows { list-style: none; margin: 0; padding: 0; }
.row {
  display: grid;
  grid-template-columns: minmax(150px, 1.2fr) 120px minmax(0, 3.2fr) 112px;
  align-items: center;
  gap: 8px 20px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}
.row--head {
  padding: 8px 0;
  font-size: 12px;
  color: var(--text-subtle);
  border-bottom: 1px solid var(--border-mid);
}
.row--head .pct { font-family: var(--font-sans); font-size: 12px; color: var(--text-subtle); }
.name { font-weight: 700; font-size: 15px; line-height: 1.3; }
.cid {
  display: block;
  font-family: var(--font-mono);
  font-weight: 400;
  font-size: 12px;
  color: var(--text-subtle);
}
.state { display: flex; flex-direction: column; font-size: 14px; line-height: 1.3; }
.state-word { display: inline-flex; align-items: center; gap: 7px; font-weight: 700; }
.state-word::before {
  content: '';
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--none);
}
.state--up .state-word { color: var(--up); }
.state--up .state-word::before { background: var(--up); }
.state--down .state-word { color: var(--down); }
.state--down .state-word::before { background: var(--down); border-radius: 1px; }
.state-detail { font-size: 12px; color: var(--text-muted); overflow-wrap: anywhere; }
.pct {
  text-align: right;
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--text);
}
.pct small { display: block; font-family: var(--font-sans); font-size: 11px; color: var(--text-subtle); }

.bars {
  display: flex;
  gap: 2px;
  height: 28px;
  align-items: stretch;
}
.bar {
  flex: 1 1 0;
  min-width: 0;
  border-radius: 2px;
  background: var(--none);
  cursor: default;
}
.bar--up { background: var(--up); }
.bar--down { background: var(--down); }
.bar:focus-visible { outline: 2px solid var(--text); outline-offset: 1px; }
.bars-axis {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: var(--text-subtle);
}
.bars-axis .short { display: none; }

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 20px;
  list-style: none;
  padding: 0;
  margin: 16px 0 0;
  font-size: 13px;
  color: var(--text-muted);
}
.legend li { display: inline-flex; align-items: center; gap: 8px; }
.swatch { width: 10px; height: 14px; border-radius: 2px; background: var(--none); }
.swatch--up { background: var(--up); }
.swatch--down { background: var(--down); }

/* History */

.months {
  border-collapse: collapse;
  margin-top: 24px;
  font-size: 14px;
  min-width: min(100%, 360px);
}
.months th,
.months td { text-align: left; padding: 8px 24px 8px 0; border-bottom: 1px solid var(--border); }
.months th { font-size: 12px; font-weight: 400; color: var(--text-subtle); }
.months td.num { font-family: var(--font-mono); text-align: right; padding: 8px 0 8px 32px; }
.months th.num { text-align: right; padding: 8px 0 8px 32px; }

/* Incidents */

.incidents { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--border-mid); }
.incident {
  display: grid;
  grid-template-columns: minmax(0, 300px) minmax(0, 1fr) auto;
  gap: 4px 24px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
}
.incident-when { font-family: var(--font-mono); font-size: 13px; color: var(--text-body); }
.incident-what { color: var(--text); }
.incident-what .note { display: block; color: var(--text-muted); margin-top: 2px; }
.incident-dur { font-family: var(--font-mono); font-size: 13px; color: var(--text-muted); text-align: right; }
.incident--ongoing .incident-what { color: var(--down); font-weight: 700; }
.empty { color: var(--text-muted); font-size: 14px; margin: 0; }
.more {
  margin-top: 16px;
  font: inherit;
  font-size: 14px;
  color: var(--accent);
  background: none;
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  padding: 8px 14px;
  cursor: pointer;
}
.more:hover { border-color: var(--accent); }

/* Tooltip */

.tip {
  position: fixed;
  z-index: 10;
  pointer-events: none;
  max-width: 260px;
  background: var(--tip-bg);
  color: var(--tip-text);
  font-size: 12px;
  line-height: 1.4;
  border-radius: 8px;
  padding: 8px 10px;
}
.tip strong { display: block; font-weight: 700; }

/* Footer */

.footer { background: var(--brand-deep); color: var(--text-on-deep-muted); }
.footer-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 20px 40px;
  padding-block: 40px;
  font-size: 14px;
}
.footer-brand { display: inline-flex; align-items: center; gap: 5px; }
.footer-links { display: flex; flex-wrap: wrap; gap: 10px 24px; }
.footer-links a { color: var(--text-on-deep-muted); }
.footer-links a:hover { color: #ffffff; text-decoration: none; }
.noscript { padding-block: 24px; color: var(--text-body); }

/* Narrow screens: name and state on one line, the bars under them, 45 days. */

@media (max-width: 760px) {
  .row {
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas: 'name state' 'bars bars' '. pct';
    gap: 8px 12px;
  }
  .row--head { grid-template-areas: 'bars bars'; padding: 4px 0; }
  .row--head > :not(.bars-wrap) { display: none; }
  .row .name { grid-area: name; }
  .row .state { grid-area: state; align-items: flex-end; text-align: right; }
  .row .bars-wrap { grid-area: bars; }
  .row .pct { grid-area: pct; }
  .bar:nth-child(-n + 45) { display: none; }
  .bars-axis .long { display: none; }
  .bars-axis .short { display: inline; }
  .incident { grid-template-columns: minmax(0, 1fr) auto; }
  .incident-what { grid-column: 1 / -1; grid-row: 2; }
  .top-links { gap: 16px; }
}

/* Narrow phones: the brand, both links and the theme toggle on one row down to 360px;
   below that the links take a second row. */
@media (max-width: 420px) {
  .brand-tag { margin-left: 8px; padding-left: 8px; }
  .top-links { gap: 12px; }
}
@media (max-width: 359px) {
  .top-inner { flex-wrap: wrap; height: auto; padding-block: 12px; row-gap: 8px; }
}
