/* ==========================================================
   Matías Manríquez — Portafolio
   Palette: sage paper, navy ink, petrol green, rack-LED amber.
   Signature: the stack "strata" — seven layers from UI to metal.
   ========================================================== */

:root {
  --paper: #edefea;
  --paper-2: #e3e6e0;
  --surface: #f8f9f6;
  --ink: #14202b;
  --muted: #56626c;
  --line: #c9cfca;
  --accent: #0b6b5d;
  --accent-soft: #d3e7e0;
  --accent-ink: #ffffff;
  --signal: #d98e04;
  --danger: #c2410c;
  --grid-dot: rgba(20, 32, 43, .13);

  /* strata: surface (UI) to depth (hardware) */
  --s1: #dde2dc;
  --s2: #ccd3ce;
  --s3: #b4bdbd;
  --s4: #96a2a8;
  --s5: #6f7d88;
  --s6: #4f5d6a;
  --s7: #333f4c;
  --s8: #1b2530;
  --s-text-light: var(--ink);
  --s-text-deep: #eef1ec;

  /* contact band + footer */
  --band: #14202b;
  --band-2: #1b2836;
  --band-ink: #eef1ec;
  --band-muted: #9aa7b2;
  --band-line: #2c3a48;
  --band-accent: #7fd1bd;

  --f-display: "Source Serif 4", Georgia, "Times New Roman", serif;
  --f-body: "Public Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --f-mono: "IBM Plex Mono", ui-monospace, "Cascadia Mono", Consolas, monospace;

  --wrap: 1180px;
  --gutter: clamp(16px, 4vw, 40px);
  --radius: 4px;
  --ease: cubic-bezier(.2, .7, .2, 1);
  --shadow: 0 1px 0 rgba(20, 32, 43, .04), 0 12px 32px -12px rgba(20, 32, 43, .22);

  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #0e141c;
    --paper-2: #131b25;
    --surface: #1a2330;
    --ink: #e3e7e1;
    --muted: #94a0aa;
    --line: #26313d;
    --accent: #5cc4aa;
    --accent-soft: #123a33;
    --accent-ink: #07211c;
    --signal: #f2b441;
    --danger: #fb923c;
    --grid-dot: rgba(227, 231, 225, .09);
    --s1: #3b4b5d;
    --s2: #354456;
    --s3: #2f3d4e;
    --s4: #293646;
    --s5: #232f3e;
    --s6: #1e2835;
    --s7: #19212d;
    --s8: #141b25;
    --s-text-light: #eef1ec;
    --s-text-deep: #e3e7e1;
    --band: #121c24;
    --band-2: #18242e;
    --band-ink: #eef1ec;
    --band-muted: #9aa8b1;
    --band-line: #273540;
    --band-accent: #7fd1bd;
    --shadow: 0 1px 0 rgba(0, 0, 0, .3), 0 14px 36px -14px rgba(0, 0, 0, .7);
    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --paper: #0e141c;
  --paper-2: #131b25;
  --surface: #1a2330;
  --ink: #e3e7e1;
  --muted: #94a0aa;
  --line: #26313d;
  --accent: #5cc4aa;
  --accent-soft: #123a33;
  --accent-ink: #07211c;
  --signal: #f2b441;
  --danger: #fb923c;
  --grid-dot: rgba(227, 231, 225, .09);
  --s1: #3b4b5d;
  --s2: #354456;
  --s3: #2f3d4e;
  --s4: #293646;
  --s5: #232f3e;
  --s6: #1e2835;
  --s7: #19212d;
  --s8: #141b25;
  --s-text-light: #eef1ec;
  --s-text-deep: #e3e7e1;
  --band: #121c24;
  --band-2: #18242e;
  --band-ink: #eef1ec;
  --band-muted: #9aa8b1;
  --band-line: #273540;
  --band-accent: #7fd1bd;
  --shadow: 0 1px 0 rgba(0, 0, 0, .3), 0 14px 36px -14px rgba(0, 0, 0, .7);
  color-scheme: dark;
}

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

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

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--f-body);
  font-size: 1.0625rem;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  transition: background-color .3s var(--ease), color .3s var(--ease);
}

img { max-width: 100%; display: block; }
a { color: inherit; }
h1, h2, h3, h4, p, ol, ul, dl, dd, figure { margin: 0; }
ol, ul { padding: 0; list-style: none; }

.mono { font-family: var(--f-mono); font-size: .78rem; letter-spacing: 0; }

.wrap {
  width: 100%;
  max-width: calc(var(--wrap) + var(--gutter) * 2);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.icon { width: 1.1em; height: 1.1em; flex: none; }

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

::selection { background: var(--accent); color: var(--accent-ink); }

.skip-link {
  position: absolute;
  left: 16px;
  top: -60px;
  z-index: 100;
  padding: .6rem 1rem;
  background: var(--ink);
  color: var(--paper);
  text-decoration: none;
  border-radius: var(--radius);
}
.skip-link:focus { top: 12px; }

.eyebrow {
  display: flex;
  align-items: flex-start;
  gap: .75rem;
  color: var(--muted);
  text-transform: lowercase;
  margin-bottom: 1.25rem;
}
.eyebrow::before {
  flex: none;
  margin-top: .7em;
  content: "";
  width: 1.5rem;
  height: 1px;
  background: currentColor;
  opacity: .6;
}

.led {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--signal);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--signal) 22%, transparent);
  animation: blink 2.4s steps(2, jump-none) infinite;
}
@keyframes blink { 50% { opacity: .35; } }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: .6rem;
  padding: .9rem 1.4rem;
  border-radius: var(--radius);
  font: 600 .975rem/1 var(--f-body);
  text-decoration: none;
  cursor: pointer;
  border: 1px solid transparent;
  transition: background-size .45s var(--ease), color .3s var(--ease), border-color .3s var(--ease), transform .2s var(--ease);
}
.btn .icon { transition: transform .3s var(--ease); }
.btn:hover .icon { transform: translateX(4px); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .6; cursor: progress; }

/* color fills in from the left instead of switching */
.btn-solid {
  color: var(--paper);
  background: linear-gradient(var(--accent), var(--accent)) left / 0% 100% no-repeat, var(--ink);
}
.btn-solid:hover { color: var(--accent-ink); background-size: 100% 100%, auto; }

.btn-line {
  color: var(--ink);
  border-color: var(--ink);
  background: linear-gradient(var(--ink), var(--ink)) left / 0% 100% no-repeat;
}
.btn-line:hover { color: var(--paper); background-size: 100% 100%; }

.btn-bright {
  color: #07211c;
  background: linear-gradient(#ffffff, #ffffff) left / 0% 100% no-repeat, var(--band-accent);
}
.btn-bright:hover { background-size: 100% 100%, auto; }

/* ---------- Header ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: color-mix(in srgb, var(--paper) 86%, transparent);
  backdrop-filter: blur(14px) saturate(1.2);
  -webkit-backdrop-filter: blur(14px) saturate(1.2);
  border-bottom: 1px solid transparent;
  transition: border-color .3s var(--ease), background-color .3s var(--ease);
}
.site-header.scrolled { border-bottom-color: var(--line); }

/* reading progress */
.progress {
  position: absolute;
  left: 0;
  right: 0;
  bottom: -1px;
  height: 2px;
  background: var(--accent);
  transform: scaleX(var(--p, 0));
  transform-origin: left;
}

.header-row {
  display: flex;
  align-items: center;
  gap: 2rem;
  height: 72px;
}

.brand {
  display: flex;
  align-items: center;
  gap: .75rem;
  text-decoration: none;
  margin-right: auto;
  min-width: 0;
}
.brand-mark {
  display: grid;
  place-items: center;
  flex: none;
  width: 36px;
  height: 36px;
  border-radius: 4px;
  background: var(--ink);
  color: var(--paper);
  font-family: var(--f-display);
  font-style: italic;
  font-weight: 600;
  font-size: 1.3rem;
  line-height: 1;
  padding-bottom: 2px;
  transition: background-color .3s var(--ease), transform .4s var(--ease);
}
.brand:hover .brand-mark { background: var(--accent); transform: rotate(-6deg); }
.brand-text { display: grid; line-height: 1.15; min-width: 0; }
.brand-name {
  font-family: var(--f-display);
  font-weight: 600;
  font-size: 1.08rem;
  letter-spacing: -.01em;
  white-space: nowrap;
}
.brand-role { color: var(--muted); font-size: .68rem; }

.nav-list { display: flex; gap: 2rem; }
.nav-list a {
  position: relative;
  display: inline-block;
  padding: .4rem 0;
  text-decoration: none;
  font-size: .95rem;
  color: var(--muted);
  transition: color .25s var(--ease);
}
.nav-list a::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 1.5px;
  background: var(--accent);
  transform: scaleX(0);
  transform-origin: right;
  transition: transform .35s var(--ease);
}
.nav-list a:hover { color: var(--ink); }
.nav-list a:hover::after, .nav-list a.current::after { transform: scaleX(1); transform-origin: left; }
.nav-list a.current { color: var(--ink); }
.nav-sheet-foot { display: none; }

