/* IHRDC Status — stylesheet
 * Drop-in replacement for /css/styles.css. Written against the existing
 * class names in the status templates; no markup changes required.
 * All values come from the IHRDC design system (colors_and_type.css).
 * ------------------------------------------------------------------ */

@font-face { font-family: 'Lato'; font-style: normal; font-weight: 300; font-display: swap; src: url('/fonts/Lato-Light.woff2') format('woff2'); }
@font-face { font-family: 'Lato'; font-style: normal; font-weight: 400; font-display: swap; src: url('/fonts/Lato-Regular.woff2') format('woff2'); }
@font-face { font-family: 'Lato'; font-style: normal; font-weight: 700; font-display: swap; src: url('/fonts/Lato-Bold.woff2') format('woff2'); }

:root {
  /* Brand */
  --ihrdc-blue: #005796;
  --ihrdc-blue-shade-1: #004373;
  --ihrdc-blue-tint-2: #66A0C5;
  --ihrdc-blue-tint-3: #B2CFE2;
  --ihrdc-navy: #154675;
  --ihrdc-dark-navy: #112A46;

  /* Neutrals */
  --fg-1: #112A46;
  --fg-2: #44546B;
  --fg-3: #615D59;
  --fg-on-dark: #FFFFFF;
  --fg-on-dark-2: #C9D6E2;
  --bg-page: #FFFFFF;
  --bg-subtle: #F7F8FA;
  --border-1: #DBDFE5;
  --border-2: #E6E6E6;
  --focus-ring: #2E8FD6;

  /* Status */
  --ok: #5E9732;    /* operational */
  --warn: #D9AB2B;  /* partially degraded */
  --bad: #CF6926;   /* degraded / failing */
  --none: #E6E6E6;  /* no data */
  --none-fg: #615D59; /* no-data used as text */
  --info: #005796;  /* informational readings */

  /* White knockout logo, used in dark mode. Override if your app serves it
     from a different path. */
  --logo-white: url('/img/IHRDC-LOGO-White.svg');

  --font-sans: 'Lato', 'Helvetica Neue', Calibri, Arial, sans-serif;
  --font-mono: 'Courier New', ui-monospace, Menlo, monospace;
  --ease: cubic-bezier(0.2, 0, 0.2, 1);
}

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

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

body {
  margin: 0;
  background: var(--bg-page);
  color: var(--fg-1);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a { color: var(--ihrdc-blue); text-decoration: none; }
a:hover { color: var(--ihrdc-blue-shade-1); text-decoration: underline; }
:focus-visible { outline: 2px solid var(--focus-ring); outline-offset: 2px; }

code, .inline { font-family: var(--font-mono); }

.wrap {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 32px;
}

/* ---------------------------------------------------------------- Header */
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  height: 72px;
  display: flex;
  align-items: center;
  background: var(--bg-page);
  border-bottom: 1px solid var(--border-1);
}
.topbar-inner { display: flex; align-items: center; justify-content: space-between; gap: 32px; }
.brand { display: flex; align-items: center; gap: 16px; }
.brand:hover { text-decoration: none; }
.brand img { display: block; height: 26px; width: auto; }
.brand-rule { width: 1px; height: 24px; background: var(--border-1); }
.brand-word {
  font-size: 14px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.12em; color: var(--fg-2);
}
.nav { display: flex; align-items: center; gap: 28px; }
.nav a { font-size: 14px; color: var(--fg-2); }
.nav a:hover { color: var(--ihrdc-blue); }
.nav a.active { font-weight: 700; color: var(--ihrdc-blue); }

/* ------------------------------------------------------------------ Hero */
.hero {
  background: var(--ihrdc-dark-navy);
  color: var(--fg-on-dark);
  padding: 72px 0 64px;
}
.hero-inner {
  display: flex; flex-wrap: wrap; align-items: flex-end;
  justify-content: space-between; gap: 40px;
}
.hero-main { display: flex; flex-direction: column; gap: 20px; max-width: 760px; }
.eyebrow { display: flex; align-items: center; gap: 12px; }
.eyebrow-rule { width: 40px; height: 2px; background: var(--ihrdc-blue-tint-2); flex: none; }
/* On the status hero the domain is the page subject, so it carries the
   scale and the outage state sits under it. */
