:root {
  /* Space reserved for fixed navbar when lightbox is open; .lightbox starts below this line. */
  --lightbox-nav-offset: calc(144px + env(safe-area-inset-top, 0px));
  --bg: #f6f1ea;
  --bg-soft: #fcfaf7;
  --surface: rgba(255, 255, 255, 0.68);
  --surface-strong: rgba(255, 255, 255, 0.88);
  --surface-muted: rgba(255, 255, 255, 0.46);
  --border: rgba(70, 52, 38, 0.08);
  --border-strong: rgba(70, 52, 38, 0.16);
  --text: #171412;
  --muted: #695e57;
  --muted-strong: #433b36;
  --accent: #bf7f4f;
  --accent-soft: rgba(191, 127, 79, 0.14);
  --accent-cool: rgba(146, 182, 207, 0.22);
  --shadow-soft: 0 24px 60px rgba(126, 100, 73, 0.14);
  --shadow-strong: 0 40px 120px rgba(126, 100, 73, 0.18);
  --radius-sm: 20px;
  --radius-md: 30px;
  --radius-lg: 40px;
  --max-width: min(1720px, calc(100vw - 44px));
}

@media (max-width: 1320px) {
  :root {
    /* Compact header row + hamburger (nav links hidden until toggled). */
    --lightbox-nav-offset: calc(92px + env(safe-area-inset-top, 0px));
  }
}

@media (max-width: 820px) {
  :root {
    --lightbox-nav-offset: calc(94px + env(safe-area-inset-top, 0px));
  }
}

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

html {
  scroll-behavior: smooth;
  color-scheme: light;
}

body {
  font-family: Inter, -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at 0% 0%, rgba(255, 209, 168, 0.54), transparent 30%),
    radial-gradient(circle at 100% 4%, rgba(188, 221, 243, 0.42), transparent 22%),
    radial-gradient(circle at 50% 100%, rgba(255, 255, 255, 0.78), transparent 36%),
    linear-gradient(180deg, #fcfaf7 0%, #f8f2ea 46%, #f3ede4 100%);
  color: var(--text);
  line-height: 1.65;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body.lightbox-open {
  overflow: hidden;
}

/* Navbar stays on top; .lightbox is positioned below it (see --lightbox-nav-offset) so the image never sits under the menu. */
body.lightbox-open .navbar {
  position: fixed;
  top: 16px;
  left: 50%;
  right: auto;
  z-index: 1100;
  width: min(1780px, calc(100vw - 32px));
  margin: 0;
  padding-top: 18px;
  padding-bottom: 18px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.92), rgba(255, 255, 255, 0.68)),
    rgba(255, 255, 255, 0.74);
  box-shadow: 0 18px 52px rgba(134, 108, 79, 0.18);
  backdrop-filter: blur(24px) saturate(150%);
  transform: translateX(-50%);
}

body.lightbox-open .logo a {
  color: var(--text);
}

body.lightbox-open .tagline {
  color: rgba(105, 94, 87, 0.78);
}

body.lightbox-open .nav-links a {
  color: rgba(67, 59, 54, 0.84);
  border-color: transparent;
  background: rgba(255, 255, 255, 0.42);
  opacity: 0.82;
}

body.lightbox-open .nav-links a:hover,
body.lightbox-open .nav-links a.active {
  color: var(--text);
  border-color: rgba(70, 52, 38, 0.12);
  background: rgba(255, 255, 255, 0.84);
  opacity: 1;
}

body::before,
body::after {
  content: "";
  position: fixed;
  pointer-events: none;
  z-index: -1;
  inset: auto;
  filter: blur(90px);
  opacity: 0.5;
}

body::before {
  top: 10vh;
  left: -5vw;
  width: 30vw;
  height: 30vw;
  background: rgba(245, 190, 139, 0.3);
}

body::after {
  right: -8vw;
  bottom: 8vh;
  width: 28vw;
  height: 28vw;
  background: rgba(175, 199, 222, 0.28);
}

a {
  color: inherit;
}

img {
  display: block;
}

