:root {
  color-scheme: dark;
  --pill: rgba(44, 41, 38, .82);
  --bg: #1a1816;
  --fg: #f2efe9;
  --mute: #9a948a;
  --line: #2c2926;
  --acc: #d9772f;
  --sans: 'Geist', system-ui, sans-serif;
  --mono: 'Geist Mono', ui-monospace, monospace;
}
/* Keep the light theme one step more specific than :root so bundlers,
   stylesheet order or injected CSS can never leave a big screen dark. */
:root[data-theme=light],
html[data-theme=light] {
  color-scheme: light;
  --pill: rgba(255, 255, 255, .82);
  --bg: #f5f3ef;
  --fg: #1c1a17;
  --mute: #6f6a61;
  --line: #e2ded6;
  --acc: #b85f1c;
}
:root[data-theme=dark],
html[data-theme=dark] { color-scheme: dark; }

* { box-sizing: border-box; }
/* Reserve the scrollbar track on every page. Without this, short pages like
   /blog have no scrollbar while other pages do, and the fixed, centered nav
   shifts a few pixels to the side when you navigate between them. */
html { scrollbar-gutter: stable; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font: 15px/1.7 var(--sans);
  transition: background .4s, color .4s;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }
.mono { font-family: var(--mono); }
:focus-visible { outline: 1px solid var(--fg); outline-offset: 4px; }

/* skip link */
.skip {
  position: fixed;
  top: 12px;
  left: 12px;
  z-index: 100;
  padding: 8px 14px;
  background: var(--fg);
  color: var(--bg);
  font: 500 12px var(--mono);
  border-radius: 4px;
  transform: translateY(-200%);
  transition: transform .2s;
}
.skip:focus { transform: none; }

/* nav — fixed, truly centered, symmetric */
nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 20;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 32px;
  padding: 28px 0;
  font: 500 13px var(--mono);
  pointer-events: none;
}
nav > * { pointer-events: auto; }
/* Project pages open on a dark hero. On desktop the fixed nav sits on top of it,
   so give the nav a theme-aware scrim; otherwise light-mode links disappear. */
body[data-page^="projects/"] nav::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 150px;
  z-index: -1;
  pointer-events: none;
  background: linear-gradient(to bottom, var(--bg) 0%, var(--bg) 34%, transparent 100%);
}
nav a { color: var(--mute); transition: color .2s; }
nav a:hover, nav a.on { color: var(--fg); }
nav button {
  all: unset;
  /* all: unset makes pointer-events inherit from the nav, which is none —
     restore it or real clicks fall through to the page behind the button. */
  pointer-events: auto;
  cursor: pointer;
  color: var(--mute);
  display: grid;
  place-items: center;
  width: 20px;
  height: 20px;
}
nav button:hover { color: var(--fg); }
/* theme toggle: sun in dark mode, moon in light mode */
.theme .i-moon { display: none; }
:root[data-theme=light] .theme .i-sun { display: none; }
:root[data-theme=light] .theme .i-moon { display: block; }

/* pond canvas */
#pond {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none;
}
main {
  position: relative;
  z-index: 1;
  min-height: 100vh;
}

/* typing */
.type {
  font: 400 13px/1.8 var(--mono);
  color: var(--mute);
  white-space: pre-line;
}
.type i {
  display: inline-block;
  width: 8px;
  height: 14px;
  background: var(--mute);
  vertical-align: -2px;
  margin-left: 4px;
  animation: blink 1.1s steps(1) infinite;
}
@keyframes blink { 50% { opacity: 0; } }

/* home */
.home {
  position: fixed;
  left: clamp(24px, 19.5vw, 320px);
  bottom: 12vh;
  right: 24px;
  font: 400 14px/1.8 var(--mono);
}
.home p { margin: 28px 0 0; }
.home .links { color: var(--mute); }
.u { border-bottom: 1px solid var(--mute); transition: border-color .2s; }
.u:hover { border-color: var(--fg); }

