/* --- Gallery.js Compatibility Styling --- */

.gallery-item {
  position: relative;
  cursor: pointer;
  transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.3s ease;
  content-visibility: auto;
  contain-intrinsic-size: 350px;
}

.gallery-item.hidden {
  display: none;
}

.item-image-container {
  position: relative;
  aspect-ratio: 1;
  overflow: hidden;
  background: linear-gradient(90deg,
      #f0f0f0 0px,
      #e8e8e8 40px,
      #f0f0f0 80px);
  background-size: 200px 100%;
  animation: skeleton-loading 1.5s infinite linear;
  margin-bottom: 0.5rem;
  border-radius: 2px;
  transition: margin-bottom 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.dark .item-image-container {
  background: linear-gradient(90deg,
      #1a1a1a 0px,
      #252525 40px,
      #1a1a1a 80px);
  background-size: 200px 100%;
}

.item-image-container.portrait {
  aspect-ratio: 4 / 5;
}

.item-image-container.portrait-34 {
  aspect-ratio: 3 / 4;
}

.item-image-container.landscape {
  aspect-ratio: 5 / 4;
}

.item-image-container img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.7s cubic-bezier(0.16, 1, 0.3, 1);
}

.item-overlay {
  position: absolute;
  inset: 0;
  background-color: rgba(0, 0, 0, 0.05);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.gallery-item:hover .item-overlay {
  opacity: 1;
}

.item-content {
  transition: opacity 0.4s cubic-bezier(0.16, 1, 0.3, 1), transform 0.4s cubic-bezier(0.16, 1, 0.3, 1), max-height 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  max-height: 100px;
  opacity: 1;
  transform: translateY(0);
  overflow: hidden;
}

.item-title {
  font-family: 'Manrope', sans-serif;
  font-size: 15px;
  font-weight: 500;
  color: #121212;
  margin-bottom: 0.25rem;
  line-height: 1.2;
}

.dark .item-title {
  color: #FAFAFA;
}


.item-type {
  font-family: 'Manrope', sans-serif;
  font-size: 0.75rem;
  color: #737373;
}

.dark .item-type {
  color: #a3a3a3;
}

.work-count {
  font-size: 0.875rem;
  color: #737373;
  font-weight: 400;
}

/* Hidden Info State */
.gallery-item.cards-hidden .item-content {
  opacity: 0;
  transform: translateY(-8px);
  max-height: 0;
  pointer-events: none;
}

.hover-title {
  position: absolute;
  bottom: 1.5rem;
  left: 50%;
  transform: translate(-50%, 10px);
  width: auto;
  max-width: 80%;
  padding: 0.5rem 1rem;
  text-align: center;
  background: rgba(255, 255, 255, 0.7);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 9999px;
  font-family: 'Manrope', sans-serif;
  font-weight: 500;
  font-size: 0.9375rem;
  transition: opacity 0.4s cubic-bezier(0.16, 1, 0.3, 1),
    transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  z-index: 10;
  opacity: 0;
  pointer-events: none;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
  letter-spacing: -0.01em;
}

.dark .hover-title {
  background: rgba(20, 20, 20, 0.7);
  color: white;
  border-color: rgba(255, 255, 255, 0.1);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
}

.gallery-item.cards-hidden .item-image-container {
  margin-bottom: 0;
}

.gallery-item.cards-hidden:hover .hover-title {
  transform: translate(-50%, 0);
  opacity: 1;
}

/* --- List View Styling --- */
.list-view-container {
  display: none;
  width: 100%;
}

.list-view-container.active {
  display: block;
}

.gallery-grid.list-view-hidden {
  display: none;
}

/* Staggered row entrance */
.list-view-group {
  border-bottom: 1px solid #e5e5e5;
  opacity: 0;
  transform: translateY(8px);
  animation: listRowIn 0.4s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes listRowIn {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.list-view-group.hidden {
  display: none;
}

.dark .list-view-group {
  border-bottom-color: #2a2a2a;
}

.list-view-group:last-child {
  border-bottom: none;
}

/* Header row — always visible */
.list-view-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.75rem 0.5rem;
  border-radius: 8px;
  cursor: pointer;
  user-select: none;
  transition: background-color 0.2s ease, padding-left 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.list-view-header:hover {
  background-color: rgba(0, 0, 0, 0.025);
  padding-left: 0.75rem;
}

.dark .list-view-header:hover {
  background-color: rgba(255, 255, 255, 0.03);
}

.list-view-header:active {
  background-color: rgba(0, 0, 0, 0.05);
  transition-duration: 0.05s;
}

.dark .list-view-header:active {
  background-color: rgba(255, 255, 255, 0.06);
}

.list-view-header-thumb {
  width: 40px;
  height: 40px;
  min-width: 40px;
  border-radius: 4px;
  object-fit: cover;
  background: #f0f0f0;
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1),
    box-shadow 0.3s cubic-bezier(0.16, 1, 0.3, 1),
    border-radius 0.3s ease;
}

.list-view-header:hover .list-view-header-thumb {
  transform: scale(1.08);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  border-radius: 5px;
}

.dark .list-view-header:hover .list-view-header-thumb {
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.dark .list-view-header-thumb {
  background: #1a1a1a;
}

.list-view-header-info {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.list-view-title {
  font-family: 'Manrope', sans-serif;
  font-size: 0.9375rem;
  font-weight: 500;
  color: #121212;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.dark .list-view-title {
  color: #FAFAFA;
}

.list-view-count {
  font-family: 'Manrope', sans-serif;
  font-size: 0.7rem;
  color: #a3a3a3;
  white-space: nowrap;
  transition: color 0.2s ease;
}

.list-view-header:hover .list-view-count {
  color: #737373;
}

.dark .list-view-count {
  color: #737373;
}

.dark .list-view-header:hover .list-view-count {
  color: #a3a3a3;
}

.list-view-status {
  font-family: 'Manrope', sans-serif;
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 0.2rem 0.5rem;
  border-radius: 9999px;
  white-space: nowrap;
  transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1),
    box-shadow 0.2s ease;
}

.list-view-header:hover .list-view-status {
  transform: scale(1.04);
}

.list-view-status.minted {
  color: #16a34a;
  background: rgba(22, 163, 74, 0.08);
}

.dark .list-view-status.minted {
  color: #4ade80;
  background: rgba(74, 222, 128, 0.1);
}

.list-view-status.unminted {
  color: #a3a3a3;
  background: rgba(163, 163, 163, 0.08);
}

.dark .list-view-status.unminted {
  color: #737373;
  background: rgba(115, 115, 115, 0.1);
}

.list-view-link {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  min-width: 32px;
  border-radius: 6px;
  color: #a3a3a3;
  transition: color 0.2s ease, background-color 0.2s ease, transform 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  text-decoration: none;
}

.list-view-link:hover {
  color: #121212;
  background-color: rgba(0, 0, 0, 0.05);
  transform: scale(1.1) rotate(-6deg);
}

.dark .list-view-link:hover {
  color: #FAFAFA;
  background-color: rgba(255, 255, 255, 0.05);
}

.list-view-link:active {
  transform: scale(0.95);
  transition-duration: 0.05s;
}

.list-view-chevron {
  width: 18px;
  height: 18px;
  min-width: 18px;
  color: #a3a3a3;
  transition: transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1),
    color 0.2s ease;
}

.list-view-header:hover .list-view-chevron {
  color: #737373;
}

.dark .list-view-chevron {
  color: #737373;
}

.dark .list-view-header:hover .list-view-chevron {
  color: #a3a3a3;
}

.list-view-group.expanded .list-view-chevron {
  transform: rotate(90deg);
}

/* Expandable image grid */
.list-view-grid-wrapper {
  display: grid;
  grid-template-rows: 0fr;
  transition: grid-template-rows 0.45s cubic-bezier(0.16, 1, 0.3, 1);
}

.list-view-group.expanded .list-view-grid-wrapper {
  grid-template-rows: 1fr;
}

.list-view-grid-inner {
  overflow: hidden;
}

.list-view-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 6px;
  padding: 0.75rem 0 1rem;
}

/* Individual grid image — staggered fade in */
.list-view-grid-item {
  position: relative;
  aspect-ratio: 1;
  border-radius: 3px;
  overflow: hidden;
  cursor: pointer;
  opacity: 0;
  transform: scale(0.92);
  transition: opacity 0.35s cubic-bezier(0.16, 1, 0.3, 1),
    transform 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

.list-view-group.expanded .list-view-grid-item {
  opacity: 1;
  transform: scale(1);
}

.list-view-grid-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1),
    filter 0.3s ease;
}

/* Hover — image lifts with subtle brightness */
.list-view-grid-item::after {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.04);
  opacity: 0;
  transition: opacity 0.25s ease;
  pointer-events: none;
}

.list-view-grid-item:hover::after {
  opacity: 1;
}

.list-view-grid-item:active img {
  transform: scale(0.97);
  transition-duration: 0.1s;
}

/* Popout preview on hover */
.list-view-popout {
  position: fixed;
  pointer-events: none;
  z-index: 90;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 16px 50px rgba(0, 0, 0, 0.18), 0 6px 16px rgba(0, 0, 0, 0.12);
  opacity: 0;
  transform: scale(0.88);
  transition: opacity 0.25s cubic-bezier(0.16, 1, 0.3, 1),
    transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
  will-change: transform, opacity;
}

.dark .list-view-popout {
  box-shadow: 0 16px 50px rgba(0, 0, 0, 0.5), 0 6px 16px rgba(0, 0, 0, 0.35);
}

.list-view-popout.visible {
  opacity: 1;
  transform: scale(1);
}

.list-view-popout img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

@media (min-width: 640px) {
  .list-view-grid {
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 8px;
  }
}

@media (min-width: 1024px) {
  .list-view-grid {
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  }
}

@media (max-width: 640px) {
  .list-view-status {
    display: none;
  }

  .list-view-header {
    gap: 0.625rem;
    padding-left: 0.25rem;
    padding-right: 0.25rem;
  }

  .list-view-header:hover {
    padding-left: 0.25rem;
  }

  .list-view-header-info {
    gap: 0.25rem;
  }

  .list-view-title {
    font-size: 0.875rem;
  }

  .list-view-grid {
    grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
  }

  .list-view-header-thumb {
    width: 36px;
    height: 36px;
    min-width: 36px;
  }

  .list-view-chevron {
    width: 16px;
    height: 16px;
    min-width: 16px;
  }
}

/* Disable hover effects on touch devices */
@media (hover: none) {
  .list-view-popout {
    display: none;
  }

  .list-view-grid-item:hover img {
    transform: none;
  }

  .list-view-grid-item:hover::after {
    opacity: 0;
  }

  .list-view-header:hover {
    padding-left: 0.5rem;
  }

  .list-view-header:hover .list-view-header-thumb {
    transform: none;
    box-shadow: none;
  }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  .list-view-group {
    animation: none;
    opacity: 1;
    transform: none;
  }

  .list-view-grid-item {
    transition: none;
    opacity: 1;
    transform: none;
  }

  .list-view-chevron,
  .list-view-header-thumb,
  .list-view-link,
  .list-view-status,
  .list-view-popout,
  .list-view-grid-item img {
    transition-duration: 0.01s;
  }
}

/* --- Modal Styling --- */
:root {
  --modal-edge-padding: 16px;
}

@media (min-width: 768px) {
  :root {
    --modal-edge-padding: 24px;
  }
}

:root {
  --page-bg: #ECEBDD;
}

.dark {
  --page-bg: #13120A;
}

.navy {
  --page-bg: #061830;
}

.pastel {
  --page-bg: var(--pastelle-pastel-bg);
}

.modal-overlay {
  background-color: var(--page-bg);
  backdrop-filter: blur(0px);
  transition: background-color 0.4s cubic-bezier(0.16, 1, 0.3, 1),
    backdrop-filter 0.4s cubic-bezier(0.16, 1, 0.3, 1),
    opacity 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  padding: max(var(--modal-edge-padding), env(safe-area-inset-top)) max(var(--modal-edge-padding), env(safe-area-inset-right)) max(var(--modal-edge-padding), env(safe-area-inset-bottom)) max(var(--modal-edge-padding), env(safe-area-inset-left));
}

.modal-overlay.active {
  display: flex !important;
  justify-content: center;
  align-items: center;
  opacity: 1 !important;
  pointer-events: auto;
  background-color: transparent;
  backdrop-filter: blur(14px);
  overscroll-behavior: contain;
}

.dark .modal-overlay.active {
  background-color: transparent;
  backdrop-filter: blur(14px);
}

.modal-content {
  border-radius: 0 !important;
  box-shadow: none !important;
  border: 1px solid rgba(0, 0, 0, 0.12) !important;
  width: min(1600px, 100%) !important;
  height: 100% !important;
  max-height: 100% !important;
  overflow: hidden !important;
  background-color: var(--page-bg) !important;
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.2s ease-out, transform 0.2s ease-out;
}

.dark .modal-content {
  border: 1px solid rgba(255, 255, 255, 0.14) !important;
}

.modal-overlay.active .modal-content {
  transform: translateY(0);
  opacity: 1;
}

/* Close Button Styling */
.modal-content>button.absolute {
  top: 1.5rem;
  right: 1.5rem;
  background-color: transparent !important;
  color: #999;
  transition: color 0.3s ease,
    transform 0.3s ease,
    background-color 0.3s ease,
    border-color 0.3s ease;
  border: 1px solid transparent;
  width: 2.5rem;
  height: 2.5rem;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-content>button.absolute:hover {
  color: #000;
  transform: rotate(90deg);
  background-color: rgba(0, 0, 0, 0.05) !important;
  border-color: rgba(0, 0, 0, 0.1);
}

.dark .modal-content>button.absolute:hover {
  color: #fff;
  background-color: rgba(255, 255, 255, 0.1) !important;
  border-color: rgba(255, 255, 255, 0.1);
}

/* Staggered animations for modal content */
.modal-overlay.active .modal-main-image {
  animation: modalSlideIn 0.34s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.modal-overlay.active .modal-main-image img {
  animation: modalImageZoom 0.34s cubic-bezier(0.16, 1, 0.3, 1) 0.03s forwards;
  opacity: 0;
  transform: scale(0.98);
}

.modal-overlay.active .modal-info {
  animation: modalSlideIn 0.34s cubic-bezier(0.16, 1, 0.3, 1) 0.05s forwards;
  opacity: 0;
}

.modal-overlay.active .modal-title {
  animation: modalFadeIn 0.28s cubic-bezier(0.16, 1, 0.3, 1) 0.08s forwards;
  opacity: 0;
}

.modal-overlay.active .modal-details {
  animation: modalFadeIn 0.28s cubic-bezier(0.16, 1, 0.3, 1) 0.12s forwards;
  opacity: 0;
}

.modal-overlay.active .modal-thumbnails {
  animation: modalFadeIn 0.28s cubic-bezier(0.16, 1, 0.3, 1) 0.15s forwards;
  opacity: 0;
}

.modal-overlay.active .modal-thumbnail {
  animation: modalThumbnailIn 0.24s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  opacity: 0;
}

.modal-overlay.active .modal-thumbnail:nth-child(1) {
  animation-delay: 0.17s;
}

.modal-overlay.active .modal-thumbnail:nth-child(2) {
  animation-delay: 0.19s;
}

.modal-overlay.active .modal-thumbnail:nth-child(3) {
  animation-delay: 0.21s;
}

.modal-overlay.active .modal-thumbnail:nth-child(4) {
  animation-delay: 0.23s;
}

.modal-overlay.active .modal-thumbnail:nth-child(5) {
  animation-delay: 0.25s;
}

.modal-overlay.active .modal-thumbnail:nth-child(6) {
  animation-delay: 0.27s;
}

.modal-overlay.active .modal-thumbnail:nth-child(7) {
  animation-delay: 0.29s;
}

.modal-overlay.active .modal-thumbnail:nth-child(8) {
  animation-delay: 0.31s;
}

.modal-overlay.active .modal-thumbnail:nth-child(9) {
  animation-delay: 0.33s;
}

.modal-overlay.active .modal-action-bar {
  animation: modalFadeIn 0.28s cubic-bezier(0.16, 1, 0.3, 1) 0.12s forwards;
  opacity: 0;
}

@keyframes modalSlideIn {
  from {
    opacity: 0;
    transform: translateY(30px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes modalFadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes modalThumbnailIn {
  from {
    opacity: 0;
    transform: scale(0.8) translateY(10px);
  }

  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

@keyframes modalImageZoom {
  from {
    opacity: 0;
    transform: scale(0.95);
  }

  to {
    opacity: 1;
    transform: scale(1);
  }
}

/* Responsive Modal Layout */
.modal-panel {
  display: flex;
  flex-direction: column;
  gap: 2rem;
  height: 100%;
  min-height: 0;
}

.modal-main-image {
  width: 100%;
  height: clamp(240px, 48vh, 560px);
  display: flex;
  justify-content: center;
  align-items: center;
  border-radius: 0;
  overflow: hidden;
  position: relative;
}

.modal-main-image img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  mix-blend-mode: normal;
}

/* Desktop Override */
@media (min-width: 768px) {
  .modal-panel {
    display: grid;
    grid-template-columns: minmax(0, 1.2fr) minmax(0, 0.8fr);
    gap: 2.5rem;
    /* Top-align columns so the info column does not stretch with empty space under metadata */
    align-items: start;
  }

  .modal-main-image {
    height: 100%;
    min-height: 420px;
  }

  .modal-main-image.portrait,
  .modal-main-image.portrait-34,
  .modal-main-image.landscape {
    width: 100%;
  }

  .modal-content {
    height: auto !important;
    max-height: min(900px, 100%) !important;
  }
}

.modal-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  min-width: 0;
  min-height: 0;
}

#modal-body {
  display: flex;
  flex-direction: column;
  gap: 2rem;
  padding: 1.5rem;
  height: 100%;
  min-height: 0;
  max-height: 100%;
  overflow-y: auto;
  overscroll-behavior: contain;
}

@media (min-width: 768px) {
  #modal-body {
    padding: 2.5rem;
  }

  /* Desktop: collapse the footer-fixed wrapper so children flow normally */
  .modal-footer-fixed {
    display: contents;
  }

  /* Desktop: show metadata in the info column, hide mobile copy */
  .modal-details-desktop {
    display: grid;
  }

  .modal-details-mobile {
    display: none !important;
  }
}

@media (max-width: 1024px) {
  .modal-panel {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
  }

  .modal-main-image {
    height: clamp(220px, 38vh, 440px);
    min-height: 0;
  }
}

@supports (-webkit-touch-callout: none) {
  @media (min-width: 768px) {
    .modal-content {
      height: -webkit-fill-available !important;
      max-height: -webkit-fill-available !important;
    }
  }
}

.modal-title {
  font-family: 'Manrope', sans-serif;
  font-size: clamp(1.75rem, 2vw, 2.5rem);
  font-weight: 400;
  line-height: 1.2;
  color: #121212;
  margin-bottom: 0.5rem;
}

.dark .modal-title {
  color: #FAFAFA;
}

.sold-indicator {
  display: inline-block;
  width: 8px;
  height: 8px;
  background-color: #ef4444;
  border-radius: 50%;
  margin-left: 0.5rem;
  vertical-align: middle;
  box-shadow: 0 0 8px rgba(239, 68, 68, 0.5);
}

.modal-header {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid rgba(0, 0, 0, 0.08);
}

.dark .modal-header {
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.modal-action-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.modal-action-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.55rem 1rem;
  border-radius: 0;
  border: 1px solid rgba(0, 0, 0, 0.12);
  background: rgba(0, 0, 0, 0.02);
  color: #121212;
  font-family: 'Manrope', sans-serif;
  font-size: 0.85rem;
  font-weight: 500;
  letter-spacing: 0.01em;
  transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1),
    box-shadow 0.2s cubic-bezier(0.16, 1, 0.3, 1),
    background-color 0.2s ease;
}

.modal-action-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.12);
  background: rgba(0, 0, 0, 0.05);
}

