:root {
  --padding: 3rem;
  --gap: 1rem;
  --grand-gap: 2rem;
}

body {
  box-sizing: border-box;
  min-height: 100vh;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  background-color: var(--md-sys-color-surface, #fff);
  color: var(--md-sys-color-on-surface, #000);
  font-family: "Noto Sans", sans-serif;
  font-weight: 400;
  font-style: normal;
  font-variation-settings: "wdth" 100;
}

main {
  flex: 1;
}

a {
  color: inherit;
}

[hidden],
.hidden {
  display: none !important;
}

button {
  cursor: pointer;
  width: fit-content;
  border: none;
  background: transparent;
  color: inherit;
}

.material-symbols-outlined {
  font-family: "Material Symbols Outlined";
  font-variation-settings: "FILL" 0, "wght" 400, "GRAD" 0, "opsz" 1.5rem;
  display: inline-block;
  line-height: 1;
  vertical-align: middle;
  font-size: 1.5rem;
  color: inherit;
}
#open-menu,
#gallery-top {
  margin: 1rem auto;
  display: flex;
  align-items: center;
  position: sticky;
  top: 0;
  max-width: 100%;
  align-self: center;
  z-index: 5;
  overflow: hidden;
  gap: 1rem;
}

#filter-bar {
  display: flex;
  background: var(--md-sys-color-primary);
  padding: 0;
  border-radius: 100rem;
  width: auto;
  max-width: calc(100% - 1rem - var(--sort-button-width, 48px));
}

#filters {
  display: flex;
  gap: 0.25rem;
  overflow-x: auto;
  flex: 1 1 auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
  border-radius: 100rem;
}

#filters::-webkit-scrollbar {
  display: none;
}

#filter-nav:hover,
#sort-button:hover {
  background: var(--md-sys-color-primary-container);
  color: var(--md-sys-color-on-primary-container);
}

#filter-nav,
#sort-button {
  box-sizing: border-box;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--md-sys-color-primary);
  color: var(--md-sys-color-on-primary);
  border-radius: 100rem;
  padding: 0.5rem;
  transition: 0.2s ease;
  height: calc(100% - 0.5rem);
}

#sort-button {
  white-space: nowrap;
}

.sort-button-label {
  margin-left: 0.35rem;
}

@media (max-width: 40rem) {
  .sort-button-label {
    display: none;
  }
}

.filter {
  box-sizing: border-box;
  border-radius: 100rem;
  font-size: 1rem;
  padding: 0.5rem 0.75rem;
  white-space: nowrap;
  transition: 0.3s;
  height: 100%;
}

.filter[aria-selected="true"] {
  background: var(--md-sys-color-primary-container);
  color: var(--md-sys-color-on-primary-container);
}

.filter[aria-selected="false"] {
  background: var(--md-sys-color-on-primary-container);
  color: var(--md-sys-color-primary-container);
}

#gallery-main {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 2rem var(--padding, 3rem) 4rem;
  gap: 1rem;
}

#gallery-images-container {
  max-width: 1200px;
  width: 100%;
  margin: 0 auto;
}

.grid-sizer,
.gallery-item {
  width: calc((100% - 20px) / 3);
}

@media (max-width: 1024px) {
  .grid-sizer,
  .gallery-item {
    width: calc((100% - 10px) / 2);
  }
}

@media (max-width: 600px) {
  .grid-sizer,
  .gallery-item {
    width: 100%;
  }
}

.gallery-item {
  margin-bottom: 10px;
}

.gallery-placeholder {
  width: 100%;
  background: #ccc;
  border-radius: 8px;
}

.gallery-image {
  width: 100%;
  height: auto;
  border-radius: 8px;
  display: block;
  opacity: 0;
  transition: opacity 0.3s ease;
  cursor: pointer;
}

.lightbox {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: var(--md-sys-color-surface);
  flex-direction: column;
}

.lightbox.is-open {
  display: flex;
}

body.lightbox-open {
  overflow: hidden;
}

#lightbox-header {
  flex: 0 0 auto;
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  padding: 1rem 1.5rem 0;
  position: relative;
  z-index: 3;
}

#lightbox-toggle-panel.is-active {
  font-variation-settings: "FILL" 1, "wght" 800, "GRAD" 0, "opsz" 0;
  border-radius: 999px;
}

