/* ==========================================================================
   josiahjardine.com
   Type: Archivo (variable weight + width, OFL). Condensed semibold for display,
   Black for emphasis, regular for body. Geist Mono for small labels.
   Icons: Phosphor (regular) via /icons.svg sprite.
   Shape rule: media and tiles are 7px; controls use a quarter of their height.
   Z-index scale: -2/-1 = hero image/scrim, 1 = tile arrow, 10 = sticky nav, 100 = skip link.
   ========================================================================== */

@font-face {
  font-family: "Archivo";
  src: url("/fonts/archivo.woff2") format("woff2-variations"), url("/fonts/archivo.woff2") format("woff2");
  font-weight: 100 900;
  font-stretch: 62% 125%;
  font-display: swap;
}
@font-face {
  font-family: "Geist Mono";
  src: url("/fonts/geist-mono.woff2") format("woff2");
  font-weight: 100 900;
  font-display: swap;
}

:root {
  /* Palette sampled from a Barbican Estate photo at dusk: slate-blue sky,
     board-marked concrete, planter greenery. Sage/moss is the one accent. */
  --bg: #e9edef;
  --surface: #f5f7f8;
  --surface-2: #dde3e6;
  --ink: #161b18;
  --muted: #53605e;
  --line: #cfd6da;
  --accent: #3d6a43;
  --on-accent: #f2f5f1;
  --code-bg: #1b241f;
  --code-ink: #e3e8e6;
  --code-mute: #8a9a94;
  --code-hi: #8fb08a;
  --code-body: #9aa6a8;
  --shot-bg: #1b241f;
  --shadow: 0 1px 2px rgb(22 27 24 / 0.06), 0 12px 32px -12px rgb(40 55 60 / 0.22);
  --nav-bg: rgb(233 237 239 / 0.78);

  --font: "Archivo", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "Geist Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;
  --hero-ink: #eef1f2;
  --logo: url("/img/logo-black.png");
  --hero-accent: #8fb08a;

  --r: 7px;
  --gutter: clamp(16px, 4vw, 40px);
  --section: clamp(72px, 10vw, 128px);
  --ease: cubic-bezier(0.16, 1, 0.3, 1);

  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #121614;
    --surface: #1b201d;
    --surface-2: #232a26;
    --ink: #e3e8e6;
    --muted: #9aa6a8;
    --line: #2c3430;
    --accent: #8fb08a;
    --on-accent: #101410;
    --code-bg: #0e1310;
    --shot-bg: #0e1310;
    --shadow: 0 1px 2px rgb(0 0 0 / 0.3), 0 12px 32px -12px rgb(0 0 0 / 0.6);
    --nav-bg: rgb(18 22 20 / 0.72);
    --logo: url("/img/logo-white.png");
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #121614;
  --surface: #1b201d;
  --surface-2: #232a26;
  --ink: #e3e8e6;
  --muted: #9aa6a8;
  --line: #2c3430;
  --accent: #8fb08a;
  --on-accent: #101410;
  --code-bg: #0e1310;
  --shot-bg: #0e1310;
  --shadow: 0 1px 2px rgb(0 0 0 / 0.3), 0 12px 32px -12px rgb(0 0 0 / 0.6);
  --nav-bg: rgb(18 22 20 / 0.72);
  --logo: url("/img/logo-white.png");
  color-scheme: dark;
}

/* ---------- base ---------- */

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: 80px; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 17px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}
img { display: block; max-width: 100%; height: auto; }
a { color: inherit; }
h1, h2, h3, p, ul, ol, dl, dd, figure, pre { margin: 0; }
ul, ol { padding: 0; list-style: none; }
::selection { background: var(--accent); color: var(--on-accent); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 2px; }