.dark .modal-action-btn {
  color: #fff;
  border-color: rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.06);
}

.dark .modal-action-btn:hover {
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.35);
  background: rgba(255, 255, 255, 0.12);
}

/* Desktop: variant grid with vertical scroll (mobile overrides to horizontal strip below) */
.modal-thumbnails {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(76px, 1fr));
  gap: 0.75rem;
  align-content: start;
  max-height: min(380px, 42vh);
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior-y: contain;
  padding-bottom: 0.5rem;
  padding-right: 0.25rem;
  scrollbar-gutter: stable;
  scrollbar-width: thin;
  -webkit-overflow-scrolling: touch;
}

.modal-thumbnails::-webkit-scrollbar {
  width: 8px;
}

.modal-thumbnails::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.22);
  border-radius: 4px;
}

.dark .modal-thumbnails::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.28);
}

.modal-thumbnail-wrapper {
  width: 100%;
  min-width: 0;
  aspect-ratio: 1;
  touch-action: manipulation;
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.06);
  border: 1px solid rgba(0, 0, 0, 0.1);
  overflow: hidden;
}

.dark .modal-thumbnail-wrapper {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.12);
}

.modal-thumbnail {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 0;
  cursor: pointer;
  opacity: 0.5;
  transition: opacity 0.25s ease,
    transform 0.25s ease,
    box-shadow 0.25s ease;
  touch-action: manipulation;
}

.modal-thumbnail:hover,
.modal-thumbnail.active {
  opacity: 1;
  transform: scale(1.04);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.modal-thumbnail-wrapper:has(.modal-thumbnail.active) {
  border-color: rgba(0, 0, 0, 0.35);
  box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.2);
}

.dark .modal-thumbnail-wrapper:has(.modal-thumbnail.active) {
  border-color: rgba(255, 255, 255, 0.5);
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.15);
}

.modal-details {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.75rem 2.5rem;
  font-family: 'Manrope', sans-serif;
  font-size: 0.95rem;
  color: #6b6b6b;
}

.detail-value {
  color: #121212;
  font-weight: 500;
}

.dark .detail-value {
  color: #e5e5e5;
}

.modal-footer-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 1.25rem;
  border-top: 1px solid rgba(0, 0, 0, 0.08);
  gap: 1rem;
  position: sticky;
  bottom: 0;
  z-index: 2;
  background: rgba(236, 235, 221, 0.92);
  backdrop-filter: blur(8px);
}

.dark .modal-footer-nav {
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(12, 12, 12, 0.85);
}

.modal-footer-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.6rem 1rem;
  border-radius: 0;
  border: 1px solid rgba(0, 0, 0, 0.12);
  background: transparent;
  color: #121212;
  font-family: 'Manrope', sans-serif;
  font-size: 0.85rem;
  font-weight: 500;
  transition: background-color 0.2s ease, transform 0.2s ease;
}

.modal-footer-btn:hover {
  background: rgba(0, 0, 0, 0.04);
  transform: translateY(-1px);
}

.dark .modal-footer-btn {
  color: #fff;
  border-color: rgba(255, 255, 255, 0.12);
}

.dark .modal-footer-btn:hover {
  background: rgba(255, 255, 255, 0.08);
}

/* Hide back-to-top button when modal is open (it has z-index: 1000, higher than modal z-[100]) */
.modal-overlay.active~#back-to-top,
body:has(.modal-overlay.active) #back-to-top {
  display: none !important;
}

/* Mobile Modal: bottom-sheet layout */
@media (max-width: 767px) {
  .modal-overlay.active {
    align-items: flex-end !important;
    padding: 0 !important;
  }

  .modal-content {
    border-radius: 20px 20px 0 0 !important;
    width: 100% !important;
    height: 92dvh !important;
    max-height: 92dvh !important;
    transform: translateY(24px);
    /* Swipe drag will override transition temporarily */
    will-change: transform;
  }

  .modal-overlay.active .modal-content {
    transform: translateY(0);
  }

  /* Drag handle: real element, not ::before, so touch targets work */
  .modal-drag-handle {
    display: flex;
    justify-content: center;
    padding: 14px 0 6px;
    flex-shrink: 0;
    cursor: grab;
    touch-action: none;
  }

  .modal-drag-handle::after {
    content: '';
    display: block;
    width: 36px;
    height: 4px;
    background: rgba(0, 0, 0, 0.15);
    border-radius: 2px;
  }

  .dark .modal-drag-handle::after {
    background: rgba(255, 255, 255, 0.2);
  }

  /* Two-zone mobile layout:
     - modal-panel = scrollable zone (image + title + thumbnails)
     - modal-footer-fixed = pinned zone (metadata + prev/next) */
  #modal-body {
    padding: 0 !important;
    gap: 0 !important;
    overflow: hidden !important;
    display: flex !important;
    flex-direction: column !important;
  }

  /* Scroll zone: image + info (without metadata) */
  .modal-panel {
    flex: 1 !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch !important;
    touch-action: pan-y !important;
    height: auto !important;
    min-height: 0 !important;
    padding: 0.5rem 1.25rem 1rem !important;
    gap: 0.75rem !important;
  }

  /* Prevent info children from shrinking and squishing thumbnails */
  .modal-header {
    flex-shrink: 0 !important;
  }

  /* Pinned bottom zone: metadata + nav always visible */
  .modal-footer-fixed {
    flex-shrink: 0 !important;
    display: flex !important;
    flex-direction: column !important;
    background: var(--page-bg) !important;
    border-top: 1px solid rgba(0, 0, 0, 0.08) !important;
  }

  .dark .modal-footer-fixed {
    border-top-color: rgba(255, 255, 255, 0.1) !important;
  }

  /* Mobile metadata strip inside footer-fixed */
  .modal-details-mobile {
    display: grid !important;
    padding: 0.625rem 1.25rem 0 !important;
  }

  /* Desktop metadata — hidden on mobile */
  .modal-details-desktop {
    display: none !important;
  }

  /* Footer nav: no longer sticky (it's always in view inside footer-fixed) */
  .modal-footer-nav {
    position: static !important;
    border-top: none !important;
    background: transparent !important;
    backdrop-filter: none !important;
    padding: 0.5rem 1.25rem !important;
  }

  /* Bigger image on mobile */
  .modal-main-image {
    height: clamp(200px, 46vh, 360px) !important;
    border-radius: 12px !important;
    /* Swipe hint: subtle left/right indicator */
    position: relative;
  }

  /* Swipe-to-navigate arrow hints on image */
  .modal-main-image::before,
  .modal-main-image::after {
    content: '';
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 28px;
    height: 28px;
    background: rgba(0, 0, 0, 0.18) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='15 18 9 12 15 6'%3E%3C/polyline%3E%3C/svg%3E") center/14px no-repeat;
    border-radius: 50%;
    opacity: 0;
    transition: opacity 0.2s ease;
    z-index: 5;
    pointer-events: none;
  }

  .modal-main-image::before {
    left: 8px;
  }

  .modal-main-image::after {
    right: 8px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='9 18 15 12 9 6'%3E%3C/polyline%3E%3C/svg%3E");
  }

  .modal-main-image.swiping-left::after,
  .modal-main-image.swiping-right::before {
    opacity: 1;
  }

  .modal-title {
    font-size: 1.25rem !important;
    margin-bottom: 0.25rem !important;
  }

  /* Panel tighter on mobile */
  .modal-panel {
    gap: 0.75rem !important;
  }

  /* Action buttons: larger tap targets */
  .modal-action-btn {
    padding: 0.7rem 1.1rem !important;
    font-size: 0.875rem !important;
    min-height: 44px !important;
  }

  /* Hide hash row — too long, not useful on mobile */
  .detail-hash-label,
  .detail-hash-value {
    display: none !important;
  }

  /* Thumbnails: horizontal scroll row on mobile */
  .modal-thumbnails {
    display: flex !important;
    flex-direction: row !important;
    overflow-x: auto !important;
    overflow-y: hidden !important;
    height: 64px !important;
    min-height: 64px !important;
    flex-shrink: 0 !important;
    align-items: center !important;
    gap: 0.5rem !important;
    padding-bottom: 0 !important;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }

  .modal-thumbnails::-webkit-scrollbar {
    display: none;
  }

  .modal-thumbnail-wrapper {
    width: 64px !important;
    height: 64px !important;
    min-width: 64px !important;
    flex-shrink: 0 !important;
  }

  /* Footer nav: bigger tap targets */
  .modal-footer-btn {
    padding: 0.75rem 1.1rem !important;
    min-height: 44px !important;
    font-size: 0.875rem !important;
  }

  /* Close button: bigger tap target */
  .modal-content>button.absolute {
    top: 0.5rem !important;
    right: 0.875rem !important;
    width: 2.5rem !important;
    height: 2.5rem !important;
    min-width: 44px !important;
    min-height: 44px !important;
  }
}

@supports (-webkit-touch-callout: none) {
  @media (max-width: 767px) {
    .modal-content {
      height: 92svh !important;
      max-height: 92svh !important;
    }
  }
}

@media (prefers-reduced-motion: reduce) {

  .modal-content,
  .modal-overlay,
  .modal-main-image,
  .modal-info,
  .modal-title,
  .modal-details,
  .modal-thumbnails,
  .modal-footer-nav {
    animation: none !important;
    transition: none !important;
  }
}

/* Toggle Switch Styling */
.toggle-checkbox:checked {
  right: 0;
  border-color: #121212;
}

.toggle-checkbox:checked+.toggle-label {
  background-color: #121212;
}

.dark .toggle-checkbox:checked+.toggle-label {
  background-color: #fff;
}

/* Category Buttons Active State */
.category-btn.active,
.year-btn.active {
  color: #171717;
  font-weight: 500;
}

.dark .category-btn.active,
.dark .year-btn.active {
  color: #e5e5e5;
  font-weight: 500;
}

/* Search Input Styling */
#search-input:focus {
  outline: none;
}

#search-clear-btn.visible {
  opacity: 1;
  pointer-events: auto;
}



/* Toggle icon active state */
.toggle-icon-active {
  color: #171717 !important;
}

.dark .toggle-icon-active {
  color: #e5e5e5 !important;
}

/* Custom Scrollbar for Modal */
.custom-scrollbar::-webkit-scrollbar {
  width: 6px;
}

.custom-scrollbar::-webkit-scrollbar-track {
  background: transparent;
}

.custom-scrollbar::-webkit-scrollbar-thumb {
  background-color: rgba(0, 0, 0, 0.2);
  border-radius: 20px;
}

.dark .custom-scrollbar::-webkit-scrollbar-thumb {
  background-color: rgba(255, 255, 255, 0.2);
}

/* --- Scrolled State for Controls Bar --- */
#controls-bar {
  transition: background-color 0.3s ease, border-color 0.3s ease, top 0.3s ease;
}

#controls-inner {
  transition: padding 0.3s ease;
}

.category-btn,
.year-btn {
  transition: padding 0.2s ease,
    font-size 0.2s ease,
    background-color 0.2s ease,
    color 0.2s ease,
    box-shadow 0.2s ease;
}

.toggle-text {
  transition: font-size 0.3s ease;
}

.toggle-wrapper {
  transition: transform 0.3s ease;
}

/* Scrolled State Styles */

#controls-bar.scrolled {
  top: 4rem;
}

/* Navbar Scrolled State */
#navbar.scrolled #navbar-inner {
  height: 4rem;
}

/* Scroll Reveal */
.reveal-up {
  opacity: 1;
  transform: translateY(0);
  transition: opacity 0.8s cubic-bezier(0.16, 1, 0.3, 1),
    transform 0.8s cubic-bezier(0.16, 1, 0.3, 1);
}

.reveal-up.active {
  opacity: 1;
  transform: translateY(0);
}

/* Animations */
@keyframes spin {
  from {
    transform: rotate(0deg);
  }

  to {
    transform: rotate(360deg);
  }
}

@keyframes skeleton-loading {
  0% {
    background-position: -200px 0;
  }

  100% {
    background-position: calc(200px + 100%) 0;
  }
}

.spin {
  animation: spin 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Mobile Dropdown Styles */
.mobile-dropdown {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  min-width: 140px;
  background: var(--page-bg, #ECEBDD);
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.10);
  padding: 0.35rem;
  opacity: 0;
  visibility: hidden;
  transform: scale(0.96) translateY(-4px);
  transform-origin: top left;
  transition: opacity 0.15s ease, visibility 0.15s ease, transform 0.15s ease;
  z-index: 50;
}

.dark .mobile-dropdown {
  background: #111;
  border-color: rgba(255, 255, 255, 0.1);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}

.mobile-dropdown.active {
  opacity: 1 !important;
  visibility: visible !important;
  transform: scale(1) translateY(0) !important;
}

.mobile-dropdown-chevron-open {
  transform: rotate(180deg);
}

.mobile-dropdown-option {
  display: block;
  width: 100%;
  text-align: left;
  padding: 0.5rem 0.75rem;
  border-radius: 7px;
  font-size: 0.85rem;
  font-weight: 500;
  color: #555;
  transition: background 0.12s ease, color 0.12s ease;
}

.dark .mobile-dropdown-option {
  color: #aaa;
}

.mobile-dropdown-option:hover {
  background: rgba(0, 0, 0, 0.05);
  color: #111;
}

.dark .mobile-dropdown-option:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}

.mobile-dropdown-option.active {
  background: #111;
  color: #fff;
  font-weight: 600;
}

.dark .mobile-dropdown-option.active {
  background: #fff;
  color: #111;
}

/* Dropdown option active state */
.category-dropdown-option.active,
.year-dropdown-option.active {
  background-color: #171717;
  color: #fff;
  font-weight: 600;
}

.dark .category-dropdown-option.active,
.dark .year-dropdown-option.active {
  background-color: #fff;
  color: #171717;
  font-weight: 600;
}

/* Modal Navigation Buttons */
.modal-nav-btn {
  position: fixed;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #121212;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: opacity 0.3s cubic-bezier(0.16, 1, 0.3, 1),
    background 0.3s cubic-bezier(0.16, 1, 0.3, 1),
    transform 0.3s cubic-bezier(0.16, 1, 0.3, 1),
    box-shadow 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  z-index: 110;
  opacity: 0;
  pointer-events: none;
}

.modal-overlay.active .modal-nav-btn {
  opacity: 1;
  pointer-events: auto;
}

.modal-nav-btn:hover {
  background: rgba(255, 255, 255, 0.95);
  transform: translateY(-50%) scale(1.1);
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.1);
}

.dark .modal-nav-btn {
  background: rgba(0, 0, 0, 0.3);
  color: white;
  border-color: rgba(255, 255, 255, 0.1);
}

.dark .modal-nav-btn:hover {
  background: #fff;
  color: #000;
}

.modal-prev {
  left: 2rem;
}

.modal-next {
  right: 2rem;
}

/* Remove specific 1440px calculation logic as we now use fixed edge positioning */

@media (max-width: 768px) {
  .modal-nav-btn {
    width: 44px;
    height: 44px;
  }

  .modal-prev {
    left: 1rem;
  }

  .modal-next {
    right: 1rem;
  }
}

/* Consolidate dark mode specific override inside general media query if needed, 
   but for now we just keep the general media query structure clean. 
   The previous max-width: 1360px block contained dark mode overrides, preserving them if not conflicting.
*/
@media (max-width: 1360px) {
  .dark .modal-nav-btn {
    background: rgba(0, 0, 0, 0.6);
  }
}

/* --- Inquiry Popup --- */
#inquiry-overlay {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(8px);
  padding: 16px;
}

#inquiry-overlay.active {
  display: flex;
}

#inquiry-modal {
  position: relative;
  background: #111;
  color: #fff;
  width: 100%;
  max-width: 420px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  padding: 2rem;
  max-height: 90dvh;
  overflow-y: auto;
}

#inquiry-close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  background: none;
  border: none;
  color: rgba(255, 255, 255, 0.4);
  cursor: pointer;
  padding: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.15s ease;
}

#inquiry-close:hover {
  color: #fff;
}

#inquiry-header {
  margin-bottom: 1.5rem;
  padding-bottom: 1.25rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

#inquiry-label {
  display: block;
  font-family: 'Manrope', sans-serif;
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  color: rgba(255, 255, 255, 0.35);
  text-transform: uppercase;
  margin-bottom: 0.5rem;
}

#inquiry-title {
  font-family: 'Manrope', sans-serif;
  font-size: 1.6rem;
  font-weight: 400;
  color: #fff;
  margin: 0 0 0.2rem;
}

#inquiry-subtitle {
  font-family: 'Manrope', sans-serif;
  font-size: 0.875rem;
  color: rgba(255, 255, 255, 0.4);
  font-style: italic;
  margin: 0;
}

