/* ==========================================================================
   Sherin Joseph Roy portfolio
   Dark technical / instrument theme
   ========================================================================== */

/* --- 1. Tokens ----------------------------------------------------------- */

:root {
  /* surfaces */
  --bg:       #08090B;
  --bg-1:     #0E1013;
  --bg-2:     #14171B;
  --bg-glass: rgba(8, 9, 11, .78);

  /* lines */
  --line:     #1F242A;
  --line-hi:  #2C333B;

  /* text */
  --fg:       #E6E8EA;
  --fg-dim:   #9AA3AD;
  --fg-mute:  #6B747E;

  /* accents */
  --cyan:     #00E5C7;
  --amber:    #FFB020;
  --red:      #FF6B6B;
  --blue:     #7AA2FF;
  --violet:   #B98CFF;

  /* category colours */
  --c-av:     var(--cyan);
  --c-cv:     var(--blue);
  --c-re:     var(--amber);
  --c-safety: var(--red);
  --c-agents: var(--violet);

  --grid-line: rgba(230, 232, 234, .028);
  --sel-bg:   rgba(0, 229, 199, .22);

  --font-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --font-sans: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;

  --r:  4px;
  --r-lg: 6px;
  --gutter: clamp(1.25rem, 4vw, 3.5rem);
  --maxw: 1240px;
  --ease: cubic-bezier(.22, .61, .36, 1);
}

:root[data-theme="light"] {
  --bg:       #FAFAF8;
  --bg-1:     #FFFFFF;
  --bg-2:     #F2F2EF;
  --bg-glass: rgba(250, 250, 248, .82);

  --line:     #E1E2DE;
  --line-hi:  #C8CAC4;

  --fg:       #111316;
  --fg-dim:   #52585F;
  --fg-mute:  #7C838B;

  --cyan:     #00857A;
  --amber:    #A96A00;
  --red:      #C63A3A;
  --blue:     #2C55C4;
  --violet:   #7040C0;

  --grid-line: rgba(17, 19, 22, .035);
  --sel-bg:   rgba(0, 133, 122, .18);
}

/* --- 2. Reset ------------------------------------------------------------ */

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

* { margin: 0; }

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

body {
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.65;
  font-synthesis-weight: none;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

/* the instrument frame: a faint grid behind everything */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background-image:
    repeating-linear-gradient(to right,  var(--grid-line) 0 1px, transparent 1px 88px),
    repeating-linear-gradient(to bottom, var(--grid-line) 0 1px, transparent 1px 88px);
}

img, svg, video { display: block; max-width: 100%; }

a { color: inherit; text-decoration: none; }

button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }

::selection { background: var(--sel-bg); color: var(--fg); }

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

h1, h2, h3, h4 { font-weight: 600; line-height: 1.12; letter-spacing: -.022em; }

/* --- 3. Primitives ------------------------------------------------------- */

.wrap {
  width: 100%;
  max-width: var(--maxw);
  margin-inline: auto;
  padding-inline: var(--gutter);
  position: relative;
  z-index: 1;
}

.mono {
  font-family: var(--font-mono);
  font-size: .6875rem;
  letter-spacing: .1em;
  text-transform: uppercase;
}

.dim  { color: var(--fg-dim); }
.mute { color: var(--fg-mute); }

.rule { height: 1px; background: var(--line); border: 0; }

.section { padding-block: clamp(4rem, 9vw, 7.5rem); position: relative; }
.section + .section { border-top: 1px solid var(--line); }

.sec-head {
  display: flex;
  align-items: baseline;
  gap: 1rem;
  margin-bottom: 2.75rem;
  flex-wrap: wrap;
}
.sec-num {
  font-family: var(--font-mono);
  font-size: .6875rem;
  letter-spacing: .12em;
  color: var(--fg-mute);
  white-space: nowrap;
  min-width: 10.5rem;      /* keeps every section title on the same x */
}
.sec-title {
  font-size: clamp(1.5rem, 3.2vw, 2.125rem);
}
.sec-note {
  margin-left: auto;
  max-width: 34ch;
  font-size: .875rem;
  color: var(--fg-dim);
  line-height: 1.55;
}

/* buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: .55rem;
  padding: .7rem 1.15rem;
  border: 1px solid var(--line-hi);
  border-radius: var(--r);
  font-family: var(--font-mono);
  font-size: .6875rem;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--fg);
  background: var(--bg-1);
  transition: border-color .18s var(--ease), background .18s var(--ease), color .18s var(--ease);
}
.btn:hover { border-color: var(--cyan); color: var(--cyan); }
.btn--primary {
  background: var(--cyan);
  border-color: var(--cyan);
  color: #05231F;
  font-weight: 500;
}
.btn--primary:hover { filter: brightness(1.12); color: #05231F; }
.btn svg { width: 14px; height: 14px; }

/* tags */
.tag {
  display: inline-block;
  padding: .18rem .45rem;
  border: 1px solid var(--line);
  border-radius: 3px;
  font-family: var(--font-mono);
  font-size: .625rem;
  letter-spacing: .06em;
  color: var(--fg-dim);
  white-space: nowrap;
}

.cat {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: .625rem;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--cat, var(--cyan));
}

[data-cat="av"]     { --cat: var(--c-av); }
[data-cat="cv"]     { --cat: var(--c-cv); }
[data-cat="re"]     { --cat: var(--c-re); }
[data-cat="safety"] { --cat: var(--c-safety); }
[data-cat="agents"] { --cat: var(--c-agents); }

/* --- 4. Nav -------------------------------------------------------------- */

.nav {
  position: sticky;
  top: 0;
  z-index: 60;
  border-bottom: 1px solid transparent;
  transition: border-color .2s var(--ease), background .2s var(--ease);
}
.nav.scrolled {
  background: var(--bg-glass);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom-color: var(--line);
}
.nav__inner {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  height: 4.25rem;
}
.nav__brand {
  display: flex;
  align-items: center;
  gap: .6rem;
  font-family: var(--font-mono);
  font-size: .75rem;
  letter-spacing: .14em;
  text-transform: uppercase;
  font-weight: 500;
  white-space: nowrap;
}
.nav__dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--cyan);
  box-shadow: 0 0 0 3px rgba(0, 229, 199, .14);
  flex: none;
}
.nav__links {
  display: flex;
  align-items: center;
  gap: 1.6rem;
  margin-left: auto;
  list-style: none;
  padding: 0;
}
.nav__links a {
  font-family: var(--font-mono);
  font-size: .6875rem;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--fg-dim);
  transition: color .16s var(--ease);
  position: relative;
  padding-block: .25rem;
}
.nav__links a:hover,
.nav__links a.active { color: var(--fg); }
.nav__links a.active::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: -2px;
  height: 1px;
  background: var(--cyan);
}
.nav__tools { display: flex; align-items: center; gap: .5rem; }
.icon-btn {
  display: grid;
  place-items: center;
  width: 2.125rem; height: 2.125rem;
  border: 1px solid var(--line);
  border-radius: var(--r);
  color: var(--fg-dim);
  transition: border-color .16s var(--ease), color .16s var(--ease);
}
.icon-btn:hover { border-color: var(--line-hi); color: var(--fg); }
.icon-btn svg { width: 15px; height: 15px; }
.icon-btn .i-sun  { display: none; }
:root[data-theme="light"] .icon-btn .i-sun  { display: block; }
:root[data-theme="light"] .icon-btn .i-moon { display: none; }

.nav__toggle { display: none; }
.nav__toggle span {
  display: block;
  width: 16px; height: 1px;
  background: currentColor;
  transition: transform .22s var(--ease), opacity .22s var(--ease);
}
.nav__toggle span + span { margin-top: 4px; }
.nav__toggle[aria-expanded="true"] span:nth-child(1) { transform: translateY(5px) rotate(45deg); }
.nav__toggle[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.nav__toggle[aria-expanded="true"] span:nth-child(3) { transform: translateY(-5px) rotate(-45deg); }

/* --- 5. Hero ------------------------------------------------------------- */

.hero { padding-block: clamp(3.5rem, 10vw, 8rem) clamp(3rem, 7vw, 5.5rem); }

.eyebrow {
  display: flex;
  align-items: center;
  gap: .7rem;
  font-family: var(--font-mono);
  font-size: .6875rem;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--cyan);
  margin-bottom: 1.75rem;
}
.eyebrow::after {
  content: "";
  flex: 1;
  height: 1px;
  background: linear-gradient(to right, var(--line-hi), transparent);
  max-width: 220px;
}

