/* =====================================================================
   components.css — buttons, cards, forms, filters, lightbox, widgets
   ===================================================================== */

/* ---------- Buttons --------------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.6rem 1.2rem;
  border-radius: 999px;
  border: 2px solid transparent;
  font-weight: 700;
  font-size: var(--step--1);
  line-height: 1.3;
  text-decoration: none;
  cursor: pointer;
  transition: transform 0.12s ease, box-shadow 0.15s ease,
    background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
  /* Wrap instead of overflowing: a long label's max-content width would
     otherwise widen the track of the grid/flex container holding the button
     and push the page wider than the viewport on narrow phones. */
  white-space: normal;
  max-width: 100%;
}

.btn:hover { transform: translateY(-1px); }

.btn:active { transform: translateY(0); }

.btn-lg { padding: 0.85rem 1.6rem; font-size: var(--step-0); }
.btn-sm { padding: 0.45rem 0.95rem; font-size: 0.82rem; }

/* Solid — magenta primary */
.btn-solid {
  background: var(--accent);
  color: var(--white);
  box-shadow: 0 6px 18px rgba(194, 24, 91, 0.32);
}

.btn-solid:hover {
  background: var(--accent-strong);
  color: var(--white);
  box-shadow: 0 10px 24px rgba(194, 24, 91, 0.4);
}

/* Solid WhatsApp green variant */
.btn-wa,
.btn-solid.btn-wa {
  background: var(--wa);
  box-shadow: 0 6px 18px rgba(31, 170, 89, 0.3);
}

.btn-wa:hover {
  background: var(--wa-dark);
  color: var(--white);
}

/* Outline — purple */
.btn-outline {
  border-color: var(--purple-900);
  color: var(--purple-900);
  background: transparent;
}

.btn-outline:hover {
  background: var(--purple-900);
  color: var(--white);
}

/* Ghost — subtle */
.btn-ghost {
  border-color: var(--line);
  color: var(--charcoal-700);
  background: var(--white);
}

.btn-ghost:hover {
  border-color: var(--accent);
  color: var(--accent);
}

/* On dark sections, outline/ghost adapt */
.section-gallery .btn-outline,
.section-contact .btn-outline {
  border-color: var(--white);
  color: var(--white);
}

.section-gallery .btn-outline:hover,
.section-contact .btn-outline:hover {
  background: var(--white);
  color: var(--purple-900);
}

/* ---------- Cards ----------------------------------------------------- */
.card {
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow);
}

.card-media {
  aspect-ratio: 4 / 3;
  overflow: hidden;
  background: var(--cream-200);
}

.card-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.4s ease;
}

/* Shown when a remote image fails to load (set by utils/images.js guard). */
img.is-fallback {
  object-fit: contain;
  background: var(--purple-800);
  padding: 1rem;
}

.card:hover .card-media img { transform: scale(1.05); }

.card-body {
  padding: 1rem 1.1rem 0.6rem;
  flex: 1;
}

.card-title {
  font-size: var(--step-1);
  margin-bottom: 0.35em;
  color: var(--purple-900);
}

.card-text {
  color: var(--text-soft);
  font-size: var(--step--1);
}

.card-foot {
  padding: 0.6rem 1.1rem 1.1rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}

/* Gallery cards sit on the dark section */
.gallery-card {
  background: rgba(255, 255, 255, 0.06);
  border-color: var(--dark-line);
  color: var(--dark-text);
}

.gallery-card:hover {
  background: rgba(255, 255, 255, 0.1);
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.34);
}

.gallery-card .card-title { color: var(--white); }

.gallery-media {
  display: block;
  width: 100%;
  padding: 0;
  border: 0;
  background: var(--purple-700);
  aspect-ratio: 3 / 4;
  overflow: hidden;
  cursor: zoom-in;
}

.gallery-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.4s ease;
}

.gallery-media:hover img { transform: scale(1.06); }

.gallery-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.4rem;
}

.gallery-actions .btn-ghost {
  background: transparent;
  border-color: var(--dark-line);
  color: var(--dark-text);
}