.inquiry-field {
  margin-bottom: 1.2rem;
}

.inquiry-field label {
  display: block;
  font-family: 'Manrope', sans-serif;
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  color: rgba(255, 255, 255, 0.4);
  margin-bottom: 0.4rem;
}

.inquiry-field .req {
  color: rgba(255, 255, 255, 0.25);
}

.inquiry-field input,
.inquiry-field textarea {
  width: 100%;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #fff;
  font-family: 'Manrope', sans-serif;
  font-size: 0.9rem;
  padding: 0.6rem 0.75rem;
  border-radius: 0;
  outline: none;
  transition: border-color 0.15s ease;
  resize: vertical;
  box-sizing: border-box;
}

.inquiry-field input::placeholder,
.inquiry-field textarea::placeholder {
  color: rgba(255, 255, 255, 0.2);
}

.inquiry-field input:focus,
.inquiry-field textarea:focus {
  border-color: rgba(255, 255, 255, 0.35);
}

#inquiry-submit {
  width: 100%;
  background: #fff;
  color: #111;
  border: none;
  font-family: 'Manrope', sans-serif;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  padding: 0.9rem 1rem;
  cursor: pointer;
  transition: background-color 0.15s ease;
  border-radius: 0;
  margin-top: 0.25rem;
}

#inquiry-submit:hover {
  background: #e5e5e5;
}

#inquiry-submit:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Animated gradient border on Inquiry button */
@property --inquiry-angle {
  syntax: '<angle>';
  initial-value: 0deg;
  inherits: false;
}

@keyframes inquiry-spin {
  to {
    --inquiry-angle: 360deg;
  }
}

.inquiry-btn {
  position: relative;
  background: transparent !important;
  border: none !important;
  color: #fff !important;
  font-weight: 600 !important;
  isolation: isolate;
}

.dark .inquiry-btn {
  color: #111 !important;
}

/* Gradient border layer */
.inquiry-btn::before {
  content: '';
  position: absolute;
  inset: -2px;
  background: conic-gradient(from var(--inquiry-angle), #000, #888, #fff, #888, #000);
  z-index: -2;
  animation: inquiry-spin 3s linear infinite;
}

/* Solid fill layer (sits on top of gradient, inside border area) */
.inquiry-btn::after {
  content: '';
  position: absolute;
  inset: 0;
  background: #111;
  z-index: -1;
}

.dark .inquiry-btn::after {
  background: #fff;
}

#inquiry-success {
  font-family: 'Manrope', sans-serif;
  font-size: 0.875rem;
  color: rgba(255, 255, 255, 0.55);
  text-align: center;
  padding: 1.5rem 0 0.5rem;
}

/* ======================================================
   V2 BRUTALIST OVERRIDES — placed last to win cascade
   ====================================================== */
:root {
  --mono: 'Manrope', sans-serif;
}

html:not(.dark) body {
  background: #ECEBDD;
  color: #13120A;
}

/* Scrollbar */
::-webkit-scrollbar {
  width: 4px;
  height: 4px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.18);
}

html:not(.dark) ::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.2);
}

* {
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.18) transparent;
}

/* Footer */
#site-footer {
  background: #13120A !important;
}

html:not(.dark) #site-footer {
  background: #ECEBDD !important;
  border-top-color: rgba(0, 0, 0, 0.1) !important;
  color: #000 !important;
}

html:not(.dark) #site-footer a {
  color: rgba(0, 0, 0, 0.5) !important;
}

html:not(.dark) #site-footer a:hover {
  color: #000 !important;
}

html.navy #site-footer {
  background: #061830 !important;
  border-top-color: rgba(220, 235, 255, 0.14) !important;
}

/* Page header */
#page-header {
  background: #13120A;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

#page-header h1 {
  color: #fff;
  letter-spacing: -0.02em;
}

html:not(.dark) #page-header {
  background: #ECEBDD;
  border-bottom-color: rgba(0, 0, 0, 0.1);
}



#page-header .pastelle-label {
  font-family: var(--mono);
  font-size: 0.7rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.2);
}

html:not(.dark) #page-header h1 {
  color: #13120A;
}

html:not(.dark) #page-header h1 {
  color: #13120A;
}



html:not(.dark) #page-header .pastelle-label {
  color: rgba(0, 0, 0, 0.2);
}

/* Controls bar */
#controls-bar {
  background: #13120A !important;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08) !important;
  box-shadow: none !important;
}

html:not(.dark) #controls-bar {
  background: #ECEBDD !important;
  border-bottom-color: rgba(0, 0, 0, 0.1) !important;
}

#controls-bar.scrolled {
  top: 4rem !important;
}

/* Brut-tab */
.brut-tab {
  position: relative;
  color: #fff;
  background: transparent;
  border: none;
  font-family: var(--mono);
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  white-space: nowrap;
  transition: color 0.15s ease;
  cursor: pointer;
  padding: 0.65rem 0.75rem;
}

.brut-tab::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0.75rem;
  right: 0.75rem;
  height: 1px;
  background: #fff;
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.2s ease;
}

.brut-tab:hover {
  color: #fff;
  opacity: 0.8;
}

.brut-tab.active,
.category-btn.active.brut-tab,
.year-btn.active.brut-tab {
  color: #fff !important;
}

.brut-tab.active::after,
.category-btn.active.brut-tab::after,
.year-btn.active.brut-tab::after {
  transform: scaleX(1);
}

html:not(.dark) .brut-tab {
  color: #000;
}

html:not(.dark) .brut-tab:hover {
  color: #000;
}

html:not(.dark) .brut-tab.active,
html:not(.dark) .category-btn.active.brut-tab,
html:not(.dark) .year-btn.active.brut-tab {
  color: #000 !important;
}

html:not(.dark) .brut-tab::after {
  background: #000;
}

/* Brut icon buttons */
.brut-icon-btn {
  padding: 0.65rem 0.75rem;
  color: #fff;
  background: transparent;
  border: none;
  border-left: 1px solid rgba(255, 255, 255, 0.08);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.15s ease;
}

.brut-icon-btn:hover {
  color: #fff;
  opacity: 0.8;
}

.brut-icon-btn.toggle-icon-active {
  color: #fff !important;
}

html:not(.dark) .brut-icon-btn {
  color: #000;
  border-left-color: rgba(0, 0, 0, 0.1);
}

html:not(.dark) .brut-icon-btn:hover {
  color: #000;
}

html:not(.dark) .brut-icon-btn.toggle-icon-active {
  color: #000 !important;
}

/* Brut search */
.search-container-brut {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 9999px;
  transition: all 0.2s ease;
}

.search-container-brut:focus-within {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.3);
}

html:not(.dark) .search-container-brut {
  background: rgba(0, 0, 0, 0.03);
  border-color: rgba(0, 0, 0, 0.1);
}

html:not(.dark) .search-container-brut:focus-within {
  background: rgba(0, 0, 0, 0.06);
  border-color: rgba(0, 0, 0, 0.3);
}

.search-icon-brut {
  color: #fff;
}

html:not(.dark) .search-icon-brut {
  color: #000;
}

.brut-search-input {
  background: transparent;
  border: none;
  outline: none;
  color: #fff;
  font-family: var(--mono);
  font-size: 0.7rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  width: 7rem;
  min-width: 0;
  padding: 0;
}

.brut-search-input::placeholder {
  color: rgba(255, 255, 255, 0.5);
}

html:not(.dark) .brut-search-input {
  background: transparent;
  border: none;
  color: #000;
}

html:not(.dark) .brut-search-input::placeholder {
  color: rgba(0, 0, 0, 0.5);
}

/* Gallery grid — brutalist hairline via box-shadow (keeps empty cells body-colored) */
.gallery-grid {
  display: grid !important;
  grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  gap: 0.25rem !important;
  background: transparent !important;
  padding: 0 !important;
}

html:not(.dark) .gallery-grid {
  background: transparent !important;
}

@media (min-width: 640px) {
  .gallery-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
    gap: 0.25rem !important;
  }
}

@media (min-width: 1024px) {
  .gallery-grid {
    grid-template-columns: repeat(5, minmax(0, 1fr)) !important;
    gap: 0.25rem !important;
  }
}

@media (min-width: 1280px) {
  .gallery-grid {
    grid-template-columns: repeat(6, minmax(0, 1fr)) !important;
    gap: 0.25rem !important;
  }
}

@media (min-width: 1536px) {
  .gallery-grid {
    grid-template-columns: repeat(8, minmax(0, 1fr)) !important;
    gap: 0.25rem !important;
  }
}

@media (min-width: 2000px) {
  .gallery-grid {
    grid-template-columns: repeat(8, minmax(0, 1fr)) !important;
    gap: 0.25rem !important;
  }
}

/* Large view modifier */
.gallery-grid.large-view {
  grid-template-columns: repeat(1, minmax(0, 1fr)) !important;
}

@media (min-width: 640px) {
  .gallery-grid.large-view {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }
}

@media (min-width: 1024px) {
  .gallery-grid.large-view {
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
  }
}

@media (min-width: 1280px) {
  .gallery-grid.large-view {
    grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
  }
}

/* Gallery items */
.gallery-item {
  background: #13120A !important;
  border-radius: 0 !important;
  padding: 0 !important;
  box-shadow: 1px 0 0 rgba(255, 255, 255, 0.1), 0 1px 0 rgba(255, 255, 255, 0.1) !important;
  outline: 1px solid transparent;
  outline-offset: -1px;
  transition: outline-color 0.1s ease;
  cursor: pointer;
  position: relative;
}

.gallery-item:hover {
  outline-color: rgba(255, 255, 255, 0.65);
  z-index: 2;
}

html:not(.dark) .gallery-item {
  background: #ECEBDD !important;
  box-shadow: 1px 0 0 rgba(0, 0, 0, 0.1), 0 1px 0 rgba(0, 0, 0, 0.1) !important;
}

html:not(.dark) .gallery-item:hover {
  outline-color: rgba(0, 0, 0, 0.55);
}

/* Natural aspect ratio — no square crop */
.item-image-container {
  aspect-ratio: unset !important;
  background: #13120A !important;
  border-radius: 0 !important;
  margin-bottom: 0.25rem !important;
  animation: none !important;
}

.item-image-container.portrait,
.item-image-container.portrait-34,
.item-image-container.landscape {
  aspect-ratio: unset !important;
}

.item-image-container img,
.item-image-container video {
  width: 100% !important;
  height: auto !important;
  object-fit: unset !important;
  display: block !important;
  border-radius: 0 !important;
}

html:not(.dark) .item-image-container {
  background: #ECEBDD !important;
}

/* Overlay */
.item-overlay {
  background: rgba(0, 0, 0, 0) !important;
  transition: background 0.2s ease !important;
  border-radius: 0 !important;
}

.gallery-item:hover .item-overlay {
  background: rgba(0, 0, 0, 0.06) !important;
}

/* =====================================================
   Title strip — refined below-image label
   ===================================================== */

.item-content {
  position: static !important;
  border-top: 1px solid rgba(255, 255, 255, 0.07) !important;
  background: transparent !important;
  border-radius: 0 !important;
  padding: 0 !important;
  transition: border-top-color 0.2s ease !important;
}

html:not(.dark) .item-content {
  border-top-color: rgba(0, 0, 0, 0.07) !important;
}

/* Title: compact, dimmed at rest */
.item-title {
  font-family: var(--mono) !important;
  font-size: 0.6rem !important;
  font-weight: 600 !important;
  letter-spacing: 0.1em !important;
  text-transform: uppercase !important;
  color: rgba(255, 255, 255, 0.76) !important;
  line-height: 1.4 !important;
  padding: 0.35rem 0.55rem 0.4rem !important;
  margin: 0 !important;
  transition: color 0.2s ease, letter-spacing 0.2s ease !important;
  white-space: nowrap !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
}

html:not(.dark) .item-title {
  color: rgba(0, 0, 0, 0.74) !important;
}

.item-type {
  display: none !important;
}

/* Hover: separator brightens, title comes forward */
.gallery-item:hover .item-content {
  background: transparent !important;
  border-top-color: rgba(255, 255, 255, 0.2) !important;
}

.gallery-item:hover .item-title {
  color: rgba(255, 255, 255, 0.9) !important;
  letter-spacing: 0.12em !important;
}

html:not(.dark) .gallery-item:hover .item-content {
  border-top-color: rgba(0, 0, 0, 0.18) !important;
}

html:not(.dark) .gallery-item:hover .item-title {
  color: rgba(0, 0, 0, 0.8) !important;
}

/* cards-hidden mode: hover-title takes over */
.hover-title {
  bottom: 0 !important;
  left: 0 !important;
  right: 0 !important;
  border-radius: 0 !important;
  background: rgba(0, 0, 0, 0.82) !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
  border: none !important;
  border-top: 1px solid rgba(255, 255, 255, 0.08) !important;
  font-family: var(--mono) !important;
  font-size: 0.6rem !important;
  font-weight: 500 !important;
  letter-spacing: 0.1em !important;
  text-transform: uppercase !important;
  color: rgba(255, 255, 255, 0.75) !important;
  padding: 0.35rem 0.55rem 0.4rem !important;
  transform: none !important;
  opacity: 0;
  transition: opacity 0.15s ease !important;
  text-align: left !important;
}

.gallery-item:hover .hover-title {
  opacity: 0 !important;
  transform: none !important;
}

.gallery-item.cards-hidden:hover .hover-title {
  opacity: 1 !important;
  transform: none !important;
}

html:not(.dark) .hover-title {
  background: rgba(236, 235, 221, 0.95) !important;
  color: rgba(0, 0, 0, 0.65) !important;
  border-top-color: rgba(0, 0, 0, 0.08) !important;
}

/* Mobile: prevent horizontal overflow */
body {
  overflow-x: hidden;
}

/* Light mode body — match navbar neutral-50 */
html:not(.dark) body {
  background-color: #ECEBDD !important;
  color: #000 !important;
}

.gallery-grid {
  min-width: 0;
}

#controls-inner>div {
  flex-wrap: nowrap;
  min-width: 0;
}

/* Mobile controls: compress all elements to fit without scrolling */
@media (max-width: 768px) {
  .brut-search-input {
    width: 100%;
    min-width: 0;
  }

  .brut-tab {
    padding: 0.65rem 0.5rem;
    letter-spacing: 0.06em;
  }

  .brut-icon-btn {
    padding: 0.65rem 0.5rem;
  }
}

@media (max-width: 640px) {
  /* Tighten outer bar padding */
  #controls-inner {
    padding-left: 0.75rem !important;
    padding-right: 0.75rem !important;
  }

  /* Tighter filter tabs: reduce horizontal padding + font-size */
  .brut-tab {
    padding: 0.65rem 0.4rem;
    font-size: 0.62rem;
    letter-spacing: 0.04em;
  }

  /* Tighter icon buttons */
  .brut-icon-btn {
    padding: 0.65rem 0.4rem;
  }

  /* Tighter search wrapper padding so input gets more room */
  #controls-search {
    padding-left: 0.4rem;
    padding-right: 0.4rem;
  }
}

/* =====================================================
   Desktop: collapse filter options, reveal on hover
   ===================================================== */
@media (min-width: 1280px) {

  /* Option buttons: collapsed by default */
  .category-option-btn,
  .year-option-btn {
    max-width: 0;
    overflow: hidden;
    opacity: 0;
    pointer-events: none;
    padding-left: 0 !important;
    padding-right: 0 !important;
    border-right: none !important;
    /* Exit transition: slight delay so cursor can travel between options */
    transition: max-width 0.22s cubic-bezier(0.25, 0.46, 0.45, 0.94) 0.1s,
                opacity    0.18s ease 0.1s,
                padding    0.22s cubic-bezier(0.25, 0.46, 0.45, 0.94) 0.1s;
  }

  /* Expanded: hover over entire wrapper keeps menu open */
  #category-expand-wrapper:hover .category-option-btn,
  #year-expand-wrapper:hover .year-option-btn {
    max-width: 9rem;
    opacity: 1;
    pointer-events: auto;
    padding-left: 0.75rem !important;
    padding-right: 0.75rem !important;
    border-right: 1px solid rgba(255,255,255,0.08) !important;
    /* Entry: no exit-delay, slight stagger applied per-child below */
    transition: max-width 0.22s cubic-bezier(0.25, 0.46, 0.45, 0.94),
                opacity    0.18s ease,
                padding    0.22s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  }

  /* Stagger category options */
  #category-expand-wrapper:hover .category-option-btn:nth-child(2) { transition-delay: 0s; }
  #category-expand-wrapper:hover .category-option-btn:nth-child(3) { transition-delay: 0.06s; }
  #category-expand-wrapper:hover .category-option-btn:nth-child(4) { transition-delay: 0.12s; }

  /* Stagger year options */
  #year-expand-wrapper:hover .year-option-btn:nth-child(2) { transition-delay: 0s; }
  #year-expand-wrapper:hover .year-option-btn:nth-child(3) { transition-delay: 0.05s; }
  #year-expand-wrapper:hover .year-option-btn:nth-child(4) { transition-delay: 0.10s; }
  #year-expand-wrapper:hover .year-option-btn:nth-child(5) { transition-delay: 0.15s; }

}

/* Light mode borders when expanded */
html:not(.dark) #category-expand-wrapper:hover .category-option-btn,
html:not(.dark) #year-expand-wrapper:hover .year-option-btn {
  border-right-color: rgba(0,0,0,0.08) !important;
}

/* Mobile header: scale down title */
@media (max-width: 480px) {
  #page-header h1 {
    font-size: clamp(2.5rem, 14vw, 4rem) !important;
  }
}

/* Empty state */
#gallery-empty-state {
  font-family: var(--mono) !important;
  font-size: 0.7rem !important;
  letter-spacing: 0.2em !important;
  text-transform: uppercase !important;
  color: rgba(255, 255, 255, 0.2) !important;
}

html:not(.dark) #gallery-empty-state {
  color: rgba(0, 0, 0, 0.2) !important;
}

/* === Enhancement 2: Image scale transition === */
.item-image-container img,
.item-image-container video {
  transition: transform 0.6s cubic-bezier(0.25, 0.46, 0.45, 0.94) !important;
}

/* === Enhancement 2: Gentle image scale on hover === */
.item-image-container {
  overflow: hidden !important;
}

.gallery-item:hover .item-image-container img,
.gallery-item:hover .item-image-container video {
  transform: scale(1.04);
}

