/*
 * status.inkabbey.com: built on the Ink Abbey tokens (web/src/index.css, DESIGN.md):
 * warm paper surfaces, Manrope for interface text, Newsreader for headings, tonal shifts
 * instead of hairline borders, and every font served from this origin.
 *
 * Status tones, each as fill (bars, marks), ink (text on the page) and wash (tinted surface):
 *   ok / degraded / down / maintenance / neutral
 * render.ts mirrors the fill colours in TONE_HEX for the favicon.
 */

@font-face {
  font-family: 'Manrope';
  src: url('/fonts/Manrope-variable.woff2') format('woff2');
  font-weight: 200 800;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Newsreader';
  src: url('/fonts/Newsreader-variable.woff2') format('woff2');
  font-weight: 200 800;
  font-style: normal;
  font-display: swap;
}

:root {
  color-scheme: light dark;
  --font-ui: 'Manrope', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-display: 'Newsreader', ui-serif, Georgia, 'Times New Roman', serif;

  --bg: oklch(0.98 0.01 80);
  --surface: oklch(0.955 0.01 80);
  --surface-sunk: oklch(0.925 0.011 80);
  --text: oklch(0.2 0.02 60);
  --muted: oklch(0.5 0.012 60);
  --rule: oklch(0.8 0.01 60 / 0.45);
  --accent: oklch(0.35 0.05 160);
  --accent-wash: oklch(0.93 0.025 160);
  --shadow: 0 1px 2px oklch(0.3 0.02 60 / 0.06), 0 8px 24px -12px oklch(0.3 0.02 60 / 0.18);

  --ok-fill: oklch(0.6 0.09 160);
  --ok-ink: oklch(0.42 0.08 160);
  --ok-wash: oklch(0.945 0.03 160);
  --degraded-fill: oklch(0.76 0.13 76);
  --degraded-ink: oklch(0.47 0.12 62);
  --degraded-wash: oklch(0.955 0.04 82);
  --down-fill: oklch(0.6 0.16 28);
  --down-ink: oklch(0.5 0.16 27);
  --down-wash: oklch(0.945 0.035 25);
  --maintenance-fill: oklch(0.62 0.1 255);
  --maintenance-ink: oklch(0.46 0.1 255);
  --maintenance-wash: oklch(0.945 0.025 255);
  --neutral-fill: oklch(0.87 0.008 70);
  --neutral-ink: oklch(0.5 0.01 60);
  --neutral-wash: oklch(0.94 0.006 70);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: oklch(0.205 0.012 250);
    --surface: oklch(0.24 0.011 250);
    --surface-sunk: oklch(0.27 0.011 250);
    --text: oklch(0.95 0.01 250);
    --muted: oklch(0.72 0.008 250);
    --rule: oklch(0.58 0.008 250 / 0.34);
    --accent: oklch(0.74 0.085 172);
    --accent-wash: oklch(0.29 0.03 172);
    --shadow: 0 1px 2px oklch(0 0 0 / 0.25), 0 10px 28px -14px oklch(0 0 0 / 0.55);

    --ok-fill: oklch(0.66 0.085 170);
    --ok-ink: oklch(0.8 0.09 170);
    --ok-wash: oklch(0.29 0.035 170);
    --degraded-fill: oklch(0.74 0.13 74);
    --degraded-ink: oklch(0.84 0.11 78);
    --degraded-wash: oklch(0.31 0.045 72);
    --down-fill: oklch(0.66 0.15 25);
    --down-ink: oklch(0.8 0.12 25);
    --down-wash: oklch(0.31 0.055 25);
    --maintenance-fill: oklch(0.66 0.1 255);
    --maintenance-ink: oklch(0.82 0.08 255);
    --maintenance-wash: oklch(0.3 0.045 255);
    --neutral-fill: oklch(0.36 0.008 250);
    --neutral-ink: oklch(0.74 0.006 250);
    --neutral-wash: oklch(0.27 0.008 250);
  }
}

