/* ============================================================
   Yuhyeon Lee — personal portfolio
   Concept: "the engineer's dossier" — matte black ground,
   engraved serif display, monospace readouts, one phosphor-green
   accent, brass for stamps and the monogram. Night by default,
   day on the toggle or the OS preference.
   ============================================================ */

/* self-hosted type (SIL Open Font License, see fonts/OFL-*.txt) */
@font-face { font-family: "Besley"; font-style: normal; font-weight: 700 800; font-display: swap; src: url("fonts/besley-var.woff2") format("woff2"); }
@font-face { font-family: "Archivo"; font-style: normal; font-weight: 400 600; font-display: swap; src: url("fonts/archivo-var.woff2") format("woff2"); }
@font-face { font-family: "Archivo"; font-style: italic; font-weight: 400; font-display: swap; src: url("fonts/archivo-italic-var.woff2") format("woff2"); }
@font-face { font-family: "IBM Plex Mono"; font-style: normal; font-weight: 400; font-display: swap; src: url("fonts/ibmplexmono-400.woff2") format("woff2"); }
@font-face { font-family: "IBM Plex Mono"; font-style: normal; font-weight: 500; font-display: swap; src: url("fonts/ibmplexmono-500.woff2") format("woff2"); }
@font-face { font-family: "Rye"; font-style: normal; font-weight: 400; font-display: swap; src: url("fonts/rye-400.woff2") format("woff2"); }

:root {
  color-scheme: dark;
  --bg: #0c0d0b;
  --bg-raise: #12140f;
  --ink: #ece7d9;          /* bone white */
  --ink-soft: #ddd9cb;
  --muted: #a9ac9b;        /* olive gray */
  --line: #2a2c22;
  --line-strong: #4b4d3e;  /* heavy poster rule */
  --line-soft: #191b14;
  --green: #44d62c;        /* phosphor */
  --green-dim: rgba(68, 214, 44, 0.45);
  --gold: #c9a96a;         /* brass */
  --gold-dim: #93805a;

  /* modality signal colors (IMU stays phosphor green — the house modality) */
  --mod-emg: #e0813f;      /* EMG — muscle signal */
  --mod-emg-dim: rgba(224, 129, 63, 0.45);
  --mod-ppg: #e26666;      /* PPG — blood pulse */
  --mod-ppg-dim: rgba(226, 102, 102, 0.45);
  --mod-vis: #52c7de;      /* vision — optics */
  --mod-vis-dim: rgba(82, 199, 222, 0.45);
  --mod-enc: #9fb8cc;      /* encoder — machined steel */
  --mod-enc-dim: rgba(159, 184, 204, 0.45);

  /* keyword inks — technique / language / year (co-occurrence checked per card) */
  --kw-ai: #b48ce0;        /* violet — indelible ink */
  --kw-ai-dim: rgba(180, 140, 224, 0.45);
  --kw-sw: #c9bd72;        /* sand */
  --kw-sw-dim: rgba(201, 189, 114, 0.45);
  --kw-app: #d693a8;       /* faded rose */
  --kw-app-dim: rgba(214, 147, 168, 0.45);
  --kw-py: #7cb8e8;        /* python — sky */
  --kw-py-dim: rgba(124, 184, 232, 0.45);
  --kw-rust: #c47a52;      /* rust — sienna */
  --kw-rust-dim: rgba(196, 122, 82, 0.45);
  --kw-kt: #e8b04a;        /* kotlin — marigold */
  --kw-kt-dim: rgba(232, 176, 74, 0.45);
  --year: #d9d2bd;         /* date stamp — bone */
  --year-dim: rgba(217, 210, 189, 0.4);

  --bg-hover: #15170f;

  --display: "Besley", "Clarendon", Georgia, serif;
  --poster: "Rye", "Besley", Georgia, serif;   /* section bands only — Rye ships one weight (400) */
  --sans: "Archivo", -apple-system, "Segoe UI", sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, "Cascadia Mono", monospace;
}

/* ------------------------------------------------------------ day mode
   the same bill printed on aged paper — toggled by the nav sun/moon,
   persisted in localStorage, night stays the default */
