/* Layout: a status page for one person. Components = services, incident log = career, pager = contact. */
:root {
  --bg: #f5f6f8;
  --surface: #ffffff;
  --sunk: #eceff3;
  --line: #d9dee5;
  --fg: #17202b;
  --muted: #536070;
  --accent: #9a5700;
  --accent-soft: #fbeeda;
  --on-accent: #ffffff;
  --ok: #1a7a51;
  --warn: #8a6700;
  --bad: #b8322a;
  --ok-bar: #2fa874;
  --warn-bar: #d9a520;
  --bad-bar: #d6463c;
  --scrim: rgba(8, 12, 18, .55);
  --shadow: 0 1px 2px rgba(23, 32, 43, .06), 0 8px 24px rgba(23, 32, 43, .06);
  --display: "IBM Plex Sans Condensed", "Arial Narrow", "Helvetica Neue", Arial, sans-serif;
  --body: "IBM Plex Sans", "Helvetica Neue", Arial, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  --gutter-l: max(16px, env(safe-area-inset-left, 0px));
  --gutter-r: max(16px, env(safe-area-inset-right, 0px));
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #10151c; --surface: #161d26; --sunk: #0c1116; --line: #26313f; --fg: #e4eaf1; --muted: #93a0b0;
    --accent: #f0a83a; --accent-soft: #2b2112; --on-accent: #10151c; --ok: #4cc391; --warn: #e2b440; --bad: #f0675d;
    --ok-bar: #34a978; --warn-bar: #d4a52a; --bad-bar: #e0584e; --scrim: rgba(0, 0, 0, .65);
    --shadow: 0 1px 2px rgba(0,0,0,.3), 0 8px 24px rgba(0,0,0,.25);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #10151c; --surface: #161d26; --sunk: #0c1116; --line: #26313f; --fg: #e4eaf1; --muted: #93a0b0;
  --accent: #f0a83a; --accent-soft: #2b2112; --on-accent: #10151c; --ok: #4cc391; --warn: #e2b440; --bad: #f0675d;
  --ok-bar: #34a978; --warn-bar: #d4a52a; --bad-bar: #e0584e; --scrim: rgba(0, 0, 0, .65);
  --shadow: 0 1px 2px rgba(0,0,0,.3), 0 8px 24px rgba(0,0,0,.25);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: 72px; }