.header-tools { display: flex; align-items: center; gap: .6rem; }

/* language + theme as one segmented control */
.seg {
  display: inline-flex;
  border: 1px solid var(--line);
  border-radius: 4px;
  overflow: hidden;
  transition: border-color .25s var(--ease);
}
.seg:hover { border-color: color-mix(in srgb, var(--ink) 35%, var(--line)); }
.seg-btn {
  display: grid;
  place-items: center;
  min-width: 38px;
  height: 36px;
  padding: 0 .55rem;
  border: 0;
  background: transparent;
  color: var(--ink);
  cursor: pointer;
  font-size: .72rem;
  transition: background-color .25s var(--ease), color .25s var(--ease);
}
.seg-btn + .seg-btn { border-left: 1px solid var(--line); }
.seg-btn:hover { background: var(--paper-2); color: var(--accent); }
#theme-toggle .icon { transition: transform .45s var(--ease); }
#theme-toggle:hover .icon { transform: rotate(-25deg); }

.btn-sm { padding: .62rem 1rem; font-size: .88rem; }

.icon-sun { display: none; }
:root[data-theme="dark"] .icon-sun { display: block; }
:root[data-theme="dark"] .icon-moon { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .icon-sun { display: block; }
  :root:not([data-theme="light"]) .icon-moon { display: none; }
}

.menu-btn {
  display: none;
  place-items: center;
  width: 40px;
  height: 38px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: transparent;
  color: var(--ink);
  cursor: pointer;
}
.burger { position: relative; display: block; width: 18px; height: 8px; }
.burger i {
  position: absolute;
  left: 0;
  width: 100%;
  height: 1.5px;
  border-radius: 1px;
  background: currentColor;
  transition: transform .4s var(--ease), top .3s var(--ease);
}
.burger i:first-child { top: 0; }
.burger i:last-child { top: 6.5px; }
.menu-btn[aria-expanded="true"] .burger i:first-child { top: 3.25px; transform: rotate(45deg); }
.menu-btn[aria-expanded="true"] .burger i:last-child { top: 3.25px; transform: rotate(-45deg); }

/* full-screen sheet on tablets and phones */
@media (max-width: 900px) {
  .menu-btn { display: grid; }
  .nav-cta { display: none; }
  .header-row { gap: 1rem; height: 64px; }

  .nav {
    position: fixed;
    top: 64px;
    left: 0;
    right: 0;
    height: calc(100dvh - 64px);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 1.5rem var(--gutter) 2rem;
    background: var(--paper);
    border-top: 1px solid var(--line);
    overflow-y: auto;
    visibility: hidden;
    opacity: 0;
    transform: translateY(-8px);
    transition: opacity .35s var(--ease), transform .4s var(--ease), visibility 0s linear .4s;
  }
  .nav.open {
    visibility: visible;
    opacity: 1;
    transform: none;
    transition: opacity .35s var(--ease), transform .4s var(--ease), visibility 0s;
  }
  .nav-list { flex-direction: column; gap: 0; }
  .nav-list li {
    border-bottom: 1px solid var(--line);
    opacity: 0;
    transform: translateY(10px);
    transition: opacity .4s var(--ease), transform .45s var(--ease);
  }
  .nav.open .nav-list li { opacity: 1; transform: none; }
  .nav.open .nav-list li:nth-child(2) { transition-delay: .05s; }
  .nav.open .nav-list li:nth-child(3) { transition-delay: .1s; }
  .nav.open .nav-list li:nth-child(4) { transition-delay: .15s; }
  .nav-list a {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.1rem 0;
    font-family: var(--f-display);
    font-size: clamp(1.7rem, 7vw, 2.3rem);
    letter-spacing: -.02em;
    color: var(--ink);
  }
  .nav-list a::after {
    content: "→";
    position: static;
    height: auto;
    background: none;
    font-family: var(--f-body);
    font-size: 1.1rem;
    color: var(--accent);
    transform: translateX(-6px);
    opacity: .5;
    transition: transform .3s var(--ease), opacity .3s var(--ease);
  }
  .nav-list a:hover::after, .nav-list a.current::after { transform: none; opacity: 1; }
  .nav-sheet-foot { display: grid; gap: 1.25rem; padding-top: 2rem; }
  .nav-sheet-foot .btn { justify-content: center; padding: 1rem; }
  .nav-sheet-foot p { color: var(--muted); text-align: center; }
  .nav-sheet-foot p a { text-decoration: none; color: var(--ink); }
  body.menu-open { overflow: hidden; }
}

@media (max-width: 380px) {
  .brand-role { display: none; }
  .brand-mark { width: 32px; height: 32px; font-size: 1.15rem; }
}

/* ---------- Hero ---------- */
.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr);
  gap: clamp(2.5rem, 6vw, 6rem);
  align-items: center;
  padding-top: clamp(3rem, 8vw, 6.5rem);
  padding-bottom: clamp(4rem, 9vw, 7.5rem);
}

.hero-title {
  font-family: var(--f-display);
  font-weight: 600;
  font-size: clamp(3.2rem, 7.6vw, 6.4rem);
  line-height: .95;
  letter-spacing: -.025em;
  margin-bottom: 1.75rem;
}
.hero-title .dot { color: var(--accent); }
.hero-title em { font-style: italic; font-weight: 500; }

.hero-lede {
  max-width: 34rem;
  font-size: clamp(1.05rem, 1.4vw, 1.2rem);
  color: var(--muted);
  margin-bottom: 2.25rem;
}

.hero-actions { display: flex; flex-wrap: wrap; gap: .75rem; margin-bottom: 3rem; }

.hero-facts {
  display: grid;
  gap: .9rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--line);
  max-width: 34rem;
}
.hero-facts div { display: grid; grid-template-columns: 4.5rem 1fr; gap: 1rem; align-items: baseline; }
.hero-facts dt { color: var(--muted); }
.hero-facts dd { font-size: .95rem; }

