/* =========================================
   Responsive Design
   ========================================= */

/* Tablet Navigation Fixes */
@media (max-width: 1200px) {
  .nav-menu {
    gap: var(--space-md);
  }

  .nav-link {
    font-size: 0.875rem;
  }
}

@media (max-width: 1099px) {
  /* Hero section tablet layout */
  .hero {
    padding-top: 115px;
    min-height: auto;
  }

  .hero-content {
    grid-template-columns: 1fr;
    gap: var(--space-xl);
    max-width: 800px;
    margin: 0 auto;
    padding: var(--space-md) 0;
    text-align: center;
  }

  .hero-text {
    text-align: center;
  }

  .hero-text p {
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
  }

  .hero-actions {
    justify-content: center;
    flex-wrap: wrap;
  }

  .hero-visual {
    justify-content: center;
  }

  .hero-card {
    max-width: 700px;
    width: 100%;
    margin: 0 auto;
  }

  .hero-scroll {
    position: absolute;
    bottom: var(--space-md);
    left: 50%;
    transform: translateX(-50%);
  }

  .hero {
    padding-bottom: var(--space-4xl);
  }

  .about-grid {
    grid-template-columns: 1fr;
    gap: var(--space-2xl);
  }

  .about-visual {
    display: none;
  }

  .services-grid,
  .services .services-grid,
  .services-page .services-grid {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: var(--space-xl);
  }

  .services-grid .service-card-link,
  .services-grid article,
  .services .services-grid .service-card-link,
  .services .services-grid article {
    flex: 0 1 calc(50% - var(--space-xl));
    max-width: 400px;
  }

  /* iPad Pro - smaller logo and show phone number */
  .logo-img {
    max-width: 160px;
    height: auto;
  }

  .nav-actions .phone-link {
    display: flex;
  }

  .nav-actions .phone-link span {
    display: inline;
  }

  .footer-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: var(--space-2xl);
  }

  .footer-brand {
    grid-column: 1 / -1;
    margin-bottom: var(--space-lg);
  }

  .footer-links {
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
  }

  .footer-links ul {
    display: flex;
    flex-direction: column;
    align-items: center;
  }

  /* Inner pages responsive */
  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .detail-grid {
    grid-template-columns: 1fr;
  }

  .team-card-large {
    text-align: left;
  }

  .team-info-large {
    text-align: left;
  }

  .team-specialties {
    justify-content: flex-start;
  }

  .values-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .telehealth-grid {
    grid-template-columns: 1fr;
    gap: var(--space-2xl);
  }
}

/* Contact page */
@media (max-width: 767px) {
  .contact-page {
    padding: var(--space-xl) 0;
  }

  .contact-details {
    flex-direction: column;
    gap: var(--space-xl);
  }

  .map-container.map-full-width iframe {
    height: 400px;
  }

  .stats-grid,
  .values-grid {
    grid-template-columns: 1fr;
  }

  .page-header {
    padding: calc(80px + var(--space-2xl)) 0 var(--space-2xl);
  }


  .team-specialties {
    justify-content: flex-start;
  }
}

/* Tablet and smaller - Mobile layout */
@media (max-width: 1099px) {
  .container {
    padding: 0 20px;
    box-sizing: border-box;
  }

  section {
    padding: var(--space-3xl) 0;
  }
}