#lightbox-body {
  flex: 1 1 auto;
  min-height: 0;
  min-width: 0;
  display: flex;
  gap: 1rem;
  padding: 1rem 1.5rem 1.5rem;
  box-sizing: border-box;
}

#lightbox-stage {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  position: relative;
}

#lightbox-image {
  max-width: 100%;
  max-height: 100%;
  display: block;
  object-fit: contain;
}

#lightbox-caption {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 4rem 1.5rem 1.25rem;
  background: linear-gradient(to top, var(--md-sys-color-surface), transparent);
  color: var(--md-sys-color-on-surface);
  pointer-events: none;
}

#lightbox-caption-title {
  margin: 0;
  font-size: 1.6rem;
  font-weight: 600;
  line-height: 1.2;
  text-align: center;
}

#lightbox-panel {
  flex: 0 0 clamp(18rem, 28vw, 26rem);
  max-width: clamp(18rem, 28vw, 26rem);
  background: var(--md-sys-color-primary);
  color: var(--md-sys-color-on-primary);
  border-radius: 1.25rem 0 0 1.25rem;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  overflow-y: auto;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.08);
  box-sizing: border-box;
}

#lightbox-panel-handle {
  display: none;
}

#lightbox-img-title {
  margin: 0;
  color: inherit;
  font-size: 1.5rem;
  font-weight: 600;
  line-height: 1.2;
}

#lightbox-img-details {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.lightbox-lead {
  margin: 0;
  font-size: 1.05rem;
  line-height: 1.45;
  opacity: 0.98;
}

.lightbox-fact-row {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.85rem 1rem;
  border-radius: 1rem;
  background: var(--md-sys-color-primary-container);
  color: var(--md-sys-color-on-primary-container);
}

.lightbox-fact-row .material-symbols-outlined {
  margin-top: 0.05rem;
  flex: 0 0 auto;
}

.lightbox-fact-content {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.lightbox-fact-label {
  font-size: 0.82rem;
  opacity: 0.75;
}

.lightbox-fact-value {
  font-size: 1rem;
  line-height: 1.35;
}

.lightbox-price {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 1rem;
  border-radius: 1rem;
  background: var(--md-sys-color-on-primary);
  color: var(--md-sys-color-primary);
  font-size: 1.35rem;
  font-weight: 700;
}

.lightbox-price .material-symbols-outlined {
  font-size: 1.8rem;
}

.lightbox-contact {
  gap: 0.75rem;
  padding: 0 1rem;
  border-radius: 1rem;
  width: 100%;
  font-weight: 400;
  text-decoration: none;
}

.lightbox-contact .material-symbols-outlined {
  font-size: 1.3rem;
}

.lightbox-chip-section {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.lightbox-chip-title {
  font-size: 0.82rem;
  opacity: 0.8;
}

.lightbox-chip-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.lightbox-chip {
  display: inline-flex;
  align-items: center;
  padding: 0.35rem 0.65rem;
  border-radius: 999px;
  background: var(--md-sys-color-primary-container);
  color: var(--md-sys-color-on-primary-container);
  font-size: 0.9rem;
}

.lightbox-empty {
  opacity: 0.9;
  font-style: italic;
}

.lightbox-actions {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-top: auto;
}

.lightbox-actions button {
  display: flex;
  align-items: center;
  gap: 1rem;
  color: inherit;
  background: transparent;
  width: fit-content;
}

.lightbox-option-label {
  font-size: 1rem;
  font-weight: 400;
  color: inherit;
}

@media (max-width: 50rem) {
  #lightbox-body {
    flex-direction: column;
    overflow-y: auto;
    padding: 1rem 0.5rem 0;
  }

  #lightbox-panel {
    width: 100%;
    max-width: 100%;
    max-height: none;
    min-height: 50%;
    border-radius: 2rem 2rem 0 0;
    padding-top: 0.25rem;
  }

  #lightbox-panel-handle {
    display: block;
    width: 8rem;
    max-width: 50%;
    min-height: 0.3rem;
    border-radius: 999px;
    background: var(--md-sys-color-on-primary);
    margin: 0 auto 0.75rem;
  }

  .lightbox-option-label {
    display: none;
  }

  #lightbox-image {
    max-height: 55vh;
  }
}