/* ---------- Strata (signature) ---------- */
.strata { position: relative; width: 100%; }
/* blueprint dot grid behind the cross-section */
.strata::before {
  content: "";
  position: absolute;
  inset: -2.5rem -2rem -2.5rem -1rem;
  z-index: -1;
  background-image: radial-gradient(var(--grid-dot) 1px, transparent 1.2px);
  background-size: 16px 16px;
  -webkit-mask-image: radial-gradient(ellipse at center, #000 45%, transparent 75%);
  mask-image: radial-gradient(ellipse at center, #000 45%, transparent 75%);
}

.strata-head, .strata-foot {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  color: var(--muted);
  padding: 0 0 .6rem 2.25rem;
}
.strata-foot { padding: .6rem 0 0 2.25rem; }
.strata-hint { font-size: .75rem; }

.strata-body {
  position: relative;
  display: grid;
  grid-template-columns: 2.25rem 1fr;
}

.spine { position: relative; }
.spine::before {
  content: "";
  position: absolute;
  left: 50%;
  top: -1.6rem;
  bottom: -1.6rem;
  width: 1px;
  background: var(--line);
}
.packet {
  position: absolute;
  left: 50%;
  top: 0;
  width: 9px;
  height: 9px;
  margin-left: -4.5px;
  border-radius: 50%;
  background: var(--signal);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--signal) 22%, transparent);
  animation: packet 7s cubic-bezier(.45, 0, .55, 1) infinite;
}
@keyframes packet {
  0%   { top: 0%; opacity: 0; }
  6%   { opacity: 1; }
  46%  { top: calc(100% - 9px); opacity: 1; }
  54%  { top: calc(100% - 9px); opacity: 1; }
  94%  { opacity: 1; }
  100% { top: 0%; opacity: 0; }
}

.layers { display: grid; gap: 3px; }

.layer {
  --bg: var(--s1);
  --fg: var(--s-text-light);
  position: relative;
  display: grid;
  grid-template-columns: 7.5rem 1fr;
  gap: 1rem;
  align-items: baseline;
  padding: .9rem 1.25rem;
  background: var(--bg);
  color: var(--fg);
  border-radius: 2px;
  transition: background-color .3s var(--ease), color .3s var(--ease), transform .35s var(--ease), opacity .35s var(--ease);
}
.layer:nth-child(1) { --bg: var(--s1); }
.layer:nth-child(2) { --bg: var(--s2); margin-left: 1.75%; }
.layer:nth-child(3) { --bg: var(--s3); margin-left: 3.5%; }
.layer:nth-child(4) { --bg: var(--s4); margin-left: 5.25%; }
.layer:nth-child(5) { --bg: var(--s5); --fg: var(--s-text-deep); margin-left: 7%; }
.layer:nth-child(6) { --bg: var(--s6); --fg: var(--s-text-deep); margin-left: 8.75%; }
.layer:nth-child(7) { --bg: var(--s7); --fg: var(--s-text-deep); margin-left: 10.5%; }
.layer:nth-child(8) { --bg: var(--s8); --fg: var(--s-text-deep); margin-left: 12.25%; }

.layer-name {
  font-family: var(--f-display);
  font-weight: 600;
  font-size: 1rem;
  letter-spacing: -.005em;
}
.layer-tools {
  font-family: var(--f-mono);
  font-size: .78rem;
  opacity: .82;
  transition: opacity .3s var(--ease);
}

.layer:hover {
  --bg: var(--accent);
  --fg: var(--accent-ink);
  transform: translateX(-6px);
}
.layer:hover .layer-tools { opacity: 1; }
.layers:hover .layer:not(:hover) { opacity: .55; }

/* ---------- Mini strata (per project) ---------- */
.minis {
  display: inline-grid;
  grid-template-rows: repeat(8, 4px);
  gap: 2px;
  width: 22px;
  flex: none;
}
.minis i {
  display: block;
  border-radius: 1px;
  box-shadow: inset 0 0 0 1px var(--line);
  transition: background-color .3s var(--ease), box-shadow .3s var(--ease), transform .3s var(--ease);
}
.minis i:nth-child(2) { transition-delay: .03s; }
.minis i:nth-child(3) { transition-delay: .06s; }
.minis i:nth-child(4) { transition-delay: .09s; }
.minis i:nth-child(5) { transition-delay: .12s; }
.minis i:nth-child(6) { transition-delay: .15s; }
.minis i:nth-child(7) { transition-delay: .18s; }
.minis i:nth-child(8) { transition-delay: .21s; }
.minis i.on { box-shadow: none; }
.minis i.on:nth-child(1) { background: var(--s1); box-shadow: inset 0 0 0 1px var(--s3); }
.minis i.on:nth-child(2) { background: var(--s2); }
.minis i.on:nth-child(3) { background: var(--s3); }
.minis i.on:nth-child(4) { background: var(--s4); }
.minis i.on:nth-child(5) { background: var(--s5); }
.minis i.on:nth-child(6) { background: var(--s6); }
.minis i.on:nth-child(7) { background: var(--s7); }
.minis i.on:nth-child(8) { background: var(--s8); }
:root[data-theme="dark"] .minis i.on { background: var(--accent); box-shadow: none; opacity: .85; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .minis i.on { background: var(--accent); box-shadow: none; opacity: .85; }
}
:is(.case:hover, .case.live) .minis i.on, .oss:hover .minis i.on { background: var(--accent); box-shadow: none; opacity: 1; transform: scaleX(1.25); }

/* ---------- Sections ---------- */
.section {
  padding-top: clamp(4.5rem, 10vw, 8rem);
  padding-bottom: clamp(1rem, 3vw, 2rem);
}

.section-head {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr);
  gap: 1.5rem clamp(2rem, 6vw, 5rem);
  align-items: end;
  padding-bottom: clamp(1.75rem, 3.5vw, 2.5rem);
  margin-bottom: clamp(2rem, 5vw, 3.5rem);
  border-bottom: 1px solid var(--ink);
}
.section-head h2, .about h2, .contact-title {
  font-family: var(--f-display);
  font-weight: 600;
  font-size: clamp(2rem, 4.2vw, 3.4rem);
  line-height: 1;
  letter-spacing: -.02em;
}
.section-lede { color: var(--muted); max-width: 30rem; }

.tags { display: flex; flex-wrap: wrap; gap: .35rem .9rem; color: var(--muted); }
.tags li { white-space: nowrap; transition: color .3s var(--ease); }

/* ---------- Cases (institutional work) ---------- */
.cases { display: grid; gap: clamp(3.5rem, 8vw, 6.5rem); }

.case {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.08fr);
  gap: clamp(2rem, 6vw, 5.5rem);
  align-items: center;
}
.case:nth-child(even) .case-text { order: 2; }

.case-kicker { color: var(--accent); margin-bottom: .9rem; }
.case h3 {
  font-family: var(--f-display);
  font-weight: 600;
  font-size: clamp(1.6rem, 2.8vw, 2.25rem);
  letter-spacing: -.015em;
  line-height: 1.08;
  margin-bottom: 1rem;
  transition: color .3s var(--ease);
}
.case-text > p:not(.case-kicker) { color: var(--muted); max-width: 32rem; }
.case-meta {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1.5rem;
  margin-top: 1.75rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--line);
  max-width: 32rem;
}
:is(.case:hover, .case.live) h3 { color: var(--accent); }
:is(.case:hover, .case.live) .tags li { color: var(--ink); }

.legend {
  display: flex;
  align-items: center;
  gap: .75rem;
  color: var(--muted);
  margin-top: clamp(3rem, 6vw, 4.5rem);
  font-size: .75rem;
}

/* ---------- Artifacts (case illustrations) ---------- */
.artifact {
  position: relative;
  min-height: 340px;
  padding: clamp(1.5rem, 3.5vw, 2.5rem);
  border: 1px solid var(--line);
  border-radius: 6px;
  background-color: var(--paper-2);
  background-image: radial-gradient(var(--grid-dot) 1px, transparent 1.2px);
  background-size: 16px 16px;
  overflow: hidden;
  display: grid;
  place-items: center;
  transition: border-color .4s var(--ease), transform .5s var(--ease);
}
:is(.case:hover, .case.live) .artifact { border-color: color-mix(in srgb, var(--accent) 45%, var(--line)); transform: translateY(-4px); }

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 6px;
  box-shadow: var(--shadow);
}