.eyebrow-text {
  font-size: 26px; font-weight: 700; line-height: 1.2;
  letter-spacing: -0.01em; color: var(--fg-on-dark);
}
.hero-headline { display: flex; align-items: center; gap: 12px; }
.hero-main { gap: 14px; }
.hero-headline h1 {
  margin: 0; font-size: 24px; font-weight: 700; line-height: 1.25;
  letter-spacing: -0.01em; color: var(--fg-on-dark); text-wrap: balance;
}
.hero-lead {
  margin: 0; font-size: 18px; font-weight: 300; line-height: 1.65;
  color: var(--fg-on-dark-2); text-wrap: pretty;
}
.hero-side { display: flex; flex-direction: column; gap: 12px; align-items: flex-start; }
.hero-meta { margin: 0; font-size: 13px; line-height: 1.6; color: var(--fg-on-dark-2); }

.status-dot {
  width: 11px; height: 11px; border-radius: 999px; flex: none;
  background: var(--ok);
  animation: ihrdc-pulse 2.4s var(--ease) infinite;
}
.status-dot.degraded { background: var(--warn); }
.status-dot.down { background: var(--bad); }
.status-dot.unknown { background: var(--none); animation: none; }
@keyframes ihrdc-pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.35; } }
@media (prefers-reduced-motion: reduce) { .status-dot { animation: none; } }

/* --------------------------------------------------------------- Sections */
main.wrap { padding-top: 64px; padding-bottom: 80px; }
.section + .section { margin-top: 64px; }
.section-head {
  display: flex; flex-wrap: wrap; align-items: flex-end;
  justify-content: space-between; gap: 24px;
  padding-bottom: 16px; margin-bottom: 24px;
  border-bottom: 1px solid var(--border-1);
}
.section-head-text { display: flex; flex-direction: column; gap: 8px; }
.section-eyebrow {
  font-size: 12px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.12em; color: var(--ihrdc-blue);
}
.section-eyebrow a { color: inherit; }
.section-head h2 { margin: 0; font-size: 32px; font-weight: 700; line-height: 1.3; color: var(--fg-1); }
.section-note { font-size: 13px; color: var(--fg-3); }

/* ------------------------------------------------------------------ Cards */
.cards { display: flex; flex-direction: column; gap: 12px; }
.card {
  position: relative;
  background: var(--bg-page);
  border: 1px solid var(--border-1);
  border-radius: 4px;
  box-shadow: 0 1px 2px rgba(17, 42, 70, 0.06), 0 1px 1px rgba(17, 42, 70, 0.04);
  padding: 24px 24px 20px;
  display: flex; flex-direction: column; gap: 18px;
  transition: box-shadow 200ms var(--ease), transform 200ms var(--ease);
}
.card:hover {
  box-shadow: 0 2px 6px rgba(17, 42, 70, 0.08), 0 1px 2px rgba(17, 42, 70, 0.05);
  transform: translateY(-2px);
}
/* State reads as a 3px top stripe — never a left border */
.card::before {
  content: ""; position: absolute; top: -1px; left: -1px; right: -1px;
  height: 3px; border-radius: 4px 4px 0 0; background: var(--border-2);
}
.card.operational::before { background: var(--ok); }
.card.degraded::before { background: var(--warn); }
.card.down::before { background: var(--bad); }