/* Navigation breakpoint — switch to hamburger menu */
@media (max-width: 1099px) {
  /* Mobile Navigation */
  .header {
    padding: 0;
  }

  .nav.container {
    padding: 0 16px 0 16px;
    gap: var(--space-md);
  }

  .nav-menu,
  .nav-actions .btn {
    display: none;
  }

  .nav-actions {
    display: flex;
    align-items: center;
    gap: 20px;
    flex-shrink: 0;
    margin-left: auto;
  }

  .phone-link {
    display: flex !important;
    font-size: 0.85rem;
    gap: 6px;
    white-space: nowrap;
    margin-right: 4px;
  }

  .phone-link span {
    display: inline !important;
  }

  .phone-link svg {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
  }

  .nav-toggle {
    display: flex !important;
    flex-shrink: 0;
    visibility: visible !important;
    opacity: 1 !important;
    margin-right: 5px;
  }

  .logo {
    flex-shrink: 0;
    min-width: 0;
  }

  .logo-img {
    max-width: 170px;
    height: auto;
  }

  /* Fix content overflow on mobile */
  .hero-text,
  .hero-content,
  .about-content,
  section {
    max-width: 100%;
    overflow-wrap: break-word;
    word-wrap: break-word;
  }

  .hero-text p {
    max-width: 100%;
  }

  /* Ensure proper width */
  .hero {
    width: 100%;
    max-width: 100vw;
  }

  /* Lock page scroll when the menu is open. Use overflow:hidden on <html> only
     (not <body>): it preserves the scroll position (no position:fixed jump) AND
     leaves the viewport as the scroll context for the sticky blog sidebar.
     Putting overflow:hidden on <body> turned body into a scroll container, which
     re-anchored the sticky sidebar to the top of the page and made it vanish
     while the menu was open. */
  html.menu-open {
    overflow: hidden;
    overscroll-behavior: none;
  }

  /* Mobile menu - slide in from right */
  .nav-menu {
    position: fixed;
    top: 0;
    right: -100%;
    width: 280px;
    max-width: 80vw;
    height: 100vh;
    height: 100dvh;
    background: white;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    padding: 0;
    box-shadow: -4px 0 20px rgba(0, 0, 0, 0.15);
    transition: right 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 1000;
    display: flex;
    text-align: left;
  }

  .nav-menu.active {
    right: 0;
  }

  /* Overlay when menu is open */
  .nav-menu::before {
    content: '';
    position: fixed;
    top: 0;
    left: -100vw;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.4);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.35s ease, visibility 0.35s ease;
    z-index: -1;
  }

  .nav-menu.active::before {
    opacity: 1;
    visibility: visible;
  }

  /* Mobile menu header with logo only (X is the hamburger) */
  .mobile-menu-header {
    display: block;
    padding: var(--space-lg) var(--space-lg) calc(var(--space-lg) - 9px);
    border-bottom: 1px solid var(--ivory-200);
  }

  .mobile-menu-header .logo {
    display: block;
  }

  .mobile-menu-header .logo-img {
    max-width: 160px;
    height: auto;
    display: block;
  }

  /* Hide the close button - hamburger transforms to X */
  .mobile-menu-close {
    display: none;
  }

  /* Mobile menu list */
  .mobile-menu-list {
    display: block;
    list-style: none;
    padding: 4px var(--space-lg);
    margin: 0;
    flex: 1 1 0;
    min-height: 0;
    overflow-y: scroll;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
  }

  .mobile-menu-list > li {
    opacity: 0;
    transform: translateX(20px);
    transition: opacity 0.3s ease, transform 0.3s ease;
  }

  .nav-menu.active .mobile-menu-list > li {
    opacity: 1;
    transform: translateX(0);
  }

  .nav-menu.active .mobile-menu-list > li:nth-child(1) { transition-delay: 0.1s; }
  .nav-menu.active .mobile-menu-list > li:nth-child(2) { transition-delay: 0.15s; }
  .nav-menu.active .mobile-menu-list > li:nth-child(3) { transition-delay: 0.2s; }
  .nav-menu.active .mobile-menu-list > li:nth-child(4) { transition-delay: 0.25s; }
  .nav-menu.active .mobile-menu-list > li:nth-child(5) { transition-delay: 0.3s; }
  .nav-menu.active .mobile-menu-list > li:nth-child(6) { transition-delay: 0.35s; }
  .nav-menu.active .mobile-menu-list > li:nth-child(7) { transition-delay: 0.4s; }

  .mobile-menu-list .nav-link {
    display: block;
    padding: var(--space-md) 0;
    font-size: 1.25rem;
    font-weight: 500;
    color: var(--cedar-800);
  }

  .mobile-menu-list .nav-dropdown .nav-link {
    display: flex;
    align-items: center;
  }

  /* Remove active underline on mobile */
  .mobile-menu-list .nav-link::after {
    display: none;
  }

  .mobile-menu-list .nav-link:hover {
    color: var(--cedar-500);
  }

  /* Dropdown arrow SVG styling */
  .dropdown-arrow {
    display: block;
    transition: transform 0.3s ease;
    flex-shrink: 0;
    margin-left: var(--space-xs);
    color: var(--cedar-500);
  }

  .nav-dropdown.active .dropdown-arrow {
    transform: rotate(180deg);
  }

  /* Hide the CSS-based arrow since we're using SVG */
  .nav-dropdown .dropdown-toggle::after {
    display: none;
  }

  /* Mobile dropdown menu - smooth animation */
  .nav-dropdown .dropdown-menu {
    position: static;
    transform: none;
    visibility: visible;
    box-shadow: none;
    padding: 0;
    padding-left: var(--space-lg);
    background: transparent;
    border-radius: 0;
    border-left: 2px solid var(--cedar-200);
    margin-left: 0;
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    white-space: normal;
    transition: max-height 0.3s ease, opacity 0.3s ease, margin 0.3s ease;
  }

  .nav-dropdown.active .dropdown-menu {
    max-height: 300px;
    opacity: 1;
    margin-top: var(--space-xs);
    margin-bottom: var(--space-sm);
  }

  .dropdown-menu li {
    opacity: 1 !important;
    transform: none !important;
  }

  .dropdown-menu a {
    padding: var(--space-sm) 0;
    font-size: 1rem;
    font-weight: 400;
    color: var(--cedar-800);
    display: block;
    border-bottom: none;
    transition: color 0.2s ease;
  }

  .dropdown-menu a:hover,
  .dropdown-menu a:active {
    color: var(--cedar-500);
  }

  /* Mobile menu CTA button */
  .mobile-menu-cta {
    display: block;
    padding: 25px var(--space-lg);
    border-bottom: 1px solid var(--ivory-200);
  }

  .mobile-menu-cta .btn {
    width: 100%;
    justify-content: center;
  }

  /* Show mobile-only elements */
  .mobile-only {
    display: inline-flex !important;
  }
}