/* projects rail */
.rail {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  padding: 0 max(24px, 12vw);
  height: 100vh;
  align-items: center;
  scrollbar-width: none;
}
.rail::-webkit-scrollbar { display: none; }
.card { flex: none; width: min(62vw, 820px); }
.card .thumb {
  position: relative;
  aspect-ratio: 3/2;
  border-radius: 2px;
  overflow: hidden;
  background: var(--line);
}
.card .thumb > div {
  position: absolute;
  inset: 0;
  transition: transform .9s cubic-bezier(.2, .7, .2, 1);
}
.card:hover .thumb > div { transform: scale(1.03); }
.card .thumb b {
  position: absolute;
  left: 16px;
  bottom: 16px;
  font: 500 12px var(--mono);
  padding: 8px 14px;
  border-radius: 99px;
  background: rgba(0, 0, 0, .35);
  color: #fff;
  opacity: 0;
  transform: translateY(6px);
  transition: .35s;
}
.card:hover .thumb b { opacity: 1; transform: none; }
.card h3 { margin: 14px 0 2px; font: 500 15px var(--sans); }
.card h3 span { font: 400 11px var(--mono); color: var(--mute); margin-left: 8px; }
.card p { margin: 0; color: var(--mute); font-size: 14px; }

/* project detail */
.wrap { max-width: 900px; margin: 0 auto; padding: 0 24px; }
.hero { height: 42vh; min-height: 280px; }
.hero img { width: 100%; height: 100%; object-fit: cover; object-position: top; }
.ext { margin: 20px 0 0; font-size: 14px; }
.hero > div { height: 100%; mask-image: linear-gradient(#000 40%, transparent); }
.detail { padding-top: 70px; }
.back { font: 400 13px var(--mono); color: var(--mute); }
.detail h1 { margin: 56px 0 4px; font: 600 28px/1.2 var(--sans); letter-spacing: -.02em; }
.sub { color: var(--mute); font-size: 17px; margin: 0 0 40px; }
.lede { font-size: 17px; line-height: 1.75; max-width: 70ch; }
.shot { margin: 64px 0 12px; aspect-ratio: 16/9; border-radius: 4px; background: var(--line); overflow: hidden; }
.cap { color: var(--mute); font-size: 14px; margin: 0 0 72px; }
.cap b { color: var(--fg); font-weight: 600; }
.pn {
  display: flex;
  justify-content: space-between;
  border-top: 1px solid var(--line);
  margin-top: 96px;
  padding: 28px 0 120px;
  font: 400 12px var(--mono);
  color: var(--mute);
}
.pn a { display: block; color: var(--fg); font: 500 15px var(--sans); margin-top: 4px; }
.pn div:last-child { text-align: right; }

/* project detail extras */
.detail h2 {
  margin: 64px 0 10px;
  font: 600 18px/1.35 var(--sans);
  letter-spacing: -.01em;
}
.detail h2:first-of-type { margin-top: 56px; }
.detail p + h2 { margin-top: 72px; }
.detail ul:not(.chips) {
  max-width: 70ch;
  margin: 10px 0 0;
  padding-left: 18px;
}
.detail li { margin: 7px 0; }
.facts {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1px;
  margin: 44px 0 0;
  padding: 1px;
  background: var(--line);
  border: 1px solid var(--line);
}
.facts div { background: var(--bg); padding: 16px 18px; }
.facts dt {
  font: 500 10px/1.4 var(--mono);
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--mute);
}
.facts dd { margin: 6px 0 0; font-size: 14px; line-height: 1.5; }
.facts dd a { border-bottom: 1px solid var(--line); }
.facts dd a:hover { border-color: var(--fg); }
.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 20px 0 0;
  padding: 0;
  list-style: none;
}
.chips li {
  padding: 5px 10px;
  border: 1px solid var(--line);
  border-radius: 99px;
  color: var(--mute);
  font: 500 11px var(--mono);
}
/* screenshots keep a designed placeholder until the real image lands */
.shot { position: relative; }
.shot .ph {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 24px;
  text-align: center;
  font: 400 12px var(--mono);
  color: var(--mute);
  background: linear-gradient(135deg, #201d1a 0%, #3a332c 55%, #6b5a45 100%);
}
.shot img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.card .thumb img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform .9s cubic-bezier(.2, .7, .2, 1);
}
.card:hover .thumb img { transform: scale(1.03); }


