/* ============================================================
   Adrian Hayden — personal site
   "Field notes from a running system"

   Ground: graphite. Text: warm off-white. Accent: slate blue.
   Signature device: a monospace evidence rail in the margin.
   No web fonts, no frameworks, no dependencies.
   ============================================================ */

/* ---------- tokens ---------- */

:root {
  --ink:        #0f1012;
  --ink-raised: #131518;
  --paper:      #ece7e0;
  --paper-dim:  #b9b4ad;
  --muted:      #7f858e;
  --accent:     #7c9cb8;
  --accent-lit: #9bb8d0;

  --line:       color-mix(in srgb, var(--paper) 11%, transparent);
  --line-soft:  color-mix(in srgb, var(--paper) 6%, transparent);

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

  --rail: 15rem;
  --gutter: clamp(1.25rem, 4vw, 4.5rem);
  --measure: 38rem;

  --ease: cubic-bezier(.22, .61, .36, 1);
}

/* ---------- reset ---------- */

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

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: 5rem;
}

body {
  margin: 0;
  background: var(--ink);
  color: var(--paper);
  font-family: var(--sans);
  font-size: clamp(1rem, .96rem + .18vw, 1.0625rem);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1, h2, h3 { margin: 0; font-weight: 600; line-height: 1.08; letter-spacing: -.022em; }
p  { margin: 0; text-wrap: pretty; }
ol, ul, dl, dd { margin: 0; padding: 0; }
li { list-style: none; }
img { display: block; max-width: 100%; height: auto; }

a {
  color: inherit;
  text-decoration-color: color-mix(in srgb, currentColor 35%, transparent);
  text-underline-offset: .22em;
  text-decoration-thickness: from-font;
}
a:hover { text-decoration-color: currentColor; }

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

::selection { background: color-mix(in srgb, var(--accent) 45%, transparent); }

.skip {
  position: absolute;
  left: -9999px;
  z-index: 20;
  padding: .7rem 1.1rem;
  background: var(--accent);
  color: var(--ink);
  font: 600 .875rem/1 var(--sans);
}
.skip:focus { left: 1rem; top: 1rem; }

/* ---------- shell ---------- */

.shell {
  display: grid;
  grid-template-columns: var(--rail) minmax(0, 1fr);
  min-height: 100vh;
}

/* ---------- index rail ---------- */

.rail {
  position: sticky;
  top: 0;
  align-self: start;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 2rem;
  padding: 2.5rem 1.5rem 2.5rem 2.25rem;
  border-right: 1px solid var(--line);
}

.rail__mark { text-decoration: none; display: block; }
.rail__initials {
  display: inline-grid;
  place-items: center;
  width: 2.15rem; height: 2.15rem;
  border: 1px solid color-mix(in srgb, var(--accent) 55%, transparent);
  color: var(--accent-lit);
  font: 500 .75rem/1 var(--mono);
  letter-spacing: .06em;
}
.rail__name {
  display: block;
  margin-top: .8rem;
  font-size: .9375rem;
  font-weight: 600;
  letter-spacing: -.01em;
}
.rail__mark:hover .rail__initials {
  border-color: var(--accent-lit);
  background: color-mix(in srgb, var(--accent) 12%, transparent);
}

.rail__nav {
  margin-top: auto;
  margin-bottom: 1.75rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--line);
}
.rail__nav ol { display: flex; flex-direction: column; gap: .1rem; }
.rail__nav a {
  display: flex;
  align-items: baseline;
  gap: .7rem;
  padding: .42rem 0;
  color: var(--muted);
  font-size: .875rem;
  text-decoration: none;
  transition: color .2s var(--ease);
}
.rail__nav i {
  font: 400 .6875rem/1 var(--mono);
  font-style: normal;
  letter-spacing: .05em;
  color: var(--muted); /* full tone: alpha mixes fell below AA on this ground */
  transition: color .2s var(--ease);
}
.rail__nav a:hover { color: var(--paper); }
.rail__nav a[aria-current="true"] { color: var(--paper); }
.rail__nav a[aria-current="true"] i { color: var(--accent); }