.hero h1 {
  font-size: clamp(2.1rem, 6.2vw, 4.15rem);
  line-height: 1.04;
  max-width: 20ch;
  margin-bottom: 1.5rem;
}
.hero h1 em { font-style: normal; color: var(--cyan); }

.hero__sub {
  font-size: clamp(1rem, 1.6vw, 1.1875rem);
  color: var(--fg-dim);
  max-width: 62ch;
  line-height: 1.6;
  margin-bottom: 2.25rem;
}

.hero__cta { display: flex; flex-wrap: wrap; gap: .75rem; }

.stat:last-child { border-right: 0; }

/* --- 6. Focus panels ----------------------------------------------------- */

.focus-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(230px, 100%), 1fr));
  border: 1px solid var(--line);
  border-radius: var(--r);
  overflow: hidden;
  background: var(--bg-1);
}
.focus {
  padding: 1.75rem 1.5rem;
  border-right: 1px solid var(--line);
  position: relative;
}
.focus:last-child { border-right: 0; }
.focus::before {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: var(--cat, var(--cyan));
  opacity: .85;
}
.focus h3 { font-size: 1.0625rem; margin: .85rem 0 .6rem; }
.focus p { font-size: .875rem; color: var(--fg-dim); line-height: 1.6; }
.focus__list {
  list-style: none;
  padding: 0;
  margin-top: 1rem;
  display: flex;
  flex-wrap: wrap;
  gap: .35rem;
}

/* --- 7. Work grid -------------------------------------------------------- */

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: .4rem;
  margin-bottom: 1.75rem;
}
.chip {
  padding: .45rem .8rem;
  border: 1px solid var(--line);
  border-radius: var(--r);
  font-family: var(--font-mono);
  font-size: .625rem;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--fg-dim);
  background: var(--bg-1);
  transition: all .16s var(--ease);
}
.chip:hover { border-color: var(--line-hi); color: var(--fg); }
.chip[aria-pressed="true"] {
  border-color: var(--cat, var(--cyan));
  color: var(--cat, var(--cyan));
  background: color-mix(in srgb, var(--cat, var(--cyan)) 9%, var(--bg-1));
}
.chip__n { opacity: .55; margin-left: .35rem; }

.work-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(320px, 100%), 1fr));
  gap: 1rem;
}

.card {
  display: flex;
  flex-direction: column;
  padding: 1.35rem 1.4rem 1.25rem;
  background: var(--bg-1);
  border: 1px solid var(--line);
  border-radius: var(--r);
  position: relative;
  overflow: hidden;
  transition: border-color .2s var(--ease), transform .2s var(--ease);
}
.card::before {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: var(--cat, var(--cyan));
  transform: scaleX(0);
  transform-origin: left;
  transition: transform .28s var(--ease);
}
.card:hover { border-color: var(--line-hi); transform: translateY(-2px); }
.card:hover::before { transform: scaleX(1); }
.card[hidden] { display: none; }

.card__top {
  display: flex;
  align-items: center;
  gap: .75rem;
  margin-bottom: .7rem;
}

.card__name { font-size: 1.125rem; margin-bottom: .45rem; }
.card__desc {
  font-size: .875rem;
  color: var(--fg-dim);
  line-height: 1.58;
  flex: 1;
}
.card__stack {
  display: flex;
  flex-wrap: wrap;
  gap: .3rem;
  margin-top: 1rem;
}
.card__links {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-top: 1.1rem;
  padding-top: .9rem;
  border-top: 1px solid var(--line);
}
.card__links a {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  font-family: var(--font-mono);
  font-size: .625rem;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--fg-mute);
  transition: color .16s var(--ease);
}
.card__links a:hover { color: var(--fg); }
.card__links a.is-case { color: var(--cat, var(--cyan)); margin-left: auto; }
.card__links svg { width: 12px; height: 12px; }

