:root {
  /* Space reserved for fixed navbar when lightbox is open; .lightbox starts below this line. */
  --lightbox-nav-offset: calc(156px + env(safe-area-inset-top, 0px));
  --bg: #070708;
  --bg-soft: #111214;
  --surface: rgba(19, 20, 24, 0.88);
  --surface-strong: rgba(26, 28, 33, 0.96);
  --surface-muted: rgba(255, 255, 255, 0.04);
  --border: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.16);
  --text: #f7f3ef;
  --muted: #b3aaa1;
  --muted-strong: #d8c7b4;
  --accent: #d9b48e;
  --accent-soft: rgba(217, 180, 142, 0.2);
  --shadow-soft: 0 24px 60px rgba(0, 0, 0, 0.28);
  --shadow-strong: 0 32px 90px rgba(0, 0, 0, 0.45);
  --radius-sm: 18px;
  --radius-md: 26px;
  --radius-lg: 34px;
  --max-width: min(1560px, calc(100vw - 40px));
}

@media (max-width: 1180px) {
  :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(96px + env(safe-area-inset-top, 0px));
  }
}

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

html {
  scroll-behavior: smooth;
}

body {
  font-family: Inter, -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at top left, rgba(217, 180, 142, 0.14), transparent 34%),
    radial-gradient(circle at top right, rgba(136, 98, 70, 0.14), transparent 28%),
    linear-gradient(180deg, #111214 0%, #080809 34%, #060607 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: 0;
  left: 0;
  right: 0;
  z-index: 1100;
  padding-top: 14px;
  padding-bottom: 8px;
  background:
    linear-gradient(180deg, rgba(6, 7, 9, 0.58) 0%, rgba(6, 7, 9, 0.34) 48%, rgba(6, 7, 9, 0.12) 78%, rgba(6, 7, 9, 0) 100%);
  backdrop-filter: blur(10px) saturate(108%);
}

body.lightbox-open .logo a {
  color: rgba(247, 243, 239, 0.88);
}

body.lightbox-open .tagline {
  color: rgba(179, 170, 161, 0.78);
}

body.lightbox-open .nav-links a {
  color: rgba(179, 170, 161, 0.82);
  border-color: transparent;
  background: rgba(255, 255, 255, 0.01);
  opacity: 0.72;
}

body.lightbox-open .nav-links a:hover,
body.lightbox-open .nav-links a.active {
  color: rgba(247, 243, 239, 0.96);
  border-color: rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.05);
  opacity: 0.9;
}

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: -8vw;
  width: 28vw;
  height: 28vw;
  background: rgba(217, 180, 142, 0.18);
}

body::after {
  right: -6vw;
  bottom: 10vh;
  width: 24vw;
  height: 24vw;
  background: rgba(110, 136, 168, 0.12);
}

a {
  color: inherit;
}

img {
  display: block;
}

.navbar {
  position: sticky;
  top: 0;
  z-index: 200;
  width: 100%;
  margin: 0;
  padding: 20px 28px 14px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  border: 0;
  border-radius: 0;
  background:
    linear-gradient(180deg, rgba(8, 9, 11, 0.82) 0%, rgba(8, 9, 11, 0.68) 38%, rgba(8, 9, 11, 0.32) 78%, rgba(8, 9, 11, 0) 100%);
  box-shadow: none;
  backdrop-filter: blur(16px) saturate(125%);
}

.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(1rem, 1.6vw, 1.18rem);
  font-weight: 600;
  letter-spacing: 0.34em;
  text-transform: uppercase;
}

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

.nav-links {
  display: flex;
  flex-wrap: nowrap;
  justify-content: center;
  gap: 4px;
  width: min(100%, 1800px);
  min-width: 0;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: none;
  -ms-overflow-style: none;
  padding: 2px 0 10px;
}

.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.61rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  padding: 0.48rem 0.56rem;
  border-radius: 999px;
  border: 1px solid transparent;
  background: rgba(255, 255, 255, 0.015);
  opacity: 0.86;
  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(217, 180, 142, 0.22);
  background: rgba(217, 180, 142, 0.08);
  opacity: 1;
}

.hamburger {
  display: none;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  font-size: 1.3rem;
  line-height: 1;
  cursor: pointer;
  align-items: center;
  justify-content: center;
}

.gallery {
  width: var(--max-width);
  margin: 0 auto;
  padding: clamp(40px, 6vw, 82px) 0 96px;
}

