/* ============================================================
   msaunders.dev : core stylesheet
   Dark, hairline-ruled, monospace-forward. No gradients.
   ============================================================ */

/* --- tokens ------------------------------------------------ */
:root {
  --bg:        #000000;
  --bg-2:      #060709;
  --bg-3:      #0b0d10;
  --bg-4:      #12151a;

  --line:      #171b21;
  --line-2:    #232931;
  --line-3:    #363e49;

  /* ASCII planetarium ink, faint enough to sit behind body copy */
  --space:     #243c50;
  --star:      #2b4a62;   /* starfield sits in the margins, so a touch brighter */

  --fg:        #e7eaef;
  --fg-2:      #98a2b0;
  --fg-3:      #5e6874;

  --accent:      #4c9eff;
  --accent-hi:   #7ab6ff;
  --accent-line: #1f4d80;
  --accent-bg:   #0d1a29;

  --mono: ui-monospace, "SF Mono", SFMono-Regular, "JetBrains Mono", "Cascadia Mono",
          Menlo, Consolas, "Liberation Mono", monospace;
  --sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
          "Helvetica Neue", Arial, sans-serif;

  --wrap: 1120px;
  --nav-h: 56px;
  --pad: clamp(20px, 5vw, 48px);
  --section-pad: clamp(28px, 4vw, 44px);   /* applied top AND bottom, so the
                                              gap between two sections is twice
                                              this */
  --node: 7px;               /* timeline node square */
  --node-top: 7px;           /* its offset below the item's top edge */
  --split-label: 176px;      /* sticky section-label column; the timeline rail
                                is positioned off this, so keep them in sync.
                                Floor is ~170px: "04 Certifications" is the
                                widest label and needs 160px plus the flex gap,
                                below which its connector rule vanishes. */

  --r: 3px;
}

/* --- reset ------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: calc(var(--nav-h) + 24px); }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: smooth; } }

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

img, svg { max-width: 100%; display: block; }
/* width/height attrs reserve layout space; never let them fix the rendered size */
img { height: auto; }
a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hi); }
h1, h2, h3, h4 { margin: 0; font-weight: 500; line-height: 1.2; letter-spacing: -0.01em; }
p { margin: 0 0 1em; }
p:last-child { margin-bottom: 0; }
ul, ol { margin: 0 0 1em; padding-left: 1.15em; }
li { margin-bottom: .45em; }
li::marker { color: var(--accent); }
hr { border: 0; border-top: 1px solid var(--line); margin: 0; }
::selection { background: var(--accent); color: #04070c; }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 2px;
}

.skip {
  position: absolute; left: -9999px; top: 0; z-index: 200;
  background: var(--accent); color: #04070c; padding: 10px 16px;
  font: 500 12px/1 var(--mono);
}
.skip:focus { left: 8px; top: 8px; }

/* --- layout ------------------------------------------------ */
.wrap {
  max-width: var(--wrap);
  margin: 0 auto;
  padding: 0 var(--pad);
  position: relative;
}
main { min-height: 60vh; }

.section { padding: var(--section-pad) 0; }
.section--tight { padding: calc(var(--section-pad) * 0.7) 0; }

/* --- nav --------------------------------------------------- */
.nav {
  position: sticky; top: 0; z-index: 100;
  height: var(--nav-h);
  background: rgba(0, 0, 0, .82);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}
.nav__in {
  max-width: var(--wrap); height: 100%;
  margin: 0 auto; padding: 0 var(--pad);
  display: flex; align-items: center; justify-content: space-between; gap: 24px;
}
.brand {
  font: 500 14px/1 var(--mono);
  color: var(--fg);
  letter-spacing: .02em;
  display: inline-flex; align-items: center; gap: 8px;
  white-space: nowrap;
}
.brand:hover { color: var(--fg); }
.brand__mark {
  width: 22px; height: 22px; flex: none;
  border: 1px solid var(--accent-line);
  color: var(--accent);
  display: grid; place-items: center;
  font-size: 11px; font-weight: 600;
  background: var(--accent-bg);
}
.brand__tld { color: var(--fg-3); }

