:root {
  --bg: #f5f3ee;
  --panel: rgba(255, 255, 255, 0.76);
  --card: #ffffff;
  --card-alt: #f1f5f9;
  --text: #111827;
  --muted: #6b7280;
  --line: rgba(17, 24, 39, 0.08);
  --shadow: 0 20px 50px rgba(17, 24, 39, 0.08);
  --accent: #111827;
  --accent-2: #0ea5e9;
  --page-gradient: linear-gradient(180deg, #f9f6f1 0%, #f3f6fb 100%);
  --topbar-bg: rgba(255, 255, 255, 0.72);
  --input-bg: rgba(255, 255, 255, 0.88);
  --chip-text: #39424a;
  --suggestion-text: #48545d;
  --collection-active: #1d3035;
  --button-text: #ffffff;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #111820;
  --panel: rgba(30, 41, 53, 0.9);
  --card: #1c2732;
  --card-alt: #253341;
  --text: #e7edf3;
  --muted: #a1afbc;
  --line: rgba(226, 237, 247, 0.14);
  --shadow: 0 20px 50px rgba(0, 0, 0, 0.24);
  --accent: #d7e5f1;
  --accent-2: #38bdf8;
  --page-gradient: linear-gradient(180deg, #111820 0%, #17232e 100%);
  --topbar-bg: rgba(17, 24, 32, 0.84);
  --input-bg: rgba(35, 48, 61, 0.96);
  --chip-text: #d5e0e9;
  --suggestion-text: #d5e0e9;
  --collection-active: #0d3440;
  --button-text: #111820;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: "Poppins", sans-serif;
  background: var(--page-gradient);
  color: var(--text);
}

a {
  color: inherit;
  text-decoration: none;
}

button, input {
  font: inherit;
}

img {
  max-width: 100%;
  display: block;
}

.container {
  width: min(1200px, calc(100% - 32px));
  margin: 0 auto;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  backdrop-filter: blur(14px);
  background: var(--topbar-bg);
  border-bottom: 1px solid var(--line);
}

.navbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  min-height: 78px;
}

.brand {
  display: flex;
  align-items: center;
  font-size: clamp(1.5rem, 2vw, 2.25rem);
  font-weight: 700;
  letter-spacing: -0.06em;
}

.brand span {
  color: var(--accent-2);
  margin-left: 0.15em;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.nav-links a {
  padding: 10px 16px;
  border-radius: 999px;
  color: var(--muted);
  font-weight: 600;
  transition: all 0.2s ease;
}

.nav-links a:hover,
.nav-links a.active {
  color: var(--text);
  background: rgba(14, 165, 233, 0.08);
}

.searchbar {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--input-bg);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 8px 12px 8px 16px;
  min-width: min(440px, 100%);
  box-shadow: 0 8px 18px rgba(17, 24, 39, 0.04);
}

.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  flex: 0 0 auto;
  min-height: 42px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--card);
  color: var(--text);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s ease, transform 0.2s ease;
}

.theme-toggle:hover {
  transform: translateY(-1px);
  background: var(--card-alt);
}

.theme-toggle span[aria-hidden="true"] {
  color: var(--accent-2);
  font-size: 1.1rem;
  line-height: 1;
}

.searchbar input {
  flex: 1;
  border: 0;
  background: transparent;
  color: var(--text);
  padding: 8px 0;
  outline: none;
}

.searchbar button {
  border: 0;
  border-radius: 999px;
  background: var(--accent);
  color: var(--button-text);
  font-weight: 600;
  padding: 10px 18px;
  cursor: pointer;
  transition: transform 0.2s ease;
}

.searchbar button:hover {
  transform: translateY(-1px);
}

.hero {
  padding: 54px 0 22px;
}

.hero .container {
  width: min(1500px, calc(100% - 48px));
}

