/*
 * mobile.css — Hemorrhoid Expert Theme
 * Добавьте к style.css или подключите отдельно через wp_enqueue_style
 */

/* ═══════════════════════════════════════════════
   BOTTOM NAVIGATION (mobile only)
═══════════════════════════════════════════════ */
.mobile-bottom-nav {
  display: none;
}

@media (max-width: 768px) {
  /* Отступ снизу чтобы контент не скрывался под навбаром */
  body { padding-bottom: 64px; }

  .mobile-bottom-nav {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: #fff;
    border-top: 1px solid var(--paper);
    z-index: 500;
    padding-bottom: env(safe-area-inset-bottom, 0);
    box-shadow: 0 -4px 20px rgba(0,0,0,.06);
  }

  .mbn-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    padding: 10px 4px 8px;
    cursor: pointer;
    text-decoration: none;
    transition: color .15s;
    position: relative;
  }
  .mbn-item svg {
    width: 22px;
    height: 22px;
    stroke: var(--muted);
    fill: none;
    stroke-width: 1.5;
  }
  .mbn-item span {
    font-size: 10px;
    font-weight: 600;
    color: var(--muted);
    font-family: var(--sans);
  }
  .mbn-item.current svg  { stroke: var(--teal); }
  .mbn-item.current span { color: var(--teal); }

  /* Centre CTA button */
  .mbn-cta {
    background: var(--teal);
    border-radius: 10px;
    padding: 8px 4px 6px;
    margin: 4px 2px;
  }
  .mbn-cta svg  { stroke: #fff; }
  .mbn-cta span { color: #fff; font-size: 9px; }
  .mbn-cta.current { background: var(--teal2); }

  /* Badge on nav items */
  .mbn-badge {
    position: absolute;
    top: 6px;
    right: calc(50% - 18px);
    width: 16px;
    height: 16px;
    background: #ef4444;
    border-radius: 50%;
    font-size: 9px;
    font-weight: 700;
    color: #fff;
    display: grid;
    place-items: center;
    border: 2px solid #fff;
  }
}

/* ═══════════════════════════════════════════════
   HEADER — MOBILE ADJUSTMENTS
═══════════════════════════════════════════════ */
@media (max-width: 768px) {
  .site-header { position: sticky; top: 0; }
  .header-inner { height: 56px; gap: 12px; }
  .primary-menu-wrap  { display: none; }
  .header-reviewed-badge { display: none; }
  .menu-toggle {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 7px 12px;
    font-size: 13px;
  }
  .nav-drawer.open {
    display: block;
    position: fixed;
    top: 56px;
    left: 0;
    right: 0;
    bottom: 64px;
    overflow-y: auto;
    z-index: 400;
  }
  .nav-drawer .primary-menu li a {
    font-size: 16px;
    padding: 14px 24px;
    border-bottom: 1px solid rgba(255,255,255,.05);
  }
  .header-cta { padding: 8px 14px; font-size: 12px; }
}

/* ═══════════════════════════════════════════════
   HERO — MOBILE
═══════════════════════════════════════════════ */
@media (max-width: 768px) {
  .hero-section { min-height: auto; }
  .hero-content { padding: 36px 0 0; }
  .hero-grid { grid-template-columns: 1fr; gap: 0; }
  .hero-form-card { display: none; } /* Форма убрана в мобиле — есть CTA в футере каждой страницы */
  .hero-title { font-size: 28px; margin-bottom: 14px; }
  .hero-desc  { font-size: 14px; }
  .hero-actions { flex-direction: column; gap: 10px; }
  .hero-actions .btn { text-align: center; justify-content: center; padding: 14px; }
  .hero-stats-grid { grid-template-columns: repeat(2, 1fr); }
  .hero-stat { padding: 14px 8px; }
  .hero-stat-num { font-size: 24px; }
}

/* ═══════════════════════════════════════════════
   TOPICS — HORIZONTAL SCROLL ON MOBILE
═══════════════════════════════════════════════ */
@media (max-width: 768px) {
  .topics-section { padding: 40px 0; }
  .card-grid-3,
  .card-grid-2 {
    /* Convert to horizontal scroll */
    display: flex;
    overflow-x: auto;
    gap: 12px;
    padding: 0 20px 16px;
    scrollbar-width: none;
    background: none;
  }
  .card-grid-3::-webkit-scrollbar,
  .card-grid-2::-webkit-scrollbar { display: none; }
  .card-grid-3 > *,
  .card-grid-2 > * {
    min-width: 220px;
    flex-shrink: 0;
    border-radius: 4px;
    border: 1px solid var(--paper);
  }
}

/* ═══════════════════════════════════════════════
   DARK SPLIT — STACK ON MOBILE
═══════════════════════════════════════════════ */
@media (max-width: 768px) {
  .dark-split { padding: 40px 0; }
  .dark-split-grid { grid-template-columns: 1fr; }
  .dark-split-col { padding: 24px 20px; }
}

/* ═══════════════════════════════════════════════
   VIDEOS — HORIZONTAL SCROLL
═══════════════════════════════════════════════ */
@media (max-width: 768px) {
  .videos-section { padding: 40px 0; }
  .video-grid {
    display: flex;
    overflow-x: auto;
    gap: 12px;
    padding: 0 20px 16px;
    scrollbar-width: none;
    grid-template-columns: none;
  }
  .video-grid::-webkit-scrollbar { display: none; }
  .video-card {
    min-width: 240px;
    flex-shrink: 0;
  }
}

/* ═══════════════════════════════════════════════
   TREATMENT CARDS — HORIZONTAL SCROLL
═══════════════════════════════════════════════ */
@media (max-width: 768px) {
  .treatment { padding: 40px 0; }
  .treatment-grid {
    display: flex;
    overflow-x: auto;
    gap: 12px;
    padding: 0 20px 16px;
    scrollbar-width: none;
    grid-template-columns: none;
    margin-top: 24px;
  }
  .treatment-grid::-webkit-scrollbar { display: none; }
  .treat-card {
    min-width: 260px;
    flex-shrink: 0;
    border-radius: 4px;
  }
}

/* ═══════════════════════════════════════════════
   ARTICLE PAGE — MOBILE
═══════════════════════════════════════════════ */
@media (max-width: 768px) {
  /* Reading progress sticks below header */
  #reading-progress { top: 56px; }

  .article-hero { padding: 24px 0 0; }
  .article-hero-inner { grid-template-columns: 1fr; gap: 0; }
  .article-title { font-size: 22px; }

  /* Layout becomes single column */
  .article-layout { grid-template-columns: 1fr; gap: 0; padding: 0 0 60px; }
  .article-sidebar { display: none; } /* Sidebar hidden — content shown inline */

  /* TOC becomes collapsible inline block */
  .toc-mobile-wrap {
    background: var(--cream);
    border: 1px solid var(--paper);
    border-radius: 6px;
    margin: 16px 20px;
    overflow: hidden;
  }
  .toc-mobile-trigger {
    padding: 13px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    color: var(--ink);
  }
  .toc-mobile-trigger svg {
    width: 16px; height: 16px;
    stroke: var(--teal); fill: none; stroke-width: 2;
    transition: transform .25s;
  }
  .toc-mobile-wrap.open .toc-mobile-trigger svg { transform: rotate(180deg); }
  .toc-mobile-list {
    display: none;
    border-top: 1px solid var(--paper);
    padding: 8px 0;
  }
  .toc-mobile-wrap.open .toc-mobile-list { display: block; }

  /* Article body padding */
  .entry-content { padding: 0 20px; }
  .entry-content h2 { font-size: 20px; margin: 32px 0 12px; }
  .entry-content h3 { font-size: 17px; }
  .entry-content p  { font-size: 15px; }

  /* Callouts full width */
  .callout { margin: 20px 0; }

  /* Steps full width */
  .steps { margin: 20px 0; }

  /* Author card stacked */
  .author-card { flex-direction: column; gap: 14px; margin: 24px 20px; }

  /* Share bar scroll */
  .share-bar { overflow-x: auto; gap: 8px; padding: 16px 20px; }
  .share-bar::-webkit-scrollbar { display: none; }

  /* CTA at bottom of article */
  .article-cta-mobile {
    background: var(--navy3);
    margin: 16px 20px;
    border-radius: 8px;
    padding: 20px;
  }
  .article-cta-mobile h4 {
    font-family: var(--serif);
    font-size: 17px;
    font-weight: 700;
    color: #fff;
    margin-bottom: 6px;
    line-height: 1.2;
  }
  .article-cta-mobile p {
    font-size: 12px;
    color: rgba(255,255,255,.45);
    margin-bottom: 14px;
    line-height: 1.6;
  }
  .article-cta-mobile-btn {
    display: block;
    background: var(--teal);
    color: #fff;
    font-size: 14px;
    font-weight: 700;
    padding: 13px;
    border-radius: 4px;
    text-align: center;
    margin-bottom: 6px;
  }
  .article-cta-mobile-note {
    font-size: 10px;
    color: rgba(255,255,255,.25);
    text-align: center;
  }
}

/* ═══════════════════════════════════════════════
   ARCHIVE / CATEGORY — MOBILE
═══════════════════════════════════════════════ */
@media (max-width: 768px) {
  .archive-hero { padding: 32px 0; }
  .archive-hero-inner { grid-template-columns: 1fr; gap: 16px; }

  .archive-layout { grid-template-columns: 1fr; padding: 20px 0 80px; gap: 0; }
  .archive-sidebar { display: none; }

  .featured-post-card { grid-template-columns: 1fr; }
  .fpc-thumb { min-height: 160px; }

  .post-list-card { grid-template-columns: 90px 1fr; }
  .plc-thumb { min-height: 90px; }
  .plc-body { padding: 12px; }
  .plc-title { font-size: 14px; }
}

/* ═══════════════════════════════════════════════
   FAQ — MOBILE
═══════════════════════════════════════════════ */
@media (max-width: 768px) {
  .faq-section { padding: 40px 0; }
  .faq-layout { grid-template-columns: 1fr; gap: 24px; }
  .faq-question { font-size: 13px; }
}

/* ═══════════════════════════════════════════════
   EXPERTS — MOBILE
═══════════════════════════════════════════════ */
@media (max-width: 768px) {
  .experts { padding: 40px 0; }
  .experts-grid {
    display: flex;
    overflow-x: auto;
    gap: 2px;
    scrollbar-width: none;
    background: var(--paper);
  }
  .experts-grid::-webkit-scrollbar { display: none; }
  .expert-card {
    min-width: 160px;
    flex-shrink: 0;
  }
}

/* ═══════════════════════════════════════════════
   CTA SPLIT — STACK ON MOBILE
═══════════════════════════════════════════════ */
@media (max-width: 768px) {
  .cta-grid { grid-template-columns: 1fr; }
  .cta-left  { padding: 36px 24px; }
  .cta-right { padding: 36px 24px; }
  .cta-left h2 { font-size: 24px; }
  .cf-row { grid-template-columns: 1fr; }
}

/* ═══════════════════════════════════════════════
   FOOTER — MOBILE
═══════════════════════════════════════════════ */
@media (max-width: 768px) {
  .site-footer { padding: 40px 0 80px; } /* extra space for bottom nav */
  .footer-grid { grid-template-columns: 1fr; gap: 32px; }
  .footer-bottom { flex-direction: column; gap: 8px; text-align: center; }
  .footer-bottom > div { flex-direction: column; gap: 8px; }
}

/* ═══════════════════════════════════════════════
   CONTAINER — MOBILE PADDING
═══════════════════════════════════════════════ */
@media (max-width: 480px) {
  .container { padding: 0 16px; }
}

/* ═══════════════════════════════════════════════
   TOUCH IMPROVEMENTS
═══════════════════════════════════════════════ */
@media (hover: none) {
  /* Remove hover-only states on touch devices */
  .info-card:hover,
  .post-card:hover,
  .treat-card:hover,
  .video-card:hover { transform: none; box-shadow: none; }

  /* Make tap targets larger */
  .nav-a,
  .footer-menu a,
  .toc-link { padding-block: 10px; }

  /* Disable :hover animations that look buggy on touch */
  .info-card::before { display: none; }
}

/* ═══════════════════════════════════════════════
   QUIZ PAGE — MOBILE
═══════════════════════════════════════════════ */
@media (max-width: 768px) {
  .quiz-page { padding: 56px 0 80px; }
  .quiz-question,
  .quiz-result { padding: 0 16px; }
  .q-card { padding: 24px 20px; margin: 0; }
  .q-opt { padding: 13px 14px; }
  .q-opt-icon { width: 30px; height: 30px; font-size: 16px; }
  .q-nav { padding: 14px 16px; }
  .qi-features { grid-template-columns: 1fr 1fr; }
  .result-actions { grid-template-columns: 1fr; }
}
