/* ================================================================
   Medizuno — responsive rules (desktop → mobile)
   Loaded after style.css
   ================================================================ */

@media (max-width: 1160px) {
    .med-hero__title { letter-spacing: -1.2px; }
    .med-nav ul { gap: 2px; }
    .med-nav__item > a { padding: 10px 9px; font-size: 13.5px; }
    .med-quicksearch input { width: 118px; }
    .med-categories__grid { grid-template-columns: repeat(3, 1fr); row-gap: 8px; }
    .med-footer__grid { grid-template-columns: 1.3fr 0.9fr 1fr 1fr; }
    .med-footer__follow { display: none; }
    .med-layout { grid-template-columns: 1fr 300px; }
}

@media (max-width: 980px) {
    /* --- Hero: full-bleed slider adapts cleanly --- */
    .med-hero { height: auto; min-height: 460px; }
    .med-hero__scrim {
        background:
            linear-gradient(180deg, rgba(7, 20, 49, 0.62) 0%, rgba(7, 20, 49, 0.55) 55%, rgba(7, 20, 49, 0.82) 100%);
    }
    .med-hero__copy { max-width: none; }
    .med-hero__text { margin: 14px auto 22px; }
    .med-hero__search { margin: 0 auto; }
    .med-hero__trust { justify-content: center; }
    .med-hero__floats { display: none; }

    /* --- News bar & header keep working at tablet width --- */
    .med-newsbar__label { padding: 0 12px 0 14px; font-size: 10px; }

    /* --- Header nav collapses into a drawer --- */
    .med-burger { display: grid; }
    .med-nav {
        position: fixed;
        top: 0; right: 0;
        height: 100dvh;
        width: min(320px, 88vw);
        background: var(--bg-panel);
        box-shadow: var(--shadow-lg);
        transform: translateX(105%);
        transition: transform 0.28s ease;
        z-index: 130;
        padding: 22px 14px;
        overflow-y: auto;
    }
    body.nav-open .med-nav { transform: translateX(0); }
    body.nav-open::after {
        content: '';
        position: fixed;
        inset: 0;
        background: rgba(8, 17, 35, 0.55);
        /* .med-header creates its own stacking context (sticky + backdrop-filter)
           at z-index 90, so an overlay at 120 paints OVER the drawer inside it
           and swallows every link click. Keep the scrim below the header. */
        z-index: 80;
    }
    .med-nav ul { flex-direction: column; gap: 2px; }
    .med-nav__item > a {
        display: flex;
        justify-content: space-between;
        align-items: center;
        border-bottom: 0;
        border-radius: 10px;
        padding: 13px 14px;
        font-size: 14.5px;
        color: var(--text);
    }
    .med-nav__item > a.is-active { background: var(--blue-soft); border-bottom-color: transparent; }
    .med-nav__sub {
        position: static;
        display: block;
        opacity: 1;
        visibility: visible;
        transform: none;
        box-shadow: none;
        background: transparent;
        padding: 0 0 6px 14px;
    }
    .med-nav__item.has-sub > a::after {
        content: '+';
        color: var(--blue);
        font-weight: 800;
        margin-left: 8px;
    }

    /* --- Two-column areas become one --- */
    .med-layout { grid-template-columns: 1fr; }
    .med-layout .med-side { order: 2; }
    .contact-grid { grid-template-columns: 1fr; }
    .med-grid { grid-template-columns: repeat(2, 1fr); }
    .stats-row { grid-template-columns: repeat(2, 1fr); }

    /* --- Hide the header quick search (drawer has a form on pages) --- */
    .med-quicksearch { display: none; }
}