.rail__foot {
  display: flex;
  align-items: center;
  gap: .5rem;
  font: 400 .75rem/1.4 var(--mono);
  color: var(--muted);
  letter-spacing: -.01em;
}
.dot {
  width: .4rem; height: .4rem;
  flex: none;
  border-radius: 50%;
  background: #6fbf8b;
  box-shadow: 0 0 0 3px color-mix(in srgb, #6fbf8b 16%, transparent);
}

/* ---------- content column ---------- */

main { min-width: 0; }

.section,
.hero { padding-inline: var(--gutter); }

/* ---------- hero ---------- */

.hero {
  position: relative;
  isolation: isolate;
  /* Clip decorative pseudo-elements so they can never widen the document.
     `clip` (not `hidden`) avoids making this a scroll container. */
  overflow: clip;
  padding-block: clamp(4.5rem, 14vh, 9rem) clamp(4rem, 9vh, 6.5rem);
  border-bottom: 1px solid var(--line);
}

/* faint plotted grid, fading out from the upper left */
.hero::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background:
    repeating-linear-gradient(to right,  var(--line-soft) 0 1px, transparent 1px 5.5rem),
    repeating-linear-gradient(to bottom, var(--line-soft) 0 1px, transparent 1px 5.5rem);
  -webkit-mask-image: radial-gradient(115% 85% at 12% 0%, #000 0%, transparent 72%);
          mask-image: radial-gradient(115% 85% at 12% 0%, #000 0%, transparent 72%);
}

.kicker {
  font: 400 .75rem/1 var(--mono);
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--muted);
}

.hero h1 {
  max-width: 15.5ch; /* fits "automation runtimes," (14.4ch), excludes "and" (17.2ch) */
  margin-top: 1.75rem;
  font-size: clamp(2.125rem, 1.2rem + 5vw, 5.25rem);
  letter-spacing: -.035em;
}
.hero h1 em { font-style: normal; color: var(--accent-lit); }

.lede {
  max-width: var(--measure);
  margin-top: 1.85rem;
  color: var(--paper-dim);
  font-size: clamp(1.0625rem, 1rem + .32vw, 1.25rem);
  line-height: 1.6;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: .75rem;
  margin-top: 2.5rem;
}
.btn {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  padding: .72rem 1.35rem;
  border: 1px solid var(--line);
  color: var(--paper);
  font-size: .9375rem;
  font-weight: 500;
  text-decoration: none;
  transition: border-color .2s var(--ease), background-color .2s var(--ease), color .2s var(--ease);
}
.btn:hover { border-color: color-mix(in srgb, var(--paper) 40%, transparent); }
.btn--primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--ink);
}
.btn--primary:hover { background: var(--accent-lit); border-color: var(--accent-lit); }

.status {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(9.5rem, 1fr));
  gap: 1.5rem 2rem;
  max-width: 50rem;
  margin-top: clamp(3rem, 7vh, 4.5rem);
  padding-top: 1.5rem;
  border-top: 1px solid var(--line);
}
.status dt {
  font: 400 .6875rem/1 var(--mono);
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--muted);
}
.status dd { margin-top: .55rem; font-size: .9375rem; }

/* ---------- section scaffolding ---------- */

.section {
  padding-block: clamp(4rem, 10vh, 7rem);
  border-bottom: 1px solid var(--line);
}
.section--last { border-bottom: 0; }

.section__head { max-width: var(--measure); }

.eyebrow {
  font: 400 .75rem/1 var(--mono);
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--accent);
}
.section__head h2 {
  margin-top: 1.1rem;
  font-size: clamp(1.75rem, 1.3rem + 1.9vw, 2.5rem);
}
.section__note {
  margin-top: 1.1rem;
  color: var(--paper-dim);
}

/* ---------- selected work ---------- */

.works { margin-top: clamp(2.5rem, 6vh, 4rem); }

.work {
  display: grid;
  grid-template-columns: 4.5rem minmax(0, 1fr);
  gap: 0 1rem;
  padding-block: clamp(2.25rem, 5vh, 3.25rem);
  border-top: 1px solid var(--line);
}
.work:last-child { border-bottom: 1px solid var(--line); }

