/* Cross-device layout refinements — all ECP pages */

html {
  overflow-x: clip;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  overflow-x: clip;
}

main,
.wrap,
.section,
.split,
.hero-grid,
.booking-layout,
.explorer,
.demo-panels,
.proof-grid,
.footer-top,
.dash-shell {
  min-width: 0;
}

h1,
h2,
.section-heading h2 {
  text-wrap: balance;
}

p,
.lead,
.faqs details p {
  overflow-wrap: anywhere;
}

.site-header .wrap.nav {
  padding-inline: max(0px, env(safe-area-inset-left)) max(0px, env(safe-area-inset-right));
}

/* Elite Professionals Clinics header lockup */
.site-header .brand {
  width: auto;
  max-width: min(260px, 52vw);
}
.site-header .brand img {
  width: 100%;
  height: auto;
  max-height: 52px;
  object-fit: contain;
  object-position: left center;
}
.site-footer .brand {
  display: none;
}

@media (max-width: 680px) {
  .site-header .brand {
    max-width: min(200px, 58vw);
  }
  .site-header .brand img {
    max-height: 44px;
  }
}

.skip {
  left: max(12px, env(safe-area-inset-left));
}

.menu-toggle,
.nav nav a,
.journey-tabs button,
.time-slots button,
.calendar-days button,
.icon-button {
  min-height: 44px;
}

.journey-tabs {
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  overscroll-behavior-x: contain;
}

/* Hero film overlay — full-bleed; play bottom-centre on desktop */
.hero-visual .film-play{
  inset:0;
  width:100%;
  height:100%;
  padding:28px 20px 26px;
  justify-content:flex-end;
  align-items:center;
  text-align:center;
  background:linear-gradient(180deg,transparent 48%,#062f32aa 100%);
}
.hero-visual .film-play .play{margin-bottom:10px}

/* IVY chip: kit bottom-right on desktop (bottom:215px), clear of play */
.hero-visual .floating-status{
  top:auto;
  right:18px;
  bottom:215px;
  left:auto;
}

@media (max-width:680px){
  .home-hero .hero-visual,
  .hero-visual{
    height:clamp(210px,56vw,248px);
    max-height:248px;
    min-height:0;
    margin-bottom:18px;
  }
  .hero-visual>img{
    object-position:70% 18%;
  }
  /* Mobile: play bottom-left */
  .hero-visual .film-play{
    inset:0;
    padding:16px 14px 18px;
    justify-content:flex-end;
    align-items:flex-start;
    text-align:left;
  }
  .hero-visual .film-play .play{
    width:56px;
    height:56px;
    font-size:20px;
    margin-bottom:6px;
  }
  .hero-visual .film-play > span:last-child{
    font-size:.9rem;
    line-height:1.25;
  }
  /* Mobile: chip top-left — play stays bottom-left; avoids covering the face */
  .hero-visual .floating-status{
    top:12px;
    left:max(10px, env(safe-area-inset-left));
    right:auto;
    bottom:auto;
    max-width:min(150px,52%);
    padding:10px;
    gap:6px;
    font-size:.72rem;
    align-items:flex-start;
    text-align:left;
  }
  .hero-visual .floating-status .ivy-mark{
    font-size:1rem;
    align-self:flex-start;
  }
  .hero-visual .floating-status small{font-size:.62rem}
}

.visually-hidden{
  position:absolute!important;
  width:1px!important;
  height:1px!important;
  padding:0!important;
  margin:-1px!important;
  overflow:hidden!important;
  clip:rect(0,0,0,0)!important;
  white-space:nowrap!important;
  border:0!important;
}
/* Film modal — video only, floating close */
#film-dialog {
  position: fixed;
  inset: 0;
  width: min(1120px, calc(100% - 24px));
  max-width: none;
  max-height: none;
  margin: auto;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: #fff;
  box-shadow: none;
  overflow: visible;
}
#film-dialog::backdrop {
  background: #041a1ccc;
  backdrop-filter: blur(8px);
}
#film-dialog > .eyebrow,
#film-dialog > h2,
#film-dialog > .button,
#film-dialog #film-content > p,
#film-dialog #film-content > a {
  display: none !important;
}
#film-dialog #film-content {
  margin: 0;
  line-height: 0;
}
#film-dialog video {
  display: block;
  width: 100%;
  max-height: min(86dvh, 820px);
  height: auto;
  border-radius: 14px;
  background: #000;
  box-shadow: 0 24px 80px #0008;
}
#film-dialog .dialog-close {
  position: fixed;
  top: max(14px, env(safe-area-inset-top));
  right: max(14px, env(safe-area-inset-right));
  z-index: 2;
  width: 48px;
  height: 48px;
  border: 0;
  border-radius: 50%;
  background: rgba(250, 248, 242, 0.92);
  color: var(--petrol, #062f32);
  font-size: 1.7rem;
  line-height: 1;
  box-shadow: 0 8px 28px #0005;
}
#film-dialog .dialog-close:hover {
  background: #fff;
}

