/* ============ Tokens — dark (default) ============ */
:root {
  --bg: #08090b;
  --fg: #d3d7de;
  --muted: #6b7280;
  --dim: #4b5563;
  --prompt: #62d9a8;
  --accent: #ffb454;
  --link: #7dcfff;
  --warn: #e0a458;
  --rule: #1c2027;
  --hover-bg: #12151a;
  --font-mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --content-max: 760px;
}

/* Wider column on larger screens — the mobile-width column just left dead
   margins on desktop. Prose still wraps at a readable measure since
   .entry-body / .hero-lede etc. carry their own ch-based max-width, so
   widening the outer column only reclaims space for layout, not line length. */
@media (min-width: 900px) {
  :root { --content-max: 920px; }
}
@media (min-width: 1200px) {
  :root { --content-max: 1080px; }
}

/* ============ Tokens — light ============ */
:root[data-theme="light"] {
  --bg: #f4f3ee;
  --fg: #24282e;
  --muted: #6b7280;
  --dim: #9aa1ab;
  --prompt: #0a8f63;
  --accent: #b5620a;
  --link: #0b6fa8;
  --warn: #a3660a;
  --rule: #dcdad2;
  --hover-bg: #eae8e0;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-mono);
  font-size: 15.5px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  transition: background 0.2s ease, color 0.2s ease;
}

a { color: var(--link); text-decoration: underline; text-underline-offset: 3px; }
a:hover { color: var(--accent); }
strong { color: var(--fg); font-weight: 600; }
.dim { color: var(--dim); }
.muted-line { color: var(--muted); }

@keyframes blink { 50% { opacity: 0; } }

/* ============ Top bar: name + hamburger ============ */
.topbar {
  position: sticky;
  top: 0;
  z-index: 60;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg);
  border-bottom: 1px solid var(--rule);
  padding: 16px 24px;
}
.topbar-name {
  font-size: 16px;
  font-weight: 600;
  color: var(--fg);
  text-decoration: none;
  letter-spacing: 0.01em;
}
.topbar-name:hover { color: var(--accent); }

.hamburger {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 30px;
  height: 30px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
}
.hamburger span {
  display: block;
  width: 100%;
  height: 1.5px;
  background: var(--fg);
  transition: transform 0.2s ease, opacity 0.2s ease;
}
.hamburger[aria-expanded="true"] span:nth-child(1) { transform: translateY(6.5px) rotate(45deg); }
.hamburger[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.hamburger[aria-expanded="true"] span:nth-child(3) { transform: translateY(-6.5px) rotate(-45deg); }

.nav-menu {
  position: sticky;
  top: 63px;
  z-index: 55;
  display: flex;
  flex-direction: column;
  gap: 2px;
  background: var(--bg);
  border-bottom: 1px solid var(--rule);
  padding: 8px 24px 16px;
}
.nav-menu[hidden] { display: none; }
.nav-menu a {
  color: var(--fg);
  text-decoration: none;
  padding: 10px 0;
  border-bottom: 1px solid var(--rule);
  font-size: 15px;
}
.nav-menu a:hover { color: var(--accent); }
.nav-menu .theme-toggle { margin: 12px 0 0; }
.nav-menu .nav-cta {
  color: var(--accent);
  font-weight: 600;
  border-bottom-color: var(--accent);
}

/* ============ Full-page starfield ============ */
#particles, #asteroids {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  pointer-events: none;
}
#particles { z-index: 0; }
#asteroids { z-index: 1; }
/* Content sits above the starfield. .topbar / .nav-menu / .intro-name are
   already positioned with their own z-index, so they're left alone here —
   overriding their position would break the sticky header. */
main, .footer {
  position: relative;
  z-index: 2;
}

/* ============ Contact row symbols ============ */
.whois-sym {
  color: var(--prompt);
  width: 1.4em;
  flex: none;
  text-align: center;
}

/* ============ Intro sequence ============ */
/* During the intro the banner is promoted to a full-screen fixed stage with
   the name centred over it; it then animates down into its normal position
   in the flow. `.intro-active` is only on <html> while that is running. */