/* === Enhancement 3: Staggered grid entrance === */
@keyframes grid-fade-up {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}
.grid-enter {
  animation: grid-fade-up 0.55s ease both;
}

/* === Enhancement 7: Image load shimmer === */
@keyframes shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

.item-image-container:not(.img-loaded) {
  background: linear-gradient(90deg, #1a1a1a 0%, #2a2a2a 50%, #1a1a1a 100%) !important;
  background-size: 200% 100% !important;
  animation: shimmer 1.8s linear infinite !important;
}

.item-image-container.img-loaded {
  animation: none !important;
  background: transparent !important;
}

/* =====================================================
   Gallery loading skeleton
   ===================================================== */
#gallery-skeleton {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.25rem;
}
@media (min-width: 640px)  { #gallery-skeleton { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (min-width: 1024px) { #gallery-skeleton { grid-template-columns: repeat(5, minmax(0, 1fr)); } }
@media (min-width: 1280px) { #gallery-skeleton { grid-template-columns: repeat(6, minmax(0, 1fr)); } }
@media (min-width: 1536px) { #gallery-skeleton { grid-template-columns: repeat(8, minmax(0, 1fr)); } }
@media (min-width: 2000px) { #gallery-skeleton { grid-template-columns: repeat(8, minmax(0, 1fr)); } }

#gallery-skeleton > div {
  aspect-ratio: 1;
  background: linear-gradient(90deg, #1e1e1e 0%, #2a2a2a 50%, #1e1e1e 100%);
  background-size: 200% 100%;
  animation: shimmer 1.8s linear infinite;
}
/* Stagger skeleton shimmer so it doesn't pulse in unison */
#gallery-skeleton > div:nth-child(2)  { animation-delay: 0.15s; }
#gallery-skeleton > div:nth-child(3)  { animation-delay: 0.30s; }
#gallery-skeleton > div:nth-child(4)  { animation-delay: 0.10s; }
#gallery-skeleton > div:nth-child(5)  { animation-delay: 0.25s; }
#gallery-skeleton > div:nth-child(6)  { animation-delay: 0.05s; }
#gallery-skeleton > div:nth-child(7)  { animation-delay: 0.20s; }
#gallery-skeleton > div:nth-child(8)  { animation-delay: 0.35s; }
#gallery-skeleton > div:nth-child(9)  { animation-delay: 0.08s; }
#gallery-skeleton > div:nth-child(10) { animation-delay: 0.18s; }

html:not(.dark) #gallery-skeleton > div {
  background: linear-gradient(90deg, #e8e8e2 0%, #d8d8d0 50%, #e8e8e2 100%);
  background-size: 200% 100%;
}

/* =====================================================
   Touch targets — expand hit area via ::before (no layout impact)
   Keeps the controls bar visually compact while meeting 44px minimum
   ===================================================== */
@media (max-width: 1279px) {
  /* ::after is reserved for the underline on .brut-tab, so ::before is free */
  .brut-tab::before,
  .brut-icon-btn::before {
    content: '';
    position: absolute;
    inset: -10px 0; /* 10px extra tap area top + bottom; horizontal stays tight */
  }
}

/* Search clear button: expand all sides */
#search-clear-btn {
  position: relative;
}
#search-clear-btn::before {
  content: '';
  position: absolute;
  inset: -12px;
}

/* =====================================================
   Focus styles — keyboard accessibility
   ===================================================== */
.brut-tab:focus-visible {
  outline: 2px solid currentColor;
  outline-offset: -2px;
}
.brut-icon-btn:focus-visible {
  outline: 2px solid currentColor;
  outline-offset: -2px;
}
.gallery-item:focus-visible {
  outline: 2px solid #fff;
  outline-offset: -2px;
  z-index: 3;
}
html:not(.dark) .gallery-item:focus-visible {
  outline-color: #000;
}

/* ============================================================
   Design Improvements
   ============================================================ */

/* Subtle image scale on hover (overflow:hidden clips gracefully) */
.gallery-item:hover .item-image-container img,
.gallery-item:hover .item-image-container video {
  transform: scale(1.04) !important;
}

/* Staggered entrance — organic wave pattern (not pure left-to-right) */
.gallery-item:nth-child(1).grid-enter  { animation-delay:   0ms; }
.gallery-item:nth-child(2).grid-enter  { animation-delay:  35ms; }
.gallery-item:nth-child(3).grid-enter  { animation-delay:  70ms; }
.gallery-item:nth-child(4).grid-enter  { animation-delay: 105ms; }
.gallery-item:nth-child(5).grid-enter  { animation-delay: 140ms; }
.gallery-item:nth-child(6).grid-enter  { animation-delay: 175ms; }
.gallery-item:nth-child(7).grid-enter  { animation-delay:  50ms; }
.gallery-item:nth-child(8).grid-enter  { animation-delay:  90ms; }
.gallery-item:nth-child(9).grid-enter  { animation-delay: 130ms; }
.gallery-item:nth-child(10).grid-enter { animation-delay:  20ms; }
.gallery-item:nth-child(11).grid-enter { animation-delay: 160ms; }
.gallery-item:nth-child(12).grid-enter { animation-delay:  60ms; }
.gallery-item:nth-child(13).grid-enter { animation-delay: 100ms; }
.gallery-item:nth-child(14).grid-enter { animation-delay: 145ms; }
.gallery-item:nth-child(15).grid-enter { animation-delay:  40ms; }
.gallery-item:nth-child(16).grid-enter { animation-delay: 185ms; }
.gallery-item:nth-child(17).grid-enter { animation-delay:  75ms; }
.gallery-item:nth-child(18).grid-enter { animation-delay: 115ms; }
.gallery-item:nth-child(19).grid-enter { animation-delay: 155ms; }
.gallery-item:nth-child(20).grid-enter { animation-delay:  25ms; }
.gallery-item:nth-child(21).grid-enter { animation-delay: 195ms; }
.gallery-item:nth-child(22).grid-enter { animation-delay:  80ms; }
.gallery-item:nth-child(23).grid-enter { animation-delay: 125ms; }
.gallery-item:nth-child(24).grid-enter { animation-delay:  45ms; }

/* Hover-title — true liquid glass with inner refraction border */
.hover-title {
  background: rgba(248, 248, 248, 0.72) !important;
  backdrop-filter: blur(14px) saturate(180%) !important;
  -webkit-backdrop-filter: blur(14px) saturate(180%) !important;
  border: 1px solid rgba(255, 255, 255, 0.55) !important;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.6),
    0 4px 20px rgba(0, 0, 0, 0.08) !important;
  letter-spacing: -0.01em !important;
}

.dark .hover-title {
  background: rgba(12, 12, 12, 0.78) !important;
  border: 1px solid rgba(255, 255, 255, 0.1) !important;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.07),
    0 4px 20px rgba(0, 0, 0, 0.45) !important;
}

/* Better empty state */
#gallery-empty-state {
  font-family: var(--mono) !important;
  font-size: 0.65rem !important;
  letter-spacing: 0.22em !important;
}

/* Controls bar border-bottom refinement */
#controls-bar {
  border-bottom-width: 1px !important;
}

/* ============================================================
   Item Title Improvements
   ============================================================ */

/* Title strip: needs relative positioning for the scan-line ::after */
.item-content {
  position: relative !important;
}

/* Scan-line: a bright hairline that scaleX-reveals from left to right
   along the top edge of the title strip on hover */
.item-content::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: rgba(255, 255, 255, 0.65);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.45s cubic-bezier(0.16, 1, 0.3, 1);
  pointer-events: none;
}

html:not(.dark) .item-content::after {
  background: rgba(0, 0, 0, 0.45);
}

.gallery-item:hover .item-content::after {
  transform: scaleX(1);
}

/* Title: replace letter-spacing jitter with a clean translateY lift */
.item-title {
  transition: color 0.2s cubic-bezier(0.16, 1, 0.3, 1),
              transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1) !important;
}

.gallery-item:hover .item-title {
  transform: translateY(-2px) !important;
  letter-spacing: 0.1em !important;
}

/* Restore item-type as an extremely dim secondary data row */
.item-type {
  display: block !important;
  font-family: var(--mono) !important;
  font-size: 0.5rem !important;
  font-weight: 400 !important;
  letter-spacing: 0.08em !important;
  text-transform: uppercase !important;
  color: rgba(255, 255, 255, 0.15) !important;
  padding: 0 0.55rem 0.35rem !important;
  margin: 0 !important;
  line-height: 1.4 !important;
  white-space: nowrap !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  transition: color 0.2s ease !important;
}

html:not(.dark) .item-type {
  color: rgba(0, 0, 0, 0.18) !important;
}

.gallery-item:hover .item-type {
  color: rgba(255, 255, 255, 0.42) !important;
}

html:not(.dark) .gallery-item:hover .item-type {
  color: rgba(0, 0, 0, 0.36) !important;
}

/* cards-hidden mode: keep item-type hidden since hover-title handles labeling */
.gallery-item.cards-hidden .item-type {
  display: none !important;
}

/* ============================================================
   Sleek portfolio refinement pass
   Keeps the artwork/content model intact while quieting the UI.
   ============================================================ */

:root {
  --page-bg: #ECEBDD;
  --page-ink: #000000;
  --page-muted: #000000;
  --page-hairline: rgba(19, 18, 10, 0.12);
  --page-panel: rgba(255, 255, 248, 0.48);
  --page-panel-strong: rgba(255, 255, 248, 0.78);
  --page-shadow: 0 18px 60px rgba(19, 18, 10, 0.08);
  --control-height: 48px;
}

.dark {
  --page-bg: #13120A;
  --page-ink: #FFFFFF;
  --page-muted: #FFFFFF;
  --page-hairline: rgba(247, 244, 232, 0.12);
  --page-panel: rgba(255, 255, 255, 0.045);
  --page-panel-strong: rgba(255, 255, 255, 0.08);
  --page-shadow: 0 24px 70px rgba(0, 0, 0, 0.35);
}

.navy {
  --page-bg: #061830;
  --page-ink: #FFFFFF;
  --page-muted: rgba(255, 255, 255, 0.68);
  --page-hairline: rgba(220, 235, 255, 0.14);
  --page-panel: rgba(220, 235, 255, 0.055);
  --page-panel-strong: rgba(220, 235, 255, 0.09);
  --page-shadow: 0 24px 70px rgba(0, 0, 0, 0.32);
}

.pastel {
  --page-bg: var(--pastelle-pastel-bg);
  --page-ink: var(--pastelle-pastel-ink);
  --page-muted: var(--pastelle-pastel-muted);
  --page-hairline: var(--pastelle-pastel-hairline);
  --page-panel: var(--pastelle-pastel-surface);
  --page-panel-strong: var(--pastelle-pastel-surface-strong);
  --page-shadow: 0 24px 70px color-mix(in srgb, var(--pastelle-pastel-ink) 14%, transparent);
}

body {
  background:
    radial-gradient(circle at 82% 8%, rgba(247, 244, 232, 0.08), transparent 28rem),
    var(--page-bg) !important;
  color: var(--page-ink) !important;
}

html:not(.dark) body {
  background:
    radial-gradient(circle at 82% 8%, rgba(255, 255, 255, 0.6), transparent 28rem),
    var(--page-bg) !important;
  color: var(--page-ink) !important;
}

#navbar > .absolute {
  left: 0 !important;
  right: auto !important;
  width: 100% !important;
  max-width: none !important;
  transform: none !important;
  background: color-mix(in srgb, var(--page-bg) 88%, transparent) !important;
  border-bottom: 0 !important;
  backdrop-filter: blur(18px) saturate(130%);
  -webkit-backdrop-filter: blur(18px) saturate(130%);
}

#navbar-inner {
  max-width: none !important;
  width: 100% !important;
}

#navbar a,
#navbar button {
  color: var(--page-ink) !important;
}

#navbar,
#mobileMenu,
#page-header,
#controls-bar,
#main-content,
.modal-overlay,
#inquiry-overlay,
#site-footer {
  color: var(--page-ink) !important;
}

#navbar :is(a, button, span, p),
#mobileMenu :is(a, button, span, p),
#page-header :is(h1, span, p),
#controls-bar :is(button, input, span),
#main-content :is(h2, h3, p, span, button),
.modal-overlay :is(h2, h3, p, span, button, a, label),
#inquiry-overlay :is(h2, h3, p, span, button, label, input, textarea),
#site-footer :is(a, p, span) {
  color: var(--page-ink) !important;
}

html.pastel #site-footer {
  background: transparent !important;
  border-top-color: var(--page-hairline) !important;
  color: var(--page-ink) !important;
}

html.pastel #site-footer a.footer-mark {
  color: var(--page-ink) !important;
}

html.pastel #site-footer .footer-note,
html.pastel #site-footer .footer-links a {
  color: var(--page-muted) !important;
}

html.pastel #site-footer .footer-links a:hover {
  color: var(--page-ink) !important;
}

.brut-search-input::placeholder,
#inquiry-overlay input::placeholder,
#inquiry-overlay textarea::placeholder {
  color: var(--page-ink) !important;
  opacity: 1 !important;
}

#page-header {
  background: transparent !important;
  border-bottom: 0 !important;
}

#page-header > div {
  max-width: none !important;
}

#page-header > div > div {
  border-top: 0 !important;
  padding-top: clamp(1.25rem, 3vw, 3rem) !important;
  padding-bottom: clamp(1.25rem, 3vw, 2.5rem) !important;
}

#page-header h1 {
  width: 100%;
  max-width: none;
  color: var(--page-ink) !important;
  font-size: clamp(2.4rem, 8.2vw, 10.5rem) !important;
  font-weight: 600 !important;
  line-height: 0.84 !important;
  letter-spacing: -0.035em !important;
  white-space: nowrap !important;
  text-wrap: nowrap;
  padding-bottom: 0 !important;
}

#work-count-label {
  display: inline-block;
  transform: none;
  color: var(--page-muted);
  font-size: 1em;
  font-weight: inherit;
}

#controls-bar {
  top: 5rem !important;
  background: transparent !important;
  border-bottom: 0 !important;
  padding: 0 0 0.65rem;
}

#controls-bar.scrolled {
  top: 4rem !important;
}

#controls-inner {
  max-width: none !important;
  width: 100% !important;
}

#controls-inner > div:first-child {
  align-items: center !important;
  gap: 0.45rem;
  overflow: visible !important;
  min-height: var(--control-height);
  padding: 0.35rem;
  border: 1px solid var(--page-hairline);
  border-radius: 0;
  background: color-mix(in srgb, var(--page-bg) 78%, transparent);
  box-shadow: var(--page-shadow);
  backdrop-filter: blur(20px) saturate(130%);
  -webkit-backdrop-filter: blur(20px) saturate(130%);
}

#controls-inner > div:first-child > div:first-child {
  flex: 1 1 auto;
  min-width: 0;
  width: 100%;
}

#controls-inner > div:first-child > div:first-child,
#category-expand-wrapper,
#year-expand-wrapper,
#controls-inner .flex.items-stretch {
  gap: 0.35rem;
}

.brut-tab,
.brut-icon-btn {
  min-height: 40px;
  border: 0 !important;
  border-radius: 6px !important;
  color: var(--page-muted) !important;
  background: transparent !important;
  font-family: var(--mono) !important;
  font-size: 0.68rem !important;
  font-weight: 600 !important;
  letter-spacing: 0.09em !important;
  transition:
    color 0.18s ease,
    background-color 0.18s ease,
    transform 0.18s cubic-bezier(0.16, 1, 0.3, 1) !important;
}

.brut-tab {
  padding: 0.72rem 0.85rem !important;
}

.brut-icon-btn {
  width: 40px;
  padding: 0 !important;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.brut-tab:hover,
.brut-icon-btn:hover,
.category-btn.active,
.year-btn.active,
.toggle-icon-active {
  color: var(--page-ink) !important;
  background: var(--page-panel-strong) !important;
  transform: translateY(-1px);
}

.brut-tab:active,
.brut-icon-btn:active {
  transform: translateY(0) scale(0.98);
}

.brut-tab::after {
  display: none !important;
}

#controls-search {
  flex: 1 1 auto !important;
  min-width: 14rem;
  padding: 0 !important;
}

.search-container-brut {
  min-height: 40px;
  padding: 0 0.72rem !important;
  border: 0 !important;
  border-radius: 6px !important;
  background: var(--page-panel) !important;
}

.brut-search-input {
  width: 100%;
  color: var(--page-ink) !important;
  font-size: 0.72rem !important;
  font-weight: 600;
  letter-spacing: 0.08em !important;
}

.brut-search-input::placeholder {
  color: var(--page-muted) !important;
}

.search-icon-brut {
  color: var(--page-muted) !important;
}

.mobile-dropdown {
  border: 1px solid var(--page-hairline) !important;
  border-radius: 8px !important;
  background: color-mix(in srgb, var(--page-bg) 94%, transparent) !important;
  box-shadow: var(--page-shadow) !important;
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}

.mobile-dropdown-option {
  border-radius: 6px !important;
  color: var(--page-muted) !important;
}

.mobile-dropdown-option:hover,
.mobile-dropdown-option.active {
  background: var(--page-panel-strong) !important;
  color: var(--page-ink) !important;
}

#main-content {
  max-width: none !important;
  width: 100% !important;
  padding-top: clamp(1.3rem, 2vw, 2.2rem);
}

.gallery-grid {
  display: grid !important;
  grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  gap: clamp(0.7rem, 1.25vw, 1.25rem) !important;
}

@media (min-width: 768px) {
  .gallery-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
  }
}

@media (min-width: 1280px) {
  .gallery-grid {
    grid-template-columns: repeat(6, minmax(0, 1fr)) !important;
  }
}

@media (min-width: 1536px) {
  .gallery-grid {
    grid-template-columns: repeat(8, minmax(0, 1fr)) !important;
  }
}

@media (min-width: 2000px) {
  .gallery-grid {
    grid-template-columns: repeat(8, minmax(0, 1fr)) !important;
  }
}

@media (min-width: 2400px) {
  .gallery-grid {
    grid-template-columns: repeat(8, minmax(0, 1fr)) !important;
  }
}

.gallery-grid.large-view {
  grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
}

@media (min-width: 1024px) {
  .gallery-grid.large-view {
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
  }
}

@media (min-width: 1536px) {
  .gallery-grid.large-view {
    grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
  }
}