.work-empty {
  padding: 3rem 0;
  text-align: center;
  color: var(--fg-mute);
  font-family: var(--font-mono);
  font-size: .75rem;
  letter-spacing: .1em;
  text-transform: uppercase;
}

/* --- 7b. Sensor stack + autonomy ladder ---------------------------------- */

.specs {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  border: 1px solid var(--line);
  border-radius: var(--r);
  overflow: hidden;
  background: var(--bg-1);
}
.spec {
  padding: 1.35rem 1.4rem;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}
.spec:nth-child(3n) { border-right: 0; }
.spec:nth-last-child(-n+3) { border-bottom: 0; }
.spec__k {
  font-family: var(--font-mono);
  font-size: .625rem;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--fg-mute);
}
.spec__v {
  font-family: var(--font-mono);
  font-size: 1.0625rem;
  color: var(--cyan);
  margin: .45rem 0 .6rem;
  letter-spacing: -.01em;
}
.spec__d { font-size: .875rem; color: var(--fg-dim); line-height: 1.62; }

.ladder {
  border: 1px solid var(--line);
  border-radius: var(--r);
  background: var(--bg-1);
  overflow: hidden;
}
.rung {
  display: grid;
  grid-template-columns: 3.25rem minmax(0, 1fr) minmax(0, 1.15fr);
  gap: 1.25rem;
  align-items: start;
  padding: 1.15rem 1.4rem;
  border-bottom: 1px solid var(--line);
  position: relative;
}
.rung:last-child { border-bottom: 0; }
.rung::before {
  content: "";
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 2px;
  background: var(--cat, var(--cyan));
  opacity: .8;
}
.rung__n {
  font-family: var(--font-mono);
  font-size: .6875rem;
  letter-spacing: .1em;
  color: var(--fg-mute);
  padding-top: .2rem;
}
.rung__h { font-size: 1rem; font-weight: 600; letter-spacing: -.012em; }
.rung__d { font-size: .875rem; color: var(--fg-dim); line-height: 1.6; margin-top: .3rem; }
.rung__sys {
  display: flex;
  flex-wrap: wrap;
  gap: .3rem;
  padding-top: .15rem;
}
.rung__sys a {
  font-family: var(--font-mono);
  font-size: .625rem;
  letter-spacing: .04em;
  color: var(--fg-dim);
  border: 1px solid var(--line);
  border-radius: 3px;
  padding: .18rem .45rem;
  transition: border-color .16s var(--ease), color .16s var(--ease);
}
.rung__sys a:hover { border-color: var(--cat, var(--cyan)); color: var(--cat, var(--cyan)); }

@media (max-width: 980px) {
  .specs { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .spec:nth-child(3n) { border-right: 1px solid var(--line); }
  .spec:nth-child(2n) { border-right: 0; }
  .spec:nth-last-child(-n+3) { border-bottom: 1px solid var(--line); }
  .spec:nth-last-child(-n+2) { border-bottom: 0; }
}

@media (max-width: 620px) {
  .specs { grid-template-columns: 1fr; }
  .spec { border-right: 0; border-bottom: 1px solid var(--line); }
  .spec:last-child { border-bottom: 0; }
}

@media (max-width: 900px) {
  .rung { grid-template-columns: 2.5rem minmax(0, 1fr); gap: .9rem; }
  .rung__sys { grid-column: 2; padding-top: .55rem; }
}

/* --- 7c. Downloads ------------------------------------------------------- */

.dl-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(340px, 100%), 1fr));
  gap: 1rem;
}
.dl {
  display: flex;
  flex-direction: column;
  padding: 1.35rem 1.4rem 1.25rem;
  background: var(--bg-1);
  border: 1px solid var(--line);
  border-radius: var(--r);
  position: relative;
  overflow: hidden;
  transition: border-color .2s var(--ease);
}
.dl::before {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: var(--cat, var(--cyan));
  opacity: .85;
}
.dl:hover { border-color: var(--line-hi); }
.dl__top { display: flex; align-items: center; gap: .75rem; margin-bottom: .65rem; }
.dl__ver {
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: .625rem;
  color: var(--fg-mute);
}
.dl__name { font-size: 1.125rem; margin-bottom: .45rem; }
.dl__desc { font-size: .875rem; color: var(--fg-dim); line-height: 1.58; flex: 1; }
.dl__meta {
  display: flex;
  flex-wrap: wrap;
  gap: .3rem .5rem;
  margin-top: 1rem;
  padding-top: .9rem;
  border-top: 1px solid var(--line);
  font-family: var(--font-mono);
  font-size: .625rem;
  letter-spacing: .06em;
  color: var(--fg-mute);
}
.dl__meta span::after { content: " ·"; color: var(--line-hi); }
.dl__meta span:last-child::after { content: ""; }
.dl__act { display: flex; align-items: center; gap: .9rem; margin-top: 1rem; flex-wrap: wrap; }
.dl__act .btn { padding: .55rem .9rem; }
.dl__act a:not(.btn) {
  font-family: var(--font-mono);
  font-size: .625rem;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--fg-mute);
}
.dl__act a:not(.btn):hover { color: var(--fg); }
.dl__warn {
  margin-top: .75rem;
  font-family: var(--font-mono);
  font-size: .5625rem;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--amber);
}

