/**
 * Bloom Legal header and navigation refinements.
 *
 * Kept separate from the minified PaperStreet styles so the custom header
 * work remains reviewable and easy to roll back.
 */

/* Mobile header and navigation */
@media screen and (max-width: 1024px) {
  #header-mobile .header-mobile-inner {
    gap: 12px;
    width: 100%;
    max-width: 1024px;
    margin: 0 auto;
  }

  #header-mobile .header-logo {
    flex: 0 1 244px;
    width: min(58vw, 244px);
    min-width: 0;
  }

  #header-mobile .header-mobile-buttons {
    flex: 0 0 auto;
    gap: 10px;
    margin-left: auto;
  }

  #header-mobile .header-mobile-buttons button {
    margin-left: 0;
  }

  #mobile-navigation {
    overscroll-behavior: contain;
  }

  #mobile-navigation .mobile-navigation-top-inner {
    position: sticky;
    top: 0;
    z-index: 2;
  }

  body.mobile-menu-open {
    overflow: hidden;
  }

  body.mobile-menu-open #textus-btn,
  body.mobile-menu-open #sift-intake-widget {
    opacity: 0 !important;
    visibility: hidden !important;
    pointer-events: none !important;
  }
}

@media screen and (max-width: 480px) {
  #header-mobile .header-mobile-inner {
    gap: 8px;
    padding-right: 16px;
    padding-left: 16px;
  }

  #header-mobile .header-logo {
    flex-basis: 220px;
    width: min(56vw, 220px);
  }

  #header-mobile .header-mobile-buttons {
    gap: 8px;
  }

  /* Keep Text Us clear of the 80px-tall Sift launcher. */
  #textus-btn {
    right: 20px !important;
    bottom: 116px !important;
  }
}

/* Desktop header */
@media screen and (min-width: 1025px) {
  #header-desktop .header-inner {
    display: grid;
    grid-template-columns: clamp(200px, 17vw, 244px) minmax(0, 1fr);
    gap: clamp(18px, 2vw, 34px);
    height: 120px;
    width: 100%;
    max-width: 1600px;
    margin: 0 auto;
    padding-right: clamp(24px, 3vw, 48px);
    padding-left: clamp(24px, 3vw, 48px);
  }

  #header-desktop .header-logo {
    width: 100%;
    min-width: 0;
  }

  #header-desktop .header-right {
    display: grid;
    grid-template-columns: minmax(0, 1fr) clamp(180px, 15vw, 220px);
    gap: clamp(16px, 2vw, 30px);
    align-items: center;
    width: 100%;
    min-width: 0;
  }

  #header-desktop .header-right-bottom,
  #header-desktop .header-right-top {
    order: initial;
    min-width: 0;
  }

  #header-desktop .header-right-bottom {
    display: block;
    grid-column: 1;
    grid-row: 1;
  }

  #header-desktop .header-right-top {
    position: relative;
    display: block;
    grid-column: 2;
    grid-row: 1;
    align-self: center;
    height: 46px;
    width: 100%;
    margin-left: 0;
  }

  #desktop-navigation {
    width: 100%;
    min-width: 0;
  }

  #desktop-navigation .main-navigation-menu {
    gap: clamp(10px, 1vw, 22px);
    align-items: center;
    justify-content: flex-end;
  }

  #desktop-navigation .main-navigation-menu > li {
    display: flex;
    align-items: center;
    white-space: nowrap;
  }

  #desktop-navigation .main-navigation-menu > li::after {
    display: none;
  }

  #desktop-navigation .main-navigation-menu > li > a {
    padding: 12px 0;
    display: inline-flex;
    align-items: center;
    font-size: clamp(0.82rem, 1.05vw, 1rem);
    line-height: 1.2;
  }

  #header-desktop .header-right-top .button,
  #header-desktop .header-right-top #textus-btn-top {
    width: 100%;
    margin: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-align: center;
  }

  #header-desktop .header-right-top .button {
    min-height: 46px;
    padding: 8px 12px;
    font-size: 0.95rem;
    line-height: 1.15;
    border-radius: 6px;
  }

  #header-desktop .header-right-top #textus-btn-top {
    position: absolute !important;
    top: calc(100% + 7px);
    left: 50%;
    width: auto !important;
    min-height: 22px;
    padding: 2px 4px !important;
    margin: 0 auto !important;
    border: 0;
    border-radius: 0;
    background: transparent !important;
    color: #fff;
    font-size: 0.8rem;
    font-weight: 600;
    line-height: 1.15;
    opacity: 0.9;
    cursor: pointer;
    white-space: nowrap;
    transform: translateX(-50%);
    transition: color 160ms ease, opacity 160ms ease;
  }

  #header-desktop .header-right-top #textus-btn-top::before {
    content: 'Prefer to text?';
    margin-right: 0.3em;
    font-weight: 400;
  }

  #header-desktop .header-right-top #textus-btn-top:hover,
  #header-desktop .header-right-top #textus-btn-top:focus-visible {
    color: #f47c16;
    opacity: 1;
    text-decoration: underline;
  }

  #header-desktop .header-right-top #textus-btn-top svg {
    width: 16px;
    height: 16px;
    margin-right: 4px;
  }

  body.scrolled #header-desktop .header-inner {
    height: 88px;
  }

  body.scrolled #header-desktop .header-right-top #textus-btn-top {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
  }
}