@media (min-width: 2200px) {
  .gallery-grid.large-view {
    grid-template-columns: repeat(5, minmax(0, 1fr)) !important;
  }
}

.gallery-item {
  background: transparent !important;
  border-radius: 0 !important;
  box-shadow: none !important;
  outline: 1px solid transparent !important;
  outline-offset: 0 !important;
  overflow: hidden;
  transition:
    transform 0.35s cubic-bezier(0.16, 1, 0.3, 1),
    outline-color 0.2s ease,
    background-color 0.2s ease !important;
}

.gallery-item:hover {
  background: var(--page-panel) !important;
  outline-color: var(--page-hairline) !important;
  transform: translateY(-4px);
}

.item-image-container {
  aspect-ratio: 1 / 1 !important;
  margin-bottom: 0 !important;
  background: transparent !important;
  border-radius: 0 !important;
  overflow: hidden !important;
}

.item-image-container.portrait {
  aspect-ratio: 4 / 5 !important;
}

.item-image-container.portrait-34 {
  aspect-ratio: 3 / 4 !important;
}

.item-image-container.landscape {
  aspect-ratio: 5 / 4 !important;
}

.item-image-container img,
.item-image-container video {
  width: 100% !important;
  height: 100% !important;
  object-fit: cover !important;
  border-radius: 0 !important;
  transform-origin: center;
}

.gallery-item:hover .item-image-container img,
.gallery-item:hover .item-image-container video {
  transform: scale(1.025) !important;
}

.item-overlay {
  border-radius: 0 !important;
  background: linear-gradient(to bottom, transparent 62%, rgba(0, 0, 0, 0.18)) !important;
  opacity: 0;
}

.gallery-item:hover .item-overlay {
  opacity: 1 !important;
  background: linear-gradient(to bottom, transparent 58%, rgba(0, 0, 0, 0.18)) !important;
}

.item-content {
  border-top: 0 !important;
  padding: 0.65rem 0.1rem 0.15rem !important;
  background: transparent !important;
}

.item-content::after {
  display: none !important;
}

.item-title {
  padding: 0 !important;
  color: var(--page-ink) !important;
  font-size: 0.78rem !important;
  font-weight: 600 !important;
  letter-spacing: 0 !important;
  line-height: 1.25 !important;
  text-transform: none !important;
  text-wrap: pretty;
}

.gallery-item:hover .item-title {
  color: var(--page-ink) !important;
  letter-spacing: 0 !important;
  transform: translateY(-1px) !important;
}

.item-type {
  display: none !important;
}

.hover-title {
  left: 0.55rem !important;
  right: 0.55rem !important;
  bottom: 0.55rem !important;
  width: auto !important;
  max-width: none !important;
  border-radius: 0 !important;
  padding: 0.45rem 0.6rem !important;
  background: color-mix(in srgb, var(--page-bg) 72%, transparent) !important;
  border: 1px solid var(--page-hairline) !important;
  color: var(--page-ink) !important;
  font-size: 0.72rem !important;
  font-weight: 600 !important;
  letter-spacing: 0 !important;
  text-transform: none !important;
  text-align: left !important;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.16) !important;
  backdrop-filter: blur(16px) saturate(140%) !important;
  -webkit-backdrop-filter: blur(16px) saturate(140%) !important;
}

.gallery-item.cards-hidden:hover .hover-title {
  opacity: 1 !important;
}

#gallery-skeleton {
  gap: clamp(0.7rem, 1.25vw, 1.25rem) !important;
  grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
}

@media (min-width: 768px) {
  #gallery-skeleton {
    grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
  }
}

@media (min-width: 1280px) {
  #gallery-skeleton {
    grid-template-columns: repeat(6, minmax(0, 1fr)) !important;
  }
}

@media (min-width: 1536px) {
  #gallery-skeleton {
    grid-template-columns: repeat(8, minmax(0, 1fr)) !important;
  }
}

@media (min-width: 2000px) {
  #gallery-skeleton {
    grid-template-columns: repeat(8, minmax(0, 1fr)) !important;
  }
}

@media (min-width: 2400px) {
  #gallery-skeleton {
    grid-template-columns: repeat(8, minmax(0, 1fr)) !important;
  }
}

#gallery-skeleton > div {
  border-radius: 0;
  background: linear-gradient(90deg, var(--page-panel) 0%, var(--page-panel-strong) 50%, var(--page-panel) 100%) !important;
  background-size: 200% 100% !important;
}

.modal-overlay {
  background: color-mix(in srgb, var(--page-bg) 24%, transparent) !important;
  isolation: isolate;
}

.modal-overlay::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 0;
  opacity: 0;
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--page-bg) 74%, transparent), color-mix(in srgb, var(--page-bg) 44%, transparent)),
    repeating-linear-gradient(90deg, color-mix(in srgb, var(--page-ink) 4%, transparent) 0 1px, transparent 1px 24px);
  transition: opacity 0.32s cubic-bezier(0.16, 1, 0.3, 1);
}

.modal-overlay.active {
  background: color-mix(in srgb, var(--page-bg) 34%, transparent) !important;
  backdrop-filter: blur(24px) saturate(118%) !important;
  -webkit-backdrop-filter: blur(24px) saturate(118%) !important;
}

.modal-overlay.active::before {
  opacity: 0.58;
}

.modal-content {
  position: relative;
  z-index: 1;
  border: 1px solid color-mix(in srgb, var(--page-hairline) 84%, var(--page-ink) 16%) !important;
  border-radius: 12px !important;
  background: color-mix(in srgb, var(--page-bg) 96%, transparent) !important;
  box-shadow: 0 26px 70px color-mix(in srgb, var(--page-ink) 16%, transparent) !important;
  contain: layout paint;
}

.modal-content > :not(button.absolute) {
  position: relative;
  z-index: 1;
}

.modal-content>button.absolute {
  position: absolute !important;
  z-index: 3 !important;
  border: 1px solid var(--page-hairline) !important;
  border-radius: 8px !important;
  background: color-mix(in srgb, var(--page-bg) 80%, transparent) !important;
  color: var(--page-ink) !important;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

.modal-content>button.absolute:hover {
  background: var(--page-panel-strong) !important;
  transform: rotate(90deg) scale(1.04) !important;
}

.modal-panel {
  gap: clamp(1.25rem, 3vw, 3rem) !important;
}

.modal-main-image {
  border: 0 !important;
  border-radius: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
  transition: border-color 0.22s ease, background 0.22s ease, transform 0.22s ease;
}

.modal-main-image.is-switching {
  opacity: 0.88;
  border-color: color-mix(in srgb, var(--page-ink) 24%, var(--page-hairline));
}

.modal-main-image > .modal-image {
  display: block;
  width: 100% !important;
  height: 100% !important;
  max-width: none !important;
  max-height: none !important;
  object-fit: contain !important;
  box-shadow:
    0 2px 5px rgba(0, 0, 0, 0.2),
    0 18px 34px rgba(0, 0, 0, 0.3);
}

.modal-main-image img.modal-image,
.modal-main-image video.modal-image {
  animation: modal-media-settle 0.24s cubic-bezier(0.16, 1, 0.3, 1) both;
}

@keyframes modal-media-settle {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

.modal-header {
  gap: 0.85rem !important;
  padding-bottom: 1.1rem !important;
  border-bottom-color: var(--page-hairline) !important;
}

.modal-title {
  color: var(--page-ink) !important;
  font-size: clamp(1.65rem, 2.25vw, 2.7rem) !important;
  font-weight: 600 !important;
  letter-spacing: 0 !important;
  line-height: 1.04 !important;
  text-wrap: balance;
}

.modal-subtitle {
  font-size: 0.68rem !important;
  font-weight: 600 !important;
  letter-spacing: 0 !important;
  text-transform: uppercase !important;
  color: var(--page-muted) !important;
  opacity: 0.68;
  margin-top: 0.1rem !important;
  font-family: 'Manrope', sans-serif !important;
}

.modal-action-bar {
  display: grid !important;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.5rem !important;
}

.modal-action-btn,
.modal-footer-btn {
  position: relative;
  min-height: 42px;
  overflow: hidden;
  border-radius: 8px !important;
  border: 1px solid var(--page-hairline) !important;
  background: color-mix(in srgb, var(--page-panel) 92%, transparent) !important;
  color: var(--page-ink) !important;
  box-shadow: none !important;
  font-size: 0.74rem !important;
  font-weight: 600 !important;
  letter-spacing: 0 !important;
  text-transform: uppercase !important;
  transition: transform 0.18s cubic-bezier(0.16, 1, 0.3, 1),
    background-color 0.18s ease,
    border-color 0.18s ease,
    color 0.18s ease !important;
}

.modal-action-btn::after,
.modal-footer-btn::after {
  content: '';
  position: absolute;
  left: 0.7rem;
  right: 0.7rem;
  bottom: 0.52rem;
  height: 1px;
  background: currentColor;
  opacity: 0.34;
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.modal-action-btn:hover,
.modal-footer-btn:hover {
  background: var(--page-panel-strong) !important;
  border-color: color-mix(in srgb, var(--page-ink) 28%, var(--page-hairline)) !important;
  transform: translateY(-1px) !important;
  box-shadow: none !important;
}

.modal-action-btn:hover::after,
.modal-footer-btn:hover::after {
  transform: scaleX(1);
}

.modal-action-btn:active,
.modal-footer-btn:active {
  transform: translateY(0) scale(0.985) !important;
}

.inquiry-btn {
  background: var(--page-ink) !important;
  color: var(--page-bg) !important;
  border-color: var(--page-ink) !important;
  font-weight: 700 !important;
}

html:not(.dark):not(.navy) .modal-action-bar .modal-action-btn.inquiry-btn {
  background: #121212 !important;
  border-color: #121212 !important;
  color: #fdfcf8 !important;
  -webkit-text-fill-color: #fdfcf8 !important;
}

.inquiry-btn:hover {
  background: color-mix(in srgb, var(--page-ink) 88%, var(--page-bg)) !important;
  color: var(--page-bg) !important;
}

html:not(.dark):not(.navy) .modal-action-bar .modal-action-btn.inquiry-btn:hover {
  background: #242424 !important;
  border-color: #242424 !important;
  color: #fdfcf8 !important;
  -webkit-text-fill-color: #fdfcf8 !important;
}

.inquiry-btn::before,
.inquiry-btn::after {
  display: none !important;
}

.modal-details {
  grid-template-columns: minmax(4rem, auto) minmax(0, 1fr) !important;
  gap: 0.58rem 1.4rem !important;
  color: var(--page-muted) !important;
  font-size: 0.82rem !important;
  line-height: 1.35 !important;
}

.detail-label {
  color: var(--page-muted) !important;
  opacity: 0.72;
}

.detail-value {
  color: var(--page-ink) !important;
  font-weight: 600 !important;
  overflow-wrap: anywhere;
}

.detail-hash-value {
  font-size: 0.72rem !important;
  line-height: 1.45 !important;
}

.modal-thumbnail-wrapper {
  position: relative;
  border-radius: 8px !important;
  border-color: var(--page-hairline) !important;
  background: var(--page-panel) !important;
  transition: border-color 0.2s ease, transform 0.2s cubic-bezier(0.16, 1, 0.3, 1), background-color 0.2s ease;
}

.modal-thumbnail-wrapper::after {
  content: '';
  position: absolute;
  inset: auto 8px 7px;
  height: 2px;
  border-radius: 999px;
  background: var(--page-ink);
  opacity: 0;
  transform: scaleX(0.3);
  transition: opacity 0.2s ease, transform 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  pointer-events: none;
}

.modal-thumbnail-wrapper:hover {
  transform: translateY(-1px);
  background: var(--page-panel-strong) !important;
}

.modal-thumbnail-wrapper:has(.modal-thumbnail.active) {
  border-color: color-mix(in srgb, var(--page-ink) 58%, var(--page-hairline)) !important;
  box-shadow: none !important;
}

.modal-thumbnail-wrapper:has(.modal-thumbnail.active)::after {
  opacity: 0.85;
  transform: scaleX(1);
}

.modal-thumbnail {
  filter: grayscale(42%) contrast(0.96) !important;
  opacity: 0.62 !important;
  transition: opacity 0.2s ease, transform 0.2s cubic-bezier(0.16, 1, 0.3, 1), filter 0.2s ease !important;
}

.modal-thumbnail:hover,
.modal-thumbnail.active {
  filter: grayscale(0%) contrast(1) !important;
  opacity: 1 !important;
  transform: scale(1.035) !important;
}

.modal-footer-nav,
.modal-footer-fixed {
  border-color: var(--page-hairline) !important;
  background: transparent !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
}

.modal-nav-btn {
  border-radius: 8px !important;
  border-color: var(--page-hairline) !important;
  background: color-mix(in srgb, var(--page-bg) 78%, transparent) !important;
  color: var(--page-ink) !important;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

.modal-nav-btn:hover {
  background: var(--page-panel-strong) !important;
  color: var(--page-ink) !important;
  box-shadow: none !important;
}

@media (min-width: 1025px) {
  .modal-content {
    width: min(1540px, calc(100vw - 2rem)) !important;
    height: min(900px, calc(100dvh - 2rem)) !important;
    max-width: calc(100vw - 2rem) !important;
    max-height: calc(100dvh - 2rem) !important;
    margin: 1rem !important;
  }

  #modal-body {
    display: grid !important;
    grid-template-rows: minmax(0, 1fr) auto;
    gap: 1rem !important;
    width: 100% !important;
    height: 100% !important;
    max-width: none !important;
    max-height: none !important;
    overflow: hidden !important;
    padding: clamp(1.5rem, 2.2vw, 2.75rem) !important;
  }

  .modal-panel {
    height: 100% !important;
    min-height: 0 !important;
    grid-template-columns: minmax(0, 1fr) minmax(330px, clamp(360px, 26vw, 500px)) !important;
    align-items: stretch !important;
  }

  .modal-main-image {
    width: 100% !important;
    height: 100% !important;
    min-height: 0 !important;
    max-height: none !important;
    aspect-ratio: auto !important;
    justify-self: stretch;
    align-self: stretch;
  }

  .modal-main-image.portrait,
  .modal-main-image.portrait-34,
  .modal-main-image.landscape {
    width: 100% !important;
    aspect-ratio: auto !important;
  }

  .modal-info {
    height: 100%;
    min-height: 0;
    display: flex !important;
    flex-direction: column;
    gap: clamp(1rem, 1.4vw, 1.35rem) !important;
    justify-content: normal;
    overflow: hidden;
  }

  .modal-thumbnails {
    grid-template-columns: repeat(auto-fill, minmax(68px, 1fr)) !important;
    max-height: none !important;
    min-height: 0;
    flex: 1 1 auto;
    overflow-y: auto !important;
    padding: 2px 4px 4px 2px !important;
    gap: 0.55rem !important;
  }

  .modal-details-desktop {
    flex: 0 0 auto;
  }

  .modal-footer-nav {
    margin-top: 0 !important;
    padding-top: 1rem !important;
  }
}

@media (min-width: 1800px) {
  .modal-content {
    width: min(1700px, calc(100vw - 3rem)) !important;
  }

  .modal-panel {
    grid-template-columns: minmax(0, 1fr) minmax(390px, clamp(430px, 24vw, 570px)) !important;
  }

}

@media (max-width: 1024px) {
  .modal-content {
    width: min(960px, calc(100vw - 1rem)) !important;
    max-height: calc(100dvh - 1rem) !important;
  }

  #modal-body {
    padding: 1.25rem !important;
  }

  .modal-action-bar {
    display: flex !important;
    flex-wrap: wrap;
  }
}

@media (max-width: 767px) {
  .modal-content {
    border-radius: 18px 18px 0 0 !important;
    box-shadow: 0 -18px 50px color-mix(in srgb, var(--page-ink) 16%, transparent) !important;
  }

  .modal-content::before {
    display: none;
  }

  .modal-panel {
    padding: 0.5rem 1rem 1rem !important;
  }

  .modal-main-image {
    height: clamp(190px, 34vh, 290px) !important;
    border-radius: 12px !important;
  }

  .modal-title {
    font-size: 1.22rem !important;
    line-height: 1.12 !important;
  }

  .modal-subtitle {
    font-size: 0.62rem !important;
  }

  .modal-action-bar {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.45rem !important;
  }

  .modal-action-btn {
    min-height: 42px !important;
    width: 100%;
    padding: 0.68rem 0.95rem !important;
  }

  .modal-footer-fixed {
    background: color-mix(in srgb, var(--page-bg) 92%, transparent) !important;
    backdrop-filter: blur(18px) saturate(120%) !important;
    -webkit-backdrop-filter: blur(18px) saturate(120%) !important;
  }

  .modal-footer-nav {
    display: grid !important;
    grid-template-columns: 1fr 1fr;
    padding: 0.55rem 1rem max(0.7rem, env(safe-area-inset-bottom)) !important;
  }

  .modal-footer-btn {
    justify-content: center;
    min-height: 44px !important;
  }
}

#inquiry-overlay {
  background: color-mix(in srgb, var(--page-bg) 45%, transparent) !important;
}

#inquiry-modal {
  border-radius: 10px;
  background: var(--page-bg) !important;
  color: var(--page-ink) !important;
  border-color: var(--page-hairline) !important;
  box-shadow: var(--page-shadow);
}

#inquiry-close,
#inquiry-label,
#inquiry-subtitle,
.inquiry-field label,
#inquiry-success {
  color: var(--page-muted) !important;
}

#inquiry-title {
  color: var(--page-ink) !important;
}

.inquiry-field input,
.inquiry-field textarea {
  border-radius: 6px;
  background: var(--page-panel) !important;
  border-color: var(--page-hairline) !important;
  color: var(--page-ink) !important;
}

#inquiry-submit {
  border-radius: 6px;
  background: var(--page-panel-strong) !important;
  color: var(--page-ink) !important;
  border-color: var(--page-ink) !important;
}

/* =====================================================
   Micro-interaction polish
   ===================================================== */
.brut-tab.filter-pulse,
.brut-icon-btn.filter-pulse {
  animation: control-settle 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes control-settle {
  0% { opacity: 0.72; }
  100% { opacity: 1; }
}

#work-count-label.count-updating {
  animation: count-settle 0.32s cubic-bezier(0.34, 1.45, 0.64, 1);
  color: var(--page-ink);
}

