/* Layout primitives: structure only. In a layer, so the rules below always win. */
@layer layout {
  :where(.od-stack,.od-row,.od-row-top,.od-cluster) > :where(*) { min-width: 0; }
  .od-stack   { display: flex; flex-direction: column; gap: var(--od-gap, 8px); }
  .od-row     { display: flex; align-items: center; gap: var(--od-gap, 8px); }
  .od-row-top { display: flex; align-items: flex-start; gap: var(--od-gap, 8px); }
  .od-cluster { display: flex; flex-wrap: wrap; align-items: center; gap: var(--od-gap, 8px); }
  .od-fill    { flex: 1 1 0; min-width: 0; }
  .od-fixed   { flex: none; }
  .od-truncate { display: block; max-width: 100%; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
  .od-nowrap  { white-space: nowrap; }
}

/* VanguardCode brand: Inter throughout, slate ground, indigo accent, 18px cards, soft wide shadows. */
@font-face {
  font-family: 'Inter';
  src: url("inter.woff2") format('woff2-variations'), url("inter.woff2") format('woff2');
  font-weight: 100 900; font-style: normal; font-display: swap;
}

:root {
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;

  --fs-12: 12px; --fs-13: 13px; --fs-14: 14px; --fs-16: 16px; --fs-18: 18px; --fs-20: 20px;
  --fs-display: clamp(30px, 4.6vw + 12px, 46px);
  --sp-1: 4px; --sp-2: 8px; --sp-3: 12px; --sp-4: 16px; --sp-5: 20px; --sp-6: 24px; --sp-8: 32px; --sp-10: 40px; --sp-12: 48px; --sp-16: 64px;
  --r-sm: 8px; --r-ctl: 12px; --r-card: 18px; --r-pill: 999px;
  --container: 880px;
  --dur-fast: 150ms; --dur: 200ms; --dur-exit: 130ms;
  --ease-out: cubic-bezier(.2,.7,.3,1); --ease-in: cubic-bezier(.5,0,.8,.4);

  --bg: #f6f8fc; --surface: #ffffff; --surface-2: #eef1f9;
  --line: rgba(15,23,42,.08); --line-strong: rgba(15,23,42,.14);
  --ink: #0b1220; --ink-2: #1e293b; --body: #334155; --muted: #475569;
  --accent: #4f46e5; --accent-hover: #4338ca; --accent-soft: #eef2ff; --focus: #4f46e5;

  --ok: #15803d;   --ok-bar: #22a05a;  --ok-soft: #e7f7ee;
  --warn: #a16207; --warn-bar: #e0a21a; --warn-soft: #fdf4dc;
  --bad: #b91c1c;  --bad-bar: #dc3a3a;  --bad-soft: #fdeaea;
  --info: #1d4ed8; --info-bar: #3b74e6; --info-soft: #e6eefd;
  --none: #475569; --none-bar: #d5dbe6; --none-soft: #eef1f6;

  --sh-sm: 0 1px 2px rgba(15,23,42,.04), 0 2px 8px rgba(15,23,42,.04);
  --sh-md: 0 2px 4px rgba(15,23,42,.04), 0 12px 32px rgba(15,23,42,.07);
  --sh-tip: 0 8px 24px rgba(15,23,42,.18);
  --tip-bg: #0b1220; --tip-text: #eef2ff; --tip-muted: #b4bcd6;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0b1024; --surface: #141a3a; --surface-2: #1a2148;
    --line: rgba(199,210,254,.10); --line-strong: rgba(199,210,254,.18);
    --ink: #eef2ff; --ink-2: #dfe4f7; --body: #c3c9e0; --muted: #a3aac6;
    --accent: #a5b4fc; --accent-hover: #c7d2fe; --accent-soft: #232a5c; --focus: #a5b4fc;

    --ok: #4ade80;   --ok-bar: #34c46f;  --ok-soft: #10301f;
    --warn: #fbbf24; --warn-bar: #e3a92a; --warn-soft: #352a0d;
    --bad: #f87171;  --bad-bar: #e25757;  --bad-soft: #3a1619;
    --info: #93c5fd; --info-bar: #5b8ff0; --info-soft: #172a52;
    --none: #a3aac6; --none-bar: #2f376a; --none-soft: #1a2148;

    --sh-sm: 0 1px 2px rgba(0,0,0,.3);
    --sh-md: 0 12px 32px rgba(0,0,0,.35);
    --sh-tip: 0 10px 28px rgba(0,0,0,.55);
    --tip-bg: #eef2ff; --tip-text: #0b1220; --tip-muted: #475569;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--body);
  font: 400 var(--fs-16)/1.6 var(--font); font-feature-settings: 'cv11', 'ss01';
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-underline-offset: 3px; }
a:hover { color: var(--accent-hover); }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 3px; border-radius: 4px; }
.num { font-variant-numeric: tabular-nums; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.wrap { max-width: var(--container); margin: 0 auto; padding: 0 var(--sp-4); }
@media (min-width: 768px) { .wrap { padding: 0 var(--sp-6); } }

/* ---------- Header ---------- */
.top { padding-top: var(--sp-6); padding-bottom: var(--sp-6); justify-content: space-between; }
.brand { --od-gap: 10px; color: var(--ink); text-decoration: none; font-weight: 700; font-size: var(--fs-18); letter-spacing: -.02em; }
.brand:hover { color: var(--ink); }
.brand img { width: 34px; height: auto; }
.brand-tag {
  font-size: var(--fs-12); font-weight: 650; color: var(--accent); background: var(--accent-soft);
  border-radius: var(--r-pill); padding: 2px 10px; letter-spacing: 0;
}
.top-link { font-size: var(--fs-14); font-weight: 600; text-decoration: none; min-height: 44px; display: inline-flex; align-items: center; }
.top-link:hover { text-decoration: underline; }
@media (max-width: 479px) { .top-link { display: none; } } /* it's in the footer too */

/* ---------- Eyebrow + headings ---------- */
.eyebrow { margin: 0; font-size: var(--fs-12); font-weight: 700; letter-spacing: .16em; text-transform: uppercase; color: var(--accent); }
h1, h2, h3 { color: var(--ink); margin: 0; }
h2 { font-size: var(--fs-20); font-weight: 800; letter-spacing: -.02em; line-height: 1.3; }
h3 { font-size: var(--fs-16); font-weight: 700; letter-spacing: -.01em; line-height: 1.4; }
.section { margin-top: var(--sp-12); }
.section-head { --od-gap: 4px; margin-bottom: var(--sp-4); }
.section-head p { margin: 0; color: var(--muted); font-size: var(--fs-14); }

/* ---------- Hero / overall ---------- */
.hero {
  --tone: var(--none); --tone-soft: var(--none-soft);
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-card); box-shadow: var(--sh-md);
  padding: var(--sp-6); display: grid; gap: var(--sp-5);
  grid-template-columns: auto minmax(0, 1fr); align-items: center;
  position: relative; overflow: hidden;
}
.hero::before { /* tonal wash from the status colour, decorative */
  content: ''; position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(120% 140% at 0% 0%, var(--tone-soft) 0%, transparent 55%);
}
.hero > * { position: relative; }
@media (min-width: 768px) { .hero { padding: var(--sp-8) var(--sp-10); gap: var(--sp-6); } }
.hero.operational { --tone: var(--ok); --tone-soft: var(--ok-soft); }
.hero.outage      { --tone: var(--bad); --tone-soft: var(--bad-soft); }
.hero.degraded    { --tone: var(--warn); --tone-soft: var(--warn-soft); }
.hero.maintenance { --tone: var(--info); --tone-soft: var(--info-soft); }