.card-top {
  display: flex; flex-wrap: wrap; align-items: flex-start;
  justify-content: space-between; gap: 20px;
}
.card-ident { display: flex; align-items: flex-start; gap: 16px; flex: 1; min-width: 300px; }
.card-num {
  flex: none; width: 26px; height: 26px; border-radius: 2px;
  background: var(--bg-subtle); border: 1px solid var(--border-1);
  font-family: var(--font-mono); font-size: 12px; color: var(--fg-2);
  display: flex; align-items: center; justify-content: center;
}
.card-text { display: flex; flex-direction: column; gap: 6px; }
.card-title { display: flex; flex-wrap: wrap; align-items: baseline; gap: 10px; }
.card-name { font-size: 18px; font-weight: 700; color: var(--ihrdc-blue); }
.card-slug {
  font-size: 12px; white-space: nowrap; background: var(--bg-subtle); border-radius: 2px;
  padding: 2px 6px; color: var(--ihrdc-dark-navy);
}
.card-desc { margin: 0; font-size: 14px; line-height: 1.5; color: var(--fg-2); text-wrap: pretty; }
.card-status { display: flex; align-items: center; gap: 20px; }
.card-note {
  margin: 0; padding-left: 42px; font-size: 13px; line-height: 1.5; color: var(--fg-3);
}
.card-note + .card-note { margin-top: -10px; }

.pill {
  display: inline-flex; align-items: center; gap: 8px;
  border-radius: 999px; padding: 6px 14px 6px 10px;
  background: var(--bg-subtle); border: 1px solid var(--border-1);
  font-size: 13px; font-weight: 700; white-space: nowrap;
  color: var(--ok);
}
.pill::before { content: ""; width: 8px; height: 8px; border-radius: 999px; background: currentColor; }
.pill.degraded { color: var(--warn); }
.pill.down { color: var(--bad); }
.pill.unknown { color: var(--none-fg); }
.pill.info { color: var(--info); }

.uptime { text-align: right; min-width: 92px; }
.uptime-value { font-size: 20px; font-weight: 700; color: var(--fg-1); font-variant-numeric: tabular-nums; }
.uptime-label { font-size: 11px; text-transform: uppercase; letter-spacing: 0.12em; color: var(--fg-3); }

/* Component dots on the overview cards */
.site-dots { display: flex; gap: 4px; }
.site-dot {
  width: 10px; height: 10px; border-radius: 2px; background: var(--ok);
}
.site-dot.degraded { background: var(--warn); }
.site-dot.down { background: var(--bad); }
.site-dot.unknown, .site-dot.nodata { background: var(--none); }
.site-dot.info { background: var(--info); }

/* ------------------------------------------------------------- 90-day strip */
.strip-block { display: flex; flex-direction: column; gap: 8px; }
.strip { display: flex; gap: 2px; height: 32px; align-items: stretch; }
.cell { flex: 1; min-width: 2px; border-radius: 1px; background: var(--ok); }
.cell.ok, .cell.operational { background: var(--ok); }
.cell.degraded { background: var(--warn); }
.cell.down { background: var(--bad); }
.cell.nodata, .cell.unknown { background: var(--none); }
.strip-legend {
  display: flex; flex-wrap: wrap; align-items: baseline;
  gap: 6px; font-size: 12px; color: var(--fg-3);
}
.strip-legend .mid { color: var(--fg-2); }
.strip-legend .mid::before { content: "\00b7"; margin-right: 6px; color: var(--fg-3); }
/* "today" is implied by the right edge of the strip */
.strip-legend > span:last-child { display: none; }