.navbar {
  position: sticky;
  top: 16px;
  z-index: 200;
  width: min(1780px, calc(100vw - 32px));
  margin: 16px auto 0;
  padding: 18px 24px 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  border: 1px solid rgba(255, 255, 255, 0.74);
  border-radius: 32px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.86), rgba(255, 255, 255, 0.58)),
    rgba(255, 255, 255, 0.62);
  box-shadow: 0 18px 52px rgba(134, 108, 79, 0.16);
  backdrop-filter: blur(24px) saturate(150%);
}

.logo {
  display: flex;
  flex-direction: column;
  gap: 3px;
  align-items: center;
  text-align: center;
}

.logo a {
  color: var(--text);
  text-decoration: none;
  font-size: clamp(0.96rem, 1.2vw, 1.08rem);
  font-weight: 600;
  letter-spacing: 0.32em;
  text-transform: uppercase;
}

.tagline {
  color: var(--muted);
  font-size: 0.66rem;
  text-transform: uppercase;
  letter-spacing: 0.34em;
  opacity: 0.76;
}

.nav-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px 8px;
  width: min(100%, 1600px);
  min-width: 0;
  overflow: visible;
  scrollbar-width: none;
  -ms-overflow-style: none;
  padding: 0;
}

.nav-links::-webkit-scrollbar {
  display: none;
}

.nav-links a {
  color: var(--muted);
  text-decoration: none;
  flex: 0 0 auto;
  white-space: nowrap;
  font-size: 0.58rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  padding: 0.66rem 0.82rem;
  border-radius: 999px;
  border: 1px solid rgba(92, 69, 47, 0.08);
  background: rgba(255, 255, 255, 0.56);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.7);
  opacity: 0.92;
  transition:
    color 0.24s ease,
    border-color 0.24s ease,
    background 0.24s ease,
    opacity 0.24s ease,
    transform 0.24s ease;
}

.nav-links a:hover,
.nav-links a.active {
  color: var(--text);
  border-color: rgba(191, 127, 79, 0.2);
  background: rgba(255, 255, 255, 0.9);
  opacity: 1;
  transform: translateY(-1px);
}

.hamburger {
  display: none;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: 1px solid rgba(92, 69, 47, 0.1);
  background: rgba(255, 255, 255, 0.76);
  color: var(--text);
  font-size: 1.3rem;
  line-height: 1;
  cursor: pointer;
  align-items: center;
  justify-content: center;
  box-shadow: 0 14px 28px rgba(134, 108, 79, 0.12);
}

.gallery {
  width: var(--max-width);
  margin: 0 auto;
  padding: clamp(30px, 5vw, 56px) 0 96px;
}

.gallery-header {
  position: relative;
  overflow: hidden;
  max-width: 1180px;
  margin: 0 auto clamp(28px, 4vw, 46px);
  padding: clamp(30px, 5vw, 58px) clamp(24px, 5vw, 74px);
  border-radius: var(--radius-lg);
  border: 1px solid rgba(255, 255, 255, 0.78);
  background:
    radial-gradient(circle at top right, rgba(245, 196, 148, 0.34), transparent 28%),
    radial-gradient(circle at bottom left, rgba(174, 205, 226, 0.24), transparent 30%),
    linear-gradient(135deg, rgba(255, 255, 255, 0.82), rgba(255, 255, 255, 0.52)),
    var(--surface);
  box-shadow: var(--shadow-soft);
  backdrop-filter: blur(24px) saturate(140%);
  text-align: center;
}

.gallery-header::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(120deg, rgba(255, 255, 255, 0.34), transparent 38%, transparent 60%, rgba(191, 127, 79, 0.1));
  pointer-events: none;
}

.gallery-header h1,
.about-hero h1,
.contact-content h1,
.about-content h2,
.closing h2 {
  position: relative;
  font-family: "Iowan Old Style", "Palatino Linotype", "Book Antiqua", Georgia, serif;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  line-height: 0.95;
}

.gallery-header h1 {
  font-size: clamp(2.7rem, 6.5vw, 5.3rem);
  margin-bottom: 16px;
}

.gallery-header p {
  position: relative;
  max-width: 48rem;
  margin: 0 auto;
  color: var(--muted);
  font-size: clamp(1rem, 1.4vw, 1.08rem);
  letter-spacing: 0.02em;
}

.portfolio-grid,
.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: clamp(18px, 2vw, 26px);
  margin: 0 auto;
}