.gallery-actions .btn-ghost:hover {
  border-color: var(--white);
  color: var(--white);
}

.gallery-count {
  display: inline-block;
  margin-top: 0.6rem;
  padding: 0.3rem 0.9rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
  color: var(--dark-text);
  font-size: var(--step--1);
  font-weight: 600;
}

/* ---------- Pills, codes, chips --------------------------------------- */
.pill {
  display: inline-block;
  padding: 0.18rem 0.65rem;
  border-radius: 999px;
  background: var(--magenta-100);
  color: var(--accent);
  font-size: 0.74rem;
  font-weight: 700;
}

.design-code {
  font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  font-size: 0.74rem;
  letter-spacing: 0.06em;
  color: var(--gold-500);
  font-weight: 700;
}

.chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.8rem;
}

.chip {
  border: 1px solid var(--line);
  background: var(--white);
  border-radius: 999px;
  padding: 0.45rem 1rem;
  font-weight: 600;
  font-size: var(--step--1);
  color: var(--charcoal-700);
  transition: border-color 0.15s ease, color 0.15s ease, background 0.15s ease;
}

.chip:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--magenta-100);
}

/* ---------- Gallery filters ------------------------------------------- */
.filters {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.5rem;
  margin-bottom: clamp(1.4rem, 3vw, 2rem);
}

.filter-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  border: 1px solid var(--dark-line);
  background: rgba(255, 255, 255, 0.08);
  color: var(--dark-text);
  border-radius: 999px;
  padding: 0.42rem 0.95rem;
  font-weight: 600;
  font-size: var(--step--1);
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.filter-chip:hover {
  background: rgba(255, 255, 255, 0.18);
  color: var(--white);
}

.filter-chip.is-active {
  background: var(--white);
  color: var(--purple-900);
  border-color: var(--white);
}

.filter-chip-count {
  display: inline-grid;
  place-items: center;
  min-width: 1.5em;
  height: 1.5em;
  padding-inline: 0.3em;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.18);
  font-size: 0.72rem;
  font-weight: 700;
}

.filter-chip.is-active .filter-chip-count {
  background: var(--magenta-100);
  color: var(--accent);
}

.empty-state {
  text-align: center;
  color: var(--dark-text-soft);
  padding: 2rem 0;
}

/* ---------- Notes ------------------------------------------------------ */
.note {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  margin-top: clamp(1.4rem, 3vw, 2rem);
  padding: 0.9rem 1.1rem;
  border-radius: var(--radius);
  background: var(--emerald-100);
  color: var(--charcoal-700);
  font-size: var(--step--1);
  border: 1px solid rgba(0, 137, 123, 0.25);
}

.note .icon { color: var(--emerald-600); margin-top: 0.15em; }

.note-gold {
  background: var(--gold-100);
  border-color: rgba(212, 160, 23, 0.35);
}

.note-gold .icon { color: var(--gold-500); }

/* ---------- Why-us ----------------------------------------------------- */
.why-item {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.4rem 1.3rem;
  box-shadow: var(--shadow-sm);
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.why-item:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow);
}

.why-icon {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border-radius: 12px;
  background: var(--magenta-100);
  color: var(--accent);
  margin-bottom: 0.9rem;
}

.why-icon .icon { width: 1.4rem; height: 1.4rem; }

.why-item h3 { font-size: var(--step-1); }

.why-item p { color: var(--text-soft); font-size: var(--step--1); }

/* ---------- Steps ------------------------------------------------------ */
.step {
  position: relative;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.5rem 1.2rem 1.3rem;
  text-align: center;
  box-shadow: var(--shadow-sm);
}

.step-num {
  position: absolute;
  top: -0.85rem;
  left: 50%;
  transform: translateX(-50%);
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: var(--purple-900);
  color: var(--white);
  font-weight: 800;
  font-size: var(--step--1);
  box-shadow: var(--shadow-sm);
}

.step-icon {
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  margin: 0.3rem auto 0.8rem;
  border-radius: 50%;
  background: var(--gold-100);
  color: var(--gold-500);
}