/* ------------------------------------------------------------ Signals table */
.table-scroll {
  border: 1px solid var(--border-1); border-radius: 4px;
  overflow-x: auto; background: var(--bg-page);
}
table.signals { width: 100%; border-collapse: collapse; font-size: 14px; }
table.signals th {
  text-align: left; padding: 12px 20px; white-space: nowrap;
  background: var(--bg-subtle); border-bottom: 1px solid var(--border-1);
  font-size: 11px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.12em; color: var(--fg-3);
}
table.signals td { padding: 12px 20px; border-bottom: 1px solid var(--border-1); vertical-align: top; }
table.signals tbody tr:last-child td { border-bottom: 0; }
table.signals tbody tr:hover { background: var(--bg-subtle); }
table.signals tr.informational td { color: var(--fg-3); }
table.signals .num {
  text-align: right; font-family: var(--font-mono); font-size: 13px;
  font-variant-numeric: tabular-nums; white-space: nowrap;
}
table.signals .muted { color: var(--fg-2); }
table.signals .nowrap { white-space: nowrap; }
table.signals code.inline {
  font-size: 12px; background: var(--bg-subtle); border-radius: 2px; padding: 1px 5px;
}
.state-text { font-weight: 700; color: var(--ok); white-space: nowrap; }
.state-text.degraded { color: var(--warn); }
.state-text.down { color: var(--bad); }
.state-text.unknown { color: var(--none-fg); font-weight: 400; }

/* ----------------------------------------------------------------- Footer */
.page-footer { background: var(--ihrdc-navy); color: var(--fg-on-dark); padding: 48px 0; }
.footer-inner {
  display: flex; flex-wrap: wrap; align-items: flex-start;
  justify-content: space-between; gap: 32px;
}
.footer-brand { display: flex; flex-direction: column; gap: 14px; max-width: 620px; }
/* align-self, because a column flex container stretches an auto-width image to the column's
   full width and the SVG then centres its mark inside that box - which put the footer logo
   well to the right of the header's. Pinned to the start it sits where the header logo sits. */
.footer-brand img { display: block; height: 24px; width: auto; align-self: flex-start; }
.footer-brand p {
  margin: 0; font-size: 14px; line-height: 1.65;
  color: var(--fg-on-dark-2); text-wrap: pretty;
}
.footer-links { display: flex; flex-direction: column; gap: 10px; font-size: 14px; }
.footer-links a { color: var(--fg-on-dark); }

