/**
 * Fresh Dental — shared mobile UX layer
 * 1) Site-wide text/button/card centering ≤820px
 * 2) Sticky bottom Call / Book bar
 */

/* -------------------------------------------------------------------------- */
/* Mobile centering                                                            */
/* -------------------------------------------------------------------------- */

@media (max-width: 820px) {
  /*
   * Page stacks often omit <main>. Center section copy, CTAs, and cards/tiles
   * site-wide. Forms keep left-aligned inputs (see exclusions below).
   */
  :is(
    .fd-fresh__intro,
    .fd-fresh__kicker,
    .fd-fresh__heading,
    .fd-fresh__sub,
    .fd-fresh__lede,
    .fd-fresh__body,
    .fd-fresh__actions,
    .fd-fresh__well,
    .fd-fresh__well h3,
    .fd-fresh__well p,
    .fd-fresh__caption,
    .fd-fresh__caption h3,
    .fd-fresh__caption p,
    .fd-fresh__caption .fd-fresh__kicker,
    .fd-fresh__step,
    .fd-fresh__step h3,
    .fd-fresh__step p,
    .fd-fresh__fact,
    .fd-fresh__fact h3,
    .fd-fresh__fact p,
    .fd-fresh__tile,
    .fd-fresh__tile h3,
    .fd-fresh__tile p,
    .fd-team-copy,
    .fd-team-copy h2,
    .fd-team-copy h3,
    .fd-team-teaser,
    .fd-team-more,
    .fd-press-tile__body,
    .fd-press-tile__body h3,
    .fd-press-tile__more,
    .fd-fee-card,
    .fd-fee-card h3,
    .fd-fee-card__price,
    .fd-fee-card__more,
    .fd-fee-card__more summary,
    .fd-fee-card__more p,
    .fd-section-break,
    .fd-section-break__kicker,
    .fd-section-break__heading,
    .fd-section-break__text,
    .fd-section-break__actions,
    .fd-tabout__copy,
    .fd-tabout__copy-inner,
    .fd-tabout__heading,
    .fd-tabout__subheading,
    .fd-tabout__body,
    .fd-tabout__body > p,
    .fd-about__heading,
    .fd-about__subheading,
    .fd-about__body,
    .fd-about__body > p,
    .fd-about__copy-stack,
    .fd-person-profile__intro,
    .fd-person-profile__intro .fd-fresh__heading,
    .fd-person-profile__role,
    .fd-person-profile__gdc,
    .fd-person-profile__back,
    .fd-person-social__card,
    .fd-person-social__kicker,
    .fd-person-social__title,
    .fd-person-social__cta,
    .fd-referral__hero,
    .fd-referral__eyebrow,
    .fd-referral__title,
    .fd-referral__lede,
    .fd-referral__section-title,
    .fd-referral__form-lede,
    .fd-referral__why-card,
    .fd-referral__why-card h3,
    .fd-referral__why-card p,
    .fdc-hero__content,
    .fdc-hero__title,
    .fdc-hero__description,
    .fdc-press-stories__heading,
    .fdc-press-stories__subheading,
    .fdc-treatment-options__heading,
    .fdc-treatment-options__heading h1,
    .fdc-treatment-options__heading h2,
    .fdc-treatment-options__heading p,
    .fdc-treatment-options__card,
    .fdc-treatment-options__card h3,
    .fdc-treatment-options__card p,
    .fdc-treatment-process__intro,
    .fdc-treatment-process__heading,
    .fdc-treatment-process__support,
    .fdc-treatment-process__card,
    .fdc-treatment-process__card h3,
    .fdc-treatment-process__card p,
    .fdc-treatment-process__reasons,
    .fdc-video-library__header,
    .wise-faq__title,
    .wise-faq__intro,
    .wise-compare-sec__intro,
    .wise-compare-sec__intro h2,
    .wise-compare-sec__intro p,
    .wise-cta__heading,
    .wise-cta__text,
    .wise-cta__kicker,
    .wise-postcard__intro,
    .wise-postcard__intro h2,
    .wise-postcard__intro p,
    .wise-blog__kicker,
    .wise-blog__title,
    .wise-blog__meta,
    .wise-blog__inner > :is(.wise-blog__kicker, .wise-blog__title),
    .wise-group--quiet,
    .wise-group--quiet .wise-group__title,
    .wise-group--quiet .wise-group__lede,
    .wrap > :is(h1, h2, .display, .kicker, .lede),
    .kicker,
    .lede,
    .display,
    .section-title,
    .section-lede
  ) {
    text-align: center;
    margin-left: auto;
    margin-right: auto;
  }

  /* Card / tile grids — center items as a column on narrow viewports */
  :is(
    .fd-fresh__why-grid,
    .fd-fresh__grid,
    .fd-fresh__grid--3,
    .fd-fresh__steps,
    .fd-fresh__facts,
    .fd-fees-cards,
    .fd-fees-cards--grid,
    .fd-referral__why-grid,
    .fdc-treatment-options__grid,
    .fdc-treatment-process__grid
  ) {
    justify-items: center;
  }

  :is(
    .fd-fresh__well,
    .fd-fresh__tile,
    .fd-fresh__step,
    .fd-fresh__fact,
    .fd-press-tile,
    .fd-fee-card,
    .fd-referral__why-card,
    .fdc-treatment-options__card,
    .fdc-treatment-process__card,
    .fd-person-social__card
  ) {
    width: 100%;
    max-width: 28rem;
    text-align: center;
  }

  .fd-fresh__caption,
  .fd-press-tile__body,
  .fd-press-tile__hit,
  .fd-fresh--press .fd-press-tile__body.fd-fresh__caption,
  .fd-fresh--press .fd-press-tile__hit {
    text-align: center;
  }

  .fd-team-carousel__slide .fd-fresh__caption,
  .fd-fresh__tile--person .fd-fresh__caption,
  button.fd-fresh__case,
  button.fd-fresh__case .fd-fresh__caption {
    text-align: center;
  }

  .fd-team-more {
    display: inline-block;
  }

  .fd-fee-card__top {
    justify-items: center;
    text-align: center;
  }

  .fd-fee-card__price {
    text-align: center !important;
  }

  /* Button / CTA groups — center as a group */
  :is(
    .fd-fresh__actions,
    .fd-fresh__actions--inline,
    .fd-section-break__actions,
    .fdc-hero__actions,
    .fdc-treatment-process__actions,
    .wise-cta__actions,
    .fd-person-profile__intro .fd-fresh__actions,
    .fd-referral__nav
  ) {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    text-align: center;
  }

  .fdc-hero__actions {
    flex-direction: column;
    align-items: center;
  }

  .fd-tabout__copy-inner,
  .fd-about__copy-stack {
    text-align: center;
    margin-left: auto;
    margin-right: auto;
  }

  :is(.fd-tabout__cta, .fd-about__cta) {
    display: inline-flex;
    margin-left: auto;
    margin-right: auto;
  }

  .fd-about__copy {
    justify-content: center;
  }

  .fd-person-profile__intro,
  .fd-person-profile__portrait {
    text-align: center;
  }

  .fd-person-profile__link {
    display: inline-block;
    margin-left: 0;
    margin-right: 0;
  }

  .fd-person-profile__bio {
    margin-left: auto;
    margin-right: auto;
  }

  .fd-person-social__bar {
    justify-content: center;
    flex-wrap: wrap;
  }

  .fd-referral__hero .fd-referral__title,
  .fd-referral__hero .fd-referral__lede {
    max-width: none;
  }

  .fd-referral__why-card {
    max-width: none;
  }

  .wise-faq__ask {
    justify-content: center;
    text-align: center;
  }

  :is(
    .fd-fresh__btn,
    .fd-section-break__btn,
    .fdc-button,
    .fdc-button--primary,
    .fdc-text-link,
    .fdc-treatment-process__btn,
    .fdc-footer-reveal__pill,
    .btn-primary,
    .btn-ghost,
    .wise-cta__btn,
    .fd-about__cta,
    .fd-tabout__cta,
    .fd-person-profile__link,
    .fd-referral__btn
  ) {
    margin-left: auto;
    margin-right: auto;
  }

  /* Decorative rules under centered headings */
  :is(.fd-tabout__rule, .fd-about__rule, .wise-blog__rule, .fdc-treatment-process__rule) {
    margin-left: auto;
    margin-right: auto;
  }

  /*
   * Keep forms, tables, FAQ answers, and long-form article body left-aligned.
   * Do NOT blanket-reset ul/ol/li or card captions — that undoes card centering.
   */
  :is(
    form:not(.fd-referral__form),
    form:not(.fd-referral__form) :is(input, textarea, select, label, .wise-form),
    table,
    table :is(th, td),
    .wise-form,
    .wise-form :is(input, textarea, select, label, p, span),
    .wise-faq__list,
    .wise-faq__item button[data-acc],
    .wise-faq__item [data-acc-panel],
    .wise-faq__item [data-acc-panel] *,
    .wise-compare-sec table,
    .wise-compare-sec table :is(th, td),
    .wise-blog__body,
    .wise-blog__body *,
    .wise-postcard form,
    .wise-postcard form *,
    .fd-person-profile__bio,
    .fd-person-profile__bio *,
    .fd-fresh__bio.prose,
    .fd-fresh__bio.prose *,
    .fd-referral__form .fd-referral__field,
    .fd-referral__form .fd-referral__field span,
    .fd-referral__form .fd-referral__choice,
    .fd-referral__form .fd-referral__hint,
    .fd-referral__form .fd-referral__sublegend,
    .fd-referral__form legend,
    .gform_wrapper,
    .gform_wrapper *
  ) {
    text-align: left;
  }

  /* Referral form nav buttons stay centered */
  .fd-referral__nav {
    text-align: center;
  }

  /* Nav + footer stay sensible (do not force center on link columns) */
  .wise-nav-expand,
  .wise-nav-expand *,
  .wise-footer-beam,
  .wise-footer-beam *,
  .wise-consent,
  .wise-consent * {
    text-align: revert;
  }
}

