/* Copperhost Status — styles
   Direction: calm technical instrument. Warm-neutral light surface, a single
   copper brand accent reserved for chrome, unambiguous status colors, and a
   IBM Plex Sans / IBM Plex Mono pairing for a credible ops feel. */

:root {
  /* warm-neutral light palette */
  --bg: #f4f2ee;
  --surface: #ffffff;
  --surface-2: #faf8f5;
  --ink: #1c1a16;
  --ink-2: #47433c;
  --muted: #7c766c;
  --line: #e7e2d9;
  --line-strong: #d8d2c6;

  /* brand — copper, chrome only */
  --copper: #b1531d;
  --copper-ink: #964516;
  --copper-soft: #f4e6da;

  /* status — unambiguous, never used for brand */
  --ok: #1a8f63;
  --ok-soft: #e2f2ea;
  --degraded: #c58309;
  --degraded-soft: #f9edd0;
  --partial: #dd6b20;
  --partial-soft: #fbe7d5;
  --major: #d13b3b;
  --major-soft: #fadedd;
  --maint: #3567c9;
  --maint-soft: #e0e8f8;

  --shadow-sm: 0 1px 2px rgba(28, 26, 22, 0.04), 0 1px 3px rgba(28, 26, 22, 0.05);
  --shadow-md: 0 4px 14px rgba(28, 26, 22, 0.07), 0 1px 3px rgba(28, 26, 22, 0.05);
  --shadow-lg: 0 18px 44px rgba(28, 26, 22, 0.14);

  --radius: 14px;
  --radius-sm: 9px;
  --radius-pill: 999px;

  --sans: 'IBM Plex Sans', system-ui, sans-serif;
  --mono: 'IBM Plex Mono', ui-monospace, 'SFMono-Regular', monospace;

  --maxw: 940px;

  /* chart theming (cshell-charts.js reads these) */
  --chart-text: #7c766c;
  --chart-grid: #ece7de;
  --chart-c1: #b1531d;
  --chart-c2: #1a8f63;
  --chart-c3: #3567c9;
  --chart-tooltip-bg: #1c1a16;
  --chart-tooltip-text: #faf8f5;
}

[data-theme='dark'] {
  --bg: #14130f;
  --surface: #1d1b16;
  --surface-2: #242118;
  --ink: #f3efe6;
  --ink-2: #c8c1b3;
  --muted: #928b7d;
  --line: #322e26;
  --line-strong: #423d33;

  --copper: #e08a4f;
  --copper-ink: #eea36c;
  --copper-soft: #362419;

  --ok: #37b984;
  --ok-soft: #133026;
  --degraded: #e0a52c;
  --degraded-soft: #322813;
  --partial: #ec8b4c;
  --partial-soft: #35240f;
  --major: #ec6a6a;
  --major-soft: #351c1c;
  --maint: #6f9bf0;
  --maint-soft: #1a2440;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 6px 18px rgba(0, 0, 0, 0.36);
  --shadow-lg: 0 20px 50px rgba(0, 0, 0, 0.5);

  --chart-text: #928b7d;
  --chart-grid: #2a271f;
  --chart-c1: #e08a4f;
  --chart-c2: #37b984;
  --chart-c3: #6f9bf0;
  --chart-tooltip-bg: #f3efe6;
  --chart-tooltip-text: #1c1a16;
}

* { box-sizing: border-box; }

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

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

h1, h2, h3 { margin: 0; font-weight: 600; letter-spacing: -0.01em; line-height: 1.2; }
p { margin: 0; }
a { color: var(--copper-ink); text-decoration: none; }
a:hover { text-decoration: underline; }

.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.tnum { font-variant-numeric: tabular-nums; }

.skip {
  position: absolute; left: -9999px; top: 0;
  background: var(--ink); color: var(--surface); padding: 10px 16px;
  border-radius: 0 0 8px 0; z-index: 100;
}
.skip:focus { left: 0; }

.wrap { width: 100%; max-width: var(--maxw); margin: 0 auto; padding: 0 22px; }

