:root {
  view-transition-name: none;
  --page: #ffffff;
  --ink: #b3b3b3;
  --placeholder: #f7f7f7;
  --placeholder-hover: #dedede;
  --gutter: 16px;
  --image-fade-duration: 250ms;
  --card-corner-radius: 0;
  --card-corner-radius-rounded: 12px;
}

.home-preview-toggle, .home-save-status {
  position: fixed; right: 16px; z-index: 20; color: #111;
  background: rgba(255,255,255,.96); line-height: normal;
}
.home-preview-toggle { top: 16px; padding: 10px 14px; border: 1px solid #ddd; border-radius: 999px; box-shadow: 0 4px 20px #0000000d; font-size: 14px; cursor: pointer; }
.home-save-status { top: 62px; font-size: 11px; color: #666; border-radius: 6px; padding: 3px 5px; max-width: 240px; text-align: right; }
.home-save-status.is-error { color: #a00050; }
.home-image-controls { display: none; }
.home-editing .home-image-controls { display: flex; flex-direction: column; gap: 6px; position: absolute; top: 12px; left: 12px; z-index: 5; }
.home-image-controls > span { display: flex; gap: 4px; }
.home-image-controls button { border: 1px solid #ddd; background: #fffffff5; color: #111; border-radius: 6px; padding: 7px 10px; font-size: 12px; cursor: pointer; }
.home-image-controls button[hidden] { display: none; }
.home-editing .work-tile::after { pointer-events: none; }
.home-editing .work-media { cursor: pointer; outline: 1px dashed #ccc; outline-offset: -1px; }
.home-editing .work-meta > span { display: block; min-width: 40px; min-height: 1.3em; cursor: text; border-bottom: 1px dashed #ccc; outline: none; }
.home-editing .work-meta > span:focus { border-bottom-color: #111; }
.home-editing .work-meta > span:empty::before { content: 'Add caption'; color: #999; }
.home-editing .work-image-secondary { display: none !important; }
.home-editing .work-tile:has([data-image="hover"]:hover) .work-image-secondary { display: block !important; }

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--page);
}

body {
  height: 100vh;
  min-height: 100%;
  margin: 0;
  overflow: hidden;
  color: var(--ink);
  font-family: "Inter Tight", Arial, Helvetica, sans-serif;
  font-size: 14pt;
  font-style: normal;
  font-weight: 500;
  letter-spacing: normal;
  line-height: normal;
  background: var(--page);
}

button,
input,
select,
textarea {
  font: inherit;
  font-variation-settings: inherit;
}

a {
  color: inherit;
  text-decoration: none;
}

.landing {
  height: 100vh;
  width: 100%;
  min-height: 0;
  margin: 0 auto;
  padding: 0;
  overflow: hidden;
}

.site-header {
  position: fixed;
  inset: 0;
  z-index: 10;
  font-size: 2rem;
  font-weight: 500;
  pointer-events: none;
  width: 100vw;
}

/* Internal navigation keeps the live header mounted in the shared shell. */
@view-transition {
  navigation: none;
}

/* Keep both glass and text live instead of creating navigation snapshots. */
.brand,
.nav-links {
  view-transition-name: none;
}

.brand-text {
  view-transition-name: none;
}

.nav-text {
  display: flex;
  align-items: center;
  view-transition-name: none;
}

.page-view[hidden] { display: none !important; }
.page-view.has-route-reveal .carousel-track.is-loaded,
.page-view.has-route-reveal .project-canvas.is-loaded { animation: none; }
.brand-text, .nav-text {
  position: relative;
  z-index: 1;
  flex-shrink: 0;
  white-space: nowrap;
  transform: translateZ(0) scale(1);
  transform-origin: center;
  /* Keep the same compositing layer before, during, and after the transition. */
  will-change: transform;
}
.site-header .brand-text, .site-header .nav-text { transform: translateZ(0) scale(0.75); }
.site-header.is-ready .brand-text,
.site-header.is-ready .nav-text { transition: transform 750ms ease-in-out; }
.site-header.is-ready .brand::before,
.site-header.is-ready .nav-links::before {
  transition: width 750ms ease-in-out, background-color 750ms ease-in-out;
}
.brand::before, .nav-links::before {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  width: 100%;
  transform: translateX(-50%);
  border-radius: 999px;
  background: transparent;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  pointer-events: none;
}
.site-header .brand::before, .site-header .nav-links::before {
  width: calc((100% - 40px) * 0.75 + 40px);
  background: rgba(255, 255, 255, 0.15);
}
.brand { justify-content: center; }
@media (prefers-reduced-motion: reduce) {
  .site-header.is-ready .brand-text, .site-header.is-ready .nav-text,
  .site-header.is-ready .brand::before, .site-header.is-ready .nav-links::before { transition: none; }
}

.nav-links .nav-text a {
  height: auto;
}

.brand {
  pointer-events: auto;
  position: absolute;
  top: 40px;
  left: 50%;
  display: flex;
  align-items: center;
  height: 3rem;
  width: max-content;
  margin: 0;
  padding: 0 20px;
  border-radius: 999px;
  background: transparent;
  color: #111111;
  font: inherit;
  letter-spacing: inherit;
  line-height: normal;
  transform: translateX(-50%);
  opacity: 1;
}

.nav-links {
  position: absolute;
  bottom: 40px;
  left: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  height: 3rem;
  width: max-content;
  padding: 0 20px;
  border-radius: 999px;
  background: transparent;
  color: #111111;
  transform: translateX(-50%);
  opacity: 1;
  pointer-events: auto;
  transition: color 250ms ease;
}

.nav-links a {
  display: flex;
  align-items: center;
  height: 48px;
  padding: 0;
  transition: color 250ms ease;
}

.site-header:has(a:hover) .nav-links a,
.site-header:has(a:focus-visible) .nav-links a {
  color: var(--ink);
}

.nav-links a:hover,
.nav-links a:focus-visible {
  color: #111111;
}

.site-header:has(a:hover) .nav-links a:hover,
.site-header:has(a:focus-visible) .nav-links a:focus-visible {
  color: #111111;
}

.portfolio-shell {
  container-type: inline-size;
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  width: 100%;
  margin: 0;
  padding: 0;
  overflow: hidden;
}

.carousel-track {
  display: flex;
  flex: 0 0 auto;
  gap: var(--gutter);
  width: max-content;
  will-change: transform;
}

.portfolio-grid {
  display: flex;
  flex: 0 0 auto;
  gap: var(--gutter);
  width: max-content;
}

.carousel-track.is-loading {
  opacity: 0;
}

.carousel-track.is-loaded {
  animation: reveal-work var(--image-fade-duration) ease both;
}

@keyframes reveal-work {
  from { opacity: 0; }
  to { opacity: 1; }
}

.work-tile {
  flex: 0 0 calc(100svh * 2 / 5);
  position: relative;
  display: block;
  overflow: visible;
  border-radius: 0;
  background: transparent;
}

.work-tile[hidden] {
  display: none;
}

.work-tile::after {
  position: absolute;
  inset: 0;
  z-index: 1;
  content: "";
}

.work-tile:hover,
.work-tile:focus-visible {
  z-index: 3;
}

.work-media {
  position: relative;
  display: block;
  height: 50svh;
  aspect-ratio: 4 / 5;
  overflow: hidden;
  border-radius: var(--card-corner-radius);
  background: var(--placeholder);
  transition: background-color 250ms ease;
}

.work-media img {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: 0;
  object-fit: cover;
}

.work-media .work-image-secondary {
  display: none;
  position: absolute;
  inset: 0;
}

.work-tile.is-pointer-hovered .work-image-secondary,
.work-tile:focus-visible .work-image-secondary {
  display: block;
}

@media (prefers-reduced-motion: reduce) {
  .carousel-track.is-loaded {
    animation: none;
  }
}

.work-tile.is-pointer-hovered .work-media,
.work-tile:focus-visible .work-media {
  background-color: var(--placeholder-hover);
}

.work-meta {
  position: relative;
  z-index: 2;
  display: flex;
  justify-content: flex-start;
  width: 100%;
  padding-top: 12px;
  color: #111111;
  font-size: 14pt;
  font-weight: 500;
  line-height: normal;
}

.work-tile::before {
  display: none;
}

.work-tile:focus-visible {
  outline: 2px solid #111111;
  outline-offset: 4px;
}

.tile-label {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* Phones use a native vertical project list. */
@media (max-width: 600px) {
  body:not(.project-page) { height: auto; min-height: 100dvh; overflow-x: hidden; overflow-y: auto; }
  .landing { height: auto; min-height: 100dvh; overflow: visible; }
  .portfolio-shell { position: relative; display: block; overflow: visible; padding: 0; }
  .carousel-track { display: block; width: 100%; transform: none !important; will-change: auto; }
  .portfolio-grid { flex-direction: column; width: 100%; gap: 0; }
  .portfolio-grid::before { content: ""; display: block; flex: 0 0 25cqw; }
  .site-header .brand::before, .site-header .nav-links::before {
    width: calc((100% - 40px) * 0.75 + 40px);
    background: rgba(255, 255, 255, 0.15);
  }
  .site-header, .project-page .site-header { font-size: 2rem; }
  .site-header .brand-text, .site-header .nav-text { transform: translateZ(0) scale(0.75); }
  .brand { top: max(16px, env(safe-area-inset-top)); padding: 0 12px; }
  .nav-links { bottom: max(16px, env(safe-area-inset-bottom)); padding: 0 12px; }
  .nav-links .nav-text a, .project-page .nav-links .nav-text a { min-height: 44px; }
  .work-tile { flex: 0 0 auto; width: 100%; }
  .work-media { width: 100%; height: auto; aspect-ratio: 4 / 5; }
  .work-meta { height: 25cqw; line-height: 1.35; padding: 10px 16px 0; }
  .home-preview-toggle, .project-page .preview-toggle { top: max(72px, calc(env(safe-area-inset-top) + 56px)); right: 12px; min-height: 44px; font-size: 13px; }
  .home-save-status, .project-page .save-status { top: max(120px, calc(env(safe-area-inset-top) + 104px)); right: 12px; max-width: calc(100vw - 24px); }
  .home-image-controls button { min-height: 44px; }
  .home-editing .home-image-controls { top: 8px; left: 8px; }
}
@media (hover: none) {
  .work-tile.is-pointer-hovered .work-image-secondary { display: none; }
  .work-tile.is-pointer-hovered .work-media { background: var(--placeholder); }
}
@media (max-height: 500px) and (orientation: landscape) {
  .brand { top: max(4px, env(safe-area-inset-top)); }
  .nav-links { bottom: max(4px, env(safe-area-inset-bottom)); }
  .site-header, .project-page .site-header { font-size: 20px; }
}

@media (max-width: 600px) {
  .landing:not(.home-editing) .work-media:has(.work-image-secondary) { touch-action: pan-y pinch-zoom; }
  .landing:not(.home-editing) .work-media .work-image-primary,
  .landing:not(.home-editing) .work-media .work-image-secondary {
    transition: transform 240ms ease;
    transform: translateX(calc(var(--image-slide, 0%) + var(--image-drag, 0px)));
  }
  .landing:not(.home-editing) .work-media .work-image-secondary {
    display: block;
    transform: translateX(calc(100% + var(--image-slide, 0%) + var(--image-drag, 0px)));
  }
  .landing:not(.home-editing) .work-media.shows-secondary:has(.work-image-secondary) { --image-slide: -100%; }
  .landing:not(.home-editing) .work-media.is-swiping img { transition: none; }
  .landing:not(.home-editing) .work-media:has(.work-image-primary):has(.work-image-secondary)::before,
  .landing:not(.home-editing) .work-media:has(.work-image-primary):has(.work-image-secondary)::after {
    content: "";
    position: absolute;
    z-index: 2;
    left: 50%;
    transform: translateX(-50%);
    pointer-events: none;
  }
  .landing:not(.home-editing) .work-media::before {
    bottom: 12px;
    width: 30px;
    height: 18px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
  }
  .landing:not(.home-editing) .work-media::after {
    bottom: 18px;
    width: 18px;
    height: 6px;
    background: radial-gradient(circle at 3px 3px, var(--first-dot, rgba(0, 0, 0, 0.75)) 2.5px, transparent 3px),
      radial-gradient(circle at 15px 3px, var(--second-dot, rgba(0, 0, 0, 0.25)) 2.5px, transparent 3px);
  }
  .landing:not(.home-editing) .work-media.shows-secondary { --first-dot: rgba(0, 0, 0, 0.25); --second-dot: rgba(0, 0, 0, 0.75); }

}
@media (max-width: 600px) and (prefers-reduced-motion: reduce) {
  .landing:not(.home-editing) .work-media img { transition: none; }
}

@media (max-width: 600px) {
  html:has(body:not(.project-page)), body:not(.project-page) { overscroll-behavior-y: none; }
  .portfolio-shell { overflow: clip; }
  .carousel-track { translate: 0 var(--mobile-bounce, 0px); }
}

/* About shares the home header, with room to scroll longer content. */
body.about-page { height: auto; min-height: 100dvh; overflow-x: hidden; overflow-y: auto; }
.about-landing { height: auto; min-height: 100dvh; overflow: visible; }
.about-content { width: min(100% - 64px, 720px); margin: 0 auto; padding: 160px 0 140px; color: var(--ink); font-size: 18px; line-height: 24px; }
.about-content section + section { margin-top: 96px; }
.about-content h1, .about-content h2 { margin: 0 0 24px; color: var(--ink); font: inherit; }
.about-list { display: grid; gap: 48px; margin: 0; }
.about-entry { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 24px; padding: 0; }
.about-entry dd { margin: 0; white-space: nowrap; }
.about-entry > dd:not(.about-roles) { justify-self: end; text-align: right; }
.about-title { display: block; color: var(--ink); }
.about-entry > dt { color: #111; display: flex; flex-wrap: wrap; align-content: start; column-gap: 16px; }
.about-entry > dt > .about-title { flex-basis: 100%; order: 1; }
.about-location { display: block; flex-basis: 100%; color: var(--ink); }
@media (max-width: 600px) {
  .about-content { width: calc(100% - 32px); padding: 112px 0 112px; }
  .about-entry { grid-template-columns: 1fr; gap: 0; }
  .about-entry dd { color: var(--ink); }
}

.about-entry-grouped { grid-template-columns: 1fr; gap: 0; }
.about-entry .about-roles { white-space: normal; color: var(--ink); }
.about-role { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 24px; }
.about-role + .about-role { margin-top: 0; }
.about-role-dates { white-space: nowrap; justify-self: end; text-align: right; }
@media (max-width: 600px) {
  .about-role { grid-template-columns: 1fr; gap: 0; }
  .about-role-dates { color: var(--ink); }
  .about-entry > dd:not(.about-roles), .about-role-dates { justify-self: start; text-align: left; }
}

.about-email { margin: 0 0 96px; overflow-wrap: anywhere; color: #111; }

/* Fade the header on a full page load; navigation keeps it mounted. */
@media (prefers-reduced-motion: no-preference) {
  .site-header { animation: reveal-work 1s ease-in-out; }
}