[hidden] { display: none !important; }
img { max-width: 100%; }
body {
  margin: 0;
  background: var(--bg); color: var(--fg);
  font-family: var(--body); font-size: 16px; line-height: 1.55;
  padding-left: var(--gutter-l); padding-right: var(--gutter-r);
  padding-block: 0 48px;
  overflow-x: hidden;
}
body::before { content: ""; position: fixed; inset: 0 0 auto; height: env(safe-area-inset-top, 0px); z-index: 10; background: var(--bg); }
.wrap { max-width: 980px; margin: 0 auto; display: grid; grid-template-columns: minmax(0, 1fr); gap: 64px; }
.section, .hero, .pager { min-width: 0; }
a { color: var(--accent); text-underline-offset: 3px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 4px; }
h1, h2, h3 { font-family: var(--display); text-wrap: balance; margin: 0; letter-spacing: -.01em; }
p { margin: 0; }
.label { font-family: var(--mono); font-size: 12px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.skip { position: absolute; left: 16px; top: -60px; z-index: 60; background: var(--surface); color: var(--fg); padding: 10px 14px; border-radius: 8px; border: 1px solid var(--line); }
.skip:focus { top: 12px; }
.print-only { display: none; }

/* Top bar */
.topbar {
  position: sticky; top: env(safe-area-inset-top, 0px); z-index: 5;
  background: var(--bg); border-bottom: 1px solid var(--line);
  padding-block: 12px;
  margin-left: calc(-1 * var(--gutter-l)); margin-right: calc(-1 * var(--gutter-r));
  padding-left: var(--gutter-l); padding-right: var(--gutter-r);
}
.topbar-inner { max-width: 980px; margin: 0 auto; width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.brand { font-family: var(--mono); font-weight: 600; font-size: 15px; color: var(--fg); text-decoration: none; }
.brand span { color: var(--muted); font-weight: 400; }
.nav { display: flex; gap: 18px; font-family: var(--mono); font-size: 13px; margin-left: auto; }
.nav a { color: var(--muted); text-decoration: none; }
.nav a:hover { color: var(--fg); text-decoration: underline; }
@media (max-width: 760px) { .nav { display: none; } }
.status-pill {
  display: inline-flex; align-items: center; gap: 10px;
  font-family: var(--mono); font-size: 13px; font-weight: 500;
  background: var(--surface); border: 1px solid var(--line); border-radius: 999px;
  padding: 6px 14px 6px 8px; color: var(--fg); cursor: pointer;
}
.dot { width: 12px; height: 12px; border-radius: 50%; background: var(--ok-bar); position: relative; flex: none; }
.dot::after { content: ""; position: absolute; inset: -4px; border-radius: 50%; border: 2px solid var(--ok-bar); background: transparent; opacity: .5; animation: ping 2.4s ease-out infinite; }
body.state-bad .dot { background: var(--bad-bar); }
body.state-bad .dot::after { border-color: var(--bad-bar); }
body.state-warn .dot { background: var(--warn-bar); }
body.state-warn .dot::after { border-color: var(--warn-bar); }
@keyframes ping { 0% { transform: scale(.7); opacity: .6; } 80%, 100% { transform: scale(1.6); opacity: 0; } }

/* Banner */
.banner {
  display: flex; gap: 12px; align-items: flex-start;
  border: 1px solid var(--bad); background: color-mix(in srgb, var(--bad) 10%, var(--surface));
  border-radius: 10px; padding: 14px 16px; font-size: 15px;
}
.banner.resolved { border-color: var(--ok); background: color-mix(in srgb, var(--ok) 10%, var(--surface)); }
.banner strong { font-family: var(--display); font-size: 17px; }

/* Hero */
.hero { padding-top: 40px; display: grid; gap: 22px; }
.hero h1 { font-size: clamp(40px, 7vw, 72px); line-height: 1.02; font-weight: 700; }
.hero h1 em { font-style: normal; color: var(--accent); }
.hero .lede { font-size: clamp(17px, 2.2vw, 20px); color: var(--muted); max-width: 64ch; }
.hero .lede strong { color: var(--fg); font-weight: 500; }
.hero .meta { display: flex; flex-wrap: wrap; gap: 8px 20px; font-family: var(--mono); font-size: 13px; color: var(--muted); }
.hero .meta b { color: var(--fg); font-weight: 500; }
.cta-row { display: flex; flex-wrap: wrap; gap: 12px; }
.btn {
  font: 600 15px/1 var(--body); padding: 13px 18px; border-radius: 8px; cursor: pointer;
  border: 1px solid var(--line); background: var(--surface); color: var(--fg); text-decoration: none;
  display: inline-flex; align-items: center; gap: 8px;
}
.btn svg { width: 16px; height: 16px; flex: none; fill: currentColor; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.btn:hover { filter: brightness(1.06); }

/* Section heads */
.section { display: grid; grid-template-columns: minmax(0, 1fr); gap: 20px; }
.section-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; flex-wrap: wrap; border-bottom: 1px solid var(--line); padding-bottom: 10px; }
.section-head h2 { font-size: 26px; font-weight: 600; }
.section-note { color: var(--muted); font-size: 14.5px; max-width: 72ch; }

/* Metrics */
.metrics { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
@media (max-width: 760px) { .metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.metric { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 16px; display: grid; gap: 4px; align-content: start; }
.metric b { font-family: var(--mono); font-size: clamp(24px, 3.4vw, 32px); font-weight: 600; font-variant-numeric: tabular-nums; line-height: 1.1; }
.metric span { font-size: 13.5px; color: var(--muted); }
.chart { margin: 0; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 18px 20px; display: grid; gap: 10px; }
.chart-top { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; align-items: baseline; }
.chart-top strong { font-size: 15px; font-weight: 600; }
.cols { display: grid; grid-template-columns: repeat(var(--n, 10), minmax(0, 1fr)); gap: 6px; align-items: end; height: 150px; padding-top: 18px; }
.col { display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: 4px; height: 100%; min-width: 0; }
.col i { display: block; width: 100%; max-width: 46px; height: calc(var(--h) * 1.1px); min-height: 3px; background: var(--ok-bar); border-radius: 3px 3px 0 0; }
.col.partial i { background: repeating-linear-gradient(135deg, var(--ok-bar) 0 6px, color-mix(in srgb, var(--ok-bar) 55%, var(--surface)) 6px 10px); }
.col b { font-family: var(--mono); font-size: 11.5px; font-weight: 500; color: var(--fg); font-variant-numeric: tabular-nums; }
.col-x { display: grid; grid-template-columns: repeat(var(--n, 10), minmax(0, 1fr)); gap: 6px; font-family: var(--mono); font-size: 11.5px; color: var(--muted); text-align: center; border-top: 1px solid var(--line); padding-top: 6px; }
.chart-foot { font-size: 13px; color: var(--muted); }

/* Components */
.components { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow); }
.comp { padding: 18px 20px; display: grid; gap: 10px; border-top: 1px solid var(--line); }
.comp:first-child { border-top: 0; }
.comp-top { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.comp-name { font-weight: 600; font-size: 16px; }
.comp-desc { color: var(--muted); font-size: 14.5px; max-width: 72ch; }
.comp-state { font-family: var(--mono); font-size: 13px; font-weight: 500; color: var(--ok); white-space: nowrap; }
.comp[data-state="warn"] .comp-state { color: var(--warn); }
.comp[data-state="bad"] .comp-state { color: var(--bad); }
.bars { display: grid; grid-template-columns: repeat(60, 1fr); gap: 2px; height: 30px; }
.bars i { display: block; border-radius: 2px; background: var(--ok-bar); opacity: .9; }
.bars i.w { background: var(--warn-bar); }
.bars i:hover { opacity: 1; transform: scaleY(1.12); }
.bars-foot { display: flex; justify-content: space-between; font-family: var(--mono); font-size: 11.5px; color: var(--muted); }
.comp[data-state="bad"] .bars i:nth-last-child(-n+3) { background: var(--bad-bar); }
.comp[data-state="warn"] .bars i:nth-last-child(-n+2) { background: var(--warn-bar); }
@media (max-width: 560px) { .bars { grid-template-columns: repeat(30, 1fr); } .bars i:nth-child(-n+30) { display: none; } }

/* Incident log */
.log { display: grid; gap: 0; }
.inc { display: grid; grid-template-columns: 150px 1fr; gap: 20px; padding: 24px 0; border-top: 1px solid var(--line); }
.inc:first-child { border-top: 0; padding-top: 4px; }
.inc-when { font-family: var(--mono); font-size: 13px; color: var(--muted); display: grid; gap: 6px; align-content: start; }
.inc-id { color: var(--accent); font-weight: 600; }
.inc-body { display: grid; gap: 8px; min-width: 0; }
.inc-body h3 { font-size: 22px; font-weight: 600; }
.inc-body .role { color: var(--muted); font-size: 14.5px; }
.inc-body ul { margin: 4px 0 0; padding-left: 18px; display: grid; gap: 8px; max-width: 74ch; }
.inc-body li b { font-weight: 600; }
.tag { display: inline-block; font-family: var(--mono); font-size: 11.5px; padding: 3px 8px; border-radius: 999px; border: 1px solid var(--line); color: var(--muted); }
.tag.res { color: var(--ok); border-color: color-mix(in srgb, var(--ok) 40%, var(--line)); }
.tag.mon { color: var(--accent); border-color: color-mix(in srgb, var(--accent) 45%, var(--line)); }
@media (max-width: 640px) { .inc { grid-template-columns: 1fr; gap: 10px; } .inc-when { grid-auto-flow: column; justify-content: start; gap: 12px; } }

/* Projects */
.filters { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { font: 500 13px var(--mono); padding: 7px 12px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); color: var(--muted); cursor: pointer; }
.chip[aria-pressed="true"] { background: var(--fg); color: var(--bg); border-color: var(--fg); }
.projects { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 16px; }
.proj { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 20px; display: grid; gap: 12px; align-content: start; }
.proj-top { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; flex-wrap: wrap; }
.proj h3 { font-size: 20px; font-weight: 600; }
.proj p { color: var(--muted); font-size: 15px; }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; border-top: 1px dashed var(--line); padding-top: 12px; }
.stat b { display: block; font-family: var(--mono); font-size: 19px; font-weight: 600; font-variant-numeric: tabular-nums; line-height: 1.25; }
.stat span { font-size: 12px; color: var(--muted); display: block; line-height: 1.35; }
.stack { font-family: var(--mono); font-size: 12.5px; color: var(--muted); }
.proj-link { font-family: var(--mono); font-size: 13px; }

/* Benchmarks */
.table-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; }
table { width: 100%; border-collapse: collapse; font-size: 14.5px; }
th, td { text-align: left; padding: 12px 14px; border-top: 1px solid var(--line); vertical-align: top; }
thead th { border-top: 0; font: 500 12px var(--mono); letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
td.num { font-family: var(--mono); font-variant-numeric: tabular-nums; white-space: nowrap; }
td small { display: block; color: var(--muted); font-size: 12.5px; }
@media (max-width: 640px) {
  .bench thead { display: none; }
  .bench tr { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 12px; padding: 12px 14px; border-top: 1px solid var(--line); }
  .bench tr:first-child { border-top: 0; }
  .bench td { border: 0; padding: 0; }
  .bench td:first-child { grid-column: 1 / -1; font-weight: 600; }
  .bench td:first-child small { font-weight: 400; }
  .bench td::before { content: attr(data-k); display: block; font: 500 11px var(--mono); letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
  .bench td:first-child::before { display: none; }
}

.sub-head { font-size: 19px; font-weight: 600; margin-top: 8px; }

/* Stack */
.deps { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; }
.dep { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 16px; display: grid; gap: 8px; align-content: start; }
.dep h3 { font-size: 16px; font-weight: 600; font-family: var(--body); }
.dep p { font-family: var(--mono); font-size: 13px; color: var(--muted); }

/* Pager / contact */
.pager { background: var(--sunk); border: 1px solid var(--line); border-radius: 12px; padding: 24px; display: grid; gap: 16px; }
.pager h2 { font-size: 30px; }
.pager p { color: var(--muted); max-width: 64ch; }
.addr { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.addr code { font-family: var(--mono); font-size: 17px; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 10px 14px; user-select: all; overflow-wrap: anywhere; }

/* Footer */
footer { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; font-family: var(--mono); font-size: 12.5px; color: var(--muted); border-top: 1px solid var(--line); padding-top: 18px; }
.kbd { font-family: var(--mono); font-size: 12px; border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 5px; padding: 1px 6px; background: var(--surface); color: var(--fg); }
.linkbtn { background: none; border: 0; color: var(--accent); font: inherit; cursor: pointer; padding: 0; text-decoration: underline; text-underline-offset: 3px; }

/* Runbook modal */
.scrim { position: fixed; inset: 0; background: var(--scrim); z-index: 40; display: grid; place-items: center; padding: 16px; }
.runbook { width: min(580px, 100%); max-height: 86vh; overflow: auto; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow); padding: 22px; display: grid; gap: 14px; }
.runbook h2 { font-size: 22px; }
.runbook ol { margin: 0; padding-left: 22px; display: grid; gap: 6px; font-size: 15px; color: var(--muted); }
.runbook li.found { color: var(--ok); }
.term { display: flex; gap: 8px; align-items: center; background: var(--sunk); border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; font-family: var(--mono); }
.term span { color: var(--accent); }
.term .term-run { padding: 7px 12px; font-size: 13px; }
.term input { flex: 1; min-width: 0; background: transparent; border: 0; color: var(--fg); font: 16px var(--mono); outline: none; }
.runbook .row { display: flex; justify-content: space-between; gap: 10px; align-items: center; flex-wrap: wrap; }

/* Toasts */
.toasts { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(16px + env(safe-area-inset-bottom, 0px)); z-index: 50; display: grid; gap: 8px; width: min(540px, calc(100% - 32px)); pointer-events: none; }
.toast { background: var(--fg); color: var(--bg); font-family: var(--mono); font-size: 13.5px; padding: 12px 14px; border-radius: 10px; box-shadow: var(--shadow); animation: up .25s ease-out; overflow-wrap: anywhere; }
.toast.pre { white-space: pre; overflow-x: auto; font-size: 12px; line-height: 1.5; overflow-wrap: normal; }
@keyframes up { from { transform: translateY(8px); opacity: 0; } to { transform: none; opacity: 1; } }

/* Effects */
.fall { transition: transform 1.1s cubic-bezier(.5,0,.9,.4), opacity 1.1s; transform: translateY(120vh) rotate(var(--rot, 8deg)); opacity: .2; }
.candle { position: fixed; inset: 0; z-index: 30; pointer-events: none;
  background: radial-gradient(circle 260px at var(--cx, 50%) var(--cy, 40%), rgba(255, 190, 110, .14), rgba(20, 10, 0, .82) 70%);
  animation: flicker 3.2s infinite; }
@keyframes flicker { 0%,100% { opacity: 1; } 47% { opacity: .93; } 50% { opacity: .98; } 73% { opacity: .91; } }
.confetti { position: fixed; top: -12px; width: 9px; height: 9px; border-radius: 50%; z-index: 45; pointer-events: none; animation: drop linear forwards; }
@keyframes drop { to { transform: translateY(110vh) rotate(540deg); } }
.shake { animation: shake .4s; }
@keyframes shake { 25% { transform: translateX(-4px); } 75% { transform: translateX(4px); } }

@media (prefers-reduced-motion: reduce) {
  .dot::after, .candle, .toast, .shake { animation: none; }
  .fall { transition: none; transform: none; opacity: 1; }
  .confetti { display: none; }
}

/* Print: the same page becomes a compact résumé. */
@media print {
  @page { margin: 11mm 12mm 12mm; }
  :root { --bg: #fff; --surface: #fff; --sunk: #fff; --fg: #111; --muted: #444; --line: #ccc; --accent: #7a4500; --shadow: none; }
  body { padding: 0; font-size: 10pt; line-height: 1.38; background: #fff; }
  body::before, .topbar, .skip, .cta-row, .hero .meta, #services, .chart, .filters, .pager .addr, footer, .scrim, .toasts, .no-print, .proj-link { display: none !important; }
  .print-only { display: block; }
  .wrap { gap: 14px; max-width: none; }
  .hero { padding-top: 0; gap: 8px; }
  .print-name { font: 700 24pt/1.1 var(--display); margin: 0; }
  .hero h1 { font-size: 13pt; font-weight: 600; }
  .hero .lede { font-size: 10pt; color: var(--fg); max-width: none; }
  .print-contact { font-family: var(--mono); font-size: 9pt; color: var(--muted); }
  .section { gap: 8px; }
  .section-head { padding-bottom: 4px; }
  .section-head h2 { font-size: 14pt; }
  .section-head .label, .section-note { display: none; }
  .metrics { grid-template-columns: repeat(4, 1fr); gap: 6px; }
  .metric { padding: 6px 8px; border-radius: 6px; }
  .metric b { font-size: 13pt; }
  .metric span { font-size: 8.5pt; }
  .inc { padding: 8px 0; display: flex; gap: 10px; }
  .inc-when { flex: 0 0 105px; display: block; }
  .inc-when > span { display: block; }
  .inc-body { flex: 1; display: block; }
  .inc-body > * + * { margin-top: 4px; }
  .inc li { break-inside: avoid; }
  .inc-body h3 { font-size: 12.5pt; }
  .inc-body ul { gap: 2px; max-width: none; }
  .inc-body .role { font-size: 9.5pt; }
  .tag { display: none; }
  .projects { grid-template-columns: repeat(3, 1fr); gap: 6px; }
  .proj[hidden] { display: grid !important; }
  .proj { padding: 8px 10px; gap: 4px; border-radius: 6px; break-inside: avoid; }
  .proj h3 { font-size: 11pt; }
  .proj p { font-size: 8.5pt; line-height: 1.35; }
  .proj .label { font-size: 7.5pt; }
  .proj-top .tag { display: none; }
  .proj .stats { display: none; }
  .proj .stack { display: none; }
  .table-wrap { border-radius: 6px; break-inside: avoid; }
  th, td { padding: 4px 8px; font-size: 9pt; }
  .deps { grid-template-columns: 1fr; gap: 3px; }
  .dep { display: flex; gap: 8px; padding: 0; border: 0; break-inside: avoid; }
  .dep h3 { flex: 0 0 120px; }
  .dep h3 { font-size: 10pt; }
  .dep p { font-size: 8.5pt; }
  .pager { padding: 0; border: 0; gap: 4px; break-inside: avoid; }
  .pager h2 { font-size: 14pt; }
  a { color: inherit; text-decoration: none; }
}