.intro-active body { overflow: hidden; }
.intro-active .topbar,
.intro-active main,
.intro-active .footer {
  opacity: 0;
}
/* the starfield stays, the page just gets out of the way */
.intro-active.intro-settling .topbar,
.intro-active.intro-settling main,
.intro-active.intro-settling .footer {
  opacity: 1;
  transition: opacity 0.9s ease 0.35s;
}

.intro-name {
  position: fixed;
  z-index: 95;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  transform-origin: center center;
  margin: 0;
  font-size: clamp(30px, 8.5vw, 92px);
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--fg);
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
}
.intro-active .intro-name { opacity: 1; }
.intro-name.flying {
  transition: transform 1.45s cubic-bezier(0.45, 0.02, 0.15, 1) 0.14s,
              opacity 0.35s ease 1.25s;
}
.intro-name.gone { opacity: 0; }

/* the real hero name stays hidden until the flying one lands on it */
.intro-active #hero h1 { visibility: hidden; }

.theme-toggle {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
}
.theme-opt {
  background: none;
  border: 1px solid var(--rule);
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 12.5px;
  padding: 3px 9px;
  cursor: pointer;
  border-radius: 2px;
}
.theme-opt:hover { color: var(--fg); border-color: var(--dim); }
.theme-opt[aria-pressed="true"] {
  color: var(--bg);
  background: var(--prompt);
  border-color: var(--prompt);
}

/* ============ Layout ============ */
main { max-width: var(--content-max); margin: 0 auto; padding: 0 24px; }
.block { padding: 44px 0; }
.rule {
  max-width: var(--content-max);
  margin: 0 auto;
  border: none;
  border-top: 1px solid var(--rule);
}

.cmd {
  margin: 0 0 14px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
}
.cmd .prompt { color: var(--prompt); margin-right: 8px; }
.cmd-spaced { margin-top: 44px; }
.section-note {
  color: var(--dim);
  margin: -8px 0 22px;
  font-size: 12.5px;
}
.out { margin: 0 0 32px; padding-left: 18px; border-left: 1px solid var(--rule); }

/* ============ Hero ============ */
#hero h1 {
  font-size: clamp(32px, 6vw, 46px);
  margin: 0 0 6px;
  font-weight: 700;
  letter-spacing: -0.01em;
}
.role { margin: 0 0 6px; color: var(--accent); font-size: 19px; }

.typewriter {
  color: var(--fg);
  font-size: 17px;
  line-height: 1.7;
  max-width: 66ch;
  white-space: pre-wrap;
  min-height: 4.5em;
}

/* generic scroll-triggered typing reveal, shared by the intro and every
   descriptive text block on the page */
.type-target.typing::after {
  content: "▌";
  color: var(--prompt);
  animation: blink 1s steps(1) infinite;
  margin-left: 2px;
}

/* The intro line keeps its cursor permanently — during typing and after it
   finishes — so the terminal reads as a live session rather than a
   finished screenshot. Higher specificity than the .typing rule above, so
   only one cursor ever renders. */
#introText::after {
  content: "▌";
  color: var(--prompt);
  animation: blink 1s steps(1) infinite;
  margin-left: 2px;
}

.stat-log { display: flex; flex-direction: column; gap: 10px; }
@media (min-width: 700px) {
  .stat-log { display: grid; grid-template-columns: 1fr 1fr; column-gap: 40px; row-gap: 14px; }
}
.stat-line {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 10px;
}
.tag { font-weight: 600; font-size: 12px; }
.tag-ok { color: var(--prompt); }
.tag-warn { color: var(--warn); }
.stat-num {
  color: var(--accent);
  font-weight: 700;
  font-size: 20px;
  min-width: 3.5ch;
}
.stat-desc { color: var(--fg); font-size: 15.5px; flex-basis: 100%; margin-top: 2px; }

