/* =========================================================
   Responsive rules
   ========================================================= */

/* ---------- Large tablets / small desktops ---------- */
@media (max-width: 1180px) {
  .footer-grid {
    grid-template-columns: 1.2fr 1fr 1fr;
  }

  .footer-grid .footer-col:last-child {
    grid-column: 1 / -1;
  }
}

/* ---------- Tablets ---------- */
@media (max-width: 1024px) {
  .main-nav {
    display: none;
  }

  .header-actions .btn {
    display: none;
  }

  .nav-toggle {
    display: flex;
  }

  .hero__badge {
    width: 220px;
    height: 220px;
  }

  .hero__badge svg {
    width: 90px;
    height: 90px;
  }

  .grid-3 {
    grid-template-columns: repeat(2, 1fr);
  }

  .grid-4 {
    grid-template-columns: repeat(2, 1fr);
  }

  .stats-bar__row {
    grid-template-columns: repeat(3, 1fr);
    row-gap: 2rem;
  }

  .stats-bar__item:nth-child(3n+1) {
    border-inline-start: none;
  }

  .case-detail-grid {
    grid-template-columns: 1fr;
  }

  .contact-grid {
    grid-template-columns: 1fr;
  }
}

/* ---------- Small tablets / large phones ---------- */
@media (max-width: 768px) {
  :root {
    --header-h: 82px;
  }

  .site-header {
    padding: 14px 14px 0;
  }

  .site-header .container {
    padding: 8px 10px 8px 8px;
  }

  .section {
    padding-block: 3.2rem;
  }

  .hero {
    min-height: auto;
    padding-bottom: 3.5rem;
    background-position: 30% center;
  }

  .hero::before {
    background:
      linear-gradient(to bottom, rgba(24, 14, 9, 0.4), rgba(24, 14, 9, 0.4)),
      linear-gradient(to right, rgba(43, 24, 16, 0.8), rgba(34, 19, 13, 0.92));
  }

  .hero__content {
    max-width: none;
  }

  /* a squeezed 2-column mirror of the desktop layout was tried here and
     turned out too cramped/broken at phone widths — stacked reads far
     more cleanly and still feels premium with generous spacing. */
  .consult-promo__grid {
    grid-template-columns: 1fr;
    gap: 2.2rem;
    text-align: center;
  }

  .consult-promo__benefits {
    justify-items: start;
    gap: 0.9rem 1rem;
  }

  .consult-promo__visual {
    order: -1;
  }

  .consult-promo__actions {
    justify-content: center;
  }

  .consult-promo__actions .btn {
    width: 100%;
    justify-content: center;
  }

  .grid-2,
  .grid-3,
  .grid-4 {
    grid-template-columns: 1fr;
  }

  .stats .grid-4 {
    grid-template-columns: repeat(2, 1fr);
    row-gap: 2rem;
  }

  .stat-card:nth-child(3) {
    border-inline-start: none;
  }

  /* same 6-across row as desktop, just condensed — overrides the 3-col
     tablet rule above, which would otherwise cascade down to phone width */
  .stats-bar__row {
    grid-template-columns: repeat(6, 1fr);
    row-gap: 0;
    column-gap: 0.25rem;
  }

  .stats-bar__item {
    padding-inline: 0.3rem;
  }

  /* restore the plain "border on every item but the first" look for a
     single row of 6 — the 3-col tablet rule above only makes sense for
     a 3-wide grid and would otherwise strip the border off the 4th item */
  .stats-bar__item:nth-child(3n+1) {
    border-inline-start: 1px solid rgba(212, 166, 58, 0.3);
  }

  .stats-bar__item:first-child {
    border-inline-start: none;
  }

  .stats-bar__icon {
    width: 22px;
    height: 22px;
  }

  .stats-bar__icon svg {
    width: 13px;
    height: 13px;
  }

  .stats-bar__item {
    gap: 0.35rem;
  }

  .stats-bar__label {
    font-size: 0.5rem;
  }

  .stats-bar__number {
    font-size: 0.8rem;
  }

  .stats-bar__number small {
    font-size: 0.55rem;
  }

  .trust .container {
    flex-direction: column;
    align-items: flex-start;
  }

  .practice-carousel {
    min-height: unset;
  }

  .carousel__track {
    height: 300px;
  }

  /* keep the same 3-card fan as desktop (not just the active card) — the
     card just needs to be a much narrower slice of the viewport than
     desktop's min(460px, 82vw) so the side cards' offset actually clears
     the center card instead of crashing into its text. */
  .carousel__card {
    width: min(170px, 52vw);
    padding: 1rem 0.8rem;
    gap: 0.4rem;
  }

  .carousel__icon {
    width: 38px;
    height: 38px;
  }

  .carousel__icon svg {
    width: 16px;
    height: 16px;
  }

  .carousel__card h3 {
    font-size: 0.86rem;
  }

  .carousel__card p {
    font-size: 0.7rem;
    line-height: 1.5;
  }

  .carousel__link {
    font-size: 0.75rem;
  }

  .carousel__divider {
    width: 6px;
    height: 6px;
    margin-block: -0.2rem 0;
  }

  .footer-grid {
    grid-template-columns: 1fr;
    gap: 2.5rem;
  }

  .footer-grid .footer-col:last-child {
    grid-column: auto;
  }

  .footer-bottom {
    flex-direction: column;
    text-align: center;
  }

  .case-card {
    grid-template-columns: 1fr;
  }

  .case-card__metric {
    flex-direction: row;
    justify-content: center;
    gap: 12px;
  }

  .case-card__metric span {
    max-width: none;
    text-align: start;
  }

  .form-row {
    grid-template-columns: 1fr;
  }

  .articles-toolbar {
    flex-direction: column;
    align-items: stretch;
  }

  .search-box {
    max-width: none;
  }
}

/* ---------- Phones ---------- */
@media (max-width: 480px) {
  .container {
    padding-inline: 18px;
  }

  .btn {
    padding: 13px 24px;
    font-size: 0.88rem;
  }

  .brand__name {
    font-size: 1rem;
  }

  .brand__sub {
    display: none;
  }

  .hero h1 {
    font-size: 2rem;
  }

  .hero__actions {
    flex-direction: column;
    align-items: stretch;
  }

  .hero__actions .btn {
    justify-content: center;
  }

  .whatsapp-float,
  .back-to-top {
    width: 48px;
    height: 48px;
    bottom: 64px;
  }

  .whatsapp-float svg,
  .back-to-top svg {
    width: 22px;
    height: 22px;
  }

  .whatsapp-float {
    inset-inline-start: 16px;
  }

  .back-to-top {
    inset-inline-end: 16px;
  }

  .contact-info-card,
  .contact-form-wrap {
    padding: 1.8rem;
  }
}
