/* Layout: left-aligned 72rem column; the hero pairs the name with a live access matrix,
   and the matrix's small squares return as the list marker everywhere a skill or tool is "granted". */
:root {
  --paper: #E7EDF0; --surface: #F5F8F9; --ink: #0B2A33; --muted: #48626C; --line: #BFCCD2;
  --risk: #BE1E5A; --clear: #0B7F69;
  --band: #0B2A33; --band-ink: #E7EDF0; --band-muted: #A3BAC1; --band-line: #2A4E59;
  --focus: var(--ink);
  --display: "Bricolage Grotesque", "Arial Narrow", system-ui, sans-serif;
  --body: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --code: "IBM Plex Mono", ui-monospace, Menlo, Consolas, monospace;
  --ease: cubic-bezier(.2, .8, .2, 1);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #07212A; --surface: #0D2E38; --ink: #E3EDEF; --muted: #9BB3BA; --line: #235058;
    --risk: #FF7AA5; --clear: #55D3B7;
    --band: #0D2E38; --band-ink: #E3EDEF; --band-muted: #9BB3BA; --band-line: #235058;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --paper: #07212A; --surface: #0D2E38; --ink: #E3EDEF; --muted: #9BB3BA; --line: #235058;
  --risk: #FF7AA5; --clear: #55D3B7;
  --band: #0D2E38; --band-ink: #E3EDEF; --band-muted: #9BB3BA; --band-line: #235058;
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-padding-top: 5rem; }
body {
  margin: 0; background: var(--paper); color: var(--ink);
  font: 400 1.0625rem/1.6 var(--body);
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, p, ul, dl, dd, figure { margin: 0; }
ul { padding: 0; list-style: none; }
a { color: inherit; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 3px; border-radius: 2px; }

.wrap {
  width: 100%; max-width: 75rem; margin-inline: auto;
  padding-left: max(1.25rem, env(safe-area-inset-left, 0px));
  padding-right: max(1.25rem, env(safe-area-inset-right, 0px));
}
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.skip-link { position: absolute; left: 1rem; top: -4rem; z-index: 30; background: var(--ink); color: var(--paper); padding: .5rem 1rem; }
.skip-link:focus { top: 1rem; }

h2 {
  font: 650 clamp(2rem, 4.6vw, 3.5rem)/1.02 var(--display);
  font-stretch: 82%; letter-spacing: -.02em; text-wrap: balance; max-width: 20ch;
}
h3 { font: 600 1.3rem/1.2 var(--display); letter-spacing: -.01em; text-wrap: balance; }
section { padding-block: clamp(4rem, 9vw, 7.5rem); border-top: 1px solid var(--line); }
.section-desc { color: var(--muted); max-width: 58ch; margin-top: 1rem; }

/* Buttons */
.btn {
  display: inline-block; padding: .8rem 1.4rem; border: 1.5px solid var(--ink); border-radius: 4px;
  font: 500 1rem/1.2 var(--body); text-decoration: none; cursor: pointer;
  background: transparent; color: var(--ink);
  transition: background .2s, color .2s, transform .2s var(--ease);
}
.btn:hover { transform: translateY(-2px); }
.btn:active { transform: translateY(0); }
.btn-primary, .btn-outline:hover, .btn-small:hover { background: var(--ink); color: var(--paper); }
.btn-primary:hover { background: var(--clear); border-color: var(--clear); }
.btn-small { padding: .5rem .9rem; font-size: .9rem; flex: none; }
.btn[disabled] { opacity: .5; cursor: default; transform: none; }

/* Scroll progress */
.progress { display: none; }
@supports (animation-timeline: scroll()) {
  .progress {
    display: block; position: fixed; inset: 0 0 auto 0; height: 3px; z-index: 25;
    background: var(--clear); transform-origin: 0 50%;
    animation: grow-x linear both; animation-timeline: scroll(root);
  }
}
@keyframes grow-x { from { transform: scaleX(0); } to { transform: scaleX(1); } }

/* Nav */
.nav {
  position: sticky; top: env(safe-area-inset-top, 0px); z-index: 20;
  background: color-mix(in srgb, var(--paper) 88%, transparent);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.nav-inner { display: flex; align-items: center; gap: 1.5rem; min-height: 3.75rem; }
.nav-logo { font: 800 1.35rem/1 var(--display); text-decoration: none; letter-spacing: -.04em; }
.nav-links { display: flex; gap: 1.4rem; margin-right: auto; min-width: 0; overflow-x: auto; scrollbar-width: none; }
.nav-links a {
  text-decoration: none; font-size: .95rem; color: var(--muted); white-space: nowrap;
  padding-block: .4rem; background: linear-gradient(var(--clear), var(--clear)) 0 100% / 0 2px no-repeat;
  transition: background-size .3s var(--ease), color .2s;
}
.nav-links a:hover, .nav-links a.active { color: var(--ink); background-size: 100% 2px; }
.tcode { position: relative; flex: none; }
.tcode input {
  width: 11.5rem; padding: .4rem .65rem; border: 1px solid var(--line); border-radius: 4px;
  background: var(--surface); color: var(--ink); font: 400 .82rem/1.3 var(--code);
}
.tcode input::placeholder { color: var(--muted); }
.tcode.bad input { border-color: var(--risk); animation: shake .3s; }
.tcode-msg {
  position: absolute; top: calc(100% + .4rem); right: 0; white-space: nowrap;
  font-size: .8rem; color: var(--risk); background: var(--surface); padding: .25rem .6rem; border-radius: 4px;
}
.tcode-msg:empty { display: none; }
@keyframes shake { 25% { transform: translateX(-4px); } 75% { transform: translateX(4px); } }
.theme-toggle {
  flex: none; border: 1px solid var(--line); border-radius: 4px; background: transparent; color: var(--ink);
  font: 500 .85rem/1.3 var(--body); padding: .4rem .7rem; cursor: pointer;
}
.theme-toggle:hover { border-color: var(--ink); }

/* Hero */
.hero { padding-block: clamp(2.5rem, 6vw, 5rem) 0; }
.hero-grid { display: grid; grid-template-columns: 1.1fr .9fr; gap: clamp(2rem, 5vw, 4.5rem); align-items: center; }
.hero-grid > * { min-width: 0; }
h1 {
  font: 800 clamp(3.1rem, 7.2vw, 6rem)/.9 var(--display);
  font-stretch: 88%; letter-spacing: -.02em;
}
h1 .word { display: inline-block; white-space: nowrap; }
h1 .ch { display: inline-block; }
.hero-lede { font: 500 clamp(1.25rem, 2.1vw, 1.6rem)/1.3 var(--display); max-width: 26ch; margin-top: 1.75rem; text-wrap: balance; }
.hero-sub { color: var(--muted); max-width: 46ch; margin-top: 1rem; }
.hero-cta { display: flex; flex-wrap: wrap; gap: .75rem; margin-top: 2rem; }

/* SoD matrix */
.sod { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 1.25rem; }
.sod-head { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; }
.sod-head figcaption { font: 600 1.05rem/1.2 var(--display); }
.sod-count { font: 500 .85rem/1 var(--body); font-variant-numeric: tabular-nums; padding: .35rem .6rem; border-radius: 99px; background: var(--clear); color: var(--surface); transition: background .3s; white-space: nowrap; }
.sod-count.has-risk { background: var(--risk); }
.sod-scroll { overflow-x: auto; margin-top: .5rem; }
.sod-table { border-collapse: collapse; margin-inline: auto; }
.sod-table th { font: 400 .8rem/1.15 var(--body); color: var(--muted); }
.sod-table thead th { height: 6.6rem; vertical-align: bottom; padding-bottom: .4rem; }
.sod-table thead th span { writing-mode: vertical-rl; transform: rotate(180deg); white-space: nowrap; }
.sod-table tbody th { text-align: right; padding-right: .6rem; white-space: nowrap; }
.sod-table td { padding: 0; }
.cell {
  display: grid; place-items: center; width: 2.1rem; height: 2.1rem; padding: 0;
  border: 0; background: transparent; cursor: pointer; border-radius: 4px;
}
.cell::before {
  content: ""; width: .4rem; height: .4rem; border-radius: 1px; background: var(--line);
  transition: width .3s var(--ease), height .3s var(--ease), background .25s, border-radius .3s;
}
.cell:hover { background: color-mix(in srgb, var(--ink) 8%, transparent); }
.cell[aria-pressed="true"]::before { width: 1.25rem; height: 1.25rem; border-radius: 3px; background: var(--ink); }
.cell.conflict::before { background: var(--risk); animation: alarm 1.1s ease-in-out infinite; }
@keyframes alarm { 50% { transform: scale(.78) rotate(45deg); } }
.sod-status { margin-top: .6rem; min-height: 3.1em; font-size: .95rem; }
.sod-foot { display: flex; gap: .9rem; align-items: center; margin-top: .4rem; font-size: .8rem; line-height: 1.35; color: var(--muted); }

/* Stats */
.stats { display: grid; grid-template-columns: repeat(4, 1fr); margin-top: clamp(2.5rem, 6vw, 4.5rem); }
.stats > div { display: flex; flex-direction: column-reverse; gap: .2rem; padding: 1.25rem 1rem 1.5rem 0; border-top: 1px solid var(--line); }
.stats dd { font: 700 clamp(2rem, 4.4vw, 3.4rem)/1 var(--display); font-stretch: 80%; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.stats dt { color: var(--muted); font-size: .92rem; }

/* Marquee */
.marquee { overflow: hidden; border-top: 1px solid var(--line); padding-block: 1.1rem; }
.marquee-track { display: flex; width: max-content; animation: slide 45s linear infinite; }
.marquee:hover .marquee-track { animation-play-state: paused; }
.marquee-track li { font: 600 1.5rem/1 var(--display); font-stretch: 80%; white-space: nowrap; padding-inline: 1.4rem; display: flex; align-items: center; gap: 2.8rem; }
.marquee-track li::after { content: ""; width: .55rem; height: .55rem; border-radius: 2px; background: var(--clear); }
@keyframes slide { to { transform: translateX(-50%); } }

/* About */
.about-grid { display: grid; grid-template-columns: 1.25fr .75fr; gap: clamp(2rem, 6vw, 5rem); margin-top: 2.5rem; }
.about-grid > * { min-width: 0; }
.prose { display: grid; gap: 1.1rem; max-width: 64ch; align-content: start; }
.prose .facts { color: var(--muted); }
.domains > div { padding-block: 1.1rem; border-top: 1px solid var(--line); }
.domains dt { font: 600 1.15rem/1.2 var(--display); }
.domains dd { color: var(--muted); font-size: .95rem; margin-top: .3rem; }

/* Granted lists (skills, tools) */
.grants { display: flex; flex-wrap: wrap; gap: .55rem 1.5rem; }
.grants li { display: flex; align-items: center; gap: .5rem; font-weight: 500; }
.grants li::before { content: ""; flex: none; width: .55rem; height: .55rem; border-radius: 2px; background: var(--clear); transition: transform .25s var(--ease); }
.grants li:hover::before { transform: scale(1.5) rotate(45deg); }
.grants-small { gap: .35rem 1.1rem; font-size: .88rem; }
.grants-small li { font-weight: 400; color: var(--muted); }
.grants-small li::before { width: .4rem; height: .4rem; border-radius: 1px; }

.skill-rows { margin-top: 2.5rem; }
.skill-row { display: grid; grid-template-columns: 17rem 1fr; gap: 1rem 2rem; padding-block: 1.6rem; border-top: 1px solid var(--line); }

/* Experience as an SM37-style job overview */
.joblog { margin-top: 3rem; font-variant-numeric: tabular-nums; }
.joblog-head, .job-row { display: grid; grid-template-columns: 1fr 7.5rem 4.5rem 4.5rem 6.5rem; gap: .25rem 1.25rem; align-items: baseline; }
.joblog-head { padding-bottom: .6rem; border-bottom: 2px solid var(--ink); font-size: .88rem; color: var(--muted); }
.job { padding-block: 1.75rem 2.25rem; border-bottom: 1px solid var(--line); }
.job-row h3 { font-size: clamp(1.3rem, 2.4vw, 1.75rem); }
.status { display: inline-flex; align-items: center; gap: .45rem; font-weight: 500; color: var(--muted); }
.status::before { content: ""; width: .6rem; height: .6rem; border-radius: 2px; background: var(--muted); }
.status-active { color: var(--clear); }
.status-active::before { background: var(--clear); border-radius: 50%; animation: beat 1.6s ease-in-out infinite; }
@keyframes beat { 50% { transform: scale(.55); opacity: .5; } }
.job-body { display: grid; gap: .9rem; max-width: 52rem; margin-top: .9rem; }
.job-sub { color: var(--muted); }
.impact { display: flex; flex-wrap: wrap; gap: .5rem 2rem; padding: .9rem 1.1rem; background: var(--surface); border-left: 3px solid var(--clear); }
.impact strong { font: 700 1.25rem/1 var(--display); margin-right: .2rem; }
h4 { margin: .4rem 0 0; font: 600 .95rem/1.2 var(--body); color: var(--muted); }
.job-log { display: grid; gap: .5rem; margin: 0; padding: 0; list-style: none; }
.job-log li { padding-left: 1.3rem; position: relative; }
.job-log li::before { content: ""; position: absolute; left: 0; top: .55em; width: .5rem; height: .5rem; border-radius: 1px; background: var(--clear); }

/* Projects */
.projects { display: grid; gap: 1.25rem; margin-top: 1.25rem; }
.projects-featured { grid-template-columns: repeat(2, 1fr); margin-top: 2.5rem; }
.projects-more { grid-template-columns: repeat(3, 1fr); }
.project {
  position: relative; overflow: hidden; min-width: 0;
  display: flex; flex-direction: column; gap: .8rem; align-items: flex-start;
  padding: 1.6rem; background: var(--surface); border: 1px solid var(--line); border-radius: 8px;
  transition: border-color .25s, transform .3s var(--ease);
}
.project::before {
  content: ""; position: absolute; inset: 0; pointer-events: none; opacity: 0; transition: opacity .3s;
  background: radial-gradient(20rem circle at var(--mx, 50%) var(--my, 0%), color-mix(in srgb, var(--clear) 18%, transparent), transparent 70%);
}
.project:hover { border-color: var(--clear); transform: translateY(-3px); }
.project:hover::before { opacity: 1; }
.project > * { position: relative; }
.project-flag { font-size: .8rem; font-weight: 500; padding: .2rem .55rem; border: 1px solid var(--clear); color: var(--clear); border-radius: 99px; }
.project-impact { font-weight: 500; color: var(--clear); }
.projects-featured h3 { font-size: 1.6rem; }
.project .grants { margin-top: auto; padding-top: .4rem; }
.project-link { font-weight: 500; text-underline-offset: .25em; text-decoration-thickness: 1.5px; }
.project-link:hover { color: var(--clear); }

/* Contact */
.contact { background: var(--band); color: var(--band-ink); border-top: 0; --focus: var(--band-ink); }
.contact .section-desc { color: var(--band-muted); }
.contact-grid { display: grid; grid-template-columns: .85fr 1.15fr; gap: clamp(2rem, 6vw, 5rem); }
.contact-grid > * { min-width: 0; }
.contact-info { margin-top: 2rem; }
.contact-info > div { display: grid; grid-template-columns: 8rem 1fr; gap: 1rem; padding-block: .8rem; border-top: 1px solid var(--band-line); }
.contact-info dt { color: var(--band-muted); font-size: .92rem; }
.contact-info dd { overflow-wrap: anywhere; }
.contact-info a { text-underline-offset: .25em; }
.contact-form form { display: grid; gap: 1rem; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.form-group { display: grid; gap: .35rem; min-width: 0; }
.form-group label { font-size: .92rem; font-weight: 500; }
.contact-form input, .contact-form textarea {
  width: 100%; padding: .75rem .85rem; border: 1px solid var(--band-line); border-radius: 4px;
  background: color-mix(in srgb, var(--band-ink) 6%, transparent); color: var(--band-ink); font: inherit;
  transition: border-color .2s, background .2s;
}
.contact-form input::placeholder, .contact-form textarea::placeholder { color: var(--band-muted); }
.contact-form input:focus, .contact-form textarea:focus { border-color: var(--band-ink); background: color-mix(in srgb, var(--band-ink) 10%, transparent); }
.contact-form textarea { resize: vertical; }
.field-error { font-size: .8rem; color: #FF9DBB; }
.field-error:empty { display: none; }
.btn-send { justify-self: start; background: var(--band-ink); color: var(--band); border-color: var(--band-ink); }
.btn-send:disabled { opacity: .55; cursor: not-allowed; }
.form-note { font-size: .82rem; color: var(--band-muted); }
[data-fs-success] { display: none; margin-bottom: 1rem; padding: .85rem 1rem; border: 1px solid #55D3B7; border-radius: 4px; color: #9FE8D7; }
.form-error:not(:empty) { margin-bottom: 1rem; padding: .85rem 1rem; border: 1px solid #FF7AA5; border-radius: 4px; color: #FF9DBB; }

.footer { background: var(--band); color: var(--band-muted); font-size: .88rem; }
.footer .wrap { display: flex; flex-wrap: wrap; justify-content: space-between; gap: .5rem 2rem; padding-block: 1.5rem; border-top: 1px solid var(--band-line); }

/* Motion: everything is visible at rest; .in replays an entrance when a block scrolls into view */
@media (prefers-reduced-motion: no-preference) {
  html { scroll-behavior: smooth; }
  h1 .ch { animation: rise .7s var(--ease) both; animation-delay: calc(var(--i) * 35ms); }
  .hero-lede, .hero-sub, .hero-cta { animation: fade .7s var(--ease) both; animation-delay: .55s; }
  .sod { animation: fade .8s var(--ease) both; animation-delay: .35s; }
  h2.in { animation: wipe .9s var(--ease) both; }
  .in:not(h2) { animation: fade .7s var(--ease) both; }
  .in .grants li { animation: pop .45s var(--ease) both; animation-delay: calc(var(--i, 0) * 35ms); }
  .in .job-log li { animation: pop .5s var(--ease) both; animation-delay: calc(.25s + var(--i, 0) * 90ms); }
}
@keyframes rise { from { transform: translateY(105%) rotate(6deg); opacity: 0; } }
@keyframes fade { from { opacity: 0; transform: translateY(14px); } }
@keyframes wipe { from { clip-path: inset(0 100% 0 0); } to { clip-path: inset(0 0 0 0); } }
@keyframes pop { from { opacity: 0; transform: translateX(-8px); } }
@media (prefers-reduced-motion: reduce) {
  .marquee-track { animation: none; flex-wrap: wrap; width: auto; row-gap: 1rem; }
  .marquee-track li[data-dup] { display: none; }
  .cell.conflict::before { animation: none; }
  .progress { display: none; }
  .status-active::before { animation: none; }
}

@media (max-width: 60rem) {
  .hero-grid, .about-grid, .contact-grid { grid-template-columns: 1fr; }
  .projects-more { grid-template-columns: 1fr 1fr; }
  .skill-row { grid-template-columns: 1fr; }
  .tcode { display: none; }
}
@media (max-width: 40rem) {
  .stats { grid-template-columns: 1fr 1fr; }
  .projects-featured, .projects-more, .form-row { grid-template-columns: 1fr; }
  .nav-inner { gap: 1rem; }
  .nav-links { gap: 1.1rem; }
  .sod { padding: 1rem .75rem; }
  .cell { width: 1.9rem; height: 1.9rem; }
  .sod-foot { flex-direction: column; align-items: flex-start; }
  .contact-info > div { grid-template-columns: 1fr; gap: .1rem; }
  .joblog-head { display: none; }
  .joblog { border-top: 2px solid var(--ink); }
  .job-row { grid-template-columns: auto auto auto 1fr; font-size: .92rem; }
  .job-row h3 { grid-column: 1 / -1; }
  .job-row span:empty { display: none; }
}