/* A1 · signed document */
.art-sign { grid-template-columns: minmax(0, 1fr); grid-template-rows: 1fr auto auto; gap: 1rem; }
.doc {
  position: relative;
  width: min(280px, 82%);
  padding: 1.4rem 1.4rem 2.6rem;
  display: grid;
  gap: .55rem;
  transform: rotate(-2.5deg);
  transition: transform .6s var(--ease);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 4px;
  box-shadow: var(--shadow);
}
:is(.case:hover, .case.live) .doc { transform: rotate(0); }
.doc-name { color: var(--muted); font-size: .7rem; margin-bottom: .35rem; }
.ln { display: block; height: 6px; border-radius: 3px; background: var(--line); }
.w90 { width: 90%; } .w85 { width: 85%; } .w80 { width: 80%; } .w70 { width: 70%; } .w60 { width: 60%; } .w50 { width: 50%; }

.seal {
  position: absolute;
  right: -1.4rem;
  bottom: -1.4rem;
  width: 104px;
  height: 104px;
  border-radius: 50%;
  display: grid;
  place-content: center;
  text-align: center;
  color: var(--accent);
  border: 2px solid var(--accent);
  background: color-mix(in srgb, var(--accent) 8%, var(--surface));
  transform: rotate(-14deg);
  transition: transform .5s cubic-bezier(.3, 1.6, .5, 1), opacity .4s var(--ease);
}
.seal-ring {
  position: absolute;
  inset: 6px;
  border-radius: 50%;
  border: 1px dashed currentColor;
  opacity: .7;
}
.seal-text {
  font-family: var(--f-display);
  font-weight: 700;
  font-size: .9rem;
  text-transform: uppercase;
  letter-spacing: .06em;
}
.seal-sub { font-size: .6rem; opacity: .85; }
:is(.case:hover, .case.live) .seal { animation: stamp .55s var(--ease); }
@keyframes stamp {
  0%   { transform: rotate(-14deg) scale(1); }
  35%  { transform: rotate(-8deg) scale(1.22); opacity: .6; }
  70%  { transform: rotate(-15deg) scale(.94); opacity: 1; }
  100% { transform: rotate(-14deg) scale(1); }
}

.otp { display: flex; gap: .35rem; }
.otp span {
  display: grid;
  place-items: center;
  width: 30px;
  height: 36px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--surface);
  font-size: .95rem;
  font-weight: 500;
  transition: border-color .3s var(--ease), color .3s var(--ease);
}
:is(.case:hover, .case.live) .otp span { border-color: var(--accent); color: var(--accent); }
.otp span:nth-child(2) { transition-delay: .04s; }
.otp span:nth-child(3) { transition-delay: .08s; }
.otp span:nth-child(4) { transition-delay: .12s; }
.otp span:nth-child(5) { transition-delay: .16s; }
.otp span:nth-child(6) { transition-delay: .2s; }
.token { color: var(--muted); font-size: .72rem; width: 100%; text-align: center; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.token span { opacity: .55; }

/* A2 · request tracker inside a container */
.container-box {
  position: relative;
  width: min(380px, 100%);
  padding: 1.6rem 1.1rem 1.1rem;
  border: 1.5px dashed color-mix(in srgb, var(--muted) 60%, transparent);
  border-radius: 8px;
  display: grid;
  gap: .9rem;
}
.container-label {
  position: absolute;
  top: -.7rem;
  left: 1rem;
  padding: 0 .5rem;
  background: var(--paper-2);
  color: var(--muted);
  font-size: .7rem;
}
.req {
  padding: 1.1rem 1.2rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 6px;
  box-shadow: var(--shadow);
}
.req-head { display: flex; justify-content: space-between; align-items: center; gap: .75rem; margin-bottom: 1rem; }
.req-id { font-weight: 500; color: var(--ink); }
.req-badge {
  font-size: .68rem;
  padding: .2rem .55rem;
  border-radius: 99px;
  color: var(--accent);
  background: var(--accent-soft);
}
.steps { display: grid; gap: .1rem; }
.steps li {
  position: relative;
  padding: .3rem 0 .3rem 1.6rem;
  font-size: .9rem;
  color: var(--muted);
}
.steps li::before {
  content: "";
  position: absolute;
  left: 0;
  top: .62rem;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  border: 1.5px solid var(--line);
  background: var(--surface);
  z-index: 1;
  transition: background-color .3s var(--ease), border-color .3s var(--ease), box-shadow .3s var(--ease);
}
.steps li:not(:last-child)::after {
  content: "";
  position: absolute;
  left: 5px;
  top: 1.05rem;
  bottom: -.6rem;
  width: 1px;
  background: var(--line);
}
.steps li.done { color: var(--ink); }
.steps li.done::before { background: var(--ink); border-color: var(--ink); }
.steps li.now { color: var(--accent); font-weight: 600; }
.steps li.now::before { border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
:is(.case:hover, .case.live) .steps li.now::before { background: var(--accent); }
.dbs { display: grid; grid-template-columns: 1fr 1fr; gap: .6rem; }
.dbs > span {
  display: grid;
  gap: .15rem;
  padding: .65rem .75rem;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  color: var(--muted);
  font-size: .68rem;
  transition: transform .4s var(--ease);
}
.dbs b { color: var(--ink); font-weight: 500; font-size: .78rem; }
:is(.case:hover, .case.live) .dbs > span:first-child { transform: translateY(-3px); }
:is(.case:hover, .case.live) .dbs > span:last-child { transform: translateY(-3px); transition-delay: .06s; }

/* A3 · ticket routing */
.art-route {
  grid-template-columns: minmax(0, 1.1fr) minmax(48px, .5fr) minmax(0, .9fr);
  place-items: center stretch;
  gap: 0;
}
.ticket {
  display: grid;
  gap: .2rem;
  padding: 1rem 1.1rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-left: 3px solid var(--signal);
  border-radius: 6px;
  box-shadow: var(--shadow);
}
.ticket-id { color: var(--muted); font-size: .7rem; }
.ticket-type { font-weight: 600; }
.ticket-sub { color: var(--muted); font-size: .85rem; line-height: 1.35; }
.routes { width: 100%; height: 180px; overflow: visible; }
.routes path {
  fill: none;
  stroke: var(--line);
  stroke-width: 1.5;
  vector-effect: non-scaling-stroke;
}
.routes path.hot {
  stroke: var(--accent);
  stroke-dasharray: 6 5;
  animation: flow 1.6s linear infinite;
  animation-play-state: paused;
}
:is(.case:hover, .case.live) .routes path.hot { animation-play-state: running; }
@keyframes flow { to { stroke-dashoffset: -22; } }
.depts { display: grid; gap: 0; height: 180px; align-content: space-between; }
.depts li {
  padding: .5rem .8rem;
  border: 1px solid var(--line);
  border-radius: 99px;
  background: var(--surface);
  font-size: .85rem;
  color: var(--muted);
  text-align: center;
  transition: background-color .35s var(--ease), color .35s var(--ease), border-color .35s var(--ease), transform .35s var(--ease);
}
.depts li.hot { color: var(--accent); border-color: var(--accent); }
:is(.case:hover, .case.live) .depts li.hot { background: var(--accent); color: var(--accent-ink); transform: translateX(4px); }

/* A4 · audit log */
.art-audit { place-items: stretch; align-content: center; gap: 1rem; }
.log {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 6px;
  box-shadow: var(--shadow);
  overflow: hidden;
  font-size: .74rem;
}
.log li {
  display: grid;
  grid-template-columns: auto auto minmax(0, 1fr) auto;
  gap: 1rem;
  padding: .7rem 1rem;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  transition: background-color .3s var(--ease), transform .4s var(--ease);
}
.log li:last-child { border-bottom: 0; }
.log .op { color: var(--ink); font-weight: 500; min-width: 3.6rem; }
.log .op.del { color: var(--danger); }
.log .obj { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.log .h { opacity: .7; }
.log li.new { background: var(--accent-soft); color: var(--ink); }
.log li.new .op { color: var(--accent); }
:is(.case:hover, .case.live) .log li { transform: translateY(-2px); }
:is(.case:hover, .case.live) .log li.new { background: color-mix(in srgb, var(--accent) 22%, var(--surface)); }
.chain { display: flex; align-items: center; gap: .6rem; color: var(--muted); font-size: .74rem; }

/* A5 · automation flow: trigger → n8n → RAG → agent */
.art-flow { place-items: center; }
.flow {
  position: relative;
  display: grid;
  gap: 22px;
  width: min(330px, 100%);
}
.fnode {
  position: relative;
  display: grid;
  gap: .15rem;
  padding: .75rem 1rem .8rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-left: 3px solid var(--line);
  border-radius: 6px;
  box-shadow: var(--shadow);
  transition: border-color .35s var(--ease), transform .4s var(--ease);
}
.fnode:not(:last-child)::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -23px;
  width: 1px;
  height: 22px;
  background: var(--line);
}
.fk { color: var(--muted); font-size: .66rem; text-transform: uppercase; letter-spacing: .06em; }
.ft { font-weight: 600; font-size: .92rem; }
.fnode.trig { border-left-color: var(--signal); }
.fnode.rag { border-left-color: var(--accent); }
.fnode.out { border-left-color: var(--ink); }
.chunks { display: flex; flex-wrap: wrap; gap: .3rem; margin-top: .45rem; }
.chunks i {
  font-style: normal;
  font-size: .64rem;
  padding: .15rem .45rem;
  border-radius: 3px;
  background: var(--accent-soft);
  color: var(--accent);
  transition: transform .35s var(--ease);
}
.flow-packet {
  position: absolute;
  left: 50%;
  top: 0;
  z-index: 2;
  width: 9px;
  height: 9px;
  margin-left: -4.5px;
  border-radius: 50%;
  background: var(--signal);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--signal) 22%, transparent);
  opacity: 0;
}
:is(.case:hover, .case.live) .flow-packet { animation: flow-down 2.4s var(--ease) infinite; }
@keyframes flow-down {
  0% { top: 0; opacity: 0; }
  10% { opacity: 1; }
  90% { opacity: 1; }
  100% { top: calc(100% - 9px); opacity: 0; }
}
:is(.case:hover, .case.live) .fnode.rag { border-color: var(--accent); }
:is(.case:hover, .case.live) .chunks i:nth-child(1) { transform: translateY(-2px); }
:is(.case:hover, .case.live) .chunks i:nth-child(2) { transform: translateY(-2px); transition-delay: .06s; }
:is(.case:hover, .case.live) .chunks i:nth-child(3) { transform: translateY(-2px); transition-delay: .12s; }

