/* ============================================
   Image Library — Styles
   ============================================ */

:root {
  --color-bg: #ffffff;
  --color-surface: #ffffff;
  --color-text: #000000;
  --color-text-secondary: #2b2b2b;
  --color-muted: #666666;
  --color-border: #e0e0e0;
  --color-accent: #111111;
  --color-accent-hover: #333333;
  --color-tag-bg: #f0f0f0;
  --color-tag-bg-active: #111111;
  --color-tag-text: #444444;
  --color-tag-text-active: #ffffff;
  --color-overlay: rgba(0, 0, 0, 0.55);
  --icon-color: #2b2b2b;
  --font-stack: "Helvetica Neue", Helvetica, Arial, sans-serif;
  --grid-gap: 12px;
  --radius: 6px;
  --transition-speed: 0.25s;
  --lightbox-duration: 0.5s;
  --lightbox-ease: cubic-bezier(0.22, 1, 0.36, 1);
  --bottom-blur-height: min(22vh, 160px);
  --bottom-blur-strength: 12px;
}

[data-theme="dark"] {
  --color-bg: #0e0e0e;
  --color-surface: #1a1a1a;
  --color-text: #f5f5f5;
  --color-text-secondary: #c5c5c5;
  --color-muted: #9a9a9a;
  --color-border: #2a2a2a;
  --color-accent: #f5f5f5;
  --color-accent-hover: #cccccc;
  --color-tag-bg: #1f1f1f;
  --color-tag-bg-active: #f5f5f5;
  --color-tag-text: #c5c5c5;
  --color-tag-text-active: #0e0e0e;
  --color-overlay: rgba(0, 0, 0, 0.7);
  --icon-color: #d8d8d8;
}

/* ---- Reset & Base ---- */

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

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-stack);
  background-color: var(--color-bg);
  color: var(--color-text);
  line-height: 1.5;
}

body.lightbox-open {
  overflow: hidden;
}

body {
  transition: background-color 0.25s ease, color 0.25s ease;
}

body::after {
  content: "";
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  /* Extend through safe-area so backdrop blur reaches the physical bottom (no sharp strip above home indicator / gesture bar). */
  height: calc(var(--bottom-blur-height) + constant(safe-area-inset-bottom));
  height: calc(var(--bottom-blur-height) + env(safe-area-inset-bottom, 0px));
  pointer-events: none;
  z-index: 10;
  background: color-mix(in srgb, var(--color-bg) 60%, transparent);
  -webkit-backdrop-filter: blur(var(--bottom-blur-strength));
  backdrop-filter: blur(var(--bottom-blur-strength));
  -webkit-mask-image: linear-gradient(to top, black, transparent);
  mask-image: linear-gradient(to top, black, transparent);
  /* Avoid compositing gaps between fixed layers and the viewport edge on mobile WebKit. */
  -webkit-transform: translateZ(0);
  transform: translateZ(0);
}

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

a {
  color: inherit;
  text-decoration: none;
}

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  background: none;
}

/* ---- Layout Wrapper ---- */

.image-library {
  position: relative;
  max-width: 1520px;
  margin: 0 auto;
  padding: 0 20px;
}

/* ---- Site Header ---- */

.site-header {
  padding: 57px 0 28px;
  text-align: left;
}

.site-title {
  font-size: 1.25rem;
  font-weight: 500;
  line-height: 1;
  letter-spacing: 0;
  color: var(--color-text);
}

.site-subtitle {
  margin-top: 13px;
  font-size: 0.9375rem;
  color: var(--color-text);
  font-weight: 400;
  line-height: 1.2;
}

/* ---- Name Hover Preview ---- */

.name-hover-wrap {
  position: relative;
  display: inline-block;
}

.name-link {
  font-weight: 500;
  color: var(--color-text);
  border-bottom: 1px solid var(--color-border);
  transition: border-color var(--transition-speed);
}

.name-link:hover {
  border-color: var(--color-text);
}

.name-preview {
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  padding-top: 12px;
  z-index: 50;
  pointer-events: none;
}

.name-hover-wrap:hover .name-preview {
  pointer-events: auto;
}

