/* ═══════════════════════════════════════════════════════════════
   SMARTERSWEB PUBLIC SITE ALIGNMENT CONTRACT
   Loaded after core + page CSS and before the responsive authority.
   Purpose: normalize public layout geometry without changing branding.
═══════════════════════════════════════════════════════════════ */

:root {
  --sw-content-max: 1200px;
  --sw-reading-max: 760px;
  --sw-section-space: clamp(3.25rem, 6vw, 5.75rem);
  --sw-control-height: 46px;
  --sw-control-radius: 12px;
  --sw-panel-radius: 22px;
  --sw-modal-gutter: clamp(.65rem, 2vw, 1.25rem);
}

/* ── Document / container geometry ─────────────────────────── */
.page,
main,
#main-content,
.container,
.section,
.section-sm {
  min-width: 0;
}

.container {
  width: min(calc(100% - clamp(1.25rem, 4vw, 3rem)), var(--sw-content-max));
  margin-inline: auto;
}

.section {
  padding-block: var(--sw-section-space);
}

.section-sm {
  padding-block: clamp(2.25rem, 4vw, 3.5rem);
}

.section-header,
.hero-grid,
.grid-2,
.grid-3,
.grid-2-asym,
[class*="-grid"] {
  min-width: 0;
}

.section-heading,
.hero h1,
.hero-inner h1,
.service-hero-title {
  text-wrap: balance;
}

.section-sub,
.hero-copy,
.service-hero-copy,
.card-body,
.modal-sub,
.step-sub {
  overflow-wrap: break-word;
}

img,
svg,
video,
iframe,
canvas {
  max-width: 100%;
}

/* Keep long tables useful rather than forcing page overflow. */
.table-wrap,
.sw-responsive-table {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  overflow-x: auto;
  overscroll-behavior-inline: contain;
  -webkit-overflow-scrolling: touch;
}

/* ── Shared form geometry ───────────────────────────────────── */
form,
.modal-form,
.modal-form-content,
.field,
.field-row {
  min-width: 0;
}

.field-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: .8rem;
  align-items: start;
}

.field-row .field {
  min-width: 0;
}

.field {
  gap: .4rem;
}

.field-label {
  line-height: 1.35;
}

/* Never stretch checkboxes/radios/hidden inputs to full control width. */
input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]):not([type="range"]),
select,
textarea {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  min-height: var(--sw-control-height);
  border-radius: var(--sw-control-radius);
}

input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]):not([type="range"]),
select {
  padding-block: .72rem;
}

textarea {
  min-height: 124px;
  resize: vertical;
}

input[type="checkbox"],
input[type="radio"] {
  flex: 0 0 auto;
}

input:focus-visible,
select:focus-visible,
textarea:focus-visible,
button:focus-visible,
a:focus-visible {
  outline-offset: 2px;
}

.option-grid {
  align-items: stretch;
}

.opt-card {
  min-width: 0;
  height: 100%;
}

.opt-label,
.opt-label span,
.consent-text,
.summary-value {
  overflow-wrap: anywhere;
  word-break: normal;
}

.form-nav,
.sw-calendar-actions,
.success-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .7rem;
}

.form-nav > *,
.sw-calendar-actions > *,
.success-actions > * {
  min-width: 0;
}

/* ── Modal contract ─────────────────────────────────────────── */
.modal-overlay,
.cal-overlay {
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: var(--sw-modal-gutter);
}

/* Header is z-index 10030 in the public responsive layer. */
.modal-overlay {
  z-index: 12000;
}

#pricingModal.modal-overlay {
  z-index: 12020;
}

.cal-overlay {
  z-index: 12010;
}

.modal-box,
.cal-box {
  min-width: 0;
  max-width: calc(100vw - (var(--sw-modal-gutter) * 2));
}

.modal-box {
  width: min(100%, 660px);
  max-height: calc(100dvh - (var(--sw-modal-gutter) * 2));
  padding: clamp(1.15rem, 3vw, 1.8rem);
  border-radius: var(--sw-panel-radius);
  overscroll-behavior: contain;
}

