/* ==========================================================================
   MEOW: responsive rules
   Desktop styles are the base. These rules adapt them for laptops,
   tablets and phones.
   ========================================================================== */

/* ---------- Large laptops ---------- */
@media (max-width: 1180px) {
  .hero__note--fact { left: -6%; }
  .hero__note--love { right: -3%; }
  .footer__grid { grid-template-columns: 1.4fr 1fr 1fr 1.2fr; gap: 2rem; }
  .article-layout { grid-template-columns: 240px minmax(0, 1fr); }
}

/* ---------- Small laptops and large tablets ---------- */
@media (max-width: 1024px) {
  .grid--3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .featured-grid { grid-template-columns: 1fr; }
  .featured-list { grid-template-rows: none; }
  .card--feature .card__media { aspect-ratio: 16 / 10; flex: none; min-height: 0; }
  .card--row .card__media { width: 34%; }
  .facts { grid-template-columns: 1fr; }
  .popular { grid-template-columns: 1fr; }
  .deco--pop1 { display: none; }
  .newsletter__card { grid-template-columns: 1fr 0.55fr; }
  .about-explore { grid-template-columns: 1fr; }

  /* Article layout: table of contents moves above the article */
  .article-layout { grid-template-columns: minmax(0, 740px); }
  .article-aside { position: static; max-height: none; overflow: visible; padding: 0; }
  .aside-share { display: none; }
}

