:root {
  --bg: #e4e6e0;
  --paper: #f3f4f0;
  --ink: #17262b;
  --muted: #4d5e63;
  --rack: #1f2c31;
  --unit: #33444b;
  --unit-text: #d9e1e3;
  --blue: #1f5fbf;
  --fibre: #e5b820;
  --led: #3cd488;
  --line: #c3c8c0;
  --rack-w: 250px;
}

* { box-sizing: border-box; margin: 0; }
html { scroll-behavior: smooth; scroll-padding-top: 1.5rem; }
body {
  background: var(--bg);
  color: var(--ink);
  font: 400 1.05rem/1.65 "IBM Plex Sans", system-ui, sans-serif;
  display: grid;
  grid-template-columns: var(--rack-w) 1fr;
  min-height: 100vh;
}
a { color: var(--blue); }
:focus-visible { outline: 3px solid var(--blue); outline-offset: 3px; }

h1, h2, h3 { font-family: "Bricolage Grotesque", system-ui, sans-serif; line-height: 1.1; }
h2 { font-size: clamp(2rem, 4vw, 2.75rem); font-weight: 800; margin-bottom: 1.75rem; }
h3 { font-size: 1.25rem; font-weight: 700; margin-bottom: .4rem; }

/* ---------- Rack navigation ---------- */
.rack {
  position: sticky; top: 0; height: 100vh;
  background: var(--rack);
  padding: 1.25rem 1rem;
  border-right: 10px solid #121b1e;
  display: flex; flex-direction: column;
}
.rack-title { color: #8fa1a6; font: 400 .75rem "IBM Plex Mono", monospace; margin-bottom: 1rem; }
.rack ul { list-style: none; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.unit {
  --h: 54px;
  display: flex; align-items: center; gap: .7rem;
  height: var(--h); padding: 0 .8rem;
  background: var(--unit); color: var(--unit-text);
  border-radius: 3px; border-left: 5px solid transparent;
  text-decoration: none; font: 500 .95rem "Bricolage Grotesque", sans-serif;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.08);
  transition: background .2s, border-color .2s;
}
.unit.u2 { --h: 78px; }
.unit:hover { background: #3f545c; }
.unit.active { background: #405860; border-left-color: var(--fibre); color: #fff; }
.name { flex: 1; }
.leds { display: flex; flex-direction: column; gap: 5px; }
.leds i { width: 7px; height: 7px; border-radius: 50%; background: #1a2428; }
.unit.active .leds i { background: var(--led); box-shadow: 0 0 6px var(--led); }
.unit.active .leds i:nth-child(2) { animation: blink 1.1s steps(2) infinite; }
.ports {
  width: 38px; height: 14px; opacity: .55;
  background: repeating-linear-gradient(90deg, #0f1719 0 6px, transparent 6px 9px);
  border-radius: 1px;
}
@keyframes blink { 50% { opacity: .15; } }

/* ---------- Main layout ---------- */
main { padding: 0 clamp(1.25rem, 5vw, 4.5rem); max-width: 60rem; }
section { padding: 5.5rem 0 3rem; border-bottom: 1px solid var(--line); }
section p { max-width: 62ch; }

/* ---------- Hero ---------- */
.hero { padding-top: 6rem; }
.hero h1 { font-size: clamp(3.5rem, 10vw, 7rem); font-weight: 800; letter-spacing: -.03em; }
.role { font: 700 1.4rem "Bricolage Grotesque", sans-serif; color: var(--blue); margin: .75rem 0 1.25rem; }
.lead { font-size: 1.25rem; max-width: 40ch; }
.trace {
  margin-top: 2.25rem; padding: 1.1rem 1.25rem;
  background: var(--rack); color: #b9f1d4;
  font: 400 .85rem/1.7 "IBM Plex Mono", monospace;
  border-radius: 4px; min-height: 9.5rem; overflow-x: auto; white-space: pre;
}

/* ---------- About ---------- */
.cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr)); gap: 1.5rem 2.5rem; }
.stats {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(9rem, 1fr));
  gap: 1.5rem; margin-top: 2.5rem;
}
.stats div { border-top: 4px solid var(--fibre); padding-top: .6rem; }
.stats dt { color: var(--muted); font-size: .9rem; }
.stats dd { font: 800 2.25rem "Bricolage Grotesque", sans-serif; }

/* ---------- Experience timeline ---------- */
.timeline { list-style: none; padding: 0 0 0 1.75rem; border-left: 4px solid var(--blue); display: grid; gap: 2.25rem; }
.timeline li { position: relative; }
.timeline li::before {
  content: ""; position: absolute; left: calc(-1.75rem - 10px); top: .35rem;
  width: 16px; height: 16px; border-radius: 50%;
  background: var(--paper); border: 4px solid var(--blue);
}
.when { font-weight: 500; color: var(--muted); font-size: .95rem; }

/* ---------- Skills ---------- */
.skill-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr)); gap: 1.75rem 2rem; }
.skill-grid div { border-left: 4px solid var(--blue); padding-left: 1rem; }
.skill-grid p { color: var(--muted); }
.sub { margin: 2.5rem 0 .9rem; }
.certs { list-style: none; padding: 0; display: flex; flex-wrap: wrap; gap: .6rem; }
.certs li { background: var(--paper); border: 1px solid var(--line); border-radius: 3px; padding: .35rem .8rem; font-weight: 500; }

