/* ============================================================
   PHARMACOMPARE — RESPONSIVE BREAKPOINTS
   ============================================================ */


/* ── MISSION — forces the plain-vertical-stack fallback, overriding
   .mission-pin.is-pinned's sticky/horizontal-translate mechanism.
   This fires on narrow screens (≤900px) OR when the user has
   prefers-reduced-motion enabled — either condition alone is
   enough to disable the pin entirely, matching mission-scroll.js's
   own check for when it's allowed to add .is-pinned in the first
   place. Kept as a straight CSS override (not just relying on the
   JS check) so the fallback holds even if JS is slow to react to
   a live viewport resize or an OS-level motion-preference change. ── */
@media (max-width: 900px), (prefers-reduced-motion: reduce) {

  .mission-pin.is-pinned {
    position: static;
    height: auto;
  }

  .mission-pin.is-pinned .mission-pin-inner {
    position: static;
    height: auto;
    overflow: visible;
  }

  .mission-pin.is-pinned .mission-track {
    display: block;
    width: auto;
    transform: none !important;
  }

  .mission-pin.is-pinned .mission-panel,
  .mission-panel {
    width: 100%;
    height: auto;
    flex-direction: column !important;
    text-align: center;
  }

  .mission-panel-content {
    max-width: 100%;
  }

  .mission-panel-frame {
    margin-top: var(--space-lg);
  }

  .mission-progress-dots {
    display: none !important;
  }

}
/* ── TIMELINE — stacks to single column, icon badges move above text ── */
@media (max-width: 768px) {

  .timeline-spine {
    left: 30px;
  }

  .timeline-step,
  .timeline-step-left,
  .timeline-step-right {
    flex-direction: column;
    align-items: flex-start;
    padding-left: 60px;
  }

  .timeline-content,
  .timeline-step-right .timeline-content {
    text-align: left;
  }

  .timeline-node {
    position: absolute;
    left: 20px;
    top: 6px;
  }

  .timeline-visual,
  .timeline-step-left .timeline-visual,
  .timeline-step-right .timeline-visual {
    justify-content: flex-start;
    margin-top: var(--space-sm);
  }

  .timeline-visual-group {
    width: 170px;
    height: 260px;
  }

  .timeline-visual-blob {
    top: 33px;
    left: -29px;
    width: 195px;
    height: 195px;
  }

  .timeline-card {
    top: 13px;
    left: 14px;
    width: 110px;
    height: auto;
  }

  .timeline-icon-badge {
    top: 90px;
    left: 97px;
    bottom: auto;
    right: auto;
    width: 80px;
    height: 80px;
  }

  .timeline-icon-badge img {
    width: 38px;
    height: 38px;
  }

}

@media (max-width: 1024px) {

  .hero-inner {
    grid-template-columns: 1fr;
    text-align: center;
  }

  .hero-text {
    order: 1;
  }

  .hero-visual {
    order: 2;
    min-height: 560px;
  }

  .phone-frame {
    width: 300px;
  }

  .hero-backdrop-circle {
    width: 420px;
    height: 420px;
  }

  .store-badge-row,
  .social-proof {
    justify-content: center;
  }

  .hero-subtext {
    margin-left: auto;
    margin-right: auto;
  }

  .showcase-row {
    flex-direction: column;
  }

  .showcase-col {
    max-width: 500px;
    width: 100%;
  }

  .showcase-phone-col {
    order: -1;              /* phone appears first when stacked on tablet */
    margin-bottom: var(--space-lg);
  }

  .showcase-phone-frame {
    width: 260px;
  }

  .functions-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  /* Built-By: stack the team column above the download card */
  .built-by-layout {
    flex-direction: column;
  }

  .built-by-team,
  .built-by-download {
    flex: 1 1 auto;
    width: 100%;
  }

  .built-by-download {
    margin-top: 108px;
  }

  .footer-grid {
    grid-template-columns: 1fr 1fr;
    gap: var(--space-lg) var(--space-md);
  }

  .flow-diagram {
    justify-content: center;
  }

  .flow-connector {
    display: none;
  }

}