.hero-panel {
  background: linear-gradient(135deg, rgba(17, 24, 39, 0.96), rgba(17, 24, 39, 0.8));
  border-radius: 32px;
  min-height: 290px;
  display: grid;
  place-items: center;
  padding: 42px 18px;
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
}

.hero-panel::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at top right, rgba(14,165,233,0.36), transparent 40%),
              radial-gradient(circle at left center, rgba(255,255,255,0.12), transparent 35%);
}

.hero-inner {
  position: relative;
  z-index: 1;
  text-align: center;
  max-width: 700px;
}

.eyebrow {
  display: inline-flex;
  padding: 8px 14px;
  background: rgba(255,255,255,0.12);
  border: 1px solid rgba(255,255,255,0.14);
  border-radius: 999px;
  color: rgba(255,255,255,0.9);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.hero h1 {
  margin: 18px 0 12px;
  color: white;
  font-size: clamp(2.4rem, 4vw, 4.25rem);
  letter-spacing: -0.08em;
  line-height: 0.98;
}

.hero p {
  color: rgba(255,255,255,0.8);
  margin: 0 auto 24px;
  max-width: 560px;
  font-size: 1.04rem;
}

.hero-actions {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  flex-wrap: wrap;
}

.primary-btn,
.secondary-btn,
.chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  font-weight: 600;
  transition: transform 0.2s ease;
}

.primary-btn {
  background: white;
  color: #111827;
  padding: 14px 20px;
}

.secondary-btn {
  border: 1px solid rgba(255,255,255,0.2);
  background: rgba(255,255,255,0.05);
  color: white;
  padding: 13px 20px;
}

.hero-action-icon {
  width: 18px;
  height: 18px;
  margin-left: 8px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: transform 0.2s ease;
}

.primary-btn:hover .hero-action-icon {
  transform: translateY(2px);
}

.secondary-btn:hover .hero-action-icon {
  transform: translate(2px, -2px);
}

.primary-btn:hover,
.secondary-btn:hover,
.chip:hover {
  transform: translateY(-1px);
}

.gallery-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin: 26px 0 22px;
  flex-wrap: wrap;
}

