/* =============================================================================
   FOOX BRICKS: MOBILE PASS (Nov 2026)
   Load last, after colour-pass.css.

   Approach: intrinsic first. Fluid values (clamp with vw) that resolve to the
   current desktop value at desktop widths, and container queries on the
   components that live in narrow columns (product card, catalogue, colour
   table). Only the header and two strips use the existing 767px breakpoint.
   Desktop (≥ 1024px) renders pixel-identical; tablet benefits.
   ============================================================================= */

/* M1 Card padding scales with the screen ---------------------------------------
   Pico <article> padding was a fixed 32px. On a phone that left ~105px of
   content in a 2-up product card and wasted 64px on every page card.
   clamp() gives 32px from 800px wide, about 16px on a phone. The product card
   image well pulls flush with the same variables, so it follows automatically. */
:root {
  --pico-block-spacing-horizontal: clamp(var(--space-3), 4vw, var(--space-8));
  --pico-block-spacing-vertical: clamp(var(--space-4), 4vw, var(--space-8));

  /* Shared by the phone rules below */
  --tap-target: 44px; /* minimum touch target */
  --top-bar-height: 30px; /* the promo bar's fixed phone height; the sticky header offsets by it */
}

/* M2 Product cards in a phone-width grid --------------------------------------
   A container query on the grid, so it works for every grid (home, catalogue,
   related) without knowing the screen size: a grid narrower than 480px means
   2-up cards of 150–200px. Desktop and tablet grids are 600px+. */
.product-grid {
  container: product-grid / inline-size;
}

@container product-grid (max-width: 30rem) {
  /* "In winkelwagen" on one line: tighter tracking and padding */
  .product-card-add-btn {
    padding-inline: var(--space-2);
    font-size: var(--text-xs);
    letter-spacing: 0.08em;
    white-space: nowrap;
  }

  /* Long minifig names: max three lines, no dictionary hyphenation (DRA-GON) */
  .product-card-name {
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 3;
    line-clamp: 3;
    overflow: hidden;
    hyphens: manual;
    overflow-wrap: anywhere;
  }

  .product-card-condition {
    flex-wrap: wrap;
    gap: var(--space-1);
  }
}

/* M3 Related products and the catalogue: two across on a phone -----------------
   The minimum was clamp(20%, 170px, 50%), and 50% + the gap never fits twice,
   so phones got one card per row. Fixed at the source in components.css: the
   cap takes half of the grid's own --grid-gap off. Desktop resolves to the 20%
   minimum, unchanged. */

/* M4 Product image height follows the width on a phone --------------------------
   420px from ~470px wide (desktop unchanged), square-ish below. */
.product-detail-main-image {
  height: min(calc(26.25 * var(--pico-spacing)), 90vw);
}

/* Product title scales with the screen: 64px on desktop, ~35px on a phone,
   so a long minifig name is 4–5 lines instead of 10. */
.product-detail-title {
  font-size: clamp(var(--text-2xl), 9vw, var(--text-4xl));
}

/* M5 No dictionary hyphenation ----------------------------------------------
   Blades sets body { hyphens: auto } and the page is lang="nl". The Dutch
   dictionary splits English and brand words wrongly: "Bric-kLink", "VER-DIENT",
   "GE-BRUIKT", "DRA-GON". Words now break at spaces; a word longer than its box
   still breaks instead of overflowing. Soft hyphens (&shy;) keep working. */
body {
  hyphens: manual;
  overflow-wrap: break-word;
}

/* "Alles zien →" never wraps its arrow onto a second line */
.section-link {
  white-space: nowrap;
}

/* M6 Yellow CTA banner stacks when there is no room ----------------------------
   flex-wrap instead of a breakpoint; the headline scales down with the screen. */
.cta-banner-inner {
  flex-wrap: wrap;
}

.cta-banner h2 {
  font-size: clamp(var(--text-2xl), 7vw, calc(2.25 * var(--pico-spacing)));
}

/* M7 Catalogue: filters above the results on narrow screens --------------------
   The two-column grid stayed on phones and the results got clipped by
   overflow:hidden. A container query on the catalogue body switches to one
   column when there is no room for sidebar + two product columns. */
.catalog-body {
  container: catalog / inline-size;
}

/* Filters: one "Filters" bar on phones that opens the whole panel
   (catalog/_filter_panel.html). On wide screens the summary and the done bar
   are hidden and nothing changes. These come before the container query:
   same specificity, so the later rule wins. */
.filter-drawer {
  margin: 0; /* Pico's <details> margin */
}

