:root {
  --bg: #000;
  --text: #f2f2f2;
  --muted: #8a8a8a;
  --line: #1c1c1c;
  --side: 280px;
  --gap: 16px;
  --serif: "DM Serif Display", Georgia, serif;
  --sans: "Inter", -apple-system, "Helvetica Neue", Arial, sans-serif;
  --ease: cubic-bezier(.22, .61, .36, 1);
}

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

html { background: var(--bg); scroll-behavior: smooth; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-weight: 300;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
img { display: block; width: 100%; height: auto; }

/* Smooth page transitions (Chrome, Edge, Safari 18+) */
@view-transition { navigation: auto; }
::view-transition-old(root) { animation: fade-out .3s var(--ease) both; }
::view-transition-new(root) { animation: fade-in .45s var(--ease) both; }
@keyframes fade-out { to { opacity: 0; } }
@keyframes fade-in { from { opacity: 0; transform: translateY(8px); } }

/* Fallback fade for browsers without view transitions */
@supports not (view-transition-name: none) {
  .main { animation: fade-in .5s var(--ease) both; }
}

/* Photos fade in as they load */
.fade { opacity: 0; transition: opacity .6s var(--ease); }
.fade.loaded { opacity: 1; }

/* Left panel */
.side {
  position: fixed;
  inset: 0 auto 0 0;
  width: var(--side);
  padding: 48px 36px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  border-right: 1px solid var(--line);
}
.name {
  font-family: var(--serif);
  font-weight: 400;
  font-size: 34px;
  line-height: 1.1;
}
.role { color: var(--muted); font-size: 13px; margin-top: 8px; letter-spacing: .04em; }
.nav { margin-top: 48px; display: flex; flex-direction: column; gap: 14px; }
.nav a { color: var(--muted); font-size: 15px; transition: color .2s; }
.nav a:hover, .nav a.active { color: var(--text); }
.social { display: flex; gap: 18px; font-size: 12px; color: #555; }
.social a:hover { color: var(--text); }
.scroll-cue, .mini { display: none; }

/* Right content */
.main { margin-left: var(--side); padding: var(--gap); min-height: 100vh; }

.gallery { display: grid; grid-template-columns: 1fr 1fr; grid-auto-flow: dense; gap: var(--gap); }
.gallery img { cursor: zoom-in; aspect-ratio: 3 / 2; object-fit: cover; background: #0d0d0d; }
.gallery img.loaded:hover { opacity: .85; }
.gallery .wide { grid-column: 1 / -1; aspect-ratio: 16 / 9; }
.gallery .tall { aspect-ratio: 4 / 5; }

/* Page headings */
.page { max-width: 900px; padding: 32px 24px; }
.page.full { max-width: none; }
.page h2 { font-family: var(--serif); font-weight: 400; font-size: 40px; margin-bottom: 28px; }

/* About */
.about { display: grid; grid-template-columns: 300px 1fr; gap: 40px; align-items: start; }
.about img { aspect-ratio: 4 / 5; object-fit: cover; }
.about p { color: #c8c8c8; line-height: 1.8; margin-bottom: 18px; font-size: 16px; }
.contact { margin-top: 28px; display: flex; flex-direction: column; gap: 8px; font-size: 15px; }
.contact a { border-bottom: 1px solid #333; align-self: flex-start; padding-bottom: 2px; }
.contact a:hover { border-color: var(--text); }

/* Projects */
.projects { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 28px; }
.project img { aspect-ratio: 4 / 3; object-fit: cover; }
.project:hover img.loaded { opacity: .8; }
.project h3 { font-family: var(--serif); font-weight: 400; font-size: 22px; margin-top: 14px; }
.project span { color: var(--muted); font-size: 13px; }
.back { color: var(--muted); font-size: 13px; display: inline-block; margin-bottom: 16px; }
.back:hover { color: var(--text); }
.intro { color: #c8c8c8; line-height: 1.8; max-width: 640px; margin: -12px 0 32px; }

/* Full-screen viewer */
.lightbox {
  position: fixed; inset: 0; background: rgba(0, 0, 0, .97);
  display: flex; align-items: center; justify-content: center; z-index: 50;
  opacity: 0; visibility: hidden; transition: opacity .3s var(--ease), visibility .3s;
}
.lightbox.open { opacity: 1; visibility: visible; }
.lightbox img { max-width: 92vw; max-height: 88vh; width: auto; object-fit: contain; transition: opacity .25s; }
.lb-btn {
  position: absolute; background: none; border: 0; color: #aaa;
  font-size: 34px; cursor: pointer; padding: 16px; font-family: var(--sans); font-weight: 200;
}
.lb-btn:hover { color: #fff; }
.lb-close { top: 8px; right: 16px; }
.lb-prev { left: 8px; top: 50%; transform: translateY(-50%); }
.lb-next { right: 8px; top: 50%; transform: translateY(-50%); }
.lb-count { position: absolute; bottom: 20px; color: #666; font-size: 12px; letter-spacing: .1em; }

/* Phone and small tablet */
@media (max-width: 800px) {
  .side {
    position: sticky; top: 0; width: 100%; z-index: 10; background: var(--bg);
    flex-direction: row; align-items: center; padding: 16px; border-right: 0; border-bottom: 1px solid var(--line);
  }
  .top { width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
  .name { font-size: 22px; }
  .role, .social { display: none; }
  .nav { margin: 0; flex-direction: row; gap: 16px; }
  .nav a { font-size: 13px; }
  .main { margin-left: 0; padding: 8px; }
  .gallery { grid-template-columns: 1fr; gap: 8px; }
  .gallery img, .gallery .wide { aspect-ratio: 3 / 2; }
  .page { padding: 24px 8px; }
  .page h2 { font-size: 32px; }
  .about { grid-template-columns: 1fr; }
  .lb-prev, .lb-next { display: none; }

  /* Home page on phones: your name fills the first screen, photos follow */
  .home .side {
    position: relative; min-height: 100svh; flex-direction: column;
    justify-content: center; align-items: center; text-align: center; border-bottom: 0;
  }
  .home .top { flex-direction: column; justify-content: center; gap: 0; }
  .home .name { font-size: 52px; animation: fade-in 1s var(--ease) both; }
  .home .role { display: block; font-size: 14px; margin-top: 12px; animation: fade-in 1s .15s var(--ease) both; }
  .home .nav { margin-top: 36px; gap: 22px; animation: fade-in 1s .3s var(--ease) both; }
  .home .nav a { font-size: 14px; }
  .home .social { display: none; }
  .scroll-cue {
    display: block; position: absolute; bottom: 32px; left: 50%; transform: translateX(-50%);
    color: #555; font-size: 11px; letter-spacing: .2em; text-transform: uppercase;
    animation: fade-in 1s .6s var(--ease) both;
  }
  .scroll-cue::after {
    content: ""; display: block; width: 1px; height: 32px; background: #555; margin: 10px auto 0;
    animation: drip 2s 1.6s var(--ease) infinite;
  }
  @keyframes drip { 0% { transform: scaleY(0); transform-origin: top; } 50% { transform: scaleY(1); transform-origin: top; } 51% { transform-origin: bottom; } 100% { transform: scaleY(0); transform-origin: bottom; } }

  /* Slim bar that slides in once you scroll past your name */
  .mini {
    display: flex; position: fixed; top: 0; left: 0; right: 0; z-index: 20;
    justify-content: space-between; align-items: center; padding: 14px 16px;
    background: var(--bg); border-bottom: 1px solid var(--line);
    transform: translateY(-100%); transition: transform .35s var(--ease);
  }
  .mini.show { transform: none; }
  .mini .name { font-size: 20px; }
}