.work__idx {
  position: sticky;
  top: 5.5rem;
  align-self: start;
  font: 400 .8125rem/1 var(--mono);
  letter-spacing: .05em;
  color: var(--accent);
}

.work__body { max-width: 46rem; }

.work h3 {
  font-size: clamp(1.3125rem, 1.15rem + .7vw, 1.75rem);
  letter-spacing: -.018em;
}

.work__meta {
  display: flex;
  flex-wrap: wrap;
  gap: .45rem .9rem;
  margin-top: .7rem;
  font: 400 .75rem/1 var(--mono);
  color: var(--muted);
}
.work__meta span + span::before {
  content: "·";
  margin-right: .9rem;
  color: var(--muted);
}

.work__lede {
  max-width: var(--measure);
  margin-top: 1.15rem;
  color: var(--paper-dim);
  font-size: 1.0625rem;
}

.proof {
  margin-top: 1.75rem;
  border-top: 1px solid var(--line-soft);
}
.proof > div {
  display: grid;
  grid-template-columns: 8.5rem minmax(0, 1fr);
  gap: 0 1.5rem;
  padding-block: .95rem;
  border-bottom: 1px solid var(--line-soft);
}
.proof dt {
  font: 400 .6875rem/1.5 var(--mono);
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--muted);
}
.proof dd { font-size: .9375rem; line-height: 1.6; color: var(--paper); }

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: .4rem;
  margin-top: 1.35rem;
}
.tags span {
  padding: .28rem .6rem;
  border: 1px solid var(--line);
  font: 400 .75rem/1.35 var(--mono);
  color: var(--paper-dim);
}

.work__guard {
  margin-top: 1rem;
  font-size: .8125rem;
  font-style: italic;
  color: var(--muted);
}

/* ---------- experience ---------- */

.roles { margin-top: clamp(2.5rem, 6vh, 3.5rem); }

.role {
  display: grid;
  grid-template-columns: 9rem minmax(0, 1fr);
  gap: 0 1.5rem;
  padding-block: 2rem;
  border-top: 1px solid var(--line);
}
.role__when {
  font: 400 .75rem/1.65 var(--mono);
  letter-spacing: .02em;
  color: var(--muted);
}
.role__body { max-width: var(--measure); }
.role h3 { font-size: 1.1875rem; letter-spacing: -.012em; }
.role__org {
  margin-top: .4rem;
  margin-bottom: .9rem;
  font-size: .9375rem;
  color: var(--accent);
}
.role__body > p:last-child { color: var(--paper-dim); font-size: .9375rem; }

.stack {
  margin-top: 3rem;
  padding-top: .5rem;
  border-top: 1px solid var(--line);
}
.stack > div {
  display: grid;
  grid-template-columns: 9rem minmax(0, 1fr);
  gap: 0 1.5rem;
  padding-block: .9rem;
  border-bottom: 1px solid var(--line-soft);
}
.stack dt {
  font: 400 .6875rem/1.6 var(--mono);
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--muted);
}
.stack dd { font-size: .9375rem; color: var(--paper-dim); }

/* ---------- about ---------- */

.about {
  display: grid;
  grid-template-columns: minmax(0, var(--measure)) auto;
  gap: clamp(2rem, 6vw, 4.5rem);
  align-items: start;
  margin-top: clamp(2.25rem, 5vh, 3rem);
}
.about__text { display: grid; gap: 1.25rem; color: var(--paper-dim); }
.about__text p:first-child { color: var(--paper); font-size: 1.125rem; }

.about__portrait { margin: 0; width: 220px; }
.about__portrait img {
  width: 100%;
  border: 1px solid var(--line);
  filter: grayscale(.92) brightness(.84) contrast(1.06);
  transition: filter .5s var(--ease);
}
.about__portrait:hover img {
  filter: grayscale(0) brightness(1) contrast(1);
}
.about__portrait figcaption {
  margin-top: .8rem;
  font: 400 .6875rem/1.5 var(--mono);
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--muted);
}

/* ---------- contact ---------- */