#modal-discovery .modal-box,
#lead-modal .modal-box {
  width: min(100%, 700px);
}

#modal-contact .modal-box {
  width: min(100%, 680px);
}

.modal-top {
  position: sticky;
  top: calc(-1 * clamp(1.15rem, 3vw, 1.8rem));
  z-index: 5;
  margin-inline: calc(-1 * clamp(1.15rem, 3vw, 1.8rem));
  margin-top: calc(-1 * clamp(1.15rem, 3vw, 1.8rem));
  margin-bottom: 1.2rem;
  padding: clamp(1.15rem, 3vw, 1.8rem);
  padding-bottom: .85rem;
  background: linear-gradient(180deg, var(--bg-surface) 82%, rgba(13, 21, 38, 0));
}

.modal-close-btn {
  min-width: 36px;
  width: 36px;
  height: 36px;
}

/* Native hidden must win over .form-step.active author styles. */
.form-step[hidden] {
  display: none !important;
}

.form-step:not([hidden]).active,
.form-step:not([hidden]) {
  min-width: 0;
}

/* ── In-house calendar / scheduler ──────────────────────────── */
.cal-box-scheduler {
  width: min(1080px, calc(100vw - (var(--sw-modal-gutter) * 2)));
  height: auto;
  max-height: calc(100dvh - (var(--sw-modal-gutter) * 2));
}

.cal-header {
  min-height: 60px;
  gap: 1rem;
}

.cal-title {
  min-width: 0;
}

.cal-scheduler-body {
  min-height: 0;
  overflow: auto;
  padding: clamp(.8rem, 2vw, 1.2rem);
}

.cal-loading {
  z-index: 4;
  min-height: 220px;
}

.sw-calendar-form,
.sw-calendar-layout,
.sw-calendar-panel {
  min-width: 0;
}

.sw-calendar-layout {
  grid-template-columns: minmax(0, .92fr) minmax(0, 1.08fr);
  gap: clamp(.85rem, 2vw, 1.15rem);
  align-items: start;
}

.sw-calendar-panel {
  padding: clamp(.95rem, 2vw, 1.2rem);
  border-radius: 18px;
}

.sw-slot-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  max-height: min(440px, 48dvh);
  scrollbar-gutter: stable;
}

.sw-slot-btn {
  min-width: 0;
  min-height: 64px;
}

.sw-slot-date,
.sw-slot-time {
  overflow-wrap: anywhere;
}

/* ── General component safety ───────────────────────────────── */
.card,
.price-card,
.side-card,
.ad-card,
[class*="-card"] {
  min-width: 0;
}

.btn,
.btn-next-step,
.btn-back,
.btn-submit-form {
  max-width: 100%;
}

/* ── Responsive alignment breakpoints ───────────────────────── */
@media (max-width: 900px) {
  .sw-calendar-layout {
    grid-template-columns: 1fr;
  }

  .sw-slot-grid {
    max-height: 340px;
  }
}

@media (max-width: 700px) {
  :root {
    --sw-modal-gutter: .5rem;
    --sw-section-space: 3rem;
  }

  .field-row {
    grid-template-columns: 1fr;
  }

  .modal-box {
    width: 100%;
    border-radius: 18px;
  }

  .cal-box-scheduler {
    width: 100%;
    height: auto;
    max-height: calc(100dvh - 1rem);
    border-radius: 18px;
  }

  .sw-slot-grid {
    grid-template-columns: 1fr;
    max-height: 300px;
  }

  .form-nav,
  .sw-calendar-actions,
  .success-actions {
    align-items: stretch;
  }

  .form-nav > *,
  .sw-calendar-actions > *,
  .success-actions > * {
    width: 100%;
    justify-content: center;
  }

  input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]):not([type="range"]),
  select,
  textarea {
    font-size: 16px;
  }
}

@media (max-width: 420px) {
  .option-grid {
    grid-template-columns: 1fr;
  }
}