.portfolio-item,
.gallery-item {
  position: relative;
  overflow: hidden;
  isolation: isolate;
  border-radius: calc(var(--radius-md) + 2px);
  border: 1px solid rgba(255, 255, 255, 0.88);
  background:
    linear-gradient(160deg, rgba(255, 255, 255, 0.58), rgba(255, 255, 255, 0.18)),
    var(--surface-strong);
  box-shadow: 0 20px 58px rgba(132, 108, 78, 0.16);
  transform: translateY(0);
  transition:
    transform 0.45s cubic-bezier(0.22, 1, 0.36, 1),
    border-color 0.3s ease,
    box-shadow 0.3s ease;
}

.portfolio-item {
  aspect-ratio: 5 / 4;
  text-decoration: none;
}

.gallery-item {
  aspect-ratio: 5 / 4;
  cursor: pointer;
}

.portfolio-item::before,
.gallery-item::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  background: linear-gradient(110deg, transparent 16%, rgba(255, 255, 255, 0.7) 38%, transparent 62%);
  transform: translateX(-120%);
  animation: shimmer 1.8s linear infinite;
  transition: opacity 0.3s ease;
}

.portfolio-item::after,
.gallery-item::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
}

.portfolio-item::after {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0) 38%, rgba(26, 20, 17, 0.18) 100%);
}

.gallery-item::after {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.02), rgba(24, 17, 12, 0.08));
  pointer-events: none;
}

.portfolio-item.is-loaded::before,
.gallery-item.is-loaded::before {
  opacity: 0;
  animation: none;
}

.portfolio-item > img,
.gallery-item > img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transform: scale(1.06);
  filter: blur(20px) saturate(0.92) contrast(1.02);
  transition:
    opacity 0.6s ease,
    transform 0.95s cubic-bezier(0.22, 1, 0.36, 1),
    filter 0.9s ease;
}

.portfolio-item.is-loaded > img,
.gallery-item.is-loaded > img {
  opacity: 1;
  transform: scale(1);
  filter: blur(0) saturate(1.03) contrast(1.02);
}

.portfolio-item:hover,
.gallery-item:hover {
  border-color: rgba(191, 127, 79, 0.18);
  box-shadow: 0 28px 80px rgba(132, 108, 78, 0.22);
  transform: translateY(-6px);
}

.portfolio-item:hover > img,
.gallery-item:hover > img {
  transform: scale(1.04);
}

.portfolio-item-overlay {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: flex;
  justify-content: flex-end;
  align-items: flex-start;
  padding: clamp(22px, 3vw, 30px);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0) 46%, rgba(15, 11, 9, 0.14) 100%);
}

.portfolio-item-title {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.88rem 1.08rem;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.88);
  background: rgba(255, 255, 255, 0.74);
  backdrop-filter: blur(16px) saturate(160%);
  box-shadow: 0 14px 28px rgba(46, 32, 20, 0.14);
  color: #171311;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.24em;
  transition: transform 0.28s ease, background 0.28s ease;
}

.portfolio-item:hover .portfolio-item-title {
  transform: translateY(-2px);
  background: rgba(255, 255, 255, 0.88);
}

.gallery-item picture,
.gallery-item meta {
  display: none;
}

.lightbox {
  position: fixed;
  top: var(--lightbox-nav-offset);
  left: 0;
  right: 0;
  bottom: 0;
  --lightbox-swipe-x: 0px;
  --lightbox-swipe-opacity: 1;
  display: none;
  align-items: center;
  justify-content: center;
  padding: clamp(18px, 4vw, 34px);
  background:
    radial-gradient(circle at top right, rgba(245, 196, 148, 0.24), transparent 28%),
    radial-gradient(circle at bottom left, rgba(174, 205, 226, 0.18), transparent 32%),
    rgba(248, 243, 237, 0.78);
  backdrop-filter: blur(22px) saturate(130%);
  /* Below navbar (1100): viewer only covers the area under the menu, so photo is never covered by it. */
  z-index: 1000;
}

.lightbox.is-open {
  display: flex;
  touch-action: none;
}