/* Tablet and smaller — content layout */
@media (max-width: 1099px) {
  .hero {
    min-height: auto;
    padding: 115px 0 var(--space-2xl);
  }

  .hero-scroll {
    display: none;
  }

  .hero-actions {
    flex-direction: column;
  }

  .hero-actions .btn {
    width: 100%;
    justify-content: center;
  }

  .about-stats {
    grid-template-columns: 1fr;
    text-align: center;
  }

  .form-row {
    grid-template-columns: 1fr;
  }

  .form-consent {
    padding: var(--space-md);
  }

  /* Footer column ladder (1 of 2): 3-col row at ≥800px — Services | Quick Links
     | Resources, brand spanning the top. Do NOT set .footer-grid columns here;
     a rule at this breakpoint would override the 1-col ladder in the
     max-width:799 block below. */
  .footer-brand .logo {
    justify-content: center;
  }

  /* Testimonials mobile */
  .testimonials-wrapper {
    flex-direction: column;
    gap: var(--space-md);
  }

  .testimonial-arrow {
    display: none;
  }

  .testimonials-slider {
    width: 100%;
  }

  .testimonial-slide blockquote {
    padding: var(--space-lg);
  }

  /* Hero text mobile */
  .hero-text h1 {
    font-size: 3rem;
    line-height: 1.15;
  }

  .hero-tag {
    font-size: 0.9rem;
  }

  /* Hero card mobile */
  .hero-card-header {
    flex-direction: column;
    text-align: center;
    gap: var(--space-xs);
  }

  .hero-card-header h3 {
    font-size: 1.5rem;
  }

  .hero-card {
    text-align: center;
  }

  /* Insurance mobile */
  .insurance-list {
    grid-template-columns: 1fr;
  }

  /* About section mobile - match hero h1 size */
  .about-content h2 {
    font-size: 3rem;
    line-height: 1.15;
  }

  .telehealth-features {
    flex-direction: row;
    flex-wrap: wrap;
    gap: var(--space-md);
  }

  .telehealth-pill {
    flex: 1 1 auto;
  }

  .telehealth-pill:nth-child(2),
  .telehealth-pill:nth-child(3) {
    transform: none;
  }

  .telehealth-pill:nth-child(2):hover,
  .telehealth-pill:nth-child(3):hover {
    transform: translateY(-2px);
  }
}

/* Blog responsive */
@media (max-width: 1000px) {
  .blog-single-content {
    grid-template-columns: 1fr;
  }

  .blog-single-sidebar {
    order: 1;
    position: static;
  }

  .blog-card-featured {
    padding: var(--space-xl);
  }
}

@media (max-width: 767px) {
  .blog-grid {
    grid-template-columns: 1fr;
  }

  .blog-card-featured {
    grid-template-columns: 1fr;
    grid-template-areas:
      "pill"
      "body"
      "excerpt"
      "more";
    row-gap: var(--space-lg);
  }

  .blog-card-featured .blog-read-more {
    align-self: start;
    padding-top: 0;
  }

  .blog-post-nav-links {
    flex-direction: column;
  }

  .blog-post-nav-link {
    /* Container is now column-direction, so the desktop `flex: 1 1 280px`
       basis applies to height — reset it so cards size to their content. */
    flex: 0 1 auto;
    max-width: none;
  }

  .blog-post-nav-next {
    text-align: left;
    align-items: flex-start;
  }
}

@media (min-width: 750px) and (max-width: 1099px) {
  .team-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .team-grid .team-card-link:last-child:nth-child(odd) {
    grid-column: 1 / -1;
    justify-self: center;
  }
}

@media (max-width: 749px) {
  .team-grid {
    grid-template-columns: 1fr;
  }

  .team-grid .team-card-link:last-child:nth-child(3n + 1) {
    grid-column: auto;
  }
}