.hero-badge {
  width: 56px; height: 56px; border-radius: 50%; display: grid; place-items: center;
  background: var(--tone-soft); color: var(--tone); box-shadow: inset 0 0 0 1px var(--line);
}
.hero-badge svg { width: 28px; height: 28px; }
@media (min-width: 768px) { .hero-badge { width: 72px; height: 72px; } .hero-badge svg { width: 34px; height: 34px; } }
.hero-copy { --od-gap: 8px; }
.hero h1 { font-size: var(--fs-display); font-weight: 800; letter-spacing: -.03em; line-height: 1.08; text-wrap: balance; }
.hero .eyebrow { color: var(--tone); }
.hero.loading .eyebrow, .hero.stale .eyebrow { color: var(--muted); }
.hero-meta { --od-gap: 8px 16px; margin: 0; color: var(--muted); font-size: var(--fs-14); }
.hero-note { margin: 0; color: var(--body); font-size: var(--fs-16); max-width: 60ch; }
.live { --od-gap: 8px; }
.live-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--tone); position: relative; flex: none; }
.live-dot::after {
  content: ''; position: absolute; inset: 0; border-radius: 50%; background: var(--tone);
  animation: pulse 2.4s var(--ease-out) infinite;
}
.hero.stale .live-dot::after, .hero.loading .live-dot::after { animation: none; }
@keyframes pulse { 0% { transform: scale(1); opacity: .5; } 70%, 100% { transform: scale(2.6); opacity: 0; } }