html[data-theme="day"] {
  color-scheme: light;
  scrollbar-color: #b5a683 #e8dcc2;

  --bg: #e8dcc2;
  --bg-raise: #e0d3b2;
  --bg-hover: #dbcda6;
  --ink: #241c10;
  --ink-soft: #332918;
  --muted: #63543e;
  --line: #c6b48e;
  --line-strong: #7d6b4a;
  --line-soft: #d8caa8;
  --green: #12570a;
  --green-dim: #12570a;
  --gold: #6c5221;
  --gold-dim: #6c5221;

  /* every chip ink reaches 4.6:1 on the darkest day surface (--bg-hover),
     so small chip text passes WCAG AA in both themes */
  --mod-emg: #86450e;  --mod-emg-dim: #86450e;
  --mod-ppg: #9a3232;  --mod-ppg-dim: #9a3232;
  --mod-vis: #0e5e71;  --mod-vis-dim: #0e5e71;
  --mod-enc: #44586b;  --mod-enc-dim: #44586b;

  --kw-ai: #5f3596;    --kw-ai-dim: #5f3596;
  --kw-sw: #5f5722;    --kw-sw-dim: #5f5722;
  --kw-app: #8e395a;   --kw-app-dim: #8e395a;
  --kw-py: #2a5982;    --kw-py-dim: #2a5982;
  --kw-rust: #874322;  --kw-rust-dim: #874322;
  --kw-kt: #734f0d;    --kw-kt-dim: #734f0d;
  --year: #4a4132;     --year-dim: #4a4132;
}

