/* Small repair layer for the existing site rhythm and responsive polish. */

.home-main-hero-title {
  margin-bottom: 40px !important;
}

.home-main-hero-legacy-title {
  margin-top: 0 !important;
}

@media (max-width: 1024px) {
  html,
  body {
    max-width: 100%;
    overflow-x: clip;
  }

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

  /* Keep floating contact actions useful without covering primary content. */
  .telegram-float,
  .whatsapp-float {
    right: 12px !important;
    width: 48px !important;
    height: 48px !important;
    font-size: 22px !important;
  }

  .telegram-float { bottom: 78px !important; }
  .whatsapp-float { bottom: 20px !important; }

  /* Homepage review cards use a comfortable tablet grid. */
  #google-reviews-track {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }

  #google-reviews-track > * {
    min-width: 0;
  }

  /* Roth artwork remains legible; its action no longer obscures the poster. */
  .home-roth-poster-section {
    padding: 26px 18px !important;
  }

  .home-roth-poster {
    width: min(100%, 760px) !important;
    max-width: 760px !important;
    overflow: visible !important;
  }

  .home-roth-poster img {
    width: 100% !important;
    height: auto !important;
    border-radius: 14px !important;
  }

  .home-roth-poster .home-roth-order-btn {
    position: relative !important;
    inset: auto !important;
    transform: none !important;
    display: flex !important;
    width: min(100%, 330px) !important;
    max-width: none !important;
    min-height: 48px !important;
    margin: 14px auto 0 !important;
    padding: 12px 18px !important;
    font-size: 0.78rem !important;
  }

  .home-roth-poster .home-roth-order-btn:hover {
    transform: translateY(-2px) !important;
  }

  /* About timeline: one consistent, readable tablet structure. */
  .about-page .modern-timeline::before {
    display: none;
  }

  .about-page .timeline-branch,
  .about-page .timeline-branch:nth-child(even) {
    width: 100% !important;
    margin-left: 0 !important;
    grid-template-columns: 112px 62px minmax(0, 1fr) !important;
    align-items: center !important;
    gap: 18px !important;
  }

  .about-page .timeline-brand-image,
  .about-page .timeline-branch:nth-child(even) .timeline-brand-image {
    grid-column: 1 !important;
    grid-row: 1 !important;
    width: 112px !important;
    min-width: 0 !important;
  }

  .about-page .timeline-dot,
  .about-page .timeline-branch:nth-child(even) .timeline-dot {
    grid-column: 2 !important;
    grid-row: 1 !important;
  }

  .about-page .timeline-copy,
  .about-page .timeline-branch:nth-child(even) .timeline-copy {
    grid-column: 3 !important;
    grid-row: 1 !important;
    min-width: 0 !important;
  }

  .about-page .timeline-copy p {
    overflow-wrap: normal;
    word-break: normal;
  }

  /* Franchise hero keeps its storefront image visible on tablets. */
  .franchise-page .franchise-hero {
    min-height: 640px !important;
  }

  .franchise-page .franchise-hero-media {
    inset: 0 0 0 auto !important;
    width: 58% !important;
  }

  .franchise-page .franchise-hero-media img {
    object-position: 62% center !important;
  }

  .franchise-page .franchise-hero .hero-gradient {
    background: linear-gradient(90deg, #fff9f2 0%, #fff9f2 43%, rgba(255, 249, 242, 0.88) 55%, rgba(255, 249, 242, 0.08) 100%) !important;
  }

  .franchise-page .franchise-hero-content {
    padding: 46px 28px !important;
  }

  .franchise-page .franchise-hero-copy {
    width: 54% !important;
    max-width: 540px !important;
    transform: none !important;
  }

  .franchise-page .franchise-hero-copy h1 {
    font-size: clamp(2.7rem, 5.8vw, 4.5rem) !important;
  }

  .franchise-page .franchise-hero-features {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 18px 12px !important;
    margin-bottom: 32px !important;
  }

  .franchise-page .franchise-hero-features > div {
    width: auto !important;
  }

  .franchise-page .franchise-hero-actions {
    align-items: flex-start !important;
  }

  /* Protect compact controls from the shared full-width mobile input rule. */
  .franchise-page #franchiseForm input.custom-radio {
    width: 20px !important;
    min-width: 20px !important;
    max-width: 20px !important;
    height: 20px !important;
    min-height: 20px !important;
    max-height: 20px !important;
    flex: 0 0 20px !important;
    padding: 0 !important;
    margin: 0 !important;
    border-radius: 50% !important;
  }

  .franchise-page #franchiseForm label:has(input.custom-radio) {
    min-width: 0;
    overflow: hidden;
  }
}