.wrap {
  width: 100%;
  max-width: 1180px;
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.i { width: 1em; height: 1em; flex: none; }

h2 {
  font-size: clamp(2.6rem, 6vw, 4.75rem);
  line-height: 0.9;
  font-weight: 600;
  font-stretch: 62%;
  text-transform: uppercase;
  letter-spacing: -0.005em;
}
h3 { font-size: 1.15rem; line-height: 1.25; font-weight: 800; letter-spacing: -0.015em; }

.skip {
  position: absolute; left: 16px; top: -48px; z-index: 100;
  background: var(--ink); color: var(--bg); padding: 8px 14px; border-radius: 6px;
  text-decoration: none; font-size: 14px;
}
.skip:focus { top: 12px; }

/* ---------- buttons & links ---------- */

.btn {
  display: inline-flex; align-items: center; gap: 8px;
  height: 46px; padding: 0 22px;
  border-radius: 11px;
  font: 600 15px/1 var(--font);
  text-decoration: none; white-space: nowrap;
  transition: transform 0.4s var(--ease), background-color 0.2s, border-color 0.2s, color 0.2s;
}
.btn .i { font-size: 18px; }
.btn:active { transform: scale(0.98); }
.btn-primary { background: var(--ink); color: var(--bg); }
.btn-primary:hover { background: var(--accent); color: var(--on-accent); }
.btn-quiet { color: var(--ink); border: 1px solid var(--line); background: transparent; }
.btn-quiet:hover { border-color: var(--ink); }

.link-arrow {
  display: inline-flex; align-items: center; gap: 6px;
  font-weight: 500; text-decoration: none;
  border-bottom: 1px solid var(--line);
  padding-bottom: 2px;
  transition: border-color 0.2s, color 0.2s;
}
.link-arrow .i { transition: transform 0.4s var(--ease); }
.link-arrow:hover { color: var(--accent); border-color: currentColor; }
.link-arrow:hover .i { transform: translate(2px, -2px); }

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

.nav {
  position: sticky; top: 0; z-index: 10;
  background: var(--nav-bg);
  -webkit-backdrop-filter: saturate(1.4) blur(14px);
  backdrop-filter: saturate(1.4) blur(14px);
  border-bottom: 1px solid color-mix(in srgb, var(--line) 70%, transparent);
}
@media (prefers-reduced-transparency: reduce) { .nav { background: var(--bg); backdrop-filter: none; } }
.nav-inner { display: flex; align-items: center; gap: 24px; height: 64px; max-width: none; }
.brand { display: inline-flex; align-items: center; gap: 12px; text-decoration: none; margin-right: auto; }
/* J monogram: black on light, white on dark and over the hero photo. */
.brand-logo {
  display: block;
  width: 40px; height: 40px;
  background: var(--logo) center / contain no-repeat;
  transition: transform 0.4s var(--ease), opacity 0.2s;
}
.brand:hover .brand-logo { transform: translateY(-1px) rotate(-4deg); }
.nav-links { display: flex; gap: 4px; }
.nav-links a {
  display: block; padding: 8px 12px; border-radius: 8px;
  font-size: 15px; color: var(--muted); text-decoration: none;
  transition: color 0.2s, background-color 0.2s;
}
.nav-links a:hover { color: var(--ink); background: var(--surface-2); }
.theme-toggle {
  display: grid; place-items: center;
  width: 38px; height: 38px; margin-right: -8px;
  border: 0; border-radius: 9px; background: transparent; color: var(--muted);
  cursor: pointer; font-size: 18px;
  transition: color 0.2s, background-color 0.2s;
}
.theme-toggle:hover { color: var(--ink); background: var(--surface-2); }
.theme-toggle .i-sun { display: none; }
:root[data-theme="dark"] .theme-toggle .i-sun { display: block; }
:root[data-theme="dark"] .theme-toggle .i-moon { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-toggle .i-sun { display: block; }
  :root:not([data-theme="light"]) .theme-toggle .i-moon { display: none; }
}

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

/* Full-bleed photo with the copy set on top of it, poster style. The hero
   stays dark in both themes, so its text uses fixed light tokens. */
.hero {
  position: relative;
  isolation: isolate;
  display: flex;
  min-height: 100svh;
  margin-top: -64px;
  overflow: hidden;
  background: #1b241f;
  color: var(--hero-ink);
}
.hero-bg { position: absolute; inset: 0; z-index: -2; width: 100%; height: 100%; object-fit: cover; }
.hero-scrim {
  position: absolute; inset: 0; z-index: -1;
  background:
    linear-gradient(to bottom, rgb(18 22 20 / 0.55) 0%, rgb(18 22 20 / 0) 18%),
    linear-gradient(to top, rgb(18 22 20 / 0.82) 0%, rgb(18 22 20 / 0.45) 38%, rgb(18 22 20 / 0) 62%);
}
.hero-inner {
  display: flex; flex-direction: column; justify-content: flex-end;
  width: 100%;
  padding: 120px var(--gutter) clamp(16px, 2.4vw, 32px);
}
.hero-copy { max-width: 1180px; }
/* Round portrait next to the name. */
.hero-id { display: flex; align-items: center; gap: clamp(20px, 2.4vw, 32px); }
.avatar {
  flex: none;
  width: clamp(112px, 11vw, 168px);
  height: auto;
  aspect-ratio: 1;
  border-radius: 50%;
  object-fit: cover;
  box-shadow: 0 0 0 3px rgb(238 241 242 / 0.9), 0 0 0 9px rgb(143 176 138 / 0.35), 0 24px 50px -18px rgb(0 0 0 / 0.7);
}
.hero-id h1 {
  font-size: clamp(2.4rem, 4.6vw, 4.4rem);
  font-weight: 900;
  line-height: 0.95;
  letter-spacing: -0.04em;
}
.lede {
  margin-top: 26px;
  max-width: 36ch;
  font-size: clamp(1.05rem, 1.5vw, 1.25rem);
  line-height: 1.5;
  color: rgb(238 241 242 / 0.84);
}
.ctas { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 28px; }
.hero .btn-primary { background: var(--hero-ink); color: #161b18; }
.hero .btn-primary:hover { background: var(--hero-accent); color: #101410; }
.hero .btn-quiet { color: var(--hero-ink); border-color: rgb(238 241 242 / 0.5); }
.hero .btn-quiet:hover { border-color: var(--hero-ink); background: rgb(238 241 242 / 0.08); }
.hero-end { position: absolute; bottom: 0; left: 0; width: 1px; height: 1px; }

/* Nav sits transparent over the photo until the hero scrolls away (main.js). */
.nav { transition: background-color 0.3s, border-color 0.3s; }
.nav.over-hero { background: transparent; border-bottom-color: transparent; -webkit-backdrop-filter: none; backdrop-filter: none; }
.nav.over-hero .theme-toggle { color: var(--hero-ink); }
.nav.over-hero .brand-logo { background-image: url("/img/logo-white.png"); }
.nav.over-hero .nav-links a { color: rgb(238 241 242 / 0.82); }
.nav.over-hero .nav-links a:hover, .nav.over-hero .theme-toggle:hover { color: var(--hero-ink); background: rgb(238 241 242 / 0.14); }

/* ---------- right now ---------- */

.now { padding-block: var(--section) 0; }
.now-list { margin-top: 32px; max-width: 820px; }
.now-list > div {
  display: grid;
  grid-template-columns: 140px minmax(0, 1fr);
  gap: 24px;
  padding-block: 18px;
  border-top: 1px solid var(--line);
}
.now-list dt {
  font: 500 15px/1.9 var(--mono);
  color: var(--accent);
}
.now-list dd { font-size: clamp(1.05rem, 1.5vw, 1.2rem); line-height: 1.55; }
.now-list a, .skill a { text-decoration-color: var(--accent); text-underline-offset: 3px; text-decoration-thickness: 1.5px; }
.now-list a:hover { color: var(--accent); }

/* ---------- hermie feature ---------- */

.feature {
  display: grid;
  grid-template-columns: minmax(0, 7fr) minmax(0, 5fr);
  gap: clamp(28px, 4vw, 56px);
  align-items: center;
  padding-block: var(--section) 0;
}
.feature-media {
  display: block;
  border-radius: var(--r);
  overflow: hidden;
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  background: #b7cbe3;
}
.feature-media img { width: 100%; transition: transform 0.9s var(--ease); }
.feature-media:hover img { transform: scale(1.02); }
.feature-copy > p { margin-top: 16px; color: var(--muted); max-width: 46ch; }
.facts { margin-top: 28px; display: grid; gap: 18px; }
.facts > div { display: grid; grid-template-columns: 64px minmax(0, 1fr); gap: 16px; }
.facts dt { font: 500 13px/1.9 var(--mono); color: var(--muted); text-transform: lowercase; }
.facts dd { font-size: 15.5px; line-height: 1.6; }
.feature-copy .link-arrow { margin-top: 28px; }

/* ---------- bento ---------- */

.work { padding-block: var(--section) 0; }
.bento {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  margin-top: 32px;
}
.span-2 { grid-column: span 2; }
.tile {
  position: relative;
  display: flex; flex-direction: column;
  border-radius: var(--r);
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--line);
  text-decoration: none;
  transition: transform 0.5s var(--ease), box-shadow 0.5s var(--ease), border-color 0.2s;
}
.tile:hover { transform: translateY(-3px); box-shadow: var(--shadow); }
.tile-media { overflow: hidden; background: var(--surface-2); }
.tile-media img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.9s var(--ease); }
.tile:hover .tile-media img { transform: scale(1.025); }
.tile-body { padding: 20px 22px 22px; }
.tile-body p { margin-top: 6px; font-size: 15px; line-height: 1.55; color: var(--muted); }
.tile-body .tile-kicker { margin: 0 0 10px; font: 500 12.5px/1.4 var(--mono); }
.year { font: 500 13px/1 var(--mono); color: var(--muted); margin-left: 6px; }
.tile-arrow {
  position: absolute; top: 14px; right: 14px; z-index: 1;
  width: 34px; height: 34px; padding: 9px;
  border-radius: 8px;
  background: var(--surface); color: var(--ink);
  box-shadow: var(--shadow);
  opacity: 0; transform: translate(-4px, 4px);
  transition: opacity 0.3s, transform 0.5s var(--ease);
}
.tile:hover .tile-arrow, .tile:focus-visible .tile-arrow { opacity: 1; transform: none; }

.tile-photo .tile-media { aspect-ratio: 16 / 9; }
.tile-shot .tile-media { flex: 1; min-height: 220px; background: var(--shot-bg); padding: 16px 16px 0; }
.tile-shot .tile-media img { border-radius: 4px 4px 0 0; object-fit: cover; object-position: top left; }

/* Marketing Meteor in its own brand colors: near-black with electric blue. */
.tile-accent {
  justify-content: flex-end;
  min-height: 280px;
  border-color: rgb(255 255 255 / 0.08);
  background:
    radial-gradient(120% 90% at 100% 0%, rgb(0 85 255 / 0.55) 0%, rgb(0 85 255 / 0.12) 45%, transparent 70%),
    #080808;
}
.tile-accent:hover { border-color: rgb(0 85 255 / 0.5); }
.tile-accent .tile-body { padding: 26px; }
.tile-accent h3 { font-size: 2rem; font-weight: 900; letter-spacing: -0.035em; color: #ffffff; }
.tile-accent .tile-body p { color: rgb(255 255 255 / 0.66); }
.tile-accent .tile-body .tile-kicker { color: #0099ff; }

.tile-code { background: var(--code-bg); border-color: transparent; }
.tile-code .code {
  flex: 1;
  padding: 26px 24px 8px;
  font: 400 13.5px/1.75 var(--mono);
  color: var(--code-ink);
  white-space: pre-wrap;
  word-break: break-word;
}
.c-mute { color: var(--code-mute); }
.c-hi { color: var(--code-hi); }
.tile-code h3 { color: var(--code-ink); }
.tile-code .tile-body p { color: var(--code-body); }

.tile-mono { justify-content: space-between; min-height: 280px; background: var(--surface-2); }
.prompt {
  padding: 24px 22px 0;
  font: 500 clamp(2.2rem, 3.6vw, 3rem)/1 var(--mono);
  color: var(--ink);
  letter-spacing: -0.02em;
}
.prompt span { color: var(--accent); }
.tile-mono .tile-kicker { color: var(--muted); }
@media (prefers-reduced-motion: no-preference) {
  .prompt span { animation: blink 1.1s steps(1) infinite; }
}
@keyframes blink { 50% { opacity: 0; } }

.more { margin-top: 28px; }

/* ---------- writing ---------- */

.writing { padding-block: var(--section) 0; }
.posts { margin-top: 24px; }
.posts li + li { border-top: 1px solid var(--line); }
.posts a {
  position: relative;
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr) 220px;
  align-items: baseline;
  gap: 24px;
  padding-block: 26px;
  text-decoration: none;
}
.post-year, .post-tag { font: 500 13px/1 var(--mono); color: var(--muted); }
.post-tag { justify-self: end; transition: opacity 0.2s; }
.posts a:hover .post-tag { opacity: 0; }
.post-title {
  font-size: clamp(1.3rem, 2.4vw, 2rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.2;
  transition: color 0.2s, transform 0.5s var(--ease);
}
.posts a:hover .post-title { color: var(--accent); transform: translateX(6px); }
.peek {
  position: absolute; right: 0; top: 50%;
  width: 200px; aspect-ratio: 16 / 10; object-fit: cover;
  border-radius: 5px;
  box-shadow: var(--shadow);
  opacity: 0; pointer-events: none;
  transform: translateY(-50%) rotate(3deg) scale(0.92);
  transition: opacity 0.3s, transform 0.6s var(--ease);
}
.posts a:hover .peek { opacity: 1; transform: translateY(-50%) rotate(-2deg) scale(1); }

/* ---------- skills ---------- */

.skills { padding-block: var(--section) 0; }
.skill-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 48px clamp(32px, 6vw, 96px);
  margin-top: 40px;
}
.skill { border-top: 1px solid var(--ink); padding-top: 22px; }
.skill-icon { font-size: 26px; color: var(--accent); }
.skill h3 { margin-top: 18px; font-size: 1.5rem; font-weight: 900; letter-spacing: -0.03em; }
.skill p { margin-top: 10px; color: var(--muted); max-width: 48ch; }

/* ---------- photography + reading ---------- */

.elsewhere { padding-block: var(--section) 0; }
.elsewhere-grid {
  display: grid;
  grid-template-columns: minmax(0, 7fr) minmax(0, 5fr);
  gap: 16px;
  margin-top: 32px;
  align-items: end;
}
.shelf { display: block; text-decoration: none; }
.shelf-media { border-radius: var(--r); overflow: hidden; background: var(--surface-2); aspect-ratio: 4 / 3; }
.shelf-wide .shelf-media { aspect-ratio: 3 / 2; }
.shelf-media img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.9s var(--ease); }
.shelf:hover .shelf-media img { transform: scale(1.03); }
.shelf-caption { display: flex; align-items: center; gap: 10px; margin-top: 14px; font-weight: 500; }
.shelf-caption .i { font-size: 18px; color: var(--muted); }
.shelf-arrow { margin-left: auto; transition: transform 0.4s var(--ease); }
.shelf:hover .shelf-arrow { transform: translateX(4px); color: var(--accent); }

/* ---------- contact ---------- */

.contact { padding-block: var(--section); }
.email {
  display: inline-block;
  margin-top: 18px;
  font-size: clamp(1.6rem, 5.4vw, 4.25rem);
  font-weight: 900;
  letter-spacing: -0.045em;
  line-height: 1.05;
  text-decoration: none;
  overflow-wrap: anywhere;
  background: linear-gradient(currentColor, currentColor) 0 100% / 0 2px no-repeat;
  transition: color 0.2s, background-size 0.6s var(--ease);
  padding-bottom: 4px;
}
.email:hover { color: var(--accent); background-size: 100% 2px; }
.contact-row { display: flex; flex-wrap: wrap; align-items: center; gap: 16px 32px; margin-top: 36px; }
.hours { font: 500 14px/1.4 var(--mono); }
.hours span { color: var(--muted); margin-right: 8px; }
.socials { display: flex; gap: 4px; margin-left: auto; }
.socials a {
  display: grid; place-items: center;
  width: 44px; height: 44px; border-radius: 11px;
  font-size: 20px; color: var(--muted);
  transition: color 0.2s, background-color 0.2s;
}
.socials a:hover { color: var(--ink); background: var(--surface-2); }

/* ---------- footer ---------- */

.footer { border-top: 1px solid var(--line); padding-block: 40px 28px; overflow: hidden; }
.wordmark {
  font: 600 min(calc((100vw - 2 * var(--gutter)) / 5.6), 12.25rem)/0.82 var(--font);
  font-stretch: 62%;
  text-transform: uppercase;
  letter-spacing: -0.005em;
  white-space: nowrap;
  color: var(--ink);
  user-select: none;
}
.footer-row {
  display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px 24px;
  margin-top: 28px;
  font-size: 14px; color: var(--muted);
}
.footer-row a { text-underline-offset: 3px; }
.footer-row a:hover { color: var(--ink); }

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

@media (prefers-reduced-motion: no-preference) {
  .js .enter { opacity: 0; transform: translateY(18px); animation: enter 0.9s var(--ease) forwards; }
  .js .hero-id.enter { animation-delay: 0.1s; }
  .js .lede.enter { animation-delay: 0.2s; }
  .js .ctas.enter { animation-delay: 0.3s; }
  .js .hero-bg { animation: settle 1.8s var(--ease) both; }

  .js .reveal { opacity: 0; transform: translateY(20px); transition: opacity 0.8s var(--ease), transform 0.8s var(--ease); }
  .js .reveal.in { opacity: 1; transform: none; }
  .js .bento .reveal.in, .js .posts .reveal.in, .js .skill-grid .reveal.in, .js .elsewhere-grid .reveal.in { transition-delay: calc(var(--n, 0) * 70ms); }
  .js .tile.reveal.in { transition: opacity 0.8s var(--ease), transform 0.5s var(--ease), box-shadow 0.5s var(--ease), border-color 0.2s; }
  .js .tile.reveal.in:hover { transform: translateY(-3px); }
}
@keyframes enter { to { opacity: 1; transform: none; } }
@keyframes settle { from { transform: scale(1.06); } to { transform: none; } }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; }
  .tile:hover, .posts a:hover .post-title { transform: none; }
}

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