/* ---------------- header ---------------- */
.site-header {
  position: sticky; top: 0; z-index: 40;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--line);
}
.header-inner {
  display: flex; align-items: center; gap: 16px;
  height: 62px;
}
.brand { display: flex; align-items: center; gap: 11px; margin-right: auto; }
.brand:hover { text-decoration: none; }
.brand-mark {
  width: 30px; height: 30px; flex: none;
  border-radius: 8px;
  display: grid; place-items: center;
  background: linear-gradient(150deg, var(--copper) 0%, var(--copper-ink) 100%);
  box-shadow: var(--shadow-sm), inset 0 1px 0 rgba(255, 255, 255, 0.28);
}
.brand-mark svg { width: 17px; height: 17px; display: block; }
.brand-name { font-weight: 600; font-size: 16px; letter-spacing: -0.015em; color: var(--ink); }
.brand-tag {
  font-family: var(--mono); font-size: 11px; letter-spacing: 0.08em;
  text-transform: uppercase; color: var(--muted);
  padding-left: 11px; margin-left: 3px; border-left: 1px solid var(--line-strong);
}
.header-nav { display: flex; gap: 4px; }
.header-nav a {
  color: var(--ink-2); font-size: 13.5px; font-weight: 500;
  padding: 7px 11px; border-radius: 8px;
}
.header-nav a:hover { background: var(--surface-2); color: var(--ink); text-decoration: none; }

.icon-btn {
  width: 38px; height: 38px; flex: none;
  display: grid; place-items: center;
  border: 1px solid var(--line-strong); background: var(--surface);
  border-radius: 9px; color: var(--ink-2); cursor: pointer;
  transition: background .16s, color .16s, border-color .16s, transform .1s;
}
.icon-btn:hover { color: var(--ink); border-color: var(--muted); }
.icon-btn:active { transform: scale(.94); }
.icon-btn svg { width: 17px; height: 17px; }
.icon-btn .moon { display: none; }
[data-theme='dark'] .icon-btn .sun { display: none; }
[data-theme='dark'] .icon-btn .moon { display: block; }

.btn {
  display: inline-flex; align-items: center; gap: 7px;
  font-family: var(--sans); font-size: 13.5px; font-weight: 500;
  padding: 9px 15px; border-radius: 9px; cursor: pointer;
  border: 1px solid transparent; transition: background .16s, border-color .16s, transform .1s, box-shadow .16s;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--copper); color: #fff; box-shadow: var(--shadow-sm); }
.btn-primary:hover { background: var(--copper-ink); text-decoration: none; }
.btn-ghost { background: var(--surface); color: var(--ink); border-color: var(--line-strong); }
.btn-ghost:hover { border-color: var(--muted); text-decoration: none; }
.btn svg { width: 15px; height: 15px; }
:focus-visible { outline: 2px solid var(--copper); outline-offset: 2px; border-radius: 6px; }

/* ---------------- hero banner ---------------- */
main { padding-bottom: 72px; }
.hero { padding: 40px 0 8px; }

.status-banner {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  overflow: hidden;
  display: flex; align-items: center; gap: 20px;
  padding: 26px 28px;
}
.status-banner::before {
  content: ''; position: absolute; inset: 0 0 auto 0; height: 4px;
  background: var(--state-color, var(--ok));
}
.banner-glyph {
  width: 52px; height: 52px; flex: none; border-radius: 13px;
  display: grid; place-items: center;
  background: var(--state-soft, var(--ok-soft));
  color: var(--state-color, var(--ok));
}
.banner-glyph svg { width: 28px; height: 28px; }
.banner-text { flex: 1; min-width: 0; }
.banner-text h1 { font-size: clamp(21px, 3.4vw, 27px); letter-spacing: -0.02em; }
.banner-sub { color: var(--muted); font-size: 13.5px; margin-top: 3px; }
.banner-sub .mono { color: var(--ink-2); }
.banner-uptime { text-align: right; flex: none; padding-left: 8px; }
.banner-uptime .val { font-family: var(--mono); font-size: 25px; font-weight: 600; color: var(--ink); letter-spacing: -0.02em; }
.banner-uptime .lbl { font-size: 11px; text-transform: uppercase; letter-spacing: 0.07em; color: var(--muted); }