/* ---------- Timeline (procurement → build → training) ---------- */
.timeline {
  position: relative;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: clamp(1.5rem, 3vw, 2.5rem);
}
.timeline::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 5px;
  height: 1px;
  background: linear-gradient(90deg, var(--ink) 0 50%, var(--line) 50% 100%);
  background-size: 100% 1px;
}
.phase { position: relative; padding-top: 2.25rem; }
.phase::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: var(--paper);
  border: 1.5px solid var(--ink);
  transition: background-color .3s var(--ease), transform .3s var(--ease), border-color .3s var(--ease);
}
.phase-when { color: var(--muted); font-size: .72rem; margin-bottom: .75rem; }
.phase h3 {
  font-family: var(--f-display);
  font-weight: 600;
  font-size: clamp(1.2rem, 1.8vw, 1.45rem);
  letter-spacing: -.02em;
  line-height: 1.12;
  margin-bottom: .6rem;
  transition: color .3s var(--ease), transform .35s var(--ease);
}
.phase > p:last-child { color: var(--muted); font-size: .97rem; }
.phase:hover::before { background: var(--accent); border-color: var(--accent); transform: scale(1.35); }
.phase:hover h3 { color: var(--accent); transform: translateX(3px); }

.phase-build h3 { color: var(--muted); }
.phase-build::before { border-style: dashed; }
.phase-build .phase-when { color: var(--accent); }

/* cross-cutting block under the timeline */
.crosscut {
  display: grid;
  grid-template-columns: minmax(0, 13rem) minmax(0, 1fr) auto;
  gap: 1rem clamp(1.5rem, 4vw, 3rem);
  align-items: baseline;
  margin-top: clamp(2.5rem, 5vw, 3.5rem);
  padding: 1.6rem clamp(1.25rem, 3vw, 2rem);
  border: 1px solid var(--line);
  border-left: 3px solid var(--accent);
  border-radius: 4px;
  background: var(--paper-2);
  transition: border-color .3s var(--ease), background-color .3s var(--ease);
}
.crosscut .phase-when { margin: 0; color: var(--accent); }
.crosscut h3 {
  font-family: var(--f-display);
  font-weight: 600;
  font-size: clamp(1.2rem, 1.8vw, 1.45rem);
  letter-spacing: -.015em;
  line-height: 1.15;
  margin-bottom: .45rem;
  transition: color .3s var(--ease);
}
.crosscut-body p { color: var(--muted); font-size: .97rem; max-width: 44rem; }
.crosscut .tags { flex-direction: column; gap: .3rem; }
.crosscut:hover { border-color: var(--accent); }
.crosscut:hover h3 { color: var(--accent); }
.crosscut:hover .tags li { color: var(--ink); }

@media (max-width: 960px) {
  .crosscut { grid-template-columns: 1fr; }
  .crosscut .tags { flex-direction: row; }
}

/* ---------- Career ---------- */
.career {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr);
  gap: clamp(2.5rem, 6vw, 5.5rem);
}
.career-label {
  color: var(--muted);
  font-weight: 400;
  font-size: .7rem;
  text-transform: uppercase;
  letter-spacing: .08em;
  margin-bottom: 1.25rem;
}
.career-col > .career-label:not(:first-child) { margin-top: 2.75rem; }

.jobs { position: relative; display: grid; gap: 0; }
.job {
  position: relative;
  display: grid;
  grid-template-columns: 10.5rem minmax(0, 1fr);
  align-items: start;
  gap: 1.5rem;
  padding: 1.5rem 0;
  border-top: 1px solid var(--line);
}
.job:last-child { border-bottom: 1px solid var(--line); }
.job-date { display: inline-flex; align-items: center; gap: .5rem; color: var(--muted); padding-top: .25rem; white-space: nowrap; }
.job h4, .edu-item h4 {
  font-family: var(--f-display);
  font-weight: 600;
  font-size: clamp(1.15rem, 1.7vw, 1.35rem);
  letter-spacing: -.015em;
  line-height: 1.2;
  transition: color .3s var(--ease);
}
.job-org { color: var(--accent); font-weight: 600; font-size: .92rem; margin: .2rem 0 .6rem; }
.job-desc { color: var(--muted); font-size: .95rem; max-width: 36rem; }
.job .tags { margin-top: .9rem; font-size: .72rem; }
.job.is-current .job-date { color: var(--ink); }
.job:hover h4, .edu-item:hover h4 { color: var(--accent); }

.edu { display: grid; gap: 0; }
.edu-item { padding: 1.25rem 0; border-top: 1px solid var(--line); }
.edu-item:last-child { border-bottom: 1px solid var(--line); }
.edu-item .job-date { padding: 0 0 .35rem; }
.edu-item .job-org { margin-bottom: 0; }
.award {
  display: inline-flex;
  align-items: center;
  gap: .45rem;
  margin-top: .75rem;
  padding: .35rem .75rem .35rem .6rem;
  border-radius: 99px;
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 600;
  font-size: .85rem;
}

.certs { display: grid; }
.certs li {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
  padding: .75rem 0;
  border-bottom: 1px solid var(--line);
  font-size: .95rem;
  transition: padding .3s var(--ease);
}
.certs li:first-child { border-top: 1px solid var(--line); }
.certs li .mono { color: var(--muted); font-size: .7rem; white-space: nowrap; }
.certs li:hover { padding-left: .4rem; }
.langs { color: var(--muted); margin-top: 1.5rem; }

