/* Layout concept: an equipment rack drawing is the one bold element (hero, right);
   everything else is a quiet, left-aligned reading column with plain rules between items. */
:root {
  /* Color: cool server-room wall, slate ink, Cat6-blue links, label-maker yellow, status LEDs */
  --wall: #e8edf2;
  --panel: #f6f8fa;
  --ink: #18212c;
  --muted: #4f5b6a;
  --rule: #c7d0da;
  --cable: #1b5dbf;
  --tape: #f3cb3a;
  --tape-ink: #1d1a0e;
  --led: #2c9d4e;
  --led-warn: #d4861a;
  /* The rack is dark steel in both themes, like the real thing */
  --steel: #2a323d;
  --steel-rail: #222932;
  --face: #39424f;
  --face-edge: #4a5462;
  --face-ink: #e6ebf0;
  --face-muted: #b3bdc8;
  --code-bg: #dfe5ec;

  /* Type: condensed industrial display, hyperlegible body, mono only inside code */
  --font-display: "Archivo", "Arial Narrow", "Roboto Condensed", sans-serif;
  --font-body: "Red Hat Text", "Segoe UI", system-ui, sans-serif;
  --font-code: "Red Hat Mono", ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;

  --step--1: 0.875rem;
  --step-0: 1.0625rem;
  --step-1: 1.25rem;
  --step-2: 1.625rem;
  --step-3: 2.25rem;
  --step-4: clamp(2.5rem, 6vw, 3.25rem);
  --step-hero: clamp(3.25rem, 11vw, 6.5rem);

  --measure: 68ch;
  --page: 72rem;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --wall: #151b23;
    --panel: #1c242e;
    --ink: #e2e8ee;
    --muted: #9ba8b7;
    --rule: #2d3845;
    --cable: #74a6f3;
    --tape: #ebc53c;
    --tape-ink: #1d1a0e;
    --led: #45c26c;
    --led-warn: #eaa23c;
    --steel: #0f141a;
    --steel-rail: #0a0e13;
    --face: #252e39;
    --face-edge: #36414f;
    --face-ink: #e6ebf0;
    --face-muted: #a9b4c0;
    --code-bg: #1f2833;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --wall: #151b23;
  --panel: #1c242e;
  --ink: #e2e8ee;
  --muted: #9ba8b7;
  --rule: #2d3845;
  --cable: #74a6f3;
  --tape: #ebc53c;
  --tape-ink: #1d1a0e;
  --led: #45c26c;
  --led-warn: #eaa23c;
  --steel: #0f141a;
  --steel-rail: #0a0e13;
  --face: #252e39;
  --face-edge: #36414f;
  --face-ink: #e6ebf0;
  --face-muted: #a9b4c0;
  --code-bg: #1f2833;
  color-scheme: dark;
}

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

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

body {
  margin: 0;
  background: var(--wall);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: var(--step-0);
  line-height: 1.6;
}

.wrap {
  max-width: var(--page);
  margin: 0 auto;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
}
@media (min-width: 700px) {
  .wrap {
    padding-left: max(32px, env(safe-area-inset-left, 0px));
    padding-right: max(32px, env(safe-area-inset-right, 0px));
  }
}

a { color: var(--cable); text-underline-offset: 0.18em; text-decoration-thickness: 1px; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 3px solid var(--cable); outline-offset: 3px; border-radius: 2px; }

h1, h2, h3 {
  font-family: var(--font-display);
  font-stretch: 78%;
  line-height: 1.1;
  text-wrap: balance;
  margin: 0;
}
h2 { font-size: var(--step-3); font-weight: 750; }
h3 { font-size: var(--step-1); font-weight: 700; font-stretch: 85%; }

p { margin: 0; }

/* ---------- Site header ---------- */
.site-header .wrap {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px 24px;
  padding-block: 20px;
}
.site-name {
  font-family: var(--font-display);
  font-stretch: 80%;
  font-weight: 750;
  font-size: var(--step-1);
  color: var(--ink);
  text-decoration: none;
}
.site-nav { display: flex; flex-wrap: wrap; gap: 4px 20px; }
.site-nav a { color: var(--ink); text-decoration: none; }
.site-nav a:hover, .site-nav a[aria-current="page"] { text-decoration: underline; color: var(--cable); }

/* ---------- Hero ---------- */
.hero .wrap {
  display: grid;
  gap: 40px;
  padding-block: 24px 56px;
}
@media (min-width: 960px) {
  .hero .wrap {
    grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr);
    align-items: start;
    gap: 56px;
    padding-block: 40px 80px;
  }
}
.hero-copy { display: grid; gap: 20px; min-width: 0; align-content: start; }
.hero h1 {
  font-size: var(--step-hero);
  font-weight: 800;
  font-stretch: 68%;
  line-height: 0.92;
  letter-spacing: -0.01em;
}
.hero .lead { font-size: var(--step-1); line-height: 1.5; max-width: 34em; }
.hero .sub { color: var(--muted); max-width: 36em; }
.hero .headline {
  font-family: var(--font-display);
  font-stretch: 85%;
  font-weight: 700;
  font-size: var(--step-2);
  line-height: 1.2;
  max-width: 26em;
  margin-top: -6px;
}
.hero .sub strong { color: var(--ink); }
.contact-links { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 24px; padding: 0; margin: 4px 0 0; list-style: none; }
.btn {
  display: inline-block;
  background: var(--cable);
  color: var(--wall);
  font-weight: 700;
  text-decoration: none;
  padding: 8px 16px;
  border-radius: 4px;
}
.btn:hover { text-decoration: underline; }