/* ---------------------------------------------------------------- Heat map */
.heatmap-block {
  display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 24px;
  align-items: start; margin-bottom: 16px;
}
.heatmap-main { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.heatmap {
  display: flex; flex-direction: column; gap: 6px;
  border: 1px solid var(--border-1); border-radius: 4px;
  background: var(--bg-page); padding: 20px;
}
.heat-row { display: grid; grid-template-columns: 190px minmax(0, 1fr); gap: 16px; align-items: center; }
.heat-label {
  font-size: 13px; font-weight: 700; color: var(--fg-2);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.heat-cells { display: flex; flex-wrap: wrap; gap: 3px; }
.heat-cell {
  width: 22px; height: 22px; padding: 0; border: 0; border-radius: 2px;
  background: var(--ok); cursor: pointer;
  transition: transform 200ms var(--ease), box-shadow 200ms var(--ease);
}
.heat-cell:hover { box-shadow: 0 0 0 2px var(--ihrdc-blue-tint-3); }
.heat-cell[aria-pressed="true"] { box-shadow: 0 0 0 2px var(--ihrdc-dark-navy); }
.heat-cell.degraded { background: var(--warn); }
.heat-cell.down { background: var(--bad); }
.heat-cell.nodata { background: var(--none); }
.heat-cell.info { background: var(--info); }

.heat-legend {
  display: flex; flex-wrap: wrap; gap: 18px;
  font-size: 12px; color: var(--fg-3);
}
.heat-legend span { display: inline-flex; align-items: center; gap: 8px; }
.heat-swatch { width: 10px; height: 10px; border-radius: 2px; background: var(--ok); }
.heat-swatch.degraded { background: var(--warn); }
.heat-swatch.down { background: var(--bad); }
.heat-swatch.nodata { background: var(--none); }
.heat-swatch.info { background: var(--info); }

.heat-panel {
  position: sticky; top: 96px;
  border: 1px solid var(--border-1); border-radius: 4px;
  background: var(--bg-subtle); padding: 20px;
  display: flex; flex-direction: column; gap: 12px; align-items: flex-start;
}
.heat-empty { margin: 0; font-size: 13px; line-height: 1.6; color: var(--fg-3); }
.heat-panel-eyebrow {
  font-size: 12px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.12em; color: var(--ihrdc-blue);
}
.heat-panel h3 { margin: 0; font-size: 18px; font-weight: 700; line-height: 1.3; color: var(--fg-1); }
.heat-panel .pill { background: var(--bg-page); }
.heat-facts { margin: 4px 0 0; display: grid; grid-template-columns: 100% ; gap: 2px; width: 100%; }
.heat-facts dt {
  font-size: 11px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.12em; color: var(--fg-3); margin-top: 10px;
}
.heat-facts dd { margin: 0; font-size: 14px; line-height: 1.5; color: var(--fg-1); overflow-wrap: anywhere; }
.heat-facts dd.mono { font-family: var(--font-mono); font-size: 13px; }

.heat-toggle {
  align-self: flex-start; margin-bottom: 12px;
  background: none; border: 0; padding: 0; cursor: pointer;
  font-family: var(--font-sans); font-size: 14px; font-weight: 700; color: var(--ihrdc-blue);
}
.heat-toggle:hover { color: var(--ihrdc-blue-shade-1); text-decoration: underline; }
.table-scroll.is-collapsed { display: none; }

/* --------------------------------------------------------------- Dark mode
 * Follows the OS setting. Status colors are unchanged — only the surfaces
 * and text tokens invert, onto approved navy values. Brand blue steps up to
 * the approved #66A0C5 / #B2CFE2 tints so links stay legible on navy.
 * ------------------------------------------------------------------------ */
@media (prefers-color-scheme: dark) {
  :root {
    --bg-page: #112A46;
    --bg-card: color-mix(in srgb, #154675 34%, #112A46);
    --bg-subtle: color-mix(in srgb, #154675 55%, #112A46);
    --border-1: color-mix(in srgb, #C9D6E2 20%, #112A46);
    --border-2: color-mix(in srgb, #C9D6E2 14%, #112A46);

    --fg-1: #FFFFFF;
    --fg-2: #C9D6E2;
    --fg-3: color-mix(in srgb, #C9D6E2 72%, #112A46);
    --none-fg: color-mix(in srgb, #C9D6E2 72%, #112A46);

    --ihrdc-blue: #66A0C5;
    --ihrdc-blue-shade-1: #B2CFE2;
    --focus-ring: #66A0C5;
  }

  .topbar { background: var(--bg-page); }
  .brand img { content: var(--logo-white); }
  .hero { border-bottom: 1px solid var(--border-1); }

  .card, .table-scroll, .heatmap { background: var(--bg-card); }
  .card { box-shadow: 0 1px 2px rgba(0, 0, 0, 0.35); }
  .card:hover { box-shadow: 0 4px 14px rgba(0, 0, 0, 0.4); }
  .card-num, .card-slug, .pill, table.signals th,
  table.signals code.inline, .heat-panel { background: var(--bg-subtle); }
  .card-slug { color: var(--fg-1); }
  table.signals tbody tr:hover { background: var(--bg-subtle); }
  .heat-panel .pill { background: var(--bg-card); }
  .heat-cell[aria-pressed="true"] { box-shadow: 0 0 0 2px #FFFFFF; }
  .heat-cell:hover { box-shadow: 0 0 0 2px var(--ihrdc-blue); }
  .page-footer { background: color-mix(in srgb, #154675 70%, #112A46); }
}

/* ---------------------------------------------------------------- Responsive */
@media (max-width: 900px) {
  .wrap { padding: 0 20px; }
  .hero { padding: 48px 0 40px; }
  .eyebrow-text { font-size: 22px; }
  .hero-headline h1 { font-size: 20px; }
  .section-head h2 { font-size: 26px; }
  .card-status { width: 100%; justify-content: space-between; }
  .card-note { padding-left: 0; }
  .heatmap-block { grid-template-columns: minmax(0, 1fr); }
  .heat-row { grid-template-columns: minmax(0, 1fr); gap: 6px; }
  .heat-panel { position: static; }
}
