:root,
[data-theme='light'] {
  --bg: #ffffff;
  --ink: #000000;
  --muted: #5a5a5a;
  --rule: #000000;
  /* Light-theme accent darkened from #ff5b00 → #cc4400 to meet WCAG AA
     contrast (4.5:1) for small body text and accent CTAs on white. Dark
     theme stays #ff7a2f (passes against #0a0a0a at 7.6:1). */
  --accent: #cc4400;
  --card: #ffffff;
  --shot-bg: #f4f4f1;
  /* Brutalist hero scale — used on /contact/ and /projects/.
     Reference this var instead of redeclaring clamp() per page. */
  --hero-size: clamp(72px, 16vw, 200px);
}

[data-theme='dark'] {
  --bg: #0a0a0a;
  --ink: #ffffff;
  --muted: #9a9a9a;
  --rule: #ffffff;
  --accent: #ff7a2f;
  --card: #0a0a0a;
  --shot-bg: #141414;
}

html {
  color-scheme: light dark;
  /* Reserve room under the sticky footer for in-page anchor jumps so the
     bottom of the target doesn't hide under the fixed bar. */
  scroll-padding-bottom: 72px;
}

* {
  box-sizing: border-box;
}

/* ------------------------------------------------------------------ */
/* Accessibility — focus + skip link                                   */
/* ------------------------------------------------------------------ */

/* Visible focus ring for keyboard users — required (WCAG 2.4.7).
   The brutalist site removes a lot of default chrome, so the browser's
   default focus indicator isn't reliable. */
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

/* Skip-to-content link — first element in <body>, visible only on focus. */
.skip-link {
  position: absolute;
  top: -100px;
  left: 16px;
  z-index: 100;
  background: var(--ink);
  color: var(--bg);
  padding: 12px 18px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  text-decoration: none;
  transition: top 0.18s ease-out;
}
.skip-link:focus-visible {
  top: 16px;
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

html,
body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: 'JetBrains Mono', ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
  font-size: 14.5px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--accent);
  text-decoration: underline;
  text-decoration-thickness: 2px;
  text-underline-offset: 3px;
}
a:hover {
  text-decoration-color: var(--accent);
}

.wrap {
  max-width: 720px;
  margin: 0 auto;
  padding: 0 28px;
}

