/* =============================================================================
   tupbebekyorumlari.com — mobile UX overrides (loaded after global.css)
   Date: 2026-05-07
   Scope: phones up to 720px primarily; some helpers up to 879px (tablet portrait)
   Strategy: surgical, additive. Does not change desktop behavior.
   ============================================================================= */

/* -----------------------------------------------------------------------------
   0. GLOBAL GUARDS — prevent horizontal scroll, ensure 16px min input font on iOS
   -----------------------------------------------------------------------------*/
html, body { max-width: 100%; overflow-x: hidden; }
img, video, svg { max-width: 100%; height: auto; }

/* iOS Safari zooms when input font-size < 16px on focus. Force ≥ 16px on phones. */
@media (max-width: 720px) {
  input, select, textarea { font-size: 16px !important; }
}

/* -----------------------------------------------------------------------------
   1. HEADER — keep brand + burger always visible above the fold on tiny screens
   -----------------------------------------------------------------------------*/
@media (max-width: 879px) {
  /* Force burger visible on every viewport up to tablet portrait */
  .nav-toggle {
    display: inline-flex !important;
    flex-shrink: 0;
    width: 44px;
    height: 44px;
    padding: 0 !important;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--color-border-strong);
    background: var(--color-surface);
    border-radius: 10px;
    cursor: pointer;
    position: relative;
    z-index: 250;                  /* above backdrop and drawer */
  }
  .nav-toggle .bar { width: 22px; height: 2px; background: var(--color-text); }
  /* Hide the desktop CTA pill when burger takes over */
  .header-cta { display: none !important; }
}