@media (max-width: 1100px) {
  .features {
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr));
  }

  .features article {
    border-right: 0 !important;
    padding-inline: 0 !important;
    padding-block: 4px 8px;
  }

  .four-outcomes {
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr));
  }

  .journey-cards {
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr));
  }
}

@media (max-width: 820px) {
  .hero-grid {
    grid-template-columns: minmax(0, 1fr) !important;
  }

  .ivy-word {
    flex-wrap: wrap;
    gap: 14px 18px;
  }

  .ivy-word span {
    border-left: 0;
    padding-left: 0;
    max-width: none;
    flex: 1 1 100%;
  }

  .page-hero .hero-art {
    height: clamp(220px, 42vw, 360px);
  }

  .proof-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 900px) and (min-width: 681px) {
  .nav {
    flex-wrap: wrap;
    row-gap: 8px;
  }

  .nav nav {
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 12px 18px;
  }

  .booking-aside {
    display: block;
  }

  .booking-aside .photo {
    height: clamp(200px, 35vw, 320px);
    margin-bottom: 24px;
  }

  .demo-controls {
    flex-wrap: wrap;
    gap: 12px;
  }

  .demo-controls .button {
    flex: 1 1 auto;
  }
}

@media (max-width: 390px) {
  .wrap {
    width: calc(100% - 28px);
  }

  h1,
  .hero-copy h1,
  .page-hero h1 {
    font-size: clamp(1.32rem, 5.8vw, 1.55rem);
  }

  h2,
  .section-heading h2 {
    font-size: clamp(1.08rem, 4.1vw, 1.26rem);
  }

  .hero-copy .actions {
    flex-direction: column;
    align-items: stretch;
  }

  .hero-copy .actions .button,
  .actions .button,
  .explorer .button,
  .closing .button {
    width: 100%;
  }

  .footer-top nav {
    grid-template-columns: 1fr;
  }

  .record-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
  }

  .record-row strong {
    max-width: 100%;
    text-align: left;
  }

  .booking-progress {
    flex-wrap: wrap;
    row-gap: 10px;
    justify-content: flex-start;
  }

  .copy-row {
    flex-direction: column;
  }

  .copy-row .button {
    width: 100%;
  }

  .stage-number {
    float: none;
    display: inline-block;
    margin-bottom: 8px;
  }
}

@media (max-width: 900px) and (orientation: landscape) {
  .home-hero .hero-grid {
    min-height: 0;
  }

  .hero-copy {
    padding-block: 28px 20px;
  }

  .home-hero .hero-visual,
  .hero-visual {
    height: clamp(200px, 48vh, 260px);
    max-height: 260px;
    min-height: 0;
  }

  .page-hero .split {
    grid-template-columns: 1fr 1fr;
    align-items: center;
  }

  .section {
    padding-block: clamp(36px, 6vh, 56px);
  }
}

@media (max-height: 520px) and (max-width: 900px) {
  .section {
    padding-block: 36px;
  }

  .page-hero .split > div:first-child {
    padding-block: 28px 16px;
  }
}

@media (min-width: 901px) and (max-width: 1100px) {
  .nav nav {
    gap: 14px;
  }

  .nav nav a {
    white-space: normal;
    text-align: center;
    line-height: 1.25;
    max-width: 8.5rem;
  }
}

@media (min-width: 1200px) {
  .reading,
  .section-heading {
    max-width: min(800px, 100%);
  }
}

/* Supporting copy — global p reset clears margin-top */
p.fine {
  margin-top: 1.125rem;
}

.home-hero .hero-copy > p.fine {
  margin-top: 0;
}