.nav__links { display: flex; align-items: center; gap: 4px; }
.nav__link {
  font: 400 12.5px/1 var(--mono);
  letter-spacing: .06em; text-transform: uppercase;
  color: var(--fg-2);
  padding: 8px 12px;
  border: 1px solid transparent;
  transition: color .15s, border-color .15s, background-color .15s;
}
.nav__link:hover { color: var(--fg); border-color: var(--line-2); background: var(--bg-2); }
.nav__link[aria-current="page"] { color: var(--accent); border-color: var(--accent-line); background: var(--accent-bg); }

.nav__toggle {
  display: none;
  background: none; border: 1px solid var(--line-2); color: var(--fg);
  width: 36px; height: 32px; padding: 0; cursor: pointer;
  align-items: center; justify-content: center;
}
.nav__toggle:hover { border-color: var(--line-3); }
.nav__toggle span { display: block; width: 15px; height: 1px; background: currentColor; position: relative; }
.nav__toggle span::before, .nav__toggle span::after {
  content: ""; position: absolute; left: 0; width: 15px; height: 1px; background: currentColor;
}
.nav__toggle span::before { top: -5px; }
.nav__toggle span::after  { top:  5px; }

@media (max-width: 720px) {
  .nav__toggle { display: flex; }
  .nav__links {
    position: absolute; top: var(--nav-h); left: 0; right: 0;
    flex-direction: column; align-items: stretch; gap: 0;
    background: var(--bg); border-bottom: 1px solid var(--line);
    padding: 6px var(--pad) 14px;
  }
  .nav__links[hidden] { display: none; }
  .nav__link { padding: 12px 10px; border: 0; border-bottom: 1px solid var(--line); }
  .nav__link[aria-current="page"] { background: transparent; border-color: var(--line); }
}

/* --- type helpers ------------------------------------------ */
.eyebrow {
  font: 400 11.5px/1 var(--mono);
  letter-spacing: .16em; text-transform: uppercase;
  color: var(--fg-3);
  display: flex; align-items: center; gap: 10px;
  margin: 0 0 22px;
  white-space: nowrap;
}
.eyebrow b { color: var(--accent); font-weight: 400; }
.eyebrow::after { content: ""; flex: 1; height: 1px; background: var(--line); }

.h-xl { font-family: var(--mono); font-size: clamp(30px, 6vw, 52px); letter-spacing: -.03em; font-weight: 500; }
.h-lg { font-family: var(--mono); font-size: clamp(22px, 3.4vw, 30px); letter-spacing: -.02em; }
.h-md { font-family: var(--mono); font-size: clamp(17px, 2.2vw, 20px); letter-spacing: -.01em; }
.h-sm { font: 500 13px/1.4 var(--mono); letter-spacing: .04em; text-transform: uppercase; color: var(--fg-2); }

.lede { font-size: clamp(15px, 1.7vw, 17px); color: var(--fg-2); max-width: 68ch; line-height: 1.7; }
.muted { color: var(--fg-2); }
.dim { color: var(--fg-3); }
.mono { font-family: var(--mono); }
.prose { max-width: 72ch; color: var(--fg-2); }
.prose strong { color: var(--fg); font-weight: 500; }
.prose h3 { color: var(--fg); margin: 2em 0 .7em; font-family: var(--mono); font-size: 16px; letter-spacing: .01em; }
.prose h3:first-child { margin-top: 0; }
.prose code {
  font-family: var(--mono); font-size: .88em;
  background: var(--bg-3); border: 1px solid var(--line-2);
  padding: .1em .38em; border-radius: var(--r); color: var(--accent-hi);
}