/* --- 8. Research --------------------------------------------------------- */

.paper {
  position: relative;
  overflow: hidden;
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr);
  gap: clamp(1.5rem, 4vw, 3.5rem);
  align-items: start;
  padding: clamp(1.5rem, 3vw, 2.5rem);
  border: 1px solid var(--line);
  border-radius: var(--r);
  background: var(--bg-1);
}
.paper::before {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: var(--cat, var(--cyan));
  opacity: .85;
}
.paper h3 {
  font-size: clamp(1.25rem, 2.4vw, 1.6rem);
  line-height: 1.22;
  margin: .9rem 0 1rem;
  max-width: 26ch;
}
.paper__abs {
  font-size: .9375rem;
  color: var(--fg-dim);
  line-height: 1.7;
  border-left: 2px solid var(--line-hi);
  padding-left: 1.1rem;
}
.paper__meta {
  display: grid;
  gap: 0;
  border: 1px solid var(--line);
  border-radius: var(--r);
  overflow: hidden;
}
.paper__row {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: .7rem .9rem;
  border-bottom: 1px solid var(--line);
  font-family: var(--font-mono);
  font-size: .6875rem;
}
.paper__row:last-child { border-bottom: 0; }
.paper__row dt { color: var(--fg-mute); letter-spacing: .1em; text-transform: uppercase; }
.paper__row dd { margin: 0; text-align: right; color: var(--fg); }
.paper__links { display: flex; flex-wrap: wrap; gap: .55rem; margin-top: 1.25rem; }

.threads {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(330px, 100%), 1fr));
  gap: 1rem;
  margin-top: 1rem;
}
.thread {
  padding: 1.6rem 1.6rem 1.4rem;
  background: var(--bg-1);
  border: 1px solid var(--line);
  border-radius: var(--r);
  position: relative;
  overflow: hidden;
}
.thread::before {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: var(--cat, var(--cyan));
  opacity: .85;
}
.thread h3 { font-size: 1.1875rem; margin: .85rem 0 .8rem; max-width: 26ch; }
.thread p { font-size: .9375rem; color: var(--fg-dim); line-height: 1.72; }
.thread p + p { margin-top: .85rem; }
.thread__links {
  list-style: none;
  padding: 0;
  margin-top: 1.35rem;
  padding-top: 1rem;
  border-top: 1px solid var(--line);
  display: flex;
  flex-wrap: wrap;
  gap: 1.25rem;
}
.thread__links a {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  font-family: var(--font-mono);
  font-size: .625rem;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--cat, var(--cyan));
}
.thread__links a:hover { text-decoration: underline; text-underline-offset: 3px; }
.thread__links svg { width: 12px; height: 12px; }

/* --- 9. Videos ----------------------------------------------------------- */