.name-preview-arrow {
  display: block;
  width: 10px;
  height: 10px;
  margin: 0 auto -5px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-bottom: none;
  border-right: none;
  transform: rotate(45deg);
  position: relative;
  z-index: 1;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.name-hover-wrap:hover .name-preview-arrow {
  opacity: 1;
}

.name-preview-window {
  display: block;
  width: 280px;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid var(--color-border);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.12), 0 2px 8px rgba(0, 0, 0, 0.04);
  background: var(--color-surface);
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.25s ease, transform 0.25s ease;
  text-decoration: none;
}

.name-hover-wrap:hover .name-preview-window {
  opacity: 1;
  transform: translateY(0);
}

.window-chrome {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: var(--color-bg);
  border-bottom: 1px solid var(--color-border);
}

.window-dots {
  display: flex;
  gap: 5px;
}

.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.dot-red { background: #ff5f57; }
.dot-yellow { background: #febc2e; }
.dot-green { background: #28c840; }

.window-url {
  flex: 1;
  text-align: center;
  font-size: 0.65rem;
  color: var(--color-text-secondary);
  font-weight: 400;
  letter-spacing: 0.01em;
}

.window-viewport {
  display: block;
  width: 280px;
  height: 175px;
  overflow: hidden;
  position: relative;
}

.window-viewport iframe {
  width: 1400px;
  height: 875px;
  border: none;
  transform: scale(0.2);
  transform-origin: top left;
  pointer-events: none;
}

/* ---- Tag Pills (cards + dropdown) ---- */

.tag-pill {
  padding: 6px 16px;
  font-size: 0.8rem;
  font-weight: 500;
  text-transform: lowercase;
  letter-spacing: 0.02em;
  border-radius: 100px;
  background-color: var(--color-tag-bg);
  color: var(--color-tag-text);
  transition: background-color var(--transition-speed), color var(--transition-speed);
}

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

.tag-pill.active {
  background-color: var(--color-tag-bg-active);
  color: var(--color-tag-text-active);
}

/* ---- Header Controls (theme + filter) ---- */

.header-controls {
  position: absolute;
  top: 57px;
  right: 20px;
  z-index: 60;
  display: flex;
  align-items: center;
  gap: 20px;
}

.theme-toggle {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--icon-color);
}

.theme-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  padding: 0;
  color: var(--icon-color);
  opacity: 0.45;
  transition: opacity 0.2s ease, color 0.2s ease;
}

.theme-btn:hover {
  opacity: 0.85;
}

.theme-btn[aria-pressed="true"] {
  opacity: 1;
  color: var(--color-text);
}

.theme-divider {
  display: block;
  width: 1px;
  height: 15px;
  background-color: var(--icon-color);
  opacity: 0.55;
}

.filter-wrap {
  position: relative;
}

.filter-toggle {
  display: flex;
  align-items: center;
  padding: 0;
  font-size: 1rem;
  font-weight: 400;
  color: var(--color-text);
  background: none;
  border: none;
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-thickness: 1px;
  transition: color var(--transition-speed) ease;
}

.filter-toggle:hover {
  color: var(--color-text-secondary);
}

.filter-toggle.open {
  text-decoration-thickness: 2px;
}

.filter-label {
  white-space: nowrap;
  line-height: 1;
}

.filter-dropdown {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  min-width: 200px;
  max-height: 360px;
  overflow-y: auto;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 10px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.1), 0 2px 8px rgba(0, 0, 0, 0.04);
  padding: 6px;
  display: flex;
  flex-direction: column;
  opacity: 0;
  visibility: hidden;
  transform: translateY(4px);
  transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s ease;
}

.filter-dropdown.open {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.filter-option {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  font-size: 0.8rem;
  font-weight: 450;
  color: var(--color-text);
  border-radius: 6px;
  cursor: pointer;
  transition: background-color 0.15s ease;
  text-transform: lowercase;
  letter-spacing: 0.01em;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
  font-family: inherit;
}

.filter-option:hover {
  background-color: var(--color-tag-bg);
}

.filter-option.active {
  font-weight: 600;
}

.filter-option-check {
  width: 16px;
  height: 16px;
  opacity: 0;
  flex-shrink: 0;
  stroke: var(--color-text);
}

.filter-option.active .filter-option-check {
  opacity: 1;
}

/* ---- Gallery Grid ---- */

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--grid-gap);
  padding-bottom: 60px;
}