@media (max-width: 900px) {
  .feature { grid-template-columns: 1fr; }
  .bento { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .tile-accent, .tile-mono { min-height: 240px; }
  .peek { display: none; }
}

@media (max-width: 767px) {
  body { font-size: 16px; }
  .nav-inner { gap: 8px; height: 60px; }
  .hero { margin-top: -60px; min-height: 92svh; }
  .hero-id { flex-direction: column; align-items: flex-start; gap: 18px; }
  .nav-links a { padding: 8px 9px; font-size: 14.5px; }
  .bento, .elsewhere-grid, .skill-grid { grid-template-columns: 1fr; }
  .span-2 { grid-column: auto; }
  .now-list > div { grid-template-columns: 1fr; gap: 2px; padding-block: 16px; }
  .posts a { grid-template-columns: 1fr; gap: 8px; padding-block: 22px; }
  .post-tag { display: none; }
  .skill-grid { gap: 36px; }
  .elsewhere-grid { row-gap: 32px; }
  .socials { margin-left: -10px; }
  .contact-row { flex-direction: column; align-items: flex-start; }
  .tile-arrow { opacity: 1; transform: none; }
}

@media (max-width: 380px) {
  .nav-links a { padding: 8px 6px; font-size: 14px; }
}

/* ---------- 404 ---------- */

.notfound { min-height: 100dvh; display: flex; flex-direction: column; justify-content: center; align-items: flex-start; gap: 20px; }
.notfound .notfound-code { font: 600 clamp(6rem, 26vw, 16rem)/0.8 var(--font); font-stretch: 62%; color: var(--accent); }
.notfound h1 { font-size: clamp(1.75rem, 4vw, 2.75rem); font-weight: 900; letter-spacing: -0.035em; line-height: 1.1; }
.notfound p { color: var(--muted); max-width: 44ch; }
.notfound p a { color: var(--ink); text-underline-offset: 3px; }
.notfound .btn { margin-top: 12px; }

/* ---------- posts (/writing/*, /projects/*) ---------- */

/* One reading column, no chrome: title, a meta line, then text. */
.post { max-width: 680px; margin-inline: auto; padding: clamp(40px, 7vw, 88px) var(--gutter) var(--section); }
.post-back {
  display: inline-flex; align-items: center; gap: 8px;
  font: 500 13px/1 var(--mono); color: var(--muted); text-decoration: none;
}
.post-back .i { transform: rotate(180deg); transition: transform 0.4s var(--ease); }
.post-back:hover { color: var(--accent); }
.post-back:hover .i { transform: rotate(180deg) translateX(3px); }
.post h1 {
  margin-top: 28px;
  font-size: clamp(2.2rem, 5.4vw, 3.4rem);
  font-weight: 900;
  line-height: 1;
  letter-spacing: -0.04em;
  text-wrap: balance;
}
.post-meta { margin-top: 16px; font: 500 13px/1.4 var(--mono); color: var(--muted); }
.post-meta span + span::before { content: "/"; margin: 0 10px; color: var(--line); }
.post-body { margin-top: 40px; padding-top: 32px; border-top: 1px solid var(--line); font-size: 18px; line-height: 1.75; }
.post-body > * + * { margin-top: 1.1em; }
.post-body h2 { margin-top: 1.8em; font-size: clamp(1.7rem, 3.4vw, 2.2rem); }
.post-body a { color: var(--ink); text-decoration-color: var(--accent); text-underline-offset: 3px; text-decoration-thickness: 1.5px; }
.post-body a:hover { color: var(--accent); }
.post-body ul { padding-left: 1.2em; list-style: disc; }
.post-body li + li { margin-top: 0.4em; }
.post-body blockquote { margin-inline: 0; padding-left: 20px; border-left: 3px solid var(--accent); color: var(--muted); }
.post-log { list-style: none !important; padding: 0 !important; }
.post-log li { display: grid; grid-template-columns: 110px minmax(0, 1fr); gap: 16px; padding-block: 12px; border-top: 1px solid var(--line); }
.post-log li + li { margin-top: 0; }
.post-log time { font: 500 13px/1.9 var(--mono); color: var(--accent); }
.post-foot { margin-top: 56px; padding-top: 24px; border-top: 1px solid var(--line); font-size: 15px; color: var(--muted); }
.post-foot a { color: var(--ink); text-underline-offset: 3px; }
@media (max-width: 767px) {
  .post-body { font-size: 17px; }
  .post-log li { grid-template-columns: 1fr; gap: 2px; }
}

/* ---------- photos + reading list ---------- */

.post--wide { max-width: 1180px; }
.post--wide .post-back, .post--wide h1, .post--wide .post-meta { max-width: 680px; }
/* Portraits three to a row, landscapes two to a row. */
.gallery { margin-top: 40px; display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 16px; }
.gallery a { grid-column: span 2; display: block; border-radius: var(--r); overflow: hidden; background: var(--surface-2); }
.gallery a.wide { grid-column: span 3; }
.gallery img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.9s var(--ease); }
@media (max-width: 767px) {
  .gallery { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .gallery a { grid-column: span 1; }
  .gallery a.wide { grid-column: span 2; }
}
.gallery a:hover img { transform: scale(1.02); }

/* Figures inside posts; portrait shots stay narrower so they don't tower. */
.post-cover { margin-top: 32px; }
.post-cover img, .post-body figure img { width: 100%; border-radius: var(--r); background: var(--surface-2); }
.post-body figure { margin: 2em 0; }
.post-cover.portrait img, .post-body figure.portrait img { max-width: 460px; margin-inline: auto; }
.post-cover + .post-body { margin-top: 32px; }
.books-grid { margin-top: 40px; display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 32px 20px; }
.books-grid img { width: 100%; aspect-ratio: 2 / 3; object-fit: cover; border-radius: 4px; box-shadow: var(--shadow); background: var(--surface-2); }
.books-grid figcaption { margin-top: 10px; font-size: 14.5px; line-height: 1.35; font-weight: 700; letter-spacing: -0.01em; }
.books-grid figcaption span { display: block; margin-top: 3px; font: 500 12px/1.4 var(--mono); color: var(--muted); }
@media (max-width: 767px) { .books-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* ---------- /writing index: two-column cards, like the old blog ---------- */

.cards { margin-top: 40px; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 40px 24px; }
.card { display: block; text-decoration: none; }
.card-media { aspect-ratio: 16 / 10; border-radius: var(--r); overflow: hidden; background: var(--surface-2); }
.card-media img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.9s var(--ease); }
.card:hover .card-media img { transform: scale(1.03); }
.card-meta { margin-top: 16px; font: 500 13px/1.4 var(--mono); color: var(--muted); }
.card-meta span + span::before { content: "/"; margin: 0 10px; color: var(--line); }
.card h2 {
  margin-top: 8px;
  font-size: clamp(1.35rem, 2.2vw, 1.75rem);
  font-weight: 800;
  font-stretch: 100%;
  text-transform: none;
  line-height: 1.15;
  letter-spacing: -0.03em;
  transition: color 0.2s;
}
.card:hover h2 { color: var(--accent); }
@media (max-width: 767px) { .cards { grid-template-columns: 1fr; gap: 32px; } }