/* ---------- The rack ---------- */
.racks { display: grid; gap: 0; min-width: 0; max-width: 30rem; width: 100%; }
@media (min-width: 960px) { .racks { justify-self: end; } }

.rack-title {
  font-size: var(--step--1);
  color: var(--muted);
  margin: 0 0 6px 2px;
}
.rack {
  list-style: none;
  margin: 0;
  background: var(--steel);
  border-radius: 6px;
  padding: 10px 10px 10px 38px;
  display: grid;
  gap: 6px;
  position: relative;
}
/* left rail, where the U numbers sit */
.rack::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 30px;
  background: var(--steel-rail);
  border-radius: 6px 0 0 6px;
}
.unit-slot { position: relative; }
.u-num {
  position: absolute;
  left: -34px;
  width: 24px;
  top: 50%;
  transform: translateY(-50%);
  text-align: center;
  font-size: 0.6875rem;
  line-height: 1;
  color: var(--face-muted);
  font-variant-numeric: tabular-nums;
}
.unit {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 4px 12px;
  min-height: 58px;
  padding: 8px 14px;
  background: var(--face);
  border: 1px solid var(--face-edge);
  border-radius: 3px;
  color: var(--face-ink);
  text-decoration: none;
  position: relative;
}
.unit-2u { min-height: 122px; align-items: start; padding-block: 14px; }
.unit-2u .led { margin-top: 7px; }
/* rack ears with screw holes */
.unit::before, .unit::after {
  content: "";
  position: absolute;
  top: 50%;
  width: 6px;
  height: 6px;
  margin-top: -3px;
  border-radius: 50%;
  background: var(--steel-rail);
  box-shadow: inset 0 0 0 1px var(--face-edge);
}
.unit::before { left: 4px; }
.unit::after { right: 4px; }
a.unit:hover { border-color: var(--cable); }
a.unit:hover .unit-more { color: var(--face-ink); }
a.unit:focus-visible { outline-offset: 2px; }

.led {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--led);
  box-shadow: 0 0 6px 1px color-mix(in srgb, var(--led) 60%, transparent);
}
.led-warn {
  background: var(--led-warn);
  box-shadow: 0 0 6px 1px color-mix(in srgb, var(--led-warn) 65%, transparent);
  animation: blink 2.4s steps(1, end) infinite;
}
@keyframes blink { 50% { opacity: 0.35; } }

.unit-body { display: grid; gap: 4px; min-width: 0; justify-items: start; }
.tape {
  display: inline-block;
  background: var(--tape);
  color: var(--tape-ink);
  font-family: var(--font-display);
  font-stretch: 82%;
  font-weight: 700;
  font-size: 0.9375rem;
  line-height: 1.25;
  padding: 1px 8px 2px;
  border-radius: 1px;
  transform: rotate(-0.6deg);
}
.unit-slot:nth-child(even) .tape { transform: rotate(0.5deg); }
.unit-desc { font-size: var(--step--1); line-height: 1.4; color: var(--face-muted); }
.unit-more { font-size: var(--step--1); color: var(--face-muted); white-space: nowrap; }
@media (max-width: 420px) { .unit-more { display: none; } }

.tunnel {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 56px;
  margin-left: 56px;
  padding-left: 14px;
  border-left: 3px dashed var(--cable);
  font-size: var(--step--1);
  color: var(--muted);
}
.rack-caption { margin-top: 12px; font-size: var(--step--1); color: var(--muted); max-width: 30rem; }

/* ---------- Sections on the home page ---------- */
.section .wrap { padding-block: 56px; border-top: 1px solid var(--rule); display: grid; gap: 28px; }
.section-intro { max-width: var(--measure); color: var(--muted); }

.projects { list-style: none; margin: 0; padding: 0; display: grid; }
.project {
  display: grid;
  gap: 12px 40px;
  padding-block: 28px;
  border-top: 1px solid var(--rule);
}
.project:first-child { border-top: 0; padding-top: 4px; }
@media (min-width: 780px) {
  .project { grid-template-columns: minmax(0, 1fr) minmax(0, 2fr); }
}
.project h3 { font-size: var(--step-2); }
.project h3 a { color: var(--ink); text-decoration: none; }
.project h3 a:hover { color: var(--cable); text-decoration: underline; }
.project-host { color: var(--muted); font-size: var(--step--1); margin-top: 6px; }
.project-body { display: grid; gap: 12px; max-width: var(--measure); min-width: 0; }
.stack { font-size: var(--step--1); color: var(--muted); }
.stack strong { color: var(--ink); font-weight: 700; }