/* Match the original Bloom Legal menu separators on wide desktops only. */
@media screen and (min-width: 1280px) {
  #desktop-navigation .main-navigation-menu {
    gap: 0;
    justify-content: flex-end;
  }

  #desktop-navigation .main-navigation-menu > li {
    display: block;
  }

  #desktop-navigation .main-navigation-menu > li::after {
    content: '';
    display: inline-block;
    width: 1px;
    height: 13px;
    margin-right: 10px;
    margin-left: 10px;
    background: rgba(255, 255, 255, 0.3);
    vertical-align: middle;
  }

  #desktop-navigation .main-navigation-menu > li:last-child::after {
    display: none;
  }
}

/* Compact desktop state immediately above the existing mobile breakpoint. */
@media screen and (min-width: 1025px) and (max-width: 1199px) {
  #header-desktop .header-inner {
    grid-template-columns: 188px minmax(0, 1fr);
    gap: 16px;
    height: 116px;
    padding-right: 20px;
    padding-left: 20px;
  }

  #header-desktop .header-right {
    grid-template-columns: minmax(0, 1fr) 174px;
    gap: 14px;
  }

  #desktop-navigation .main-navigation-menu {
    gap: 9px;
  }

  #desktop-navigation .main-navigation-menu > li > a {
    font-size: 0.78rem;
  }

  #header-desktop .header-right-top .button {
    min-height: 42px;
    padding: 6px 8px;
    font-size: 0.82rem;
  }

  #header-desktop .header-right-top #textus-btn-top {
    min-height: 20px;
    padding: 2px !important;
    font-size: 0.72rem;
  }

  #header-desktop .header-right-top {
    height: 42px;
  }
}

/* Keep the replacement homepage phone clear of the header while preserving a
   modest overlap into the following section. */
@media screen and (min-width: 1025px) {
  .home .hero {
    overflow: visible;
    z-index: 2;
  }

  .home .hero-image {
    display: flex;
    align-items: flex-start;
    justify-content: flex-end;
    padding-top: 70px;
    margin-bottom: -45px;
  }

  .home .hero-image img {
    width: 100%;
    max-width: 420px;
    height: auto;
    margin: 0;
  }
}

/* Bloom Legal visual/mobile improvement round — August 2026. */
@media screen and (max-width: 1024px) {
  /* Let the subpage artwork run behind the transparent fixed header again. */
  body:not(.home) #banner {
    margin-top: 0;
  }

  /* The theme's inline banner rule uses a fixed image height. Keep the image
     tied to the actual banner height so extended titles never expose a seam. */
  body:not(.home) #banner > img.banner-bg-image {
    height: 100% !important;
  }
}

@media screen and (max-width: 767px) {
  /* Add the fixed header's 80px overlay area to the banner, while keeping the
     title centered in the same 250px safe content area below it. */
  body:not(.home) #banner {
    height: 330px;
  }

  body:not(.home) #banner .banner-inner {
    padding-top: 80px;
  }

  /* These two unusually long titles need additional vertical breathing room;
     all other subpages retain the standard 250px content area. */
  body.page-id-8500 #banner,
  body.postid-162 #banner {
    height: 420px;
  }

  /* Keep WordPress content media inside the mobile content column. */
  .content img {
    max-width: 100% !important;
    height: auto !important;
  }

  .content .wp-block-embed,
  .content .wp-block-embed__wrapper {
    width: 100%;
    max-width: 100%;
  }

  .content iframe[src*="youtube.com"],
  .content iframe[src*="youtube-nocookie.com"] {
    display: block;
    width: 100% !important;
    max-width: 100%;
    height: auto !important;
    aspect-ratio: 16 / 9;
  }

  /* Preserve the FAQ artwork's source aspect ratio on narrow screens. */
  .home .faqs-left img {
    width: 100%;
    height: auto;
  }

  /* Use a consistent mobile rhythm while retaining the intended overlaps. */
  .home .connecting,
  .home .process,
  .home .legal,
  .home .faqs {
    padding-top: 48px;
  }

  .home .connecting + .coast {
    margin-top: -100px;
  }
}

/* Homepage desktop composition refinements. */
@media screen and (min-width: 1025px) {
  /* Give the longer firm copy more room and optically center the concise
     benefits list beside it. */
  .home .coast-holder {
    display: grid;
    grid-template-columns: minmax(0, 1.1fr) minmax(400px, 0.9fr);
    column-gap: clamp(48px, 5vw, 80px);
    align-items: center;
  }

  .home .coast-left,
  .home .coast-right {
    width: auto;
    min-width: 0;
    padding-right: 0;
    padding-left: 0;
  }

  .home .coast-left {
    max-width: 620px;
  }

  .home .coast-right {
    width: 100%;
    max-width: 520px;
    justify-self: center;
  }

  /* Separate the FAQ copy from the artwork and center the complete copy /
     accordion group against the image rather than its top edge. */
  .home .faqs-holder {
    display: grid;
    grid-template-columns: minmax(0, 0.46fr) minmax(0, 0.54fr);
    column-gap: clamp(48px, 5vw, 76px);
    align-items: center;
  }

  .home .faqs-left,
  .home .faqs-right {
    width: auto;
    min-width: 0;
    padding-right: 0;
    padding-left: 0;
  }

  .home .faqs-left img {
    display: block;
    width: 100%;
    height: auto;
  }
}


/* Keep the masked FAQ artwork proportional at every breakpoint. */
.home .faqs-left img {
  display: block;
  width: 100%;
  max-width: 559px;
  height: auto;
  margin-right: auto;
  margin-left: auto;
}