/* ---------- Tablets: mobile navigation ---------- */
@media (max-width: 900px) {
  :root { --header-h: 68px; }
  .brand__logo { height: 40px; }
  .menu-toggle { display: inline-grid; }
  .nav {
    position: fixed; top: calc(var(--header-h) + 8px); left: var(--gutter); right: var(--gutter);
    flex-direction: column; align-items: stretch; gap: 1rem;
    background: var(--white); border-radius: 28px; padding: 1rem; box-shadow: var(--shadow-lg);
    max-height: calc(100vh - var(--header-h) - 24px); overflow: auto;
    opacity: 0; visibility: hidden; transform: translateY(-10px) scale(0.98); transform-origin: top center;
    transition: opacity 0.25s var(--ease), transform 0.25s var(--ease), visibility 0.25s;
  }
  .nav.is-open { opacity: 1; visibility: visible; transform: none; }
  .nav__list { flex-direction: column; align-items: stretch; gap: 0.25rem; }
  .nav__link { display: block; padding: 0.9rem 1.1rem; font-size: 1.08rem; border-radius: 18px; }
  .nav__cta { display: inline-flex; width: 100%; padding-block: 0.9rem; font-size: 1rem; }
  .header__actions { margin-left: auto; }

  .hero__grid { grid-template-columns: 1fr; }
  .hero__copy { text-align: center; }
  .hero__lead { margin-inline: auto; }
  .hero__actions, .hero__stats { justify-content: center; }
  .hero__stats { margin-inline: auto; }
  .hero__visual { width: min(82%, 400px); margin-top: 1rem; }
  .hero__note--fact { left: -10%; bottom: 6%; max-width: 240px; }
  .hero__note--love { right: -8%; }

  .cat-hero__grid, .about-intro, .not-found__grid { grid-template-columns: 1fr; }
  .cat-hero__media, .about-intro__media img { transform: none; }
  .contact-grid { grid-template-columns: 1fr; }
  .footer__grid { grid-template-columns: 1fr 1fr; }
  .footer__brand { grid-column: 1 / -1; }
  .topic-list--grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* ---------- Phones ---------- */
@media (max-width: 640px) {
  body { font-size: 1rem; }
  .section-head { flex-direction: column; align-items: flex-start; }
  .section-head--center { align-items: center; }
  .grid--3 { grid-template-columns: 1fr; }
  .facts__list { grid-template-columns: 1fr; }
  .card--row { flex-direction: column; }
  .card--row .card__media { width: auto; aspect-ratio: 3 / 2; margin: 0.6rem 0.6rem 0; min-height: 0; }
  .card--row .card__body { padding: 1.1rem 1.3rem 1.3rem; }
  .card--feature .card__body { padding: 1.2rem 1.35rem 1.4rem; }

  .hero__title { font-size: clamp(2.35rem, 11vw, 3rem); }
  .hero__accent { white-space: normal; }
  .hero__stats { gap: 0.75rem 1.5rem; }
  .hero__stats strong { font-size: 1.6rem; }
  .hero__visual { width: min(88%, 340px); }
  .hero__note--fact { position: relative; left: auto; bottom: auto; max-width: none; margin: -2.5rem 0.75rem 0; }
  .hero__note--love { right: -4%; top: 4%; font-size: 0.78rem; }
  .deco--s2, .deco--p2 { display: none; }

  .popular { padding: 1.5rem 1rem; border-radius: 32px; }
  .popular-item { grid-template-columns: auto 64px 1fr; gap: 0.75rem; padding: 0.6rem 0.8rem 0.6rem 0.6rem; }
  .popular-item__thumb { width: 64px; border-radius: 14px; }
  .popular-item__rank { font-size: 1.5rem; width: 1.8rem; }
  .popular-item__title { font-size: 1rem; }
  .popular-item .meta > :nth-child(n + 3) { display: none; }
  .facts { padding: 1.75rem 1.25rem; border-radius: 32px; }

  .newsletter__card { grid-template-columns: 1fr; text-align: center; padding: 2rem 1.25rem; border-radius: 32px; }
  .newsletter__visual { order: -1; }
  .newsletter__photo { width: 170px; }
  .newsletter__text { margin-inline: auto; }
  .newsletter-form { margin-inline: auto; }
  .newsletter-form__row { flex-direction: column; border-radius: 22px; }
  .newsletter-form__row .input { text-align: center; }
  .newsletter-form__row .btn { width: 100%; }

  .product-card--compact .product-card__media { width: 88px; }
  .product-card--compact .product-card__foot { flex-direction: column; align-items: flex-start; }

  .myth-fact { grid-template-columns: 1fr; }
  .form-row--2 { grid-template-columns: 1fr; }
  .topic-list--grid { grid-template-columns: 1fr; }
  .filter-bar .chip-list { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 0.5rem; margin-inline: calc(var(--gutter) * -1); padding-inline: var(--gutter); scrollbar-width: none; }
  .filter-bar .chip-list::-webkit-scrollbar { display: none; }
  .filter-bar .chip { white-space: nowrap; }

  .footer__grid { grid-template-columns: 1fr; gap: 1.5rem; }
  .footer__cat { width: 110px; top: -55px; }
  .site-footer { border-radius: 36px 36px 0 0; padding-top: 3.75rem; }
  .footer__bottom { flex-direction: column; }

  .search-dialog { margin-top: 1rem; }
  .search-field .btn { padding-inline: 0.85rem; }

  /* Article */
  .article-title { font-size: clamp(2rem, 9vw, 2.6rem); }
  .byline { border-radius: 24px; padding-right: 1rem; }
  .article-hero img { border-radius: 24px; aspect-ratio: 4 / 3; }
  .share-row { padding: 1.25rem; }
  .author-box { flex-direction: column; }
  .post-nav { grid-template-columns: 1fr; }
  .post-nav__link--next { flex-direction: row; text-align: left; }
  .post-nav__link--next .post-nav__label { justify-content: flex-start; }
  .prose { font-size: 1.04rem; }
  .prose .lead::first-letter { font-size: 3.1em; }
}

/* ---------- Small phones ---------- */
@media (max-width: 400px) {
  .hero__actions .btn { width: 100%; }
  .btn--lg { padding: 0.95rem 1.3rem; }
  .header__actions .icon-btn { width: 42px; height: 42px; }
  .brand__logo { height: 36px; }
}