html[data-theme="day"] ::-webkit-scrollbar-thumb { background: #b5a683; }
html[data-theme="day"] .portrait { background: linear-gradient(160deg, #ded1af 0%, #e5d9bb 100%); }
html[data-theme="day"] .vignette {
  background: radial-gradient(ellipse 130% 95% at 50% 24%, rgba(0, 0, 0, 0) 52%, rgba(74, 56, 24, 0.3) 100%);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { scrollbar-color: #262822 #0c0d0b; }

@media (prefers-reduced-motion: no-preference) {
  html { scroll-behavior: smooth; }
}

body {
  background: var(--bg);
  color: var(--ink-soft);
  font-family: var(--sans);
  font-size: 16.5px;
  line-height: 1.68;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

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

a { color: var(--green); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 4px; }
a:focus-visible,
.btn:focus-visible {
  outline: 2px solid var(--green);
  outline-offset: 3px;
}

.skip-link {
  position: absolute;
  top: 8px;
  left: 50%;
  transform: translate(-50%, -160%);
  z-index: 100;
  background: var(--bg);
  color: var(--green);
  border: 1px solid var(--green);
  padding: 8px 16px;
  font-family: var(--mono);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
}
.skip-link:focus { transform: translate(-50%, 0); }

/* thin dark scrollbar */
::-webkit-scrollbar { width: 10px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: #262822; border-radius: 0; }
::-webkit-scrollbar-thumb:hover { background: var(--green-dim); }

/* film grain over everything */
.grain {
  position: fixed;
  inset: 0;
  z-index: 999;
  pointer-events: none;
  opacity: 0.034;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* lamplight — the poster darkens toward its edges. Bound to the first screen and
   scrolled away with it: as a fixed layer it washed the bottom of every screen,
   which read as a haze over anything being scrolled past. */
.vignette {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 100vh;
  z-index: 998;
  pointer-events: none;
  background: radial-gradient(ellipse 130% 95% at 50% 24%, rgba(0, 0, 0, 0) 52%, rgba(3, 4, 2, 0.42) 100%);
}

/* ------------------------------------------------------------ monogram mark */

.mark {
  width: 26px;
  height: 26px;
  border: 1px solid var(--line-strong);
  transform: rotate(45deg);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: border-color 0.2s ease;
}

.mark span {
  transform: rotate(-45deg);
  font-family: var(--display);
  font-size: 0.58rem;
  font-weight: 700;
  color: var(--ink);
  letter-spacing: 0.04em;
}

/* ------------------------------------------------------------ nav */

.nav {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--bg);
  border-bottom: 1px solid var(--line);
}

.nav-inner {
  position: relative;
  max-width: 900px;
  margin: 0 auto;
  padding: 0 24px;
  height: 62px;
  display: flex;
  align-items: center;
  gap: 18px;
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: 14px;
}
.nav-brand:hover { text-decoration: none; }
.nav-brand:hover .mark { border-color: var(--green); }

.nav-name {
  font-family: var(--display);
  font-size: 0.95rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--ink);
  letter-spacing: 0.05em;
  white-space: nowrap;
}

.nav-links {
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
  margin-left: auto;
}

.nav-links a {
  font-family: var(--mono);
  font-size: 0.72rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--muted);
}
.nav-links a:hover {
  color: var(--ink);
  text-decoration: underline;
  text-decoration-color: var(--green);
  text-underline-offset: 6px;
}

.theme-toggle {
  width: 30px;
  height: 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  padding: 0;
  background: transparent;
  border: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1;
  cursor: pointer;
  transition: border-color 0.18s ease, color 0.18s ease;
}
.theme-toggle:hover { border-color: var(--green); color: var(--ink); }
.theme-toggle:focus-visible { outline: 2px solid var(--green); outline-offset: 3px; }

/* ------------------------------------------------------------ layout */

/* the whole page is framed like a printed bill */
main {
  position: relative;
  max-width: 960px;
  margin: 34px auto 0;
  padding: 0 52px;
  border: 1px solid var(--line-strong);
  outline: 1px solid var(--line);
  outline-offset: 5px;
}

main::before,
main::after {
  content: "\2756";           /* ❖ */
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  color: var(--green);
  background: var(--bg);
  padding: 0 14px;
  font-size: 0.8rem;
  line-height: 1;
}
main::before { top: -7px; }
main::after { bottom: -7px; }

/* brass tacks pinning the bill at its corners */
.frame-tacks span {
  position: absolute;
  width: 16px;
  height: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--gold);
  background: var(--bg);
  font-size: 0.6rem;
  line-height: 1;
  z-index: 2;
}
.frame-tacks span:nth-child(1) { top: -8px; left: -8px; }
.frame-tacks span:nth-child(2) { top: -8px; right: -8px; }
.frame-tacks span:nth-child(3) { bottom: -8px; left: -8px; }
.frame-tacks span:nth-child(4) { bottom: -8px; right: -8px; }

section {
  margin: 104px 0;
  scroll-margin-top: 92px;
}

/* poster band: heavy-thin rules flanking a centered title */
.section-head {
  display: flex;
  align-items: center;
  gap: 20px;
  margin-bottom: 34px;
}

.section-head::before,
.section-head::after {
  content: "";
  flex: 1;
  height: 6px;
  border-top: 3px solid var(--line-strong);
  border-bottom: 1px solid var(--line);
}

h2 {
  font-family: var(--poster);
  font-size: 1.55rem;
  font-weight: 400;
  text-transform: uppercase;
  color: var(--ink);
  letter-spacing: 0.06em;
  white-space: nowrap;
}

/* hand-set ornaments flanking every band title */
h2::before,
h2::after {
  content: "\2726";           /* ✦ */
  font-size: 0.55em;
  color: var(--gold-dim);
  vertical-align: 0.18em;
}
h2::before { margin-right: 16px; }
h2::after { margin-left: 16px; }

/* ------------------------------------------------------------ hero */

/* wanted-poster stack: kicker, name, mugshot, details */
.hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 78px 0 0;
}

.hero-kicker {
  display: flex;
  align-items: center;
  gap: 16px;
  font-family: var(--mono);
  font-size: 0.76rem;
  font-weight: 500;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--green);
  margin-bottom: 26px;
}
.hero-kicker::before,
.hero-kicker::after {
  content: "";
  width: 34px;
  height: 1px;
  background: var(--green);
}

.hero h1 {
  font-family: var(--display);
  font-size: clamp(2.7rem, 7vw, 4.3rem);
  font-weight: 800;
  text-transform: uppercase;
  color: var(--ink);
  letter-spacing: 0.02em;
  line-height: 1.05;
  margin-bottom: 36px;
}

/* worn wood-type ink on the name — noise clipped into the glyphs */
@supports (-webkit-background-clip: text) {
  .hero h1 {
    color: transparent;
    background-image:
      url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='w'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.5' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0  0 0 0 0 0  0 0 0 0 0  0 0 0 0.8 -0.3'/%3E%3C/filter%3E%3Crect width='140' height='140' filter='url(%23w)' opacity='0.55'/%3E%3C/svg%3E"),
      linear-gradient(var(--ink), var(--ink));
    -webkit-background-clip: text;
    background-clip: text;
  }
}

.hero-affiliation {
  font-family: var(--mono);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
  margin-bottom: 30px;
}
.hero-affiliation a {
  color: var(--muted);
  text-decoration: underline;
  text-decoration-color: var(--line);
  text-underline-offset: 4px;
}
.hero-affiliation a:hover { color: var(--green); text-decoration-color: var(--green); }

.hero-links { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; }

.btn {
  display: inline-block;
  padding: 10px 20px;
  border: 1px solid var(--line);
  font-family: var(--mono);
  font-size: 0.72rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--ink);
  background: transparent;
  transition: border-color 0.18s ease, color 0.18s ease, background 0.18s ease;
}
.btn:hover { border-color: var(--green); color: var(--green); text-decoration: none; }

.btn-primary {
  background: var(--green);
  border-color: var(--green);
  color: var(--bg);
  font-weight: 600;
}
.btn-primary:hover { background: #3bbd26; color: var(--bg); }

/* portrait — dossier ID photo, 5:6, registration corner marks */

.portrait {
  position: relative;
  width: 200px;
  height: 240px;
  margin: 0 0 32px;
  border: 1px solid var(--line-strong);
  background: linear-gradient(160deg, #14160f 0%, #0e100b 100%);
  flex-shrink: 0;
}
.portrait::before,
.portrait::after {
  content: "";
  position: absolute;
  width: 14px;
  height: 14px;
}
.portrait::before {
  top: -5px;
  left: -5px;
  border-top: 1px solid var(--green);
  border-left: 1px solid var(--green);
}
.portrait::after {
  bottom: -5px;
  right: -5px;
  border-bottom: 1px solid var(--green);
  border-right: 1px solid var(--green);
}

.portrait-blank {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
}

.portrait-mono {
  font-family: var(--display);
  font-size: 2.6rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--ink);
  opacity: 0.85;
}

.portrait-caption {
  font-family: var(--mono);
  font-size: 0.58rem;
  text-transform: uppercase;
  letter-spacing: 0.28em;
  color: var(--muted);
}

.portrait img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  filter: grayscale(12%) contrast(1.03);
}

/* spec strip — at-a-glance readout */

.spec-strip {
  margin-top: 60px;
  border-top: 3px solid var(--line-strong);
  border-bottom: 3px solid var(--line-strong);
  box-shadow: 0 5px 0 -4px var(--line), 0 -5px 0 -4px var(--line);
  display: grid;
  grid-template-columns: 1fr 1.1fr 1.34fr;
}

.spec {
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.spec + .spec { border-left: 1px solid var(--line); }

.spec-key {
  font-family: var(--mono);
  font-size: 0.64rem;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--muted);
}

.spec-val {
  font-family: var(--mono);
  font-size: 0.84rem;
  color: var(--ink);
}

.live-dot {
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 6px var(--green-dim);
  margin-right: 7px;
  vertical-align: 1px;
  animation: pulse 2.6s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.35; }
}

