.yc-template-main {
  padding-top: 0;
}

.yc-page-shell {
  padding-block: var(--yc-section-padding-sm) var(--yc-section-padding);
}

.yc-page-shell .wp-block-post-title,
.yc-page-shell > h1:first-child,
.wp-block-post-content > h1:first-child {
  max-width: var(--yc-container-lg);
  margin-inline: auto;
  margin-bottom: var(--yc-space-8);
}

.home .yc-page-shell,
.front-page .yc-page-shell {
  padding-top: 0;
}

/* Give existing page content a premium rhythm without changing its text or structure. */
.wp-block-post-content > h2 {
  margin-top: var(--yc-section-padding-sm);
  margin-bottom: var(--yc-space-6);
}

.wp-block-post-content > h2:first-child {
  margin-top: 0;
}

.wp-block-post-content > h3 {
  margin-top: var(--yc-space-8);
  margin-bottom: var(--yc-space-3);
}

.wp-block-post-content > p,
.wp-block-post-content > ul,
.wp-block-post-content > ol {
  color: var(--yc-muted);
  font-size: var(--yc-text-lg);
}

/* Existing homepage first block/hero. */
.home .wp-block-post-content > :first-child,
.front-page .wp-block-post-content > :first-child {
  margin-top: 0;
}

.home .wp-block-post-content > h2:first-of-type,
.front-page .wp-block-post-content > h2:first-of-type {
  position: relative;
  max-width: var(--yc-container-lg);
  padding-top: clamp(4.5rem, 10vw, 8.5rem);
  margin-top: 0;
  font-size: var(--yc-text-4xl);
}

.home .wp-block-post-content > h2:first-of-type::before,
.front-page .wp-block-post-content > h2:first-of-type::before {
  content: "";
  position: absolute;
  inset: 0 calc(50% - 50vw) auto;
  z-index: -1;
  height: min(62vw, 620px);
  background: var(--yc-gradient-soft);
  border-bottom: 1px solid rgba(2, 35, 94, 0.08);
}

.home .wp-block-post-content > h2:first-of-type + h3,
.front-page .wp-block-post-content > h2:first-of-type + h3 {
  max-width: 720px;
  margin-inline: auto;
  color: var(--yc-muted);
  font-family: var(--yc-font-body);
  font-size: clamp(1.15rem, 1rem + 0.55vw, 1.55rem);
  font-weight: 500;
  line-height: 1.45;
  letter-spacing: 0;
}

/* Page-specific shells. */
.yc-template--templates .wp-block-post-content > h1,
.yc-template--calculator .wp-block-post-content > h1,
.yc-template--options .wp-block-post-content > h1 {
  max-width: var(--yc-container-lg);
  margin-bottom: var(--yc-space-10);
}

.yc-template--calculator .wp-block-post-content,
.yc-template--templates .wp-block-post-content,
.yc-template--options .wp-block-post-content {
  padding-bottom: var(--yc-section-padding);
}

@media (max-width: 720px) {
  .yc-page-shell {
    padding-block: var(--yc-space-12) var(--yc-space-16);
  }

  .home .wp-block-post-content > h2:first-of-type,
  .front-page .wp-block-post-content > h2:first-of-type {
    padding-top: var(--yc-space-16);
  }
}

/* v0.2 homepage section system.
   Existing page text is not edited; JS wraps top-level home blocks into visual sections. */
.home .yc-page-shell,
.front-page .yc-page-shell,
.yc-template--front.yc-page-shell {
  padding-block: 0;
}

.yc-home-section {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: var(--yc-section-min-height);
  padding-block: clamp(4rem, 8vh, 7rem);
  scroll-margin-top: calc(var(--yc-header-height) + var(--yc-admin-offset));
}

.yc-home-section > * {
  margin-left: auto;
  margin-right: auto;
}

.yc-home-section:nth-child(odd)::before {
  content: "";
  position: absolute;
  inset: 0 calc(50% - 50vw);
  z-index: -1;
  background: linear-gradient(180deg, rgba(247,250,252,0.72), rgba(255,255,255,0.96));
  border-block: 1px solid rgba(2, 35, 94, 0.055);
}