/* ---------- Projects ---------- */
.project { background: var(--paper); padding: 1.5rem 1.75rem; border-left: 8px solid var(--fibre); margin-bottom: 1.25rem; }
.project:nth-of-type(2) { border-left-color: var(--blue); }
.project:nth-of-type(3) { border-left-color: var(--led); }
.tags { margin-top: .75rem; font: 400 .85rem "IBM Plex Mono", monospace; color: var(--muted); }

/* ---------- Contact ---------- */
.contact-intro { margin-bottom: 1.75rem; }
form { display: grid; gap: 1rem; max-width: 36rem; }
label { display: grid; gap: .3rem; font-weight: 500; }
input, textarea {
  font: inherit; padding: .65rem .8rem; background: var(--paper);
  border: 2px solid var(--line); border-radius: 3px; color: var(--ink);
}
input:focus, textarea:focus { border-color: var(--blue); outline: none; }
input[aria-invalid="true"], textarea[aria-invalid="true"] { border-color: #b3261e; }
button {
  justify-self: start; font: 700 1rem "Bricolage Grotesque", sans-serif;
  background: var(--blue); color: #fff; border: 0; border-radius: 3px;
  padding: .75rem 1.5rem; cursor: pointer;
}
button:hover { background: #174b97; }
.form-status { min-height: 1.5em; font-weight: 500; }
.links { margin-top: 2rem; display: flex; flex-wrap: wrap; gap: 1.5rem; font-weight: 500; }
footer { padding: 2rem 0 3rem; color: var(--muted); font-size: .9rem; }

/* ---------- Mobile: rack lays down as a top bar ---------- */
@media (max-width: 860px) {
  body { grid-template-columns: 1fr; }
  .rack { height: auto; flex-direction: row; align-items: center; padding: .5rem; border-right: 0; border-bottom: 6px solid #121b1e; z-index: 10; }
  .rack-title { display: none; }
  .rack ul { flex-direction: row; overflow-x: auto; gap: 6px; width: 100%; }
  .unit, .unit.u2 { --h: 44px; padding: 0 .7rem; white-space: nowrap; border-left-width: 0; border-bottom: 4px solid transparent; }
  .unit.active { border-bottom-color: var(--fibre); }
  .ports { display: none; }
  html { scroll-padding-top: 4.5rem; }
  section { padding-top: 4rem; }
  .hero { padding-top: 3.5rem; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .unit.active .leds i:nth-child(2) { animation: none; }
}