@keyframes count-settle {
  0% { opacity: 0.55; transform: translateY(0.12em); }
  100% { opacity: 1; transform: translateY(0); }
}

.item-image-container.img-loaded img,
.item-image-container.img-loaded video {
  opacity: 1;
}

.modal-content {
  transform-origin: center;
}

@media (max-width: 767px) and (prefers-reduced-motion: no-preference) {
  .modal-overlay.active .modal-content {
    animation: mobile-sheet-arrive 0.28s cubic-bezier(0.16, 1, 0.3, 1) both;
  }
}

@keyframes mobile-sheet-arrive {
  from { opacity: 0; transform: translateY(18%); }
  to { opacity: 1; transform: translateY(0); }
}

.brut-tab:focus-visible,
.brut-icon-btn:focus-visible,
.modal-action-btn:focus-visible,
.modal-footer-btn:focus-visible,
.modal-nav-btn:focus-visible,
.mobile-dropdown-option:focus-visible,
#search-input:focus-visible {
  outline: 1px solid var(--page-ink) !important;
  outline-offset: 3px !important;
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--page-ink) 10%, transparent) !important;
}

@media (min-width: 1280px) {
  #controls-inner > div:first-child > div:first-child {
    display: flex !important;
    align-items: center;
    gap: 0;
  }

  #category-filter-wrapper,
  #year-filter-wrapper {
    flex: 0 0 auto;
  }

  #year-filter-wrapper {
    margin-left: 0.35rem;
  }

  #category-expand-wrapper,
  #year-expand-wrapper {
    gap: 0;
  }

  .category-option-btn,
  .year-option-btn {
    flex: 0 0 0 !important;
    width: 0 !important;
    min-width: 0 !important;
    max-width: 0 !important;
    margin: 0 !important;
    padding-left: 0 !important;
    padding-right: 0 !important;
    border: 0 !important;
    opacity: 0 !important;
    transform: scaleX(0.86) translateX(-4px);
    transform-origin: left center;
    transition:
      max-width 0.42s cubic-bezier(0.34, 1.65, 0.64, 1),
      padding 0.42s cubic-bezier(0.34, 1.65, 0.64, 1),
      opacity 0.18s ease,
      transform 0.42s cubic-bezier(0.34, 1.65, 0.64, 1) !important;
  }

  #category-expand-wrapper:hover .category-option-btn,
  #year-expand-wrapper:hover .year-option-btn {
    flex: 0 0 auto !important;
    width: auto !important;
    min-width: max-content !important;
    max-width: 9rem !important;
    padding-left: 0.85rem !important;
    padding-right: 0.85rem !important;
    opacity: 1 !important;
    transform: scaleX(1) translateX(0);
  }

  #controls-search {
    flex: 1 1 auto !important;
    margin-left: 0.35rem;
    min-width: 10rem;
  }
}

@media (max-width: 1024px) {
  #controls-inner > div:first-child {
    flex-wrap: nowrap;
  }

  #controls-inner > div:first-child > div:first-child {
    flex: 1 1 auto;
    order: initial;
    min-width: 0;
    flex-wrap: nowrap;
  }

  #controls-inner > div:first-child > div:last-child {
    order: initial;
    margin-left: auto;
  }

  #controls-search {
    flex: 1 1 auto;
    flex-basis: auto;
    order: initial;
    min-width: 0;
  }
}

@media (max-width: 640px) {
  html,
  body {
    width: 100%;
    max-width: 100%;
    overflow-x: hidden !important;
  }

  #page-header > div,
  #controls-inner,
  #main-content {
    padding-left: 1rem !important;
    padding-right: 1rem !important;
    max-width: 100vw !important;
    overflow-x: clip;
  }

  #page-header > div > div {
    padding-top: 2rem !important;
  }

  #page-header h1 {
    font-size: clamp(2.15rem, 11.8vw, 5.8rem) !important;
  }

  #controls-bar {
    top: 4.7rem !important;
  }

  #controls-inner > div:first-child {
    display: flex !important;
    align-items: center !important;
    flex-wrap: nowrap !important;
    gap: 0.35rem;
    width: 100%;
    min-width: 0;
    padding: 0.4rem;
  }

  #controls-inner > div:first-child > div:first-child {
    display: flex !important;
    flex: 1 1 auto !important;
    align-items: center;
    order: initial;
    min-width: 0;
    width: auto;
    gap: 0.28rem;
  }

  #controls-inner > div:first-child > div:last-child {
    position: static;
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    gap: 0.08rem;
    margin-left: 0;
  }

  #category-filter-wrapper,
  #year-filter-wrapper {
    flex: 0 0 auto;
  }

  #controls-search {
    flex: 1 1 auto !important;
    order: initial;
    width: auto;
    min-width: 0;
  }

  .brut-tab {
    min-height: 34px;
    padding: 0.55rem 0.42rem !important;
    font-size: 0.57rem !important;
    letter-spacing: 0.04em !important;
  }

  .brut-icon-btn {
    width: 28px;
    min-height: 34px;
  }

  .search-container-brut {
    width: 100%;
    min-height: 34px;
    padding: 0 0.5rem !important;
    gap: 0.35rem !important;
  }

  .brut-search-input {
    font-size: 0.58rem !important;
    letter-spacing: 0.06em !important;
  }

  .search-container-brut svg {
    width: 0.85rem !important;
    height: 0.85rem !important;
  }

  .gallery-grid {
    width: 100%;
    gap: 0.9rem !important;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }

  .gallery-item:hover {
    transform: none;
  }

  .item-title {
    font-size: 0.74rem !important;
  }
}

/* ============================================================
   Gallery page refinement pass
   ============================================================ */

body {
  background:
    linear-gradient(90deg, color-mix(in srgb, var(--page-ink) 3%, transparent) 1px, transparent 1px),
    linear-gradient(180deg, color-mix(in srgb, var(--page-ink) 3%, transparent) 1px, transparent 1px),
    var(--page-bg) !important;
  background-size: 52px 52px, 52px 52px, auto;
  background-position: -1px -1px;
}

html:not(.dark) body {
  background:
    linear-gradient(90deg, color-mix(in srgb, var(--page-ink) 4%, transparent) 1px, transparent 1px),
    linear-gradient(180deg, color-mix(in srgb, var(--page-ink) 4%, transparent) 1px, transparent 1px),
    var(--page-bg) !important;
  background-size: 52px 52px, 52px 52px, auto;
  background-position: -1px -1px;
}

/* Let the page's own pastel field continue behind the navbar at the top. */
html.pastel #navbar > .absolute {
  background: transparent !important;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}

html.pastel #navbar.scrolled > .absolute {
  background: var(--page-bg) !important;
}

#page-header > div > div {
  position: relative;
  padding-top: clamp(1.25rem, 3vw, 3rem) !important;
  padding-bottom: clamp(1rem, 2vw, 1.75rem) !important;
}

#page-header > div > div::after {
  display: none !important;
}

@keyframes page-rule-in {
  from { opacity: 0; transform: scaleX(0.18); }
  to { opacity: 0.18; transform: scaleX(1); }
}

#page-header h1 {
  font-size: clamp(3.25rem, 7.4vw, 9.6rem) !important;
  line-height: 0.88 !important;
  letter-spacing: 0 !important;
  transform: translateX(-0.05em);
}

#work-count-label {
  font-variant-numeric: tabular-nums;
  opacity: 0.86;
  transition: opacity 0.2s ease, transform 0.24s cubic-bezier(0.34, 1.45, 0.64, 1);
}

#controls-bar {
  z-index: 40 !important;
  padding-bottom: clamp(0.7rem, 1.5vw, 1rem) !important;
}

#controls-inner > div:first-child {
  position: relative;
  border-radius: 8px !important;
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--page-bg) 86%, transparent), color-mix(in srgb, var(--page-bg) 74%, transparent)) !important;
  box-shadow: 0 12px 44px color-mix(in srgb, var(--page-ink) 8%, transparent) !important;
  overflow: hidden !important;
}

#controls-inner > div:first-child::before {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(90deg, transparent, color-mix(in srgb, var(--page-ink) 8%, transparent), transparent);
  opacity: 0;
  transform: translateX(var(--controls-sheen-x, -80%));
  transition: opacity 0.18s ease;
}

#controls-inner > div:first-child:hover::before {
  opacity: 0.38;
}

.brut-tab,
.brut-icon-btn,
.search-container-brut {
  border-radius: 7px !important;
}

.brut-tab,
.brut-icon-btn {
  will-change: transform;
}

.brut-tab:hover,
.brut-icon-btn:hover {
  transform: translateY(-1px) scale(1.015) !important;
}

.category-btn.active,
.year-btn.active,
.toggle-icon-active {
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--page-ink) 9%, transparent) !important;
}

.search-container-brut {
  transition: background-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s cubic-bezier(0.16, 1, 0.3, 1) !important;
}

.search-container-brut:focus-within {
  background: var(--page-panel-strong) !important;
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--page-ink) 12%, transparent) !important;
  transform: translateY(-1px);
}

#main-content {
  padding-bottom: clamp(5rem, 10vw, 11rem) !important;
}

.gallery-grid {
  gap: clamp(0.85rem, 1.35vw, 1.45rem) !important;
  align-items: start;
}

.gallery-grid:has(.gallery-item:hover) .gallery-item:not(:hover) {
  opacity: 1 !important;
}

.gallery-item {
  --card-x: 50%;
  --card-y: 50%;
  isolation: isolate;
  border-radius: 4px !important;
  overflow: visible !important;
  opacity: 1;
  transform-origin: center 70%;
  transition:
    opacity 0.28s ease,
    transform 0.36s cubic-bezier(0.16, 1, 0.3, 1),
    outline-color 0.2s ease,
    background-color 0.2s ease !important;
}

.gallery-item::before {
  content: '';
  position: absolute;
  inset: -1px;
  z-index: -1;
  pointer-events: none;
  border-radius: 5px;
  opacity: 0;
  background: radial-gradient(220px circle at var(--card-x) var(--card-y), color-mix(in srgb, var(--page-ink) 14%, transparent), transparent 58%);
  transition: opacity 0.22s ease;
}

.gallery-item:hover::before {
  opacity: 1;
}

.gallery-item:hover {
  transform: translateY(-6px) !important;
  background: transparent !important;
  outline-color: color-mix(in srgb, var(--page-ink) 18%, transparent) !important;
}

.item-image-container {
  border-radius: 4px !important;
  background: var(--page-panel) !important;
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--page-ink) 6%, transparent);
  transition: box-shadow 0.22s ease, filter 0.22s ease !important;
}

.gallery-item:hover .item-image-container {
  box-shadow:
    inset 0 0 0 1px color-mix(in srgb, var(--page-ink) 14%, transparent),
    0 18px 36px color-mix(in srgb, var(--page-ink) 10%, transparent);
}

.item-image-container img,
.item-image-container video {
  filter: saturate(0.94) contrast(0.98);
  transition:
    transform 0.7s cubic-bezier(0.16, 1, 0.3, 1),
    filter 0.28s ease !important;
}

.gallery-item:hover .item-image-container img,
.gallery-item:hover .item-image-container video {
  filter: saturate(1.05) contrast(1.02);
  transform: scale(1.035) !important;
}

.item-content {
  padding: 0.72rem 0.05rem 0 !important;
}

.item-title {
  font-size: clamp(0.74rem, 0.78vw, 0.86rem) !important;
  line-height: 1.18 !important;
  text-wrap: pretty;
  white-space: normal !important;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.gallery-item:hover .item-title {
  transform: translateY(-0.08rem) !important;
}

.gallery-item.cards-hidden .item-content {
  max-height: 0 !important;
  padding: 0 !important;
}

.hover-title {
  border-radius: 6px !important;
}

#gallery-empty-state {
  min-height: 30vh;
  display: grid;
  place-items: center;
  border: 1px solid var(--page-hairline);
  border-radius: 8px;
  background: color-mix(in srgb, var(--page-bg) 78%, transparent);
}

#gallery-empty-state.hidden {
  display: none !important;
}

@media (min-width: 1280px) {
  .gallery-grid {
    grid-template-columns: repeat(6, minmax(0, 1fr)) !important;
  }
}

@media (min-width: 1680px) {
  .gallery-grid {
    grid-template-columns: repeat(8, minmax(0, 1fr)) !important;
  }
}

@media (min-width: 2200px) {
  .gallery-grid {
    grid-template-columns: repeat(8, minmax(0, 1fr)) !important;
  }
}

@media (max-width: 900px) {
  #page-header h1 {
    transform: none;
    white-space: normal !important;
    text-wrap: balance;
  }

  .gallery-grid:has(.gallery-item:hover) .gallery-item:not(:hover) {
    opacity: 1 !important;
  }
}

@media (max-width: 640px) {
  #page-header > div > div {
    padding-top: 2.35rem !important;
    padding-bottom: 0.85rem !important;
  }

  #page-header h1 {
    font-size: clamp(2.3rem, 13vw, 4.4rem) !important;
    line-height: 0.93 !important;
  }

  #controls-bar {
    top: 4.45rem !important;
  }

  #controls-inner > div:first-child {
    border-radius: 8px !important;
    gap: 0.28rem !important;
    flex-wrap: nowrap !important;
  }

  #controls-inner > div:first-child > div:first-child {
    flex: 1 1 auto !important;
    width: auto !important;
    min-width: 0 !important;
  }

  #controls-inner > div:first-child > div:last-child {
    width: auto !important;
    display: flex !important;
    flex: 0 0 auto !important;
    gap: 0.12rem !important;
  }

  #controls-inner > div:first-child > div:last-child .brut-icon-btn {
    width: 26px !important;
    min-width: 26px !important;
    min-height: 34px !important;
  }

  .gallery-grid {
    gap: 1rem !important;
  }

  .gallery-item:hover {
    transform: none !important;
  }

  .item-image-container {
    border-radius: 5px !important;
  }

  .item-title {
    font-size: 0.78rem !important;
  }
}

@media (prefers-reduced-motion: reduce) {
  #page-header > div > div::after,
  .gallery-item,
  .gallery-item::before,
  .item-image-container img,
  .item-image-container video,
  .brut-tab,
  .brut-icon-btn,
  .search-container-brut {
    animation: none !important;
    transition-duration: 0.01ms !important;
  }
}

/* Requested refinements: square artwork, flatter controls, larger title. */
#page-header h1 {
  font-size: clamp(3.6rem, 8.1vw, 10.4rem) !important;
}

#work-count-label {
  will-change: contents, opacity, transform;
}

#work-count-label.count-updating {
  animation: count-settle 0.46s cubic-bezier(0.16, 1, 0.3, 1) !important;
}

@keyframes count-settle {
  0% { opacity: 0.68; transform: translateY(0.08em); }
  55% { opacity: 1; transform: translateY(-0.015em); }
  100% { opacity: 1; transform: translateY(0); }
}

#controls-inner > div:first-child {
  box-shadow: none !important;
  border: 0 !important;
}

#controls-inner > div:first-child::before {
  display: none !important;
}

.gallery-item,
.gallery-item::before,
.item-image-container,
.item-image-container.portrait,
.item-image-container.portrait-34,
.item-image-container.landscape,
.item-image-container img,
.item-image-container video {
  border-radius: 0 !important;
}

.item-image-container {
  aspect-ratio: 1 / 1 !important;
}

.item-image-container.portrait {
  aspect-ratio: 4 / 5 !important;
}

.item-image-container.portrait-34 {
  aspect-ratio: 3 / 4 !important;
}

.item-image-container.landscape {
  aspect-ratio: 5 / 4 !important;
}

.gallery-item:hover .item-image-container {
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--page-ink) 14%, transparent) !important;
}

/* Motion polish: smoother page entry, image settling, and hover response. */
@keyframes unique-page-in {
  from {
    opacity: 0;
    transform: translate3d(0, 0.65rem, 0);
  }
  to {
    opacity: 1;
    transform: translate3d(0, 0, 0);
  }
}

@keyframes unique-grid-in {
  from {
    opacity: 0;
    transform: translate3d(0, 0.5rem, 0);
  }
  to {
    opacity: 1;
    transform: translate3d(0, 0, 0);
  }
}

@keyframes grid-fade-up {
  from {
    opacity: 0;
    transform: translate3d(0, 18px, 0) scale(0.992);
  }
  to {
    opacity: 1;
    transform: translate3d(0, 0, 0) scale(1);
  }
}

#page-header h1 {
  animation: unique-page-in 0.38s cubic-bezier(0.16, 1, 0.3, 1) both;
}

#controls-bar {
  animation: unique-page-in 0.34s cubic-bezier(0.16, 1, 0.3, 1) 0.03s both;
}

.gallery-grid {
  animation: unique-grid-in 0.3s cubic-bezier(0.16, 1, 0.3, 1) 0.04s both;
}

.grid-enter {
  animation-duration: 0.38s !important;
  animation-fill-mode: backwards !important;
  animation-timing-function: cubic-bezier(0.16, 1, 0.3, 1) !important;
}

.gallery-item {
  backface-visibility: hidden;
  contain: layout paint;
  transition:
    opacity 0.3s ease,
    transform 0.24s cubic-bezier(0.16, 1, 0.3, 1),
    outline-color 0.18s ease,
    background-color 0.18s ease !important;
  will-change: opacity, transform;
}

html.motion-ready .gallery-item.reveal-up:not(.active) {
  opacity: 0;
  transform: translate3d(0, 12px, 0) !important;
}

html.motion-ready .gallery-item.reveal-up.active {
  opacity: 1;
  transform: translate3d(0, 0, 0);
  transition-delay: var(--reveal-delay, 0ms) !important;
}

html.motion-ready .gallery-item.reveal-up.active:hover {
  transform: translate3d(0, 0, 0) !important;
  transition-delay: 0ms !important;
}

html.motion-ready .gallery-item.reveal-up:not(.active) .item-image-container {
  transform: translate3d(0, 6px, 0);
}

html.motion-ready .gallery-item.reveal-up.active .item-image-container {
  transform: translate3d(0, 0, 0);
  transition-delay: var(--reveal-delay, 0ms) !important;
}

html.motion-ready .gallery-item.reveal-up:not(.active) .item-image-container img,
html.motion-ready .gallery-item.reveal-up:not(.active) .item-image-container video {
  transform: translate3d(0, 8px, 0) scale(1.025);
}