/* ---------- Cards ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-card); box-shadow: var(--sh-sm); }
.stack-cards { display: grid; gap: var(--sp-3); }

/* ---------- Pills ---------- */
.pill {
  --tone: var(--none); --tone-soft: var(--none-soft);
  display: inline-flex; align-items: center; gap: 6px; white-space: nowrap;
  font-size: var(--fs-13); font-weight: 650; line-height: 1; color: var(--tone);
  background: var(--tone-soft); border-radius: var(--r-pill); padding: 6px 10px 6px 8px;
}
.pill svg { width: 14px; height: 14px; flex: none; }
.pill.operational, .pill.resolved { --tone: var(--ok); --tone-soft: var(--ok-soft); }
.pill.outage, .pill.investigating, .pill.critical, .pill.major { --tone: var(--bad); --tone-soft: var(--bad-soft); }
.pill.degraded, .pill.identified, .pill.minor { --tone: var(--warn); --tone-soft: var(--warn-soft); }
.pill.maintenance, .pill.monitoring, .pill.scheduled, .pill.inprogress { --tone: var(--info); --tone-soft: var(--info-soft); }

/* ---------- Incidents ---------- */
.incident { padding: var(--sp-5); }
@media (min-width: 768px) { .incident { padding: var(--sp-6); } }
.incident-head { --od-gap: 12px; justify-content: space-between; }
.incident-head h3 { font-size: var(--fs-18); }
.incident-meta { margin: var(--sp-1) 0 0; color: var(--muted); font-size: var(--fs-14); }
.timeline { list-style: none; margin: var(--sp-5) 0 0; padding: 0; display: grid; gap: var(--sp-4); }
.timeline li { display: grid; grid-template-columns: 16px minmax(0, 1fr); column-gap: var(--sp-3); position: relative; }
.timeline li::before { /* rail */
  content: ''; position: absolute; left: 7px; top: 18px; bottom: calc(-1 * var(--sp-4)); width: 2px; background: var(--line-strong);
}
.timeline li:last-child::before { display: none; }
.tl-dot { width: 10px; height: 10px; margin: 7px 0 0 3px; border-radius: 50%; background: var(--surface); box-shadow: 0 0 0 2px var(--line-strong); }
.timeline li:first-child .tl-dot { background: var(--tone, var(--muted)); box-shadow: 0 0 0 3px var(--tone-soft, var(--surface-2)); }
.tl-body { --od-gap: 2px; }
.tl-status { font-size: var(--fs-14); font-weight: 700; color: var(--ink); text-transform: capitalize; }
.tl-msg { color: var(--body); font-size: var(--fs-16); max-width: 68ch; }
.tl-time { color: var(--muted); font-size: var(--fs-13); }
.incident.open.investigating, .incident.open.identified { --tone: var(--bad); --tone-soft: var(--bad-soft); }
.incident.open.monitoring { --tone: var(--info); --tone-soft: var(--info-soft); }
.incident.past { --tone: var(--ok); --tone-soft: var(--ok-soft); box-shadow: none; }

/* Past incidents are compact: timeline behind a disclosure */
.past-item { padding: var(--sp-4) var(--sp-5); }
.past-item summary { list-style: none; cursor: pointer; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: var(--sp-3); align-items: center; min-height: 44px; border-radius: var(--r-sm); }
.past-item summary::-webkit-details-marker { display: none; }
.past-item summary .chev { width: 20px; height: 20px; color: var(--muted); transition: transform var(--dur) var(--ease-out); }
.past-item[open] summary .chev { transform: rotate(180deg); }
.past-item h3 { font-size: var(--fs-16); }
.past-item .incident-meta { margin-top: 2px; }
.past-item .timeline { margin-top: var(--sp-4); }
@media (hover: hover) { .past-item summary:hover h3 { color: var(--accent); } }

/* ---------- Maintenance ---------- */
.maint { padding: var(--sp-5); display: grid; grid-template-columns: auto minmax(0, 1fr); gap: var(--sp-4); align-items: start; }
@media (min-width: 768px) { .maint { padding: var(--sp-6); gap: var(--sp-6); } }
.cal {
  width: 60px; border-radius: var(--r-ctl); overflow: hidden; text-align: center; background: var(--surface-2);
  box-shadow: inset 0 0 0 1px var(--line);
}
.cal-m { display: block; background: var(--info); color: var(--surface); font-size: var(--fs-12); font-weight: 700; letter-spacing: .08em; text-transform: uppercase; padding: 3px 0; }
.cal-d { display: block; font-size: 24px; font-weight: 800; color: var(--ink); letter-spacing: -.02em; padding: 4px 0 6px; line-height: 1.2; }
.maint-body { --od-gap: 8px; }
.maint-head { --od-gap: 8px 12px; justify-content: space-between; }
.maint-when { margin: 0; color: var(--ink-2); font-size: var(--fs-14); font-weight: 600; }
.maint-desc { margin: 0; color: var(--body); max-width: 68ch; }
.chips { --od-gap: 6px; margin-top: var(--sp-1); }
.chip { font-size: var(--fs-13); font-weight: 600; color: var(--ink-2); background: var(--surface-2); border-radius: var(--r-pill); padding: 4px 10px; white-space: nowrap; }