/* ------------------------------------------------------------ about */

.facts { margin: 0; }

.fact {
  display: grid;
  grid-template-columns: 130px 1fr;
  gap: 28px;
  padding: 16px 0;
  border-top: 1px solid var(--line);
}
.facts .fact:first-child { border-top: none; }
.facts .fact:last-child { border-bottom: 1px solid var(--line); }

.fact dt {
  font-family: var(--mono);
  font-size: 0.72rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--green);
  padding-top: 4px;
}

/* About keys are poster subheads — About is the impression section;
   Contact keeps the small mono keys (utility register) */
#about .fact dt {
  font-family: var(--poster);
  font-size: 1.1rem;
  font-weight: 400;
  letter-spacing: 0.08em;
  padding-top: 0;
}

.fact dd { font-size: 1.02rem; line-height: 1.7; }

.fact-points { list-style: none; }

.fact-points li {
  position: relative;
  padding-left: 18px;
  margin: 3px 0;
}
.fact-points li::before {
  content: "\2022";           /* • */
  position: absolute;
  left: 0;
  color: var(--green);
}

/* ------------------------------------------------------------ research cards */

.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.card {
  border: 1px solid var(--line);
  background: var(--bg-raise);
  padding: 22px 24px;
  transition: border-color 0.18s ease, background 0.18s ease;
}
.card:hover { border-color: var(--gold-dim); background: var(--bg-hover); }

.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
  min-height: 22px;
}

.card h3 {
  font-size: 1rem;
  font-weight: 600;
  color: var(--ink);
}

.tag {
  font-family: var(--mono);
  font-size: 0.56rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  padding: 3px 9px;
  white-space: nowrap;
  flex-shrink: 0;
}

.tag-now { color: var(--green); border: 1px solid var(--green-dim); }
.tag-next,
.tag-ult { color: var(--gold); border: 1px solid var(--gold-dim); }

