@font-face {
  font-family: "JetBrains Mono";
  src: url("/fonts/jetbrainsmono-400.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "JetBrains Mono";
  src: url("/fonts/jetbrainsmono-500.woff2") format("woff2");
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "JetBrains Mono";
  src: url("/fonts/jetbrainsmono-400-italic.woff2") format("woff2");
  font-weight: 400;
  font-style: italic;
  font-display: swap;
}

@font-face {
  font-family: "JetBrains Mono";
  src: url("/fonts/jetbrainsmono-700.woff2") format("woff2");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

:root {
  --bg: #faf9f7;
  --ink: #1c1a17;
  --muted: #7a746b;
  --hairline: #ebe6de;
  --overlay: rgba(16, 14, 12, 0.93);
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #11100e;
    --ink: #ebe6df;
    --muted: #9a9388;
    --hairline: #2a2721;
    --overlay: rgba(6, 5, 4, 0.94);
  }
}

* {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 0.9375rem;
  line-height: 1.75;
  font-weight: 400;
  text-rendering: optimizeLegibility;
}

::selection {
  background: #d8cebd;
  color: #1c1a17;
}

.wrap {
  max-width: 68rem;
  margin: 0 auto;
  padding: clamp(4rem, 12vh, 7.5rem) clamp(1.25rem, 4.5vw, 2.75rem) 5rem;
}

/* ---------- Intro ---------- */

.intro {
  max-width: 40rem;
}

.intro h1 {
  margin: 0 0 1.75rem;
  font-size: clamp(1.9rem, 5vw, 2.5rem);
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: -0.02em;
}

.intro p {
  margin: 0 0 1.15em;
}

a {
  color: inherit;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-decoration-color: color-mix(in srgb, currentColor 38%, transparent);
  text-underline-offset: 0.22em;
  transition: text-decoration-color 0.2s ease;
}

a:hover {
  text-decoration-color: currentColor;
}

a:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 3px;
}

.links {
  margin-top: 0.35rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem 1.5rem;
  font-style: italic;
}

.links a {
  /* Tall tap target, but text flush with the column (no side padding) */
  padding: 0.55rem 0;
  margin: -0.55rem 0;
  min-height: 2.75rem;
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
}

/* ---------- Gallery ---------- */

.gallery {
  margin-top: clamp(3.75rem, 10vh, 6rem);
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.5rem;
}

.gallery figure {
  margin: 0;
  overflow: hidden;
  background: var(--hairline);
}

.shot {
  display: block;
  line-height: 0;
  overflow: hidden;
  height: 100%;
}

.shot:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 3px;
}

.gallery img {
  width: 100%;
  height: 100%;
  display: block;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  transition: transform 0.8s cubic-bezier(0.2, 0.7, 0.2, 1);
}

.gallery img.portrait {
  object-position: center 12%;
}

@media (hover: hover) and (pointer: fine) {
  .shot:hover img {
    transform: scale(1.03);
  }
}

.js .gallery figure {
  opacity: 0;
  transform: translateY(12px);
  transition: opacity 0.8s cubic-bezier(0.2, 0.6, 0.2, 1), transform 0.8s cubic-bezier(0.2, 0.6, 0.2, 1);
}

.js .gallery figure.in {
  opacity: 1;
  transform: none;
}

/* ---------- Lightbox ---------- */

#lightbox {
  border: 0;
  padding: 0;
  background: transparent;
  max-width: 100vw;
  max-height: 100vh;
  outline: none;
}

#lightbox::backdrop {
  background: var(--overlay);
  animation: fade 0.25s ease;
}

#lightbox img {
  display: block;
  max-width: min(94vw, 70rem);
  max-height: 92vh;
  width: auto;
  height: auto;
  cursor: zoom-out;
  animation: soft 0.3s ease;
}

@keyframes fade {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes soft {
  from { opacity: 0; transform: scale(0.985); }
  to { opacity: 1; transform: none; }
}

/* ---------- Entrance ---------- */

.js .intro > * {
  animation: rise 0.7s cubic-bezier(0.2, 0.6, 0.2, 1) both;
}

.js .intro > *:nth-child(2) { animation-delay: 0.05s; }
.js .intro > *:nth-child(3) { animation-delay: 0.1s; }
.js .intro > *:nth-child(4) { animation-delay: 0.15s; }
.js .intro > *:nth-child(5) { animation-delay: 0.2s; }
.js .intro > *:nth-child(6) { animation-delay: 0.25s; }

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(0.45rem);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

/* ---------- Responsive ---------- */

@media (max-width: 899px) {
  .gallery {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (max-width: 559px) {
  .wrap {
    padding: 3rem 1rem 3.5rem;
  }

  .gallery {
    grid-template-columns: repeat(2, 1fr);
    gap: 0.35rem;
    margin-top: 2.75rem;
  }

  .intro h1 {
    font-size: 1.75rem;
  }

  /* Keep long email from forcing overflow on very narrow phones */
  .links a[href^="mailto"] {
    overflow-wrap: anywhere;
  }
}

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

  .js .gallery figure {
    opacity: 1;
    transform: none;
  }

  .shot:hover img {
    transform: none;
  }
}