.btn-row {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  margin: 20px 0 32px;
}
.btn {
  display: inline-flex;
  align-items: center;
  font-family: var(--font-mono);
  font-size: 14.5px;
  font-weight: 600;
  padding: 12px 22px;
  border-radius: 3px;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease, transform 0.1s ease;
}
.btn:active { transform: translateY(1px); }
.btn-primary {
  background: var(--accent);
  color: var(--bg);
  border: 1px solid var(--accent);
}
.btn-primary:hover { background: var(--fg); border-color: var(--fg); }
.btn-ghost {
  background: none;
  color: var(--fg);
  border: 1px solid var(--rule);
}
.btn-ghost:hover { border-color: var(--accent); color: var(--accent); }

/* anchored sections shouldn't land underneath the sticky top bar */
#capabilities, #about, #systems, #experience, #blog, #contact {
  scroll-margin-top: 64px;
}

/* ============ Listings (capabilities / systems / experience) ============ */
.listing { display: flex; flex-direction: column; gap: 30px; }
@media (min-width: 900px) {
  #capabilities .listing {
    display: grid;
    grid-template-columns: 1fr 1fr;
    column-gap: 48px;
    row-gap: 34px;
  }
}
.entry {
  padding: 0;
  position: relative;
}
/* faint abstract line-art behind each description, so the empty space
   around shorter entries doesn't read as bare. Purely decorative — sits
   behind the text via normal paint order, no z-index needed. */
.entry::before {
  content: "";
  position: absolute;
  top: -20px;
  right: -10px;
  width: 220px;
  height: 220px;
  background-repeat: no-repeat;
  background-size: contain;
  pointer-events: none;
}
.listing .entry:nth-of-type(4n+1)::before {
  background-image: url("data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyMjAiIGhlaWdodD0iMjIwIiB2aWV3Qm94PSIwIDAgMjIwIDIyMCI+PHBvbHlnb24gcG9pbnRzPSIxMTAsMTAgMTgwLDQwIDIwNSwxMDAgMTkwLDE2MCAxNDAsMjA1IDgwLDIwMCAzMCwxNTUgMjAsOTAgNTUsMzUiIGZpbGw9Im5vbmUiIHN0cm9rZT0iIzYyZDlhOCIgc3Ryb2tlLXdpZHRoPSIxLjEiIG9wYWNpdHk9IjAuMDUiLz48L3N2Zz4=");
}
.listing .entry:nth-of-type(4n+2)::before {
  background-image: url("data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyMjAiIGhlaWdodD0iMjIwIiB2aWV3Qm94PSIwIDAgMjIwIDIyMCI+PHBvbHlnb24gcG9pbnRzPSIyMCw2MCA5MCwxNSAxNTAsMzAgMjAwLDgwIDE4MCwxNTAgMTIwLDIwMCA2MCwxODAgMTUsMTIwIiBmaWxsPSJub25lIiBzdHJva2U9IiM2MmQ5YTgiIHN0cm9rZS13aWR0aD0iMS4xIiBvcGFjaXR5PSIwLjA1Ii8+PC9zdmc+");
}
.listing .entry:nth-of-type(4n+3)::before {
  background-image: url("data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyMjAiIGhlaWdodD0iMjIwIiB2aWV3Qm94PSIwIDAgMjIwIDIyMCI+PHBvbHlnb24gcG9pbnRzPSIxMDAsNSAxNjAsNTAgMjEwLDExMCAxNzAsMTkwIDEwMCwyMTAgNDAsMTc1IDEwLDExMCA0NSw1MCIgZmlsbD0ibm9uZSIgc3Ryb2tlPSIjNjJkOWE4IiBzdHJva2Utd2lkdGg9IjEuMSIgb3BhY2l0eT0iMC4wNSIvPjwvc3ZnPg==");
}
.listing .entry:nth-of-type(4n)::before {
  background-image: url("data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyMjAiIGhlaWdodD0iMjIwIiB2aWV3Qm94PSIwIDAgMjIwIDIyMCI+PHBvbHlnb24gcG9pbnRzPSIzMCwxMDAgNzAsMjAgMTUwLDE1IDIwMCw3MCAxOTAsMTQwIDEzMCwyMDUgNjAsMTkwIDE1LDE1MCIgZmlsbD0ibm9uZSIgc3Ryb2tlPSIjNjJkOWE4IiBzdHJva2Utd2lkdGg9IjEuMSIgb3BhY2l0eT0iMC4wNSIvPjwvc3ZnPg==");
}
#capabilities .entry::before { width: 170px; height: 170px; }
@media (max-width: 600px) {
  .entry::before { width: 140px; height: 140px; opacity: 0.7; }
}
.entry-head { margin: 0 0 9px; font-size: 16.5px; }
.dir { color: var(--link); font-size: 12px; }
.path { color: var(--fg); font-weight: 600; }
.entry-body {
  color: var(--fg);
  margin: 0 0 10px;
  max-width: 64ch;
  font-size: 16.5px;
  line-height: 1.72;
}
.entry-tags {
  color: var(--dim);
  font-size: 12px;
  margin: 0;
  word-break: break-word;
}
.entry-metric {
  color: var(--accent);
  font-size: 14px;
  margin: 6px 0 0;
}
.pipeline {
  color: var(--muted);
  font-size: 13px;
  margin: 0 0 10px;
  word-break: break-word;
}
.pipeline .arrow { color: var(--dim); margin: 0 2px; }

