/* ==========================================================================
   Archery Arcade — Responsive layer
   Breakpoints verified against: 320, 375, 390, 414, 768, 1024, 1280, 1440, 1920
   Mobile-first: style.css holds the small-screen baseline where practical,
   this file layers up and handles the nav collapse.
   ========================================================================== */

/* --------------------------------------------------------------------------
   Large desktop refinements (1440px+)
   -------------------------------------------------------------------------- */
@media (min-width: 1440px) {
  :root { --wrap: 1340px; }
  .grid--4 { grid-template-columns: repeat(auto-fill, minmax(262px, 1fr)); }
}

@media (min-width: 1920px) {
  :root { --wrap: 1440px; }
  body { font-size: 1.06rem; }
}

/* --------------------------------------------------------------------------
   Below 1080px — hero stacks earlier so the art never squashes
   -------------------------------------------------------------------------- */
@media (max-width: 1080px) {
  .hero__grid {
    grid-template-columns: 1fr;
    gap: var(--sp-6);
  }
  .hero { padding-block: var(--sp-7) var(--sp-6); }
  .hero__art { order: -1; }
  .footer-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .footer-brand { grid-column: 1 / -1; }
}

/* --------------------------------------------------------------------------
   Tablet & mobile nav (<= 900px)
   -------------------------------------------------------------------------- */
@media (max-width: 900px) {
  :root { --header-h: 60px; }

  .nav-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 42px; height: 42px;
    border-radius: var(--r-md);
    border: 1px solid var(--c-line);
    background: var(--c-surface);
    color: var(--c-text);
    cursor: pointer;
    order: -1;
  }
  .nav-toggle svg { width: 20px; height: 20px; }

  .brand__name small { display: none; }

  .nav {
    position: fixed;
    inset: var(--header-h) 0 0 0;
    background: var(--c-bg-deep);
    margin: 0;
    padding: var(--sp-5);
    overflow-y: auto;
    transform: translateX(-100%);
    visibility: hidden;
    transition: transform .25s var(--ease), visibility .25s;
    border-top: 1px solid var(--c-line);
    z-index: 55;
  }
  .nav[data-open="true"] {
    transform: translateX(0);
    visibility: visible;
  }
  .nav__list {
    flex-direction: column;
    align-items: stretch;
    gap: .2rem;
  }
  .nav__link {
    display: block;
    padding: .95rem 1rem;
    font-size: 1.05rem;
    border-radius: var(--r-md);
    border-bottom: 1px solid var(--c-line-soft);
  }

  body[data-nav-open="true"] { overflow: hidden; }
}

/* --------------------------------------------------------------------------
   Tablet (<= 768px)
   -------------------------------------------------------------------------- */
@media (max-width: 768px) {
  :root {
    --sp-8: 3rem;
    --sp-9: 4rem;
  }
  .wrap { padding-inline: var(--sp-4); }
  .section { padding-block: var(--sp-7); }

  .grid--3, .grid--4 {
    grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  }

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

  .hero__stats { gap: var(--sp-5); }

  .toolbar__label { min-width: 100%; }
}

/* --------------------------------------------------------------------------
   Wide content (tables) scrolls inside its own container rather than
   widening the page. The container is the scroller, not the table itself -
   a table with display:block does not reliably clip in every engine.
   -------------------------------------------------------------------------- */
.table-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  max-width: 100%;
}
.table-scroll table { margin-bottom: 0; min-width: 22rem; }

/* --------------------------------------------------------------------------
   Phones (<= 560px)
   -------------------------------------------------------------------------- */
@media (max-width: 560px) {
  .grid--3, .grid--4, .grid--2 { grid-template-columns: 1fr; }

  .section-head { align-items: flex-start; flex-direction: column; gap: var(--sp-2); }

  .hero__actions .btn { width: 100%; }
  .hero__stats {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--sp-4);
  }

  .footer-grid { grid-template-columns: 1fr; gap: var(--sp-5); }
  .footer-bottom { flex-direction: column; align-items: flex-start; }

  .ad-slot { margin-block: var(--sp-6); }
}

/* --------------------------------------------------------------------------
   Small phones (<= 380px) — 320/375 safety
   -------------------------------------------------------------------------- */
@media (max-width: 400px) {
  .wrap { padding-inline: var(--sp-3); }

  /* The header is the tightest row on the site: at 320px the toggle, brand
     and two tools have to share about 296px. Everything here is width. */
  .site-header__inner { gap: var(--sp-2); }
  .brand { font-size: .96rem; gap: .45rem; }
  .brand__mark { width: 28px; height: 28px; }
  .nav-toggle { width: 38px; height: 38px; }
  .header-tools { gap: 4px; }
  .header-tools .icon-btn { width: 36px; height: 36px; }
  .header-tools .icon-btn svg { width: 17px; height: 17px; }

  .btn { padding: .7rem 1.1rem; }
  .hero__stats { grid-template-columns: 1fr 1fr; gap: var(--sp-3); }
}

/* --------------------------------------------------------------------------
   Landscape phones — keep the game canvas usable
   -------------------------------------------------------------------------- */
@media (max-height: 520px) and (orientation: landscape) {
  .site-header { position: static; }
  .hero { padding-block: var(--sp-6); }
}

/* --------------------------------------------------------------------------
   Coarse pointers — bigger hit areas
   -------------------------------------------------------------------------- */
@media (pointer: coarse) {
  .pill, .btn--sm { min-height: 44px; }
  .fav-btn { width: 44px; height: 44px; }
  .nav__link { min-height: 44px; }
}