@media (max-width: 720px) {
  .site-header .inner {
    gap: 12px;
    padding: 12px 16px;
    min-height: 60px;
  }
  /* Brand stays compact: smaller logo, smaller text, ellipsis if it overflows */
  .brand { gap: 8px; font-size: 1.05rem; min-width: 0; flex-shrink: 1; }
  .brand .brand-mark svg { width: 28px; height: 28px; }
  .brand .brand-text { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
}

@media (max-width: 380px) {
  .brand { font-size: 0.98rem; }
  .brand .brand-mark svg { width: 24px; height: 24px; }
  .site-header .inner { padding: 10px 14px; gap: 8px; }
}

/* Sticky header: stronger shadow on scroll so users feel grounded */
@media (max-width: 879px) {
  .site-header { box-shadow: 0 1px 0 var(--color-border); }
  html.nav-open .site-header { box-shadow: 0 1px 0 var(--color-border), 0 8px 24px rgba(31, 42, 38, .04); }
}

/* -----------------------------------------------------------------------------
   2. MOBILE NAV — slide-in drawer + backdrop + body scroll lock
   -----------------------------------------------------------------------------*/
@media (max-width: 879px) {
  /* Drawer: convert from "absolute below header" to a true slide-in panel */
  .nav-links {
    position: fixed !important;
    top: 0;
    right: 0;
    left: auto;
    bottom: 0;
    width: min(86vw, 360px);
    max-height: 100vh;
    height: 100dvh;
    padding: 80px 20px 32px;
    border: none;
    border-left: 1px solid var(--color-divider);
    box-shadow: -12px 0 32px rgba(31, 42, 38, .18);
    transform: translateX(100%);
    transition: transform .28s cubic-bezier(.22, 1, .36, 1);
    will-change: transform;
    z-index: 200;
    display: flex !important;
    flex-direction: column !important;
    background: #FFFFFF !important;          /* force solid white, no glass */
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
    opacity: 1 !important;
    overflow-y: auto;
  }
  .nav-links.is-open { transform: translateX(0); }

  /* Backdrop overlay — solid darken, NO blur (caused readability issues) */
  html.nav-open::before {
    content: "";
    position: fixed;
    inset: 0;
    background: rgba(31, 42, 38, .55);   /* darker for clear divide */
    z-index: 150;
    animation: nav-backdrop-in .2s ease-out;
  }
  @keyframes nav-backdrop-in { from { opacity: 0; } to { opacity: 1; } }

  /* Lock body scroll when drawer is open */
  html.nav-open, html.nav-open body { overflow: hidden; }

  /* Promote the burger above backdrop so it stays clickable as the X close */
  .nav-toggle { position: relative; z-index: 250; }
  html.nav-open .nav-toggle {
    position: fixed;
    top: 12px;
    right: 16px;
    background: var(--color-surface);
    border: 1px solid var(--color-border-strong);
    box-shadow: var(--shadow-sm);
  }
  /* Make the X explicit so users know burger has flipped to a close icon */
  html.nav-open .nav-toggle .bar { transition: transform .2s ease, opacity .2s ease; }
  html.nav-open .nav-toggle .bar:nth-child(1) { transform: translateY(7px) rotate(45deg); }
  html.nav-open .nav-toggle .bar:nth-child(2) { opacity: 0; }
  html.nav-open .nav-toggle .bar:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

  /* Nav rows: bigger touch targets, clearer hierarchy, sharp text */
  .nav-links > a,
  .nav-links .has-dropdown > .dropdown-trigger {
    padding: 14px 4px !important;
    font-size: 16px !important;
    font-weight: var(--fw-medium) !important;
    color: #1F2A26 !important;            /* deep text — no fading */
    min-height: 48px;
    align-items: center;
    background: transparent !important;
    opacity: 1 !important;
    text-decoration: none;
  }
  .nav-links > a:hover,
  .nav-links .has-dropdown > .dropdown-trigger:hover {
    color: var(--color-primary) !important;
  }
  .nav-links .chev { font-size: .9em; opacity: .7; }
  .nav-links .has-dropdown.is-open > .dropdown-trigger { color: var(--color-primary); }

  /* Sub-dropdown items: lighter background, indented, comfortable rows */
  .nav-links .dropdown-menu {
    background: var(--color-bg);
    border-radius: 12px;
    padding: 6px;
    margin: 4px 0 12px;
  }
  .nav-links .dropdown-menu a {
    padding: 12px 14px !important;
    font-size: 15px;
    border-radius: 8px;
    min-height: 44px;
    display: flex;
    align-items: center;
  }
  .nav-links .dropdown-menu a:hover,
  .nav-links .dropdown-menu a:active { background: var(--color-primary-soft); }
  .nav-links .dropdown-section {
    padding: 12px 14px 6px !important;
    font-size: 11px;
    margin-top: 8px;
  }

  /* Mobile CTA at the bottom of the drawer — sticky-ish prominence */
  .nav-cta-mobile {
    margin-top: auto !important;
    padding: 14px 20px !important;
    font-size: 15px !important;
    width: 100%;
    text-align: center;
    border-radius: 12px;
  }
}

/* Desktop (≥880px) — make sure nothing here leaks into desktop layout */
@media (min-width: 880px) {
  .nav-links {
    position: static !important;
    transform: none !important;
    transition: none !important;
    box-shadow: none !important;
    width: auto !important;
    height: auto !important;
    padding: 0 !important;
    background: transparent !important;
    border: none !important;
  }
  html.nav-open::before { display: none; }
}

/* -----------------------------------------------------------------------------
   3. HERO SEARCH BAR — pill input + compact icon-style submit on phones
   -----------------------------------------------------------------------------*/
@media (max-width: 600px) {
  .hero-search {
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    gap: 4px !important;
    padding: 4px !important;
    border-radius: 999px !important;
    max-width: 100% !important;
    background: var(--color-surface) !important;
    border: 1px solid var(--color-border) !important;
  }
  .hero-search input {
    flex: 1 1 auto !important;
    width: auto !important;
    min-width: 0 !important;
    padding: 10px 16px !important;
    font-size: 16px !important;          /* prevents iOS zoom */
    border-radius: 999px !important;
    background: transparent !important;
    min-height: 40px !important;
    border: 0 !important;
    outline: 0 !important;
  }
  /* Submit button collapses to a small round 36×36 icon-only puck.
     "Ara" text is hidden via font-size:0; pseudo-element renders a search glyph. */
  .hero-search button {
    flex: 0 0 auto !important;
    width: 36px !important;
    height: 36px !important;
    min-width: 36px !important;
    min-height: 36px !important;
    max-height: 36px !important;
    padding: 0 !important;
    border-radius: 50% !important;
    font-size: 0 !important;             /* hide the "Ara" text */
    line-height: 0 !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    flex-shrink: 0 !important;
  }
  .hero-search button::before {
    content: "\1F50D";                  /* 🔍 magnifying glass */
    font-size: 16px !important;
    line-height: 1 !important;
    color: var(--color-text-inverse, #fff);
    font-family: "Apple Color Emoji","Segoe UI Emoji","Noto Color Emoji",sans-serif;
  }
}

/* Tablet (601–879px): keep the original "Ara" text but compact */
@media (min-width: 601px) and (max-width: 879px) {
  .hero-search { padding: 6px; }
  .hero-search input { padding: 11px 14px; min-height: 42px; }
  .hero-search button { min-height: 42px; padding: 0 22px; font-size: 14px; }
}

/* -----------------------------------------------------------------------------
   4. HERO CTA ROW — full-width buttons on phones, equal stacking
   -----------------------------------------------------------------------------*/
@media (max-width: 559px) {
  .hero-cta-row { flex-direction: column; gap: 10px; }
  .hero-cta-row .btn {
    width: 100%;
    min-height: 48px;
    padding: 14px 20px;
    font-size: 15px;
    justify-content: center;
  }
}

@media (max-width: 720px) {
  .hero { padding: 28px 0 36px; }
  .hero h1 { font-size: clamp(1.85rem, 7vw, 2.2rem); margin-bottom: 14px; }
  .hero p.lead { font-size: 15px; margin-bottom: 20px; }
  .hero-pill { margin-bottom: 14px; }
  .hero-popular { gap: 16px; margin-top: 24px; }
}

/* -----------------------------------------------------------------------------
   5. CARDS — readable action buttons, comfortable touch targets
   -----------------------------------------------------------------------------*/
@media (max-width: 480px) {
  /* Center cards: action buttons need to be readable & tappable */
  .center-card { padding: 18px; }
  .center-card .actions {
    flex-direction: column;
    gap: 8px;
    width: 100%;
  }
  .center-card .actions .btn {
    width: 100%;
    min-height: 44px;
    padding: 12px 16px !important;
    font-size: 14px !important;        /* was 11px — too small for touch */
    justify-content: center;
  }
  .center-card .actions .btn-secondary { flex: 1 1 auto; }

  .doctor-card { padding: 18px; }
  .doctor-card .actions {
    flex-direction: column;
    gap: 8px;
  }
  .doctor-card .actions .btn {
    width: 100%;
    min-height: 44px;
    font-size: 14px !important;
    padding: 12px 16px !important;
  }
}

/* -----------------------------------------------------------------------------
   6. CONTAINERS / SECTIONS — tighter padding on tiny screens
   -----------------------------------------------------------------------------*/
@media (max-width: 480px) {
  .container { padding: 0 16px; }
  .container-prose { padding: 0 16px; }
  .hero-inner { padding: 0 16px; }
  section.block { padding: 36px 0; }
  section.block + section.block { padding-top: 36px; }
}

@media (max-width: 380px) {
  .container, .container-prose, .hero-inner { padding: 0 14px; }
}

/* -----------------------------------------------------------------------------
   7. PROSE — better mobile reading: tighter heading rhythm, larger body
   -----------------------------------------------------------------------------*/
@media (max-width: 720px) {
  .prose { font-size: 16px; line-height: 1.65; }
  .prose h2 { font-size: clamp(1.35rem, 5vw, 1.6rem); margin-top: 1.6em; margin-bottom: 0.5em; }
  .prose h3 { font-size: clamp(1.1rem, 4.2vw, 1.25rem); margin-top: 1.2em; }
  .prose p { margin-bottom: 1em; }
  .prose ul, .prose ol { padding-left: 22px; }
  .prose blockquote { padding: 14px 16px; margin: 1.2em 0; }
}

/* -----------------------------------------------------------------------------
   8. FAQ — bigger summary tap area
   -----------------------------------------------------------------------------*/
@media (max-width: 720px) {
  .faq details { padding: 14px 18px; }
  .faq summary { font-size: 15px; min-height: 44px; align-items: center; }
  .faq details > div { font-size: 15px !important; line-height: 1.6 !important; }
}

/* -----------------------------------------------------------------------------
   9. FOOTER — stack neater on phones
   -----------------------------------------------------------------------------*/
@media (max-width: 720px) {
  .site-footer { padding: 36px 0 24px; font-size: 14px; }
  .site-footer .cols { gap: 24px; }
  .site-footer h4 { margin-bottom: 10px; }
  .site-footer .legal-row { gap: 8px; flex-direction: column; align-items: flex-start; }
}

/* -----------------------------------------------------------------------------
   10. BREADCRUMBS — wrap and stay readable
   -----------------------------------------------------------------------------*/
@media (max-width: 480px) {
  .breadcrumbs { font-size: 12px; padding-top: 14px; }
  .breadcrumbs ol { gap: 6px; }
}

/* -----------------------------------------------------------------------------
   11. TRUST STRIP — keep numbers big and proud
   -----------------------------------------------------------------------------*/
@media (max-width: 720px) {
  .trust-strip { padding: 24px 0; }
  .trust-strip-grid { gap: 16px; }
  .trust-stat .stat-num { font-size: clamp(1.6rem, 6vw, 2rem); }
  .trust-stat .stat-label { font-size: 12px; }
}

/* -----------------------------------------------------------------------------
   12. BUTTONS GLOBAL — never let primary actions go below 44px touch target
   -----------------------------------------------------------------------------*/
@media (max-width: 720px) {
  .btn-primary, .btn-secondary { min-height: 44px; }
  .btn-sm { min-height: 36px; }
}

/* -----------------------------------------------------------------------------
   13. DIRECTORY GRID — sidebar stacks on top, list flows naturally
   -----------------------------------------------------------------------------*/
@media (max-width: 879px) {
  .directory-sidebar {
    position: static;
    max-height: none;
    overflow: visible;
    margin-bottom: 16px;
  }
}

/* -----------------------------------------------------------------------------
   14. LEAD FORM CTA — comfortable on phones
   -----------------------------------------------------------------------------*/
@media (max-width: 559px) {
  .lead-cta-card { padding: 22px 18px; }
  .lead-cta-strip { padding: 14px 16px; flex-direction: column; align-items: flex-start; gap: 10px; }
}

/* -----------------------------------------------------------------------------
   15. ACCESSIBILITY — focus rings on mobile too, tap-highlight tweak
   -----------------------------------------------------------------------------*/
* { -webkit-tap-highlight-color: rgba(47, 93, 79, .12); }
.btn:focus-visible, a:focus-visible, summary:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
}

/* -----------------------------------------------------------------------------
   16. MOBILE MENU HARDENING — defensive rules for stubborn rendering issues
   -----------------------------------------------------------------------------*/
@media (max-width: 879px) {
  /* Drawer panel must always be opaque on top of any glass / backdrop chains */
  .nav-links {
    background: #FFFFFF !important;
    background-color: #FFFFFF !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
    filter: none !important;
    -webkit-filter: none !important;
    pointer-events: auto !important;
    isolation: isolate;                   /* new stacking context */
  }
  .nav-links * {
    /* nothing inside the drawer should add a blur layer */
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
  }
  /* Burger / X must always be tappable on top of everything */
  .nav-toggle {
    pointer-events: auto !important;
    cursor: pointer !important;
    -webkit-tap-highlight-color: rgba(47, 93, 79, .15) !important;
    touch-action: manipulation !important;
  }
  /* Each row in the drawer is its own tappable target */
  .nav-links > a,
  .nav-links .has-dropdown > .dropdown-trigger,
  .nav-links .dropdown-menu a {
    pointer-events: auto !important;
    -webkit-tap-highlight-color: rgba(47, 93, 79, .15) !important;
    touch-action: manipulation !important;
    cursor: pointer !important;
  }
  /* Make sure dropdown inside drawer expands when .is-open */
  .nav-links .has-dropdown .dropdown-menu { display: none !important; }
  .nav-links .has-dropdown.is-open .dropdown-menu { display: block !important; }
  /* Clearer visual that a dropdown is open */
  .nav-links .has-dropdown.is-open > .dropdown-trigger {
    color: var(--color-primary) !important;
  }
  .nav-links .has-dropdown.is-open .chev {
    transform: rotate(180deg);
    opacity: 1 !important;
  }
  /* Better text rendering on iOS — prevents the "washed-out" look */
  .nav-links {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
  }
  /* Backdrop must NEVER sit above the drawer */
  html.nav-open::before { z-index: 150 !important; }
  .nav-links { z-index: 200 !important; }
  .nav-toggle { z-index: 300 !important; }
  html.nav-open .nav-toggle { z-index: 300 !important; }
}