/* ---------------- sections ---------------- */
section { scroll-margin-top: 78px; }
.section-head {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 12px; margin: 40px 0 14px;
}
.section-head h2 { font-size: 15px; letter-spacing: 0.02em; }
.section-head .hint { font-size: 12.5px; color: var(--muted); font-family: var(--mono); }

/* ---------------- components / current status ---------------- */
.components { display: grid; gap: 12px; }
.component {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 18px 20px 16px;
  box-shadow: var(--shadow-sm);
}
.component-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.component-id { min-width: 0; }
.component-name { font-weight: 600; font-size: 15.5px; letter-spacing: -0.01em; }
.component-blurb { color: var(--muted); font-size: 12.5px; margin-top: 1px; }

.pill {
  display: inline-flex; align-items: center; gap: 6px; flex: none;
  font-size: 12.5px; font-weight: 600; letter-spacing: -0.005em;
  padding: 5px 11px 5px 9px; border-radius: var(--radius-pill);
  color: var(--st-color); background: var(--st-soft);
  border: 1px solid color-mix(in srgb, var(--st-color) 22%, transparent);
  white-space: nowrap;
}
.pill .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--st-color); flex: none; }
.pill.lg { font-size: 13px; padding: 6px 13px 6px 11px; }

.st-operational { --st-color: var(--ok); --st-soft: var(--ok-soft); }
.st-maintenance, .st-scheduled, .st-in_progress { --st-color: var(--maint); --st-soft: var(--maint-soft); }
.st-completed { --st-color: var(--ok); --st-soft: var(--ok-soft); }
.st-degraded, .st-monitoring { --st-color: var(--degraded); --st-soft: var(--degraded-soft); }
.st-partial, .st-identified { --st-color: var(--partial); --st-soft: var(--partial-soft); }
.st-major, .st-investigating { --st-color: var(--major); --st-soft: var(--major-soft); }
.st-resolved { --st-color: var(--ok); --st-soft: var(--ok-soft); }

/* 90-day uptime bar */
.uptime-bar { display: flex; gap: 2px; margin: 15px 0 9px; height: 34px; align-items: stretch; }
.uptime-bar .day {
  flex: 1 1 0; min-width: 0; border-radius: 2px;
  background: var(--ok); opacity: 0.9;
  transition: opacity .12s, transform .12s;
  cursor: default;
}
.uptime-bar .day.s-operational { background: var(--ok); }
.uptime-bar .day.s-maintenance { background: var(--maint); }
.uptime-bar .day.s-degraded { background: var(--degraded); }
.uptime-bar .day.s-partial { background: var(--partial); }
.uptime-bar .day.s-major { background: var(--major); }
.uptime-bar .day.blip { background: var(--degraded); opacity: 0.5; }
.uptime-bar .day:hover { opacity: 1; transform: scaleY(1.08); }

.uptime-legend {
  display: flex; align-items: center; justify-content: space-between;
  font-size: 12px; color: var(--muted); font-family: var(--mono);
}
.uptime-legend .mid { color: var(--ink-2); font-weight: 500; }
.uptime-legend .mid b { color: var(--ink); font-weight: 600; }

/* tooltip for uptime bars */
.uptip {
  position: fixed; z-index: 60; pointer-events: none;
  background: var(--chart-tooltip-bg); color: var(--chart-tooltip-text);
  border-radius: 8px; padding: 8px 11px; font-size: 12px;
  box-shadow: var(--shadow-lg); max-width: 240px;
  opacity: 0; transform: translateY(3px); transition: opacity .12s, transform .12s;
}
.uptip.on { opacity: 1; transform: translateY(0); }
.uptip .t-date { font-family: var(--mono); font-weight: 600; margin-bottom: 2px; }
.uptip .t-up { font-family: var(--mono); }
.uptip .t-note { margin-top: 4px; opacity: 0.82; line-height: 1.35; }