.gallery-header {
  position: relative;
  overflow: hidden;
  margin: 0 auto clamp(28px, 4vw, 46px);
  padding: clamp(34px, 6vw, 72px);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  background:
    radial-gradient(circle at top right, rgba(217, 180, 142, 0.16), transparent 32%),
    linear-gradient(135deg, rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0.01)),
    var(--surface);
  box-shadow: var(--shadow-strong);
}

.gallery-header::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(120deg, rgba(255, 255, 255, 0.05), transparent 40%, transparent 60%, rgba(217, 180, 142, 0.08));
  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, 7vw, 5.6rem);
  margin-bottom: 18px;
}

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

.portfolio-grid,
.gallery-grid {
  display: grid;
  gap: clamp(18px, 2vw, 26px);
  margin: 0 auto;
}

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

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

.portfolio-item,
.gallery-item {
  position: relative;
  overflow: hidden;
  isolation: isolate;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.05), transparent 48%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.02), rgba(255, 255, 255, 0.01)),
    var(--surface-strong);
  box-shadow: var(--shadow-soft);
}

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

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

.portfolio-item::before,
.gallery-item::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  background: linear-gradient(110deg, transparent 10%, rgba(255, 255, 255, 0.18) 34%, transparent 58%);
  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;
  background: linear-gradient(180deg, rgba(3, 4, 5, 0.04), rgba(3, 4, 5, 0.58));
  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.05);
  filter: blur(16px) saturate(0.95);
  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);
}

.portfolio-item:hover,
.gallery-item:hover {
  border-color: var(--border-strong);
  box-shadow: 0 36px 95px rgba(0, 0, 0, 0.42);
  transform: translateY(-4px);
}

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

.portfolio-item-overlay {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  align-items: flex-start;
  gap: 10px;
  padding: clamp(22px, 3vw, 30px);
  background: linear-gradient(180deg, rgba(6, 7, 8, 0.04) 20%, rgba(6, 7, 8, 0.78) 82%, rgba(6, 7, 8, 0.94) 100%);
}

.portfolio-item-title {
  color: var(--text);
  font-size: 0.82rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.28em;
}

.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: rgba(8, 9, 11, 0.88);
  backdrop-filter: blur(16px);
  /* 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(92vw, 1500px);
  /* 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-radius: 24px;
  box-shadow: 0 36px 120px rgba(0, 0, 0, 0.62);
  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(255, 255, 255, 0.18);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
}

.lightbox-loader-text {
  color: var(--muted);
  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(255, 255, 255, 0.12);
  border-radius: 50%;
  background: rgba(16, 17, 19, 0.68);
  color: var(--text);
  cursor: pointer;
  box-shadow: var(--shadow-soft);
  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(217, 180, 142, 0.34);
  background: rgba(28, 29, 34, 0.9);
}

.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: var(--max-width);
  margin: 0 auto;
  padding: 24px;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: rgba(13, 14, 17, 0.66);
  box-shadow: var(--shadow-soft);
  backdrop-filter: blur(20px);
}

.social-footer a,
.social-links a {
  color: var(--muted);
  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(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.03);
  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(217, 180, 142, 0.26);
  background: rgba(217, 180, 142, 0.08);
  transform: translateY(-1px);
}

.copyright {
  text-align: center;
  padding: 28px 20px 62px;
  color: rgba(179, 170, 161, 0.68);
  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: -36px 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(179, 170, 161, 0.62);
  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: 1180px) {
  .navbar {
    width: var(--max-width);
    margin: 14px auto 0;
    padding: 18px 20px;
    display: grid;
    grid-template-columns: auto auto;
    align-items: center;
    gap: 12px;
    border: 1px solid var(--border);
    border-radius: 28px;
    background: rgba(12, 13, 16, 0.8);
    box-shadow: var(--shadow-soft);
    backdrop-filter: blur(22px) saturate(135%);
  }

  .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(255, 255, 255, 0.08);
    margin-top: 8px;
  }

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

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

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

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

  .gallery-header {
    border-radius: 28px;
  }

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

  .social-footer {
    padding: 18px;
  }
}

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

  .nav-links a {
    font-size: 0.68rem;
    letter-spacing: 0.12em;
    padding: 0.72rem 0.88rem;
  }

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

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

  .prev,
  .next {
    width: 52px;
    height: 52px;
    font-size: 1.5rem;
  }

  .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;
  }
}