.grid-item {
  position: relative;
  list-style: none;
  aspect-ratio: 353 / 285;
  border-radius: 0;
  background-color: var(--color-tag-bg);
  cursor: pointer;
  overflow: hidden;
}

.grid-item-entrance {
  position: relative;
  width: 100%;
  height: 100%;
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.5s ease, transform 0.5s ease;
}

.grid-item-entrance.visible {
  opacity: 1;
  transform: translateY(0);
}

.grid-item-thumb {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: opacity var(--transition-speed) ease;
}

.grid-item:hover .grid-item-thumb {
  opacity: 0.85;
}

.grid-item.is-article {
  background-color: #f5f3ef;
}

[data-theme="dark"] .grid-item.is-article {
  background-color: #202020;
}

.article-thumb {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
  color: var(--color-text);
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  transition: background-color var(--transition-speed), opacity var(--transition-speed);
}

[data-theme="dark"] .article-thumb {
  background: var(--color-surface);
}

.grid-item.is-article:hover .article-thumb {
  opacity: 0.86;
}

.article-preview-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top center;
  display: block;
  background: #fff;
  opacity: 0;
  transition: opacity 0.35s ease;
}

.article-preview-canvas.is-loaded {
  opacity: 1;
}

[data-theme="dark"] .article-preview-canvas {
  filter: invert(0.92) hue-rotate(180deg);
}

.article-overlay {
  position: absolute;
  inset: 0;
  padding: 18px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  background: linear-gradient(180deg, rgba(255,255,255,0) 55%, rgba(0,0,0,0.7) 100%);
  color: #fff;
  pointer-events: none;
}

.article-filetype {
  align-self: flex-start;
  padding: 4px 7px;
  font-size: 0.6875rem;
  font-weight: 600;
  line-height: 1;
  border: 1px solid rgba(255,255,255,0.6);
  background: rgba(0,0,0,0.45);
  color: #fff;
  backdrop-filter: blur(4px);
}

.article-title {
  display: -webkit-box;
  overflow: hidden;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  font-size: 0.9375rem;
  font-weight: 500;
  line-height: 1.25;
  text-shadow: 0 1px 2px rgba(0,0,0,0.4);
}

/* ---- Carousel (Grid) ---- */

.carousel-track {
  display: flex;
  width: 100%;
  height: 100%;
  transition: transform 0.35s cubic-bezier(0.25, 1, 0.5, 1);
}

.carousel-track .grid-item-thumb {
  flex: 0 0 100%;
}

.carousel-prev,
.carousel-next {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.88);
  color: var(--color-text);
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.2s ease, background-color 0.15s ease;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.15);
}

.carousel-prev { left: 6px; }
.carousel-next { right: 6px; }

.grid-item.has-carousel:hover .carousel-prev,
.grid-item.has-carousel:hover .carousel-next {
  opacity: 1;
}

.carousel-prev:hover,
.carousel-next:hover {
  background: rgba(255, 255, 255, 1);
}

.carousel-dots {
  position: absolute;
  bottom: 8px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 2;
  display: flex;
  gap: 5px;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.grid-item.has-carousel:hover .carousel-dots {
  opacity: 1;
}

.carousel-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.45);
  transition: background 0.2s ease;
}

.carousel-dot.active {
  background: rgba(255, 255, 255, 0.95);
}

/* ---- Lightbox ---- */

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  perspective: 1200px;
  visibility: hidden;
  opacity: 0;
  transition:
    opacity var(--lightbox-duration) var(--lightbox-ease),
    visibility 0s linear var(--lightbox-duration);
  pointer-events: none;
}

.lightbox.is-open {
  visibility: visible;
  opacity: 1;
  transition:
    opacity var(--lightbox-duration) var(--lightbox-ease),
    visibility 0s;
  pointer-events: auto;
}

.lightbox-backdrop {
  position: absolute;
  inset: 0;
  background-color: rgba(43, 43, 43, 0);
  -webkit-backdrop-filter: blur(0px);
  backdrop-filter: blur(0px);
  cursor: pointer;
  transition:
    background-color 0.7s var(--lightbox-ease),
    -webkit-backdrop-filter 0.7s var(--lightbox-ease),
    backdrop-filter 0.7s var(--lightbox-ease);
  will-change: backdrop-filter, background-color;
}

