/* assets/css/components.css */
/* Cards, badges, tabs, accordion, filters, and other reusable components. */

/* ==========================================================================
   Cards
   ========================================================================== */
.fum-card {
  background-color: var(--warm-white);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: 0 2px 8px var(--shadow);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.fum-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 10px 24px var(--shadow);
}

.fum-card__media {
  position: relative;
  display: block;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  background-color: var(--cream);
}

.fum-card__media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.fum-card__body {
  padding: 1.1rem 1.25rem 1.35rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  flex-grow: 1;
}

.fum-card__episode {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--terra);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* Flags a house that was also featured under a different episode, see
   fum_group_seed_houses() in inc/seed-houses.php. */
.fum-card__also-in {
  font-weight: 500;
  color: var(--mid-gray);
  text-transform: none;
  letter-spacing: normal;
}

.fum-single-house__other-episodes {
  list-style: none;
  margin: 0.25rem 0 0;
  padding: 0;
}

.fum-card__title {
  font-size: 1.1rem;
  margin: 0;
}

.fum-card__title a {
  color: var(--charcoal);
}

.fum-card__title a:hover {
  color: var(--terra);
}

.fum-card__address {
  color: var(--mid-gray);
  font-size: 0.9rem;
  margin: 0;
}

.fum-card__note {
  color: var(--mid-gray);
  font-size: 0.9rem;
  margin: 0 0 0.5rem;
}

.fum-card__meta-list {
  list-style: none;
  margin: 0 0 0.75rem;
  padding: 0;
  font-size: 0.9rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.fum-card__meta-label {
  font-weight: 600;
  color: var(--charcoal);
}

.fum-card__link {
  margin-top: auto;
  align-self: flex-start;
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--terra);
  padding-top: 0.5rem;
}

.fum-card__link:hover {
  color: var(--terra-light);
}

.fum-card__shop-btn {
  margin-top: 0.5rem;
  width: 100%;
}

.fum-card--company {
  padding: 1.25rem 1.25rem 1.35rem;
}

.fum-card--company .fum-card__title {
  margin-bottom: 0.25rem;
}

/* ==========================================================================
   Badges and pills
   ========================================================================== */
.fum-badge {
  display: inline-flex;
  align-items: center;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 0.3rem 0.6rem;
  border-radius: 999px;
}

.fum-badge--season {
  position: absolute;
  top: 0.75rem;
  left: 0.75rem;
  background-color: var(--charcoal);
  color: var(--warm-white);
}

.fum-single-house .fum-badge--season {
  position: static;
  margin-right: 0.5rem;
}

.fum-badge--verified {
  background-color: var(--sage);
  color: var(--warm-white);
}

/* Flags a home that ships with before/after photos. */
.fum-badge--photos {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  background-color: var(--terra);
  color: var(--warm-white);
}

.fum-pill {
  display: inline-block;
  align-self: flex-start;
  background-color: var(--cream);
  color: var(--sage-dark);
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.25rem 0.65rem;
  border-radius: 999px;
  margin-bottom: 0.35rem;
}

/* ==========================================================================
   Tabs
   ========================================================================== */
.fum-tabs__list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 2rem;
  border-bottom: 1px solid var(--border);
  padding-bottom: 0.75rem;
}