/* gallery */
.gal { max-width: 1120px; margin: 0 auto; padding: 130px 24px 120px; }
.gal header { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 80px; }
.gal h2 { margin: 8px 0 0; font: 500 17px var(--sans); }
.grid { display: grid; grid-template-columns: 1.8fr 1fr; gap: 120px; align-items: start; }
.grid figure:nth-child(even) { margin-top: 110px; }
.grid figure:nth-child(3n) { grid-column: 2; }
.grid .ph { background: var(--line); border-radius: 2px; overflow: hidden; }
.grid img { width: 100%; height: 100%; object-fit: cover; }
figcaption {
  display: flex;
  justify-content: space-between;
  margin-top: 12px;
  font: 400 12px var(--mono);
  color: var(--mute);
}
figcaption b { color: var(--fg); font-weight: 500; }

/* centered */
.center { height: 100vh; display: grid; place-items: center; }

/* count — fixed right gutter, never fights nav */
.count {
  position: fixed;
  top: 28px;
  right: max(24px, calc((100vw - 1200px) / 2));
  z-index: 2;
  display: flex;
  flex-direction: column;
  font: 400 12px/1.25 var(--mono);
  color: var(--mute);
  text-align: right;
}

/* mobile bar + fullscreen menu (hidden by default) */
.mbar, .menu { display: none; }
nav button.theme, .mfoot button {
  all: unset;
  pointer-events: auto;
  cursor: pointer;
  display: grid;
  place-items: center;
  width: 20px;
  height: 20px;
  color: var(--mute);
}

@media (max-width: 800px) {
  .grid { grid-template-columns: 1fr; gap: 56px; }
  .grid figure { grid-column: auto !important; margin-top: 0 !important; }
  .card { width: 82vw; }
  .home { bottom: 8vh; }
  .facts { grid-template-columns: 1fr 1fr; }
  nav { display: none; gap: 20px; }
  .count { left: 22px; right: auto; top: 80px; text-align: left; }

  .mbar {
    display: flex;
    position: fixed;
    z-index: 30;
    top: 10px;
    left: 10px;
    right: 10px;
    height: 52px;
    padding: 0 8px 0 20px;
    align-items: center;
    justify-content: space-between;
    border-radius: 99px;
    background: var(--pill);
    border: 1px solid var(--line);
    -webkit-backdrop-filter: blur(14px);
    backdrop-filter: blur(14px);
  }
  .mname { font: 500 15px var(--sans); }
  .mbtn {
    all: unset;
    cursor: pointer;
    width: 40px;
    height: 40px;
    display: grid;
    place-items: center;
    color: var(--mute);
    border-radius: 50%;
  }
  .mbtn .i-x,
  .mbtn[aria-expanded=true] .i-dots { display: none; }
  .mbtn[aria-expanded=true] .i-x { display: block; }

  .menu {
    display: flex;
    position: fixed;
    inset: 0;
    z-index: 25;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: var(--bg);
    visibility: hidden;
    opacity: 0;
  }
  .menu[aria-hidden=false] { visibility: visible; }
  .mlinks {
    display: flex;
    flex-direction: column;
    align-items: center;
    font: 500 clamp(46px, 16vw, 66px) / 1.08 'Playfair Display', Georgia, serif;
    letter-spacing: -.01em;
    text-align: center;
  }
  .mfoot {
    position: absolute;
    bottom: 88px;
    display: flex;
    gap: 40px;
    align-items: center;
    font: 400 14px var(--sans);
    color: var(--mute);
  }
  .mfoot a span { font-size: 11px; }
  .mfoot a:hover, .mfoot button:hover { color: var(--fg); }
}

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}