/* appliverun.site — Live Run's own "Vigil" palette (DESIGN.md): cold slate ground, one saturated
   signal (lime) rationed to "live and fresh", system fonts only, monospace tabular numerals. */
:root {
  --ground: #10151a;
  --raised: #171d24;
  --sunk: #0b0f13;
  --hairline: #263039;
  --hairline-strong: #35424e;
  --text: #e8edf2;
  --muted: #93a1ae;
  --current: #d7f56b;
  --delayed: #ffbe5c;
  --offline: #ff8873;
  --sans: ui-sans-serif, -apple-system, "SF Pro Text", "Segoe UI", system-ui, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, "Cascadia Mono", monospace;
  --gutter: clamp(1.1rem, 4vw, 2.5rem);
  color-scheme: dark;
}

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

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

body {
  margin: 0;
  background: var(--ground);
  color: var(--text);
  font: 400 16px/1.6 var(--sans);
}

h1,
h2,
h3,
p,
dl,
dd,
ol,
figure {
  margin: 0;
}

a {
  color: inherit;
}

:focus-visible {
  outline: 2px solid var(--current);
  outline-offset: 3px;
}

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

.skip {
  position: absolute;
  left: var(--gutter);
  top: -3rem;
  padding: 0.6rem 0.9rem;
  background: var(--text);
  color: var(--ground);
  border-radius: 8px;
  z-index: 10;
}

.skip:focus {
  top: 0.75rem;
}

.wrap {
  width: 100%;
  max-width: 1200px;
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.topbar {
  border-bottom: 1px solid var(--hairline);
}

.topbar-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  min-height: 64px;
}

.wordmark {
  font-weight: 800;
  letter-spacing: 0.16em;
  text-decoration: none;
  font-size: 0.95rem;
}

.lang {
  color: var(--muted);
  text-underline-offset: 4px;
  padding: 0.6rem 0.2rem;
}

.label {
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}

.display {
  font-weight: 800;
  font-size: clamp(2.3rem, 5.2vw, 4.4rem);
  line-height: 1.02;
  letter-spacing: -0.025em;
  margin-top: 1.1rem;
  text-wrap: balance;
}

.h2 {
  font-weight: 800;
  font-size: clamp(1.7rem, 3.2vw, 2.6rem);
  line-height: 1.08;
  letter-spacing: -0.03em;
  margin-top: 0.8rem;
  max-width: 24ch;
  text-wrap: balance;
}

.lede {
  font-size: clamp(1.05rem, 1.4vw, 1.2rem);
  color: var(--muted);
  margin-top: 1.4rem;
  max-width: 58ch;
}

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

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 2rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 0.8rem 1.4rem;
  border-radius: 8px;
  font: 700 1rem/1.2 var(--sans);
  text-decoration: none;
  border: 1px solid transparent;
  cursor: pointer;
  transition: background-color 150ms ease, border-color 150ms ease;
}

.btn-primary {
  background: var(--text);
  color: var(--ground);
}

.btn-primary:hover {
  background: #fff;
}

.btn-line {
  background: transparent;
  color: var(--text);
  border-color: var(--hairline-strong);
}

.btn-line:hover {
  border-color: var(--muted);
}

.btn-small {
  min-height: 44px;
  padding: 0.55rem 0.9rem;
  font-size: 0.875rem;
}

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.hero {
  padding-block: clamp(3rem, 7vw, 6rem);
  border-bottom: 1px solid var(--hairline);
}

.hero-grid {
  display: grid;
  gap: clamp(2.5rem, 5vw, 4.5rem);
  align-items: center;
}

@media (min-width: 960px) {
  .hero-grid {
    grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr);
  }
}

/* The instrument */
.demo {
  background: var(--raised);
  border: 1px solid var(--hairline);
  border-radius: 14px;
  padding: 1.1rem;
  scroll-margin-top: 1.5rem;
}

.demo-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}

.state {
  font: 600 0.8rem/1.4 var(--mono);
  padding: 0.2rem 0.55rem;
  border-radius: 6px;
  border: 1px solid currentColor;
}

.state[data-state="live"] {
  color: var(--current);
}
.state[data-state="delayed"] {
  color: var(--delayed);
}
.state[data-state="offline"] {
  color: var(--offline);
}
.state[data-state="replay"] {
  color: var(--muted);
}

.strip {
  height: 3px;
  margin-top: 0.9rem;
  border-radius: 2px;
  background: var(--hairline);
  position: relative;
  overflow: hidden;
}

.strip::after {
  content: "";
  position: absolute;
  inset: 0;
  transform-origin: left;
  transform: scaleX(var(--fresh, 1));
  background: var(--current);
  transition: transform 900ms linear, background-color 300ms ease;
}

.demo[data-freshness="delayed"] .strip::after {
  background: var(--delayed);
}
.demo[data-freshness="offline"] .strip::after,
.demo[data-freshness="replay"] .strip::after {
  background: transparent;
}