.step-icon .icon { width: 1.5rem; height: 1.5rem; }

.step h3 { font-size: var(--step-1); }
.step p { color: var(--text-soft); font-size: var(--step--1); }

/* ---------- Form ------------------------------------------------------- */
.privacy-note {
  background: var(--emerald-100);
  border-left: 4px solid var(--emerald-600);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  padding: 0.8rem 1rem;
  color: var(--charcoal-700);
  font-size: var(--step--1);
}

.form-card {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: clamp(1.2rem, 3vw, 2rem);
  box-shadow: var(--shadow);
}

.form-grid {
  display: grid;
  /* minmax(0, 1fr): a control's intrinsic min-content (e.g. <input type="date">)
     must not be able to force a track wider than its share on narrow screens. */
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem 1.1rem;
}

.form-grid > * { min-width: 0; }

/* Single column once a half-width field would be too cramped to use. */
@media (max-width: 560px) {
  .form-grid { grid-template-columns: 1fr; }
  .field-full { grid-column: auto; }
}

.field { display: grid; gap: 0.35rem; }
.field-full { grid-column: 1 / -1; }

.field label,
.field legend {
  font-weight: 700;
  color: var(--purple-900);
  font-size: var(--step--1);
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
}

.hint {
  font-weight: 500;
  font-size: 0.74rem;
  color: var(--text-soft);
}

.field input,
.field select,
.field textarea {
  width: 100%;
  min-width: 0;
  padding: 0.65rem 0.85rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--cream-100);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(224, 48, 110, 0.18);
  outline: none;
}

.field textarea { resize: vertical; min-height: 96px; }

.field input[aria-invalid="true"],
.field select[aria-invalid="true"],
.field textarea[aria-invalid="true"] {
  border-color: #c62828;
}

.field-error {
  color: #c62828;
  font-size: 0.78rem;
  font-weight: 600;
  margin: 0;
}

.radio-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.2rem;
  margin-top: 0.35rem;
}

.radio {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  font-weight: 600;
  font-size: var(--step--1);
  color: var(--charcoal-700);
  cursor: pointer;
}

.radio input { accent-color: var(--accent); }

.form-foot {
  margin-top: 1.3rem;
  display: grid;
  /* Explicit single track: the implicit 'auto' track is sized to the
     submit button's max-content and overflows the card on narrow screens. */
  grid-template-columns: minmax(0, 1fr);
  gap: 0.7rem;
  justify-items: start;
}

.form-foot > * { max-width: 100%; }

.form-errors {
  background: #fdecea;
  border-left: 4px solid #c62828;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  padding: 0.8rem 1rem;
  color: #b71c1c;
  font-weight: 600;
  font-size: var(--step--1);
  margin-bottom: 1rem;
}

.form-status {
  background: var(--emerald-100);
  border-left: 4px solid var(--emerald-600);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  padding: 0.8rem 1rem;
  color: var(--charcoal-700);
  font-size: var(--step--1);
  font-weight: 600;
  margin: 0;
}

.form-fallback {
  font-size: 0.82rem;
  color: var(--text-soft);
}

.form-fallback a { font-weight: 700; }

/* ---------- Contact cards ---------------------------------------------- */
.contact-card {
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid var(--dark-line);
  border-radius: var(--radius);
  padding: 1.4rem 1.2rem;
  color: var(--dark-text);
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.contact-icon {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.12);
  color: var(--gold-500);
  margin-bottom: 0.4rem;
}

.contact-icon .icon { width: 1.35rem; height: 1.35rem; }

.contact-card h3 {
  color: var(--dark-text);
  font-size: var(--step-1);
  margin-bottom: 0.1em;
}

.contact-strong { font-weight: 700; color: var(--white); }

.contact-muted { color: var(--dark-text-soft); font-size: var(--step--1); }

.contact-note {
  color: var(--charcoal-300);
  font-size: 0.78rem;
  margin: 0;
}

.contact-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.5rem;
}

