:root {
  --bg: #091014;
  --surface: rgba(16, 24, 28, 0.9);
  --surface-soft: rgba(24, 35, 40, 0.94);
  --surface-strong: rgba(20, 29, 33, 0.96);
  --line: rgba(246, 234, 212, 0.14);
  --text: #f5efe1;
  --muted: #b6c0bc;
  --accent: #d7a565;
  --chip: #223138;
  --chip-active: #60411a;
  --shadow: 0 18px 48px rgba(0, 0, 0, 0.24);
  --lightbox-nav-top: 50%;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  font-family: 'Fira Sans', sans-serif;
  background:
    radial-gradient(circle at top left, rgba(215, 165, 101, 0.12), transparent 26%),
    linear-gradient(180deg, var(--bg) 0%, #10181c 100%);
}

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

button,
select {
  font: inherit;
}

code {
  padding: 0.1rem 0.35rem;
  border-radius: 0.35rem;
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
}

.page-hero,
.page-shell {
  width: min(1100px, calc(100vw - 2.25rem));
  margin: 0 auto;
}

.page-hero {
  padding: 1.25rem 0 1.2rem;
}

.back-link {
  display: inline-flex;
  align-items: center;
  padding: 0.55rem 0.9rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  text-decoration: none;
  background: rgba(255, 255, 255, 0.04);
  transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.back-link:hover,
.back-link:focus-visible {
  color: var(--text);
  background: rgba(255, 255, 255, 0.08);
  border-color: var(--accent);
}

.hero-copy,
.controls-panel,
.photo-card,
.lightbox-panel {
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--surface-strong);
  box-shadow: var(--shadow);
}

.hero-copy,
.controls-panel {
  padding: 1.1rem 1.2rem;
}

.hero-copy h1,
.controls-copy h2,
.section-header h2,
.card-title,
.lightbox-copy h2 {
  margin: 0;
  font-weight: 600;
  line-height: 1.15;
}

.hero-copy h1 {
  font-size: clamp(1.85rem, 3.8vw, 2.5rem);
}

.intro,
.intro-meta,
.card-source,
.lightbox-description,
.active-filter-copy,
.status-pill {
  color: var(--muted);
}

.intro {
  max-width: 44rem;
  margin: 0.55rem 0 0;
  font-size: 0.96rem;
  line-height: 1.55;
}

.intro-meta {
  margin: 0.55rem 0 0;
  font-size: 0.9rem;
  line-height: 1.5;
}

.eyebrow {
  margin: 0 0 0.45rem;
  color: var(--accent);
  font-size: 0.84rem;
  font-weight: 500;
}

.page-shell {
  padding-bottom: 2.2rem;
}

.controls-panel {
  background: var(--surface);
}

.controls-row,
.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}

.controls-row {
  margin-top: 0.75rem;
}

.sort-control {
  display: inline-grid;
  gap: 0.45rem;
  color: var(--text);
  font-size: 0.9rem;
}

.sort-control select {
  min-width: 220px;
  padding: 0.66rem 0.85rem;
  border: 1px solid var(--line);
  border-radius: 12px;
  color: var(--text);
  background: var(--surface-soft);
}

.status-pill {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  padding: 0.55rem 0.8rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--line);
  font-size: 0.88rem;
}

.tag-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  margin-top: 0.85rem;
}

.tag-button,
.tag-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 32px;
  padding: 0.4rem 0.75rem;
  border-radius: 999px;
  background: var(--chip);
  color: var(--text);
  border: 1px solid transparent;
  font-size: 0.84rem;
}

.tag-button {
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease;
}

.tag-button:hover,
.tag-button:focus-visible {
  border-color: var(--accent);
}

.tag-button.is-active {
  background: var(--chip-active);
  border-color: var(--accent);
}

.gallery-section {
  margin-top: 1.25rem;
}

.section-header {
  margin-bottom: 0.8rem;
}

.section-header h2 {
  font-size: clamp(1.15rem, 2vw, 1.35rem);
}

.active-filter-copy {
  margin: 0;
  text-align: right;
  font-size: 0.88rem;
}

.gallery-grid {
  column-width: 19rem;
  column-gap: 1rem;
}

.photo-card {
  break-inside: avoid;
  margin: 0 0 1rem;
  overflow: hidden;
}

.photo-trigger {
  width: 100%;
  padding: 0;
  border: 0;
  color: inherit;
  text-align: left;
  background: transparent;
  cursor: pointer;
}

.photo-image {
  width: 100%;
  height: auto;
  transition: transform 0.25s ease;
}

.photo-trigger:hover .photo-image,
.photo-trigger:focus-visible .photo-image {
  transform: scale(1.01);
}

.card-copy {
  padding: 0.75rem 0.85rem 0.85rem;
}

.card-date {
  margin: 0 0 0.25rem;
  color: var(--accent);
  font-size: 0.76rem;
}

.card-title {
  font-size: 1rem;
}

.tag-list,
.lightbox-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-top: 0.7rem;
}

.tag-chip {
  min-height: auto;
  font-size: 0.8rem;
}

.empty-state {
  padding: 1.5rem;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--muted);
}

.lightbox[hidden] {
  display: none;
}

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: grid;
  place-items: center;
  padding: 1rem;
}

.lightbox-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(4, 9, 11, 0.82);
}