html.motion-ready .gallery-item.reveal-up.active .item-image-container img,
html.motion-ready .gallery-item.reveal-up.active .item-image-container video {
  transform: translate3d(0, 0, 0) scale(1);
  transition-delay: var(--reveal-delay, 0ms) !important;
}

html.motion-ready .gallery-item.reveal-up:not(.active) .item-content {
  opacity: 0;
  transform: translate3d(0, 7px, 0);
}

html.motion-ready .gallery-item.reveal-up.active .item-content {
  opacity: 1;
  transform: translate3d(0, 0, 0);
  transition-delay: calc(var(--reveal-delay, 0ms) + 46ms) !important;
}

.item-overlay,
.gallery-item:hover .item-overlay {
  background: transparent !important;
  opacity: 0 !important;
}

.gallery-item::before {
  display: none !important;
}

.gallery-item:hover {
  transform: translate3d(0, 0, 0) !important;
}

.item-image-container {
  contain: paint;
  transition:
    transform 0.42s cubic-bezier(0.16, 1, 0.3, 1),
    box-shadow 0.24s ease,
    filter 0.2s ease,
    background-color 0.2s ease !important;
}

.item-image-container:not(.img-loaded) {
  animation-duration: 0.8s !important;
}

.item-image-container img,
.item-image-container video {
  opacity: 0;
  filter: none !important;
  transform: translateZ(0) scale(1.018);
  transition:
    opacity 0.3s ease,
    transform 0.24s cubic-bezier(0.16, 1, 0.3, 1) !important;
  will-change: opacity, transform;
}

.item-image-container.img-loaded img,
.item-image-container.img-loaded video {
  opacity: 1;
  transform: translateZ(0) scale(1);
}

.gallery-item:hover .item-image-container img,
.gallery-item:hover .item-image-container video {
  filter: none !important;
  transform: translateZ(0) scale(1.008) !important;
}

.item-title,
.item-type,
.hover-title {
  transition:
    opacity 0.18s ease,
    color 0.18s ease,
    transform 0.24s cubic-bezier(0.16, 1, 0.3, 1) !important;
}

.brut-tab,
.brut-icon-btn,
.modal-action-btn,
.modal-footer-btn,
.modal-nav-btn {
  transition:
    opacity 0.16s ease,
    color 0.16s ease,
    background-color 0.16s ease,
    box-shadow 0.18s ease,
    transform 0.2s cubic-bezier(0.16, 1, 0.3, 1) !important;
}

.brut-tab:active,
.brut-icon-btn:active,
.modal-action-btn:active,
.modal-footer-btn:active,
.modal-nav-btn:active {
  transform: translateY(1px) scale(0.985);
}

html.pastel #controls-bar {
  background: transparent !important;
  border-bottom-color: transparent !important;
}

html.pastel #controls-inner > div:first-child {
  background: var(--page-panel-strong) !important;
  border-color: var(--page-hairline) !important;
  box-shadow: 0 18px 54px color-mix(in srgb, var(--page-ink) 10%, transparent) !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
}

html.pastel .search-container-brut,
html.pastel .item-image-container {
  background: var(--page-panel) !important;
}

html.pastel .gallery-item {
  background: transparent !important;
  box-shadow: none !important;
}

html.pastel .item-content {
  border-top-color: var(--page-hairline) !important;
}

html.pastel .brut-tab:hover,
html.pastel .brut-icon-btn:hover,
html.pastel .category-btn.active,
html.pastel .year-btn.active,
html.pastel .toggle-icon-active,
html.pastel .search-container-brut:focus-within,
html.pastel .mobile-dropdown-option:hover,
html.pastel .mobile-dropdown-option.active {
  background: var(--page-panel-strong) !important;
}

@media (max-width: 640px) {
  #page-header h1 {
    font-size: clamp(2.55rem, 14.2vw, 4.8rem) !important;
  }

  .item-image-container {
    border-radius: 0 !important;
  }
}

@media (prefers-reduced-motion: reduce) {
  #page-header h1,
  #controls-bar,
  .gallery-grid,
  .grid-enter,
  .reveal-up,
  .gallery-item,
  .gallery-item::before,
  .item-image-container,
  .item-image-container img,
  .item-image-container video,
  .item-title,
  .item-type,
  .hover-title,
  .brut-tab,
  .brut-icon-btn,
  .modal-action-btn,
  .modal-footer-btn,
  .modal-nav-btn {
    animation: none !important;
    transition-duration: 0.01ms !important;
  }

  .gallery-item,
  .gallery-item:hover,
  .item-image-container img,
  .item-image-container video,
  .gallery-item:hover .item-image-container img,
  .gallery-item:hover .item-image-container video {
    transform: none !important;
  }
}

/* Navbar motion polish: scroll morph, active rail, dropdown reveal, and theme toggle sweep. */
@keyframes nav-shell-in {
  from {
    transform: translate3d(0, -4px, 0);
  }
  to {
    transform: translate3d(0, 0, 0);
  }
}

@keyframes nav-item-in {
  from {
    transform: translate3d(0, -0.22rem, 0);
  }
  to {
    transform: translate3d(0, 0, 0);
  }
}

#navbar {
  --nav-ease: cubic-bezier(0.16, 1, 0.3, 1);
  --nav-surface: color-mix(in srgb, var(--page-bg) 86%, transparent);
  --nav-surface-strong: color-mix(in srgb, var(--page-bg) 95%, transparent);
  transform: none !important;
  transition: none !important;
}

#navbar.nav-hidden {
  transform: none !important;
}

#navbar > .absolute {
  animation: nav-shell-in 0.38s var(--nav-ease) both;
  background: var(--nav-surface) !important;
  border-bottom: 0 !important;
  box-shadow: none !important;
  transform-origin: top center;
  transition:
    background-color 0.28s var(--nav-ease),
    border-color 0.28s ease,
    box-shadow 0.28s ease,
    backdrop-filter 0.28s ease,
    -webkit-backdrop-filter 0.28s ease !important;
}

#navbar.scrolled > .absolute {
  background: var(--nav-surface-strong) !important;
  border-bottom-color: transparent !important;
  box-shadow: none !important;
}

#navbar-inner {
  position: relative;
  height: 5rem;
  transition:
    height 0.28s var(--nav-ease),
    padding 0.28s var(--nav-ease),
    transform 0.28s var(--nav-ease) !important;
}

#navbar.scrolled #navbar-inner {
  height: 4rem !important;
}

#navbar-inner > a:first-child,
  #navbar-inner > div.hidden[class*="md:flex"] > div.flex > a,
  #navbar-inner > div.hidden[class*="md:flex"] > div.flex > .group > button,
  #navbar-inner > div.hidden[class*="md:flex"] > .w-px,
  #navbar-inner > div.hidden[class*="md:flex"] > button {
  animation: nav-item-in 0.32s var(--nav-ease) both;
}

#navbar-inner > a:first-child {
  animation-delay: 0.08s;
  transform-origin: left center;
  transition:
    opacity 0.34s ease,
    letter-spacing 0.28s var(--nav-ease),
    transform 0.28s var(--nav-ease) !important;
}

#navbar.scrolled #navbar-inner > a:first-child {
  letter-spacing: 0.02em;
  transform: translate3d(0, -1px, 0) scale(0.92);
}

#navbar-inner > div.hidden[class*="md:flex"] > div.flex > .group:first-child > button { animation-delay: 0.08s; }
#navbar-inner > div.hidden[class*="md:flex"] > div.flex > a:nth-of-type(1) { animation-delay: 0.1s; }
#navbar-inner > div.hidden[class*="md:flex"] > div.flex > a:nth-of-type(2) { animation-delay: 0.12s; }
#navbar-inner > div.hidden[class*="md:flex"] > div.flex > .group:last-child > button { animation-delay: 0.14s; }
#navbar-inner > div.hidden[class*="md:flex"] > .w-px { animation-delay: 0.16s; }
#navbar-inner > div.hidden[class*="md:flex"] > button { animation-delay: 0.18s; }

#mobileMenu {
  z-index: 80 !important;
}

#navbar .theme-toggle-enhanced {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  position: relative;
  background-color: transparent !important;
  box-shadow: none !important;
  overflow: hidden;
  transform: translate3d(0, 0, 0);
  transition:
    opacity 0.28s ease,
    transform 0.42s var(--nav-ease) !important;
}

#navbar .theme-toggle-enhanced:hover,
#navbar .theme-toggle-enhanced:focus-visible {
  background-color: transparent !important;
  box-shadow: none !important;
  opacity: 0.78;
  transform: translate3d(0, -1px, 0) !important;
}

html:not(.dark) #navbar .theme-toggle-enhanced {
  background-color: transparent !important;
}

html:not(.dark) #navbar .theme-toggle-enhanced:hover,
html:not(.dark) #navbar .theme-toggle-enhanced:focus-visible {
  background-color: transparent !important;
}

html.dark #navbar .theme-toggle-enhanced {
  background-color: transparent !important;
}

html.dark #navbar .theme-toggle-enhanced:hover,
html.dark #navbar .theme-toggle-enhanced:focus-visible {
  background-color: transparent !important;
}

#navbar .theme-toggle-enhanced:active {
  transform: translate3d(0, 1px, 0) scale(0.96) !important;
}

#navbar .theme-toggle-enhanced svg {
  transition:
    opacity 0.34s ease,
    transform 0.64s var(--nav-ease) !important;
}

#navbar .theme-toggle-enhanced:hover .sun-icon {
  transform: rotate(28deg) scale(1.06) !important;
}

#navbar .theme-toggle-enhanced:hover .moon-icon,
#navbar .theme-toggle-enhanced:hover .palette-icon {
  transform: translate(-50%, -50%) rotate(24deg) scale(1.06) !important;
}

@media (prefers-reduced-motion: reduce) {
  #navbar,
  #navbar *,
  #navbar *::before,
  #navbar *::after {
    animation: none !important;
    transition-duration: 0.01ms !important;
  }

  #navbar-inner,
  #navbar > .absolute,
  #navbar .relative.group > div.absolute > div,
  #navbar .relative.group > div.absolute a,
  #navbar .theme-toggle-enhanced {
    transform: none !important;
    filter: none !important;
    clip-path: none !important;
  }
}

/* Gallery motion detail: expressive cards, but with compact timing. */
.item-image-container img,
.item-image-container video {
  filter: none !important;
}

.gallery-item:hover .item-image-container img,
.gallery-item:hover .item-image-container video {
  filter: saturate(1.01) contrast(1.005) !important;
}

.gallery-item:not(:hover) {
  will-change: auto;
}

.gallery-item:hover {
  will-change: transform;
}

.gallery-item:active {
  transform: translate3d(0, -2px, 0) scale(0.998) !important;
  transition-duration: 0.12s !important;
}

.item-image-container {
  position: relative;
}

.gallery-item::before {
  transform: scale(0.985);
  background:
    radial-gradient(260px circle at var(--card-x) var(--card-y), color-mix(in srgb, var(--page-ink) 20%, transparent), transparent 58%),
    linear-gradient(180deg, color-mix(in srgb, var(--page-ink) 8%, transparent), transparent 48%);
}

.gallery-item:hover::before,
.gallery-item:focus-visible::before {
  opacity: 1;
  transform: scale(1);
}

.gallery-item:hover .item-image-container {
  box-shadow:
    inset 0 0 0 1px color-mix(in srgb, var(--page-ink) 18%, transparent),
    0 20px 44px color-mix(in srgb, #000 28%, transparent) !important;
}

.item-image-container::after {
  content: '';
  position: absolute;
  inset: -12%;
  pointer-events: none;
  opacity: 0;
  background:
    radial-gradient(220px circle at var(--card-x) var(--card-y), color-mix(in srgb, #fff 14%, transparent), transparent 62%),
    linear-gradient(108deg, transparent 0 36%, color-mix(in srgb, #fff 20%, transparent) 47%, transparent 58%),
    linear-gradient(180deg, transparent 58%, color-mix(in srgb, var(--page-bg) 36%, transparent));
  mix-blend-mode: screen;
  transform: translate3d(-1.5%, -1.5%, 0) scale(1.03);
  transition:
    opacity 0.3s ease,
    transform 0.52s cubic-bezier(0.16, 1, 0.3, 1);
}

.gallery-item:hover .item-image-container::after,
.gallery-item:focus-visible .item-image-container::after {
  opacity: 0.58;
  transform: translate3d(0, 0, 0) scale(1);
}

.gallery-item:hover .item-title,
.gallery-item:focus-visible .item-title {
  color: color-mix(in srgb, var(--page-ink) 92%, var(--page-bg) 8%) !important;
  transform: translate3d(0, -4px, 0) !important;
}

.gallery-item:hover .item-type,
.gallery-item:focus-visible .item-type {
  opacity: 0.92;
  transform: translate3d(0, -2px, 0) !important;
}

.brut-tab:hover,
.brut-icon-btn:hover {
  transform: translate3d(0, -1px, 0);
}

/* Keep the desktop filter rail compact until it is intentionally explored. */
@media (min-width: 1280px) {
  #category-expand-wrapper > .category-option-btn,
  #year-expand-wrapper > .year-option-btn {
    flex: 0 0 0 !important;
    width: 0 !important;
    min-width: 0 !important;
    max-width: 0 !important;
    margin: 0 !important;
    padding-left: 0 !important;
    padding-right: 0 !important;
    border: 0 !important;
    opacity: 0 !important;
    visibility: hidden;
    pointer-events: none !important;
    transform: translate3d(-6px, 0, 0) !important;
    transition:
      max-width 0.2s cubic-bezier(0.16, 1, 0.3, 1),
      padding 0.2s cubic-bezier(0.16, 1, 0.3, 1),
      opacity 0.14s ease,
      transform 0.2s cubic-bezier(0.16, 1, 0.3, 1),
      visibility 0s linear 0.2s !important;
  }

  #category-expand-wrapper:hover > .category-option-btn,
  #category-expand-wrapper:has(> :focus-visible) > .category-option-btn,
  #year-expand-wrapper:hover > .year-option-btn,
  #year-expand-wrapper:has(> :focus-visible) > .year-option-btn {
    flex: 0 0 auto !important;
    width: auto !important;
    min-width: max-content !important;
    max-width: 9rem !important;
    padding-left: 0.85rem !important;
    padding-right: 0.85rem !important;
    opacity: 1 !important;
    visibility: visible;
    pointer-events: auto !important;
    transform: translate3d(0, 0, 0) !important;
    transition-delay: 0s !important;
  }
}

/* =====================================================
   Grid loading treatment + scroll cost
   Final cascade point: earlier passes in this file layer several !important
   `.item-image-container` backgrounds on top of each other, and the winner in
   light mode (`html:not(.dark) .item-image-container`) is a flat fill — so the
   shimmer animation ran against a solid colour and the cells read as empty
   boxes. These rules restate the loading surface once, in theme tokens, at a
   specificity that beats every earlier override in all four themes.
   `.img-loaded` is added by the page script on the media's load/error event.
   ===================================================== */
@keyframes unique-media-shimmer {
  from { background-position: 150% 0; }
  to   { background-position: -50% 0; }
}

html body .item-image-container:not(.img-loaded) {
  background-color: var(--theme-surface) !important;
  background-image: linear-gradient(
    90deg,
    transparent 0%,
    color-mix(in srgb, var(--theme-ink) 9%, transparent) 50%,
    transparent 100%
  ) !important;
  background-size: 60% 100% !important;
  background-repeat: no-repeat !important;
  animation: unique-media-shimmer 1.6s linear infinite !important;
}

html body .item-image-container.img-loaded {
  background-image: none !important;
  animation: none !important;
}

@media (prefers-reduced-motion: reduce) {
  html body .item-image-container:not(.img-loaded) {
    background-image: none !important;
    animation: none !important;
  }
}

/* Cells are a known aspect box, so the browser can skip rendering the ones
   that are off screen and still size the scrollbar correctly. `auto` lets it
   remember each cell's real size once it has been rendered, which keeps the
   scroll position stable on a 600+ tile grid. */
.gallery-item {
  content-visibility: auto;
  contain-intrinsic-size: auto 350px;
}

/* ========================================================================
   Sol Medium UI refresh — final Unique Works controls/modal overrides
   Preserve the sticky shell, flexible search, 40px controls, and existing
   gallery/modal interaction hooks; refine only the material and feedback.
   ======================================================================== */
#controls-inner > div:first-child {
  border: 1px solid var(--page-hairline) !important;
  border-radius: 0.6875rem !important;
  background: color-mix(in srgb, var(--page-bg) 86%, var(--page-panel) 14%) !important;
  box-shadow: 0 12px 30px color-mix(in srgb, var(--page-ink) 8%, transparent) !important;
}

.brut-tab,
.brut-icon-btn {
  border: 1px solid transparent !important;
  border-radius: 0.5rem !important;
  background: var(--page-panel) !important;
  transition:
    color 140ms ease,
    background-color 140ms ease,
    border-color 140ms ease,
    box-shadow 140ms ease,
    transform 140ms var(--ease-out-expo) !important;
}

.brut-tab:hover,
.brut-icon-btn:hover,
.category-btn.active,
.year-btn.active,
.toggle-icon-active {
  border-color: color-mix(in srgb, var(--page-ink) 14%, var(--page-hairline)) !important;
  background: var(--page-panel-strong) !important;
  color: var(--page-ink) !important;
}

.search-container-brut {
  min-height: 40px;
  border: 1px solid color-mix(in srgb, var(--page-ink) 6%, transparent) !important;
  border-radius: 0.5rem !important;
  background: var(--page-panel) !important;
  transition:
    background-color 140ms ease,
    border-color 140ms ease,
    box-shadow 140ms ease,
    transform 140ms var(--ease-out-expo) !important;
}

.search-container-brut:focus-within {
  border-color: color-mix(in srgb, var(--page-ink) 16%, var(--page-hairline)) !important;
  background: var(--page-panel-strong) !important;
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--page-ink) 14%, transparent) !important;
  transform: none !important;
}

html body .modal-overlay {
  background: var(--theme-scrim, color-mix(in srgb, var(--page-bg) 78%, transparent)) !important;
  backdrop-filter: blur(18px) saturate(112%) !important;
  -webkit-backdrop-filter: blur(18px) saturate(112%) !important;
}

html body .modal-content {
  border-color: var(--theme-modal-hairline, var(--page-hairline)) !important;
  background: var(--theme-modal-bg, var(--page-bg)) !important;
  box-shadow: var(--theme-modal-shadow, var(--page-shadow)) !important;
}