@media (max-width: 768px) {

  html {
    scroll-padding-top: 70px;
  }

  /* ── TYPOGRAPHY SCALE-UP — raises the site-wide font-size tokens
     for this breakpoint and below (480px inherits these too, since
     it's a narrower max-width that layers on top of this block).
     h1/h2/h3, .section-eyebrow, and plain <p> paragraphs all read
     off these vars (see base.css), so this one change reaches
     nearly everything without touching each section's markup. ── */
  :root {
    --fs-body: 1.05rem;      /* was 1rem */
    --fs-small: 0.95rem;     /* was 0.875rem */
    --fs-card-title: 1.35rem; /* was 1.25rem */
  }

  /* A handful of component paragraphs/headings hard-code their own
     rem value instead of reading --fs-body/--fs-card-title, so the
     token bump above doesn't reach them — bumped individually here. */
  .why-built-text,
  .mission-panel-text,
  .vision-text {
    font-size: 1.15rem;   /* was 1.05rem (why-built-text, mission-panel-text) / 1.1rem (vision-text) */
  }

  .timeline-content h3 {
    font-size: 1.4rem;    /* was 1.3rem */
  }

  .showcase-item-text h3 {
    font-size: 1.15rem;   /* was 1.05rem */
  }

  .timeline-content p,
  .showcase-item-text p {
    font-size: 1rem;      /* was 0.95rem (timeline-content p) / 0.85rem (showcase-item-text p) */
  }

  .mission-stat-text p {
    font-size: 0.9rem;    /* was 0.85rem */
  }

  /* ── Mirrors .section-container's own padding value at this
     breakpoint (base.css) so Mission's panels use as much width
     as .why-built does — .mission-panel's fixed --space-xl (6rem)
     side padding was never shrunk below the desktop pinned-slide
     value, unlike .section-container, which left large empty
     margins on mobile. ── */
  .mission-panel {
    padding-left: var(--space-md);
    padding-right: var(--space-md);
  }

  .site-nav {
    padding: 1.1rem 0;
  }

  .nav-container {
    grid-template-columns: auto auto;
    justify-content: space-between;
    padding: 0 var(--space-sm);
  }

  .nav-logo-img {
    height: 54px;
  }

  .nav-links {
    position: fixed;
    top: 90px;
    left: 50%;
    transform: translateX(-50%) translateY(-20px);
    width: min(88vw, 360px);
    max-height: 70vh;
    overflow-y: auto;   /* the four dropdown groups can push total content taller than 70vh */
    background: var(--color-white);
    flex-direction: column;
    flex-wrap: nowrap; /* override components.css's desktop-only wrap safety net */
    align-items: flex-start;
    justify-content: flex-start;
    gap: var(--space-md);
    padding: 60px var(--space-lg) var(--space-lg);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    opacity: 0;
    visibility: hidden;
    transition: opacity var(--transition-medium), transform var(--transition-medium), visibility var(--transition-medium);
    z-index: 1000;
    box-sizing: border-box;
  }

  .nav-links.open {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0);
  }

  /* The mobile menu panel is always solid white, so links inside it
     stay dark even while the nav itself is in its Hero (not-scrolled)
     white-text state. */
  .site-nav:not(.scrolled) .nav-links .nav-link,
  .site-nav:not(.scrolled) .nav-links .nav-item.has-dropdown {
    color: var(--color-text-dark);
  }

  .site-nav:not(.scrolled) .nav-links .nav-link:hover,
  .site-nav:not(.scrolled) .nav-links .nav-link.active,
  .site-nav:not(.scrolled) .nav-links .nav-item.has-dropdown:hover {
    color: var(--color-green-primary);
  }

  /* ── NAV DROPDOWNS → MOBILE ACCORDION —
     Touch has no hover, so inside the drawer the dropdown menu is
     repurposed into a max-height accordion (same technique the FAQ
     section already uses) that only opens via nav.js toggling
     `.is-open` on `.nav-item` when its chevron is tapped. */
  .nav-links .nav-item.has-dropdown {
    flex-direction: column;
    align-items: flex-start;
    width: 100%;
  }

  /* Plain top-level links (Home, Partners, Our Team) get the same
     full-width row the dropdown parents have, so every main link —
     text, hover and active underline — is laid out identically. */
  .nav-links > a.nav-link,
  .nav-links .nav-item.has-dropdown > .nav-link {
    width: 100%;
    text-align: left;   /* the "Pages" trigger is a <button>, which centres its text by default */
  }

  .nav-links .nav-dropdown-toggle {
    position: absolute;
    top: 0;
    right: 0;
    width: 40px;
    height: 40px;
  }

  .nav-links .nav-dropdown-arrow {
    width: 19px;
    height: 19px;
  }

  /* Selector deliberately matches the desktop rules' specificity
     (.nav-item.has-dropdown:hover / :focus-within / .is-open
     .nav-dropdown-menu in components.css = 4 classes) — with only
     `.nav-links .nav-dropdown-menu` (2 classes) the desktop
     `transform: translateX(-50%)` won as soon as a menu opened and
     shifted the accordion ~110px left, clipping its links. */
  .nav-links .nav-item.has-dropdown .nav-dropdown-menu {
    position: static;
    width: 100%;
    min-width: 0;
    opacity: 1;
    visibility: visible;
    transform: none;
    box-shadow: none;
    padding: 0;
    margin-top: 0;
    max-height: 0;
    overflow: hidden;
    transition: max-height var(--transition-medium), margin-top var(--transition-medium);
  }

  .nav-links .nav-item.has-dropdown.is-open .nav-dropdown-menu {
    max-height: 400px;
    margin-top: var(--space-xs);
  }

  .nav-links .nav-dropdown-link {
    padding: 10px 14px 10px 44px;
    font-size: 0.95rem;
    color: var(--color-text-body);
  }

  .nav-cta {
    display: none;
  }

  .lang-toggle-mobile {
    display: flex;
    margin-top: var(--space-xs);
  }

  .lang-toggle-mobile .lang-toggle-btn {
    padding: 10px 18px;
    font-size: 0.85rem;
  }

  .nav-toggle {
    display: flex;
  }

  .nav-close {
    display: flex;
  }

  .hero {
    padding-top: 110px;
  }

  .hero-subtext {
    font-size: 1.15rem;   /* ✏️ was 1rem here (a shrink from the 1.1rem desktop base) — now an actual increase */
  }

  .phone-frame {
    width: 260px;
  }

  .hero-backdrop-circle {
    width: 330px;
    height: 330px;
  }

  .hero-visual {
    min-height: 420px;
  }

  .store-badge-row {
    flex-direction: column;
    align-items: center;
  }

  .hero-scroll-indicator {
    margin-top: var(--space-md);
  }

  .showcase-card {
    padding: var(--space-lg) var(--space-md);
  }

  .showcase-phone-frame {
    width: 220px;
  }

  .showcase-icon-wrap {
    width: 76px;
    height: 76px;
  }

  .showcase-icon {
    width: 32px;
    height: 32px;
  }

  .flow-diagram {
    flex-direction: column;
    align-items: center;
    gap: var(--space-lg);
  }

  .flow-connector {
    display: none;
  }

  .functions-grid,
  .functions-grid.cols-2 {
    /* .cols-2 needs calling out explicitly — two classes beats
       responsive.css's plain .functions-grid on specificity alone,
       so without this it would stay 2-up right down to phone width. */
    grid-template-columns: 1fr;
  }

  .blog-grid {
    grid-template-columns: 1fr;
  }

  .footer-grid {
    grid-template-columns: 1fr;
    gap: var(--space-lg);
  }

}

