/* ==========================================================================
   sec-contact-bar.css
   Sitewide mobile contact bar (Call, WhatsApp) and the branch sheet.
   Markup: inc/contact-bar.php. Script: assets/js/contact-bar.js.
   Phones only: the bar is hidden from 640 px up. It is position: fixed, so it
   never moves the page; body gets bottom padding the same height as the bar so
   it cannot cover the footer or a submit button.
   ========================================================================== */

body.has-contact-bar {
  --contact-bar-height: 64px;
  --contact-bar-z: 200;
  --contact-bar-btn-height: 48px;
  --contact-bar-wa: #25D366;
  --contact-bar-wa-hover: #1ebe5b;
  --contact-bar-shadow: 0 -2px 12px rgba(0,0,0,.18);
  --contact-sheet-z: 210;
  --contact-sheet-backdrop: rgba(15,16,20,.6);
  --contact-sheet-link-height: 60px;
  padding-bottom: calc(var(--contact-bar-height) + env(safe-area-inset-bottom));
}

/* A focused field scrolls clear of the bar instead of sitting behind it. */
html:has(body.has-contact-bar) {
  --contact-bar-scroll-clearance: 80px;
  scroll-padding-bottom: var(--contact-bar-scroll-clearance);
}

.s-contact-bar {
  position: fixed;
  z-index: var(--contact-bar-z);
  inset: auto 0 0;
  display: flex;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-3) calc(var(--space-2) + env(safe-area-inset-bottom));
  background: var(--color-ink);
  box-shadow: var(--contact-bar-shadow);
}

.s-contact-bar__btn {
  display: flex;
  flex: 1;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  min-height: var(--contact-bar-btn-height);
  padding: 0 var(--space-3);
  border-radius: var(--radius-md);
  background: var(--color-red);
  color: var(--color-page);
  font-family: var(--font-heading);
  font-size: var(--text-body);
  font-weight: var(--font-black);
  letter-spacing: var(--letter-nav);
  line-height: 1;
  text-align: center;
  text-decoration: none;
  text-transform: uppercase;
}

.s-contact-bar__btn--wa {
  background: var(--contact-bar-wa);
  color: var(--color-ink);
}

.s-contact-bar__btn:hover {
  background: var(--color-red-hover);
  color: var(--color-page);
}

.s-contact-bar__btn--wa:hover,
.s-contact-bar__btn--wa:focus-visible {
  background: var(--contact-bar-wa-hover);
  color: var(--color-ink);
}

.s-contact-bar__btn:focus-visible,
.s-contact-bar__sheet-link:focus-visible,
.s-contact-bar__sheet-close:focus-visible {
  outline: var(--space-1) solid var(--color-page);
  outline-offset: calc(var(--space-1) * -1);
  box-shadow: 0 0 0 var(--space-1) var(--color-red);
}

.s-contact-bar__icon {
  flex-shrink: 0;
}

.s-contact-bar__sheet {
  position: fixed;
  z-index: var(--contact-sheet-z);
  inset: 0;
  display: flex;
  align-items: flex-end;
}

.s-contact-bar__sheet[hidden],
.s-contact-bar__sheet-title[hidden],
.s-contact-bar__sheet-link[hidden] {
  display: none;
}

.s-contact-bar__sheet-backdrop {
  position: absolute;
  inset: 0;
  background: var(--contact-sheet-backdrop);
}

.s-contact-bar__sheet-panel {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  width: 100%;
  padding: var(--space-5) var(--space-4) calc(var(--space-4) + env(safe-area-inset-bottom));
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  background: var(--color-page);
}

.s-contact-bar__sheet-title {
  margin: 0 0 var(--space-1);
  color: var(--color-ink);
  font-family: var(--font-heading);
  font-size: var(--text-h3);
  font-weight: var(--font-black);
  letter-spacing: var(--letter-nav);
  text-transform: uppercase;
}

.s-contact-bar__sheet-link {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  min-height: var(--contact-sheet-link-height);
  padding: var(--space-2) var(--space-4);
  border-radius: var(--radius-md);
  background: var(--color-red);
  color: var(--color-page);
  text-decoration: none;
}

.s-contact-bar__sheet-link--whatsapp {
  background: var(--contact-bar-wa);
  color: var(--color-ink);
}

.s-contact-bar__sheet-text {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  font-family: var(--font-heading);
  font-size: var(--text-h3);
  font-weight: var(--font-black);
  letter-spacing: var(--letter-nav);
  line-height: 1;
  text-transform: uppercase;
}

.s-contact-bar__sheet-number {
  font-family: var(--font-body);
  font-size: var(--text-small);
  font-weight: var(--font-semibold);
  letter-spacing: var(--letter-normal);
  text-transform: none;
}

.s-contact-bar__sheet-close {
  min-height: var(--contact-bar-btn-height);
  margin-top: var(--space-1);
  border: 1px solid var(--color-field-border);
  border-radius: var(--radius-md);
  background: var(--color-page);
  color: var(--color-ink);
  font-family: var(--font-heading);
  font-size: var(--text-body);
  font-weight: var(--font-bold);
  letter-spacing: var(--letter-nav);
  text-transform: uppercase;
  cursor: pointer;
}

@media (min-width: 640px) {
  html:has(body.has-contact-bar) {
    scroll-padding-bottom: 0;
  }

  body.has-contact-bar {
    padding-bottom: 0;
  }

  .s-contact-bar,
  .s-contact-bar__sheet {
    display: none;
  }
}