@media (max-width: 960px) {
  .career { grid-template-columns: 1fr; }
}
@media (max-width: 560px) {
  .job { grid-template-columns: 1fr; gap: .5rem; }
  .certs li { flex-direction: column; gap: .15rem; }
}

/* ---------- Open source ---------- */
.oss-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 320px), 1fr));
  gap: 1px;
  background: var(--line);
  border: 1px solid var(--line);
}
.oss {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: .7rem;
  padding: 1.75rem 1.6rem 1.6rem;
  background: var(--paper);
  transition: background-color .3s var(--ease);
}
.oss:hover { background: var(--paper-2); }
.oss .minis { position: absolute; top: 1.85rem; right: 1.6rem; }
.oss h3 {
  font-family: var(--f-display);
  font-weight: 600;
  font-size: 1.2rem;
  letter-spacing: -.01em;
  padding-right: 2.5rem;
}
.oss h3 a { text-decoration: none; transition: color .3s var(--ease); }
.oss h3 a::after { content: ""; position: absolute; inset: 0; }
.oss:hover h3 a { color: var(--accent); }
.oss p { color: var(--muted); font-size: .97rem; flex: 1; }
.oss .tags { font-size: .75rem; }
.oss:hover .tags li { color: var(--ink); }
.oss::after {
  content: "↗";
  position: absolute;
  right: 1.5rem;
  bottom: 1.3rem;
  font-family: var(--f-mono);
  color: var(--accent);
  opacity: 0;
  transform: translate(-6px, 6px);
  transition: opacity .3s var(--ease), transform .35s var(--ease);
}
.oss:hover::after, .oss:focus-within::after { opacity: 1; transform: none; }

/* GitHub activity */
.activity { margin-top: clamp(2.5rem, 5vw, 3.5rem); }
.activity-title {
  display: flex;
  align-items: center;
  gap: .6rem;
  color: var(--muted);
  font-weight: 400;
  margin-bottom: .75rem;
}
.activity-list { border-top: 1px solid var(--line); }
.activity-list li {
  display: grid;
  grid-template-columns: minmax(10rem, 16rem) minmax(0, 1fr) auto;
  gap: 1.5rem;
  align-items: baseline;
  padding: .85rem 0;
  border-bottom: 1px solid var(--line);
  transition: background-color .3s var(--ease), padding .35s var(--ease);
}
.activity-list li:not(.activity-empty):hover { background: var(--paper-2); padding-left: .75rem; padding-right: .75rem; }
.activity-list a { font-weight: 600; text-decoration: none; overflow-wrap: anywhere; }
.activity-list a:hover { color: var(--accent); }
.activity-list .desc { color: var(--muted); font-size: .95rem; }
.activity-list .meta { color: var(--muted); white-space: nowrap; }
.activity-list li.activity-empty { display: block; color: var(--muted); }

/* ---------- About ---------- */
.about {
  display: grid;
  grid-template-columns: minmax(0, .8fr) minmax(0, 1.2fr);
  gap: clamp(2.5rem, 7vw, 6.5rem);
  align-items: center;
  padding-bottom: clamp(4.5rem, 10vw, 8rem);
}
/* credential card with the GitHub avatar (monogram shows if it fails to load) */
.credential {
  position: relative;
  max-width: 440px;
  width: 100%;
  padding: 1.5rem 1.6rem 1.4rem 1.85rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: var(--shadow);
  overflow: hidden;
  transform: rotate(-1.5deg);
  transition: transform .6s var(--ease), box-shadow .6s var(--ease);
}
.credential::before {
  /* faint security pattern plus an accent edge */
  content: "";
  position: absolute;
  inset: 0;
  background:
    repeating-radial-gradient(circle at 110% -10%, transparent 0 10px, color-mix(in srgb, var(--accent) 7%, transparent) 10px 11px),
    linear-gradient(90deg, var(--accent) 0 4px, transparent 4px);
  pointer-events: none;
}
.credential:hover { transform: rotate(0) translateY(-4px); }
.credential > * { position: relative; }

.cred-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: var(--accent);
  font-size: .68rem;
  text-transform: uppercase;
  letter-spacing: .08em;
  padding-bottom: 1rem;
  margin-bottom: 1.25rem;
  border-bottom: 1px dashed var(--line);
}
.cred-top .minis { grid-template-rows: none; grid-template-columns: repeat(8, 5px); gap: 2px; width: auto; }
.cred-top .minis i { height: 12px; }

.cred-id { display: grid; grid-template-columns: 104px 1fr; gap: 1.25rem; align-items: end; }
.cred-photo {
  position: relative;
  aspect-ratio: 4 / 5;
  border-radius: 6px;
  background: var(--ink);
  overflow: hidden;
  display: grid;
  place-items: center;
}
.cred-mono {
  font-family: var(--f-display);
  font-style: italic;
  font-weight: 500;
  font-size: 2.6rem;
  letter-spacing: -.04em;
  color: var(--paper);
}
.cred-photo img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 50% 30%;
  filter: grayscale(1) contrast(1.08);
  transition: filter .6s var(--ease), transform .6s var(--ease);
}
.credential:hover .cred-photo img { filter: none; transform: scale(1.04); }
.cred-first, .cred-last {
  font-family: var(--f-display);
  font-weight: 600;
  font-size: clamp(1.35rem, 2.2vw, 1.6rem);
  line-height: 1.05;
  letter-spacing: -.02em;
}
.cred-last { font-style: italic; font-weight: 500; }
.cred-role { color: var(--muted); font-size: .7rem; margin-top: .6rem; }

.cred-data { display: grid; gap: .55rem; margin: 1.4rem 0 1.25rem; }
.cred-data div { display: grid; grid-template-columns: 5.25rem 1fr; gap: .75rem; align-items: baseline; }
.cred-data dt { color: var(--muted); font-size: .68rem; text-transform: uppercase; letter-spacing: .06em; }
.cred-data dd { font-size: .9rem; }

.cred-foot {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  padding-top: 1rem;
  border-top: 1px solid var(--line);
}
.cred-sign {
  font-family: var(--f-display);
  font-style: italic;
  font-size: 1.35rem;
  color: var(--accent);
  letter-spacing: -.01em;
  transform: rotate(-4deg);
  transform-origin: left bottom;
}
.cred-seal {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  padding: .3rem .6rem;
  border: 1px solid var(--accent);
  border-radius: 99px;
  color: var(--accent);
  font-size: .66rem;
  text-transform: uppercase;
  letter-spacing: .06em;
  transition: background-color .3s var(--ease), color .3s var(--ease);
}
.credential:hover .cred-seal { background: var(--accent); color: var(--accent-ink); }

/* working principles */
.principles {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1.25rem;
  margin-top: 2rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--line);
}
.principles li { padding-left: .9rem; border-left: 2px solid var(--accent); }
.principles h3 {
  font-family: var(--f-display);
  font-weight: 600;
  font-size: 1.1rem;
  letter-spacing: -.01em;
  margin-bottom: .25rem;
}
.principles p { color: var(--muted); font-size: .88rem; line-height: 1.45; }

.about h2 { margin-bottom: 1.5rem; }
.about-lead {
  font-family: var(--f-display);
  font-weight: 500;
  font-size: clamp(1.2rem, 2vw, 1.5rem);
  line-height: 1.35;
  letter-spacing: -.01em;
  margin-bottom: 1.25rem;
  max-width: 36rem;
}
.about-text > p:not(.about-lead):not(.eyebrow) { color: var(--muted); max-width: 34rem; }