.filter-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.chip {
  background: var(--panel);
  border: 1px solid var(--line);
  color: var(--text);
  padding: 10px 16px;
  font-size: 0.8rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.chip.active {
  background: var(--accent);
  color: var(--button-text);
  border-color: var(--accent);
}

.page-title {
  margin: 0;
  font-size: clamp(1.8rem, 2vw, 2.6rem);
  letter-spacing: -0.04em;
}

.search-note {
  margin: -10px 0 20px;
  color: var(--muted);
  font-size: 0.88rem;
}

.search-suggestions {
  display: flex;
  align-items: center;
  gap: 14px;
  margin: -8px 0 22px;
}

.suggestion-label {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 600;
  white-space: nowrap;
}

.suggestion-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.suggestion-tag {
  padding: 7px 12px;
  border: 1px solid rgba(17,24,39,0.1);
  border-radius: 999px;
  background: var(--panel);
  color: var(--suggestion-text);
  font-size: 0.75rem;
  transition: all 0.18s ease;
}

.suggestion-tag:hover {
  transform: translateY(-1px);
  border-color: rgba(14,165,233,0.4);
  background: #eaf7fb;
  color: var(--text);
}

.provider-credit {
  margin: -12px 0 14px;
  font-size: 0.82rem;
  color: var(--muted);
}

.provider-credit a,
.photo-attribution {
  color: var(--accent);
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.collections-page {
  width: min(1320px, calc(100% - 48px));
  padding-top: 34px;
}

.collections-intro {
  min-height: 290px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 32px;
  overflow: hidden;
  position: relative;
  padding: clamp(30px, 6vw, 64px);
  border-radius: 8px;
  color: white;
  background:
    radial-gradient(ellipse at 83% 10%, rgba(115, 190, 211, 0.52), transparent 30%),
    radial-gradient(ellipse at 76% 100%, rgba(197, 130, 91, 0.45), transparent 36%),
    linear-gradient(115deg, #172b33, #263b3c 54%, #68594d);
}

.collections-intro::after {
  content: "";
  position: absolute;
  width: 300px;
  height: 300px;
  right: 8%;
  top: 18%;
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: 50%;
  box-shadow: 0 0 0 34px rgba(255,255,255,0.035), 0 0 0 70px rgba(255,255,255,0.025);
  pointer-events: none;
}

.collections-copy {
  position: relative;
  z-index: 1;
  max-width: 640px;
}

.collections-kicker,
.section-kicker {
  color: #8ccbd7;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.collections-copy h1 {
  margin: 16px 0 12px;
  font-size: clamp(2.3rem, 5vw, 4.4rem);
  letter-spacing: -0.075em;
  line-height: 0.98;
}

.collections-copy p {
  max-width: 460px;
  margin: 0;
  color: rgba(255,255,255,0.72);
  font-size: 1rem;
}

.collections-mark {
  position: relative;
  z-index: 1;
  display: flex;
  flex: 0 0 170px;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  aspect-ratio: 1;
  border: 1px solid rgba(255,255,255,0.35);
  border-radius: 50%;
  background: rgba(255,255,255,0.08);
  backdrop-filter: blur(6px);
}

.collections-mark span {
  font-size: 3.8rem;
  font-weight: 500;
  letter-spacing: -0.08em;
  line-height: 1;
}

.collections-mark small {
  margin-top: 8px;
  color: rgba(255,255,255,0.76);
  font-size: 0.68rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.collections-browser {
  padding: 42px 0 34px;
}

.collections-heading,
.collections-gallery-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 20px;
}

.collections-heading h2,
.collections-gallery-heading h2,
.collections-heading h1 {
  margin: 6px 0 0;
  font-size: clamp(1.45rem, 2.6vw, 2rem);
  letter-spacing: -0.055em;
}

.collections-heading h1 {
  font-size: clamp(1.7rem, 3vw, 2.5rem);
}

.category-results-page {
  padding-top: 12px;
}

.category-results-page .collections-browser {
  padding-top: 28px;
}

.browse-all-link {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 600;
  white-space: nowrap;
}

.browse-all-link span {
  color: var(--accent-2);
}

.collections-heading .section-kicker,
.collections-gallery-heading .section-kicker {
  color: var(--accent-2);
}

.collection-count {
  color: var(--muted);
  font-size: 0.82rem;
}

.collection-list {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 10px;
}

.collection-chip {
  min-height: 52px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 0 15px;
  border: 1px solid rgba(17,24,39,0.09);
  background: var(--panel);
  color: var(--chip-text);
  font-size: 0.84rem;
  font-weight: 600;
  transition: color 0.2s ease, background 0.2s ease, border-color 0.2s ease, transform 0.2s ease;
}

.collection-chip:nth-child(5n + 1) {
  border-left: 3px solid #8bb9a6;
}

.collection-chip:nth-child(5n + 2) {
  border-left: 3px solid #d4a77f;
}

.collection-chip:nth-child(5n + 3) {
  border-left: 3px solid #80a9bb;
}

.collection-chip:nth-child(5n + 4) {
  border-left: 3px solid #b49bbd;
}

.collection-chip:nth-child(5n) {
  border-left: 3px solid #d2bd73;
}

.collection-arrow {
  color: #9aa3ac;
  font-size: 1rem;
  transition: transform 0.2s ease;
}

.collection-chip:hover,
.collection-chip.active {
  transform: translateY(-2px);
  border-color: rgba(17,24,39,0.16);
  background: var(--collection-active);
  color: white;
}

.collection-chip:hover .collection-arrow,
.collection-chip.active .collection-arrow {
  color: #a9dce2;
  transform: translate(2px, -2px);
}

.collections-gallery-heading {
  margin: 0 0 4px;
}

.collections-gallery-heading a {
  color: var(--muted);
  font-size: 0.78rem;
}

.collections-gallery-heading a span {
  color: var(--accent-2);
}

.gallery-grid {
  width: 100%;
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  grid-auto-rows: 64px;
  grid-auto-flow: dense;
  gap: 14px;
  padding: 8px 0 60px;
}

.gallery-container {
  width: calc(100vw - 40px);
  max-width: none;
  margin-left: calc((100% - 100vw) / 2 + 20px);
}

.gallery-card {
  display: block;
  position: relative;
  overflow: hidden;
  grid-row: span 4;
  min-height: 0;
  border-radius: 10px;
  background: var(--card);
  box-shadow: var(--shadow);
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.gallery-card[data-layout="compact"] {
  grid-row: span 3;
}

.gallery-card[data-layout="tall"] {
  grid-row: span 5;
}

.gallery-card[data-layout="wide"] {
  grid-column: span 2;
  grid-row: span 4;
}

.gallery-card[data-layout="feature"] {
  grid-column: span 2;
  grid-row: span 5;
}

.gallery-card:hover {
  transform: translateY(-3px) rotate(-0.25deg);
  box-shadow: 0 24px 50px rgba(17, 24, 39, 0.12);
}

.image-only .gallery-card {
  cursor: default;
}

.gallery-card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.gallery-card .meta {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 18px 16px;
  background: linear-gradient(180deg, rgba(17, 24, 39, 0.0), rgba(17,24,39,0.8));
  color: white;
}

.gallery-card .meta strong {
  display: block;
  font-size: 0.92rem;
}

.gallery-card .meta span {
  font-size: 0.74rem;
  color: rgba(255,255,255,0.8);
}

.gallery-card .save {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 0;
  background: rgba(255,255,255,0.12);
  color: white;
  cursor: pointer;
}

.load-more-wrap {
  display: flex;
  align-items: center;
  flex-direction: column;
  gap: 10px;
  padding: 0 0 56px;
}

.load-more-button {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  padding: 13px 20px;
  border: 1px solid rgba(17,24,39,0.14);
  background: var(--card);
  color: var(--text);
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease, transform 0.2s ease;
}

.load-more-button:hover:not(:disabled) {
  transform: translateY(-2px);
  background: var(--accent);
  color: white;
}

.load-more-button:disabled {
  cursor: wait;
  opacity: 0.7;
}

.load-more-button[hidden] {
  display: none;
}

.load-more-status {
  min-height: 1.2em;
  margin: 0;
  color: var(--muted);
  font-size: 0.82rem;
}

.lightbox {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.8);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
  z-index: 50;
}

.lightbox.open {
  display: flex;
}

.lightbox-panel {
  position: relative;
  width: min(1000px, 92vw);
  background: white;
  border-radius: 28px;
  overflow: hidden;
  box-shadow: 0 30px 80px rgba(15, 23, 42, 0.35);
}

.lightbox-panel img {
  width: 100%;
  max-height: 70vh;
  object-fit: cover;
}

.lightbox-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 42px;
  height: 42px;
  border: 0;
  border-radius: 50%;
  background: rgba(17,24,39,0.7);
  color: white;
  font-size: 1.7rem;
  cursor: pointer;
}

.lightbox-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  padding: 18px 22px 22px;
}

.lightbox-meta h3 {
  margin: 0;
  font-size: 1.15rem;
}

.link-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 16px;
  background: var(--accent);
  color: var(--button-text);
  border-radius: 999px;
  font-weight: 600;
}