/* ---------------- metrics ---------------- */
.metrics { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.metric {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 15px 16px; box-shadow: var(--shadow-sm);
}
.metric .m-lbl { font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); }
.metric .m-val { font-family: var(--mono); font-size: 24px; font-weight: 600; letter-spacing: -0.02em; margin-top: 5px; }
.metric .m-val small { font-size: 14px; font-weight: 500; color: var(--muted); }
.metric .m-foot { font-size: 12px; color: var(--muted); margin-top: 2px; }

.chart-card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 18px 18px 12px; box-shadow: var(--shadow-sm);
  margin-top: 12px;
}
.chart-card .cc-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 6px; }
.chart-card .cc-head h3 { font-size: 13.5px; font-weight: 600; }
.chart-card .cc-head .cc-sub { font-size: 12px; color: var(--muted); font-family: var(--mono); }

/* ---------------- incidents / timeline ---------------- */
.month-sep {
  font-family: var(--mono); font-size: 12px; letter-spacing: 0.06em;
  text-transform: uppercase; color: var(--muted);
  margin: 26px 0 12px; padding-bottom: 8px; border-bottom: 1px solid var(--line);
}
.month-sep:first-child { margin-top: 4px; }

.incident {
  background: var(--surface); border: 1px solid var(--line);
  border-left: 3px solid var(--st-color, var(--line-strong));
  border-radius: var(--radius); padding: 18px 20px; margin-bottom: 12px;
  box-shadow: var(--shadow-sm);
}
.incident.st-resolved, .incident.st-completed { --st-color: var(--ok); }
.incident.st-major { --st-color: var(--major); }
.incident.st-partial { --st-color: var(--partial); }
.incident.st-degraded { --st-color: var(--degraded); }
.incident.st-scheduled, .incident.st-in_progress { --st-color: var(--maint); }

.inc-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.inc-title { font-size: 16px; font-weight: 600; letter-spacing: -0.01em; }
.inc-meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 7px; }
.chip {
  font-family: var(--mono); font-size: 11px; letter-spacing: 0.02em;
  color: var(--ink-2); background: var(--surface-2);
  border: 1px solid var(--line); border-radius: 6px; padding: 2px 7px;
}
.chip.id { color: var(--muted); }
.inc-date { font-family: var(--mono); font-size: 12px; color: var(--muted); white-space: nowrap; }

.timeline { margin: 15px 0 2px; padding: 0; list-style: none; position: relative; }
.timeline::before {
  content: ''; position: absolute; left: 5px; top: 6px; bottom: 6px; width: 2px;
  background: var(--line); border-radius: 2px;
}
.tl-step { position: relative; padding: 0 0 15px 26px; }
.tl-step:last-child { padding-bottom: 0; }
.tl-step .node {
  position: absolute; left: 0; top: 4px; width: 12px; height: 12px;
  border-radius: 50%; background: var(--surface);
  border: 2.5px solid var(--st-node, var(--muted));
}
.tl-step.k-resolved .node, .tl-step.k-completed .node { --st-node: var(--ok); background: var(--ok); }
.tl-step.k-investigating .node { --st-node: var(--major); }
.tl-step.k-identified .node { --st-node: var(--partial); }
.tl-step.k-monitoring .node { --st-node: var(--degraded); }
.tl-step.k-scheduled .node, .tl-step.k-in_progress .node { --st-node: var(--maint); }
.tl-top { display: flex; align-items: baseline; gap: 9px; flex-wrap: wrap; }
.tl-status { font-weight: 600; font-size: 13px; letter-spacing: -0.005em; }
.tl-time { font-family: var(--mono); font-size: 11.5px; color: var(--muted); }
.tl-body { font-size: 13.5px; color: var(--ink-2); margin-top: 3px; line-height: 1.5; max-width: 66ch; }

.maint-window {
  font-family: var(--mono); font-size: 12px; color: var(--maint);
  background: var(--maint-soft); border: 1px solid color-mix(in srgb, var(--maint) 22%, transparent);
  border-radius: 7px; padding: 6px 10px; margin: 12px 0 2px;
  display: inline-flex; align-items: center; gap: 7px;
}