.contact-card .btn-ghost {
  background: transparent;
  border-color: var(--dark-line);
  color: var(--dark-text);
}

.contact-card .btn-ghost:hover {
  border-color: var(--white);
  color: var(--white);
}

/* ---------- Floating WhatsApp button ----------------------------------- */
.wa-float {
  position: fixed;
  right: max(1rem, env(safe-area-inset-right));
  bottom: max(1rem, env(safe-area-inset-bottom));
  z-index: 90;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.8rem 1.05rem;
  border-radius: 999px;
  background: var(--wa);
  color: var(--white);
  font-weight: 700;
  font-size: var(--step--1);
  text-decoration: none;
  box-shadow: 0 10px 26px rgba(18, 140, 71, 0.45);
  transition: transform 0.15s ease, background 0.15s ease;
  animation: wa-pop 0.4s ease both;
}

.wa-float:hover {
  background: var(--wa-dark);
  color: var(--white);
  transform: translateY(-2px);
}

.wa-float .icon { width: 1.5rem; height: 1.5rem; }

@keyframes wa-pop {
  from { transform: scale(0.85); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

@media (max-width: 560px) {
  .wa-float-text { display: none; }
  .wa-float { padding: 0.85rem; }
}

/* ---------- Lightbox ---------------------------------------------------- */
/* Lock the page behind the open dialog (toggled by lightbox.js). */
body.is-lightbox-open {
  overflow: hidden;
}

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 300;
  display: grid;
  place-items: center;
  padding: clamp(0.75rem, 3vw, 2rem);
}

.lightbox[hidden] { display: none; }

.lightbox-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(20, 6, 28, 0.9);
  backdrop-filter: blur(4px);
}

.lightbox-dialog {
  position: relative;
  z-index: 1;
  width: min(96vw, 900px);
  max-height: min(92vh, 100%);
  display: grid;
  grid-template-columns: auto 1fr auto;
  grid-template-areas:
    "prev fig next"
    "bar bar bar";
  gap: 0.5rem;
  align-items: center;
}

.lightbox-figure {
  grid-area: fig;
  margin: 0;
  display: grid;
  gap: 0.7rem;
  justify-items: center;
  min-width: 0;
}

.lightbox-image {
  max-width: 100%;
  max-height: 68vh;
  width: auto;
  border-radius: var(--radius);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.55);
  background: var(--purple-700) center / cover no-repeat;
  opacity: 1;
  transition: opacity 0.2s ease;
}

.lightbox-image.is-loading { opacity: 0; }

.lightbox-caption {
  text-align: center;
  color: var(--dark-text);
  display: grid;
  gap: 0.25rem;
  justify-items: center;
}

.lightbox-title {
  color: var(--white);
  font-size: var(--step-2);
  margin: 0;
}

.lightbox-nav,
.lightbox-close {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border: 1px solid var(--dark-line);
  background: rgba(255, 255, 255, 0.1);
  color: var(--white);
  border-radius: 50%;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.15s ease;
}

.lightbox-nav:hover,
.lightbox-close:hover {
  background: rgba(255, 255, 255, 0.22);
  transform: scale(1.05);
}

.lightbox-prev { grid-area: prev; }
.lightbox-next { grid-area: next; }

.lightbox-close {
  position: absolute;
  top: -3.2rem;
  right: 0;
  z-index: 2;
}

.lightbox-bar {
  grid-area: bar;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  flex-wrap: wrap;
  padding-top: 0.4rem;
}

.lightbox-counter {
  color: var(--dark-text-soft);
  font-size: var(--step--1);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

@media (max-width: 640px) {
  .lightbox-dialog {
    grid-template-columns: 1fr;
    grid-template-areas:
      "fig"
      "bar";
  }
  .lightbox-nav {
    position: fixed;
    top: 50%;
    transform: translateY(-50%);
  }
  .lightbox-prev { left: 0.4rem; }
  .lightbox-next { right: 0.4rem; }
  .lightbox-nav:hover { transform: translateY(-50%) scale(1.05); }
  .lightbox-close { top: -3rem; right: 0.2rem; }
}