.card p {
  font-size: 0.95rem;
  color: var(--muted);
  line-height: 1.62;
}

/* ------------------------------------------------------------ education timeline */

.timeline { list-style: none; }

.timeline li {
  display: grid;
  grid-template-columns: 190px 1fr;
  gap: 28px;
  padding: 24px 0;
  border-top: 1px solid var(--line);
}
.timeline li:first-child { border-top: none; padding-top: 4px; }
.timeline li:last-child { border-bottom: 1px solid var(--line); }

.timeline-period {
  font-family: var(--mono);
  font-size: 0.74rem;
  color: var(--muted);
  letter-spacing: 0.04em;
  padding-top: 6px;
  white-space: nowrap;
}

.timeline-body h3 {
  font-family: var(--display);
  font-size: 1.06rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--ink);
  margin-bottom: 4px;
}

.timeline-degree { font-size: 1rem; }

.timeline-detail {
  font-size: 0.88rem;
  color: var(--muted);
  margin-top: 2px;
}

/* ------------------------------------------------------------ publications */

.publications { list-style: none; }

.publications li {
  padding: 24px 0;
  border-top: 1px solid var(--line);
}
.publications li:first-child { border-top: none; padding-top: 4px; }
.publications li:last-child { border-bottom: 1px solid var(--line); }

.pub-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 10px;
}

.pub-title {
  font-family: var(--display);
  font-size: 1.22rem;
  font-weight: 700;
  line-height: 1.4;
  color: var(--ink);
  max-width: 60ch;
}

.stamp {
  font-family: var(--mono);
  font-size: 0.6rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  color: var(--gold);
  border: 1px solid var(--gold-dim);
  box-shadow: inset 0 0 0 2px var(--bg), inset 0 0 0 3px var(--gold-dim);
  padding: 8px 14px;
  transform: rotate(-2deg);
  white-space: nowrap;
  flex-shrink: 0;
  margin-top: 5px;
}

.pub-authors { font-size: 0.98rem; margin-bottom: 3px; }
.pub-authors strong { color: var(--ink); }

.pub-note {
  font-family: var(--mono);
  font-size: 0.7rem;
  color: var(--muted);
  margin-left: 10px;
  /* atomic, so a two-marker note drops to the next line whole instead of
     breaking after the separator and orphaning a leading middot */
  display: inline-block;
}

.pub-venue {
  font-size: 0.9rem;
  font-style: italic;
  color: var(--muted);
  margin-bottom: 8px;
}

.pub-links { font-family: var(--mono); font-size: 0.78rem; }

/* ------------------------------------------------------------ awards (hidden until ready) */

.awards { list-style: none; }
.awards > li {
  display: flex;
  align-items: baseline;
  gap: 26px;
  padding: 15px 0;
  border-top: 1px solid var(--line);
  font-size: 0.98rem;
}
.awards > li:first-child { border-top: none; }
.awards > li:last-child { border-bottom: 1px solid var(--line); }

.award-year {
  font-family: var(--mono);
  font-size: 0.74rem;
  color: var(--muted);
  width: 172px;
  flex-shrink: 0;
  white-space: nowrap;
}

.award-body strong { color: var(--ink); font-weight: 600; }

.award-points { list-style: none; margin-top: 9px; }
.award-points li {
  position: relative;
  padding-left: 16px;
  font-size: 0.88rem;
  color: var(--muted);
  line-height: 1.6;
  margin: 3px 0;
  max-width: 74ch;
}
.award-points li::before {
  content: "\2022";           /* • */
  position: absolute;
  left: 0;
  color: var(--green);
}

/* ------------------------------------------------------------ projects */

.featured {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.project-card {
  border: 1px solid var(--line);
  background: var(--bg-raise);
  padding: 24px 26px;
  transition: border-color 0.18s ease, background 0.18s ease;
}
.project-card:hover { border-color: var(--gold-dim); background: var(--bg-hover); }

.project-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 10px;
}

.project-head h3 { font-size: 1.04rem; font-weight: 600; }
.project-head h3 a { color: var(--ink); }
.project-head h3 a:hover { color: var(--green); text-decoration: none; }

.project-year {
  font-family: var(--mono);
  font-size: 0.62rem;
  letter-spacing: 0.12em;
  color: var(--year);
  border: 1px solid var(--year-dim);
  padding: 3px 10px;
  white-space: nowrap;
}

/* right-side row: visibility · year · language, boxed to one spec */
.project-side,
.project-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
  flex-shrink: 0;
}
.project-meta { margin-top: 4px; }

