/* ─── Galleri (Masonry) ─── */
#gallery {
  columns: 4;
  column-gap: 15px;
  padding: 20px;
  width: 100%;
  /* Frame style variables */
  --frame-gradient: repeating-linear-gradient(
    90deg,
    #D4B896 0px,
    #E5C9A8 1px,
    #C5A885 2px,
    #DFC4A2 3px,
    #D4B896 4px,
    #E5C9A8 5px,
    #D4B896 6px,
    #DCBF99 7px,
    #D4B896 8px,
    #C5A885 9px,
    #DFC4A2 10px
  );
  --frame-top: #B59970;
  --frame-right: #D4B896;
  --frame-bottom: #C5A885;
  --frame-left: #B89A78;
  --frame-inset-shadow: inset 0 0 10px rgba(0, 0, 0, 0.2), inset 1px 1px 0 rgba(255, 255, 255, 0.2);
  --frame-outer-shadow: 0 3px 10px rgba(181, 153, 112, 0.3);
}

@media (max-width: 1100px) {
  #gallery {
    columns: 3;
  }
}

@media (max-width: 720px) {
  #gallery {
    columns: 2;
  }
}

@media (max-width: 480px) {
  #gallery {
    columns: 2;
  }
}

.gallery-item {
  position: relative;
  overflow: hidden;
  width: 100%;
  margin-bottom: 15px;
  break-inside: avoid;
}

.gallery-item::after {
  content: " ";
  position: absolute;
  bottom: 10px;
  right: 10px;
  color: var(--bg-warm);
  font-size: 0.8rem;
  font-family: 'Quicksand', sans-serif;
  pointer-events: none;
  text-shadow: 0 1px 3px var(--shadow-dark);
}

.gallery-item img {
  width: 100%;
  height: auto;
  display: block;
  cursor: pointer;
  padding: 3px;
  background: var(--frame-gradient);
  border: 5px solid;
  border-color: var(--frame-top) var(--frame-right) var(--frame-bottom) var(--frame-left);
  border-radius: 2px;
  box-shadow:
    var(--frame-inset-shadow),
    var(--frame-outer-shadow);
  transition: transform 0.2s ease;
}

.gallery-item img:hover {
  transform: scale(1.1);
}

.gallery-item--circle {
  aspect-ratio: 1 / 1;
}

.gallery-item--circle img {
  border-radius: 50%;
}

.gallery-item-info {
  position: absolute;
  bottom: 8px;
  left: 8px;
  right: 8px;
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  pointer-events: none;
  gap: 6px;
}

.gallery-item-size,
.gallery-item-price {
  background: rgba(44, 36, 22, 0.72);
  color: #fff;
  font-size: 0.75rem;
  font-family: 'Quicksand', sans-serif;
  font-weight: 600;
  letter-spacing: 0.04em;
  padding: 3px 8px;
  border-radius: 20px;
  backdrop-filter: blur(2px);
  white-space: nowrap;
  min-width: 0;
}

@media (max-width: 960px) {
  .gallery-item-size,
  .gallery-item-price {
    font-size: 0.62rem;
    padding: 2px 6px;
    letter-spacing: 0.02em;
  }
}

.sold-badge {
  position: absolute;
  top: 18px;
  right: -45px;
  background: var(--accent-green);
  color: var(--text-light);
  padding: 8px 60px;
  font-size: 0.75rem;
  letter-spacing: 2px;
  text-transform: uppercase;
  font-weight: 600;
  transform: rotate(45deg);
  text-align: center;
  box-shadow: 0 4px 10px var(--shadow-dark);
  pointer-events: none;
}

/* ─── Filter knappar ─── */
.gallery-filters {
  display: flex;
  gap: 10px;
  justify-content: center;
  margin: 40px 0 30px 0;
  flex-wrap: wrap;
  padding: 0 20px;
}

/* ─── Sticky filter bar (desktop) ─── */
#gallery-filter-bar {
  display: none; /* visas bara på desktop via media query */
  flex-wrap: nowrap;
  gap: 10px;
  justify-content: center;
  padding: 10px 20px;
  background: var(--bg-light);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  transition: transform 0.3s ease, opacity 0.2s ease;
  border-bottom: 1px solid var(--accent-green);
}

@media (min-width: 961px) {
  #gallery-filter-bar {
    display: flex;
    position: sticky;
    top: 0;
    z-index: 100;
    gap: clamp(20px, 4.5vw, 70px);
  }
}

.filter-dropdown {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.filter-reset-btn {
  display: none;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: none;
  background: #5a8a6a;
  color: white;
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
  transition: background 0.15s;
  flex-shrink: 0;
}

.filter-reset-btn:hover {
  background: #3d6b52;
}

.filter-dropdown.has-filter .filter-reset-btn {
  display: flex;
}

.filter-dropdown-trigger {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 7px 14px;
  border: 1px solid var(--accent-light);
  border-radius: 3px;
  background: var(--bg-warm);
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
}

.filter-dropdown-trigger:hover,
.filter-dropdown.open .filter-dropdown-trigger {
  border-color: var(--accent-green);
}

.filter-dropdown.has-filter .filter-dropdown-trigger {
  background: var(--accent-green);
  border-color: var(--accent-green);
}

.filter-dropdown.has-filter .filter-dropdown-label {
  color: var(--text-light);
}

.filter-dropdown.has-filter .filter-chevron {
  fill: var(--text-light);
}

.filter-dropdown-label {
  font-family: 'Playfair Display', serif;
  font-style: italic;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-dark);
  white-space: nowrap;
}

.filter-chevron {
  width: 9px;
  height: 6px;
  fill: var(--accent-green);
  flex-shrink: 0;
  transition: transform 0.2s ease;
}

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

.filter-dropdown-panel {
  display: none;
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  background: var(--bg-light);
  border: 1px solid var(--accent-light);
  border-radius: 3px;
  box-shadow: 0 4px 16px var(--shadow-light);
  padding: 6px;
  flex-direction: column;
  gap: 4px;
  z-index: 200;
  min-width: 100%;
}

.filter-dropdown.open .filter-dropdown-panel {
  display: flex;
}

.filter-option {
  background: transparent;
  color: var(--text-dark);
  border: none;
  padding: 7px 14px;
  border-radius: 2px;
  font-family: 'Playfair Display', serif;
  font-style: italic;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s, color 0.15s;
  text-align: left;
}

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

.filter-option.active {
  background: var(--accent-green);
  color: var(--text-light);
}