.fum-tabs__tab {
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 0.95rem;
  padding: 0.55rem 1.1rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background-color: var(--warm-white);
  color: var(--charcoal);
  cursor: pointer;
  transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

.fum-tabs__tab:hover {
  border-color: var(--terra);
}

.fum-tabs__tab.is-active {
  background-color: var(--terra);
  border-color: var(--terra);
  color: var(--warm-white);
}

.fum-tabs__panel[hidden] {
  display: none;
}

/* ==========================================================================
   Accordion (CSS-only, <details>/<summary>)
   ========================================================================== */
.fum-accordion {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  max-width: 760px;
}

.fum-accordion__item {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background-color: var(--warm-white);
  padding: 0.25rem 1.25rem;
}

.fum-accordion__trigger {
  cursor: pointer;
  list-style: none;
  padding: 1rem 0;
  font-weight: 600;
  font-family: var(--font-heading);
  font-size: 1.05rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.fum-accordion__trigger::-webkit-details-marker {
  display: none;
}

.fum-accordion__trigger::after {
  content: "+";
  font-size: 1.4rem;
  line-height: 1;
  color: var(--terra);
  flex-shrink: 0;
  transition: transform 0.2s ease;
}

.fum-accordion__item[open] .fum-accordion__trigger::after {
  transform: rotate(45deg);
}

.fum-accordion__panel {
  padding-bottom: 1rem;
  color: var(--mid-gray);
}

/* ==========================================================================
   Filter bar (archive-house.php)
   ========================================================================== */
.fum-filter-btn {
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 0.9rem;
  padding: 0.5rem 1rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background-color: var(--warm-white);
  color: var(--charcoal);
  cursor: pointer;
  transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

.fum-filter-btn:hover {
  border-color: var(--sage);
}

.fum-filter-btn.is-active {
  background-color: var(--sage);
  border-color: var(--sage);
  color: var(--warm-white);
}

.fum-filter-item[hidden] {
  display: none;
}

/* ==========================================================================
   Scroll reveal (progressive enhancement, applied only when JS is active
   and IntersectionObserver is available, see assets/js/animations.js)
   ========================================================================== */
.fum-reveal {
  opacity: 0;
  transform: translateY(16px);
  transition: opacity 0.5s ease, transform 0.5s ease;
}

.fum-reveal.is-visible {
  opacity: 1;
  transform: none;
}


/* ==========================================================================
   Before and after gallery
   ========================================================================== */
.fum-gallery__intro {
  color: var(--mid-gray);
  margin-bottom: 1.25rem;
}

.fum-gallery__switch {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1.75rem;
}

.fum-gallery__switch-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.6rem 1.25rem;
  border: 2px solid var(--border);
  border-radius: var(--radius-md);
  background-color: transparent;
  color: var(--charcoal);
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.fum-gallery__switch-btn:hover {
  border-color: var(--sage);
}

.fum-gallery__switch-btn.is-active {
  background-color: var(--sage);
  border-color: var(--sage);
  color: var(--warm-white);
}

.fum-gallery__switch-count {
  font-size: 0.8rem;
  font-weight: 700;
  padding: 0.1rem 0.45rem;
  border-radius: 999px;
  background-color: rgba(44, 44, 44, 0.12);
}

.fum-gallery__switch-btn.is-active .fum-gallery__switch-count {
  background-color: rgba(253, 250, 244, 0.25);
}

/* The per-group heading is only needed when JS is off, since the toggle
   above names the visible stage once the script takes over. */
.fum-gallery__group-title {
  font-size: 1.35rem;
  margin: 2rem 0 1rem;
}

.fum-gallery__group.is-enhanced .fum-gallery__group-title {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(1px, 1px, 1px, 1px);
  white-space: nowrap;
}

.fum-gallery__grid {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 1rem;
}

.fum-gallery__item {
  margin: 0;
}

.fum-gallery__link {
  position: relative;
  display: block;
  overflow: hidden;
  border-radius: var(--radius-md);
  background-color: var(--cream);
  box-shadow: 0 2px 8px var(--shadow);
  aspect-ratio: 3 / 2;
  cursor: zoom-in;
}

.fum-gallery__link img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.35s ease;
}

.fum-gallery__link:hover img {
  transform: scale(1.04);
}

.fum-gallery__tag {
  position: absolute;
  top: 0.6rem;
  left: 0.6rem;
  padding: 0.2rem 0.6rem;
  border-radius: var(--radius-sm);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--warm-white);
}

.fum-gallery__tag--before {
  background-color: var(--mid-gray);
}

.fum-gallery__tag--after {
  background-color: var(--terra);
}

.fum-gallery__credit {
  margin-top: 1.5rem;
  font-size: 0.9rem;
  color: var(--mid-gray);
  font-style: italic;
}

/* ==========================================================================
   Lightbox
   ========================================================================== */
body.fum-lightbox-open {
  overflow: hidden;
}

.fum-lightbox {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 1rem;
  background-color: rgba(44, 44, 44, 0.92);
}

.fum-lightbox[hidden] {
  display: none;
}

.fum-lightbox__figure {
  margin: 0;
  max-width: min(1100px, 92vw);
  max-height: 88vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
}

.fum-lightbox__img {
  max-width: 100%;
  max-height: 80vh;
  width: auto;
  border-radius: var(--radius-md);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.45);
}

.fum-lightbox__caption {
  color: var(--cream);
  font-size: 0.9rem;
  letter-spacing: 0.04em;
}

.fum-lightbox__close,
.fum-lightbox__nav {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: 50%;
  background-color: rgba(253, 250, 244, 0.14);
  color: var(--warm-white);
  cursor: pointer;
  transition: background-color 0.2s ease;
}

.fum-lightbox__close:hover,
.fum-lightbox__nav:hover {
  background-color: rgba(253, 250, 244, 0.3);
}

.fum-lightbox__nav {
  width: 48px;
  height: 48px;
  font-size: 2rem;
  line-height: 1;
}

.fum-lightbox__close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  width: 44px;
  height: 44px;
  font-size: 1.75rem;
  line-height: 1;
}

.fum-lightbox :focus-visible {
  outline: 3px solid var(--terra-light);
  outline-offset: 2px;
}

@media (max-width: 600px) {
  .fum-lightbox__nav {
    width: 40px;
    height: 40px;
    font-size: 1.5rem;
  }

  .fum-gallery__grid {
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  }
}

@media (prefers-reduced-motion: reduce) {
  .fum-gallery__link img,
  .fum-gallery__link:hover img {
    transition: none;
    transform: none;
  }
}

/* Qualifier next to an address that is only known to the town. */
.fum-note {
  display: block;
  font-size: 0.85rem;
  color: var(--mid-gray);
  font-style: italic;
}

.fum-map-info__approx {
  font-size: 0.8rem;
  font-style: italic;
  color: var(--mid-gray);
}
