/* =====================================================================
   ONYX LABS — Responsive layer
   Breakpoints: 1440 (large desktop) · 1180 (laptop) · 960 (tablet) ·
                720 (large phone) · 480 (phone, down to 360/375)
   ===================================================================== */

@media (min-width: 1680px) {
  :root { --container: 1360px; }
}

/* ---------- Laptop ---------- */
@media (max-width: 1180px) {
  .header-inner { gap: 1.25rem; }
  .main-nav__link { padding-inline: .6rem; }
  .tabs { grid-template-columns: 200px minmax(0, 1fr); }
  .feature-list { grid-template-columns: 1fr; }
  .contact-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* ---------- Small laptop: 2 + 1 product layout ---------- */
@media (min-width: 961px) and (max-width: 1180px) {
  .product-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  /* The third card takes the full row, screenshot beside the content */
  .product-card:nth-child(3) { grid-column: 1 / -1; flex-direction: row; }
  .product-card:nth-child(3) .product-card__shot {
    flex: 0 0 44%;
    aspect-ratio: auto;
    border-bottom: 0;
    border-inline-end: 1px solid var(--line);
  }
  .product-card:nth-child(3) .feature-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* Single-column cards have room for the icon beside the name again */
@media (min-width: 481px) and (max-width: 960px) {
  .product-card__head { flex-direction: row; align-items: center; }
}

/* ---------- Tablet: mobile navigation ---------- */
@media (max-width: 960px) {
  :root { --header-h: 64px; }

  .menu-toggle { display: inline-flex; }

  .main-nav {
    position: fixed;
    /* The header's backdrop-filter makes it the containing block, so the
       panel is sized with an explicit height rather than bottom: 0. */
    inset: var(--header-h) 0 auto 0;
    height: calc(100vh - var(--header-h));
    height: calc(100dvh - var(--header-h));
    overflow-y: auto;
    flex-direction: column;
    justify-content: flex-start;
    align-items: stretch;
    gap: 1.5rem;
    padding: 1.25rem var(--gutter) 2rem;
    background: var(--bg);
    border-bottom: 1px solid var(--line);
    visibility: hidden;
    opacity: 0;
    transform: translateY(-8px);
    transition: opacity .25s var(--ease), transform .25s var(--ease), visibility 0s .25s;
  }
  .main-nav.is-open {
    visibility: visible;
    opacity: 1;
    transform: none;
    transition: opacity .25s var(--ease), transform .25s var(--ease), visibility 0s;
  }
  body.menu-open { overflow: hidden; }

  .main-nav__list { flex-direction: column; margin: 0; gap: 0; }
  .main-nav__link {
    padding: .95rem .25rem;
    font-size: 1.1rem;
    border-bottom: 1px solid var(--line);
    border-radius: 0;
  }
  .main-nav__link[aria-current="true"] { color: var(--green); }
  .main-nav__indicator { display: none; }

  .nav-actions { justify-content: space-between; }
  .lang-switch__btn { min-height: 40px; min-width: 48px; font-size: .85rem; }
  .nav-cta { min-height: 44px; padding-inline: 1.2rem; font-size: var(--fs-sm); }

  .hero__inner { grid-template-columns: 1fr; }
  .hero__copy { max-width: 680px; }
  .terminal__body { height: 320px; }

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

  /* Tabs become a horizontal, scrollable strip */
  .tabs { grid-template-columns: 1fr; gap: 1rem; }
  .tabs__list-wrap {
    position: static;
    margin-inline: calc(var(--gutter) * -1);
    padding-inline: var(--gutter);
    overflow-x: auto;
    scrollbar-width: none;
  }
  .tabs__list-wrap::-webkit-scrollbar { display: none; }
  .tabs__list {
    flex-direction: row;
    border-inline-start: 0;
    border-bottom: 1px solid var(--line);
    width: max-content;
    min-width: 100%;
  }
  .tabs__tab { white-space: nowrap; padding: .8rem 1rem; }
  .tabs__tab::before {
    inset: auto 0 -1px 0;
    width: auto;
    height: 2px;
    transform: scaleX(0);
  }
  .tabs__tab[aria-selected="true"]::before { transform: scaleX(1); }
  .tabs__tab[aria-selected="true"] { background: transparent; }

  .docs-layout { grid-template-columns: 1fr; }
  .docs-sidebar { position: static; }
  .docs-products { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .docs-nav {
    display: flex;
    flex-wrap: wrap;
    gap: .4rem;
    border: 0;
  }
  .docs-nav__item {
    margin: 0;
    padding: .5rem .85rem;
    border: 1px solid var(--line);
    border-radius: 999px;
    white-space: nowrap;
  }
  .docs-nav__item[aria-current="true"] { border-color: var(--green); background: var(--green-dim); }
  .docs-search { width: 100%; }

  .why__inner, .about__inner { grid-template-columns: 1fr; }
  .why__head { position: static; }

  .footer-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .footer-brand { grid-column: 1 / -1; }
}

/* ---------- Large phone ---------- */
@media (max-width: 720px) {
  .feature-grid { grid-template-columns: 1fr; }
  .gallery { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .req-table > div { grid-template-columns: 1fr; gap: .4rem; }
  .download-panel__meta { grid-template-columns: 1fr; }
  .values__item { grid-template-columns: 1fr; gap: .4rem; }
  .lightbox__inner { padding: 3.5rem .5rem 4.5rem; }
  .lightbox__nav { top: auto; bottom: 0; transform: none; }
  .lightbox__nav--prev { inset-inline-start: calc(50% - 56px); }
  .lightbox__nav--next { inset-inline-end: calc(50% - 56px); }
  .lightbox__count { inset-inline-start: .5rem; }
}

/* ---------- Phone ---------- */
@media (max-width: 480px) {
  .hero { padding-top: 2.5rem; }
  .hero__actions .btn { flex: 1 1 100%; }
  .terminal__body { height: 300px; padding: .9rem; }
  .terminal__status { display: none; }

  .feature-list { grid-template-columns: 1fr; }
  .product-meta { grid-template-columns: 1fr; gap: 0; }
  .product-meta > div { padding-block: .8rem; }
  .product-card__actions .btn { flex: 1 1 auto; }
  .product-card__actions .btn--download { flex-basis: 100%; }

  .detail-head { align-items: flex-start; }
  .detail-head, .product-card__head { flex-direction: column; align-items: flex-start; gap: .9rem; }
  .detail-head .section-title,
  .product-card__name { font-stretch: 100%; font-size: 1.45rem; }
  .tabs__panel { padding: 1.25rem; }
  .gallery { grid-template-columns: 1fr; }
  .download-panel__actions .btn { flex: 1 1 100%; }

  .docs-products { grid-template-columns: 1fr; }
  .docs-article { padding: 1.25rem; }

  .contact-list { grid-template-columns: 1fr; }
  .footer-grid { grid-template-columns: 1fr 1fr; }
  .footer-bottom { flex-direction: column; }
}

@media (max-width: 360px) {
  .brand__name { font-size: .95rem; }
  .nav-actions { flex-wrap: wrap; gap: .75rem; }
}
