:root {
  color-scheme: light;
  --bg: #f7f2e9;
  --bg-accent: #e6efe9;
  --panel: #ffffff;
  --ink: #1d1b16;
  --muted: #5e5a52;
  --accent: #2f6f5e;
  --accent-strong: #1f4a3f;
  --accent-soft: #d6ede5;
  --border: rgba(29, 27, 22, 0.12);
  --shadow: 0 18px 40px rgba(29, 27, 22, 0.12);
  --radius: 18px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Newsreader", "Times New Roman", serif;
  color: var(--ink);
  background: radial-gradient(circle at top left, #fffaf0 0%, var(--bg) 40%),
    radial-gradient(circle at 20% 10%, var(--bg-accent) 0%, transparent 55%),
    radial-gradient(circle at 80% 0%, #fce9d6 0%, transparent 55%);
  min-height: 100vh;
}

h1,
h2,
h3,
.kicker {
  font-family: "Sora", "Trebuchet MS", sans-serif;
}

h1 {
  font-size: clamp(2.4rem, 3vw, 3.4rem);
  margin: 0 0 0.5rem;
}

h2 {
  font-size: 1.1rem;
  margin: 0;
}

p {
  margin: 0;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(0, 1fr);
  gap: 2rem;
  padding: 3.5rem clamp(1.5rem, 4vw, 4rem) 2.5rem;
  align-items: center;
}

.kicker {
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 0.72rem;
  color: var(--accent-strong);
  font-weight: 600;
}

.lede {
  font-size: 1.1rem;
  color: var(--muted);
  max-width: 36rem;
}

.hero__controls {
  background: var(--panel);
  border-radius: var(--radius);
  padding: 1.5rem;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
}

.search-field {
  display: flex;
  gap: 0.75rem;
  align-items: center;
}

.search-field input {
  flex: 1;
  padding: 0.85rem 1rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  font-size: 1rem;
  background: #fbfaf7;
  color: var(--ink);
}

.search-field input:focus {
  outline: 2px solid var(--accent-soft);
  border-color: var(--accent);
}

.stats {
  margin-top: 1rem;
  font-size: 0.95rem;
  color: var(--muted);
}

.layout {
  display: grid;
  grid-template-columns: minmax(240px, 320px) minmax(0, 1fr);
  gap: 2rem;
  padding: 0 clamp(1.5rem, 4vw, 4rem) 3rem;
}

.filters {
  position: sticky;
  top: 1.5rem;
  align-self: start;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  height: calc(100vh - 3rem);
  overflow-y: auto;
  overflow-x: hidden;
  padding-right: 0.35rem;
  scrollbar-gutter: stable;
  overscroll-behavior: contain;
}

.filter-section {
  background: var(--panel);
  border-radius: var(--radius);
  padding: 1.25rem;
  border: 1px solid var(--border);
  box-shadow: 0 10px 25px rgba(29, 27, 22, 0.08);
}

.section-title {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.75rem;
}

.section-actions {
  display: flex;
  gap: 0.6rem;
  align-items: center;
}

.filter-section.collapsed .collapsible {
  display: none;
}

.text-btn {
  background: none;
  border: none;
  color: var(--accent-strong);
  font-size: 0.85rem;
  cursor: pointer;
}

.text-btn:hover {
  text-decoration: underline;
}

.tag-search {
  width: 100%;
  padding: 0.65rem 0.75rem;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: #fbfaf7;
  margin-bottom: 0.75rem;
}

.pill-list {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.5rem;
}

.pill-list.scroll {
  max-height: 320px;
  overflow: auto;
  padding-right: 0.25rem;
}

.pill {
  border: 1px solid var(--border);
  background: #fdfbf7;
  color: var(--ink);
  padding: 0.4rem 0.75rem;
  border-radius: 999px;
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.2s ease;
  text-align: left;
  width: 100%;
}

.pill[aria-pressed="true"] {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent-strong);
}

.pill:hover {
  border-color: var(--accent);
}

.btn {
  padding: 0.85rem 1.25rem;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  border: none;
  font-size: 0.95rem;
  cursor: pointer;
  box-shadow: 0 12px 24px rgba(47, 111, 94, 0.25);
}

.btn:hover {
  background: var(--accent-strong);
}

.ghost {
  padding: 0.6rem 1rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: #fff;
  cursor: pointer;
  font-size: 0.9rem;
}

.gallery {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.active-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.active-chip {
  background: var(--accent-soft);
  color: var(--accent-strong);
  padding: 0.35rem 0.7rem;
  border-radius: 999px;
  font-size: 0.8rem;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.active-chip button {
  border: none;
  background: none;
  cursor: pointer;
  font-weight: 700;
  color: var(--accent-strong);
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 1.25rem;
}

.card {
  background: var(--panel);
  border-radius: 16px;
  overflow: hidden;
  border: 1px solid var(--border);
  box-shadow: 0 12px 25px rgba(29, 27, 22, 0.08);
  display: flex;
  flex-direction: column;
  min-height: 100%;
  cursor: pointer;
}

.card img {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  display: block;
  background: #efece4;
}

.card .meta {
  padding: 0.85rem 0.9rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.card h3 {
  font-size: 0.98rem;
  margin: 0;
}

.card .meta p {
  font-size: 0.85rem;
  color: var(--muted);
}

.card .meta .path {
  font-size: 0.75rem;
  color: #7a746a;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.tag-row span {
  font-size: 0.75rem;
  background: #f6f1e8;
  padding: 0.25rem 0.5rem;
  border-radius: 999px;
}

.empty {
  text-align: center;
  padding: 3rem 1rem;
  background: rgba(255, 255, 255, 0.7);
  border-radius: var(--radius);
  border: 1px dashed var(--border);
}

.hidden {
  display: none;
}

.footer {
  padding: 2.5rem clamp(1.5rem, 4vw, 4rem) 3rem;
  color: var(--muted);
  font-size: 0.9rem;
}

.sentinel {
  height: 1px;
}

.modal {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  z-index: 20;
}

.modal.hidden {
  display: none;
}

.modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(20, 18, 14, 0.55);
  backdrop-filter: blur(4px);
}

.modal__panel {
  position: relative;
  z-index: 1;
  width: min(1100px, 92vw);
  max-height: 90vh;
  overflow: auto;
  background: #fff;
  border-radius: 20px;
  border: 1px solid var(--border);
  box-shadow: 0 24px 60px rgba(20, 18, 14, 0.35);
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.modal__header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}

.modal__body {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr);
  gap: 1.5rem;
  align-items: start;
}

.modal__body img {
  width: 100%;
  max-height: 70vh;
  object-fit: contain;
  border-radius: 16px;
  border: 1px solid var(--border);
  background: #f7f2e9;
  cursor: zoom-in;
}

.modal__meta {
  display: grid;
  gap: 0.85rem;
  font-size: 0.95rem;
  color: var(--muted);
}

.modal__meta strong {
  color: var(--ink);
  font-weight: 600;
}

.modal__meta .meta-block {
  background: #f9f5ee;
  border-radius: 12px;
  padding: 0.75rem 0.9rem;
  border: 1px solid var(--border);
}

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: grid;
  place-items: center;
}

.lightbox.hidden {
  display: none;
}

.lightbox__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(12, 10, 8, 0.75);
}

