:root {
  --bg: #f7f1e7;
  --bg-strong: #efe4d5;
  --surface: rgba(255, 252, 247, 0.9);
  --surface-strong: #fffaf2;
  --text: #2f261f;
  --muted: #6d5a4b;
  --accent: #8c5a34;
  --accent-soft: #d8b596;
  --line: rgba(89, 62, 39, 0.14);
  --shadow: 0 14px 32px rgba(74, 49, 29, 0.12);
  --shadow-strong: 0 20px 48px rgba(45, 28, 12, 0.22);
  --radius-lg: 24px;
  --radius-md: 18px;
  --radius-sm: 14px;
  --tap: 48px;
  --page-width: 1120px;
  --serif: Georgia, "Iowan Old Style", "Palatino Linotype", "Book Antiqua", serif;
  --sans: "Avenir Next", Avenir, "Segoe UI", Helvetica, Arial, sans-serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--sans);
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(214, 182, 142, 0.28), transparent 34%),
    radial-gradient(circle at top right, rgba(197, 168, 131, 0.2), transparent 26%),
    linear-gradient(180deg, #fbf6ef 0%, var(--bg) 28%, #f4ede2 100%);
}

body.lightbox-open {
  overflow: hidden;
}

img {
  display: block;
  max-width: 100%;
}

button {
  font: inherit;
}

.hero {
  position: relative;
  overflow: clip;
  padding: 5.5rem 1.25rem 3.25rem;
  background:
    linear-gradient(180deg, rgba(251, 246, 239, 0.7), rgba(247, 241, 231, 0.96)),
    linear-gradient(120deg, rgba(215, 190, 160, 0.26), transparent 48%);
}

.hero__media {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(180deg, rgba(251, 246, 239, 0.5), rgba(247, 241, 231, 0.92)),
    center / cover no-repeat;
  filter: saturate(0.85);
  opacity: 0.35;
  transform: scale(1.04);
}

.hero__content {
  position: relative;
  z-index: 1;
  max-width: 48rem;
  margin: 0 auto;
  text-align: center;
}

.eyebrow,
.hero__count,
.section__meta,
.card__meta,
.lightbox__meta,
.empty-state,
.error-message,
.status-message,
.site-footer {
  letter-spacing: 0.01em;
  color: var(--muted);
}

.eyebrow {
  margin: 0 0 0.75rem;
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.16em;
}

.hero h1,
.intro h2,
.section__title {
  margin: 0;
  font-family: var(--serif);
  font-weight: 600;
  line-height: 1.05;
}

.hero h1 {
  font-size: clamp(2.75rem, 8vw, 5rem);
}

.hero__subtitle {
  margin: 1rem auto 0;
  max-width: 38rem;
  font-size: 1.05rem;
  line-height: 1.65;
}

.hero__count {
  margin: 1.25rem 0 0;
  font-size: 0.98rem;
}

.mode-nav {
  position: sticky;
  top: 0;
  z-index: 20;
  padding: 0.8rem 0.9rem 0;
  background: linear-gradient(180deg, rgba(247, 241, 231, 0.96), rgba(247, 241, 231, 0.75));
  backdrop-filter: blur(12px);
}

.mode-nav__inner {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.5rem;
  max-width: var(--page-width);
  margin: 0 auto;
}

.mode-tab,
.lightbox__button,
.lightbox__nav {
  min-height: var(--tap);
  min-width: var(--tap);
  border: 1px solid transparent;
  border-radius: 999px;
  cursor: pointer;
  transition:
    transform 180ms ease,
    background-color 180ms ease,
    border-color 180ms ease,
    opacity 180ms ease;
}

.mode-tab {
  padding: 0.8rem 0.9rem;
  background: rgba(255, 250, 242, 0.88);
  color: var(--muted);
  border-color: rgba(140, 90, 52, 0.1);
  box-shadow: 0 10px 20px rgba(92, 61, 37, 0.08);
  font-weight: 600;
}

.mode-tab.is-active {
  color: #fffaf4;
  background: linear-gradient(180deg, #9b6942, #865432);
  border-color: rgba(90, 57, 31, 0.2);
}

.page-shell {
  max-width: var(--page-width);
  margin: 0 auto;
  padding: 1.5rem 1rem 4rem;
}

.intro,
.status-message,
.error-message,
.section {
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.intro {
  padding: 1.3rem 1.2rem;
  border-radius: var(--radius-lg);
}

.intro h2 {
  font-size: 1.55rem;
  margin-bottom: 0.55rem;
}

.intro p {
  margin: 0;
  line-height: 1.7;
}

.status-message,
.error-message {
  margin-top: 1rem;
  padding: 1rem 1.1rem;
  border-radius: var(--radius-md);
}

.error-message {
  color: #6a3322;
  background: rgba(255, 244, 237, 0.98);
  border-color: rgba(164, 87, 64, 0.2);
}

.gallery-root {
  display: grid;
  gap: 1.25rem;
  margin-top: 1rem;
}

.section {
  padding: 1.15rem;
  border-radius: var(--radius-lg);
}

.section__header {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  margin-bottom: 1rem;
}

.section__title {
  font-size: 1.6rem;
}

.section__meta {
  font-size: 0.95rem;
}

.thumb-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.85rem;
}

.thumb-card {
  display: block;
  padding: 0;
  border: 0;
  border-radius: var(--radius-md);
  background: transparent;
  text-align: left;
  overflow: hidden;
  box-shadow: var(--shadow);
  cursor: pointer;
}

.thumb-card__frame {
  position: relative;
  overflow: hidden;
  background: linear-gradient(135deg, rgba(216, 181, 150, 0.22), rgba(244, 232, 219, 0.85));
}

.thumb-card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 220ms ease;
}