.tone-ok { --fill: var(--ok-fill); --ink: var(--ok-ink); --wash: var(--ok-wash); }
.tone-degraded { --fill: var(--degraded-fill); --ink: var(--degraded-ink); --wash: var(--degraded-wash); }
.tone-down { --fill: var(--down-fill); --ink: var(--down-ink); --wash: var(--down-wash); }
.tone-maintenance { --fill: var(--maintenance-fill); --ink: var(--maintenance-ink); --wash: var(--maintenance-wash); }
.tone-neutral { --fill: var(--neutral-fill); --ink: var(--neutral-ink); --wash: var(--neutral-wash); }

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

html {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-ui);
  font-size: 100%;
  line-height: 1.55;
  -webkit-text-size-adjust: 100%;
  text-rendering: optimizeLegibility;
}

body { margin: 0; }

a {
  color: var(--accent);
  text-decoration-thickness: 0.06em;
  text-underline-offset: 0.18em;
}
a:hover { text-decoration-thickness: 0.12em; }

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

h1, h2, h3, p { margin: 0; }

.visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.page {
  max-width: 46rem;
  margin: 0 auto;
  padding: 1.5rem 1.25rem 3rem;
}

/* Masthead ------------------------------------------------------------------ */

.masthead {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 2rem;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  color: var(--text);
  text-decoration: none;
}
.brand img { display: block; height: 2.25rem; width: auto; }
.wordmark {
  font-family: var(--font-display);
  font-size: 1.45rem;
  font-weight: 500;
  letter-spacing: -0.01em;
}
.brand-tag {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  background: var(--surface-sunk);
  padding: 0.18rem 0.5rem;
  border-radius: 999px;
}

.open-app {
  font-size: 0.875rem;
  font-weight: 600;
  text-decoration: none;
  color: var(--accent);
  background: var(--accent-wash);
  padding: 0.45rem 0.9rem;
  border-radius: 999px;
  white-space: nowrap;
}
.open-app:hover { filter: brightness(0.97); }

/* Hero ----------------------------------------------------------------------- */

.hero {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 1.1rem;
  align-items: start;
  background: var(--wash);
  border-radius: 1.4rem;
  padding: 1.6rem 1.6rem 1.5rem;
  margin-bottom: 1.25rem;
}

.hero-mark {
  position: relative;
  display: grid;
  place-items: center;
  width: 3rem;
  height: 3rem;
  border-radius: 50%;
  background: var(--fill);
  color: var(--bg);
  margin-top: 0.15rem;
}
.hero-icon { width: 1.6rem; height: 1.6rem; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }

.hero.tone-down .hero-mark::after,
.hero.tone-degraded .hero-mark::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 50%;
  box-shadow: 0 0 0 0 var(--fill);
  animation: pulse 2.4s ease-out infinite;
}
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 color-mix(in oklch, var(--fill) 55%, transparent); }
  80%, 100% { box-shadow: 0 0 0 0.9rem transparent; }
}

.hero h1 {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: clamp(1.65rem, 1.25rem + 1.6vw, 2.3rem);
  line-height: 1.15;
  letter-spacing: -0.015em;
  text-wrap: balance;
}
.summary { margin-top: 0.5rem; font-size: 1.02rem; }
.checked { margin-top: 0.7rem; font-size: 0.85rem; color: var(--muted); }
.stale-note { color: var(--degraded-ink); }

/* Notes ---------------------------------------------------------------------- */

.note {
  background: var(--surface);
  border-radius: 1rem;
  padding: 1.1rem 1.25rem;
  margin-bottom: 1.25rem;
}
.note h2 { font-size: 1rem; font-weight: 700; margin-bottom: 0.25rem; }
.reassurance {
  background: var(--accent-wash);
  display: grid;
  gap: 0.2rem;
}
.reassurance h2::before {
  content: '';
  display: inline-block;
  width: 0.55rem;
  height: 0.55rem;
  margin-right: 0.5rem;
  border-radius: 50%;
  background: var(--ok-fill);
  vertical-align: 0.12em;
}
.announcement p + p { margin-top: 0.5rem; }

/* Blocks --------------------------------------------------------------------- */

