/* ==========================================================================
   CodesBuddy — responsive.css
   Breakpoints: 1440 / 1280 / 1024 / 900 / 768 / 560 / 400 / 340
   ========================================================================== */

/* ---------------------------------------------------------- 1440 & below */
@media (max-width: 1440px) {
  :root { --wrap: 1240px; }
}

/* ---------------------------------------------------------- 1280 & below */
@media (max-width: 1280px) {
  .wrap, .header-inner, .hero__inner { padding-inline: 22px; }
  .footer-grid { gap: 28px; }
  .header-search input { width: 178px; }
}

/* ---------------------------------------------------------- 1120 & below */
@media (max-width: 1120px) {
  .section { padding: 72px 0; }
  .footer-grid { grid-template-columns: 1.5fr 1fr 1fr 1.4fr; }
  .footer-col--cats { display: none; }
  .nav__link { padding: 8px 11px; font-size: 0.89rem; }
}

/* ---------------------------------------------------------- 1024 & below */
@media (max-width: 1024px) {
  .nav, .header-search, .lang { display: none; }
  .burger { display: grid; }
  .header-actions { margin-left: auto; }

  .grid--4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid--3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }

  .cat-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }

  .contact-grid { grid-template-columns: 1fr; gap: 32px; }
  .mission { grid-template-columns: 1fr; gap: 30px; text-align: center; }
  .mission p { max-width: 640px; margin-inline: auto; }

  .hero__inner { padding: 78px 22px 112px; }
  .hero__wave { height: 66px; }
}

/* ----------------------------------------------------------- 900 & below */
@media (max-width: 900px) {
  .footer-grid { grid-template-columns: 1fr 1fr; gap: 34px; }
  .footer-col--cats { display: block; }
  .footer-about { grid-column: 1 / -1; }
  .footer-news { grid-column: 1 / -1; }
  .newsletter-box { padding: 40px 26px; }
}

/* ----------------------------------------------------------- 768 & below */
@media (max-width: 768px) {
  :root { --header-h: 60px; }

  .section { padding: 58px 0; }
  .section--tight { padding: 44px 0; }
  .section-head { margin-bottom: 34px; }
  .section-head h2 { flex-direction: row; gap: 10px; }

  .grid { gap: 18px; }
  .grid--4, .grid--3, .grid--2 { grid-template-columns: 1fr; }
  .cat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }

  /* Disable 3D rotation on touch layouts — keeps taps predictable */
  .card-3d { transform: none; }
  .coupon-card:hover, .coupon-card:focus-within,
  .store-card:hover, .store-card:focus-within,
  .cat-card:hover, .cat-card:focus-visible,
  .feature-card:hover {
    transform: translateY(-4px);
  }
  .coupon-card:hover .store-logo,
  .coupon-card:focus-within .store-logo,
  .store-card:hover .store-logo,
  .cat-card:hover .cat-card__icon,
  .feature-card:hover .feature-card__icon {
    transform: scale(1.04);
  }
  .coupon-card:hover .badge--discount { transform: none; }
  .card-3d::after { display: none; }

  .hero__inner { padding: 56px 20px 92px; }
  .hero h1 { font-size: clamp(1.85rem, 8vw, 2.5rem); max-width: none; }
  .hero__sub { font-size: 0.98rem; }
  .hero__badge { font-size: 0.8rem; padding: 7px 14px; }
  .hero__wave { height: 48px; }

  .hero-search {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
    padding: 12px;
    border-radius: 18px;
    max-width: 100%;
  }
  .hero-search__icon { display: none; }
  .hero-search input {
    height: 46px;
    padding: 0 14px;
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    background: var(--bg);
  }
  .hero-search .btn { width: 100%; }

  .hero__stats { gap: 18px 30px; margin-top: 34px; }
  .hero__stat b { font-size: 1.35rem; }

  .toolbar { flex-direction: column; align-items: stretch; gap: 14px; }
  .filters { overflow-x: auto; flex-wrap: nowrap; padding-bottom: 4px; -webkit-overflow-scrolling: touch; }
  .filters::-webkit-scrollbar { height: 0; }
  .filter-btn { flex-shrink: 0; }
  .sort { justify-content: space-between; }
  .sort select { flex: 1; }

  .form-card { padding: 24px 20px; }
  .form-row { grid-template-columns: 1fr; gap: 0; }

  .store-hero__row { gap: 16px; }
  .store-hero .store-logo--lg { width: 68px; height: 68px; font-size: 1.25rem; border-radius: 18px; }
  .store-hero__actions .btn { flex: 1; }

  .commitment { padding: 34px 22px; }
  .newsletter-form { flex-direction: column; }
  .newsletter-form .btn { width: 100%; }

  .footer-grid { grid-template-columns: 1fr 1fr; gap: 28px; }
  .site-footer { padding-top: 52px; }
  .footer-bottom { flex-direction: column; align-items: flex-start; margin-top: 36px; }

  .cookie {
    flex-direction: column;
    align-items: flex-start;
    gap: 14px;
    padding: 18px;
    left: 16px;
    right: 16px;
    width: auto;
    transform: translateY(140%);
    max-width: none;
  }
  .cookie.is-visible { transform: translateY(0); }
  .cookie__actions { width: 100%; }
  .cookie__actions .btn { flex: 1; }

  .toast-stack { left: 14px; right: 14px; bottom: 14px; }
  .toast { max-width: none; }

  .to-top { right: 16px; bottom: 78px; width: 42px; height: 42px; }
}

/* ----------------------------------------------------------- 560 & below */
@media (max-width: 560px) {
  .wrap, .header-inner, .hero__inner { padding-inline: 16px; }
  .logo__text { font-size: 1.1rem; }
  .logo__mark { width: 36px; height: 36px; border-radius: 11px; }
  .logo__mark svg { width: 20px; height: 20px; }

  .cat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
  .cat-card { padding: 22px 12px; }
  .cat-card__icon { width: 52px; height: 52px; border-radius: 16px; }
  .cat-card__icon svg { width: 24px; height: 24px; }
  .cat-card__name { font-size: 0.95rem; }

  .coupon-card, .store-card { padding: 18px; }
  .footer-grid { grid-template-columns: 1fr; gap: 26px; }
  .footer-about p { max-width: none; }

  .hero__stats { gap: 14px 24px; }
  .hero__stat b { font-size: 1.2rem; }
  .hero__stat span { font-size: 0.76rem; }
}

/* ----------------------------------------------------------- 400 & below */
@media (max-width: 400px) {
  h1 { font-size: 1.7rem; }
  h2 { font-size: 1.4rem; }
  .cat-grid { grid-template-columns: 1fr; }
  .coupon-card__foot { flex-direction: column; align-items: stretch; gap: 10px; }
  .coupon-card__foot .btn { width: 100%; }
  .store-hero__actions { flex-direction: column; }
  .store-hero__actions .btn { width: 100%; }
  .mobile-menu { padding: 16px 16px 22px; }
}

/* ----------------------------------------------------------- 340 & below */
@media (max-width: 340px) {
  .wrap, .header-inner, .hero__inner { padding-inline: 12px; }
  .logo__text { display: none; }
  .hero__badge { font-size: 0.74rem; }
}

/* --------------------------------------------------------- Large screens */
@media (min-width: 1600px) {
  :root { --wrap: 1320px; }
  .hero__inner { padding-block: 116px 148px; }
}

/* --------------------------------------------------------------- Utility */
@media print {
  .site-header, .mobile-menu, .cookie, .to-top, .toast-stack, .site-footer { display: none !important; }
  main { padding-top: 0; }
}