/* Site header */
.site-header {
  padding: 22px 0;
  border-bottom: 1px solid var(--rule);
}
.site-header .wrap {
  max-width: none;
  padding: 0 32px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 24px;
  flex-wrap: wrap;
}
.brand {
  font-family: 'JetBrains Mono', monospace;
  font-weight: 700;
  font-size: 14px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink);
  text-decoration: none;
}
.site-header__right {
  display: flex;
  align-items: center;
  gap: 28px;
  flex-wrap: wrap;
}
.site-nav {
  display: flex;
  gap: 22px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.site-nav a {
  color: var(--ink);
  text-decoration: none;
}
.site-nav a:hover,
.site-nav a[aria-current='page'] {
  color: var(--accent);
}
/* Project entries */
.project {
  margin: 0;
  padding: 28px 0;
  border-bottom: 1px solid var(--rule);
}
.project:first-of-type {
  padding-top: 8px;
}
.project:last-of-type {
  border-bottom: none;
}
.project-title {
  font-family: 'JetBrains Mono', monospace;
  font-weight: 700;
  font-size: 18px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  margin: 0 0 6px;
}
.project-meta {
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 14px;
}
.project p {
  margin: 0 0 12px;
}
.project-links {
  margin: 14px 0 0;
  display: flex;
  flex-wrap: wrap;
  gap: 22px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

/* Color swatches (Design page) */
.swatch-grid {
  list-style: none;
  padding: 0;
  margin: 18px 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 12px;
}
.swatch {
  border: 1px solid var(--rule);
  background: var(--card);
}
.swatch__color {
  height: 56px;
  border-bottom: 1px solid var(--rule);
}
.swatch__meta {
  padding: 10px 12px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
}
.swatch__name {
  display: block;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--ink);
}
.swatch__var {
  display: block;
  color: var(--muted);
  font-size: 11px;
  letter-spacing: 0.04em;
  margin-top: 2px;
}

/* Component sample blocks (Design page) */
.sample {
  margin: 14px 0 22px;
  padding: 18px 22px;
  border: 1px solid var(--rule);
  background: var(--card);
}

/* Stat grid (Diagnostic page) */
.stat-grid {
  list-style: none;
  padding: 0;
  margin: 18px 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 12px;
}
.stat-grid li {
  padding: 14px 16px;
  border: 1px solid var(--rule);
  background: var(--card);
}
.stat-label {
  display: block;
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 6px;
}
.stat-value {
  font-family: 'JetBrains Mono', monospace;
  font-size: 15px;
  word-break: break-word;
}
.stat-value--mono {
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 13px;
}
/* Launch Checklist */
.checklist {
  list-style: none;
  padding: 0;
  margin: 14px 0 0;
}
.checklist li {
  border-bottom: 1px solid var(--rule);
}
.checklist li:last-child {
  border-bottom: none;
}
.checklist label {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 0;
  font-family: 'JetBrains Mono', monospace;
  font-size: 13px;
  color: var(--ink);
  cursor: pointer;
}
.checklist input[type='checkbox'] {
  margin: 3px 0 0;
  width: 14px;
  height: 14px;
  accent-color: var(--accent);
  cursor: pointer;
  flex-shrink: 0;
}
.checklist input[type='checkbox']:checked + span {
  color: var(--muted);
  text-decoration: line-through;
  text-decoration-color: var(--muted);
}
.checklist--shipped li {
  padding: 12px 0;
  font-family: 'JetBrains Mono', monospace;
  font-size: 13px;
  color: var(--muted);
}
.checklist-mark {
  display: inline-block;
  margin-right: 12px;
  color: var(--accent);
  font-weight: 700;
}
.checklist-progress {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  margin-top: 10px;
}
.checklist label a {
  color: var(--muted);
  text-decoration: none;
  border-bottom: 1px solid var(--rule);
}
.checklist label a:hover {
  color: var(--accent);
  border-bottom-color: var(--accent);
}
.checklist input[type='checkbox']:checked + span a {
  color: var(--muted);
}
/* Tech stack (System page) */
.tech-stack__group {
  margin: 0 0 28px;
}
.tech-stack__group h3 {
  font-family: 'JetBrains Mono', monospace;
  font-weight: 700;
  font-size: 12px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 10px;
}
.tech-stack__list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.tech-stack__list li {
  padding: 6px 12px;
  border: 1px solid var(--rule);
  background: var(--card);
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
}
.tech-stack__version {
  color: var(--muted);
  margin-left: 6px;
  font-size: 11px;
  letter-spacing: 0.02em;
}
/* Main */
main.wrap {
  padding-top: 64px;
  padding-bottom: 64px;
}

h1 {
  font-family: 'JetBrains Mono', monospace;
  font-weight: 700;
  font-size: 56px;
  line-height: 1;
  letter-spacing: -0.02em;
  text-transform: uppercase;
  margin: 0 0 18px;
}

h2 {
  font-family: 'JetBrains Mono', monospace;
  font-weight: 700;
  font-size: 16px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink);
  margin: 0 0 14px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--rule);
}

h3 {
  font-family: 'JetBrains Mono', monospace;
  font-weight: 700;
  font-size: 14px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin: 24px 0 6px;
}

p {
  margin: 0 0 14px;
}