.filter-drawer > summary,
.filter-drawer-done {
  display: none;
}

@container catalog (max-width: 47.9375rem) {
  /* overflow: clip instead of hidden: hidden made the card the scroll
     container of the sticky "Toon resultaten" bar, so it never stuck to the
     screen. clip cuts off the watermark the same way. */
  .catalog-layout {
    grid-template-columns: minmax(0, 1fr);
    overflow: clip;
  }

  .filter-panel {
    position: static;
    border-right: 0;
    border-bottom: 1px solid var(--line-color);
  }

  /* compact rows: the sections start closed on phones (see the template note) */
  .filter-panel details > summary {
    min-height: var(--tap-target);
    display: flex;
    align-items: center;
  }

  .filter-drawer > summary {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    min-height: var(--icon-btn-size); /* as tall as the logo row */
    padding: 0 var(--space-4);
    cursor: pointer;
    list-style: none;
    background: var(--color-black);
    font-family: var(--font-display);
    font-weight: 900;
    font-size: var(--text-lg);
    letter-spacing: 0.08em;
    text-transform: uppercase;
  }

  /* Beats Pico's summary colour and open-state margin */
  .filter-drawer > summary,
  .filter-drawer > summary:not([role]):not(:focus),
  .filter-drawer[open] > summary:not([role]):not(:focus) {
    color: var(--color-white);
    margin: 0;
  }

  .filter-drawer > summary:focus-visible {
    outline: var(--pico-outline-width) solid var(--color-yellow);
    outline-offset: calc(-1 * var(--pico-outline-width));
  }

  .filter-drawer > summary::-webkit-details-marker {
    display: none;
  }

  /* Font Awesome chevron in place of Pico's background-image one */
  .filter-drawer > summary::after {
    content: "\f078";
    font-family: "Font Awesome 6 Free";
    font-weight: 900;
    font-size: var(--text-sm);
    margin-left: auto;
    float: none;
    width: auto;
    height: auto;
    background: none;
    transform: none;
    transition: transform var(--transition-base);
  }

  .filter-drawer[open] > summary::after {
    transform: rotate(180deg);
  }

  .filter-drawer > summary i {
    color: var(--color-yellow);
  }

  .filter-drawer-count {
    --count-size: var(--space-6);
    display: inline-grid;
    place-items: center;
    min-width: var(--count-size);
    height: var(--count-size);
    padding: 0 var(--space-2); /* square, like every corner on the site (pico-custom.css) */
    background: var(--color-yellow);
    color: var(--color-black);
    font-family: var(--pico-font-family);
    font-size: var(--text-sm);
    font-weight: 700;
    letter-spacing: 0;
  }

  .filter-drawer-count:empty {
    display: none;
  }

  /* The panel's own header (title + Wis alles) moves into the bar and the done bar */
  .filter-drawer > .filter-panel .filter-panel-header {
    display: none;
  }

  .filter-drawer-done {
    display: flex;
    position: sticky;
    bottom: 0;
    gap: var(--space-3);
    padding: var(--space-3) var(--space-4);
    background: var(--pico-card-background-color);
    border-top: 1px solid var(--line-color);
  }

  .filter-drawer-done > * {
    flex: 1;
    margin: 0;
    min-height: var(--btn-height);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    /* "Toon resultaten" on one line at 360px, like the 2-up card buttons */
    padding-inline: var(--space-2);
    letter-spacing: 0.08em;
    white-space: nowrap;
  }
}

/* M8 Colour guide table fits a phone -------------------------------------------
   It had min-width: 560px inside a scroll box, so the BrickOwl column was cut
   off at the right edge. On narrow cards: no min-width, a smaller swatch column,
   no arrow and badge columns (the row tint already marks a different name). */
.color-guide-table {
  container: color-table / inline-size;
}

@container color-table (max-width: 35rem) {
  .color-guide-table table {
    min-width: 0;
  }

  .color-guide-table .col-swatch {
    width: var(--space-16);
  }

  .color-guide-table :is(.col-arrow, .col-badge) {
    width: 0;
  }

  .color-guide-table tr > :is(:nth-child(3), :nth-child(5)) {
    font-size: 0;
    padding: 0;
    overflow: hidden;
  }

  .color-guide-table tr > :nth-child(5) > * {
    display: none;
  }

  .color-guide-table tr > :first-child {
    padding-left: var(--space-3);
  }

  .color-guide-table tr > :nth-child(4) {
    padding-right: var(--space-3);
  }

  .color-guide-table :is(th, td) {
    height: auto;
    padding-block: var(--space-2);
    font-size: var(--text-sm);
    overflow-wrap: anywhere;
  }

  .color-guide-table thead :is(th, td) {
    font-size: var(--text-xs);
    letter-spacing: 0.1em;
  }
}