/* -------------------------------------------------------------------------- */
/* Sticky bottom mobile bar                                                    */
/* -------------------------------------------------------------------------- */

.fd-mobile-bar {
  --fd-bar-gold: var(--brand-primary, #b28b42);
  --fd-bar-gold-soft: #e5b768;
  --fd-bar-ink: #191919;
  --fd-bar-pad: 10px;
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 85;
  display: none;
  padding: var(--fd-bar-pad);
  padding-bottom: calc(var(--fd-bar-pad) + env(safe-area-inset-bottom, 0px));
  pointer-events: none;
  transform: translate3d(0, calc(100% + 12px), 0);
  opacity: 0;
  visibility: hidden;
  transition:
    transform 0.28s cubic-bezier(0.22, 0.7, 0.2, 1),
    opacity 0.22s ease,
    visibility 0.22s ease;
}

.fd-mobile-bar__inner {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  max-width: 420px;
  margin: 0 auto;
  padding: 8px;
  border-radius: 18px;
  background: color-mix(in srgb, var(--fd-bar-ink) 92%, transparent);
  border: 1px solid color-mix(in srgb, var(--fd-bar-gold) 38%, transparent);
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.42);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  pointer-events: auto;
}

.fd-mobile-bar__btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  padding: 0.7rem 0.85rem;
  border-radius: 999px;
  font-family: "Montserrat", Arial, sans-serif;
  font-size: 0.82rem;
  font-weight: 650;
  letter-spacing: 0.02em;
  text-decoration: none;
  text-align: center;
  line-height: 1.2;
  transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

