/* Priventry status page: white body, header styled after priventry.ai.
   Status colours validated for colour-vision deficiency on white (all pairs,
   worst CVD Delta E 9.0). Colour never carries meaning alone: every state
   also has an icon and a text label, and a table view lists bad days. */

:root {
  --bg: #ffffff;
  --ink: #141412;
  --ink-2: #3d3d38;
  --muted: #63635b;
  --line: #e6e4dd;
  --rule: #d6d3ca;
  --accent: #2e5e3e;
  --accent-2: #1e6940;
  --heading: #17221b;
  --focus: #2e5e3e;

  /* Fills for the 90-day bars and legend. */
  --s-operational: #3e8343;
  --s-degraded: #e29d56;
  --s-outage: #972527;
  --s-maintenance: #2b4ea7;
  --s-nodata: #d9d6cc;

  /* Icon and status-label inks (>= 4.5:1 on white). */
  --t-operational: #1d6b2e;
  --t-degraded: #a35d00;
  --t-outage: #972527;
  --t-maintenance: #2b4ea7;

  --radius: 10px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.5 var(--font);
  overflow-x: hidden;
}

.wrap { width: min(100% - 32px, 860px); margin-inline: auto; }

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

.skip {
  position: absolute; left: 16px; top: -48px; padding: 8px 12px;
  background: var(--ink); color: #fff; border-radius: 8px; z-index: 10;
}
.skip:focus { top: 12px; }

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

/* ------------------------------------------------------------------ Header
   Follows priventry.ai: light translucent nav with a hairline, segmented
   ID | EN pill, plain sans headline, and a faint mint wash that fades into the white page. */
.nav {
  position: sticky; top: 0; z-index: 15;
  background: rgba(255, 255, 255, .86);
  -webkit-backdrop-filter: saturate(1.4) blur(12px); backdrop-filter: saturate(1.4) blur(12px);
  border-bottom: 1px solid rgba(20, 20, 18, .08);
}
.nav__row { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 68px; }
.nav__end { display: flex; align-items: center; gap: 10px; }
.brand { display: inline-flex; align-items: center; gap: 8px; color: var(--ink); text-decoration: none; }
.brand img { display: block; height: 30px; width: 30px; }
.brand__name { font-size: 19px; font-weight: 600; letter-spacing: -0.01em; }