.lightbox img {
  touch-action: none;
  max-width: min(94vw, 1540px);
  /* Fit entirely in the viewport region below the navbar (matches --lightbox-nav-offset). */
  max-height: calc(100vh - var(--lightbox-nav-offset) - clamp(36px, 8vw, 68px));
  border: 1px solid rgba(255, 255, 255, 0.82);
  border-radius: 30px;
  box-shadow: 0 34px 90px rgba(120, 95, 69, 0.2);
  object-fit: contain;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  -webkit-user-drag: none;
  pointer-events: auto;
  opacity: 0;
  transform: translate3d(var(--lightbox-swipe-x), 14px, 0) scale(0.985);
  transition: opacity 0.35s ease, transform 0.45s ease;
}

.lightbox img.is-visible {
  opacity: var(--lightbox-swipe-opacity);
  transform: translate3d(var(--lightbox-swipe-x), 0, 0) scale(1);
}

.lightbox.is-dragging img {
  transition: none;
}

.lightbox-loader {
  position: absolute;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

.lightbox.is-loading .lightbox-loader {
  opacity: 1;
}

.lightbox-loader-ring {
  width: 52px;
  height: 52px;
  border: 2px solid rgba(95, 74, 51, 0.14);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
}

.lightbox-loader-text {
  color: var(--muted-strong);
  font-size: 0.76rem;
  text-transform: uppercase;
  letter-spacing: 0.3em;
}

.close,
.prev,
.next {
  position: absolute;
  z-index: 3;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(95, 74, 51, 0.1);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.78);
  color: var(--text);
  cursor: pointer;
  box-shadow: 0 16px 34px rgba(120, 95, 69, 0.14);
  backdrop-filter: blur(18px) saturate(150%);
  transition:
    transform 0.24s ease,
    border-color 0.24s ease,
    background 0.24s ease,
    opacity 0.24s ease;
}

.close:hover,
.prev:hover,
.next:hover {
  transform: translateY(-2px);
  border-color: rgba(191, 127, 79, 0.18);
  background: rgba(255, 255, 255, 0.94);
}

.close {
  top: 22px;
  right: 22px;
  width: 56px;
  height: 56px;
  font-size: 2rem;
}

.prev,
.next {
  top: 50%;
  width: 60px;
  height: 60px;
  transform: translateY(-50%);
  font-size: 1.8rem;
}

.prev:hover,
.next:hover {
  transform: translateY(calc(-50% - 2px));
}

.prev {
  left: 22px;
}

.next {
  right: 22px;
}

.social-footer {
  width: min(1100px, calc(100vw - 40px));
  margin: 0 auto;
  padding: 18px;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;
  border: 1px solid rgba(255, 255, 255, 0.82);
  border-radius: var(--radius-md);
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.78), rgba(255, 255, 255, 0.56)),
    rgba(255, 255, 255, 0.54);
  box-shadow: var(--shadow-soft);
  backdrop-filter: blur(24px) saturate(140%);
}

.social-footer a,
.social-links a {
  color: var(--muted-strong);
  text-decoration: none;
  font-size: 0.74rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  padding: 0.8rem 1rem;
  border-radius: 999px;
  border: 1px solid rgba(95, 74, 51, 0.08);
  background: rgba(255, 255, 255, 0.52);
  transition:
    color 0.24s ease,
    border-color 0.24s ease,
    background 0.24s ease,
    transform 0.24s ease;
}

.social-footer a:hover,
.social-links a:hover {
  color: var(--text);
  border-color: rgba(191, 127, 79, 0.18);
  background: rgba(255, 255, 255, 0.9);
  transform: translateY(-1px);
}

