/* DSA — mobile fixes (2026-11-11). Loaded by mu-plugins/dsa-mobile-assets.php.
   Breakpoint 880px = the theme's own burger breakpoint (style.css §3). */

@media (max-width: 880px) {
  /* 1. Burger menu: the "Nettbutikk" item kept its desktop inline-flex row, so
        its category list sat BESIDE the link and ran off the right edge.
        Stack it under the link. The open menu also scrolls on short phones. */
  .dsa-nav {
    max-height: calc(100vh - 76px);
    max-height: calc(100dvh - 76px);
    overflow-y: auto;
    overscroll-behavior: contain;
    flex-wrap: nowrap !important; /* inline flex-wrap:wrap + max-height = 2nd column */
  }
  .dsa-nav > * { flex-shrink: 0; }
  .dsa-navitem-has-drop {
    display: flex !important;
    flex-direction: column;
    align-items: stretch;
  }
  .dsa-navdrop { width: 100%; box-sizing: border-box; }
  .dsa-navdrop-link { width: 100%; box-sizing: border-box; white-space: normal; }

  /* 2. Section rhythm: desktop paddings of 54-64px top AND bottom stacked into
        124-173px empty bands between sections on a phone. 40px each side. */
  #dsa-main section[style*="padding:clamp(64px"],
  #dsa-main section[style*="padding:clamp(60px"],
  #dsa-main section > div[style*="padding:clamp(60px"],
  #dsa-main section > div[style*="padding:clamp(54px"] {
    padding-top: 40px !important;
    padding-bottom: 40px !important;
  }
  #dsa-main section > div[style*="padding:clamp(44px"] {
    padding-top: 32px !important;
    padding-bottom: 32px !important;
  }
}

/* 3. Homepage gallery: four 9:16 videos stacked one per row were 2.5 screens
      tall on a phone. Two per row. */
@media (max-width: 620px) {
  #dsa-main #galleri [style*="minmax(210px"] {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 10px !important;
  }
}

/* ---- 2026-11-11 pass 2 (design review) ---------------------------------- */

/* 4. Home product row: was a hidden-scrollbar swipe slider on phones (owner
      rule: no sliders). Two-up grid instead. Overrides style.css @760px. */
@media (max-width: 1023px) {
  .dsa-prodgrid {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 12px !important;
    overflow: visible !important;
    scroll-snap-type: none !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
    padding: 0 !important;
  }
  .dsa-prodgrid > * { flex: none; min-width: 0; }
  .dsa-prodgrid h3 { overflow-wrap: anywhere; }
  .dsa-prodgrid .amount { white-space: nowrap; }
}
@media (max-width: 760px) {
  /* price above a full-width button: the 171px card can't hold both in a row */
  .dsa-prodgrid div:has(> .add_to_cart_button) { flex-direction: column; align-items: stretch !important; gap: 8px !important; }
  .dsa-prodgrid .add_to_cart_button { text-align: center; padding: 12px 10px !important; }
}

/* 5. /galleri/: CSS columns left a 3/3/1 hole at desktop and one photo per
      screen on phones. Flex rows, incomplete last row centred (owner rule). */
.dsa-grid {
  column-count: auto !important;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: clamp(12px, 1.4vw, 18px);
}
.dsa-grid > .dsa-gcard {
  flex: 0 0 calc((100% - 2 * clamp(12px, 1.4vw, 18px)) / 3);
  margin-bottom: 0 !important;
}
@media (max-width: 940px) {
  .dsa-grid > .dsa-gcard { flex-basis: calc((100% - clamp(12px, 1.4vw, 18px)) / 2); }
}
@media (max-width: 880px) {
  [data-ak-filterrow] { justify-content: center; }
}

/* 6. Scroll reveal: .8s inline transition left whole phone screens blank
      while scrolling. Faster, and none for reduced motion. */
[data-reveal] { transition-duration: .4s !important; }
@media (prefers-reduced-motion: reduce) {
  [data-reveal] { transition: none !important; opacity: 1 !important; transform: none !important; }
}

/* 7. Buttons fell back to the system font (gallery filters, contact chips). */
button { font-family: inherit; }

/* ---- 2026-11-11 pass 3 (UX / a11y review) ------------------------------- */

/* 8. Cookie banner covered the open menu's last links and the kontakt form. */
body.dsa-menu-open #ak-consent,
body:has(#dsa-menu:checked) #ak-consent { display: none !important; }
@media (max-width: 880px) {
  #ak-consent { padding: 12px 16px !important; }
  #ak-consent p { font-size: 13px !important; line-height: 1.45 !important; }
  #ak-consent > div { gap: 10px !important; }
  #ak-consent button { padding-top: 10px !important; padding-bottom: 10px !important; }
}

/* 9. Page behind the open menu / lightbox must not scroll. */
@media (max-width: 880px) { body.dsa-menu-open { overflow: hidden; } }
body.dsa-lb-open { overflow: hidden; }

/* 10. Search inside the burger menu (added by a11y.js); desktop keeps the header search. */
.dsa-nav-search { display: none; }
@media (max-width: 880px) {
  .dsa-nav-search { display: block; padding: 10px 0 6px; }
  .dsa-nav-search input {
    width: 100%; box-sizing: border-box; padding: 12px; font-size: 16px;
    border: 1px solid var(--line); border-radius: 2px; background: #fff; color: var(--ink);
  }
}

/* 11. Visible keyboard focus (default ring was 1.5:1 on teal) + skip link. */
:focus-visible { outline: 2px solid #C9A86A !important; outline-offset: 3px; }
.dsa-skip {
  position: absolute; left: 12px; top: -60px; z-index: 300;
  background: var(--ink); color: #F4F2EC; padding: 12px 18px; border-radius: 2px;
}
.dsa-skip:focus { top: 12px; }
/* 12. Tap targets: header icon buttons 40 → 44px. */
@media (max-width: 880px) {
  .dsa-burger, .dsa-iconbtn { width: 44px !important; height: 44px !important; }
}

/* 13. Contrast: Seniordag eyebrow #1E7A6E on sand was 4.17:1. */
#dsa-main section[data-screen-label="Seniordag"] [style*="text-transform:uppercase"] { color: #186B60 !important; }

/* Submenu caret (Ovanap rule 2026-11-11: every menu item with a submenu shows a small arrow) */
.dsa-navitem-has-drop > .dsa-navlink::after {
  content: "";
  display: inline-block;
  width: 6px; height: 6px;
  margin-left: 7px;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  transform: translateY(-3px) rotate(45deg);
  transition: transform .2s ease;
  opacity: .7;
}
.dsa-navitem-has-drop:hover > .dsa-navlink::after,
.dsa-navitem-has-drop:focus-within > .dsa-navlink::after { transform: translateY(0) rotate(225deg); }
@media (max-width: 880px) {
  .dsa-navitem-has-drop > .dsa-navlink::after { transform: translateY(0) rotate(225deg); }
}
@media (prefers-reduced-motion: reduce) { .dsa-navitem-has-drop > .dsa-navlink::after { transition: none; } }
