/* Portfolio home: full-screen dithered photo, name bottom-left. */
.hero {
  position: relative;
  display: flex;
  align-items: flex-end;
  height: 100svh;
  min-height: 520px;
  overflow: hidden;
}

.backdrop {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  image-rendering: pixelated; /* the canvas renders at half resolution */
}

/* Shade behind the name, then a dissolve into the page so the hero flows into the projects. */
.hero::before, .hero::after {
  content: "";
  position: absolute;
  z-index: 1;
  pointer-events: none;
}
.hero::before {
  inset: 0;
  background: radial-gradient(ellipse 55% 42% at 8% 92%, hsl(13 53% 3% / .65), hsl(13 53% 3% / 0) 70%);
}
.hero::after {
  inset: auto 0 0;
  height: 42%;
  background: linear-gradient(to bottom, hsl(13 53% 3% / 0), hsl(13 53% 3% / .65) 55%, var(--bg));
}

.intro {
  position: relative;
  z-index: 2;
  width: 100%;
  padding: 0 clamp(20px, 5vw, 72px) clamp(72px, 11vh, 112px);
}

/* A caption, not a poster: one line, the photo stays the hero. */
.name {
  font-family: var(--serif);
  font-size: clamp(36px, 4.4vw, 60px);
  font-weight: 400;
  line-height: 1;
  letter-spacing: -.01em;
}
.name em { color: hsl(var(--fg) / .72); }

/* Frosted capsule so the small text stays legible over the moving dither. */
.meta {
  display: flex;
  align-items: center;
  gap: 6px;
  width: fit-content;
  margin-top: clamp(16px, 3vh, 28px);
  padding: 4px;
  border-radius: 10px;
  background: hsl(13 53% 3% / .55);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
}
.meta .role { border-radius: 6px; background: hsl(var(--fg) / .07); color: hsl(var(--fg) / .6); }

.links { display: flex; gap: 2px; }
.links a {
  padding: 4px 6px;
  font-size: 11px;
  color: hsl(var(--fg) / .45);
  transition: color .2s;
}
.links a:hover { color: hsl(var(--fg)); }

.name { text-shadow: 0 2px 28px hsl(13 53% 3% / .55); }

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

.scroll-cue {
  position: absolute;
  z-index: 2;
  bottom: 22px;
  left: 50%;
  translate: -50% 0;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 16px;
  color: hsl(var(--fg) / .6);
  text-shadow: 0 1px 12px hsl(13 53% 3% / .6);
  transition: color .2s;
}
.scroll-cue:hover { color: hsl(var(--fg)); }

.photo-credit {
  position: absolute;
  z-index: 2;
  top: 18px;
  right: clamp(20px, 5vw, 72px);
  font-size: 11px;
  color: hsl(var(--fg) / .4);
  text-shadow: 0 1px 8px hsl(13 53% 3% / .7);
}
.scroll-cue svg { animation: nudge 2.4s ease-in-out infinite; }
@keyframes nudge { 50% { transform: translateY(3px); } }

/* ---------- Sections ---------- */
.section { padding: clamp(72px, 14vh, 160px) clamp(20px, 5vw, 72px) clamp(48px, 8vh, 96px); }
.section + .section { padding-top: clamp(40px, 8vh, 96px); }

.section-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px 24px;
  max-width: 1280px;
  margin-bottom: clamp(24px, 4vh, 40px);
}
.section-title {
  font-family: var(--serif);
  font-size: clamp(44px, 6vw, 84px);
  font-weight: 400;
  line-height: .9;
  letter-spacing: -.02em;
}
.section-note { font-size: 12px; color: hsl(var(--fg) / .45); }
.section-note a {
  color: hsl(var(--fg) / .75);
  text-decoration: underline;
  text-decoration-color: hsl(var(--fg) / .25);
  text-underline-offset: 3px;
  transition: color .2s;
}
.section-note a:hover { color: hsl(var(--fg)); }

.project-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 340px), 1fr));
  gap: 14px;
  max-width: 1280px;
  padding: 0;
  list-style: none;
}

.card {
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100%;
  padding: 6px;
  border: 1px solid hsl(var(--fg) / .08);
  border-radius: 16px;
  background: hsl(var(--fg) / .02);
  text-align: left;
  transition: background-color .25s, border-color .25s, scale .2s;
}
.card:hover { border-color: hsl(var(--fg) / .16); background: var(--row-hover); }
.card:active { scale: .985; }