.thumb-card:focus-visible,
.mode-tab:focus-visible,
.lightbox__button:focus-visible,
.lightbox__nav:focus-visible {
  outline: 3px solid rgba(140, 90, 52, 0.32);
  outline-offset: 3px;
}

.thumb-card:hover img,
.thumb-card:focus-visible img {
  transform: scale(1.03);
}

.thumb-card__body {
  padding: 0.75rem 0.8rem 0.85rem;
  background: rgba(255, 252, 247, 0.98);
}

.thumb-card__caption {
  margin: 0;
  font-size: 0.98rem;
  line-height: 1.4;
}

.card__meta {
  margin: 0.35rem 0 0;
  font-size: 0.86rem;
}

.empty-state {
  margin: 0;
  padding: 1.4rem 0.2rem 0.3rem;
  font-style: italic;
}

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 0.9rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity 220ms ease;
}

.lightbox.is-open {
  opacity: 1;
  pointer-events: auto;
}

.lightbox__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(31, 21, 14, 0.72);
  backdrop-filter: blur(12px);
}

.lightbox__panel {
  position: relative;
  z-index: 1;
  width: min(100%, 1100px);
  max-height: 100%;
  display: grid;
  gap: 0.8rem;
  padding: 0.85rem;
  border-radius: 28px;
  background: rgba(30, 21, 15, 0.78);
  box-shadow: var(--shadow-strong);
  transform: translateY(16px) scale(0.985);
  transition: transform 240ms ease;
}

.lightbox.is-open .lightbox__panel {
  transform: translateY(0) scale(1);
}

.lightbox__topbar {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
}

.lightbox__button {
  padding: 0.7rem 1rem;
  background: rgba(255, 250, 244, 0.14);
  color: #f8f0e3;
  border-color: rgba(255, 247, 235, 0.16);
}

.lightbox__button[aria-pressed="true"] {
  background: rgba(232, 180, 131, 0.26);
  border-color: rgba(255, 234, 207, 0.38);
}

.lightbox__viewer {
  display: grid;
  grid-template-columns: min-content 1fr min-content;
  align-items: center;
  gap: 0.4rem;
  min-height: 0;
}

.lightbox__nav {
  align-self: stretch;
  padding: 0;
  background: rgba(255, 250, 244, 0.14);
  color: #fff8ef;
  border-color: rgba(255, 247, 235, 0.16);
  font-size: 2rem;
}

.lightbox__nav:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.lightbox__figure {
  margin: 0;
  display: grid;
  gap: 0.8rem;
  min-width: 0;
}

.lightbox__figure img {
  width: 100%;
  max-height: min(70vh, 860px);
  object-fit: contain;
  border-radius: 22px;
  background: rgba(255, 250, 244, 0.08);
}

.lightbox__caption {
  display: grid;
  gap: 0.3rem;
  padding: 0.95rem 1rem 1.05rem;
  border-radius: 18px;
  background: rgba(255, 250, 244, 0.1);
  color: #fffaf3;
}

.lightbox__caption-text,
.lightbox__meta {
  margin: 0;
}

.lightbox__caption-text {
  font-size: 1rem;
  line-height: 1.5;
}

.lightbox__meta {
  color: rgba(255, 242, 224, 0.8);
  font-size: 0.92rem;
}

.site-footer {
  padding: 0 1rem 2.5rem;
  text-align: center;
  font-size: 0.92rem;
}

@media (min-width: 700px) {
  .hero {
    padding: 7rem 1.5rem 4rem;
  }

  .page-shell {
    padding: 2rem 1.5rem 4.5rem;
  }

  .section {
    padding: 1.35rem;
  }

  .thumb-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1rem;
  }
}

@media (min-width: 980px) {
  .thumb-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

@media (max-width: 699px) {
  .lightbox {
    padding: 0.5rem;
  }

  .lightbox__panel {
    border-radius: 22px;
    padding: 0.65rem;
  }

  .lightbox__viewer {
    grid-template-columns: 1fr;
    gap: 0.6rem;
  }

  .lightbox__nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 3rem;
    min-height: 3.5rem;
    z-index: 2;
  }

  .lightbox__nav#prev-photo {
    left: 0.8rem;
  }

  .lightbox__nav#next-photo {
    right: 0.8rem;
  }

  .lightbox__figure img {
    max-height: 64vh;
  }
}