.map {
  display: block;
  width: 100%;
  height: auto;
  margin-top: 0.9rem;
  background: var(--sunk);
  border-radius: 10px;
}

.streets path {
  fill: none;
  stroke: var(--hairline);
  stroke-width: 6;
  stroke-linecap: round;
}

.route,
.route-ghost {
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.route {
  stroke: var(--current);
  stroke-width: 3.5;
}

.demo[data-freshness="delayed"] .route {
  stroke: var(--delayed);
}
.demo[data-freshness="offline"] .route {
  stroke: var(--offline);
}
.demo[data-freshness="replay"] .route {
  stroke: var(--text);
}

.route-ghost {
  stroke: var(--hairline-strong);
  stroke-width: 2;
}

.marker {
  fill: var(--current);
  stroke: var(--sunk);
  stroke-width: 3;
}

.demo[data-freshness="delayed"] .marker {
  fill: var(--delayed);
}
.demo[data-freshness="offline"] .marker {
  fill: var(--offline);
}

.trim-label {
  fill: var(--muted);
  font: 10px var(--mono);
}

.readouts {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.5rem;
  margin-top: 0.9rem;
}

.readout {
  background: var(--sunk);
  border-radius: 10px;
  padding: 0.75rem 0.85rem 0.8rem;
}

.readout dt {
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}

.readout dd {
  margin-top: 0.4rem;
}

.value {
  display: block;
  font: 600 clamp(1.35rem, 2.6vw, 1.75rem) / 1.1 var(--mono);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
  color: var(--text);
  transition: color 400ms ease;
}

.demo[data-freshness="delayed"] .value,
.demo[data-freshness="offline"] .value,
.demo[data-hr-stale] [data-hr-cell] .value {
  color: var(--muted);
}

/* Live Run's signature: the line under a number drains right to left as it ages. */
.age {
  display: block;
  height: 2px;
  margin-top: 0.5rem;
  background: var(--current);
  transform-origin: left;
  transform: scaleX(var(--fresh, 1));
  transition: transform 900ms linear, background-color 300ms ease;
}

.demo[data-freshness="delayed"] .age {
  background: var(--delayed);
}
.demo[data-freshness="offline"] .age,
.demo[data-freshness="replay"] .age,
.demo[data-hr-stale] [data-hr-cell] .age {
  background: transparent;
}

.demo-note {
  margin-top: 0.9rem;
  min-height: 3em;
  font-size: 0.875rem;
  line-height: 1.5;
  color: var(--muted);
}

.demo-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.8rem;
}

/* Sections */
.section {
  padding-block: clamp(3.5rem, 8vw, 6.5rem);
  border-bottom: 1px solid var(--hairline);
}

.split {
  display: grid;
  gap: 2rem;
}

@media (min-width: 960px) {
  .split {
    grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
    gap: 4rem;
  }
}

.prose p {
  font-size: 1.1rem;
  line-height: 1.65;
  color: var(--muted);
}

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

.prose p:last-child {
  color: var(--text);
  font-weight: 600;
}

.grid {
  display: grid;
  gap: 0.5rem;
  margin-top: 2.2rem;
  padding: 0;
  list-style: none;
}

@media (min-width: 720px) {
  .grid-2,
  .grid-4 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .grid-3 {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (min-width: 1100px) {
  .grid-4 {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

.cell {
  background: var(--raised);
  border: 1px solid var(--hairline);
  border-radius: 14px;
  padding: 1.4rem 1.3rem 1.5rem;
}

.cell dt,
.cell h3 {
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.cell dd,
.cell p {
  margin-top: 0.6rem;
  color: var(--muted);
}

.closing {
  margin-top: 1.8rem;
  max-width: 62ch;
  font-size: 1.05rem;
}

.faq details {
  border-top: 1px solid var(--hairline);
}

.faq details:last-child {
  border-bottom: 1px solid var(--hairline);
}

.faq summary {
  cursor: pointer;
  list-style: none;
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.1rem 0;
  font-size: 1.05rem;
  font-weight: 700;
}

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

.faq summary::after {
  content: "+";
  font-family: var(--mono);
  color: var(--muted);
}

.faq details[open] summary::after {
  content: "−";
}

.faq details p {
  padding-bottom: 1.2rem;
  color: var(--muted);
  max-width: 60ch;
}

.final {
  border-bottom: 0;
}

.final-title {
  max-width: 18ch;
}

.links {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem 1.5rem;
  margin-top: 2rem;
}

.links a {
  text-underline-offset: 4px;
}

.honesty {
  margin-top: 2.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--hairline);
  max-width: 70ch;
  font-size: 0.875rem;
  color: var(--muted);
}

.footer {
  border-top: 1px solid var(--hairline);
  padding-block: 2rem;
  font-size: 0.875rem;
  color: var(--muted);
}

@media (prefers-reduced-motion: reduce) {
  .strip::after,
  .age,
  .value,
  .btn {
    transition: none;
  }
}
