:root {
  /* Lab5 "Main Street" tokens, the same as lab5.dev */
  --bg: #fbf6ee;
  --paper: #fffdf8;
  --line: #e6dccb;
  --ink: #0f2744;
  --text: #1f2a3a;
  --muted: #5a6474;
  --orange: #ff8a3d;
  --orange-ink: #c2410c;
  --orange-soft: #ffe9d8;
  --blue: #3fa9f5;
  --blue-ink: #2d6cb0;
  --blue-soft: #e3f1fc;
  --cream: #fff6ec;
  --serif: ui-serif, "New York", Georgia, "Times New Roman", serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;

  /* Charts. The series and reference colors pass the dataviz palette checks against --paper. */
  --series: #2d6cb0;
  --series-wash: rgb(45 108 176 / 10%);
  --reference: #898781;
  --grid: #ece4d6;
  --axis: #c3c2b7;
  /* Status colors always come with an icon and a word, never alone. */
  --good: #0ca30c;
  --warning: #fab219;
  --critical: #d03b3b;
  --nodata: #e6dccb;
  --good-soft: #e5f4e5;
  --warning-soft: #fff1d1;
  --critical-soft: #fbe4e4;
  --nodata-soft: #f1ebe0;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 5rem; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
body { margin: 0; font-family: var(--sans); font-size: 1.0625rem; line-height: 1.65; color: var(--text); background: var(--bg); -webkit-font-smoothing: antialiased; }
h1, h2, h3 { font-family: var(--serif); color: var(--ink); line-height: 1.12; margin: 0 0 .55em; text-wrap: balance; }
h1 { font-size: clamp(2.2rem, 5.2vw, 3.6rem); letter-spacing: -0.015em; }
h2 { font-size: clamp(1.7rem, 3.4vw, 2.4rem); letter-spacing: -0.01em; }
h3 { font-size: 1.22rem; }
p { margin: 0 0 1em; }
a { color: var(--blue-ink); }
button { font: inherit; }

.wrap { width: min(1120px, 100% - 2rem); margin-inline: auto; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.skip { position: absolute; left: 1rem; top: -3rem; padding: .5rem 1rem; background: var(--ink); color: #fff; border-radius: 8px; z-index: 40; }
.skip:focus { top: 1rem; }
:focus-visible { outline: 3px solid var(--blue-ink); outline-offset: 3px; border-radius: 6px; }
.muted { color: var(--muted); }
.num { font-variant-numeric: tabular-nums; }

/* Header */
.site-header { position: sticky; top: 0; z-index: 10; background: rgb(251 246 238 / 94%); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); border-bottom: 2px solid var(--ink); }
.header-inner { display: flex; align-items: center; justify-content: space-between; gap: 1rem; min-height: 4.4rem; }
.brand { display: flex; align-items: center; gap: .55rem; color: var(--ink); text-decoration: none; font: 800 1.55rem var(--serif); letter-spacing: -0.01em; }
.brand-word span { color: var(--orange-ink); }
.brand-name { display: grid; line-height: 1; }
.brand-sub { margin-top: .2rem; font: 700 .6rem var(--sans); letter-spacing: .16em; text-transform: uppercase; color: var(--muted); }
.brand-tag { font: 700 .72rem var(--sans); letter-spacing: .12em; text-transform: uppercase; color: var(--ink); background: var(--blue-soft); border: 2px solid var(--ink); border-radius: 999px; padding: .15rem .55rem; white-space: nowrap; }
.site-header nav { display: flex; align-items: center; gap: .25rem; }
.site-header nav a { color: var(--text); text-decoration: none; padding: .5rem .8rem; border-radius: 8px; font-size: .95rem; font-weight: 500; white-space: nowrap; }
.site-header nav a:hover { background: var(--orange-soft); }
.site-header nav .nav-cta { color: var(--cream); background: var(--ink); font-weight: 700; }
.site-header nav .nav-cta:hover { background: #1c3a63; }
@media (max-width: 720px) {
  html { scroll-padding-top: 7.5rem; }
  .header-inner { flex-wrap: wrap; gap: 0; min-height: 0; padding-block: .6rem .35rem; }
  .site-header nav { width: 100%; justify-content: space-between; margin-top: .45rem; padding-top: .35rem; border-top: 1px solid var(--line); }
  .site-header nav a { padding: .45rem .45rem; font-size: .86rem; }
}

/* Hero and the summary banner */
.hero { background: radial-gradient(circle at 88% 0%, rgb(63 169 245 / 16%) 0 6rem, transparent 6.1rem), radial-gradient(circle at 88% 0%, rgb(63 169 245 / 8%), transparent 28rem); padding: clamp(2.75rem, 6vw, 4.5rem) 0 clamp(2.5rem, 5vw, 3.5rem); }
.eyebrow { display: inline-flex; align-items: center; gap: .5rem; font-size: .8rem; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: var(--orange-ink); margin-bottom: 1rem; }
.eyebrow::before { content: ""; width: 1.6rem; height: 2px; background: var(--orange-ink); }
h1 em { color: var(--orange-ink); }
.lede { font-size: 1.2rem; color: var(--muted); max-width: 40rem; }
.banner { display: flex; align-items: center; gap: 1rem; margin-top: 2rem; padding: 1.1rem 1.3rem; background: var(--paper); border: 2px solid var(--ink); border-radius: 12px; box-shadow: 4px 4px 0 var(--ink); max-width: 46rem; }
.banner p { margin: 0; }
.banner-title { font: 700 clamp(1.25rem, 2.6vw, 1.6rem) var(--serif); color: var(--ink); line-height: 1.2; }
.banner-meta { color: var(--muted); font-size: .95rem; }
.banner-note { color: var(--muted); }
.banner .icon { width: 2.6rem; height: 2.6rem; flex: none; }

/* Status icons: a different shape for each state, so color is never the only cue */
.icon { width: 1.05rem; height: 1.05rem; flex: none; }
.icon-up .shape { fill: var(--good); }
.icon-degraded .shape { fill: var(--warning); }
.icon-down .shape { fill: var(--critical); }
.icon-unknown .shape { fill: var(--axis); }
.icon .glyph { fill: none; stroke: #fff; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.icon-degraded .glyph { stroke: var(--ink); }

/* Sections */
.section { padding: clamp(3rem, 7vw, 5rem) 0; }
.section.paper { background: var(--paper); border-block: 2px solid var(--ink); }
.section-intro { color: var(--muted); max-width: 44rem; margin-bottom: 2rem; font-size: 1.08rem; }
.sub-h { margin-top: 3rem; font-size: clamp(1.35rem, 2.6vw, 1.75rem); }

/* Site cards */
.site-list { display: grid; gap: 1.5rem; }
.site-card { background: var(--paper); border: 2px solid var(--ink); border-radius: 12px; overflow: hidden; }
.site-card .stripe { height: .7rem; background: repeating-linear-gradient(90deg, var(--orange) 0 14px, var(--cream) 14px 28px); border-bottom: 2px solid var(--ink); }
.site-card:nth-child(even) .stripe { background: repeating-linear-gradient(90deg, var(--blue) 0 14px, var(--cream) 14px 28px); }
.site-inner { padding: 1.25rem 1.35rem 1.4rem; }
.site-head { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: .5rem 1rem; margin-bottom: 1.1rem; }
.site-head h3 { margin: 0 0 .15rem; font-size: 1.45rem; }
.site-head p { margin: 0; color: var(--muted); font-size: .95rem; }
.site-head a { font-weight: 600; }
.pill { display: inline-flex; align-items: center; gap: .4rem; padding: .3rem .75rem .3rem .55rem; border-radius: 999px; border: 2px solid var(--ink); font-weight: 700; font-size: .92rem; color: var(--ink); white-space: nowrap; }
.pill-up { background: var(--good-soft); }
.pill-degraded { background: var(--warning-soft); }
.pill-down { background: var(--critical-soft); }
.pill-unknown { background: var(--nodata-soft); }
.reason { flex-basis: 100%; margin: .25rem 0 0; font-size: .92rem; color: var(--text); }

.site-body { display: grid; gap: 1.25rem; }
@media (min-width: 860px) { .site-body { grid-template-columns: 15rem minmax(0, 1fr); gap: 1.75rem; } }
.kpis { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem 1.25rem; align-content: start; }
@media (min-width: 860px) { .kpis { grid-template-columns: 1fr; } }
.kpi-label { display: block; font-size: .8rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.kpi-value { display: block; font: 600 1.9rem/1.15 var(--sans); color: var(--ink); }
.kpi-sub { display: block; font-size: .88rem; color: var(--muted); }
.uptimes { display: flex; flex-wrap: wrap; gap: .2rem 1rem; margin: .2rem 0 0; padding: 0; list-style: none; font-size: .92rem; }
.uptimes b { color: var(--ink); }

.chart-title { display: flex; justify-content: space-between; gap: 1rem; margin: 0 0 .35rem; font-size: .9rem; font-weight: 700; color: var(--ink); }
.chart-title span { font-weight: 400; color: var(--muted); }
.chart { position: relative; }
.chart svg { display: block; overflow: visible; }
.chart:focus-visible { outline-offset: 4px; }
.strip-wrap { margin-top: 1.4rem; }
.strip-ends { display: flex; justify-content: space-between; font-size: .8rem; color: var(--muted); margin-top: .3rem; }
.legend { display: flex; flex-wrap: wrap; gap: .3rem 1.1rem; margin: .6rem 0 0; padding: 0; list-style: none; font-size: .82rem; color: var(--muted); }
.legend li { display: inline-flex; align-items: center; gap: .4rem; }
.swatch { width: .8rem; height: .8rem; border-radius: 2px; }
.swatch-good { background: var(--good); }
.swatch-warning { background: var(--warning); }
.swatch-critical { background: var(--critical); }
.swatch-nodata { background: var(--nodata); }

/* SVG marks */
.grid-line { stroke: var(--grid); stroke-width: 1; }
.base-line { stroke: var(--axis); stroke-width: 1; }
.axis-text { fill: var(--muted); font: 12px var(--sans); font-variant-numeric: tabular-nums; }
.series-line { fill: none; stroke: var(--series); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.series-area { fill: var(--series-wash); stroke: none; }
.series-dot { fill: var(--series); stroke: var(--paper); stroke-width: 2; }
.crosshair { stroke: var(--axis); stroke-width: 1; }
.day-good { fill: var(--good); }
.day-warning { fill: var(--warning); }
.day-critical { fill: var(--critical); }
.day-nodata { fill: var(--nodata); }
.day-focus { fill: none; stroke: var(--ink); stroke-width: 2; }
.bar-site { fill: var(--series); }
.bar-ref { fill: var(--reference); }
.bar-label { fill: var(--text); font: 600 13px var(--sans); font-variant-numeric: tabular-nums; }
.bar-name { fill: var(--text); font: 14px var(--sans); }
.ring-track { fill: none; stroke: var(--grid); }
.ring-good { fill: none; stroke: var(--good); stroke-linecap: round; }
.ring-warning { fill: none; stroke: var(--warning); stroke-linecap: round; }
.ring-critical { fill: none; stroke: var(--critical); stroke-linecap: round; }
.ring-text { fill: var(--ink); font: 700 19px var(--sans); }

/* Table view under each chart */
.table-view { margin-top: 1rem; font-size: .9rem; }
.table-view summary { cursor: pointer; color: var(--blue-ink); font-weight: 600; width: max-content; }
.table-view .table-wrap { margin-top: .6rem; max-height: 22rem; overflow: auto; border: 1px solid var(--line); border-radius: 8px; }
.table-view table { width: 100%; }
table { border-collapse: collapse; font-variant-numeric: tabular-nums; }
th, td { text-align: left; padding: .45rem .7rem; border-bottom: 1px solid var(--line); vertical-align: top; }
thead th { font-size: .78rem; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); background: var(--paper); position: sticky; top: 0; }
.table-view-pair { display: grid; gap: 1rem; }
@media (min-width: 700px) { .table-view-pair { grid-template-columns: 1fr 1fr; } }

/* PageSpeed */
.toggle { display: inline-flex; border: 2px solid var(--ink); border-radius: 10px; overflow: hidden; margin-bottom: 1.5rem; }
.toggle button { border: 0; background: var(--paper); color: var(--ink); padding: .5rem 1.1rem; font-weight: 700; cursor: pointer; }
.toggle button + button { border-left: 2px solid var(--ink); }
.toggle button[aria-pressed="true"] { background: var(--ink); color: var(--cream); }
.scores { display: grid; gap: 1rem; }
.score-row { display: grid; gap: .9rem 1.5rem; align-items: center; padding: 1.1rem 1.25rem; background: var(--bg); border: 2px solid var(--ink); border-radius: 12px; }
@media (min-width: 860px) { .score-row { grid-template-columns: 15rem minmax(0, 1fr); } }
.score-row h3 { margin: 0; font-size: 1.2rem; }
.score-row .when { margin: .15rem 0 0; font-size: .85rem; color: var(--muted); }
.rings { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .5rem; }
@media (max-width: 520px) { .rings { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem .5rem; } }
.ring { display: flex; flex-direction: column; align-items: center; text-align: center; gap: .25rem; font-size: .82rem; line-height: 1.25; color: var(--text); }
.vitals { grid-column: 1 / -1; margin: 0; font-size: .88rem; color: var(--muted); }
@media (min-width: 860px) { .vitals { grid-column: 2; } }
.vitals b { color: var(--ink); font-weight: 600; }

.figure { margin: 0; }
.headline { font: 600 clamp(1.3rem, 2.4vw, 1.6rem)/1.3 var(--sans); color: var(--ink); margin: 0 0 1rem; max-width: 40rem; }

/* Security */
.table-wrap { overflow-x: auto; }
.security { width: 100%; min-width: 40rem; background: var(--paper); border: 2px solid var(--ink); border-radius: 12px; border-collapse: separate; border-spacing: 0; overflow: hidden; }
.security th, .security td { padding: .8rem 1rem; }
.security tbody tr:last-child td, .security tbody tr:last-child th { border-bottom: 0; }
.security tbody th { font-weight: 700; color: var(--ink); }
.security tbody th span { display: block; font-weight: 400; font-size: .85rem; color: var(--muted); }
.yes, .no { display: inline-flex; align-items: center; gap: .35rem; font-weight: 600; }
/* On phones each site's row becomes a small card, with the column name beside each value. */
@media (max-width: 720px) {
  .security { display: block; min-width: 0; border: 0; background: none; border-radius: 0; }
  .security thead { display: none; }
  .security tbody { display: grid; gap: 1rem; }
  .security tr { display: block; background: var(--paper); border: 2px solid var(--ink); border-radius: 12px; overflow: hidden; }
  .security tbody th, .security tbody tr:last-child th { display: block; border-bottom: 1px solid var(--line); }
  .security td, .security tbody tr:last-child td { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; text-align: right; border-bottom: 1px solid var(--line); }
  .security td::before { content: attr(data-label); text-align: left; font-size: .78rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
  .security tbody tr td:last-child { border-bottom: 0; }
  .security .grade-note { text-align: right; }
}
.grade { display: inline-flex; align-items: center; justify-content: center; min-width: 2.6rem; padding: .1rem .5rem; border: 2px solid var(--ink); border-radius: 8px; background: var(--good-soft); color: var(--ink); font: 800 1.05rem var(--sans); text-decoration: none; }
.grade-low { background: var(--warning-soft); }
.grade-note { display: block; font-size: .82rem; color: var(--muted); }

/* Live test */
.live-figure { background: var(--bg); border: 2px solid var(--ink); border-radius: 12px; padding: 1.2rem 1.25rem; }
.live-actions { display: flex; flex-wrap: wrap; align-items: center; gap: .75rem 1rem; margin-top: 1rem; font-size: .92rem; }
.connection { margin-top: 1.25rem; padding: 1rem 1.25rem; border-left: 4px solid var(--blue-ink); background: var(--blue-soft); border-radius: 0 10px 10px 0; }
.connection p { margin: 0; }
.connection ul { display: flex; flex-wrap: wrap; gap: .4rem .6rem; margin: .6rem 0 0; padding: 0; list-style: none; }
.connection li { padding: .2rem .65rem; background: var(--paper); border: 1px solid var(--ink); border-radius: 999px; font-size: .88rem; font-weight: 600; color: var(--ink); }

/* Incidents */
.incident-empty { display: flex; align-items: center; gap: .6rem; margin: 0; font-size: 1.08rem; }
.incidents-list { margin: 0; padding: 0; list-style: none; display: grid; gap: .75rem; }
.incidents-list li { padding: .85rem 1.1rem; background: var(--paper); border: 2px solid var(--ink); border-radius: 10px; }
.incidents-list b { color: var(--ink); }
.incidents-list span { display: block; color: var(--muted); font-size: .92rem; }

/* Method */
.method { display: grid; gap: 1.25rem 2.5rem; margin: 0; }
@media (min-width: 860px) { .method { grid-template-columns: 1fr 1fr; } }
.method dt { font: 700 1.1rem var(--serif); color: var(--ink); margin-bottom: .3rem; }
.method dd { margin: 0; color: var(--text); }

/* Buttons and the closing call to action */
.btn { display: inline-flex; align-items: center; justify-content: center; min-height: 3rem; padding: .75rem 1.4rem; border-radius: 10px; font-weight: 700; text-decoration: none; border: 2px solid var(--ink); cursor: pointer; transition: background-color .15s, transform .15s; }
.btn-primary { background: var(--orange); color: var(--ink); box-shadow: 4px 4px 0 var(--ink); }
.btn-primary:hover { transform: translate(-1px, -1px); box-shadow: 5px 5px 0 var(--ink); }
.btn-ghost { background: var(--paper); color: var(--ink); min-height: 2.6rem; padding: .5rem 1.1rem; }
.btn-ghost:hover { background: var(--blue-soft); }
.btn:disabled { opacity: .6; cursor: progress; }
@media (prefers-reduced-motion: reduce) { .btn-primary:hover { transform: none; } }
.cta-inner { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 1.25rem 2rem; }
.cta h2 { margin-bottom: .3rem; }
.cta p { margin: 0; color: var(--muted); max-width: 38rem; }

/* Footer */
.site-footer { padding: 2rem 0 4.5rem; background: var(--ink); color: #c9d4e3; font-size: .9rem; }
.footer-inner { display: flex; flex-wrap: wrap; justify-content: space-between; gap: .75rem 2rem; }
.site-footer p { margin: 0; }
.footer-links { display: flex; flex-wrap: wrap; gap: .5rem 1.25rem; }
.footer-links a { color: #c9d4e3; text-decoration: none; }
.footer-links a:hover { color: #fff; }

/* Tooltip */
.tip { position: fixed; z-index: 30; pointer-events: none; max-width: 16rem; padding: .5rem .7rem; background: var(--ink); color: #fff; border-radius: 8px; font-size: .85rem; line-height: 1.4; box-shadow: 0 6px 18px rgb(15 39 68 / 25%); }
.tip b { display: block; font-size: 1rem; }
.tip span { display: block; color: #c9d4e3; }

/* 404 */
.notfound { min-height: 60vh; display: grid; align-items: center; padding: clamp(3rem, 8vw, 5rem) 0; }
.notfound .actions { display: flex; flex-wrap: wrap; gap: .75rem; margin-top: 1.5rem; }

/* Loading and refreshing: keep the last render, slightly faded */
[data-refreshing] .site-list, [data-refreshing] .scores { opacity: .7; }