.lightbox.is-open .lightbox-backdrop {
  background-color: rgba(43, 43, 43, 0.37);
  -webkit-backdrop-filter: blur(4.2px);
  backdrop-filter: blur(4.2px);
}

[data-theme="dark"] .lightbox.is-open .lightbox-backdrop {
  background-color: rgba(0, 0, 0, 0.55);
}

.lightbox-panel {
  position: relative;
  z-index: 1;
  width: min(1072px, 100%);
  max-height: min(90vh, 900px);
  max-height: min(90dvh, 900px);
  display: flex;
  flex-direction: column;
  background-color: var(--color-surface);
  border-radius: 0;
  overflow: hidden;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.18), 0 8px 24px rgba(0, 0, 0, 0.08);
  border: none;
  transform: rotateY(90deg) scale(0.92);
  transform-origin: center center;
  opacity: 0;
  transition:
    transform var(--lightbox-duration) var(--lightbox-ease),
    opacity var(--lightbox-duration) var(--lightbox-ease);
}

.lightbox.is-open .lightbox-panel {
  transform: rotateY(0deg) scale(1);
  opacity: 1;
}

.lightbox-close {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 100px;
  color: var(--color-text);
  background-color: var(--color-surface);
  border: 1px solid var(--color-border);
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
  transition: background-color var(--transition-speed), color var(--transition-speed);
}

.lightbox-close:hover {
  background-color: var(--color-tag-bg);
}

.lightbox-media {
  flex: 1;
  min-height: min(48vh, 420px);
  min-height: min(48dvh, 420px);
  min-width: 0;
  position: relative;
  overflow: hidden;
  display: block;
  background-color: #f1f1f1;
}

[data-theme="dark"] .lightbox-media {
  background-color: #111111;
}

.lightbox-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
}

.pdf-frame-wrap {
  position: relative;
  width: 100%;
  height: 100%;
  min-height: inherit;
  background: var(--color-surface);
}

.pdf-frame {
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
  background: var(--color-surface);
}

.pdf-open-link {
  position: absolute;
  right: 12px;
  bottom: 12px;
  z-index: 1;
  padding: 7px 10px;
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--color-text);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
}

.pdf-open-link:hover {
  background: var(--color-tag-bg);
}

.lightbox-media .carousel-track {
  display: flex;
  width: 100%;
  height: 100%;
  transition: transform 0.35s cubic-bezier(0.25, 1, 0.5, 1);
}

.lightbox-media .carousel-track img {
  flex: 0 0 100%;
}

.lightbox-carousel-prev,
.lightbox-carousel-next {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.9);
  color: var(--color-text);
  cursor: pointer;
  transition: background-color 0.15s ease, transform 0.15s ease;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.18);
}

.lightbox-carousel-prev { left: 12px; }
.lightbox-carousel-next { right: 12px; }

.lightbox-carousel-prev:hover,
.lightbox-carousel-next:hover {
  background: rgba(255, 255, 255, 1);
  transform: translateY(-50%) scale(1.06);
}

.lightbox-carousel-counter {
  position: absolute;
  bottom: 12px;
  right: 12px;
  z-index: 2;
  padding: 4px 10px;
  font-size: 0.7rem;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.9);
  background: rgba(0, 0, 0, 0.4);
  border-radius: 100px;
  letter-spacing: 0.04em;
}

.lightbox-content {
  flex-shrink: 0;
  padding: 32px 27px 27px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  overflow-y: auto;
  max-height: 50vh;
  max-height: 50dvh;
  background-color: var(--color-surface);
}

.lightbox-title {
  font-size: 1.25rem;
  font-weight: 500;
  letter-spacing: 0;
  line-height: 1.2;
  color: var(--color-text);
  padding-right: 48px;
}

.lightbox-description {
  font-size: 0.9375rem;
  color: var(--color-text);
  line-height: 1.5;
  font-weight: 400;
}

.lightbox-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 4px;
}

.lightbox-tags .tag-pill {
  padding: 5px 10px;
  font-size: 0.75rem;
  font-weight: 400;
  text-transform: none;
  letter-spacing: 0;
  border-radius: 50px;
  background-color: #e0e0e2;
  color: #2b2b2b;
}

[data-theme="dark"] .lightbox-tags .tag-pill {
  background-color: #2a2a2a;
  color: #d8d8d8;
}