.lede {
  font-size: 18px;
  line-height: 1.45;
  color: var(--ink);
  margin: 0 0 14px;
  max-width: 38ch;
}
.meta {
  color: var(--muted);
  font-size: 12.5px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

/* Bare <section> margin — scoped to the utility pages (main.wrap) so
   their plain stacked sections breathe. Public pages (home, about,
   work, projects, contact) have sections with their own padding and
   borders, so a global section margin just creates ghost gaps. */
main.wrap section {
  margin: 48px 0;
}

ul.plain {
  list-style: none;
  padding: 0;
  margin: 0;
}
ul.plain li {
  margin: 0 0 14px;
  padding-left: 18px;
  position: relative;
}
ul.plain li::before {
  content: '—';
  position: absolute;
  left: 0;
  color: var(--rule);
}
/* Run button (diagnostic & tools) */
.run-controls {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  margin-top: 24px;
}
.run-button {
  font-family: 'JetBrains Mono', monospace;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 11px 20px;
  background: var(--accent);
  color: var(--bg);
  border: 1px solid var(--accent);
  border-radius: 0;
  cursor: pointer;
  transition:
    background 0.15s,
    color 0.15s;
}
.run-button:hover {
  background: transparent;
  color: var(--accent);
}
.run-button:active {
  transform: translateY(1px);
}
.run-button:disabled {
  opacity: 0.55;
  cursor: progress;
}
.run-status {
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}

/* Terminal */
.terminal {
  margin-top: 28px;
  border: 1px solid var(--rule);
  border-radius: 0;
  background: #0a0a0a;
  color: #e8e8e8;
  font-family: 'JetBrains Mono', 'SF Mono', Menlo, Consolas, monospace;
  font-size: 13.5px;
  line-height: 1.55;
  overflow: hidden;
}
.terminal__bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 9px 14px;
  background: #141414;
  border-bottom: 1px solid #232323;
}
.terminal__title {
  color: #8b93a3;
  font-size: 12px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.terminal__title::before {
  content: '$ ';
  color: #ff7a2f;
}
.terminal__ctrls {
  color: #5b6671;
  font-size: 13px;
  letter-spacing: 0.28em;
  user-select: none;
}
.terminal__body {
  margin: 0;
  padding: 16px 18px 18px;
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 480px;
  overflow-y: auto;
  font-family: inherit;
}
.terminal__line {
  display: inline;
}
.terminal__line--prompt {
  color: #ff7a2f;
}
.terminal__line--dim {
  color: #6a6a6a;
}
.terminal__line--ok {
  color: #7ddc8a;
}
.terminal__line--warn {
  color: #ffcc66;
}
.terminal__line--fail {
  color: #ff7a85;
}
@keyframes terminal-cursor {
  0%,
  50% {
    opacity: 1;
  }
  51%,
  100% {
    opacity: 0;
  }
}
.terminal__body::after {
  content: '▌';
  color: var(--accent);
  animation: terminal-cursor 1s steps(2) infinite;
  margin-left: 2px;
}

/* Footer — single-row status bar */
.site-footer {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 50;
  background: var(--bg);
  border-top: 1px solid var(--rule);
  font-family: 'JetBrains Mono', monospace;
  color: var(--muted);
}
body {
  padding-bottom: 52px;
}
.site-footer .wrap {
  max-width: none;
  padding: 10px 32px;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 18px;
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.site-footer__center {
  display: flex;
  justify-content: center;
}
.site-footer__center a {
  font-family: 'JetBrains Mono', monospace;
  font-weight: 700;
  letter-spacing: 0.14em;
  color: var(--ink);
  text-decoration: none;
  transition: color 0.12s;
}
.site-footer__center a:hover {
  color: var(--accent);
}
.site-footer__right {
  justify-content: flex-end;
}
/* Dev-only Tools pill — injected by portfolio.js when on localhost. */
.dev-pill {
  position: fixed;
  right: 18px;
  bottom: 60px;
  z-index: 60;
  padding: 7px 14px;
  background: var(--bg);
  border: 1px solid var(--accent);
  color: var(--accent);
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  text-decoration: none;
  transition:
    background 0.15s,
    color 0.15s;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.18);
}
.dev-pill::before {
  content: '/ ';
  opacity: 0.55;
}
.dev-pill:hover {
  background: var(--accent);
  color: var(--bg);
}
@media (max-width: 760px) {
  /* Mobile footer collapses to a stacked layout (~96px tall vs 52px on
     desktop). Bump body padding-bottom so the last paragraph of any
     page isn't hidden under the fixed footer. */
  body {
    padding-bottom: 96px;
  }
  .site-footer .wrap {
    grid-template-columns: 1fr;
    text-align: center;
    gap: 8px;
  }
  .site-footer__right {
    justify-content: center;
    flex-wrap: wrap;
  }
}
.site-footer__id {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--muted);
  white-space: nowrap;
}
.site-footer__id .status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
  display: inline-block;
  box-shadow: 0 0 8px var(--accent);
  animation: status-pulse 1.8s ease-in-out infinite;
}
@keyframes status-pulse {
  0%,
  100% {
    opacity: 1;
    transform: scale(1);
  }
  50% {
    opacity: 0.45;
    transform: scale(0.85);
  }
}
.site-footer__right {
  display: flex;
  align-items: center;
  gap: 18px;
}
.theme-toggle {
  background: none;
  border: 0;
  /* Padding + negative margin keeps the visual size at 18×18 while giving
     a 30×30 tap target. WCAG 2.5.5 / 2.2 AA wants ≥24×24. */
  padding: 6px;
  margin: -6px;
  cursor: pointer;
  color: var(--muted);
  display: inline-flex;
  width: 30px;
  height: 30px;
  transition: color 0.15s;
}
.theme-toggle:hover {
  color: var(--accent);
}
.theme-toggle svg {
  width: 18px;
  height: 18px;
}
[data-theme='light'] .theme-toggle .icon-sun,
[data-theme='dark'] .theme-toggle .icon-moon {
  display: none;
}