.yc-home-section:first-child {
  text-align: center;
  min-height: calc(100svh - var(--yc-admin-offset));
  padding-top: clamp(5rem, 11vh, 8rem);
  background: transparent;
}

.yc-home-section:first-child::before {
  content: "";
  position: absolute;
  inset: 0 calc(50% - 50vw);
  z-index: -1;
  background:
    radial-gradient(circle at 18% 18%, rgba(2, 129, 219, 0.18), transparent 28%),
    radial-gradient(circle at 82% 10%, rgba(6, 93, 188, 0.10), transparent 32%),
    linear-gradient(180deg, #ffffff 0%, #f4f9fe 100%);
  border-bottom: 1px solid rgba(2, 35, 94, 0.08);
}

.yc-home-section:first-child h2:first-child,
.home .wp-block-post-content > h2:first-of-type,
.front-page .wp-block-post-content > h2:first-of-type {
  padding-top: 0;
  font-size: var(--yc-text-display);
  max-width: 13ch;
  margin-top: 0;
  margin-bottom: var(--yc-space-5);
}

.home .wp-block-post-content > h2:first-of-type::before,
.front-page .wp-block-post-content > h2:first-of-type::before {
  content: none;
}

.yc-home-section:first-child h3,
.home .wp-block-post-content > h2:first-of-type + h3,
.front-page .wp-block-post-content > h2:first-of-type + h3 {
  max-width: 780px;
  color: var(--yc-deep-navy);
  opacity: 0.94;
  font-family: var(--yc-font-body);
  font-size: clamp(1.15rem, 0.96rem + 0.78vw, 1.65rem);
  font-weight: 700;
  line-height: 1.35;
  letter-spacing: -0.02em;
}

.yc-home-section > h2:first-child,
.wp-block-post-content > h2 {
  text-align: center;
}

.yc-home-section .wp-block-columns {
  width: min(100%, var(--yc-container-xl));
}

/* Keep long solution sections readable instead of forcing cramped 100vh. */
.yc-home-section:has(ul),
.yc-home-section:has(.jet-form-builder) {
  justify-content: flex-start;
}

@media (max-width: 900px) {
  .yc-home-section {
    min-height: auto;
    padding-block: var(--yc-section-padding-sm);
  }

  .yc-home-section:first-child {
    min-height: calc(86svh - var(--yc-admin-offset));
  }
}

.yc-home-section > .wp-block-buttons {
  justify-content: center;
}

.yc-home-section > .wp-block-columns {
  align-items: stretch !important;
}


/* v0.3: reliable full-viewport front-page hero and laptop typography scale. */
.yc-template--front .wp-block-post-content.yc-home-enhanced {
  display: block;
}

.yc-template--front .yc-home-section {
  min-height: calc(100svh - var(--yc-header-height) - var(--yc-admin-offset));
  padding-block: clamp(3rem, 7vh, 6rem);
}

.yc-template--front .yc-home-section:first-child {
  min-height: calc(100svh - var(--yc-header-height) - var(--yc-admin-offset));
  justify-content: center;
  padding-block: clamp(2rem, 4vh, 4.5rem);
}

.yc-template--front .yc-home-section:first-child > h2:first-child {
  max-width: min(980px, 92vw);
  font-size: var(--yc-text-display);
  line-height: 1.03;
}

.yc-template--front .yc-home-section:first-child > h3 {
  max-width: min(980px, 92vw);
  margin-bottom: var(--yc-space-5);
}

@media (max-width: 1440px) and (max-height: 820px) {
  .yc-template--front .yc-home-section:first-child > h2:first-child {
    max-width: 940px;
  }

  .yc-template--front .yc-home-section:first-child > h3,
  .home .wp-block-post-content > h2:first-of-type + h3,
  .front-page .wp-block-post-content > h2:first-of-type + h3 {
    font-size: clamp(1.05rem, 0.9rem + 0.55vw, 1.28rem);
    line-height: 1.30;
  }

  .yc-template--front .yc-home-section > h2:first-child,
  .wp-block-post-content > h2 {
    margin-bottom: var(--yc-space-5);
  }
}

@media (max-width: 900px) {
  .yc-template--front .yc-home-section,
  .yc-template--front .yc-home-section:first-child {
    min-height: auto;
    padding-block: var(--yc-section-padding-sm);
  }

  .yc-template--front .yc-home-section:first-child {
    min-height: calc(78svh - var(--yc-header-height) - var(--yc-admin-offset));
  }
}

/* v0.4: tighter editorial rhythm for existing page content.
   Keep page text intact while reducing the large gaps between paragraphs, labels and lists. */
.wp-block-post-content :where(p, ul, ol) {
  margin-top: 0;
  margin-bottom: 0.72rem;
}

.wp-block-post-content :where(p + p, p + ul, p + ol, ul + p, ol + p) {
  margin-top: 0.45rem;
}

.wp-block-post-content :where(ul, ol) {
  padding-left: 1.15rem;
}

.wp-block-post-content li {
  margin-block: 0.22rem;
  line-height: 1.52;
}

.wp-block-post-content :where(h2 + p, h3 + p, h4 + p) {
  margin-top: 0;
}

.wp-block-post-content :where(p:empty) {
  display: none !important;
}

.yc-template--front .wp-block-post-content :where(.wp-block-column > p, .wp-block-column > ul, .wp-block-column > ol) {
  margin-bottom: 0.58rem;
}

.yc-template--front .wp-block-post-content .wp-block-column :where(h2, h3, h4) {
  margin-bottom: 0.65rem;
}

/* v0.4: force the first visual area of the homepage to occupy one viewport on desktop/laptop.
   Works even when JS enhancement is cached or when the front page template is not detected. */
@media (min-width: 901px) {
  body.home .yc-template-main > .wp-block-post-content,
  body.front-page .yc-template-main > .wp-block-post-content,
  .yc-template--front > .wp-block-post-content {
    position: relative;
  }

  body.home .wp-block-post-content > h2:first-of-type,
  body.front-page .wp-block-post-content > h2:first-of-type,
  .yc-template--front .wp-block-post-content > h2:first-of-type {
    padding-top: clamp(7rem, 15vh, 11rem);
  }

  body.home .wp-block-post-content:not(.yc-home-enhanced) > h2:first-of-type,
  body.front-page .wp-block-post-content:not(.yc-home-enhanced) > h2:first-of-type,
  .yc-template--front .wp-block-post-content:not(.yc-home-enhanced) > h2:first-of-type {
    min-height: calc(100svh - var(--yc-header-height) - var(--yc-admin-offset));
    display: flex;
    align-items: center;
    justify-content: flex-end;
    flex-direction: column;
    text-align: center;
    margin-bottom: 0;
    padding-bottom: clamp(1rem, 2.5vh, 2rem);
  }

  body.home .wp-block-post-content:not(.yc-home-enhanced) > h2:first-of-type + h3,
  body.front-page .wp-block-post-content:not(.yc-home-enhanced) > h2:first-of-type + h3,
  .yc-template--front .wp-block-post-content:not(.yc-home-enhanced) > h2:first-of-type + h3 {
    margin-top: calc(-1 * clamp(18rem, 36vh, 25rem));
    margin-bottom: var(--yc-space-5);
    position: relative;
    z-index: 2;
  }

  body.home .wp-block-post-content:not(.yc-home-enhanced) > h2:first-of-type + h3 + .wp-block-buttons,
  body.front-page .wp-block-post-content:not(.yc-home-enhanced) > h2:first-of-type + h3 + .wp-block-buttons,
  .yc-template--front .wp-block-post-content:not(.yc-home-enhanced) > h2:first-of-type + h3 + .wp-block-buttons {
    position: relative;
    z-index: 2;
    justify-content: center;
    margin-bottom: clamp(9rem, 24vh, 17rem);
  }
}

@media (max-width: 1440px) and (max-height: 820px) {
  .wp-block-post-content :where(p, ul, ol) {
    margin-bottom: 0.55rem;
  }

  .wp-block-post-content li {
    margin-block: 0.16rem;
    line-height: 1.42;
  }

  .wp-block-post-content > h3 {
    margin-top: 1.15rem;
    margin-bottom: 0.5rem;
  }
}