@media (max-width: 600px) {

  .mission-stat-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px 10px;
  }

  /* .cols-3 (home teaser previews, 3 stats) needs calling out — two
     classes beats the plain .mission-stat-grid rule above on
     specificity alone, so it otherwise stayed 3-up at phone width, its
     nowrap stat numbers overflowed, and the page widened past the
     viewport. One column reads better than a 2+1 orphan for 3 stats. */
  .mission-stat-grid.cols-3 {
    grid-template-columns: 1fr;
  }

  .mission-stat-box {
    padding: 8px 10px;
    min-height: 76px;
  }

  .mission-stat-icon {
    width: 44px;
    height: 44px;
    min-width: 44px;
  }

  .mission-stat-icon img {
    width: 22px;
    height: 22px;
  }

  .mission-stat-number,
  .mission-stat-plus {
    font-size: 1.6rem;
  }

}

@media (max-width: 480px) {

  .section-container {
    padding: 0 var(--space-sm);
  }

  /* Same --space-sm step-down .section-container takes here, applied
     to .mission-panel so Mission's text matches .why-built's width
     at this breakpoint too. */
  .mission-panel {
    padding-left: var(--space-sm);
    padding-right: var(--space-sm);
  }

  .nav-logo-img {
    height: 44px;
  }

  .nav-links {
    top: 80px;
    width: 92vw;
    max-height: 75vh;
  }

  .phone-frame {
    width: 220px;
  }

  .hero-backdrop-circle {
    width: 270px;
    height: 270px;
  }

  .showcase-phone-frame {
    width: 190px;
  }

  .store-badge img {
    height: 46px;
  }

  .btn {
    padding: 12px 24px;
  }

  .btn-nav-download {
    padding: 14px 28px;
    font-size: 0.95rem;
  }

  .nav-close {
    top: 12px;
    right: 12px;
    width: 36px;
    height: 36px;
    font-size: 1.4rem;
  }

}

@media (prefers-reduced-motion: reduce) {

  html {
    scroll-behavior: auto;
  }

  [data-animate] {
    opacity: 1 !important;
    transform: none !important;
    transition: none !important;
  }

  .hero-scroll-indicator span,
  .btn-nav-download::before,
  .btn-nav-download::after {
    animation: none;
  }

  /* mission-scroll.js already checks this same media query before
     starting its continuous bounce rAF loop (sticker, corner icon,
     blobs, crash shots) and its per-panel scroll-driven phone-frame
     tilt/scale — this is the CSS-side guarantee in case that loop
     was already running when the preference changed mid-session. */
  .mission-square-sticker,
  .mission-square-corner-icon,
  .mission-blob-large,
  .mission-blob-small,
  .mission-crash-shot,
  .mission-phone-frame {
    transform: none !important;
  }

}