.empty-state {
  border-radius: 24px;
  border: 1px dashed var(--line);
  background: var(--panel);
  padding: 32px;
  color: var(--muted);
  text-align: center;
}

.photo-page {
  padding-top: 32px;
  padding-bottom: 60px;
}

.back-link {
  display: inline-flex;
  color: var(--muted);
  font-weight: 600;
  margin-bottom: 18px;
}

.back-link:hover {
  color: var(--text);
}

.photo-detail {
  overflow: hidden;
  border-radius: 28px;
  background: var(--card);
  box-shadow: var(--shadow);
}

.photo-viewer {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background: #111827;
  touch-action: pan-y;
}

.photo-detail-image {
  width: 100%;
  max-height: min(72vh, 820px);
  object-fit: contain;
  background: #111827;
  transform: scale(1);
  transition: transform 0.18s ease;
  will-change: transform;
}

.photo-viewer.is-zoomed {
  touch-action: none;
}

.photo-viewer.is-zoomed .photo-detail-image {
  cursor: grab;
}

.photo-detail-image.is-panning {
  cursor: grabbing;
  transition: none;
  user-select: none;
}

.photo-zoom-controls {
  position: absolute;
  right: 16px;
  bottom: 16px;
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 6px;
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: 7px;
  background: rgba(17,24,39,0.78);
  color: white;
  backdrop-filter: blur(8px);
}