.vid-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(280px, 100%), 1fr));
  gap: 1rem;
}
.vid {
  display: block;
  border: 1px solid var(--line);
  border-radius: var(--r);
  overflow: hidden;
  background: var(--bg-1);
  text-align: left;
  width: 100%;
  transition: border-color .2s var(--ease), transform .2s var(--ease);
}
.vid:hover { border-color: var(--line-hi); transform: translateY(-2px); }
.vid__thumb { display: block; position: relative; aspect-ratio: 16 / 9; background: var(--bg-2); }
.vid__thumb img { width: 100%; height: 100%; object-fit: cover; opacity: .82; transition: opacity .2s var(--ease); }
.vid:hover .vid__thumb img { opacity: 1; }
.vid__play {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
}
.vid__play span {
  display: grid;
  place-items: center;
  width: 44px; height: 44px;
  border-radius: 50%;
  background: var(--bg-glass);
  border: 1px solid var(--line-hi);
  backdrop-filter: blur(6px);
  transition: border-color .2s var(--ease), background .2s var(--ease);
}
.vid:hover .vid__play span { border-color: var(--cyan); }
.vid__play svg { width: 14px; height: 14px; margin-left: 2px; fill: var(--fg); }
.vid__body { display: block; padding: 1rem 1.1rem 1.15rem; }
.vid__title { display: block; font-size: .9375rem; font-weight: 500; margin: .5rem 0 .35rem; }
.vid__desc { display: block; font-size: .8125rem; color: var(--fg-dim); line-height: 1.55; }

/* modal */
.modal {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: none;
  place-items: center;
  padding: var(--gutter);
  background: rgba(4, 5, 7, .88);
  backdrop-filter: blur(8px);
}
.modal.open { display: grid; }
.modal__box {
  width: min(980px, 100%);
  border: 1px solid var(--line-hi);
  border-radius: var(--r);
  background: var(--bg-1);
  overflow: hidden;
}
.modal__bar {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: .7rem .9rem;
  border-bottom: 1px solid var(--line);
}
.modal__title {
  font-family: var(--font-mono);
  font-size: .6875rem;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--fg-dim);
}
.modal__close { margin-left: auto; }
.modal__frame { aspect-ratio: 16 / 9; background: #000; }
.modal__frame iframe { width: 100%; height: 100%; border: 0; }

/* --- 10. About ----------------------------------------------------------- */

.about {
  display: grid;
  grid-template-columns: minmax(0, 260px) minmax(0, 1fr);
  gap: clamp(1.75rem, 5vw, 4rem);
  align-items: start;
}
.about__photo {
  border: 1px solid var(--line);
  border-radius: var(--r);
  overflow: hidden;
  background: var(--bg-1);
}
.about__photo img { width: 100%; aspect-ratio: 1; object-fit: cover; }
.about__cap {
  padding: .7rem .85rem;
  border-top: 1px solid var(--line);
  font-family: var(--font-mono);
  font-size: .625rem;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--fg-mute);
}
.about__body p {
  font-size: 1rem;
  color: var(--fg-dim);
  line-height: 1.75;
  max-width: 68ch;
}
.about__body p + p { margin-top: 1rem; }
.about__body strong { color: var(--fg); font-weight: 500; }

.stack {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(210px, 100%), 1fr));
  gap: 0;
  margin-top: 2.5rem;
  border: 1px solid var(--line);
  border-radius: var(--r);
  overflow: hidden;
  background: var(--bg-1);
}
.stack__col { padding: 1.1rem 1.15rem; border-right: 1px solid var(--line); }
.stack__col:last-child { border-right: 0; }
.stack__h {
  font-family: var(--font-mono);
  font-size: .625rem;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--cyan);
  margin-bottom: .7rem;
}
.stack__col ul { list-style: none; padding: 0; }
.stack__col li {
  font-family: var(--font-mono);
  font-size: .75rem;
  color: var(--fg-dim);
  line-height: 1.85;
}

/* --- 11. Contact + footer ------------------------------------------------ */

.contact { display: grid; gap: 2.5rem; }
.contact__mail {
  font-family: var(--font-mono);
  font-size: clamp(1rem, 3.4vw, 1.75rem);
  letter-spacing: -.01em;
  color: var(--fg);
  border-bottom: 1px solid var(--line-hi);
  padding-bottom: .35rem;
  transition: color .18s var(--ease), border-color .18s var(--ease);
  display: inline-block;
  word-break: break-all;
}
.contact__mail:hover { color: var(--cyan); border-color: var(--cyan); }