@media (min-width: 768px) {
  html body .modal-content {
    border-radius: 0.6875rem !important;
  }
}

@media (max-width: 767px) {
  html body .modal-content {
    border-radius: 0.75rem 0.75rem 0 0 !important;
  }

  #controls-inner > div:first-child {
    display: grid !important;
    grid-template-columns: auto auto 1fr;
    grid-template-rows: auto auto;
    align-items: stretch;
  }

  #controls-inner > div:first-child > div:first-child {
    display: contents !important;
  }

  #category-filter-wrapper {
    grid-column: 1;
    grid-row: 1;
  }

  #year-filter-wrapper {
    grid-column: 2;
    grid-row: 1;
  }

  #controls-search {
    grid-column: 1 / -1;
    grid-row: 2;
    min-width: 0;
    width: 100%;
    padding: 0.5rem 0.75rem 0.75rem;
  }

  #controls-search .search-container-brut {
    min-width: 0;
    width: 100%;
  }

  #controls-inner > div:first-child > div:last-child {
    grid-column: 3;
    grid-row: 1;
    justify-self: end;
  }
}

.modal-action-btn,
.modal-footer-btn,
.modal-nav-btn {
  border-radius: 0.5rem !important;
  transition:
    color 140ms ease,
    background-color 140ms ease,
    border-color 140ms ease,
    box-shadow 140ms ease,
    transform 140ms var(--ease-out-expo) !important;
}

.modal-action-btn:focus-visible,
.modal-footer-btn:focus-visible,
.modal-nav-btn:focus-visible,
.brut-tab:focus-visible,
.brut-icon-btn:focus-visible,
.search-container-brut:focus-within {
  outline: 1px solid var(--page-ink) !important;
  outline-offset: 3px !important;
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--page-ink) 10%, transparent) !important;
}

#inquiry-modal {
  border-radius: 0.6875rem !important;
  background: var(--theme-modal-bg, var(--page-bg)) !important;
  border-color: var(--theme-modal-hairline, var(--page-hairline)) !important;
  box-shadow: var(--theme-modal-shadow, var(--page-shadow)) !important;
}

#inquiry-submit {
  border-radius: 0.5rem !important;
  border-color: var(--page-ink) !important;
  background: var(--page-ink) !important;
  color: var(--page-bg) !important;
  transition: background-color 140ms ease, border-color 140ms ease, transform 140ms var(--ease-out-expo) !important;
}

#inquiry-submit:hover {
  border-color: color-mix(in srgb, var(--page-ink) 86%, var(--page-bg)) !important;
  background: color-mix(in srgb, var(--page-ink) 86%, var(--page-bg)) !important;
}

@media (prefers-reduced-motion: reduce) {
  #controls-inner > div:first-child,
  .brut-tab,
  .brut-icon-btn,
  .search-container-brut,
  html body .modal-content,
  .modal-action-btn,
  .modal-footer-btn,
  .modal-nav-btn,
  #inquiry-submit {
    transition: none !important;
  }
}

/* Keep artwork static on hover; retain the gallery's title and control feedback. */
.gallery-item:hover .item-image-container img,
.gallery-item:hover .item-image-container video {
  filter: none !important;
  transform: translateZ(0) scale(1) !important;
}

.gallery-item:hover .item-image-container {
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--page-ink) 6%, transparent) !important;
}

.gallery-item:hover {
  outline-color: transparent !important;
}

.gallery-item:hover::before,
.gallery-item:focus-visible::before,
.item-image-container::after,
.gallery-item:hover .item-image-container::after,
.gallery-item:focus-visible .item-image-container::after {
  display: none !important;
  opacity: 0 !important;
  background: none !important;
  box-shadow: none !important;
  transform: none !important;
  mix-blend-mode: normal !important;
}

.list-view-header:hover .list-view-header-thumb,
.list-view-header:focus-visible .list-view-header-thumb {
  transform: none !important;
  box-shadow: none !important;
}

/* ========================================================================
   Paper specimen modal — final border-led surface
   The existing modal markup, data attributes, keyboard navigation, drag
   gesture, thumbnails, and action links remain unchanged. This last block
   translates the approved Paper direction into the live theme tokens.
   ======================================================================== */
:root {
  --pastelle-modal-paper: var(--page-bg, #ECEBDD);
  --pastelle-modal-panel: var(--page-panel-strong, rgba(255, 255, 255, 0.68));
  --pastelle-modal-ink: var(--page-ink, #000000);
  --pastelle-modal-muted: var(--page-muted, rgba(0, 0, 0, 0.62));
  --pastelle-modal-rule: var(--page-hairline, rgba(0, 0, 0, 0.12));
  --pastelle-modal-accent: var(--page-ink, #000000);
  --pastelle-modal-frame: color-mix(in srgb, var(--page-bg, #ECEBDD) 78%, var(--page-ink, #000000));
}

html body .modal-overlay.active {
  background: color-mix(in srgb, var(--page-bg) 42%, transparent) !important;
  backdrop-filter: blur(18px) saturate(110%) !important;
  -webkit-backdrop-filter: blur(18px) saturate(110%) !important;
}

html body .modal-content {
  box-sizing: border-box !important;
  padding: 10px !important;
  border: 1px solid var(--pastelle-modal-rule) !important;
  border-radius: 14px !important;
  background: var(--pastelle-modal-frame) !important;
  box-shadow: 0 28px 80px color-mix(in srgb, var(--pastelle-modal-ink) 16%, transparent) !important;
}

html body #modal-body {
  box-sizing: border-box !important;
  border: 1px solid var(--pastelle-modal-rule) !important;
  border-radius: 9px !important;
  background: var(--pastelle-modal-paper) !important;
  color: var(--pastelle-modal-ink) !important;
}

html body .modal-panel {
  gap: 22px !important;
}

html body .modal-main-image {
  box-sizing: border-box !important;
  aspect-ratio: var(--modal-media-ratio, 1 / 1) !important;
  padding: 0 !important;
  border: 0 !important;
  border-radius: 0 !important;
  background: transparent !important;
  box-shadow:
    0 3px 8px rgba(0, 0, 0, 0.12),
    0 14px 28px rgba(0, 0, 0, 0.2) !important;
}

html body .modal-main-image.portrait,
html body .modal-main-image.portrait-34,
html body .modal-main-image.landscape {
  aspect-ratio: var(--modal-media-ratio, 1 / 1) !important;
}

html body .modal-main-image > .modal-image {
  box-shadow: none !important;
}

html body .modal-info {
  gap: 20px !important;
}

html body .modal-header {
  gap: 10px !important;
  padding-bottom: 18px !important;
  border-bottom-color: var(--pastelle-modal-rule) !important;
}

html body .modal-title {
  margin-bottom: 0 !important;
  color: var(--pastelle-modal-ink) !important;
  font-family: 'Manrope', sans-serif !important;
  font-size: clamp(1.65rem, 2.4vw, 2.35rem) !important;
  font-weight: 600 !important;
  letter-spacing: -0.02em !important;
  line-height: 1.08 !important;
}

html body .modal-subtitle {
  margin-top: 0 !important;
  color: var(--pastelle-modal-muted) !important;
  font-family: 'Manrope', sans-serif !important;
  font-size: 12px !important;
  font-weight: 500 !important;
  letter-spacing: 0.08em !important;
  line-height: 17px !important;
  opacity: 1 !important;
  text-transform: none !important;
}

html body .modal-action-bar {
  gap: 8px !important;
  background: transparent !important;
  background-image: none !important;
  box-shadow: none !important;
  filter: none !important;
}

html body .modal-action-bar::before,
html body .modal-action-bar::after {
  background: none !important;
  box-shadow: none !important;
  filter: none !important;
}

html body .modal-action-bar .modal-action-btn,
html body .modal-action-bar .modal-action-btn:hover,
html body .modal-action-bar .modal-action-btn:focus-visible {
  box-shadow: none !important;
}

/* The gallery filter tray sits behind the selected controls; keep it flat so
   the control row does not cast a halo across the artwork grid. */
html body #controls-inner > div:first-child {
  box-shadow: none !important;
}

html body #controls-inner > div:first-child::before {
  display: none !important;
  opacity: 0 !important;
}

html body .modal-action-btn,
html body .modal-footer-btn {
  box-sizing: border-box !important;
  min-height: 36px !important;
  padding: 10px 14px !important;
  border: 1px solid var(--pastelle-modal-rule) !important;
  border-radius: 999px !important;
  background: transparent !important;
  color: var(--pastelle-modal-ink) !important;
  font-family: 'Manrope', sans-serif !important;
  font-size: 12px !important;
  font-weight: 500 !important;
  letter-spacing: 0 !important;
  line-height: 16px !important;
  text-transform: none !important;
  box-shadow: none !important;
}

html body .modal-action-btn:hover,
html body .modal-footer-btn:hover {
  border-color: var(--pastelle-modal-ink) !important;
  background: color-mix(in srgb, var(--pastelle-modal-ink) 5%, transparent) !important;
  color: var(--pastelle-modal-ink) !important;
  transform: translateY(-1px) !important;
}

html body .modal-action-btn.inquiry-btn {
  border-color: var(--pastelle-modal-accent) !important;
  background: var(--pastelle-modal-accent) !important;
  color: var(--pastelle-modal-paper) !important;
  -webkit-text-fill-color: var(--pastelle-modal-paper) !important;
  font-weight: 600 !important;
}

html body .modal-action-btn.inquiry-btn:hover {
  border-color: color-mix(in srgb, var(--pastelle-modal-accent) 86%, var(--pastelle-modal-paper)) !important;
  background: color-mix(in srgb, var(--pastelle-modal-accent) 86%, var(--pastelle-modal-paper)) !important;
  color: var(--pastelle-modal-paper) !important;
  -webkit-text-fill-color: var(--pastelle-modal-paper) !important;
}

html:not(.dark):not(.navy) body .modal-action-bar .modal-action-btn.inquiry-btn {
  border-color: var(--pastelle-modal-accent) !important;
  background: var(--pastelle-modal-accent) !important;
  color: var(--pastelle-modal-paper) !important;
  -webkit-text-fill-color: var(--pastelle-modal-paper) !important;
}

html:not(.dark):not(.navy) body .modal-action-bar .modal-action-btn.inquiry-btn:hover {
  border-color: color-mix(in srgb, var(--pastelle-modal-accent) 86%, var(--pastelle-modal-paper)) !important;
  background: color-mix(in srgb, var(--pastelle-modal-accent) 86%, var(--pastelle-modal-paper)) !important;
  color: var(--pastelle-modal-paper) !important;
  -webkit-text-fill-color: var(--pastelle-modal-paper) !important;
}

html body .modal-thumbnails {
  gap: 10px !important;
}

html body .modal-thumbnail-wrapper {
  border: 1px solid var(--pastelle-modal-rule) !important;
  border-radius: 0 !important;
  background: var(--pastelle-modal-panel) !important;
  box-shadow:
    0 1px 3px rgba(0, 0, 0, 0.1),
    0 6px 12px rgba(0, 0, 0, 0.08) !important;
}

html body .modal-thumbnail-wrapper:has(.modal-thumbnail.active) {
  border: 2px solid var(--pastelle-modal-accent) !important;
  box-shadow:
    0 2px 4px rgba(0, 0, 0, 0.14),
    0 8px 16px rgba(0, 0, 0, 0.12) !important;
}

html body .modal-thumbnail-wrapper:hover {
  border-color: var(--pastelle-modal-ink) !important;
  background: var(--pastelle-modal-panel) !important;
  transform: translateY(-1px) !important;
}

html body .modal-thumbnail-wrapper:has(.modal-thumbnail.active)::after {
  display: none !important;
}

html body .modal-footer-nav {
  padding-top: 16px !important;
  border-top-color: var(--pastelle-modal-rule) !important;
  background: transparent !important;
  color: var(--pastelle-modal-ink) !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
}

html body .modal-footer-btn {
  min-height: 34px !important;
  padding: 9px 14px !important;
}

html body .modal-content > button.absolute {
  box-sizing: border-box !important;
  width: 36px !important;
  height: 36px !important;
  border: 1px solid var(--pastelle-modal-rule) !important;
  border-radius: 50% !important;
  background: var(--pastelle-modal-paper) !important;
  color: var(--pastelle-modal-muted) !important;
}

html body .modal-content > button.absolute:hover {
  border-color: var(--pastelle-modal-ink) !important;
  background: var(--pastelle-modal-paper) !important;
  color: var(--pastelle-modal-ink) !important;
}

@media (min-width: 768px) {
  html body .modal-content {
    width: min(1540px, calc(100vw - 2rem)) !important;
    height: min(900px, calc(100dvh - 2rem)) !important;
    max-width: calc(100vw - 2rem) !important;
    max-height: calc(100dvh - 2rem) !important;
  }

  html body #modal-body {
    padding: clamp(22px, 2.2vw, 40px) !important;
  }

  html body .modal-main-image {
    min-height: 0 !important;
  }
}

@media (min-width: 1025px) {
  html body .modal-main-image,
  html body .modal-main-image.portrait,
  html body .modal-main-image.portrait-34,
  html body .modal-main-image.landscape {
    aspect-ratio: var(--modal-media-ratio, 1 / 1) !important;
    width: auto !important;
    height: auto !important;
    max-height: 100% !important;
    max-width: 100% !important;
    justify-self: center !important;
    align-self: flex-start !important;
  }
}

@media (max-width: 767px) {
  html body .modal-overlay.active {
    align-items: flex-end !important;
    padding: 0 !important;
  }

  html body .modal-content {
    width: calc(100vw - 28px) !important;
    height: calc(100dvh - 28px) !important;
    max-width: none !important;
    max-height: calc(100dvh - 28px) !important;
    margin: 0 14px 14px !important;
    border-radius: 18px !important;
    padding: 7px !important;
  }

  html body .modal-drag-handle {
    box-sizing: border-box !important;
    display: flex !important;
    justify-content: center !important;
    flex-shrink: 0 !important;
    padding: 12px 0 7px !important;
    border: 1px solid var(--pastelle-modal-rule) !important;
    border-bottom: 0 !important;
    border-radius: 12px 12px 0 0 !important;
    background: var(--pastelle-modal-paper) !important;
  }

  html body .modal-drag-handle::after {
    width: 34px !important;
    height: 3px !important;
    border-radius: 999px !important;
    background: var(--pastelle-modal-muted) !important;
  }

  html body #modal-body {
    border-top: 0 !important;
    border-radius: 0 0 10px 10px !important;
    padding: 0 !important;
    background: var(--pastelle-modal-paper) !important;
  }

  html body .modal-panel {
    gap: 12px !important;
    padding: 0 13px 12px !important;
  }

  html body .modal-main-image {
    height: auto !important;
    max-height: none !important;
    min-height: 0 !important;
    padding: 0 !important;
    border-radius: 0 !important;
  }

  html body .modal-info {
    gap: 12px !important;
  }

  html body .modal-header {
    gap: 6px !important;
    padding-bottom: 10px !important;
  }

  html body .modal-title {
    font-size: 28px !important;
    line-height: 31px !important;
  }

  html body .modal-subtitle {
    font-size: 11px !important;
    line-height: 15px !important;
    letter-spacing: 0.06em !important;
  }

  html body .modal-action-bar {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 7px !important;
  }

  html body .modal-action-btn {
    width: 100% !important;
    min-height: 34px !important;
    padding: 9px 10px !important;
    font-size: 11px !important;
    line-height: 14px !important;
  }

  html body .modal-thumbnails {
    height: 60px !important;
    min-height: 60px !important;
    gap: 7px !important;
    align-items: center !important;
    padding: 0 !important;
  }

  html body .modal-thumbnail-wrapper {
    width: 56px !important;
    height: 56px !important;
    min-width: 56px !important;
    border-radius: 0 !important;
  }

  html body .modal-footer-fixed {
    flex-shrink: 0 !important;
    border-top: 0 !important;
    background: var(--pastelle-modal-paper) !important;
  }

  html body .modal-footer-nav {
    padding: 10px 13px max(10px, env(safe-area-inset-bottom)) !important;
    border-top: 1px solid var(--pastelle-modal-rule) !important;
  }

  html body .modal-footer-btn {
    min-height: 34px !important;
    padding: 9px 14px !important;
    font-size: 11px !important;
    line-height: 15px !important;
  }

  html body .modal-content > button.absolute {
    top: 2.1rem !important;
    right: 1rem !important;
    width: 32px !important;
    height: 32px !important;
    min-width: 32px !important;
    min-height: 32px !important;
  }
}

@media (min-width: 768px) and (max-width: 1024px) {
  /* Keep the scrollable work details and footer navigation in separate zones.
     At short tablet heights, display: contents on the footer lets Previous /
     Next sit on top of the action row. */
  html body #modal-body {
    display: flex !important;
    flex-direction: column !important;
    gap: 0 !important;
    overflow: hidden !important;
  }

  html body .modal-panel {
    flex: 1 1 auto !important;
    min-height: 0 !important;
    height: auto !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch !important;
    padding: 0 !important;
  }

  html body .modal-info {
    flex: 0 0 auto !important;
    height: auto !important;
    min-height: 0 !important;
    overflow: visible !important;
  }

  html body .modal-main-image {
    flex: 0 0 auto !important;
  }

  html body .modal-footer-fixed {
    flex: 0 0 auto !important;
    display: block !important;
    border-top: 1px solid var(--pastelle-modal-rule) !important;
    background: var(--pastelle-modal-paper) !important;
  }

  html body .modal-footer-nav {
    position: static !important;
    display: flex !important;
    justify-content: space-between !important;
    gap: 12px !important;
    padding: 12px 0 0 !important;
    border-top: 0 !important;
  }

  html body .modal-footer-btn {
    flex: 0 0 auto !important;
  }

  html body .modal-main-image {
    height: auto !important;
    max-height: min(calc(100dvh - 180px), 34dvh) !important;
    align-self: flex-start !important;
  }
}

@media (prefers-reduced-motion: reduce) {
  html body .modal-content,
  html body .modal-main-image,
  html body .modal-info,
  html body .modal-title,
  html body .modal-thumbnails,
  html body .modal-footer-nav,
  html body .modal-action-btn,
  html body .modal-footer-btn {
    transition: none !important;
    animation: none !important;
  }
}