.photo-zoom-button,
.photo-zoom-reset {
  min-width: 34px;
  height: 34px;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: white;
  cursor: pointer;
}

.photo-zoom-button {
  font-size: 1.3rem;
  line-height: 1;
}

.photo-zoom-level {
  min-width: 42px;
  text-align: center;
  font-size: 0.78rem;
  font-variant-numeric: tabular-nums;
}

.photo-zoom-reset {
  padding: 0 9px;
  font-size: 0.76rem;
}

.photo-zoom-button:hover:not(:disabled),
.photo-zoom-reset:hover:not(:disabled) {
  background: rgba(255,255,255,0.14);
}

.photo-zoom-button:disabled,
.photo-zoom-reset:disabled {
  opacity: 0.45;
  cursor: default;
}

.photo-detail-info {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 24px;
  padding: 24px 30px;
}

.photo-detail-info > div:first-child {
  flex: 1 1 auto;
  min-width: 0;
}

.photo-detail-info .eyebrow {
  color: var(--muted);
  background: var(--card-alt);
  border-color: var(--line);
}

.photo-detail-info h1 {
  margin: 12px 0 4px;
  font-size: clamp(1.4rem, 3vw, 2rem);
}

.photo-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.photo-tag {
  padding: 6px 11px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--card-alt);
  color: var(--text);
  font-size: 0.82rem;
  line-height: 1.2;
  text-decoration: none;
  transition: border-color 0.18s ease, background 0.18s ease;
}

.photo-tag:hover {
  border-color: var(--accent);
  background: var(--card-alt);
}

.photo-attribution {
  display: inline-block;
  margin-top: 12px;
}

.photo-actions {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  flex: 0 0 auto;
}

.photo-actions .link-btn {
  min-height: 46px;
  gap: 10px;
  padding: 0 24px;
  border: 1px solid #111827;
  border-radius: 6px;
  background: #111827;
  box-shadow: 0 8px 18px rgba(17, 24, 39, 0.16);
  color: #fff;
  font-size: 0.88rem;
  letter-spacing: 0.01em;
  transition: background 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

.photo-actions .link-btn:hover {
  background: #273b43;
}

.photo-actions .link-btn::before {
  content: none;
  font-size: 1.15rem;
  line-height: 1;
}

:root[data-theme="dark"] .photo-actions .link-btn {
  border-color: #38bdf8;
  background: #38bdf8;
  color: #0c1820;
}

:root[data-theme="dark"] .photo-actions .link-btn:hover {
  background: #7dd3fc;
}

.photo-actions .link-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 24px rgba(17, 24, 39, 0.22);
}

.source-link {
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 600;
}

.source-link:hover {
  color: var(--text);
}

:root[data-theme="dark"] .suggestion-tag:hover {
  background: #1d3a48;
}

:root[data-theme="dark"] .collection-arrow {
  color: #a1afbc;
}

:root[data-theme="dark"] .lightbox-panel {
  background: var(--card);
}