.card-cover, .sheet-cover { position: relative; display: block; overflow: hidden; background: var(--bg); }
.card-cover { aspect-ratio: 2 / 1; border-radius: 11px; }
.card-cover canvas, .sheet-cover canvas, .edu-art canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  image-rendering: pixelated;
}
.cover-live { z-index: 1; animation: fade-in .25s ease-out; }
.card-index {
  position: absolute;
  z-index: 2;
  top: 8px;
  left: 8px;
  padding: 1px 6px;
  border-radius: 6px;
  background: hsl(13 53% 3% / .6);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  color: hsl(var(--fg) / .7);
}

.card-body { display: flex; flex: 1; flex-direction: column; gap: 4px; padding: 14px 10px 8px; }
.card-title { font-size: 15px; font-weight: 500; line-height: 1.3; }
.card-tagline {
  display: -webkit-box;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  font-size: 13px;
  line-height: 1.45;
  color: hsl(var(--fg) / .55);
}
.card-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: auto;
  padding-top: 12px;
  font-size: 11px;
  color: hsl(var(--fg) / .4);
}
.dot { width: 7px; height: 7px; flex-shrink: 0; border-radius: 50%; background: var(--dot); }
.card-open { margin-left: auto; color: hsl(var(--fg) / .3); transition: color .2s, translate .2s; }
.card:hover .card-open { color: hsl(var(--fg) / .8); translate: 2px -2px; }

/* ---------- About: same vocabulary as the rest (muted copy, dithered tiles, divided rows) ---------- */
.about { padding-bottom: max(120px, 34vh); } /* room for the last rows to reach the centre of the screen */

.about-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr);
  gap: clamp(28px, 5vw, 80px);
  max-width: 1280px;
}
@media (max-width: 860px) { .about-grid { grid-template-columns: minmax(0, 1fr); } }

.about-bio {
  display: grid;
  align-content: start;
  gap: 14px;
  max-width: 56ch;
  font-size: 15px;
  line-height: 1.55;
  text-wrap: pretty;
}
.dim { color: hsl(var(--fg) / .6); }
.toolbox { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; padding: 0; list-style: none; }
.toolbox li { padding: 2px 8px; border-radius: 4px; background: hsl(var(--fg) / .05); font-size: 11px; color: hsl(var(--fg) / .5); }

.label {
  margin-bottom: 6px;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: hsl(var(--fg) / .4);
}
.edu-list { padding: 0; list-style: none; }
.edu-row {
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin: 0 -10px;
  padding: 14px 10px;
  border-radius: 12px;
  transition: background-color .2s;
}
.edu-row:hover { background: var(--row-hover); }
.edu-row + .edu-row::before { /* divider, hidden around the hovered row */
  content: "";
  position: absolute;
  top: 0;
  left: 10px;
  right: 10px;
  height: 1px;
  background: hsl(var(--fg) / .06);
  transition: opacity .2s;
}
.edu-row:hover::before, .edu-row:hover + .edu-row::before { opacity: 0; }

.edu-tile { flex-shrink: 0; width: 48px; height: 48px; padding: 2px; border: 1px solid hsl(var(--fg) / .12); border-radius: 6px; }
.edu-art {
  position: relative;
  display: grid;
  place-items: center;
  height: 100%;
  overflow: hidden;
  border-radius: 4px;
  background: var(--bg);
}
.edu-mark {
  position: relative;
  z-index: 2;
  font-family: var(--serif);
  font-size: 15px;
  font-style: italic;
  color: #fff;
  text-shadow: 0 1px 6px hsl(13 53% 3% / .8);
}
.edu-text { display: flex; flex: 1; flex-direction: column; gap: 2px; min-width: 0; }
.edu-title { font-size: 14px; font-weight: 500; line-height: 1.3; }
.edu-school { font-size: 13px; color: hsl(var(--fg) / .55); }
.edu-detail { margin-top: 4px; font-size: 12px; line-height: 1.45; color: hsl(var(--fg) / .4); text-wrap: pretty; }
.edu-date { flex-shrink: 0; font-size: 12px; font-variant-numeric: tabular-nums; color: hsl(var(--fg) / .3); transition: color .2s; }
.edu-row:hover .edu-date { color: hsl(var(--fg) / .5); }

/* ---------- Depth of field: whatever is far from the centre of the screen goes soft ---------- */
@keyframes focus-pull {
  0%, 100% { opacity: .3; filter: blur(8px); }
  30%, 70% { opacity: 1; filter: none; }
}
@keyframes hero-out { to { opacity: .15; filter: blur(16px); } }

@media (prefers-reduced-motion: no-preference) {
  @supports (animation-timeline: view()) {
    .focus { animation: focus-pull linear both; animation-timeline: view(); animation-range: cover; }
    .hero { animation: hero-out linear both; animation-timeline: view(); animation-range: exit; }
  }
}

.footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 8px;
  max-width: calc(1280px + 2 * clamp(20px, 5vw, 72px));
  padding: 24px clamp(20px, 5vw, 72px) 32px;
  font-size: 11px;
  color: hsl(var(--fg) / .35);
}
.footer a { transition: color .2s; }
.footer a:hover { color: hsl(var(--fg)); }

/* ---------- Project sheet (native <dialog>) ---------- */
html:has(.sheet[open]) { overflow: hidden; }

.sheet {
  width: min(600px, calc(100vw - 32px));
  max-width: none;
  max-height: min(86vh, 860px);
  padding: 0;
  overflow: auto;
  border: 1px solid hsl(var(--fg) / .1);
  border-radius: 18px;
  background: #0a0403;
  color: hsl(var(--fg));
  box-shadow: 0 30px 80px -20px rgb(0 0 0 / .7);
  scrollbar-width: none;
}
.sheet::backdrop {
  background: hsl(13 53% 3% / .72);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  transition: opacity .18s ease-in;
}
.sheet.is-closing::backdrop { opacity: 0; }
.sheet[open] { animation: sheet-in .35s cubic-bezier(.23, 1, .32, 1); }
.sheet[open]::backdrop { animation: fade-in .35s ease-out; }
@keyframes sheet-in { from { opacity: 0; transform: translateY(14px) scale(.97); filter: blur(6px); } }
@keyframes fade-in { from { opacity: 0; } }

.sheet-cover { aspect-ratio: 3 / 1; }
.sheet-close {
  position: absolute;
  z-index: 2;
  top: 12px;
  right: 12px;
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: hsl(13 53% 3% / .6);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  color: hsl(var(--fg) / .8);
  transition: color .2s, background-color .2s, scale .2s;
}
.sheet-close:hover { background: hsl(13 53% 3% / .85); color: hsl(var(--fg)); }
.sheet-close:active { scale: .94; }

.sheet-body { display: grid; gap: 18px; padding: 22px 24px 24px; }
.sheet-kicker { font-size: 11px; letter-spacing: .04em; color: hsl(var(--fg) / .4); }
.sheet-title {
  margin-top: 4px;
  font-family: var(--serif);
  font-size: 36px;
  font-weight: 400;
  line-height: 1;
  letter-spacing: -.01em;
  overflow-wrap: anywhere;
}
.sheet-summary { font-size: 14px; line-height: 1.55; color: hsl(var(--fg) / .78); }
.sheet-highlights { display: grid; gap: 8px; padding: 0; list-style: none; }
.sheet-highlights li { position: relative; padding-left: 16px; font-size: 13px; line-height: 1.45; color: hsl(var(--fg) / .6); }
.sheet-highlights li::before {
  content: "";
  position: absolute;
  top: .6em;
  left: 2px;
  width: 5px;
  height: 5px;
  border-radius: 1px;
  background: hsl(var(--accent) / .8);
}
.sheet-media { margin: 0; }
.sheet-media[hidden] { display: none; }
.sheet-media img {
  display: block;
  width: 100%;
  height: auto;
  max-height: 340px;
  object-fit: contain;
  border: 1px solid hsl(var(--fg) / .08);
  border-radius: 10px;
  background: hsl(var(--fg) / .03);
}
.sheet-media figcaption { margin-top: 6px; font-size: 11px; color: hsl(var(--fg) / .35); }

.lang-bar { display: flex; gap: 2px; height: 6px; overflow: hidden; border-radius: 3px; }
.lang-bar span { flex: 1 0 0; min-width: 3px; background: var(--dot); }
.lang-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
  margin-top: 10px;
  padding: 0;
  list-style: none;
  font-size: 11px;
  color: hsl(var(--fg) / .55);
}
.lang-legend li { display: inline-flex; align-items: center; gap: 6px; }
.lang-legend b { font-weight: 400; color: hsl(var(--fg) / .35); }

.sheet-foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-top: 16px;
  border-top: 1px solid hsl(var(--fg) / .08);
}
.sheet-dates { font-size: 11px; color: hsl(var(--fg) / .4); }
.sheet-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 12px;
  border-radius: 999px;
  background: hsl(var(--fg));
  color: var(--bg);
  font-size: 12px;
  font-weight: 500;
  transition: opacity .2s, scale .2s;
}
.sheet-link:hover { opacity: .88; }
.sheet-link:active { scale: .96; }

@media (prefers-reduced-motion: reduce) {
  .scroll-cue svg, .cover-live, .sheet[open], .sheet[open]::backdrop { animation: none; }
}
