:root {
  color-scheme: light;
  --canvas: #f2f5ef;
  --canvas-deep: #e5ede3;
  --surface: #fbfcf9;
  --ink: #213228;
  --muted: #66746a;
  --line: rgba(45, 72, 54, 0.14);
  --sage: #9eb9a0;
  --sage-deep: #486852;
  --shadow: 0 18px 45px rgba(38, 58, 44, 0.13);
}

@property --ambient-0 { syntax: '<color>'; inherits: true; initial-value: #dce6d9; }
@property --ambient-1 { syntax: '<color>'; inherits: true; initial-value: #dce6d9; }
@property --ambient-2 { syntax: '<color>'; inherits: true; initial-value: #dce6d9; }
@property --ambient-3 { syntax: '<color>'; inherits: true; initial-value: #dce6d9; }

* { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  scrollbar-gutter: stable;
}

body {
  isolation: isolate;
  min-width: 18rem;
  margin: 0;
  color: var(--ink);
  background: var(--canvas);
  transition: --ambient-0 900ms ease, --ambient-1 900ms ease,
    --ambient-2 900ms ease, --ambient-3 900ms ease;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 1rem;
  line-height: 1.5;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -2;
  pointer-events: none;
  background:
    radial-gradient(ellipse at 0% 0%, var(--ambient-0), transparent var(--radius, 65%)),
    radial-gradient(ellipse at 100% 0%, var(--ambient-1), transparent var(--radius, 65%)),
    radial-gradient(ellipse at 0% 100%, var(--ambient-2), transparent var(--radius, 65%)),
    var(--ambient-3);
}

.ambient-field {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: -1;
  overflow: hidden;
  pointer-events: none;
  opacity: 0;
  transition: opacity 650ms ease;
}

.ambient-field.is-active { opacity: 1; }

.ambient-blob {
  position: absolute;
  border-radius: clamp(2rem, 5vw, 5rem);
  opacity: 0.92;
  filter: blur(clamp(2rem, 4vw, 4.5rem));
  transform: translateZ(0);
  transition: background-color 650ms ease;
}

button { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }

main {
  width: min(100%, 112rem);
  margin: 0 auto;
  padding: clamp(0.65rem, 1.5vw, 1.5rem) clamp(0.65rem, 1.5vw, 1.5rem) 4rem;
}

.photo-grid {
  --gallery-gap: clamp(0.65rem, 1.2vw, 1.25rem);
  --gallery-columns: 4;
  display: grid;
  grid-template-columns: repeat(var(--gallery-columns), minmax(0, 1fr));
  grid-auto-flow: dense;
  grid-auto-rows: 0.25rem;
  column-gap: var(--gallery-gap);
  row-gap: 0;
  align-items: start;
}

.photo-card {
  position: relative;
  width: 100%;
  display: block;
  height: auto;
  margin: 0;
  align-self: start;
  padding: 0;
  overflow: hidden;
  break-inside: avoid;
  border: 0;
  border-radius: clamp(0.8rem, 1.5vw, 1.25rem);
  background: var(--canvas-deep);
  box-shadow: 0 1px 0 var(--line);
  cursor: zoom-in;
  content-visibility: auto;
  transition: transform 220ms ease, box-shadow 220ms ease;
}


.photo-card::after {
  content: "";
  position: absolute;
  inset: 0;
  border: 1px solid rgba(255, 255, 255, 0.34);
  border-radius: inherit;
  pointer-events: none;
}

.photo-card:hover { z-index: 1; transform: translateY(-0.2rem); box-shadow: var(--shadow); }

.photo-card:focus-visible,
.lightbox button:focus-visible { outline: 3px solid #587d61; outline-offset: 3px; }

.photo-card img {
  width: 100%;
  height: auto;
  display: block;
  opacity: 0;
  transition: opacity 300ms ease, scale 500ms ease;
}

.photo-card img.is-loaded { opacity: 1; }
.photo-card:hover img { scale: 1.012; }
.load-sentinel { height: 1px; }

.lightbox {
  width: 100vw;
  max-width: none;
  height: 100vh;
  height: 100dvh;
  max-height: none;
  margin: 0;
  padding: 0;
  overflow: hidden;
  border: 0;
  color: #f4f7f2;
  background: rgba(19, 28, 22, 0.96);
  transition: background-color 600ms ease;
}

.lightbox::backdrop { background: rgba(19, 28, 22, 0.65); backdrop-filter: blur(8px); }
.lightbox[open] { display: grid; place-items: center; }

.lightbox figure {
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
  display: grid;
  place-items: center;
  margin: 0;
  padding: 3.5rem clamp(3.5rem, 8vw, 7rem) 1.25rem;
}

.lightbox img {
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
  max-width: 100%;
  max-height: 100%;
  display: block;
  border-radius: 0.5rem;
  object-fit: contain;
  box-shadow: 0 25px 80px rgba(0, 0, 0, 0.35);
}

.lightbox button {
  position: fixed;
  z-index: 2;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 50%;
  color: inherit;
  background: rgba(255, 255, 255, 0.08);
  cursor: pointer;
}

.lightbox-close { top: 1rem; right: 1rem; width: 2.75rem; height: 2.75rem; font-size: 1.8rem; }
.lightbox-arrow { top: 50%; width: 3rem; height: 3rem; translate: 0 -50%; font-size: 2.25rem; }
.lightbox-previous { left: 1rem; }
.lightbox-next { right: 1rem; }


@media (max-width: 48rem) {
  .lightbox figure { padding: 4rem 0.75rem 5rem; }
  .lightbox-arrow { top: auto; bottom: 1rem; translate: none; }
}


@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: 0.01ms !important; }
}