.duties { margin: 0; padding-left: 1.2em; display: grid; gap: 8px; align-content: start; list-style-type: disc; }
.duties li::marker { color: var(--muted); }

/* ---------- Certifications ---------- */
.creds { list-style: none; margin: 0; padding: 0; display: grid; gap: 0; max-width: var(--measure); }
.creds li { display: grid; gap: 2px 24px; padding-block: 12px; border-top: 1px solid var(--rule); }
.creds li:first-child { border-top: 0; padding-top: 0; }
.creds span { color: var(--muted); }
@media (min-width: 640px) { .creds li { grid-template-columns: 16rem minmax(0, 1fr); } }

/* ---------- Tables ---------- */
.table-scroll { overflow-x: auto; max-width: 100%; }
table { border-collapse: collapse; width: 100%; font-size: var(--step--1); line-height: 1.45; }
th, td { text-align: left; vertical-align: top; padding: 10px 16px 10px 0; border-bottom: 1px solid var(--rule); }
th { font-weight: 700; color: var(--muted); }
td:first-child, th:first-child { white-space: nowrap; }
td { font-variant-numeric: tabular-nums; }
.incident-table td:nth-child(2) a { font-weight: 700; }
@media (max-width: 600px) {
  .incident-table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  .incident-table tr { display: grid; gap: 2px; padding-block: 12px; border-bottom: 1px solid var(--rule); }
  .incident-table td { border: 0; padding: 0; white-space: normal; }
  .incident-table td:first-child { color: var(--muted); }
  .incident-table td:nth-child(2) { font-size: var(--step-0); }
}

/* ---------- Skills ---------- */
.skills { display: grid; gap: 24px 40px; margin: 0; }
@media (min-width: 700px) { .skills { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 1040px) { .skills { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.skills div { min-width: 0; }
.skills dt { font-family: var(--font-display); font-stretch: 85%; font-weight: 700; font-size: var(--step-1); margin-bottom: 4px; }
.skills dd { margin: 0; color: var(--muted); }

.contact-block { display: grid; gap: 10px; max-width: var(--measure); }
.contact-block .email { font-size: var(--step-1); user-select: all; }

/* ---------- Footer ---------- */
.site-footer .wrap { padding-block: 32px 48px; border-top: 1px solid var(--rule); color: var(--muted); font-size: var(--step--1); }

/* ---------- Article pages ---------- */
.article .wrap { padding-block: 24px 64px; }
.article-head { display: grid; gap: 16px; padding-block: 16px 36px; max-width: var(--measure); }
.article-head h1 { font-size: var(--step-4); font-weight: 800; font-stretch: 72%; }
.article-head .lead { font-size: var(--step-1); line-height: 1.5; }
.breadcrumb { font-size: var(--step--1); color: var(--muted); }
.breadcrumb a { color: var(--muted); }

.prose { display: grid; gap: 18px; max-width: var(--measure); min-width: 0; }
.prose > section { display: grid; gap: 16px; padding-top: 28px; margin-top: 12px; border-top: 1px solid var(--rule); min-width: 0; }
.prose h2 { font-size: var(--step-2); }
.prose h3 { margin-top: 8px; }
.prose ul, .prose ol { margin: 0; padding-left: 1.3em; display: grid; gap: 6px; }
.prose li::marker { color: var(--muted); }

.facts { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 6px 20px; margin: 0; font-size: var(--step--1); }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; }

code { font-family: var(--font-code); font-size: 0.88em; background: var(--code-bg); padding: 0.1em 0.35em; border-radius: 3px; overflow-wrap: anywhere; }
pre {
  margin: 0;
  background: var(--code-bg);
  border-radius: 4px;
  padding: 16px 18px;
  overflow-x: auto;
  font-size: 0.875rem;
  line-height: 1.55;
  max-width: 100%;
}
pre code { background: none; padding: 0; font-size: inherit; overflow-wrap: normal; }
figure { margin: 0; display: grid; gap: 8px; min-width: 0; }
figcaption { font-size: var(--step--1); color: var(--muted); }

.status { font-size: var(--step--1); font-weight: 700; white-space: nowrap; }
.status-done { color: var(--led); }
.status-open { color: var(--led-warn); }

/* ---------- Incident write-ups ---------- */
.incident { display: grid; gap: 14px; padding-top: 32px; margin-top: 16px; border-top: 1px solid var(--rule); scroll-margin-top: 16px; min-width: 0; }
.incident h2 { font-size: var(--step-2); }
.incident-meta { font-size: var(--step--1); color: var(--muted); font-variant-numeric: tabular-nums; }
.incident h3 { font-size: var(--step-0); font-stretch: 90%; margin-top: 6px; }
.followups { list-style: none; padding: 0 !important; }
.followups li { display: grid; grid-template-columns: 4.5rem minmax(0, 1fr); gap: 12px; }

.next-prev { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 12px 24px; margin-top: 40px; padding-top: 24px; border-top: 1px solid var(--rule); max-width: var(--measure); }

@media (prefers-reduced-motion: reduce) {
  .led-warn { animation: none; }
}