@media (max-width: 699px) {
  .services-grid,
  .services .services-grid,
  .services-page .services-grid {
    display: grid;
    grid-template-columns: 1fr;
  }

  .services-grid .service-card-link,
  .services-grid article,
  .services .services-grid .service-card-link,
  .services .services-grid article,
  .services-page .services-grid .service-card,
  .services-page .services-grid .service-card-link,
  .services-page .services-grid article {
    flex: none;
    max-width: none;
    width: 100%;
  }
}

@media (max-width: 899px) {
  .hero-text {
    text-align: left;
  }

  .hero-text p {
    margin-left: 0;
    margin-right: 0;
  }
}

/* Footer column ladder (2 of 2): single centered column at/below 799px. Must
   stay AFTER the max-width:1099 block above so it wins the cascade. The brand's
   grid-column:1/-1 rule becomes harmless here (it spans the single column =
   full width). Boundary: ≤799 = 1-col, ≥800 = 3-col row from the 1099 block. */
@media (max-width: 799px) {
  .footer-grid {
    grid-template-columns: 1fr;
  }
}

@media (min-width: 900px) and (max-width: 1099px) {
  .hero-content {
    grid-template-columns: 1fr 320px;
    max-width: 1000px;
    text-align: left;
    padding: var(--space-3xl) 50px;
  }

  .hero-text {
    text-align: left;
  }

  .hero-text p {
    max-width: none;
    margin-left: 0;
    margin-right: 0;
  }

  .hero-actions {
    justify-content: flex-start;
    flex-direction: row;
  }

  .hero-actions .btn {
    width: auto;
  }

  .hero-visual {
    justify-content: flex-end;
  }

  .hero-card {
    max-width: none;
    width: auto;
    margin: 0;
    text-align: left;
  }

  .hero-card-header {
    flex-direction: row;
    text-align: left;
    gap: var(--space-sm);
  }

  .hero-card-header h3 {
    font-size: 1.75rem;
  }
}

@media (min-width: 705px) and (max-width: 1099px) {
  .telehealth-grid {
    grid-template-columns: 1.2fr 1fr;
    gap: var(--space-2xl);
  }

  .telehealth-features {
    flex-direction: column;
    gap: var(--space-lg);
  }

  .telehealth-pill {
    flex: 0 0 auto;
  }
}

@media (max-width: 704px) {
  .telehealth-grid {
    display: flex;
    flex-direction: column;
    gap: 0;
  }

  .telehealth-content {
    display: contents;
  }

  .telehealth-content .section-tag {
    order: 1;
    align-self: flex-start;
  }

  .telehealth-content h2 {
    order: 2;
    align-self: flex-start;
    text-align: left;
  }

  .telehealth-content p {
    order: 3;
    text-align: left;
  }

  .telehealth-features {
    order: 4;
    flex-direction: column;
    align-items: center;
    margin: var(--space-xl) 0;
  }

  .telehealth-pill {
    flex: 0 0 auto;
  }

  .telehealth-content .btn {
    order: 5;
    align-self: center;
  }
}

@media (max-width: 480px) {
  h1 {
    font-size: 2rem;
  }

  /* Keep hero title larger on mobile */
  .hero-text h1 {
    font-size: 2.75rem;
    line-height: 1.15;
  }

  h2 {
    font-size: 1.75rem;
  }

  .btn-lg {
    padding: 0.875rem 1.5rem;
    font-size: 0.9375rem;
  }

  .insurance-list {
    flex-direction: column;
  }
}

@media (max-width: 389px) {
  /* Hide phone icon on small phones, keep number text only */
  .phone-link svg {
    display: none !important;
  }

  .phone-link span {
    display: inline !important;
  }

  .phone-link {
    margin-right: 0;
    gap: 0;
  }

  .logo-img {
    max-width: 150px;
  }
}

@media (max-width: 343px) {
  .nav.container {
    padding: 0 8px;
    gap: var(--space-sm);
  }

  .logo {
    flex-shrink: 1;
    min-width: 0;
    overflow: hidden;
  }

  .logo-img {
    max-width: 120px;
  }

  .nav-toggle {
    margin-right: 0;
    margin-left: var(--space-xs);
  }

  .phone-link {
    font-size: 0.75rem;
  }
}

/* Blog post scaffolding (Plan A) — mobile */
@media (max-width: 704px) {
  .post-byline { font-size: 0.82rem; gap: var(--space-xs); }
  .post-toc { padding: var(--space-md) var(--space-lg); }
  .post-related { padding: var(--space-3xl) 0; }
}