.about-links { display: flex; gap: 1.75rem; margin-top: 2rem; }
.about-links a {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  text-decoration: none;
  font-weight: 600;
  padding-bottom: 3px;
  background: linear-gradient(var(--accent), var(--accent)) left bottom / 0 1px no-repeat,
              linear-gradient(var(--line), var(--line)) left bottom / 100% 1px no-repeat;
  transition: color .25s var(--ease), background-size .4s var(--ease);
}
.about-links a:hover { color: var(--accent); background-size: 100% 1px, 100% 1px; }
.link-btn {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  padding: 0 0 3px;
  border: 0;
  background: linear-gradient(var(--accent), var(--accent)) left bottom / 0 1px no-repeat,
              linear-gradient(var(--line), var(--line)) left bottom / 100% 1px no-repeat;
  color: inherit;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  transition: color .25s var(--ease), background-size .4s var(--ease);
}
.link-btn:hover { color: var(--accent); background-size: 100% 1px, 100% 1px; }
.about-links { flex-wrap: wrap; }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.about-links a .icon { transition: transform .35s var(--ease); }
.about-links a:hover .icon { transform: rotate(-8deg) scale(1.12); }

/* ---------- Contact band ---------- */
.band {
  background: var(--band);
  color: var(--band-ink);
  --muted: var(--band-muted);
  --line: var(--band-line);
  --accent: var(--band-accent);
}
.band .eyebrow { color: var(--band-muted); }

.contact {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr);
  gap: clamp(2.5rem, 7vw, 6rem);
  padding-top: clamp(4.5rem, 10vw, 7.5rem);
  padding-bottom: clamp(4rem, 9vw, 6.5rem);
}
.contact-title { font-size: clamp(2.1rem, 4.6vw, 3.6rem); margin-bottom: 1.5rem; }
.contact-note { color: var(--band-muted); }