.seg {
  display: inline-flex; padding: 3px; gap: 2px; border-radius: 999px;
  border: 1px solid rgba(20, 20, 18, .12); background: #fff;
}
.seg button {
  font: 600 12.5px/1 var(--font); letter-spacing: .02em;
  min-width: 38px; min-height: 30px; padding: 0 10px; border: 0; border-radius: 999px;
  color: var(--muted); background: transparent; cursor: pointer;
}
.seg button[aria-pressed="true"] { background: var(--ink); color: #fff; }
.seg button:not([aria-pressed="true"]):hover { color: var(--ink); }

.pill {
  display: inline-flex; align-items: center; min-height: 40px; padding: 0 18px;
  border-radius: 999px; border: 1px solid rgba(20, 20, 18, .12);
  color: var(--ink); text-decoration: none; font-size: 14.5px; font-weight: 500;
}
.pill:hover { background: #f6f5f1; }

.hero {
  background:
    radial-gradient(720px 340px at 78% 0%, rgba(30, 105, 64, .10), transparent 70%),
    radial-gradient(560px 300px at 8% 30%, rgba(132, 169, 123, .12), transparent 70%),
    linear-gradient(180deg, #f3f6f1 0%, #ffffff 100%);
  padding: 40px 0 32px;
}
.hero__title {
  margin: 0 0 24px; color: var(--heading);
  font: 600 clamp(28px, 4.6vw, 40px)/1.15 var(--font);
  letter-spacing: -0.02em;
}

/* ------------------------------------------------------------------ Summary
   A solid status bar that overlaps the header edge. White text on each fill
   meets 4.5:1. */
.summary {
  margin: 0; padding: 18px 22px; border-radius: var(--radius);
  background: var(--t-operational); color: #fff;
  display: grid; gap: 2px;
}
.summary[data-state="disrupted"] { background: var(--t-degraded); }
.summary[data-state="outage"] { background: var(--t-outage); }
.summary[data-state="maintenance"] { background: var(--t-maintenance); }
.summary[data-state="error"] { background: var(--t-outage); }
.summary[aria-busy="true"] { background: #4a4a44; }
.summary__line { margin: 0; display: flex; align-items: center; gap: 10px; font: 600 clamp(18px, 3.6vw, 21px)/1.3 var(--font); }
.summary__line .icon { width: 24px; height: 24px; flex: none; color: #fff; }
.summary__affected { margin: 4px 0 0; font-size: 15px; font-weight: 500; }
.summary__meta { margin: 6px 0 0; color: #fff; font-size: 13px; opacity: 1; }

.notice {
  margin: 0 0 28px; padding: 12px 16px; border-radius: 8px; font-size: 14px;
  background: #fdf3e7; border: 1px solid #f0c99c; color: var(--ink);
}

/* ------------------------------------------------------------------ Sections */
main { padding-top: 32px; }
.block { margin: 0 0 40px; }
.block h2 { font: 600 19px/1.3 var(--font); margin: 0 0 12px; }
.block__head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 4px 16px; }
.block__hint { margin: 0 0 10px; color: var(--muted); font-size: 13px; }

/* Components */
.components { list-style: none; margin: 0; padding: 0; border: 1px solid var(--line); border-radius: var(--radius); }
.component { padding: 18px 20px 14px; }
.component + .component { border-top: 1px solid var(--line); }
.component__head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 4px 12px; }
.component__title { min-width: 0; }
.component__name { margin: 0; font-weight: 600; font-size: 16px; overflow-wrap: anywhere; }
.component__desc { margin: 2px 0 0; color: var(--muted); font-size: 13px; }
.state { display: inline-flex; align-items: center; gap: 6px; font-size: 14px; font-weight: 500; white-space: nowrap; }
.state[data-state="operational"] { color: var(--t-operational); }
.state[data-state="degraded"] { color: var(--t-degraded); }
.state[data-state="outage"] { color: var(--t-outage); }
.state[data-state="maintenance"] { color: var(--t-maintenance); }
.icon { width: 18px; height: 18px; flex: none; }
.icon--operational { color: var(--t-operational); }
.icon--degraded { color: var(--t-degraded); }
.icon--outage { color: var(--t-outage); }
.icon--maintenance { color: var(--t-maintenance); }
.icon--error { color: var(--t-outage); }

/* 90-day bar: one focusable group; arrow keys move between days. */
.bars {
  margin: 12px 0 8px; height: 34px;
  display: grid; grid-template-columns: repeat(var(--days, 90), minmax(0, 1fr)); gap: 2px;
  align-items: stretch; touch-action: pan-y; border-radius: 3px;
}
.bar { border-radius: 2px; background: var(--s-nodata); }
.bar[data-state="operational"] { background: var(--s-operational); }
.bar[data-state="degraded"] { background: var(--s-degraded); }
.bar[data-state="outage"] { background: var(--s-outage); }
.bar[data-state="maintenance"] { background: var(--s-maintenance); }
.bar.is-active { box-shadow: 0 0 0 2px var(--bg), 0 0 0 4px var(--ink); }
.bars:hover .bar:not(.is-active) { opacity: .8; }

.component__foot {
  display: flex; align-items: center; gap: 12px;
  color: var(--muted); font-size: 13px; font-variant-numeric: tabular-nums; white-space: nowrap;
}
.component__foot .rule { flex: 1; height: 1px; background: var(--rule); min-width: 12px; }
.component__foot .uptime { color: var(--ink-2); }

/* Legend */
.legend { list-style: none; margin: 12px 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px 16px; color: var(--muted); font-size: 13px; }
.legend li { display: inline-flex; align-items: center; gap: 6px; }
.swatch { width: 10px; height: 14px; border-radius: 2px; background: var(--s-nodata); }
.swatch[data-state="operational"] { background: var(--s-operational); }
.swatch[data-state="degraded"] { background: var(--s-degraded); }
.swatch[data-state="outage"] { background: var(--s-outage); }
.swatch[data-state="maintenance"] { background: var(--s-maintenance); }

/* Table view */
.table-view { margin-top: 14px; font-size: 14px; }
.table-view summary { cursor: pointer; color: var(--accent); padding: 6px 0; }
.table-view table { width: 100%; border-collapse: collapse; margin-top: 8px; font-variant-numeric: tabular-nums; }
.table-view th, .table-view td { text-align: left; padding: 6px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
.table-view th { color: var(--muted); font-weight: 600; }

/* Incidents */
.incidents { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.incident {
  border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px;
  border-left: 4px solid var(--s-degraded);
}
.incident[data-tone="outage"] { border-left-color: var(--s-outage); }
.incident[data-tone="maintenance"] { border-left-color: var(--s-maintenance); }
.incident__head { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px 12px; }
.incident h3 { margin: 0; font-size: 16px; line-height: 1.35; overflow-wrap: anywhere; }
.incident__meta { margin: 4px 0 0; color: var(--muted); font-size: 13.5px; }
.incident__affects { margin: 10px 0 0; display: flex; flex-wrap: wrap; gap: 6px; }
.chip { padding: 2px 10px; border-radius: 999px; background: #f3f2ee; color: var(--ink-2); font-size: 12.5px; }

.badge {
  flex: none; padding: 2px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap;
  background: #f3f2ee; color: var(--ink-2);
}
.badge[data-tone="degraded"] { background: #fbeedd; color: #8a4f00; }
.badge[data-tone="outage"] { background: #f7e1e1; color: #85171c; }
.badge[data-tone="maintenance"] { background: #e3eaf8; color: #22438f; }
.badge[data-tone="resolved"] { background: #e3f0e4; color: #1d6b2e; }

.updates { list-style: none; margin: 14px 0 0; padding: 0; display: grid; gap: 12px; font-size: 14.5px; }
.updates time { display: block; color: var(--muted); font-size: 12.5px; }
.updates p { margin: 2px 0 0; overflow-wrap: anywhere; }
.older { margin-top: 10px; font-size: 13.5px; }
.older summary, .table-view summary { cursor: pointer; color: var(--accent); padding: 4px 0; width: fit-content; }
.older .updates { margin-top: 8px; padding-left: 12px; border-left: 2px solid var(--line); }

/* Past announcements: one line each, open for details. */
.incident--past { padding: 0; border-left: 1px solid var(--line); }
.incident--past > details > summary { list-style: none; cursor: pointer; padding: 14px 18px; border-radius: var(--radius); }
.incident--past > details > summary::-webkit-details-marker { display: none; }
.incident--past > details > summary:hover { background: #fafaf8; }
.incident--past .incident__head h3::before {
  content: "›"; display: inline-block; width: 14px; color: var(--muted); transition: transform .15s ease;
}
.incident--past > details[open] .incident__head h3::before { transform: rotate(90deg); }
.incident--past .incident__meta { padding-left: 14px; }
.incident__body { padding: 0 18px 16px 32px; }
.incident__body .incident__affects { margin-top: 0; }
.empty { color: var(--muted); font-size: 14px; }

/* Tooltip */
.tip {
  position: fixed; z-index: 20; pointer-events: none; max-width: min(260px, calc(100vw - 24px));
  padding: 8px 10px; border-radius: 8px; font-size: 13px; line-height: 1.4;
  background: var(--ink); color: #fff; box-shadow: 0 6px 20px rgba(0, 0, 0, .18);
}
.tip strong { display: block; font-weight: 600; }

/* Help block: the way out when something is wrong. Buttons follow
   priventry.ai (dark pill primary, outlined pill secondary). */
.help {
  display: flex; align-items: center; justify-content: space-between; gap: 24px;
  margin-top: 8px; padding: 26px 28px; border-radius: 16px;
  background: linear-gradient(180deg, #f3f6f1 0%, #f8faf7 100%);
  border: 1px solid #e4ebe2;
}
.help__text { flex: 1 1 auto; min-width: 0; }
.help h2 { margin: 0 0 4px; font-size: 18px; font-weight: 600; letter-spacing: -0.01em; }
.help p { margin: 0; color: var(--ink-2); font-size: 15px; }
.help__actions { flex: none; display: flex; gap: 10px; }
/* Not enough room for one row: stack and centre, never leave a ragged gap. */
@media (max-width: 820px) {
  .help { flex-direction: column; text-align: center; padding: 28px 22px; gap: 18px; }
  .help__actions { justify-content: center; flex-wrap: wrap; }
}
.btn {
  display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 20px;
  border-radius: 999px; font-size: 14.5px; font-weight: 500; text-decoration: none; white-space: nowrap;
}
.btn .icon { width: 17px; height: 17px; }
.btn--dark { background: var(--ink); color: #fff; }
.btn--dark:hover { background: #2a2a27; }
.btn--ghost { color: var(--ink); border: 1px solid rgba(20, 20, 18, .16); background: #fff; }
.btn--ghost:hover { background: #f6f5f1; }

.foot { padding: 28px 0 40px; color: var(--muted); font-size: 13px; text-align: center; }
.foot a:hover { color: var(--ink); }

@media (max-width: 560px) {
  .hero { padding: 28px 0 28px; }
  .hero__title { margin-bottom: 18px; }
  main { padding-top: 28px; }
  .pill { display: none; }
  .help { padding: 22px 18px; }
  .help__actions, .btn { width: 100%; }
  .btn { justify-content: center; }
  .bars { height: 30px; }
  .component__foot { gap: 8px; font-size: 12px; }
  .component__foot .rule { min-width: 6px; }
  .component { padding: 14px 14px 12px; }
}

@media (forced-colors: active) {
  .bar, .swatch { forced-color-adjust: none; border: 1px solid CanvasText; }
}

@media (prefers-reduced-motion: no-preference) {
  .bar { transition: opacity .12s ease; }
}