.empty-note {
  text-align: center; color: var(--muted); font-size: 13.5px;
  padding: 22px; border: 1px dashed var(--line-strong); border-radius: var(--radius);
}

/* ---------------- footer ---------------- */
.site-footer { border-top: 1px solid var(--line); background: var(--surface-2); margin-top: 54px; }
.footer-inner { display: flex; flex-wrap: wrap; gap: 26px 40px; padding: 34px 0 30px; }
.foot-brand { max-width: 300px; }
.foot-brand .brand { margin-bottom: 10px; }
.foot-brand p { font-size: 13px; color: var(--muted); line-height: 1.5; }
.foot-col h4 { font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.07em; color: var(--muted); font-weight: 600; margin: 0 0 10px; }
.foot-col ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.foot-col a { color: var(--ink-2); font-size: 13.5px; }
.foot-col a:hover { color: var(--copper-ink); }
.foot-bottom {
  border-top: 1px solid var(--line); padding: 16px 0 30px;
  display: flex; flex-wrap: wrap; gap: 10px 18px; justify-content: space-between;
  font-size: 12.5px; color: var(--muted); font-family: var(--mono);
}

/* ---------------- modal ---------------- */
.modal-scrim {
  position: fixed; inset: 0; z-index: 80;
  background: rgba(20, 18, 14, 0.5); backdrop-filter: blur(3px);
  display: grid; place-items: center; padding: 20px;
  opacity: 0; visibility: hidden; transition: opacity .18s, visibility .18s;
}
.modal-scrim.on { opacity: 1; visibility: visible; }
.modal {
  width: 100%; max-width: 430px; background: var(--surface);
  border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow-lg);
  padding: 24px; transform: translateY(8px) scale(.99); transition: transform .18s;
}
.modal-scrim.on .modal { transform: none; }
.modal-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 6px; }
.modal-head h3 { font-size: 18px; }
.modal p.lead { font-size: 13.5px; color: var(--muted); margin-bottom: 16px; line-height: 1.5; }
.field-row { display: flex; gap: 8px; }
.field-row input {
  flex: 1; font-family: var(--sans); font-size: 14px; color: var(--ink);
  background: var(--surface-2); border: 1px solid var(--line-strong);
  border-radius: 9px; padding: 11px 13px; transition: border-color .16s, box-shadow .16s;
}
.field-row input::placeholder { color: var(--muted); }
.field-row input:focus { outline: none; border-color: var(--copper); box-shadow: 0 0 0 3px var(--copper-soft); }
.field-msg { font-size: 12.5px; margin-top: 9px; min-height: 17px; }
.field-msg.ok { color: var(--ok); }
.field-msg.err { color: var(--major); }
.modal-alt {
  margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--line);
  font-size: 13px; color: var(--muted); display: flex; align-items: center; gap: 8px;
}
.modal-alt a { display: inline-flex; align-items: center; gap: 6px; font-weight: 500; }
.modal-alt svg { width: 14px; height: 14px; }

/* ---------------- responsive ---------------- */
@media (max-width: 720px) {
  .header-nav { display: none; }
  .brand-tag { display: none; }
  .hero { padding: 24px 0 4px; }
  .status-banner { flex-wrap: wrap; padding: 20px; gap: 14px; }
  .banner-uptime { text-align: left; width: 100%; padding-left: 0; border-top: 1px solid var(--line); padding-top: 12px; display: flex; align-items: baseline; gap: 8px; }
  .banner-uptime .val { font-size: 20px; }
  .metrics { grid-template-columns: repeat(2, 1fr); }
  .component { padding: 16px; }
  .uptime-bar { height: 30px; }
  .btn-label { display: none; }
  .btn-primary { padding: 9px 12px; }
  .footer-inner { gap: 22px 30px; }
}
@media (max-width: 400px) {
  .metrics { grid-template-columns: 1fr 1fr; }
  .wrap { padding: 0 16px; }
}

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