@media (max-width: 700px) {
    /* Offset is applied to heading targets via scroll-margin-top only. */
    /* Match the shorter mobile sticky header for in-page TOC heading links. */
    .med-prose h2[id], .med-prose h3[id], .med-prose h4[id], .med-prose h5[id], .med-prose h6[id] { scroll-margin-top: 72px; }
    .med-header { backdrop-filter: none; -webkit-backdrop-filter: none; }
    .med-header__row { gap: 10px; padding: 10px 0; min-height: 64px; }
    .med-logo__text strong { font-size: 21px; }
    .med-logo__text small { display: none; }
    .med-logo__mark { width: 36px; height: 36px; }

    .med-pagehero h1 { font-size: 26px; }
    .med-pagehero { padding: 34px 0 46px; }
    .med-pagehero p { font-size: 14px; }

    /* --- Phones: compact hero, 192px tall, content kept inside --- */
    .med-hero { height: 192px; min-height: 192px; max-height: 192px; }
    .med-hero__content { padding: 14px 0 22px; align-items: center; justify-content: center; }
    .med-hero__copy { width: 100%; max-width: 100%; }
    .med-hero__title { font-size: 24px; letter-spacing: -0.4px; line-height: 1.1; }
    .med-hero__badge { font-size: 10px; padding: 4px 10px; margin-bottom: 8px; }
    /* Middle hero paragraph is removed on phones only */
    .med-hero__text { display: none; }
    .med-hero__search { flex-direction: row; align-items: center; width: 100%; border-radius: 999px; padding: 4px 4px 4px 14px; margin: 12px 0 0; }
    .med-hero__search svg { display: none; }
    .med-hero__search input { padding: 9px 4px; font-size: 13.5px; }
    .med-hero__search button { justify-content: center; padding: 9px 14px; font-size: 12.5px; }
    /* Trust badges do not fit the 192px hero on phones */
    .med-hero__trust { display: none; }

    /* News bar slims down on phones */
    .med-newsbar { height: 33px; }
    .med-newsbar__label { font-size: 9.5px; gap: 6px; padding: 0 10px 0 12px; }
    .med-newsbar__label i { width: 6px; height: 6px; }
    .med-newsbar__track a { font-size: 12px; }

    .med-hero__arrow { display: none; }
    /* The hero has a 70px bottom padding; a negative offset keeps the 24px
       touch targets clear of the search field while staying inside the hero. */
    .med-hero__dots { bottom: -66px; padding: 4px 10px; min-width: 214px; }
    .med-hero__dot { width: 24px; height: 24px; }
    .med-hero__dot::after { width: 6px; height: 6px; }
    .med-hero__dot.is-active::after { transform: scaleX(4); }

    /* Category cards (incl. Lifestyle) below the hero are hidden on phones only */
    .med-categories { display: none; }
    .med-cat { flex-direction: column; align-items: center; text-align: center; padding: 18px 12px; }
    .med-cat__text { align-items: center; }
    .med-cat__text small { text-align: center; }

    .med-grid { grid-template-columns: 1fr; }
    .med-grid--2 { grid-template-columns: 1fr; }
    .med-section { padding: 24px 0 36px; }
    .med-section__head { flex-direction: column; align-items: flex-start; gap: 8px; }

    .med-article { padding: 0; }
    .med-article .med-page { padding: 26px 20px; }
    .med-page { padding: 26px 20px; }
    .med-article__featured img { max-height: 300px; }
    .med-prose { font-size: 15.4px; }
    .med-prose h2 { font-size: 22px; }
    .med-prose table { display: block; overflow-x: auto; }

    .med-authorbox { flex-direction: column; text-align: center; align-items: center; }
    .med-form__row { grid-template-columns: 1fr; }
    .stats-row { gap: 10px; }
    .stat-box strong { font-size: 24px; }

    .med-footer__grid {
        grid-template-columns: 1fr 1fr;
        gap: 26px 18px;
        padding: 36px 0 26px;
    }
    .med-footer__about { grid-column: 1 / -1; }
    .med-footer__about p { max-width: none; }
    .med-footer__bottomrow { flex-direction: column; gap: 6px; text-align: center; padding: 14px 0; }

    .med-filterbar { flex-wrap: wrap; }
    .med-empty { padding: 44px 12px; }
    .med-404 strong { font-size: 78px; letter-spacing: -2px; }
}

@media (max-width: 430px) {
    .med-categories__grid { grid-template-columns: 1fr; }
    .med-footer__grid { grid-template-columns: 1fr; }
    .med-hero { height: 192px; min-height: 192px; max-height: 192px; }
    .med-hero__title { font-size: 22px; }
    .med-newsbar__sep { display: none; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    html { scroll-behavior: auto; }
    body.nav-open::after { backdrop-filter: none; }
    /* The news marquee stops animating; let readers swipe through it */
    .med-newsbar__track { animation: none; }
    .med-newsbar__viewport { overflow-x: auto; }
}

@media print {
    .med-newsbar, .med-header, .med-footer, .med-side,
    [data-ad-slot], .med-article__tags, .med-related,
    .med-hero__arrow, .med-hero__dots { display: none !important; }
    body { background: #fff; }
}