.block { margin-top: 2.25rem; }
.block-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem 1rem;
  margin-bottom: 0.9rem;
}
.block-head h2 {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 1.45rem;
  letter-spacing: -0.01em;
}

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.9rem;
  list-style: none;
  margin: 0;
  padding: 0;
  font-size: 0.78rem;
  color: var(--muted);
}
.legend li { display: inline-flex; align-items: center; gap: 0.35rem; }
.swatch { width: 0.65rem; height: 0.65rem; border-radius: 3px; background: var(--fill); }

/* Chips ---------------------------------------------------------------------- */

.chip {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  flex-shrink: 0;
  padding: 0.18rem 0.65rem 0.18rem 0.45rem;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 650;
  color: var(--ink);
  background: var(--wash);
}
.chip-icon { width: 0.95rem; height: 0.95rem; fill: none; stroke: currentColor; stroke-width: 2.6; stroke-linecap: round; stroke-linejoin: round; }

/* Services ------------------------------------------------------------------- */

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

.service {
  background: var(--surface);
  border-radius: 1rem;
  padding: 1.05rem 1.25rem 0.9rem;
}

.service-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}
.service-head h3 { font-size: 1.02rem; font-weight: 700; }
.service-desc { margin-top: 0.15rem; color: var(--muted); font-size: 0.9rem; }
.service-impact {
  margin-top: 0.55rem;
  font-size: 0.9rem;
  color: var(--ink);
  background: var(--wash);
  border-radius: 0.6rem;
  padding: 0.5rem 0.7rem;
}
.service.tone-ok .service-impact { display: none; }

.bars {
  display: flex;
  gap: 2px;
  height: 2.1rem;
  margin-top: 0.85rem;
}
.bar {
  position: relative;
  flex: 1 1 0;
  min-width: 2px;
  border-radius: 2.5px;
  background: var(--fill);
  transition: transform 120ms ease, filter 120ms ease;
}
.bar:hover { transform: scaleY(1.1); filter: brightness(1.06); }
.bar::after {
  content: attr(data-tip);
  position: absolute;
  bottom: calc(100% + 0.5rem);
  left: 50%;
  transform: translateX(-50%) translateY(0.2rem);
  white-space: nowrap;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--bg);
  background: var(--text);
  padding: 0.3rem 0.55rem;
  border-radius: 0.45rem;
  box-shadow: var(--shadow);
  opacity: 0;
  pointer-events: none;
  transition: opacity 120ms ease, transform 120ms ease;
  z-index: 2;
}
.bar.edge-start::after { left: 0; transform: translateY(0.2rem); }
.bar.edge-end::after { left: auto; right: 0; transform: translateY(0.2rem); }
.bar:hover::after { opacity: 1; transform: translateX(-50%) translateY(0); }
.bar.edge-start:hover::after, .bar.edge-end:hover::after { transform: translateY(0); }

.axis {
  display: flex;
  justify-content: space-between;
  margin-top: 0.35rem;
  font-size: 0.72rem;
  color: var(--muted);
}
.axis-near { display: none; }

.service-foot {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.25rem 1rem;
  margin-top: 0.55rem;
  font-size: 0.85rem;
  color: var(--muted);
}
.uptime strong { color: var(--text); font-weight: 700; }

details > summary {
  cursor: pointer;
  list-style: none;
}
details > summary::-webkit-details-marker { display: none; }

.history { text-align: right; }
.history > summary {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  color: var(--accent);
  font-weight: 600;
}
.history > summary::after {
  content: '';
  width: 0.4rem;
  height: 0.4rem;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(45deg) translateY(-0.12rem);
  transition: transform 150ms ease;
}
.history[open] > summary::after { transform: rotate(-135deg) translateY(-0.05rem); }
.history[open] {
  flex-basis: 100%;
  text-align: left;
}
.history ul, .history p {
  margin: 0.5rem 0 0.2rem;
  padding: 0.6rem 0.8rem;
  background: var(--surface-sunk);
  border-radius: 0.6rem;
  color: var(--text);
}
.history ul { list-style: none; display: grid; gap: 0.25rem; }
.history li::before {
  content: '';
  display: inline-block;
  width: 0.55rem;
  height: 0.55rem;
  margin-right: 0.5rem;
  border-radius: 2px;
  background: var(--fill);
}

/* Incidents ------------------------------------------------------------------ */