.fd-mobile-bar__btn--call {
  background: transparent;
  color: var(--fd-bar-gold-soft);
  border: 1px solid color-mix(in srgb, var(--fd-bar-gold) 55%, transparent);
}

.fd-mobile-bar__btn--book {
  background: var(--fd-bar-gold);
  color: #1a1408;
  border: 1px solid var(--fd-bar-gold);
}

.fd-mobile-bar__btn--call:hover,
.fd-mobile-bar__btn--call:focus-visible {
  background: color-mix(in srgb, var(--fd-bar-gold) 16%, transparent);
  outline: none;
}

.fd-mobile-bar__btn--book:hover,
.fd-mobile-bar__btn--book:focus-visible {
  background: var(--fd-bar-gold-soft);
  outline: none;
}

@media (max-width: 820px) {
  .fd-mobile-bar {
    display: block;
  }

  .fd-mobile-bar.is-visible {
    transform: none;
    opacity: 1;
    visibility: visible;
  }

  /* Lift back-to-top above the bar when it is showing */
  body:has(.fd-mobile-bar.is-visible) .wise-scroll-top {
    bottom: calc(88px + env(safe-area-inset-bottom, 0px));
  }

  /* Soft page padding so the last content isn't flush under a peeking bar */
  body.fd-has-mobile-bar {
    padding-bottom: env(safe-area-inset-bottom, 0px);
  }
}

@media (min-width: 821px) {
  .fd-mobile-bar {
    display: none !important;
  }
}

/* Hide while mobile nav drawer is open or studio shell is active */
html[data-wise-nav-open="true"] .fd-mobile-bar,
body:has([data-wise-nav][data-open="true"]) .fd-mobile-bar,
body.wise-studio .fd-mobile-bar,
body.wise-studio-frame .fd-mobile-bar {
  display: none !important;
}

@media print {
  .fd-mobile-bar {
    display: none !important;
  }
}

@media (prefers-reduced-motion: reduce) {
  .fd-mobile-bar {
    transition: none;
  }
}