.vis-public { color: var(--green); border: 1px solid var(--green-dim); }
.vis-private { color: var(--gold); border: 1px solid var(--gold-dim); }

.project-points { list-style: none; margin-top: 2px; }

.project-points li {
  position: relative;
  padding-left: 18px;
  font-size: 0.98rem;
  color: var(--ink-soft);
  line-height: 1.64;
  margin: 6px 0;
  max-width: 74ch;
}
.project-points li::before {
  content: "\2022";           /* • */
  position: absolute;
  left: 0;
  color: var(--green);
}

.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }

.chip {
  font-family: var(--mono);
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  background: transparent;
  border: 1px solid var(--line);
  padding: 3px 10px;
  white-space: nowrap;
}

/* modality chips are colored signal codes — technique chips stay neutral.
   compound selectors (.chip.mod-*) must outrank .chip, which resets color/border */
.chip.chip-mod { background: transparent; color: var(--green); border-color: var(--green-dim); }

.chip.mod-imu, .mod-imu { color: var(--green); border-color: var(--green-dim); }
.chip.mod-emg, .mod-emg { color: var(--mod-emg); border-color: var(--mod-emg-dim); }
.chip.mod-ppg, .mod-ppg { color: var(--mod-ppg); border-color: var(--mod-ppg-dim); }
.chip.mod-vis, .mod-vis { color: var(--mod-vis); border-color: var(--mod-vis-dim); }
.chip.mod-enc, .mod-enc { color: var(--mod-enc); border-color: var(--mod-enc-dim); }

.mod-word { font-family: var(--mono); font-size: 0.82em; letter-spacing: 0.04em; }

/* technique + language keyword inks — same compound-selector rule as .mod-* */
.chip.kw-ai { color: var(--kw-ai); border-color: var(--kw-ai-dim); }
.chip.kw-sw { color: var(--kw-sw); border-color: var(--kw-sw-dim); }
.chip.kw-app { color: var(--kw-app); border-color: var(--kw-app-dim); }
.chip.kw-py { color: var(--kw-py); border-color: var(--kw-py-dim); }
.chip.kw-rust { color: var(--kw-rust); border-color: var(--kw-rust-dim); }
.chip.kw-kt { color: var(--kw-kt); border-color: var(--kw-kt-dim); }

.more-heading {
  display: flex;
  align-items: center;
  gap: 18px;
  font-family: var(--mono);
  font-size: 0.7rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  color: var(--muted);
  margin: 48px 0 8px;
}
.more-heading::before,
.more-heading::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--line);
}

.project-list { list-style: none; }

.project-list > li {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  padding: 20px 0;
  border-top: 1px solid var(--line);
}
.project-list > li:first-child { border-top: none; }
.project-list > li:last-child { border-bottom: 1px solid var(--line); }

.list-main .project-points { margin-top: 8px; }

.project-list a,
.project-list .no-link { font-weight: 600; color: var(--ink); }
.project-list a:hover { color: var(--green); text-decoration: none; }

.project-list p {
  font-size: 0.95rem;
  color: var(--muted);
  margin-top: 3px;
  max-width: 64ch;
}

.project-list .chips { margin-top: 10px; }

.list-sep { color: var(--muted); margin: 0 4px; }

/* ------------------------------------------------------------ project tiles */

/* the Projects tab is a grid of tiles: thumbnail, name, two lines, chips.
   the whole tile is the link to the project's own page */
.tiles {
  list-style: none;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-top: 10px;
}

.tile {
  display: flex;
  flex-direction: column;
  height: 100%;
  border: 1px solid var(--line);
  background: var(--bg-raise);
  color: var(--ink-soft);
  transition: border-color 0.18s ease, background 0.18s ease;
}
.tile:hover { border-color: var(--gold-dim); background: var(--bg-hover); text-decoration: none; }
.tile:focus-visible { outline: 2px solid var(--green); outline-offset: 3px; }

/* thumbnails are composed on the night card color, so they read as plates in both themes */
.tile-thumb {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 8 / 5;
  object-fit: cover;
  background: #12140f;
  border-bottom: 1px solid var(--line);
}

.tile-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 16px 18px 18px;
}

.tile-title { font-size: 1.02rem; font-weight: 600; color: var(--ink); line-height: 1.35; }
.tile:hover .tile-title { color: var(--green); }
.tile-sub { font-weight: 400; font-size: 0.9em; color: var(--muted); }