.links-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(180px, 100%), 1fr));
  border: 1px solid var(--line);
  border-radius: var(--r);
  overflow: hidden;
  background: var(--bg-1);
}
.link-cell {
  display: flex;
  align-items: center;
  gap: .7rem;
  padding: 1.05rem 1.15rem;
  border-right: 1px solid var(--line);
  transition: background .16s var(--ease);
}
.link-cell:last-child { border-right: 0; }
.link-cell:hover { background: var(--bg-2); }
.link-cell svg { width: 16px; height: 16px; color: var(--fg-mute); flex: none; }
.link-cell:hover svg { color: var(--cyan); }
.link-cell b {
  font-family: var(--font-mono);
  font-size: .6875rem;
  letter-spacing: .1em;
  text-transform: uppercase;
  font-weight: 500;
}
.link-cell small { display: block; font-size: .6875rem; color: var(--fg-mute); }

.footer {
  border-top: 1px solid var(--line);
  padding-block: 2rem;
}
.footer__inner {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  align-items: center;
  justify-content: space-between;
  font-family: var(--font-mono);
  font-size: .625rem;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--fg-mute);
}

/* --- 12. Case-study pages ------------------------------------------------ */

.crumb {
  display: flex;
  align-items: center;
  gap: .5rem;
  font-family: var(--font-mono);
  font-size: .625rem;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--fg-mute);
  padding-top: 2.5rem;
}
.crumb a:hover { color: var(--fg); }

.cs-hero { padding-block: 2rem clamp(2.5rem, 6vw, 4rem); }
.cs-hero h1 {
  font-size: clamp(2rem, 5.5vw, 3.25rem);
  margin: 1rem 0 1.1rem;
}
.cs-hero__lead {
  font-size: clamp(1rem, 1.7vw, 1.1875rem);
  color: var(--fg-dim);
  line-height: 1.65;
  max-width: 62ch;
}
.cs-hero__meta { display: flex; flex-wrap: wrap; gap: .3rem; margin-top: 1.5rem; }
.cs-hero__cta { display: flex; flex-wrap: wrap; gap: .65rem; margin-top: 1.75rem; }

.prose { max-width: 70ch; }
.prose p { color: var(--fg-dim); line-height: 1.78; }
.prose p + p { margin-top: 1rem; }
.prose strong { color: var(--fg); font-weight: 500; }
.prose code {
  font-family: var(--font-mono);
  font-size: .85em;
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: 3px;
  padding: .1em .35em;
  color: var(--fg);
}
.prose ul { margin: 1rem 0 0; padding-left: 1.1rem; color: var(--fg-dim); }
.prose li { line-height: 1.75; margin-bottom: .5rem; }
.prose li::marker { color: var(--fg-mute); }

.dtable {
  width: 100%;
  border-collapse: collapse;
  font-size: .875rem;
}
.dtable th, .dtable td {
  text-align: left;
  padding: .75rem .9rem;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}
.dtable th {
  font-family: var(--font-mono);
  font-size: .625rem;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--fg-mute);
  font-weight: 400;
  white-space: nowrap;
}
.dtable td { color: var(--fg-dim); }
.dtable td:first-child { color: var(--fg); font-family: var(--font-mono); font-size: .8125rem; white-space: nowrap; }
.dtable tr:last-child td { border-bottom: 0; }
.table-scroll { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--r); background: var(--bg-1); }

.callout {
  border: 1px solid var(--line);
  border-left: 2px solid var(--amber);
  border-radius: var(--r);
  background: var(--bg-1);
  padding: 1.1rem 1.25rem;
  max-width: 70ch;
}
.callout--cyan { border-left-color: var(--cyan); }
.callout__h {
  font-family: var(--font-mono);
  font-size: .625rem;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--amber);
  margin-bottom: .5rem;
}
.callout--cyan .callout__h { color: var(--cyan); }
.callout p { font-size: .875rem; color: var(--fg-dim); line-height: 1.7; }

