/* Dedicated mobile composition for the homepage. Desktop remains in styles.css. */
.mobile-cta-label,
.mobile-pricing-tabs,
.mobile-footer-support,
.mobile-final-title,
.custom-story-more,
.mobile-menu-overlay {
  display: none;
}

.home-secondary-cta > span[aria-hidden="true"] {
  display: none;
}

@media (max-width: 767px) {
  :root {
    --mobile-page-padding: 20px;
    --mobile-section-gap: 54px;
    --mobile-card-gap: 14px;
    --mobile-navy: #062a61;
    --mobile-orange: #ff6a00;
    --mobile-orange-hover: #e95f00;
    --mobile-blue: #2f80ed;
    --mobile-blue-soft: #eaf4ff;
    --mobile-cream: #fff8ec;
    --mobile-green-soft: #eff8ea;
    --mobile-muted: #62758f;
    --mobile-line: #e2eaf3;
    --mobile-shadow-card: 0 10px 28px rgba(20, 55, 92, 0.08);
    --page-padding: var(--mobile-page-padding);
  }

  html { scroll-padding-top: 84px; }
  body.is-home { overflow-x: clip; background: #fff; }
  body.has-mobile-menu { overflow: hidden; }
  .desktop-cta-label { display: none !important; }
  .mobile-cta-label { display: inline; }

  .home-view.is-visible { display: flex; flex-direction: column; }
  .home-view > .home-hero-section { order: 1; }
  .home-view > .home-categories { order: 2; }
  .home-view > .home-popular { order: 3; }
  .home-view > .home-benefits { order: 4; }
  .home-view > .home-custom-story { order: 5; }
  .home-view > .home-testimonials { order: 6; }
  .home-view > .home-formats { order: 7; }
  .home-view > .home-final-cta { order: 8; }
  .home-view > .how-section { order: 9; }
  .home-view > .home-library { order: 10; }
  .home-view > .about-section { order: 11; }

  /* Header and accessible drawer */
  .site-header,
  .site-header.is-scrolled,
  body.is-home .site-header,
  body.is-home .site-header.is-scrolled {
    position: sticky;
    top: 0;
    z-index: 100;
    height: 76px;
    background: rgba(255, 255, 255, 0.94);
    border-bottom: 1px solid rgba(226, 234, 243, 0.72);
    box-shadow: none;
    -webkit-backdrop-filter: blur(14px);
    backdrop-filter: blur(14px);
  }

  .site-header .header-inner,
  body.is-home .site-header .header-inner {
    width: 100%;
    height: 76px;
    padding: 8px var(--mobile-page-padding);
    grid-template-columns: 1fr auto;
  }

  .site-header .home-logo,
  .site-header.is-scrolled .home-logo,
  body.is-home .site-header .home-logo {
    width: 108px;
    height: auto;
    max-width: 108px;
  }

  .header-actions { gap: 10px; }
  .home-search-button,
  .menu-toggle {
    width: 46px;
    height: 46px;
    min-width: 46px;
    border-radius: 15px;
  }
  .home-search-button { background: #f5f8fc; border: 0; box-shadow: none; }
  .menu-toggle { display: grid; color: var(--mobile-navy); background: #fff; border: 1px solid #dfe7f0; }

  .mobile-menu-overlay {
    position: fixed;
    inset: 76px 0 0;
    z-index: 90;
    display: block;
    background: rgba(6, 42, 97, 0.24);
    -webkit-backdrop-filter: blur(4px);
    backdrop-filter: blur(4px);
  }
  .mobile-menu-overlay[hidden],
  .mobile-menu[hidden] { display: none !important; }
  .mobile-menu {
    position: fixed;
    inset: 76px 0 auto;
    z-index: 91;
    width: 100%;
    padding: 14px var(--mobile-page-padding) 24px;
    display: grid;
    gap: 2px;
    color: var(--mobile-navy);
    background: #fff;
    border: 0;
    border-radius: 0 0 24px 24px;
    box-shadow: 0 16px 40px rgba(20, 55, 92, 0.14);
  }
  .mobile-menu > button {
    width: 100%;
    min-height: 50px;
    padding: 0 10px;
    justify-content: flex-start;
    color: var(--mobile-navy);
    background: transparent;
    border: 0;
    border-bottom: 1px solid rgba(226, 234, 243, 0.72);
    border-radius: 0;
    font-size: 15px;
    font-weight: 700;
    text-align: left;
  }
  .mobile-menu > button:focus-visible { outline: 3px solid rgba(47, 128, 237, 0.28); outline-offset: -2px; border-radius: 12px; }
  .mobile-menu .home-watch-button {
    min-height: 52px;
    margin-top: 12px;
    display: inline-flex;
    justify-content: center;
    color: #fff;
    background: var(--mobile-orange);
    border: 0;
    border-radius: 16px;
    text-align: center;
  }

  /* Compact hero and the primary 4:5 story carousel */
  .home-hero-section { min-height: 0; padding: 20px var(--mobile-page-padding) 0; }
  .home-hero-section > .page-container { width: 100%; max-width: none; padding: 0; }
  .home-hero-grid { display: grid; grid-template-columns: 1fr; gap: 26px; }
  .home-hero-copy { width: 100%; max-width: none; padding: 0; text-align: center; }
  .home-hero-title,
  .home-hero-title--art {
    width: min(100%, 330px);
    max-width: 330px;
    height: 100px;
    aspect-ratio: auto;
    margin: 0 auto;
  }
  .home-hero-title-image { top: 70%; width: 155%; }
  .home-hero-description {
    max-width: 330px;
    margin: 16px auto 0;
    color: var(--mobile-navy);
    font-size: 16px;
    line-height: 1.5;
    font-weight: 500;
    text-align: center;
  }
  .home-hero-description br { display: none; }
  .home-hero-actions { margin-top: 22px; display: grid; justify-items: center; gap: 2px; }
  .home-primary-cta {
    width: 100%;
    min-height: 54px;
    padding: 0 18px;
    color: #fff;
    background: var(--mobile-orange);
    border: 0;
    border-radius: 16px;
    box-shadow: 0 9px 20px rgba(255, 106, 0, 0.18);
    font-size: 15px;
    font-weight: 800;
  }
  .home-primary-cta svg { display: none; }
  .home-secondary-cta {
    width: auto;
    min-height: 44px;
    padding: 0 6px;
    gap: 5px;
    color: var(--mobile-blue);
    background: transparent;
    border: 0;
    border-radius: 8px;
    box-shadow: none;
    font-size: 14px;
    font-weight: 750;
  }
  .home-secondary-cta svg { display: none; }
  .home-secondary-cta > span[aria-hidden="true"] { display: inline; }
  .home-hero-visual { width: 100%; padding: 0 0 20px; }
  .home-carousel-backdrop { display: none; }
  .home-hero-visual .hero-carousel {
    width: 100%;
    aspect-ratio: 4 / 5;
    overflow: visible;
    background: transparent;
    border-radius: 26px;
    box-shadow: var(--mobile-shadow-card);
  }
  .hero-carousel__viewport { overflow: hidden; border-radius: 26px; background: var(--mobile-blue-soft); }
  .hero-carousel__image { object-fit: cover; object-position: var(--mobile-object-position, center); }
  .hero-carousel__question {
    top: 14px;
    right: 14px;
    left: 14px;
    max-width: none;
    padding: 11px 14px;
    border-radius: 17px;
    background: rgba(255, 255, 255, 0.92);
  }
  .hero-carousel__question small { color: var(--mobile-muted); font-size: 12px; }
  .hero-carousel__question strong {
    display: -webkit-box;
    overflow: hidden;
    color: var(--mobile-navy);
    font-size: 15px;
    line-height: 1.25;
    font-weight: 800;
    text-overflow: clip;
    white-space: normal;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
  }
  .hero-carousel__arrow {
    width: 44px;
    height: 44px;
    color: var(--mobile-navy);
    background: rgba(255, 255, 255, 0.88);
    border-radius: 50%;
    box-shadow: 0 7px 20px rgba(18, 56, 96, 0.12);
  }
  .hero-carousel__arrow--prev { left: 12px; }
  .hero-carousel__arrow--next { right: 12px; }
  .mobile-carousel-dots {
    position: absolute;
    left: 50%;
    bottom: -24px;
    z-index: 8;
    display: flex;
    justify-content: center;
    gap: 7px;
    transform: translateX(-50%);
  }
  .mobile-carousel-dots .carousel-dot { width: 20px; height: 18px; padding: 0; }
  .mobile-carousel-dots .carousel-dot::before { width: 6px; height: 6px; background: #d7e3ef; }
  .mobile-carousel-dots .carousel-dot.is-active::before { width: 20px; height: 6px; background: var(--mobile-orange); transform: none; }

  /* Shared section rhythm and compact illustrated headings */
  .after-hero-section,
  body.is-home .home-popular { padding-top: var(--mobile-section-gap); }
  .after-hero-container { width: 100%; max-width: none; }
  .after-hero-heading,
  .after-hero-heading--art,
  .after-hero-heading--action.after-hero-heading--art {
    padding: 0 var(--mobile-page-padding);
    display: flex;
    align-items: flex-start;
    flex-direction: column;
    gap: 0;
  }
  .after-hero-heading--art > div { width: 100%; flex: none; }
  .section-title-art { width: min(calc(100vw - 40px), 350px); height: 52px; aspect-ratio: auto; }
  .section-title-art__image {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 122%;
    max-width: none;
    height: auto;
    object-fit: contain;
    transform: translate(-50%, -50%);
  }
  .after-hero-heading p { margin: 12px 0 0; color: var(--mobile-muted); font-size: 15px; line-height: 1.5; }

  /* Category rail: 3.5–4 cards in view */
  .home-categories { padding-top: 50px; }
  .home-category-grid {
    width: 100%;
    margin: 20px 0 0;
    padding: 0 var(--mobile-page-padding) 6px;
    display: flex;
    gap: 12px;
    overflow-x: auto;
    overscroll-behavior-inline: contain;
    scroll-padding-left: var(--mobile-page-padding);
    scroll-snap-type: x mandatory;
    scrollbar-width: none;
  }
  .home-category-grid::-webkit-scrollbar,
  body.is-home .home-popular-grid::-webkit-scrollbar { display: none; }
  .home-category-card {
    flex: 0 0 94px;
    min-width: 94px;
    min-height: 92px;
    height: 92px;
    padding: 0;
    display: grid;
    place-items: center;
    overflow: hidden;
    border-radius: 18px;
    box-shadow: none;
    scroll-snap-align: start;
  }
  .home-category-copy { min-height: 0; padding: 10px 6px; display: grid; place-items: center; gap: 7px; text-align: center; }
  .home-category-title { display: grid; place-items: center; gap: 6px; }
  .home-category-title img { width: 34px; height: 34px; flex-basis: 34px; }
  .home-category-title strong { color: var(--mobile-navy); font-size: 12px; line-height: 1.15; font-weight: 750; }
  .home-category-copy small,
  .home-category-art { display: none; }

  /* Popular stories rail: two cards plus the next edge */
  body.is-home .home-popular { margin: 0; }
  body.is-home .home-popular .after-hero-heading--action {
    padding-inline: var(--mobile-page-padding);
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 12px;
  }
  body.is-home .home-popular .after-hero-heading--action > div { min-width: 0; }
  body.is-home .home-popular .section-title-art { width: min(230px, 62vw); height: 42px; }
  body.is-home .home-popular .after-hero-heading--action > button {
    min-height: 44px;
    margin: 0;
    padding: 0;
    grid-column: auto;
    align-self: center;
    color: var(--mobile-blue);
    font-size: 13px;
    font-weight: 700;
  }
  body.is-home .home-popular-grid {
    width: 100%;
    margin: 18px 0 0;
    padding: 0 var(--mobile-page-padding) 6px;
    display: flex;
    gap: 12px;
    overflow-x: auto;
    scroll-padding-left: var(--mobile-page-padding);
    scroll-snap-type: x mandatory;
    scrollbar-width: none;
  }
  body.is-home .home-story-card { flex: 0 0 clamp(148px, 40vw, 156px); min-width: 148px; scroll-snap-align: start; }
  body.is-home .home-story-card button { border-radius: 18px; box-shadow: 0 8px 22px rgba(20, 55, 92, 0.07); }
  .home-story-media { aspect-ratio: 1 / 1; }
  .home-story-body { min-height: 96px; padding: 10px 10px 12px; gap: 6px; }
  body.is-home .home-story-card .home-story-body h3 {
    display: -webkit-box;
    overflow: hidden;
    font-size: 13px;
    line-height: 1.25;
    font-weight: 750;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 3;
  }
  .home-story-body small { font-size: 11px; line-height: 1.2; }
  .home-story-body i { font-size: 16px; }

  /* Benefits become a dense 2×2 knowledge panel */
  .home-benefits { padding-top: 50px; }
  .home-benefits .after-hero-container {
    width: calc(100% - 40px);
    margin-inline: auto;
    padding: 20px;
    display: block;
    background: var(--mobile-cream);
    border-radius: 24px;
  }
  .home-benefits .after-hero-heading { padding: 0; }
  .home-benefits .after-hero-heading h2 { width: 100%; height: 52px; }
  .home-benefits .after-hero-heading p { max-width: none; margin-top: 10px; color: var(--mobile-navy); font-size: 14px; line-height: 1.45; }
  .home-benefits-mascot { display: none; }
  .home-benefit-grid { margin-top: 18px; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .home-benefit-card,
  .home-benefit-card.is-tone-2,
  .home-benefit-card.is-tone-3,
  .home-benefit-card.is-tone-4 {
    min-height: 126px;
    padding: 13px;
    display: block;
    background: rgba(255, 255, 255, 0.76);
    border: 0;
    border-radius: 16px;
    box-shadow: none;
  }
  .home-benefit-card > img { width: 30px; height: 30px; margin-bottom: 8px; }
  .home-benefit-card h3 { margin: 0 0 5px; font-size: 13px; line-height: 1.2; font-weight: 750; }
  .home-benefit-card p {
    display: -webkit-box;
    overflow: hidden;
    color: var(--mobile-muted);
    font-size: 11px;
    line-height: 1.35;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 3;
  }

  /* Personal story is one compact promotional card */
  .home-custom-story { padding-top: 52px; }
  .home-custom-story .after-hero-container { width: calc(100% - 40px); margin-inline: auto; }
  .custom-story-panel {
    min-height: 220px;
    max-height: 260px;
    padding: 20px;
    display: block;
    overflow: hidden;
    background: var(--mobile-blue-soft);
    border-radius: 24px;
    box-shadow: none;
  }
  .custom-story-copy { position: relative; z-index: 2; width: 58%; max-width: 58%; }
  .custom-story-copy .section-title-art { width: 172%; max-width: none; height: 48px; }
  .custom-story-copy .section-title-art__image { width: 122%; left: 50%; }
  .custom-story-copy > p { margin-top: 7px; color: var(--mobile-navy); font-size: 13px; line-height: 1.4; }
  .custom-story-action { margin-top: 12px; display: grid; justify-items: start; gap: 2px; }
  .custom-story-action .after-hero-button {
    width: auto;
    min-height: 44px;
    padding-inline: 14px;
    border-radius: 14px;
    font-size: 12px;
    white-space: nowrap;
  }
  .custom-story-more.mobile-cta-label {
    min-height: 40px;
    padding: 0;
    color: var(--mobile-blue);
    background: transparent;
    border: 0;
    font-size: 12px;
    font-weight: 750;
  }
  .custom-story-action > span,
  .custom-story-steps { display: none; }
  .custom-story-art {
    top: auto;
    right: -12px;
    bottom: 0;
    left: auto;
    width: 48%;
    height: 100%;
    object-fit: contain;
    object-position: right bottom;
    transform: none;
  }

  /* Reviews remain conditional and become a single-card rail. */
  .home-testimonials:not([hidden]) .home-testimonial-grid {
    display: flex;
    gap: 12px;
    padding: 0 var(--mobile-page-padding) 6px;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
  }
  .home-testimonials:not([hidden]) .home-testimonial-card { flex: 0 0 calc(100vw - 40px); scroll-snap-align: start; }

  /* One pricing card at a time */
  .home-formats { padding-top: 52px; }
  .home-formats .after-hero-heading { padding-inline: var(--mobile-page-padding); }
  .mobile-pricing-tabs {
    margin: 18px var(--mobile-page-padding) 0;
    padding: 4px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    background: #f2f6fb;
    border-radius: 16px;
  }
  .mobile-pricing-tabs button {
    min-height: 44px;
    color: var(--mobile-muted);
    background: transparent;
    border: 0;
    border-radius: 12px;
    font-size: 13px;
    font-weight: 750;
  }
  .mobile-pricing-tabs button.is-active { color: var(--mobile-navy); background: #fff; box-shadow: 0 4px 12px rgba(20, 55, 92, 0.09); }
  .mobile-pricing-tabs button:focus-visible { outline: 3px solid rgba(47, 128, 237, 0.28); }
  .home-format-grid { margin: 12px var(--mobile-page-padding) 0; display: block; }
  .home-format-card { display: none; }
  .home-format-card.is-mobile-active {
    min-height: 0;
    padding: 20px;
    display: grid;
    grid-template-columns: 58px minmax(0, 1fr);
    gap: 0 14px;
    background: #fff;
    border-width: 1.5px;
    border-radius: 22px;
  }
  .home-format-icon { width: 56px; height: 56px; }
  .home-format-copy h3 { font-size: 18px; }
  .home-format-price { margin: 4px 0 10px; }
  .home-format-price strong { font-size: 22px; }
  .home-format-copy ul { gap: 5px; }
  .home-format-copy li { font-size: 12px; }
  .home-format-copy li:nth-child(n + 4) { display: none; }
  .home-format-card > .after-hero-button { grid-column: 1 / -1; width: 100%; min-height: 48px; margin-top: 16px; }
  .home-format-badge,
  .home-format-proof { display: none; }

  /* Demo CTA: short horizontal closing block */
  .home-final-cta { padding: 48px 0 0; }
  .home-final-cta .after-hero-container { width: calc(100% - 40px); margin-inline: auto; }
  .final-cta-panel {
    min-height: 150px;
    max-height: 180px;
    padding: 16px;
    display: grid;
    grid-template-columns: 72px minmax(0, 1fr);
    grid-template-rows: auto auto;
    align-items: center;
    gap: 8px 14px;
    overflow: hidden;
    background: var(--mobile-green-soft);
    border-radius: 22px;
    text-align: left;
  }
  .final-cta-panel > img {
    width: 72px;
    height: 112px;
    grid-row: 1 / 3;
    align-self: end;
    object-fit: contain;
    object-position: center bottom;
  }
  .final-cta-panel > div:not(.final-cta-action) { align-self: end; }
  .final-cta-panel h2.section-title-art { width: 100%; height: auto; overflow: visible; }
  .final-cta-panel .section-title-art__image { display: none; }
  .mobile-final-title { display: block; color: var(--mobile-navy); font-size: 16px; line-height: 1.25; font-weight: 800; }
  .final-cta-panel p { display: none; }
  .final-cta-action { grid-column: 2; justify-self: stretch; align-self: start; padding: 0; justify-items: stretch; gap: 5px; }
  .final-cta-action .after-hero-button { width: 100%; min-width: 0; min-height: 44px; padding-inline: 10px; font-size: 12px; }
  .final-cta-action small { font-size: 10px; text-align: center; }

  /* Compact footer, no app bottom navigation */
  body.is-home .site-footer {
    margin-top: 54px;
    padding: 30px var(--mobile-page-padding) calc(24px + env(safe-area-inset-bottom));
    background: #f5f8fc;
  }
  body.is-home .site-footer .footer-grid,
  body.is-home .site-footer .footer-bottom { width: 100%; max-width: none; }
  body.is-home .site-footer .footer-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px 20px; }
  body.is-home .site-footer .footer-brand { grid-column: 1 / -1; }
  .footer-full-logo img { width: 92px; }
  body.is-home .footer-brand p { max-width: 280px; margin-top: 10px; font-size: 12px; }
  body.is-home .footer-grid > div:nth-child(4) { display: none; }
  .mobile-footer-support { display: flex; flex-wrap: wrap; gap: 4px 14px; }
  .mobile-footer-support a {
    min-height: 30px;
    display: inline-flex;
    align-items: center;
    color: var(--mobile-blue);
    font-size: 12px;
    text-decoration: none;
  }
  body.is-home .footer-bottom { margin-top: 24px; padding-top: 16px; display: grid; gap: 6px; font-size: 11px; }
  .mobile-bottom-nav,
  body.is-home .mobile-bottom-nav { display: none !important; }

  :where(.home-primary-cta, .home-secondary-cta, .home-category-card, .home-story-card button, .mobile-pricing-tabs button, .custom-story-more):focus-visible {
    outline: 3px solid rgba(47, 128, 237, 0.3);
    outline-offset: 3px;
  }
}

@media (max-width: 379px) {
  .home-category-card { flex-basis: 88px; min-width: 88px; }
  .custom-story-copy { width: 61%; max-width: 61%; }
  .custom-story-art { right: -18px; width: 47%; }
}

@media (prefers-reduced-motion: reduce) {
  .hero-carousel-slide,
  .home-story-media > img,
  .mobile-menu { transition: none !important; }
}