.lightbox__panel {
  position: relative;
  z-index: 1;
  width: min(1400px, 95vw);
  height: min(900px, 92vh);
  background: #11100f;
  border-radius: 20px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.lightbox__toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem 1rem;
  color: #f4efe6;
  font-family: "Sora", sans-serif;
  font-size: 0.85rem;
  background: rgba(10, 9, 8, 0.9);
}

.lightbox__controls {
  display: flex;
  gap: 0.5rem;
}

.lightbox__hint {
  color: rgba(244, 239, 230, 0.75);
}

.lightbox__stage {
  flex: 1;
  position: relative;
  overflow: hidden;
  display: grid;
  place-items: center;
}

.lightbox__stage img {
  max-width: 100%;
  max-height: 100%;
  transform-origin: center center;
  cursor: grab;
  user-select: none;
  touch-action: none;
}

.lightbox__stage img.dragging {
  cursor: grabbing;
}

@media (max-width: 1024px) {
  .hero {
    grid-template-columns: 1fr;
  }

  .layout {
    grid-template-columns: 1fr;
  }

  .filters {
    position: static;
    height: auto;
    overflow: visible;
  }

  .modal__body {
    grid-template-columns: 1fr;
  }

  .lightbox__panel {
    width: 95vw;
    height: 90vh;
  }
}

@media (prefers-reduced-motion: reduce) {
  * {
    scroll-behavior: auto !important;
    transition: none !important;
  }
}