@media (max-width: 600px) {
  main.wrap {
    padding-top: 44px;
  }
  h1 {
    font-size: 36px;
  }
  .lede {
    font-size: 16px;
  }
}

/* Respect users who prefer reduced motion. Disable infinite background
   animations site-wide (status-pulse, terminal-cursor). Per-page
   animations like home-loc-pulse are already gated locally. */
@media (prefers-reduced-motion: reduce) {
  .site-footer__id .status-dot,
  .terminal__body::after {
    animation: none;
  }
}

/* ------------------------------------------------------------------ */
/* Brutalist page hero — shared across /about/, /work/, /projects/,    */
/* /contact/. (/index.html has its own split-grid `.home-hero`.)       */
/*                                                                     */
/* Pattern: eyebrow `>` prompt → two-line H1 (second line in accent    */
/* with hanging indent) → optional lede → optional bordered chip.      */
/* ------------------------------------------------------------------ */
.page-hero {
  padding: 72px 32px 48px;
  max-width: none;
  font-family: 'JetBrains Mono', monospace;
}
.page-hero__pre {
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 26px;
  line-height: 1;
}
.page-hero__pre::before {
  content: '> ';
  color: var(--accent);
}
.page-hero__title {
  margin: 0 0 28px;
  font-weight: 700;
  font-size: var(--hero-size);
  line-height: 0.9;
  letter-spacing: -0.04em;
  text-transform: uppercase;
  color: var(--ink);
}
.page-hero__title span {
  display: block;
}
.page-hero__title span:nth-child(2) {
  color: var(--accent);
  padding-left: 0.4em;
}
.page-hero__sub {
  font-size: 17px;
  line-height: 1.5;
  max-width: 56ch;
  margin: 0;
  color: var(--ink);
}
.page-hero__honest {
  display: inline-block;
  margin-top: 18px;
  padding: 8px 14px;
  border: 1px solid var(--ink);
  font-size: 12px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
}

/* Narrow lede + relative positioning — used on /contact/. */
.page-hero--narrow {
  position: relative;
}
.page-hero--narrow .page-hero__sub {
  max-width: 50ch;
}

@media (max-width: 700px) {
  .page-hero {
    padding: 52px 22px 36px;
  }
}
