/* Service first-view normalization pilot 2026-11-21.
   Opt-in via body.ip-fv-ready. Not applied to foreign pages.
   W=approved wrapped layouts; S=unchanged DOM direct children; O=service hub.
   Keep existing common.css/pages.css/review.css/service-price.css untouched. */
body.ip-fv-ready {
  --ip-fv-min:370px;
  --ip-fv-max:470px;
  --ip-fv-subtract:515px;
  --ip-fv-card-height:326px;
  --ip-fv-head-font:22px;
  --ip-fv-head-line:1.42;
}
body.ip-fv-ready.page-medical {--ip-fv-head-font:21px;--ip-fv-head-line:1.40}
body.ip-fv-ready.ip-fv-standard {--ip-fv-crumb:57px}

/* W types: extract v6/general and v1/medical rules into one common sheet. */
body.ip-fv-ready main#main-content > :is(.general-firstview,.medical-firstview){display:contents}
@media (min-width:881px) {
  body.ip-fv-ready main#main-content > :is(.general-firstview,.medical-firstview){
    display:flex;flex-direction:column;
    min-height:min(calc(100vh - 77px),955px);
    min-height:min(calc(100dvh - 77px),955px)
  }
  body.ip-fv-ready :is(.general-firstview,.medical-firstview) > .breadcrumb {flex:0 0 auto}
  body.ip-fv-ready :is(.general-firstview,.medical-firstview) > .ip-service-quickprice-section {flex:1 0 auto}
  body.ip-fv-ready main#main-content > :is(.general-firstview,.medical-firstview) > .hero {
    flex:0 0 auto;height:auto;
    min-height:clamp(var(--ip-fv-min),calc(100vh - var(--ip-fv-subtract)),var(--ip-fv-max));
    min-height:clamp(var(--ip-fv-min),calc(100dvh - var(--ip-fv-subtract)),var(--ip-fv-max));
    padding:28px 0
  }
  body.ip-fv-ready :is(.general-firstview,.medical-firstview) .ip-service-quickprice {
    grid-template-columns:minmax(0,.97fr) minmax(0,1.03fr);
    min-height:var(--ip-fv-card-height)
  }
  body.ip-fv-ready :is(.general-firstview,.medical-firstview) .ip-service-quickprice-primary{padding:23px 29px 21px}
  body.ip-fv-ready :is(.general-firstview,.medical-firstview) .ip-service-quickprice-secondary{padding:22px 29px 20px}
  body.ip-fv-ready :is(.general-firstview,.medical-firstview) .ip-service-quickprice-heading{
    font-size:var(--ip-fv-head-font);line-height:var(--ip-fv-head-line);letter-spacing:-.015em;margin-bottom:11px
  }
  body.ip-fv-ready :is(.general-firstview,.medical-firstview) .ip-service-quickprice-note{font-size:13px;line-height:1.68}
  body.ip-fv-ready :is(.general-firstview,.medical-firstview) .ip-service-quickprice-links{font-size:13px;line-height:1.65;gap:6px 16px;margin-top:11px}
  body.ip-fv-ready :is(.general-firstview,.medical-firstview) .ip-service-quickprice-rewrite{margin-bottom:7px;line-height:1.5}
  body.ip-fv-ready :is(.general-firstview,.medical-firstview) .ip-service-quickprice-rate{margin-bottom:9px}
  body.ip-fv-ready :is(.general-firstview,.medical-firstview) .ip-service-quickprice-trust li{padding:11px 20px 12px}
  body.ip-fv-ready.page-medical .medical-firstview .ip-service-quickprice-note .ip-timecode-policy{display:block;margin-top:5px}
}
body.ip-fv-ready.page-general .general-firstview .ip-service-quickprice-note .ip-timecode-policy{display:block;margin-top:5px}
@media (max-width:880px){
  body.ip-fv-ready.page-general main#main-content > .general-firstview > .hero {height:auto;min-height:330px;padding:28px 0}
  body.ip-fv-ready.page-general .general-firstview .ip-service-quickprice-note{line-height:1.68}
}

/* S types: preserve direct child relationships and all specialist card styles.
   No wrapper element is inserted, no broad .hero or global .ip-service-quickprice selectors.
   Content can enlarge hero beyond minimum; do not force a fixed height. */
@media (min-width:881px){
 body.ip-fv-ready.ip-fv-standard main#main-content > section.hero{
    height:auto;
    min-height:clamp(var(--ip-fv-min),calc(100vh - var(--ip-fv-subtract)),var(--ip-fv-max));
    min-height:clamp(var(--ip-fv-min),calc(100dvh - var(--ip-fv-subtract)),var(--ip-fv-max));
    padding-top:28px;padding-bottom:28px;
 }
 /* Theme20 places 70px above and below hero-inner; replace this with the
    shared compact rhythm instead of stacking a second 28px on the hero. */
 body.ip-fv-ready.ip-fv-standard.ip-theme20 main#main-content > section.hero{padding-top:0;padding-bottom:0}
 body.ip-fv-ready.ip-fv-standard.ip-theme20 main#main-content > section.hero .hero-inner{padding-top:28px;padding-bottom:28px}
 body.ip-fv-ready.ip-fv-standard main#main-content > section.ip-service-quickprice-section {
    min-height:max(var(--ip-fv-card-height),calc(100dvh - 77px - var(--ip-fv-crumb, 0px) - clamp(var(--ip-fv-min),calc(100dvh - var(--ip-fv-subtract)),var(--ip-fv-max))));
 }
}
/* O type is deliberately isolated: it has a four-card services grid, not a quick-price card. */
@media (min-width:881px){
 body.ip-fv-ready.ip-fv-overview main#main-content > section.hero{
    height:auto;
    min-height:clamp(350px,calc(100dvh - 560px),420px);
    padding-top:28px;padding-bottom:28px;
 }
}

/* Narrow phones: two legacy heroes with fixed 330px min-height contain more text.
   Let their height grow naturally instead of allowing the text to extend under the price card. */
@media (max-width:359px){
  body.ip-fv-ready.page-specialty-overview main#main-content > section.hero,
  body.ip-fv-ready.page-summary main#main-content > section.hero {
    height:auto !important;
    min-height:330px !important;
  }
}