.lightbox-meta {
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin-top: 14px;
  font-size: 0.9375rem;
  line-height: 1.4;
}

.lightbox-meta .meta-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 4px 0;
  border-bottom: 0.5px solid rgba(43, 43, 43, 0.5);
}

[data-theme="dark"] .lightbox-meta .meta-row {
  border-bottom-color: rgba(220, 220, 220, 0.35);
}

.lightbox-meta dt {
  color: #6d676e;
  flex-shrink: 0;
}

[data-theme="dark"] .lightbox-meta dt {
  color: #9a9a9a;
}

.lightbox-meta dd {
  color: var(--color-text);
  text-align: right;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.lightbox-meta dd a {
  color: var(--color-text);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.lightbox-meta dd a:hover {
  opacity: 0.7;
}

@media (max-width: 767px) {
  .lightbox {
    padding: 0;
    align-items: stretch;
    justify-content: stretch;
  }

  .lightbox-panel {
    width: 100%;
    max-height: 100dvh;
    height: 100dvh;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
  }

  .lightbox-media {
    flex: 0 0 auto;
    min-height: 0;
    height: auto;
    aspect-ratio: auto;
  }

  .lightbox-media img {
    width: 100%;
    height: auto;
    object-fit: contain;
  }

  .pdf-frame-wrap {
    height: 62dvh;
    min-height: 420px;
  }

  .lightbox-media .carousel-track {
    height: auto;
    align-items: stretch;
  }

  .lightbox-media .carousel-track img {
    height: auto;
  }

  .lightbox-content {
    flex-shrink: 0;
    max-height: none;
    overflow: visible;
    padding-bottom: calc(32px + env(safe-area-inset-bottom, 0px));
  }
}

@media (min-width: 768px) {
  .lightbox-panel {
    flex-direction: row;
    align-items: stretch;
    max-height: min(88vh, 720px);
    max-height: min(88dvh, 720px);
  }

  .lightbox-media {
    flex: 0 0 559px;
    min-width: 0;
    min-height: 0;
    height: 483px;
  }

  .lightbox-content {
    flex: 0 0 513px;
    max-height: 483px;
    overflow-y: auto;
    padding: 38px 27px 32px;
    gap: 14px;
  }

  .lightbox-title {
    padding-right: 36px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .lightbox,
  .lightbox.is-open {
    transition-duration: 0.01ms;
    transition-delay: 0s;
  }

  .lightbox-panel {
    transition-duration: 0.01ms;
  }

  .grid-item-entrance {
    transition-duration: 0.01ms;
  }

  .carousel-track,
  .lightbox-media .carousel-track {
    transition-duration: 0.01ms;
  }

  body::after {
    display: none;
  }
}

/* ---- Footer ---- */

.site-footer {
  padding: 40px 0;
  text-align: left;
  font-size: 0.75rem;
  color: var(--color-muted);
  border-top: 1px solid var(--color-border);
}

/* ---- Empty State ---- */

.empty-state {
  grid-column: 1 / -1;
  text-align: center;
  padding: 80px 20px;
  color: var(--color-text-secondary);
  font-size: 0.95rem;
}

/* ---- Responsive ---- */

@media (max-width: 1024px) {
  .gallery-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (max-width: 768px) {
  .image-library {
    padding: 0 16px;
  }

  .site-header {
    padding: 40px 0 24px;
  }

  .site-title {
    font-size: 1.125rem;
  }

  .header-controls {
    top: 40px;
    right: 16px;
    gap: 14px;
  }

  .filter-toggle {
    font-size: 0.875rem;
  }

  .gallery-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
  }

  .name-preview {
    display: none;
  }

  .carousel-prev,
  .carousel-next {
    width: 22px;
    height: 22px;
  }

  .carousel-prev { left: 4px; }
  .carousel-next { right: 4px; }

  .lightbox-carousel-prev,
  .lightbox-carousel-next {
    width: 30px;
    height: 30px;
  }

  .lightbox-carousel-prev { left: 8px; }
  .lightbox-carousel-next { right: 8px; }
}

@media (max-width: 400px) {
  .gallery-grid {
    gap: 6px;
  }

  .tag-pill {
    padding: 5px 12px;
    font-size: 0.7rem;
  }
}