/* —— Mobile site pass (≤680px) —— */
@media (max-width: 680px) {
  /* Sitewide headings — compact mobile scale (both basecamps, all pages) */
  h1,
  .hero-copy h1,
  .page-hero h1,
  .closing h2 {
    font-size: clamp(1.42rem, 6vw, 1.72rem);
    line-height: 1.1;
    margin-bottom: 14px;
  }

  h2,
  .section-heading h2 {
    font-size: clamp(1.16rem, 4.4vw, 1.38rem);
    line-height: 1.14;
    margin-bottom: 12px;
  }

  h3 {
    font-size: 0.94rem;
    line-height: 1.22;
    margin-bottom: 8px;
  }

  .demo-stage > h2,
  .explorer h2,
  .booking-aside h2,
  .roadmap li h3,
  .dash-main h3 {
    font-size: clamp(1.16rem, 4.4vw, 1.38rem);
  }

  .features h3,
  .four-outcomes h3,
  .journey-cards h3 {
    font-size: 0.9rem;
  }

  html {
    scroll-padding-top: 82px;
  }

  body {
    padding-bottom: calc(76px + env(safe-area-inset-bottom, 0px));
  }

  .site-header .nav {
    min-height: 72px;
  }

  .section {
    padding-block: clamp(38px, 11vw, 46px);
  }

  .section-heading {
    margin-bottom: 22px;
  }

  .section-heading .lead {
    font-size: 0.98rem;
  }

  .lead {
    font-size: 1rem;
  }

  /* Home hero: eyebrow → headline → image → body → CTAs (display:contents in kit) */
  .home-hero .hero-grid {
    padding-top: 8px;
    min-height: 0;
  }

  .home-hero .hero-copy h1 {
    max-width: none;
    font-size: clamp(1.42rem, 6vw, 1.72rem);
  }

  .home-hero .hero-copy .lead {
    font-size: 0.88rem;
    line-height: 1.48;
    margin-bottom: 12px;
    color: var(--muted);
  }

  .home-hero .hero-copy .actions {
    flex-direction: column;
    align-items: stretch;
    width: 100%;
    margin: 8px 0 12px;
    gap: 10px;
  }

  .home-hero .hero-copy .actions .button {
    width: 100%;
    flex: none;
    min-width: 0;
  }

  .home-hero .hero-copy > p.fine {
    font-size: 0.82rem;
    line-height: 1.45;
  }

  /* Hero film + IVY — override kit partial-width film strip */
  .home-hero .hero-visual .film-play {
    width: 100%;
    inset: 0;
    padding: 10px 12px 12px;
    background: linear-gradient(180deg, transparent 42%, #062f32b8 100%);
  }

  .home-hero .hero-visual .film-play .play {
    width: 50px;
    height: 50px;
  }

  .home-hero .hero-visual .film-play .play svg {
    width: 20px;
    height: 24px;
  }

  .home-hero .hero-visual .film-play > span:last-child {
    font-size: 0.78rem;
    max-width: 11.5rem;
  }

  .home-hero .hero-visual .film-play small {
    font-size: 0.62rem;
    margin-top: 4px;
    opacity: 0.92;
  }

  .home-hero .hero-visual .floating-status {
    padding: 8px 9px;
    gap: 4px;
    max-width: min(138px, 48%);
  }

  .home-hero .hero-visual .floating-status strong {
    font-size: 0.68rem;
    font-weight: 700;
    line-height: 1.25;
  }

  .territory-promise {
    margin-top: 14px;
    padding: 14px 0;
    font-size: 0.82rem;
  }

  /* Inner pages */
  .page-hero .split > div:first-child {
    padding: 28px 0 18px;
  }

  .page-hero .hero-art {
    height: clamp(200px, 52vw, 270px);
    margin-bottom: 18px;
  }

  .page-hero .hero-art img {
    border-radius: 16px;
  }

  .product-showcase .photo {
    max-height: min(52vh, 300px);
    aspect-ratio: 16 / 11;
  }

  .benefit-row {
    margin: 18px 0;
    padding-block: 16px;
  }

  .ivy-word {
    font-size: clamp(1.65rem, 7.2vw, 1.95rem);
  }

  .phone {
    width: min(100%, 340px);
  }

  .roadmap > img {
    max-height: 200px;
    object-fit: cover;
  }

  .roadmap ol {
    padding: 16px;
    gap: 12px;
  }

  .roadmap li {
    padding: 18px 16px;
  }

  .explorer {
    padding: 18px 16px;
    gap: 20px;
  }

  .demo-stage {
    padding: 18px 16px;
  }

  .booking-panel {
    padding: 20px 16px;
  }

  .mobile-sticky {
    padding: 10px 16px max(10px, env(safe-area-inset-bottom));
  }

  .footer-top nav {
    gap: 14px 16px;
  }

  /* Territory checker (Next) — shared booking / review blocks */
  #territory-review.booking-layout,
  #territory-review .booking-layout {
    margin-top: 8px;
  }

  #territory-review .booking-aside .photo {
    height: clamp(180px, 48vw, 220px);
  }

  #territory-review .booking-panel {
    padding: 18px 16px;
  }

  #territory-review .calendar-days button,
  #territory-review .time-slots button {
    min-height: 44px;
  }
}

/* Tablet / small landscape — avoid 540px+ hero mins from kit */
@media (max-width: 820px) and (min-width: 681px) {
  .home-hero .hero-grid {
    min-height: 0;
    gap: 20px;
  }

  .home-hero .hero-visual {
    min-height: 0;
    height: clamp(260px, 40vw, 340px);
    max-height: 340px;
    border-radius: 18px;
  }

  .home-hero .hero-copy {
    padding-block: 40px 24px;
  }

  .home-hero .hero-copy h1 {
    font-size: clamp(2rem, 4.2vw, 2.6rem);
  }
}