.incident {
  position: relative;
  background: var(--surface);
  border-radius: 1rem;
  padding: 1.1rem 1.25rem 1.15rem 1.45rem;
  overflow: hidden;
}
.incident + .incident { margin-top: 0.75rem; }
.incident::before {
  content: '';
  position: absolute;
  inset: 0 auto 0 0;
  width: 0.3rem;
  background: var(--fill);
}
.incident-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
}
.incident-head h3 { font-size: 1.05rem; font-weight: 700; line-height: 1.35; }
.incident-meta { margin-top: 0.3rem; font-size: 0.85rem; color: var(--muted); }
.sep { margin: 0 0.15rem; }

.timeline {
  list-style: none;
  margin: 0.9rem 0 0;
  padding: 0;
  position: relative;
}
.timeline::before {
  content: '';
  position: absolute;
  top: 0.45rem;
  bottom: 0.45rem;
  left: 0.3rem;
  width: 2px;
  background: var(--rule);
  border-radius: 2px;
}
.timeline > li {
  position: relative;
  padding-left: 1.4rem;
}
.timeline > li + li { margin-top: 0.85rem; }
.timeline > li::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0.38rem;
  width: 0.65rem;
  height: 0.65rem;
  border-radius: 50%;
  background: var(--fill);
  box-shadow: 0 0 0 3px var(--surface);
}
.update-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.15rem 0.6rem;
  font-size: 0.82rem;
  color: var(--muted);
}
.update-state { font-weight: 700; color: var(--ink); }
.update-body { margin-top: 0.15rem; font-size: 0.95rem; overflow-wrap: anywhere; }
.update-body p + p, .update-body ul + p, .update-body p + ul { margin-top: 0.45rem; }
.update-body ul { margin: 0; padding-left: 1.2rem; }

.month + .month { margin-top: 1.25rem; }
.month h3 {
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 0.4rem;
}

.past-incident {
  background: var(--surface);
  border-radius: 0.85rem;
  padding: 0.75rem 1rem;
}
.past-incident + .past-incident { margin-top: 0.5rem; }
.past-incident > summary {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0 0.6rem;
  align-items: baseline;
}
.past-incident .dot {
  width: 0.6rem;
  height: 0.6rem;
  border-radius: 50%;
  background: var(--fill);
  transform: translateY(-0.05rem);
}
.past-title { font-weight: 650; }
.past-facts { grid-column: 2; font-size: 0.82rem; color: var(--muted); }
.past-incident[open] > summary { margin-bottom: 0.2rem; }
.past-incident .timeline { margin-left: 1.2rem; }
.past-incident .timeline > li::before { box-shadow: 0 0 0 3px var(--surface); }

.empty {
  background: var(--surface);
  border-radius: 0.85rem;
  padding: 0.85rem 1rem;
  color: var(--muted);
}

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

.colophon {
  margin-top: 3rem;
  padding-top: 1.5rem;
  border-top: 2px solid var(--surface-sunk);
  font-size: 0.82rem;
  color: var(--muted);
  display: grid;
  gap: 0.35rem;
}

/* Small screens: show the last 45 days, keep everything else. ------------------ */

@media (max-width: 34rem) {
  .page { padding: 1rem 1rem 2.5rem; }
  .masthead { margin-bottom: 1.25rem; }
  .wordmark { font-size: 1.25rem; }
  .brand img { height: 1.9rem; }
  .hero { grid-template-columns: 1fr; gap: 0.8rem; padding: 1.25rem; }
  .bars { height: 1.9rem; }
  .bar:nth-child(-n + 45) { display: none; }
  .bar:nth-child(46)::after, .bar:nth-child(47)::after, .bar:nth-child(48)::after,
  .bar:nth-child(49)::after, .bar:nth-child(50)::after, .bar:nth-child(51)::after {
    left: 0;
    transform: translateY(0.2rem);
  }
  .axis-far { display: none; }
  .axis-near { display: inline; }
  .history { text-align: left; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation: none !important;
    transition: none !important;
  }
}

@media (forced-colors: active) {
  .bar, .swatch, .hero-mark, .past-incident .dot, .timeline > li::before { forced-color-adjust: none; }
}