/* --- hero -------------------------------------------------- */
.hero { padding: clamp(56px, 10vw, 104px) 0 clamp(40px, 7vw, 72px); }
.hero__meta {
  font: 400 12px/1 var(--mono); color: var(--fg-3);
  letter-spacing: .1em; text-transform: uppercase;
  display: flex; flex-wrap: wrap; gap: 8px 18px; margin-bottom: 24px;
}
.hero__meta span { display: inline-flex; align-items: center; gap: 7px; }
.dot { width: 5px; height: 5px; background: var(--accent); flex: none; }
.hero h1 { margin-bottom: 16px; }
.hero .socials { margin-bottom: 30px; }
.hero .btn-row { margin-top: 28px; }
.hero h1 .caret { color: var(--accent); }
.hero__role {
  font: 400 clamp(13px, 1.6vw, 15px)/1.5 var(--mono);
  color: var(--accent); letter-spacing: .02em; margin-bottom: 24px;
}

/* --- buttons ----------------------------------------------- */
.btn {
  display: inline-flex; align-items: center; gap: 9px;
  font: 400 12.5px/1 var(--mono); letter-spacing: .06em; text-transform: uppercase;
  padding: 11px 17px;
  border: 1px solid var(--line-2); color: var(--fg); background: var(--bg-2);
  transition: border-color .15s, background-color .15s, color .15s;
  cursor: pointer;
}
.btn:hover { border-color: var(--line-3); background: var(--bg-3); color: var(--fg); }
.btn--primary { border-color: var(--accent-line); background: var(--accent-bg); color: var(--accent); }
.btn--primary:hover { border-color: var(--accent); background: #112538; color: var(--accent-hi); }
.btn__arr { color: var(--fg-3); transition: transform .15s, color .15s; }
.btn:hover .btn__arr { transform: translateX(3px); color: var(--accent); }
.btn-row { display: flex; flex-wrap: wrap; gap: 10px; }

/* --- tags / chips ------------------------------------------ */
.tags { display: flex; flex-wrap: wrap; gap: 6px; list-style: none; margin: 0; padding: 0; }
.tag {
  font: 400 11.5px/1 var(--mono); letter-spacing: .04em;
  color: var(--fg-2); background: var(--bg-2);
  border: 1px solid var(--line); padding: 5px 9px; border-radius: var(--r);
  white-space: nowrap;
}
.tag--accent { color: var(--accent); border-color: var(--accent-line); background: var(--accent-bg); }

/* --- status pill ------------------------------------------- */
.status {
  display: inline-flex; align-items: center; gap: 7px;
  font: 400 11px/1 var(--mono); letter-spacing: .1em; text-transform: uppercase;
  padding: 5px 9px; border: 1px solid var(--line-2); color: var(--fg-2);
  border-radius: var(--r); background: var(--bg-2);
}
.status--live { color: var(--accent); border-color: var(--accent-line); background: var(--accent-bg); }
.status--live .dot { background: var(--accent); }
.status--wip .dot { background: var(--fg-3); }
.status--soon { color: var(--fg-3); }

/* --- grid helpers ------------------------------------------ */
.grid { display: grid; gap: 1px; background: var(--line); border: 1px solid var(--line); }
.grid > * { background: var(--bg); }
.cols-2 { display: grid; gap: clamp(24px, 4vw, 44px); grid-template-columns: 1fr 1fr; }
.cols-3 { display: grid; gap: clamp(16px, 2.5vw, 24px); grid-template-columns: repeat(3, 1fr); }
@media (max-width: 860px) { .cols-2, .cols-3 { grid-template-columns: 1fr; } }

.split { display: grid; grid-template-columns: var(--split-label) 1fr; gap: clamp(24px, 4vw, 48px); align-items: start; }
@media (max-width: 860px) { .split { grid-template-columns: 1fr; gap: 20px; } }
.split__label { position: sticky; top: calc(var(--nav-h) + 28px); }

/* Sections whose content is a timeline share ONE rail. Each .tl still draws its
   own border, but that only spans the list; this runs the full height of the
   section including its padding, and because sections stack flush the rails join
   into a single unbroken line down the page.
   The gap is closed to 0 so the label's trailing rule meets the rail head on,
   which also shifts the rail and its content left by the old gap width. */
.section--rail { position: relative; padding-top: 0; }
/* every rail section except the first keeps its normal top padding */
.section--rail ~ .section--rail { padding-top: var(--section-pad); }
.section--rail .split { gap: 0; }
/* Give the label row the node's own height and let the existing
   align-items:center do the work: the number, the title and the connector rule
   all end up centred on the first node's centre line, with no magic offsets
   and no dependence on the label's font size. */
.section--rail .eyebrow {
  height: calc(var(--node-top) * 2 + var(--node));
}
.section--rail::before {
  content: "";
  position: absolute; top: 0; bottom: 0; width: 1px;
  left: calc(max(0px, 50% - var(--wrap) / 2) + var(--pad) + var(--split-label));
  background: var(--line);
  pointer-events: none;
}
@media (max-width: 860px) {
  /* Single column here, so .tl's own border is the rail. */
  .section--rail::before { display: none; }
  .section--rail .split { gap: 20px; }
}

/* Secondary link sitting under a section label. */
.split__link {
  display: inline-flex; align-items: center; gap: 7px;
  font: 400 11.5px/1 var(--mono);
  letter-spacing: .09em; text-transform: uppercase;
  color: var(--accent);
}
.split__link:hover { color: var(--accent-hi); }
.split__link span { transition: transform .15s; }
.split__link:hover span { transform: translateX(3px); }
@media (max-width: 860px) { .split__label { position: static; } }

/* --- cards ------------------------------------------------- */
.card {
  border: 1px solid var(--line);
  background: var(--bg-2);
  padding: clamp(18px, 2.4vw, 26px);
  position: relative;
  transition: border-color .18s, background-color .18s;
}
.card--link { display: block; color: inherit; }
.card--link:hover { border-color: var(--line-3); background: var(--bg-3); color: inherit; }
.card--link:hover .card__title { color: var(--accent); }
.card__idx {
  font: 400 11px/1 var(--mono); color: var(--fg-3); letter-spacing: .1em;
  margin-bottom: 14px; display: block;
}
.card__title { font-family: var(--mono); font-size: 17px; margin-bottom: 8px; transition: color .18s; }
.card__body { color: var(--fg-2); font-size: 14px; margin-bottom: 16px; }

/* --- data list (key/value) --------------------------------- */
.kv { display: grid; grid-template-columns: minmax(120px, 170px) 1fr; border-top: 1px solid var(--line); }
.kv > dt {
  font: 400 11.5px/1.5 var(--mono); letter-spacing: .09em; text-transform: uppercase;
  color: var(--fg-3); padding: 14px 16px 14px 0; border-bottom: 1px solid var(--line);
}
.kv > dd {
  margin: 0; padding: 14px 0; border-bottom: 1px solid var(--line);
  color: var(--fg-2); font-size: 14px;
}
.kv > dd .mono { color: var(--fg); }
@media (max-width: 620px) {
  .kv { grid-template-columns: 1fr; }
  .kv > dt { padding-bottom: 2px; border-bottom: 0; }
  .kv > dd { padding-top: 4px; }
}

/* --- timeline ---------------------------------------------- */
.tl { list-style: none; margin: 0; padding: 0 0 0 24px; border-left: 1px solid var(--line); }
.tl__item { position: relative; padding: 0 0 30px; }
.tl__item:last-child { padding-bottom: 0; }
.tl__item::before {
  content: ""; position: absolute; left: -28px; top: var(--node-top);
  width: var(--node); height: var(--node);
  background: var(--bg); border: 1px solid var(--line-3);
}
.tl__item--now::before,
.tl > .tl__item:first-child::before { background: var(--accent); border-color: var(--accent); }
.tl__when {
  font: 400 11.5px/1 var(--mono); letter-spacing: .08em; text-transform: uppercase;
  color: var(--accent); margin-bottom: 7px; display: block;
}
.tl__what { font-family: var(--mono); font-size: 15.5px; margin-bottom: 3px; }
.tl__where { font-size: 13.5px; color: var(--fg-3); margin-bottom: 10px; font-family: var(--mono); }
.tl__desc { font-size: 14px; color: var(--fg-2); }
.tl__desc ul { margin: 0; padding-left: 1.1em; }

/* Project entries: the title links out to its own writeup. */
.tl__what a {
  color: inherit;
  display: inline-flex; align-items: baseline; gap: 9px;
  transition: color .15s;
}
.tl__what a:hover { color: var(--accent); }
.tl__arr {
  color: var(--fg-3); font-size: .8em;
  transition: transform .15s, color .15s;
}
.tl__what a:hover .tl__arr { transform: translateX(3px); color: var(--accent); }
.tl__tags { margin: 11px 0 12px; }

/* --- figures / media --------------------------------------- */
.shots { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 16px; }
.shot {
  border: 1px solid var(--line); background: var(--bg-2); padding: 10px;
  transition: border-color .18s;
  cursor: zoom-in;
  display: flex; flex-direction: column;   /* keeps captions bottom-aligned across the row */
}
.shot:hover { border-color: var(--accent-line); }
.shot img { width: 100%; height: auto; border: 1px solid var(--line); background: #000; }
.shot figcaption {
  font: 400 11px/1.5 var(--mono); letter-spacing: .05em; text-transform: uppercase;
  color: var(--fg-3); margin-top: 10px; padding-top: 0;
}
.shot:hover figcaption { color: var(--fg-2); }

.promos { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 16px; }
.promos img { width: 100%; border: 1px solid var(--line); }

/* --- lightbox ---------------------------------------------- */
.lb {
  position: fixed; inset: 0; z-index: 300;
  background: rgba(0, 0, 0, .94);
  display: grid; place-items: center; padding: 4vh 4vw;
  cursor: zoom-out;
}
.lb[hidden] { display: none; }
.lb img { max-width: 100%; max-height: 92vh; border: 1px solid var(--line-2); }
.lb__cap {
  position: absolute; left: 0; right: 0; bottom: 14px; text-align: center;
  font: 400 11.5px/1 var(--mono); letter-spacing: .1em; text-transform: uppercase; color: var(--fg-3);
}
.lb__x {
  position: absolute; top: 14px; right: 16px;
  background: none; border: 1px solid var(--line-2); color: var(--fg-2);
  font: 400 13px/1 var(--mono); width: 32px; height: 32px; cursor: pointer;
}
.lb__x:hover { color: var(--fg); border-color: var(--line-3); }

/* --- callout / note ---------------------------------------- */
.note {
  border: 1px solid var(--line);
  border-left: 2px solid var(--accent);
  background: var(--bg-2);
  padding: 16px 18px;
  font-size: 14px; color: var(--fg-2);
}
.note__label {
  font: 400 11px/1 var(--mono); letter-spacing: .13em; text-transform: uppercase;
  color: var(--accent); display: block; margin-bottom: 8px;
}

/* --- empty state ------------------------------------------- */
.empty {
  border: 1px dashed var(--line-2);
  background: var(--bg-2);
  padding: clamp(36px, 7vw, 72px) var(--pad);
  text-align: center;
}
.empty__icon {
  width: 40px; height: 40px; margin: 0 auto 20px;
  border: 1px solid var(--accent-line); background: var(--accent-bg); color: var(--accent);
  display: grid; place-items: center; font: 400 15px/1 var(--mono);
}
.empty h2 { font-family: var(--mono); font-size: 18px; margin-bottom: 10px; }
.empty p { color: var(--fg-2); font-size: 14px; max-width: 46ch; margin-inline: auto; }

/* --- stats ------------------------------------------------- */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 1px; background: var(--line); border: 1px solid var(--line); }
.stat { background: var(--bg-2); padding: 18px 20px; }
.stat__n { font: 500 clamp(20px, 3vw, 26px)/1 var(--mono); color: var(--accent); letter-spacing: -.02em; }
.stat__l { font: 400 11px/1.4 var(--mono); letter-spacing: .1em; text-transform: uppercase; color: var(--fg-3); margin-top: 9px; }

/* --- footer ------------------------------------------------ */
/* Deep bottom padding leaves the horizon globe its own clear band. */
.foot { padding: 56px 0 clamp(140px, 22vh, 250px); }
.foot__in { display: flex; flex-wrap: wrap; gap: 24px; justify-content: space-between; align-items: flex-start; }
.foot__note { font: 400 11.5px/1.7 var(--mono); color: var(--fg-3); letter-spacing: .04em; }
.socials { display: flex; flex-wrap: wrap; gap: 8px; }
.social {
  display: inline-flex; align-items: center; gap: 8px;
  font: 400 12px/1 var(--mono); letter-spacing: .05em;
  color: var(--fg-2); border: 1px solid var(--line); background: var(--bg-2);
  padding: 9px 12px; transition: color .15s, border-color .15s, background-color .15s;
}
.social:hover { color: var(--accent); border-color: var(--accent-line); background: var(--accent-bg); }
.social svg { width: 14px; height: 14px; fill: currentColor; flex: none; }

/* --- breadcrumb -------------------------------------------- */
.crumb {
  font: 400 11.5px/1 var(--mono); letter-spacing: .09em; text-transform: uppercase;
  color: var(--fg-3); display: flex; align-items: center; gap: 9px; flex-wrap: wrap;
  padding-top: 34px;
}
.crumb a { color: var(--fg-3); }
.crumb a:hover { color: var(--accent); }
.crumb__sep { color: var(--line-3); }

/* --- pager ------------------------------------------------- */
.pager { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 28px 0 48px; }

/* --- ASCII planetarium ------------------------------------- */
/* Sits in document space, not the viewport, so the bodies scroll up and
   off the page with everything else. js/cosmos.js fills each <pre> with a
   shaded ASCII body and spins it from scroll position. */
.cosmos {
  position: absolute; top: 0; left: 0;
  width: 100%; height: 100%;
  z-index: 0;
  overflow: hidden; pointer-events: none;
  user-select: none; -webkit-user-select: none;
}
.cosmos__body {
  position: absolute; margin: 0;
  font-family: var(--mono);
  line-height: 1;
  white-space: pre;
  color: var(--space);
}
/* The horizon globe spans the full width at the foot of the page. */
.cosmos__horizon { width: 100%; }

/* Starfield. Scattered only in the margins either side of the content
   column, so no star ever sits behind body copy. */
.stars { position: absolute; inset: 0; pointer-events: none; }
.star {
  position: absolute;
  font-family: var(--mono);
  font-style: normal;
  line-height: 1;
  color: var(--star);
}
.star--blue { color: #35709f; }
.star--tw {
  animation-name: twinkle;
  animation-iteration-count: infinite;
  animation-timing-function: ease-in-out;
}
@keyframes twinkle {
  0%, 100% { opacity: .20; }
  50%      { opacity: .95; }
}
@media (prefers-reduced-motion: reduce) {
  .star--tw { animation: none; opacity: .58; }
}

/* Content rides above the planetarium. */
body { position: relative; }
.nav, main, .foot, .skip { position: relative; z-index: 1; }
.nav { z-index: 100; }

@media (max-width: 720px) {
  .cosmos__body { color: #1a2c3a; }   /* quieter where copy is denser */
}

/* --- reveal on scroll -------------------------------------- */
/* Progressive enhancement: content is visible by default. The hidden start
   state only applies once JS has confirmed it can reveal it again. */
.js .rv { opacity: 0; transform: translateY(10px); transition: opacity .5s ease, transform .5s ease; }
.js .rv.in { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) { .js .rv { opacity: 1; transform: none; transition: none; } }