.diagram {
  border: 1px solid var(--line);
  border-radius: var(--r);
  background: var(--bg-1);
  padding: clamp(1rem, 3vw, 2rem);
  overflow-x: auto;
}
.diagram svg { width: 100%; height: auto; min-width: 520px; }
.d-box  { fill: var(--bg-2); stroke: var(--line-hi); stroke-width: 1; }
.d-lab  { fill: var(--fg); font-family: var(--font-mono); font-size: 11px; letter-spacing: .06em; }
.d-sub  { fill: var(--fg-mute); font-family: var(--font-mono); font-size: 9px; letter-spacing: .06em; }
.d-line { stroke: var(--line-hi); stroke-width: 1; fill: none; }
.d-acc  { stroke: var(--cyan); stroke-width: 1.25; fill: none; }
.d-arrow { fill: var(--line-hi); }

.pager {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  border-top: 1px solid var(--line);
  padding-top: 1.75rem;
}
.pager a {
  font-family: var(--font-mono);
  font-size: .6875rem;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--fg-dim);
}
.pager a:hover { color: var(--cyan); }

/* --- 12b. Screenshots ---------------------------------------------------- */

.shot {
  margin: 1.75rem 0 0;
  border: 1px solid var(--line);
  border-radius: var(--r);
  overflow: hidden;
  background: var(--bg-1);
}
.shot img { width: 100%; height: auto; display: block; }
.shot figcaption {
  padding: .7rem .95rem;
  border-top: 1px solid var(--line);
  font-family: var(--font-mono);
  font-size: .625rem;
  letter-spacing: .09em;
  text-transform: uppercase;
  color: var(--fg-mute);
  line-height: 1.5;
}
.shot-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(340px, 100%), 1fr));
  gap: 1rem;
  margin-top: 1.75rem;
}
.shot-grid .shot { margin: 0; }

/* --- 13. Reveal ---------------------------------------------------------- */

/* Scoped to .js so content stays visible if the script fails to load. */
.js .reveal {
  opacity: 0;
  transform: translateY(14px);
  transition: opacity .55s var(--ease), transform .55s var(--ease);
}
.js .reveal.visible { opacity: 1; transform: none; }

/* --- 14. Responsive ------------------------------------------------------ */

@media (max-width: 900px) {
  .paper { grid-template-columns: 1fr; }
  .about { grid-template-columns: 1fr; }
  .about__photo { max-width: 220px; }
  .focus { border-right: 0; border-bottom: 1px solid var(--line); }
  .focus:last-child { border-bottom: 0; }
  .stack__col { border-right: 0; border-bottom: 1px solid var(--line); }
  .stack__col:last-child { border-bottom: 0; }
  .link-cell { border-right: 0; border-bottom: 1px solid var(--line); }
  .link-cell:last-child { border-bottom: 0; }
}

/* Seven nav items stop fitting well before the layout breakpoint. */
@media (max-width: 900px) {
  html { scroll-padding-top: 4.75rem; }
  .nav__toggle { display: grid; }
  .nav__links {
    position: fixed;
    inset: 4.25rem 0 auto;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    background: var(--bg-1);
    border-bottom: 1px solid var(--line);
    padding: .5rem var(--gutter) 1.25rem;
    transform: translateY(-120%);
    transition: transform .28s var(--ease);
    margin-left: 0;
  }
  .nav__links.open { transform: none; }
  .nav__links li { border-bottom: 1px solid var(--line); }
  .nav__links li:last-child { border-bottom: 0; }
  .nav__links a { display: block; padding: .9rem 0; font-size: .75rem; }
  .nav__links a.active::after { display: none; }
  .nav__tools { margin-left: auto; }
}

@media (max-width: 760px) {
  .work-grid { grid-template-columns: 1fr; }
  .sec-note { margin-left: 0; max-width: none; }
  .sec-num { min-width: 100%; }
  .diagram svg { min-width: 460px; }
}


/* Very narrow phones: the wordmark and three icon buttons stop fitting. */
@media (max-width: 400px) {
  .nav__inner { gap: .6rem; }
  .nav__brand {
    font-size: .625rem;
    letter-spacing: .06em;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .nav__tools { gap: .35rem; flex: none; }
  .icon-btn { width: 1.8rem; height: 1.8rem; }
  .icon-btn svg { width: 13px; height: 13px; }
}

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

@media print {
  body::before, .nav, .modal, .footer { display: none; }
  body { background: #fff; color: #000; }
}