.form { display: grid; gap: 1.25rem; align-content: start; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1.25rem; }
.field { display: grid; gap: .45rem; }
.field label { font-size: .85rem; font-weight: 600; color: var(--band-muted); }
.field input, .field textarea {
  width: 100%;
  padding: .85rem .95rem;
  font: inherit;
  font-size: 1rem;
  color: var(--band-ink);
  background: var(--band-2);
  border: 1px solid var(--band-line);
  border-radius: var(--radius);
  transition: border-color .25s var(--ease), box-shadow .25s var(--ease), background-color .25s var(--ease);
}
.field input:hover, .field textarea:hover { border-color: color-mix(in srgb, var(--band-accent) 40%, var(--band-line)); }
.field textarea { resize: vertical; min-height: 9rem; }
.field input:focus, .field textarea:focus {
  outline: none;
  border-color: var(--band-accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--band-accent) 22%, transparent);
}
.field input[aria-invalid="true"], .field textarea[aria-invalid="true"] { border-color: #fb923c; }

.form-foot { display: flex; flex-wrap: wrap; align-items: center; gap: 1rem; margin-top: .25rem; }
.form-status { color: var(--band-muted); }
.form-status.ok { color: var(--band-accent); }
.form-status.err { color: #fb923c; }

/* ---------- Footer ---------- */
.site-footer { padding: 0 0 1.75rem; }
.footer-main {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 1.25rem 2rem;
  padding: 2rem 0 1.5rem;
  border-top: 1px solid var(--band-line);
}
.footer-main .brand { margin: 0; flex: none; }
.footer-main .brand-mark { width: 30px; height: 30px; font-size: 1.05rem; background: var(--band-ink); color: var(--band); }
.footer-main .brand:hover .brand-mark { background: var(--band-accent); }
.footer-main .brand-name { font-size: .98rem; }

.footer-links { display: flex; flex-wrap: wrap; align-items: center; gap: .75rem 1.75rem; font-size: .92rem; }
.footer-links a {
  display: inline-flex;
  align-items: center;
  gap: .3rem;
  text-decoration: none;
  color: var(--band-ink);
  transition: color .25s var(--ease);
}
.footer-links a .icon { width: .85em; height: .85em; opacity: .55; transition: transform .3s var(--ease), opacity .3s var(--ease); }
.footer-links a:hover { color: var(--band-accent); }
.footer-links a:hover .icon { transform: translate(2px, -2px); opacity: 1; }
.footer-time { display: inline-flex; align-items: center; gap: .5rem; color: var(--band-muted); font-size: .74rem; white-space: nowrap; }

.footer-bottom {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem 2rem;
  padding-top: 1.25rem;
  border-top: 1px solid color-mix(in srgb, var(--band-line) 60%, transparent);
  color: var(--band-muted);
  font-size: .7rem;
}
.footer-bottom > a { text-decoration: none; transition: color .2s var(--ease); }
.footer-bottom > a:hover { color: var(--band-ink); }

/* terminal tucked into the bottom bar */
.term summary {
  cursor: pointer;
  list-style: none;
  display: inline-flex;
  gap: .4rem;
  color: var(--band-muted);
  transition: color .2s var(--ease);
}
.term summary::-webkit-details-marker { display: none; }
.term summary:hover { color: var(--band-ink); }
.term[open] { flex-basis: 100%; order: 3; }
.prompt { color: var(--signal); }

.term-window {
  margin-top: 1rem;
  background: #0a0f15;
  color: #d7dcd6;
  border: 1px solid var(--band-line);
  border-radius: var(--radius);
  padding: 1.1rem 1.25rem;
  font-size: .8rem;
}
.term-out { max-height: 280px; overflow-y: auto; line-height: 1.65; }
.term-out p, .term-out pre { margin: 0 0 .15rem; white-space: pre-wrap; font: inherit; }
.term-out b { color: #7fd1bd; font-weight: 500; }
.term-out a { color: #7fd1bd; }
.term-out .err { color: #fb923c; }
.term-in { display: flex; gap: .6rem; align-items: center; margin-top: .4rem; }
.term-in input {
  flex: 1;
  min-width: 0;
  background: transparent;
  border: 0;
  color: inherit;
  font: inherit;
  caret-color: #f2b441;
}
.term-in input:focus { outline: none; }

@media (max-width: 560px) {
  .footer-main { flex-direction: column; align-items: flex-start; }
  .footer-bottom { flex-direction: column; gap: .75rem; }
}

/* ---------- Strata as a filter ---------- */
.layer { cursor: pointer; }
.layer.is-active {
  --bg: var(--accent);
  --fg: var(--accent-ink);
  transform: translateX(-6px);
}
.layer.is-active .layer-tools { opacity: 1; }
.layer.is-active::after {
  content: "";
  position: absolute;
  right: 1rem;
  top: 50%;
  width: 7px;
  height: 7px;
  margin-top: -3.5px;
  border-radius: 50%;
  background: currentColor;
}
.layers.has-active .layer:not(.is-active):not(:hover) { opacity: .5; }

.case, .oss { transition: opacity .45s var(--ease), filter .45s var(--ease), background-color .3s var(--ease); }
.case.dim, .oss.dim { opacity: .28; filter: grayscale(1); }
.case.match .minis i.on, .oss.match .minis i.on { background: var(--accent); box-shadow: none; opacity: 1; }
.case.match .case-kicker::before {
  content: "";
  display: inline-block;
  width: 6px;
  height: 6px;
  margin-right: .5rem;
  border-radius: 50%;
  background: var(--accent);
  vertical-align: middle;
}
.oss.match { background: var(--paper-2); }

.layer-pill {
  position: fixed;
  left: 50%;
  bottom: max(20px, env(safe-area-inset-bottom));
  z-index: 60;
  display: flex;
  align-items: center;
  gap: .75rem;
  max-width: calc(100vw - 32px);
  padding: .55rem .6rem .55rem 1rem;
  background: var(--ink);
  color: var(--paper);
  border-radius: 99px;
  box-shadow: 0 12px 32px -10px rgba(0, 0, 0, .45);
  font-size: .9rem;
  opacity: 0;
  transform: translate(-50%, 16px);
  transition: opacity .35s var(--ease), transform .45s var(--ease);
}
.layer-pill.show { opacity: 1; transform: translate(-50%, 0); }
.layer-pill[hidden] { display: none; }
.layer-pill b { font-weight: 600; }
.layer-pill #layer-pill-text { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.layer-pill-dot { flex: none; width: 8px; height: 8px; border-radius: 50%; background: var(--signal); }
.layer-pill button {
  flex: none;
  padding: .45rem .85rem;
  border: 1px solid color-mix(in srgb, var(--paper) 30%, transparent);
  border-radius: 99px;
  background: transparent;
  color: inherit;
  font: inherit;
  font-size: .82rem;
  cursor: pointer;
  transition: background-color .25s var(--ease), color .25s var(--ease);
}
.layer-pill button:hover { background: var(--paper); color: var(--ink); }

/* ---------- Motion ---------- */
.js .reveal {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity .8s var(--ease), transform .8s var(--ease);
}
.js .reveal.in { opacity: 1; transform: none; }

.js .hero-copy > *, .js .layer { animation: rise .8s var(--ease) backwards; }
.js .hero-copy > :nth-child(2) { animation-delay: .06s; }
.js .hero-copy > :nth-child(3) { animation-delay: .12s; }
.js .hero-copy > :nth-child(4) { animation-delay: .18s; }
.js .hero-copy > :nth-child(5) { animation-delay: .24s; }
.js .layer:nth-child(1) { animation-delay: .20s; }
.js .layer:nth-child(2) { animation-delay: .26s; }
.js .layer:nth-child(3) { animation-delay: .32s; }
.js .layer:nth-child(4) { animation-delay: .38s; }
.js .layer:nth-child(5) { animation-delay: .44s; }
.js .layer:nth-child(6) { animation-delay: .50s; }
.js .layer:nth-child(7) { animation-delay: .56s; }
.js .layer:nth-child(8) { animation-delay: .62s; }
@keyframes rise { from { opacity: 0; transform: translateY(12px); } }

@media (hover: none) {
  .layers:hover .layer:not(:hover) { opacity: 1; }
  :is(.case:hover, .case.live) .artifact { transform: none; }
}

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

/* ---------- Responsive ---------- */
@media (max-width: 960px) {
  .hero { grid-template-columns: 1fr; }
  .strata { max-width: 620px; }
  .section-head { grid-template-columns: 1fr; }
  .case { grid-template-columns: 1fr; }
  .case:nth-child(even) .case-text { order: 0; }
  .timeline { grid-template-columns: repeat(2, minmax(0, 1fr)); row-gap: 3rem; }
  .timeline::before { display: none; }
  .phase { border-top: 1px solid var(--line); }
  .phase::before { top: -6px; }
  .about { grid-template-columns: 1fr; }
  .credential { max-width: 420px; transform: none; }
  .principles { grid-template-columns: 1fr; gap: 1rem; }
  .contact { grid-template-columns: 1fr; }
}

@media (max-width: 760px) {
  .hero { padding-top: 2.5rem; }
  .hero-title { font-size: clamp(3.1rem, 14vw, 4.2rem); }
  .eyebrow { font-size: .7rem; }
  .eyebrow::before { display: none; }
  .hero-actions .btn { flex: 1; justify-content: center; }
  .section-head h2, .about h2 { font-size: clamp(1.9rem, 8.5vw, 2.4rem); }
  .case h3 { font-size: 1.55rem; }
  .case-meta { gap: 1rem; }

  .layer { grid-template-columns: 1fr; gap: .2rem; padding: .8rem 1rem; }
  .layer:nth-child(n) { margin-left: 0; }
  .strata-body { grid-template-columns: 1.5rem 1fr; }
  .strata-head, .strata-foot { padding-left: 1.5rem; }
  .strata::before { inset: -1.5rem 0; }

  .artifact { min-height: 0; padding: 1.75rem 1.25rem; }
  .art-route { grid-template-columns: 1fr; gap: .75rem; }
  .routes { display: none; }
  .depts { height: auto; grid-template-columns: repeat(3, 1fr); gap: .4rem; }
  .depts li { padding: .45rem .3rem; font-size: .78rem; }
  .log li { grid-template-columns: auto auto minmax(0, 1fr); gap: .75rem; }
  .log .h { display: none; }

  .timeline { grid-template-columns: 1fr; }
  .field-row { grid-template-columns: 1fr; }

  .activity-list li { grid-template-columns: 1fr auto; gap: .25rem 1rem; }
  .activity-list .desc { grid-column: 1 / -1; grid-row: 2; }
}

@media (max-width: 420px) {
  .hero-facts div { grid-template-columns: 1fr; gap: .1rem; }
  .strata-hint { display: none; }
  .seal { width: 88px; height: 88px; right: -.8rem; }
  .otp span { width: 26px; height: 32px; }
}

/* ---------- Print: the page doubles as a one-file CV ---------- */
@media print {
  @page { margin: 14mm 16mm; }
  :root:not([data-print]) {
    --paper: #ffffff;
    --paper-2: #f4f5f3;
    --surface: #ffffff;
    --ink: #111111;
    --muted: #444444;
    --line: #cccccc;
    --accent: #0b6b5d;
    --accent-ink: #ffffff;
    --band: #ffffff;
    --band-2: #ffffff;
    --band-ink: #111111;
    --band-muted: #444444;
    --band-line: #cccccc;
    --band-accent: #0b6b5d;
    color-scheme: light;
  }
  body { font-size: 10.5pt; background: #fff; }
  .site-header, .skip-link, .strata, .artifact, .legend, .activity, .form, .term,
  .layer-pill, .hero-actions, .menu-btn, .contact-note, .footer-bottom, .footer-time, .link-btn,
  .credential, .minis, .about-links a[download] { display: none !important; }
  *, *::before, *::after { animation: none !important; transition: none !important; box-shadow: none !important; }
  .js .reveal { opacity: 1 !important; transform: none !important; }
  .case.dim, .oss.dim { opacity: 1; filter: none; }

  .hero { display: block; padding-top: 0; padding-bottom: 6mm; }
  .hero-title { font-size: 30pt; margin-bottom: 4mm; }
  .section { padding-top: 7mm; padding-bottom: 0; }
  .section-head { display: block; padding-bottom: 3mm; margin-bottom: 5mm; }
  .section-head h2, .about h2, .contact-title { font-size: 18pt; }
  .section-lede { margin-top: 2mm; }

  .cases { gap: 5mm; }
  .case { display: block; break-inside: avoid; }
  .case h3 { font-size: 13pt; margin-bottom: 1.5mm; }
  .case-meta { margin-top: 2mm; padding-top: 2mm; }
  .timeline { grid-template-columns: repeat(2, 1fr); gap: 5mm; }
  .timeline::before { display: none; }
  .phase { break-inside: avoid; }
  .crosscut { break-inside: avoid; background: #fff; }
  .oss-grid { grid-template-columns: repeat(2, 1fr); }
  .oss { break-inside: avoid; padding: 4mm; }
  .oss::after { display: none; }

  .about { display: block; break-inside: avoid; padding-bottom: 4mm; }
  .career { grid-template-columns: 1fr; gap: 4mm; }
  #open-source, .site-footer { display: none !important; }
  .job { grid-template-columns: 34mm 1fr; gap: 4mm; padding: 3mm 0; break-inside: avoid; }
  .career-col > .career-label:not(:first-child) { margin-top: 5mm; }
  .edu-item, .certs { break-inside: avoid; }
  .credential { transform: none; }
  .band .contact { display: block; padding-top: 6mm; padding-bottom: 0; }
  .contact-title { margin-bottom: 2mm; }
  .footer-main { padding: 4mm 0 2mm; }

  .footer-links a::after {
    content: " · " attr(href);
    font-family: var(--f-mono);
    font-size: 7.5pt;
    color: #555;
  }
}