@media (max-width: 767px) {
  .telegram-float,
  .whatsapp-float {
    right: 8px !important;
    width: 42px !important;
    height: 42px !important;
    font-size: 19px !important;
  }

  .telegram-float {
    right: 58px !important;
    bottom: max(10px, env(safe-area-inset-bottom)) !important;
  }

  .whatsapp-float {
    right: 8px !important;
    bottom: max(10px, env(safe-area-inset-bottom)) !important;
  }

  #google-reviews {
    padding-bottom: 82px !important;
  }

  #google-reviews-track {
    grid-template-columns: minmax(0, 1fr) !important;
    gap: 14px !important;
  }

  #google-reviews-track > * {
    padding: 18px !important;
  }

  .home-roth-poster-section {
    padding: 20px 12px 26px !important;
  }

  .home-roth-poster {
    width: 100% !important;
  }

  /* Timeline cards use explicit areas, preventing the copy from collapsing. */
  .about-page .modern-timeline {
    gap: 18px !important;
    padding-left: 0 !important;
  }

  .about-page .modern-timeline::before {
    display: block !important;
    left: 26px !important;
  }

  .about-page .timeline-branch,
  .about-page .timeline-branch:nth-child(even) {
    display: grid !important;
    grid-template-columns: 52px minmax(0, 1fr) !important;
    grid-template-rows: auto auto !important;
    grid-template-areas:
      "dot image"
      "dot copy" !important;
    align-items: start !important;
    gap: 10px 14px !important;
    padding: 16px 14px !important;
    border-radius: 16px !important;
  }

  .about-page .timeline-brand-image,
  .about-page .timeline-branch:nth-child(even) .timeline-brand-image {
    grid-area: image !important;
    width: min(100%, 156px) !important;
    height: 74px !important;
    min-height: 74px !important;
    object-fit: contain !important;
    justify-self: start !important;
  }

  .about-page .timeline-dot,
  .about-page .timeline-branch:nth-child(even) .timeline-dot {
    grid-area: dot !important;
    width: 52px !important;
    height: 52px !important;
  }

  .about-page .timeline-copy,
  .about-page .timeline-branch:nth-child(even) .timeline-copy {
    grid-area: copy !important;
    min-width: 0 !important;
    width: 100% !important;
  }

  .about-page .timeline-copy h3 {
    font-size: clamp(1.25rem, 6vw, 1.55rem) !important;
    line-height: 1.15 !important;
    margin-bottom: 6px !important;
  }

  .about-page .timeline-copy p {
    font-size: 0.9rem !important;
    line-height: 1.55 !important;
    overflow-wrap: break-word !important;
  }

  /* Franchise is image-first on phones, matching the homepage hero rhythm. */
  .franchise-page .franchise-hero {
    display: block !important;
    min-height: 0 !important;
    overflow: visible !important;
  }

  .franchise-page .franchise-hero-media {
    position: relative !important;
    inset: auto !important;
    width: 100% !important;
    height: clamp(240px, 72vw, 340px) !important;
  }

  .franchise-page .franchise-hero-media::after {
    content: "";
    position: absolute;
    inset: auto 0 0;
    height: 34%;
    background: linear-gradient(to bottom, rgba(255, 249, 242, 0), #fff9f2);
    pointer-events: none;
  }

  .franchise-page .franchise-hero-media img {
    display: block !important;
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
    object-position: center 52% !important;
  }

  .franchise-page .franchise-hero .hero-gradient {
    display: none !important;
  }

  .franchise-page .franchise-hero-content {
    display: block !important;
    padding: 10px 18px 42px !important;
  }

  .franchise-page .franchise-hero-copy {
    width: 100% !important;
    max-width: none !important;
    transform: none !important;
  }

  .franchise-page .franchise-hero-copy h1 {
    font-size: clamp(2.5rem, 12vw, 3.6rem) !important;
    line-height: 0.98 !important;
    overflow-wrap: normal !important;
    word-break: normal !important;
  }

  .franchise-page .franchise-hero-copy .font-script {
    font-size: clamp(1.8rem, 8vw, 2.65rem) !important;
    white-space: nowrap;
  }

  .franchise-page .franchise-hero-features {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 22px 12px !important;
    margin: 0 0 30px !important;
  }

  .franchise-page .franchise-hero-features > div {
    min-width: 0 !important;
  }

  .franchise-page .franchise-hero-actions {
    display: grid !important;
    grid-template-columns: 1fr !important;
    gap: 18px !important;
  }

  .franchise-page .franchise-hero-actions > button {
    width: 100% !important;
    min-height: 48px !important;
    justify-content: center !important;
  }

  .franchise-page #franchise-form-section > div {
    padding: 22px 16px !important;
    border-radius: 14px !important;
  }

  .franchise-page #franchiseForm .grid {
    min-width: 0;
  }

  .franchise-page #franchiseForm input,
  .franchise-page #franchiseForm select,
  .franchise-page #franchiseForm textarea {
    max-width: 100%;
  }
}

@media (max-width: 380px) {
  .franchise-page .franchise-hero-copy .font-script {
    font-size: 1.65rem !important;
  }

  .about-page .timeline-branch,
  .about-page .timeline-branch:nth-child(even) {
    grid-template-columns: 46px minmax(0, 1fr) !important;
    gap: 9px 11px !important;
  }

  .about-page .timeline-dot,
  .about-page .timeline-branch:nth-child(even) .timeline-dot {
    width: 46px !important;
    height: 46px !important;
  }
}