.log-date { color: var(--prompt); font-weight: 600; }
.log-list {
  margin: 10px 0 0;
  padding-left: 20px;
  color: var(--fg);
  font-size: 16px;
  line-height: 1.78;
}
.log-list li { margin-bottom: 10px; }

/* ============ Contact / whois ============ */
.whois { display: flex; flex-direction: column; gap: 8px; }
.whois-row { display: flex; gap: 14px; font-size: 16px; }
.whois-key { color: var(--dim); min-width: 9ch; }

/* ============ Footer ============ */
.footer {
  max-width: var(--content-max);
  margin: 0 auto;
  padding: 32px 24px 64px;
  font-size: 14px;
  color: var(--muted);
}
/* ============ Focus visibility ============ */
a:focus-visible, button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* ============ Fluid cursor ============ */
#fluid {
  position: fixed;
  inset: 0;
  z-index: 40;
  width: 100vw;
  height: 100vh;
  pointer-events: none;
  mix-blend-mode: screen;
  opacity: 0.8;
}
:root[data-theme="light"] #fluid {
  mix-blend-mode: multiply;
  opacity: 0.55;
}

@media (max-width: 600px) {
  body { font-size: 14.5px; }
  .out { padding-left: 12px; }
  .whois-row { flex-direction: column; gap: 2px; }
  .whois-key { min-width: 0; }
}

/* ============ Page titles (multi-page) ============ */
.page-title {
  font-size: clamp(26px, 4.5vw, 38px);
  font-weight: 700;
  letter-spacing: -0.01em;
  margin: 0 0 34px;
}
.nav-menu a.is-active {
  color: var(--prompt);
  border-bottom-color: var(--prompt);
}
/* inner pages start below the sticky bar rather than under a full-screen intro */
body[data-page="inner"] main { padding-top: 26px; }

/* ============ Experience timeline ============ */
.timeline {
  position: relative;
  list-style: none;
  margin: 0;
  padding: 0 0 0 30px;
}
.timeline-rail {
  position: absolute;
  left: 4px;
  top: 8px;
  bottom: 8px;
  width: 1px;
  background: var(--rule);
}
/* fills as you scroll the page, marking progress down the track record */
.timeline-rail i {
  display: block;
  width: 100%;
  height: 100%;
  background: var(--prompt);
  transform: scaleY(0);
  transform-origin: top;
}
.tl-item {
  position: relative;
  margin-bottom: 26px;
  list-style: none;
}
.tl-item:last-child { margin-bottom: 0; }
.tl-dot {
  position: absolute;
  left: -30px;
  top: 26px;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--prompt);
  box-shadow: 0 0 0 4px var(--bg);
}
.tl-card {
  border: 1px solid var(--rule);
  border-radius: 4px;
  padding: 22px 24px;
  background: color-mix(in srgb, var(--bg) 86%, transparent);
}
.tl-badge {
  display: inline-block;
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--prompt);
  border: 1px solid var(--prompt);
  border-radius: 999px;
  padding: 2px 10px;
  margin: 0 0 14px;
}
.tl-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 18px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}
.tl-role { font-size: 19px; font-weight: 700; margin: 0; color: var(--accent); }
.tl-org { margin: 3px 0 0; color: var(--fg); font-size: 15px; }
.tl-when { text-align: right; font-size: 13px; }
.tl-dates { display: block; color: var(--fg); }
.tl-place { display: block; color: var(--muted); margin-top: 2px; }
.tl-points { margin: 0; padding-left: 18px; }
.tl-points li {
  color: var(--fg);
  font-size: 15.5px;
  line-height: 1.7;
  margin-bottom: 9px;
}
.tl-points li::marker { color: var(--prompt); }
.tl-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  list-style: none;
  margin: 16px 0 0;
  padding: 0;
}
.tl-chips li {
  font-size: 11.5px;
  color: var(--muted);
  border: 1px solid var(--rule);
  border-radius: 999px;
  padding: 3px 10px;
}
@media (max-width: 600px) {
  .timeline { padding-left: 22px; }
  .tl-dot { left: -22px; }
  .tl-card { padding: 18px 16px; }
  .tl-when { text-align: left; }
}