/* =============================================================================
   PHONE (the site's existing 767px breakpoint; these extend the rules already
   there in layout.css and components.css)
   ============================================================================= */
@media (max-width: 767px) {
  /* The fox watermark is anchored to the bottom of the catalogue layout. On a phone that is thousands of
     pixels down, but while the page is still streaming in the layout is short and the watermark is in view:
     it jumped away when the results arrived (layout shift 0.03-0.05 on /catalogus, #1144). */
  .catalog-watermark {
    display: none;
  }

  /* M9 Header: the promo bar scrolls away, the logo row + links stay ----------
     The whole header was sticky: top bar + logo row + link row = 140px of an
     844px screen. Sticking it 30px higher lets the top bar scroll off. */
  body > header {
    top: calc(-1 * var(--top-bar-height));
  }

  .top-bar {
    height: var(--top-bar-height);
    box-sizing: border-box;
  }

  /* Logo row: a little tighter */
  body > header nav > ul:first-child {
    height: var(--icon-btn-size);
  }

  /* Link row becomes a tab bar: every link a 44px target, spread across the
     width, the active page marked in yellow with a bar under it. "Shop" goes on
     phones because the logo already links home, which is what lets
     Catalogus, Aanbiedingen, Over ons and Contact fit at 360px without
     scrolling (it still scrolls sideways below that). */
  body > header nav > ul:nth-child(2) {
    justify-content: space-between;
    gap: 0;
  }

  .nav-links > li:first-child {
    display: none;
  }

  .nav-links > li {
    flex: 1 0 auto;
  }

  .nav-links > li > a {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: var(--tap-target);
    /* Pico pulls nav links out by a negative block margin: the 44px link sat in
       a 30px row, and the row's sideways scroll box cut off its top, bottom and
       the yellow bar. */
    margin-block: 0;
    padding-inline: clamp(var(--space-2), 2.5vw, var(--space-3));
    font-size: clamp(var(--text-sm), 3.7vw, var(--text-base));
    letter-spacing: 0;
    box-shadow: inset 0 -2px 0 transparent;
  }

  .nav-links > li > a.active {
    box-shadow: inset 0 -2px 0 var(--color-yellow);
  }

  /* Breadcrumb on one line: the current page (long part names) truncates */
  .catalog-breadcrumb {
    flex-wrap: nowrap;
    min-width: 0; /* it's a flex item of Pico's <nav> */
  }

  .catalog-breadcrumb > li {
    flex-shrink: 0;
    white-space: nowrap;
  }

  .catalog-breadcrumb > li:last-child {
    flex-shrink: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  /* M10 Hero stats: 2 × 2 instead of four full-width rows -------------------- */
  .hero-inner {
    padding-block: var(--space-10) var(--space-8);
  }

  .hero-stats-inner {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    padding-inline: var(--space-4);
  }

  .hero-stat,
  .hero-stat:last-child {
    padding: var(--space-3) var(--space-3) var(--space-3) 0;
    border-right: 0;
    border-bottom: 1px solid var(--color-black-muted);
  }

  .hero-stat:nth-child(odd) {
    border-right: 1px solid var(--color-black-muted);
  }

  .hero-stat:nth-child(even) {
    padding-left: var(--space-4);
  }

  .hero-stat:last-child {
    border-bottom: 0;
  }

  /* An odd last stat (three on the home page) takes the whole row. */
  .hero-stat:last-child:nth-child(odd) {
    grid-column: 1 / -1;
    border-right: 0;
  }

  .hero-stat-val {
    font-size: var(--text-lg);
  }

  .hero-stat-label {
    font-size: var(--text-xs);
  }

  /* Over ons stats strip: same 2 × 2 */
  .stats-strip {
    padding-block: var(--space-6);
  }

  .stats-strip > .container {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--space-5) var(--space-4);
  }

  .stats-strip > .container > :last-child:nth-child(odd) {
    grid-column: 1 / -1;
  }

  .stats-strip strong {
    font-size: var(--text-2xl);
  }

  /* M11 Login brand panel: a header, not a full screen ----------------------- */
  .auth-brand {
    padding: var(--space-6) var(--space-5);
  }

  .auth-brand h1 {
    font-size: var(--text-3xl);
  }

  .auth-studs {
    display: none; /* decorative colour squares */
  }
}