.copyright {
  text-align: center;
  padding: 28px 20px 62px;
  color: rgba(79, 70, 64, 0.72);
  font-size: 0.84rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.copyright p {
  margin: 0;
}

/* Random footer quote (photo_quotes.txt); filled by js/photo-quote.js */
.photo-quote {
  max-width: 38rem;
  margin: -18px auto 0;
  padding: 0 clamp(20px, 4vw, 28px) clamp(40px, 6vw, 72px);
  text-align: center;
}

.photo-quote[hidden] {
  display: none !important;
}

.photo-quote__inner {
  margin: 0;
  padding: 0;
  border: none;
  quotes: none;
}

.photo-quote__inner::before,
.photo-quote__inner::after {
  content: none;
}

.photo-quote__text {
  font-family: "Iowan Old Style", "Palatino Linotype", "Book Antiqua", Georgia, serif;
  font-size: clamp(0.78rem, 1.05vw, 0.92rem);
  font-style: italic;
  font-weight: 400;
  color: rgba(86, 78, 73, 0.72);
  letter-spacing: 0.06em;
  line-height: 1.7;
  margin: 0;
}

.protected-img {
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  user-select: none;
  pointer-events: none;
}

.gallery-item,
.portfolio-item {
  pointer-events: auto;
}

.gallery-item img,
.portfolio-item img,
.lightbox img {
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  user-select: none;
}

.print-warning {
  display: none;
}

@keyframes shimmer {
  0% {
    transform: translateX(-120%);
  }
  100% {
    transform: translateX(120%);
  }
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@media (max-width: 1320px) {
  .navbar {
    width: var(--max-width);
    margin: 14px auto 0;
    padding: 16px 18px;
    display: grid;
    grid-template-columns: auto auto;
    align-items: center;
    gap: 12px;
    border: 1px solid rgba(255, 255, 255, 0.74);
    border-radius: 28px;
    background:
      linear-gradient(135deg, rgba(255, 255, 255, 0.86), rgba(255, 255, 255, 0.62)),
      rgba(255, 255, 255, 0.62);
    box-shadow: var(--shadow-soft);
    backdrop-filter: blur(22px) saturate(145%);
  }

  .logo {
    align-items: flex-start;
    text-align: left;
  }

  .nav-links {
    display: none;
    grid-column: 1 / -1;
    justify-content: flex-start;
    flex-wrap: wrap;
    gap: 10px;
    padding-top: 14px;
    overflow: visible;
  }

  .nav-links.active {
    display: flex;
    border-top: 1px solid rgba(70, 52, 38, 0.08);
    margin-top: 8px;
  }

  .hamburger {
    display: inline-flex;
    justify-self: end;
  }

  .portfolio-grid,
  .gallery-grid {
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  }
}

@media (max-width: 820px) {
  :root {
    --max-width: calc(100vw - 24px);
  }

  .navbar {
    top: 10px;
    margin-top: 10px;
    padding: 14px 16px;
  }

  .gallery {
    padding-top: 28px;
    padding-bottom: 72px;
  }

  .gallery-header {
    border-radius: 30px;
    padding: 28px 22px 32px;
  }

  .portfolio-grid,
  .gallery-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
  }

  .portfolio-item,
  .gallery-item {
    grid-column: auto;
    aspect-ratio: 5 / 4;
  }

  .social-footer {
    padding: 16px;
    border-radius: 28px;
  }

  body.lightbox-open .navbar {
    top: 10px;
    width: var(--max-width);
  }
}

@media (max-width: 640px) {
  .navbar {
    border-radius: 24px;
    width: calc(100vw - 20px);
  }

  .nav-links a {
    font-size: 0.66rem;
    letter-spacing: 0.12em;
    padding: 0.7rem 0.84rem;
  }

  .gallery-header h1 {
    font-size: clamp(2.15rem, 12vw, 3.6rem);
  }

  .portfolio-grid,
  .gallery-grid {
    grid-template-columns: 1fr;
  }

  .portfolio-item,
  .gallery-item {
    grid-column: auto;
    aspect-ratio: 5 / 4;
    border-radius: 24px;
  }

  .portfolio-item-title {
    font-size: 0.68rem;
    letter-spacing: 0.22em;
    padding: 0.78rem 0.96rem;
  }

  .prev,
  .next {
    width: 50px;
    height: 50px;
    font-size: 1.4rem;
  }

  .prev {
    left: 12px;
  }

  .next,
  .close {
    right: 12px;
  }

  .close {
    top: 12px;
    width: 52px;
    height: 52px;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

@media print {
  body * {
    visibility: hidden;
  }

  .print-warning {
    display: block !important;
    position: fixed;
    inset: 0;
    background: #111;
    color: #fff;
    font-size: 24px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    z-index: 999999;
  }

  .print-warning::before {
    content: "!";
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 88px;
    height: 88px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    font-size: 3rem;
    margin-bottom: 20px;
  }

  /* Print copyright line: see css/site-config.css (generated from config/site.json) */
  .print-warning::after {
    font-size: 18px;
    white-space: pre-line;
    margin-top: 20px;
    color: #bbb;
  }
}