/* ---------- Components ---------- */
.components { overflow: visible; }
.component { padding: var(--sp-5); border-top: 1px solid var(--line); }
.component:first-child { border-top: 0; }
@media (min-width: 768px) { .component { padding: var(--sp-6); } }
.comp-head { --od-gap: 12px; justify-content: space-between; align-items: flex-start; }
.comp-name { --od-gap: 2px; }
.comp-name h3 { font-size: var(--fs-16); }
.comp-name p { margin: 0; color: var(--muted); font-size: var(--fs-14); }

.bars {
  display: flex; gap: 2px; height: 36px; margin-top: var(--sp-4); align-items: stretch;
  border-radius: var(--r-sm); cursor: default;
}
.bars i {
  flex: 1 1 0; min-width: 1px; border-radius: 2px; background: var(--none-bar);
  transition: opacity var(--dur-fast) var(--ease-out), transform var(--dur-fast) var(--ease-out);
  transform-origin: bottom;
}
.bars i.ok { background: var(--ok-bar); }
.bars i.warn { background: var(--warn-bar); }
.bars i.bad { background: var(--bad-bar); }
.bars i.m { background: var(--info-bar); }
.bars.active i { opacity: .45; }
.bars.active i.on { opacity: 1; transform: scaleY(1.08); }
.stale-doc .bars { filter: grayscale(1); opacity: .55; }
.range { --od-gap: 12px; justify-content: space-between; color: var(--muted); font-size: var(--fs-13); margin-top: var(--sp-2); }
.range .uptime { color: var(--ink-2); font-weight: 650; }
.range .mobile { display: none; }
@media (max-width: 559px) {
  .bars { gap: 1px; height: 32px; }
  .bars i:nth-child(-n+60) { display: none; }  /* last 30 days on small screens */
  .range .desktop { display: none; }
  .range .mobile { display: inline; }
}

.legend { --od-gap: 8px 20px; color: var(--muted); font-size: var(--fs-13); margin: var(--sp-4) 0 0; padding: 0 var(--sp-1); }
.legend span { display: inline-flex; align-items: center; gap: 8px; }
.legend i { width: 10px; height: 14px; border-radius: 2px; background: var(--none-bar); flex: none; }
.legend i.ok { background: var(--ok-bar); } .legend i.warn { background: var(--warn-bar); }
.legend i.bad { background: var(--bad-bar); } .legend i.m { background: var(--info-bar); }

/* Tooltip for a day: a decorative overlay, fixed to the viewport, positioned from the hovered bar */
.tip {
  position: fixed; top: 0; left: 0; z-index: 10; pointer-events: none;
  width: max-content; max-width: 240px; padding: 10px 12px; border-radius: var(--r-ctl);
  background: var(--tip-bg); color: var(--tip-text); box-shadow: var(--sh-tip);
  font-size: var(--fs-13); line-height: 1.45;
  opacity: 0; transition: opacity var(--dur-exit) var(--ease-in);
}
.tip.show { opacity: 1; transition: opacity var(--dur-fast) var(--ease-out); }
.tip-date { display: block; font-weight: 700; }
.tip-line { display: block; color: var(--tip-muted); }
.tip-line b { color: var(--tip-text); font-weight: 650; }

/* ---------- Empty & footer ---------- */
.empty { padding: var(--sp-5); color: var(--muted); font-size: var(--fs-14); --od-gap: 12px; }
.empty svg { width: 20px; height: 20px; color: var(--ok); flex: none; }
.foot { margin-top: var(--sp-16); padding-top: var(--sp-6); padding-bottom: var(--sp-10); border-top: 1px solid var(--line); color: var(--muted); font-size: var(--fs-14); --od-gap: 12px 24px; justify-content: space-between; }
.foot nav { --od-gap: 4px 20px; }
.foot nav a { font-weight: 600; text-decoration: none; min-height: 44px; display: inline-flex; align-items: center; }
.foot nav a:hover { text-decoration: underline; }

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