.lightbox-panel {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(280px, 0.9fr);
  width: min(1100px, calc(100vw - 2rem));
  max-height: calc(100vh - 2rem);
  overflow: hidden;
}

.lightbox-close {
  position: absolute;
  top: 0.9rem;
  right: 0.9rem;
  z-index: 2;
  padding: 0.55rem 0.85rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(9, 16, 20, 0.84);
  color: var(--text);
  cursor: pointer;
}

.lightbox-expand {
  position: absolute;
  top: 0.9rem;
  right: calc(0.9rem + 4.85rem);
  z-index: 2;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.9rem;
  height: 2.9rem;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(9, 16, 20, 0.84);
  color: var(--text);
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease, opacity 0.2s ease;
}

.lightbox-expand:hover,
.lightbox-expand:focus-visible {
  background: rgba(24, 35, 40, 0.96);
  border-color: var(--accent);
}

.lightbox-expand[hidden] {
  display: none;
}

.lightbox-expand span {
  font-size: 1.2rem;
  line-height: 1;
}

.lightbox-nav {
  position: absolute;
  top: var(--lightbox-nav-top);
  z-index: 2;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 3rem;
  height: 3rem;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(9, 16, 20, 0.84);
  color: var(--text);
  cursor: pointer;
  transform: translateY(-50%);
  transition: background 0.2s ease, border-color 0.2s ease, opacity 0.2s ease;
}

.lightbox-nav:hover,
.lightbox-nav:focus-visible {
  background: rgba(24, 35, 40, 0.96);
  border-color: var(--accent);
}

.lightbox-nav:disabled {
  opacity: 0.4;
  cursor: default;
}

.lightbox-nav-prev {
  left: 0.9rem;
}

.lightbox-nav-next {
  right: calc(0.9rem + 4.6rem);
}

.lightbox-nav span {
  font-size: 1.25rem;
  line-height: 1;
}

.lightbox-figure {
  position: relative;
  margin: 0;
  display: grid;
  place-items: center;
  min-height: min(68vh, calc(100vh - 8rem));
  background: var(--surface-soft);
  touch-action: pan-y;
}

.lightbox-figure img {
  max-height: calc(100vh - 2rem);
  object-fit: contain;
  transition: opacity 0.2s ease;
}

.lightbox-figure.is-loading img {
  opacity: 0;
}

.lightbox-loader {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

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

.lightbox-spinner {
  width: 2rem;
  height: 2rem;
  border: 2px solid rgba(245, 239, 225, 0.18);
  border-top-color: var(--accent);
  border-radius: 999px;
  animation: lightbox-spin 0.8s linear infinite;
}

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

.lightbox-copy {
  padding: 3.6rem 1.1rem 1.1rem;
  overflow: auto;
  border-left: 1px solid var(--line);
}

.lightbox-copy h2 {
  font-size: clamp(1.2rem, 2vw, 1.5rem);
}

.lightbox-panel:fullscreen {
  width: 100vw;
  height: 100vh;
  max-height: none;
  border-radius: 0;
  border: 0;
  grid-template-columns: 1fr;
  background: #05090b;
}

.lightbox-panel:fullscreen .lightbox-copy {
  display: none;
}

.lightbox-panel:fullscreen .lightbox-figure {
  min-height: 100vh;
  background: #05090b;
}

.lightbox-panel:fullscreen .lightbox-figure img {
  max-width: 100vw;
  max-height: 100vh;
}

.lightbox-panel:fullscreen .lightbox-nav,
.lightbox-panel:fullscreen .lightbox-close,
.lightbox-panel:fullscreen .lightbox-expand {
  background: rgba(5, 9, 11, 0.8);
}

.lightbox-description {
  margin: 0.65rem 0 0;
  line-height: 1.55;
  font-size: 0.93rem;
}

body.modal-open {
  overflow: hidden;
}

@media (max-width: 880px) {
  :root {
    --lightbox-nav-top: clamp(10rem, 34vh, 18rem);
  }

  .lightbox-panel {
    grid-template-columns: 1fr;
  }

  .lightbox-copy {
    border-left: 0;
    border-top: 1px solid var(--line);
  }
}

@media (max-width: 720px) {
  .page-hero,
  .page-shell {
    width: min(100vw - 1rem, 1100px);
  }

  .controls-row,
  .section-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .status-pill,
  .sort-control,
  .sort-control select {
    width: 100%;
  }

  .active-filter-copy {
    text-align: left;
  }

  .gallery-grid {
    column-width: 15rem;
  }

  .lightbox {
    padding: 0.6rem;
  }

  .lightbox-panel {
    width: calc(100vw - 1.2rem);
    max-height: calc(100vh - 1.2rem);
  }

  .lightbox-figure {
    min-height: min(56vh, calc(100vh - 12rem));
  }

  .lightbox-nav {
    width: 2.75rem;
    height: 2.75rem;
  }

  .lightbox-expand {
    width: 2.75rem;
    height: 2.75rem;
    right: calc(0.65rem + 4.25rem);
  }

  .lightbox-nav-prev {
    left: 0.65rem;
  }

  .lightbox-nav-next {
    right: calc(0.65rem + 4.25rem);
  }

  .lightbox-copy {
    padding-top: 1.25rem;
  }
}