@media (max-width: 900px) {
  .navbar {
    display: grid;
    grid-template-columns: auto 1fr auto;
    gap: 12px 18px;
    padding: 14px 0;
  }

  .theme-toggle {
    grid-column: 3;
    grid-row: 1;
  }

  .searchbar {
    grid-column: 1 / -1;
    grid-row: 2;
    width: 100%;
    min-width: 0;
  }

  .hero {
    padding-top: 28px;
  }

  .hero .container {
    width: calc(100% - 24px);
  }

  .hero-panel {
    min-height: 230px;
    border-radius: 24px;
  }

  .gallery-controls {
    align-items: flex-start;
    flex-direction: column;
  }

  .search-suggestions {
    align-items: flex-start;
    flex-direction: column;
    gap: 8px;
  }

  .collections-page {
    width: calc(100% - 32px);
    padding-top: 22px;
  }

  .collections-intro {
    min-height: 250px;
    padding: 30px;
  }

  .collections-mark {
    flex-basis: 125px;
  }

  .collections-mark span {
    font-size: 2.8rem;
  }

  .collection-list {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .lightbox-meta {
    flex-direction: column;
    align-items: flex-start;
  }

  .gallery-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    grid-auto-rows: 68px;
    gap: 12px;
  }

  .gallery-card,
  .gallery-card {
    grid-column: span 1;
    grid-row: span 4;
  }

  .gallery-card[data-layout="wide"],
  .gallery-card[data-layout="feature"] {
    grid-column: span 1;
  }

  .gallery-card[data-layout="tall"],
  .gallery-card[data-layout="feature"] {
    grid-row: span 5;
  }

  .gallery-card[data-layout="compact"] {
    grid-row: span 3;
  }

  .photo-detail-info {
    align-items: flex-start;
    flex-direction: column;
    padding: 20px;
  }

  .photo-actions {
    align-items: center;
    flex-direction: row;
  }
}

@media (max-width: 520px) {
  .navbar {
    grid-template-columns: 1fr auto;
    gap: 12px;
    padding: 12px 0;
  }

  .brand {
    grid-column: 1;
    grid-row: 1;
  }

  .nav-links {
    grid-column: 1 / -1;
    grid-row: 2;
    justify-content: flex-start;
    gap: 4px;
  }

  .nav-links a {
    padding: 8px 12px;
    font-size: 0.88rem;
  }

  .theme-toggle {
    grid-column: 2;
    grid-row: 1;
    min-height: 38px;
    padding: 0 11px;
  }

  .searchbar {
    grid-column: 1 / -1;
    grid-row: 3;
    padding: 6px 8px 6px 13px;
  }

  .collections-page {
    width: calc(100% - 24px);
    padding-top: 14px;
  }

  .collections-intro {
    min-height: 230px;
    padding: 26px 22px;
  }

  .collections-intro::after {
    right: -100px;
  }

  .collections-mark {
    display: none;
  }

  .collections-browser {
    padding: 30px 0 26px;
  }

  .collection-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  .collection-chip {
    min-height: 48px;
    padding: 0 11px;
    font-size: 0.78rem;
  }

  .collections-gallery-heading {
    align-items: flex-start;
    flex-direction: column;
    gap: 8px;
  }

  .gallery-container {
    width: calc(100vw - 20px);
    margin-left: calc((100% - 100vw) / 2 + 10px);
  }

  .gallery-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-auto-rows: 72px;
    gap: 10px;
  }

  .gallery-card {
    grid-column: span 1;
    grid-row: span 4;
    border-radius: 7px;
  }

  .gallery-card[data-layout="wide"],
  .gallery-card[data-layout="feature"] {
    grid-column: span 1;
  }

  .gallery-card[data-layout="tall"],
  .gallery-card[data-layout="feature"] {
    grid-row: span 5;
  }

  .gallery-card[data-layout="compact"] {
    grid-row: span 3;
  }
}