.tile-blurb { font-size: 0.92rem; line-height: 1.6; color: var(--muted); }
.tile:hover .tile-blurb { color: var(--ink-soft); }

.tile-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: auto;
  padding-top: 6px;
}
.tile .chips { margin-top: 4px; }

.tiles-small { grid-template-columns: repeat(3, 1fr); }
.tiles-small .tile-body { padding: 12px 14px 14px; gap: 4px; }
.tiles-small .tile-title { font-size: 0.92rem; }
.tiles-small .tile-meta { padding-top: 2px; }

/* ------------------------------------------------------------ project pages */

.project-hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 64px 0 0;
}

.project-hero h1 {
  font-family: var(--display);
  font-size: clamp(2rem, 5.2vw, 3.2rem);
  font-weight: 800;
  text-transform: uppercase;
  color: var(--ink);
  letter-spacing: 0.02em;
  line-height: 1.08;
  margin-bottom: 14px;
}

.project-subtitle {
  font-family: var(--mono);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--muted);
  margin-bottom: 14px;
}

.project-lede {
  font-size: 1.12rem;
  line-height: 1.6;
  color: var(--ink-soft);
  max-width: 58ch;
  margin-bottom: 18px;
}

.project-hero-meta { justify-content: center; margin-top: 0; padding-top: 0; }
.project-hero-chips { justify-content: center; margin: 12px 0 26px; }

.project-figure { margin: 44px 0 0; }
.project-figure img {
  display: block;
  width: 100%;
  height: auto;
  border: 1px solid var(--line);
  background: var(--bg-raise);
}
.project-figure figcaption {
  font-family: var(--mono);
  font-size: 0.74rem;
  line-height: 1.6;
  color: var(--muted);
  margin-top: 10px;
}
.project-figure-hero { margin-top: 48px; }

/* figures ship in both palettes; the page shows the one that matches the theme.
   (two classes, so these outrank the `.project-figure img { display: block }` above) */
.project-figure .fig-day { display: none; }
html[data-theme="day"] .project-figure .fig-day { display: block; }
html[data-theme="day"] .project-figure .fig-night { display: none; }

.figure-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px 14px; }
.figure-grid .project-figure { margin: 0; }

.detail { margin: 72px 0; }
.detail .project-points li { max-width: none; }
.project-page .fact { grid-template-columns: 150px 1fr; }


/* ------------------------------------------------------------ contact & footer */

.contact-mail {
  display: inline-block;
  font-family: var(--mono);
  font-size: 1.28rem;
  color: var(--green);
  letter-spacing: 0.01em;
  margin-bottom: 30px;
}

.pointer {
  display: inline-block;
  font-size: 0.72em;
  vertical-align: 1px;
  margin-right: 12px;
  transition: transform 0.18s ease;
}
.contact-mail:hover .pointer { transform: translateX(5px); }

footer {
  border-top: 3px solid var(--line-strong);
  box-shadow: 0 -5px 0 -4px var(--line);
  margin-top: 96px;
}

.footer-inner {
  max-width: 900px;
  margin: 0 auto;
  padding: 36px 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
}

.mark-footer { width: 30px; height: 30px; }
.mark-footer span { font-size: 0.66rem; }

.footer-line {
  font-family: var(--mono);
  font-size: 0.62rem;
  text-transform: uppercase;
  letter-spacing: 0.28em;
  color: var(--muted);
}

.footer-src {
  font-family: var(--mono);
  font-size: 0.62rem;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  color: var(--muted);
}
.footer-src:hover { color: var(--green); }

/* ------------------------------------------------------------ responsive */

/* keep breathing room around the frame before the mobile layout kicks in */
@media (max-width: 1012px) {
  main { margin-left: 16px; margin-right: 16px; }
}

/* stack the nav before its link row starts wrapping raggedly */
@media (max-width: 880px) {
  .nav-inner { height: auto; padding: 12px 20px; flex-direction: column; align-items: stretch; gap: 10px; }
  .nav-links { width: 100%; gap: 10px 14px; justify-content: center; margin-left: 0; }
  .theme-toggle { position: absolute; top: 10px; right: 16px; width: 28px; height: 28px; }
  section { scroll-margin-top: 130px; }
}