/* ============ Contact ============ */
.contact-status {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  border: 1px solid var(--rule);
  border-left: 2px solid var(--prompt);
  border-radius: 4px;
  padding: 16px 18px;
  margin-bottom: 26px;
  background: color-mix(in srgb, var(--bg) 84%, transparent);
}
.status-dot {
  position: relative;
  flex: none;
  width: 9px;
  height: 9px;
  margin-top: 7px;
  border-radius: 50%;
  background: var(--prompt);
}
/* a slow pulse — the page reads as a live system elsewhere, so does this */
.status-dot::after {
  content: "";
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  background: var(--prompt);
  opacity: 0.35;
  animation: statusPulse 2.4s ease-out infinite;
}
@keyframes statusPulse {
  0%   { transform: scale(0.5); opacity: 0.45; }
  70%  { transform: scale(1.5); opacity: 0; }
  100% { transform: scale(1.5); opacity: 0; }
}
.status-line { margin: 0; font-weight: 600; color: var(--fg); font-size: 15.5px; }
.status-meta { margin: 3px 0 0; color: var(--muted); font-size: 13.5px; }

.contact-cards {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 8px;
}
.c-card {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--rule);
  border-radius: 5px;
  padding: 22px;
  text-decoration: none;
  background: color-mix(in srgb, var(--bg) 84%, transparent);
  transition: border-color 0.18s ease, transform 0.18s ease, background 0.18s ease;
}
.c-card:hover {
  border-color: var(--prompt);
  transform: translateY(-2px);
}
.c-card--primary { border-color: color-mix(in srgb, var(--accent) 55%, var(--rule)); }
.c-card--primary:hover { border-color: var(--accent); }
.c-icon { font-size: 20px; color: var(--prompt); line-height: 1; }
.c-card--primary .c-icon { color: var(--accent); }
.c-title {
  margin-top: 12px;
  font-size: 17px;
  font-weight: 700;
  color: var(--fg);
}
.c-desc {
  margin-top: 7px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.6;
  flex: 1;
}
.c-go {
  margin-top: 16px;
  font-size: 13px;
  color: var(--prompt);
  word-break: break-all;
}
.c-card--primary .c-go { color: var(--accent); font-weight: 600; }

.link-list { list-style: none; margin: 0; padding: 0; }
.link-list li {
  display: flex;
  align-items: baseline;
  gap: 12px;
  padding: 11px 2px;
  border-bottom: 1px solid var(--rule);
  font-size: 14.5px;
}
.link-list li:last-child { border-bottom: none; }
.ll-sym { color: var(--prompt); width: 1.3em; flex: none; }
.ll-key { color: var(--muted); min-width: 8ch; }
.link-list a { color: var(--fg); text-decoration: none; border-bottom: 1px dashed var(--dim); }
.link-list a:hover { color: var(--accent); border-color: var(--accent); }

@media (max-width: 640px) {
  .contact-cards { grid-template-columns: 1fr; }
  .link-list li { flex-wrap: wrap; gap: 6px 10px; }
}