.mailto {
  display: inline-block;
  margin-top: clamp(2rem, 5vh, 2.75rem);
  font-size: clamp(1.375rem, 1rem + 1.8vw, 2.25rem);
  font-weight: 600;
  letter-spacing: -.028em;
  color: var(--accent-lit);
  text-decoration-color: color-mix(in srgb, var(--accent) 40%, transparent);
}
.mailto:hover { text-decoration-color: var(--accent-lit); }

.links {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0;
  max-width: 52rem;
  margin-top: 2.75rem;
  border-top: 1px solid var(--line);
}
.links a {
  display: flex;
  align-items: center;
  gap: .9rem;
  padding: 1rem .25rem;
  border-bottom: 1px solid var(--line);
  color: var(--paper-dim);
  font-size: .9375rem;
  text-decoration: none;
  transition: color .2s var(--ease), padding-left .2s var(--ease);
}
.links i {
  min-width: 2.1rem;
  font: 400 .6875rem/1 var(--mono);
  font-style: normal;
  letter-spacing: .08em;
  color: var(--accent);
}
.links a:hover { color: var(--paper); padding-left: .7rem; }

/* ---------- footer ---------- */

.foot {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: .5rem 2rem;
  padding: 2.25rem var(--gutter) 3rem;
  border-top: 1px solid var(--line);
  font: 400 .75rem/1.6 var(--mono);
  color: var(--muted);
}

/* ============================================================
   responsive — rail folds into a top bar
   ============================================================ */

@media (max-width: 1000px) {
  .shell { grid-template-columns: minmax(0, 1fr); }

  .rail {
    position: sticky;
    top: 0;
    z-index: 10;
    flex-direction: row;
    align-items: center;
    gap: 1.25rem;
    height: auto;
    padding: .7rem var(--gutter);
    border-right: 0;
    border-bottom: 1px solid var(--line);
    background: color-mix(in srgb, var(--ink) 88%, transparent);
    backdrop-filter: saturate(160%) blur(12px);
    -webkit-backdrop-filter: saturate(160%) blur(12px);
  }

  .rail__mark { display: flex; align-items: center; gap: .65rem; flex: none; }
  .rail__initials { width: 1.85rem; height: 1.85rem; font-size: .6875rem; }
  .rail__name { margin-top: 0; font-size: .875rem; }

  .rail__nav {
    margin: 0 0 0 auto;
    padding-top: 0;
    border-top: 0;
    overflow-x: auto;
    scrollbar-width: none;
  }
  .rail__nav::-webkit-scrollbar { display: none; }
  .rail__nav ol { flex-direction: row; gap: .95rem; }
  .rail__nav a { padding: .2rem 0; font-size: .8125rem; white-space: nowrap; }
  .rail__nav i { display: none; }
  .rail__nav a[aria-current="true"] { box-shadow: inset 0 -1px 0 var(--accent); }

  .rail__foot { display: none; }

  .work__idx { top: 4.5rem; }
  html { scroll-padding-top: 4.5rem; }
}

@media (max-width: 760px) {
  .rail__name { display: none; }

  .work { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .work__idx { position: static; margin-bottom: .85rem; }

  .proof > div,
  .stack > div,
  .role { grid-template-columns: minmax(0, 1fr); gap: .35rem; }
  .role { gap: .75rem; }

  .about { grid-template-columns: minmax(0, 1fr); }
  .about__portrait { width: 160px; order: -1; }

  .links { grid-template-columns: minmax(0, 1fr); }
}

/* ============================================================
   progressive enhancement — entry reveal
   Hidden state only applies when JS is present (html.js),
   so the page is fully readable with scripting disabled.
   ============================================================ */

.js .reveal {
  opacity: 0;
  transform: translateY(14px);
}
.js .reveal.is-in {
  opacity: 1;
  transform: none;
  transition: opacity .62s var(--ease), transform .62s var(--ease);
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .js .reveal { opacity: 1; transform: none; }
  .js .reveal.is-in { transition: none; }
  *, *::before, *::after {
    animation-duration: .01ms !important;
    transition-duration: .01ms !important;
  }
}

@media print {
  .rail, .actions, .hero::before { display: none; }
  body { background: #fff; color: #000; }
  .shell { grid-template-columns: 1fr; }
}