@media (max-width: 760px) {
  .nav-links a { font-size: 0.64rem; }

  main {
    margin: 14px 10px 0;
    padding: 0 22px;
    outline-offset: 3px;
  }

  .hero { padding-top: 52px; }
  /* the one-line name is unbreakable — its floor must scale with the viewport */
  .hero h1 { font-size: clamp(1.8rem, 8.6vw, 2.7rem); letter-spacing: 0.01em; }
  .portrait { width: 156px; height: 187px; margin-bottom: 26px; }
  .portrait-mono { font-size: 2rem; }

  section { margin: 76px 0; scroll-margin-top: 130px; }

  .section-head { gap: 14px; }
  h2 { font-size: 1.08rem; }
  h2::before { margin-right: 10px; }
  h2::after { margin-left: 10px; }

  .spec-strip { grid-template-columns: 1fr; }
  .spec + .spec { border-left: none; border-top: 1px solid var(--line); }

  .grid-2 { grid-template-columns: 1fr; }

  .fact { grid-template-columns: 1fr; gap: 5px; padding: 14px 0; }
  #about .fact dt { font-size: 1.02rem; }

  .timeline li { grid-template-columns: 1fr; gap: 6px; padding: 18px 0; }

  .pub-top { flex-direction: column; gap: 12px; }
  .stamp { transform: rotate(0deg); margin-top: 0; }

  .awards > li { flex-direction: column; gap: 4px; padding: 13px 0; }
  .award-year { width: auto; }

  .project-list > li { flex-direction: column; gap: 8px; }
  .project-meta { justify-content: flex-start; margin-top: 0; order: -1; }
  .project-head { flex-wrap: wrap; }
  /* the meta rows already wrap internally, but flex-shrink:0 pinned them to
     max-content, so on a narrow phone they pushed past the card edge instead
     of breaking onto a second line */
  .project-side,
  .project-meta { flex-shrink: 1; min-width: 0; }

  .tiles, .tiles-small { grid-template-columns: 1fr; }
  .figure-grid { grid-template-columns: 1fr; }
  .project-hero { padding-top: 44px; }
  .project-page .fact { grid-template-columns: 1fr; }
  .detail { margin: 56px 0; }

  .contact-mail { font-size: 1.02rem; }
}

/* narrow phones: tighten the nav row so seven links wrap evenly */
@media (max-width: 430px) {
  .nav-links { gap: 8px 12px; }
  .nav-links a { font-size: 0.6rem; letter-spacing: 0.08em; }
}

/* very narrow phones: let poster-band titles wrap instead of clipping */
@media (max-width: 380px) {
  h2 { white-space: normal; line-height: 1.3; }
  .section-head { gap: 10px; }
}

/* ------------------------------------------------------------ reduced motion */

@media (prefers-reduced-motion: reduce) {
  .live-dot { animation: none; }
  .card, .project-card, .tile, .btn, .mark, .pointer, .skip-link { transition: none; }
}

/* ------------------------------------------------------------ print */

@media print {
  :root, html[data-theme="day"] {
    --bg: #ffffff;
    --bg-raise: #ffffff;
    --bg-hover: #ffffff;
    --ink: #111111;
    --ink-soft: #222222;
    --muted: #555555;
    --line: #cccccc;
    --line-strong: #888888;
    --line-soft: #e5e5e5;
    --green: #1a7a10;
    --green-dim: #1a7a10;
    --gold: #7a6233;
    --gold-dim: #7a6233;
    --mod-emg: #9a4f10;
    --mod-emg-dim: #9a4f10;
    --mod-ppg: #a03434;
    --mod-ppg-dim: #a03434;
    --mod-vis: #106b80;
    --mod-vis-dim: #106b80;
    --mod-enc: #44586b;
    --mod-enc-dim: #44586b;
    --kw-ai: #5f3596;    --kw-ai-dim: #5f3596;
    --kw-sw: #6b6226;    --kw-sw-dim: #6b6226;
    --kw-app: #9c3f63;   --kw-app-dim: #9c3f63;
    --kw-py: #2d5f8a;    --kw-py-dim: #2d5f8a;
    --kw-rust: #8a4423;  --kw-rust-dim: #8a4423;
    --kw-kt: #8a5f10;    --kw-kt-dim: #8a5f10;
    --year: #4a4132;     --year-dim: #4a4132;
  }
  .theme-toggle { display: none; }
  .grain, .vignette, .nav { display: none; }
  .hero h1 { color: var(--ink); background: none; -webkit-background-clip: initial; background-clip: initial; }
  body { background: #ffffff; }
  section { margin: 40px 0; break-inside: avoid; }
}
