/* WordPress-specific additions. ds.css and site.css stay byte-identical to the
   static build; everything the CMS introduces — real images in the placeholder
   slots, pagination, editor content, accessibility helpers — lives here. */

/* ── accessibility helpers ──────────────────────────────────────────── */

.screen-reader-text {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip-path: inset(50%);
  white-space: nowrap; border: 0;
}
.screen-reader-text:focus {
  position: static;
  width: auto; height: auto;
  margin: var(--space-2); padding: var(--space-2);
  clip-path: none;
  background: var(--color-accent); color: var(--color-bg);
  font-family: var(--font-heading); font-weight: 800;
}

/* ── real images in the placeholder slots ───────────────────────────── */

/* The slots are flex containers sized by aspect-ratio. A photograph sits
   inside the box whole: these are equipment shots -- lane lines, mats,
   javelins, parallel bars -- whose subject runs the full width or height of
   the frame, so object-fit: cover cut the ends off nearly every one. contain
   letterboxes instead, and the tinted ground makes the box read as a
   deliberate frame rather than a loading error. */
.card-thumb:has(img),
.product-photo:has(img) {
  padding: 0;
  background: var(--color-neutral-100);
  position: relative;
  /* min-height: auto is the flex/grid default, and it stops the box shrinking
     below its content, so the image's natural height beat aspect-ratio and
     frames in one row came out 303, 285 and 213 px tall. */
  min-height: 0;
}

/* width/height 100% with object-fit: contain, not max-width/max-height with
   auto. The max-* form makes the box's height depend on the image while
   aspect-ratio makes the image's height depend on the box, and the browser
   resolves that circle in favour of the natural size -- so the frames came out
   303, 285 and 213 px tall in one row. Filling the box and letting object-fit
   do the letterboxing keeps every frame identical. */
/* Absolutely positioned, with the size written out rather than left to auto.
   Two traps here, both hit in turn. A percentage height on an in-flow child of
   a box sized by aspect-ratio counts as indefinite, so height: 100% resolved
   to auto and the picture overflowed its frame by up to 73 px. Switching to
   position: absolute with inset did not fix it either: an image is a replaced
   element, and for those height: auto means the intrinsic height, not "stretch
   to the pinned edges". Explicit calc() sizes are definite -- a percentage
   against an absolute element's containing block resolves normally -- and they
   double as the padding that keeps the subject off the border. */
/* scale-down, not contain: some AVK photographs are only 150-280 px, and
   contain blew them up to the frame and blurred them. scale-down shrinks a
   large photo exactly as contain did and leaves a small one at its own size,
   sharp, in the middle of the frame. */
.card-thumb img,
.product-photo img {
  position: absolute;
  top: var(--space-3); left: var(--space-3);
  width: calc(100% - var(--space-3) * 2);
  height: calc(100% - var(--space-3) * 2);
  object-fit: scale-down;
  display: block;
}

/* ── editor content ─────────────────────────────────────────────────── */

.entry { max-width: 68ch; font-size: 16px; }
.entry > * + * { margin-top: var(--space-4); }
.entry h2 { font-size: 22px; }
.entry h3 { font-size: 18px; }
.entry img,
.entry iframe { max-width: 100%; height: auto; }
.entry ul,
.entry ol { padding-left: var(--space-6); }

.product-lede p { margin: 0 0 var(--space-3); }
.product-lede > :last-child { margin-bottom: 0; }

/* The custom region on a discipline page keeps the two-column layout of the
   prototype when the editor supplies exactly two blocks; anything else stacks. */
.custom > iframe { width: 100%; min-height: 320px; border: 0; }

/* The all-disciplines section is the one page band the prototype left without
   horizontal padding; align it with every other section. */
.sec-all { padding: var(--space-6) var(--space-6) 0; }

/* ── pagination ─────────────────────────────────────────────────────── */

.pagination { margin-top: var(--space-8); }
.pagination .nav-links {
  display: flex; gap: var(--space-3); flex-wrap: wrap; align-items: center;
  font-family: var(--font-heading); font-weight: 800;
  font-size: 13px; text-transform: uppercase; letter-spacing: 0.06em;
}
/* A page number is one digit, so the link measured seven pixels across --
   the smallest target on the site, and the only one that failed WCAG 2.5.8
   even with the spacing exception: neighbouring numbers sat 21px apart when
   24 is the minimum. Square boxes at every width, not just on a phone; nine
   pixels is an awkward thing to hit with a mouse too. The row centres rather
   than sitting on a baseline so the boxes line up. */
.pagination .page-numbers {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 24px; min-width: 24px;
}
.pagination a { text-decoration: none; color: var(--color-neutral-700); }
.pagination a:hover { color: var(--color-accent); }
.pagination .current { color: var(--color-accent); }
.pagination .screen-reader-text { display: none; }

/* ── admin bar ──────────────────────────────────────────────────────── */

body.admin-bar .site-header { scroll-margin-top: 32px; }

/* ── language switch ────────────────────────────────────────────────── */

.lang-switch {
  display: flex; gap: var(--space-2); align-items: center;
  font-family: var(--font-heading); font-weight: 800;
  font-size: 13px; letter-spacing: 0.06em;
}
/* An svg has no baseline, so the row centres instead of sitting on one. */
.lang-switch .icon { color: var(--color-neutral-600); margin-right: -2px; }
.lang-switch a { text-decoration: none; color: var(--color-neutral-600); }
.lang-switch a:hover { color: var(--color-accent); }
.lang-switch a[aria-current='true'] { color: var(--color-text); }
.lang-switch abbr { text-decoration: none; border: 0; cursor: inherit; }

/* The catalog grid links on to the full archive. */
.grid-more { margin: var(--space-6) 0 0; }

/* The front page body band sits between the pictograms and the catalog. */
.sec-intro { padding-top: 0; }
.sec-intro .entry { max-width: 68ch; }

/* Variants table under the specification on a catalog item. */
.variants-head {
  font-size: 16px; margin: var(--space-6) 0 var(--space-3);
  text-transform: uppercase; letter-spacing: 0.06em;
}
.table.variants td:first-child { width: 40%; white-space: nowrap; }

/* ── subcategories ──────────────────────────────────────────────────── */

/* A subcategory is a real term with its own page, so the chip is a link.
   Disciplines that have no child terms still render plain spans, which is
   why the hover rules are scoped to the anchor. */
a.tag-sub { text-decoration: none; }
a.tag-sub:hover,
a.tag-sub:focus-visible {
  background: var(--color-accent); color: var(--color-bg); border-color: var(--color-accent);
}

/* ── product grid on a discipline page ──────────────────────────────── */

/* Replaces the catalog table. The table put a 72 px thumbnail beside four
   columns of metadata and needed min-width: 640px, so on a phone it scrolled
   sideways: the product name was clipped mid-word and the code, type and lead
   time sat off-screen entirely. A grid of photographs needs no horizontal
   scroll at any width and gives the picture the room it was missing. */
.product-grid {
  display: grid; gap: var(--space-6);
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
}

.product-card {
  display: flex; flex-direction: column;
  text-decoration: none; color: var(--color-text);
  border: 1px solid var(--color-divider);
  background: var(--color-bg);
  transition: border-color 0.15s ease;
}
.product-card:hover,
.product-card:focus-visible { border-color: var(--color-accent); }

.product-card__photo {
  aspect-ratio: 4 / 3;
  position: relative;
  display: grid; place-items: center;
  background: var(--color-neutral-100);
  border-bottom: 1px solid var(--color-divider);
  min-height: 0; /* see the note above: keeps aspect-ratio in charge */
}
.product-card__photo img {
  position: absolute;
  top: var(--space-4); left: var(--space-4);
  width: calc(100% - var(--space-4) * 2);
  height: calc(100% - var(--space-4) * 2);
  object-fit: scale-down; display: block; /* see .card-thumb img */
}
.product-card__nophoto {
  font-size: 12px; text-align: center; text-wrap: balance;
  color: var(--color-neutral-600); letter-spacing: 0.04em;
}

.product-card__body {
  display: flex; flex-direction: column; flex: 1;
  padding: var(--space-4);
}
.product-card__type {
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--color-neutral-600);
}
.product-card__title {
  font-size: 16px; line-height: 1.3; margin: var(--space-2) 0 var(--space-4);
  text-wrap: pretty;
}
.product-card:hover .product-card__title { color: var(--color-accent-700); }

/* Pushed to the foot so the codes line up across a row of uneven titles. */
.product-card__meta {
  margin-top: auto; display: flex; flex-wrap: wrap; gap: var(--space-2);
  align-items: baseline; justify-content: space-between;
  font-size: 12px; color: var(--color-neutral-600);
}
.product-card__code {
  font-variant-numeric: tabular-nums; letter-spacing: 0.04em;
  color: var(--color-text);
}

/* One column on a phone: at two, a 4:3 photograph is barely larger than the
   72 px thumbnail this replaced, which was the whole complaint. */
@media (max-width: 560px) {
  .product-grid { grid-template-columns: 1fr; gap: var(--space-4); }
  .product-card__photo { aspect-ratio: 3 / 2; }
}

/* Utility: content for screen readers only. */
.sr-only {
  position: absolute; width: 1px; height: 1px;
  margin: -1px; padding: 0; overflow: hidden;
  clip-path: inset(50%); white-space: nowrap; border: 0;
}

/* ── breadcrumbs ────────────────────────────────────────────────────── */

/* Replaces the single "← back" link the prototype used. The trail is three
   levels deep in places (discipline > subcategory > item), and one link back
   could not say where those levels were. */
.crumbs { margin: 0 0 var(--space-4); }
.crumbs ol {
  display: flex; flex-wrap: wrap; align-items: baseline;
  gap: var(--space-2); margin: 0; padding: 0; list-style: none;
  font-size: 12px; text-transform: uppercase; letter-spacing: 0.06em;
}
.crumbs li { display: flex; align-items: baseline; gap: var(--space-2); }
.crumbs li + li::before { content: '/'; color: var(--color-neutral-600); }
.crumbs a { text-decoration: none; color: var(--color-neutral-700); }
.crumbs a:hover { color: var(--color-accent); }
.crumbs [aria-current='page'] { color: var(--color-text); }

/* ── all disciplines: linked and unlinked ───────────────────────────── */

/* The list mixes disciplines that have a page with ones that do not. The two
   used to look identical, and the unlinked ones were <a> elements with no
   href -- not links to a screen reader, and a text cursor to everyone else. */
.group-item { font-size: 14px; padding: 2px 0; }
a.group-item { text-decoration: none; color: var(--color-text); }
a.group-item:hover { color: var(--color-accent); }
.group-item.is-empty {
  color: var(--color-neutral-600); cursor: default;
}

/* The same marks as the front page, at reading size. They are masks filled
   with currentColor, so a discipline with no catalog items greys out mark
   and name together instead of showing a black mark beside a grey word. */
.has-marks .group-item {
  display: flex; align-items: center; gap: var(--space-3);
}
.has-marks .picto-mark { width: 24px; height: 24px; }
/* A discipline with no mark keeps the empty slot: without it that one name
   would sit a column-width to the left of all the others. */
.picto-mark.is-blank { background: none; }
.legend {
  display: flex; align-items: center; gap: var(--space-2);
  margin: calc(var(--space-8) * -1 + var(--space-4)) 0 var(--space-6);
  font-size: 12px; color: var(--color-neutral-600);
}
.legend-key {
  width: 10px; height: 10px; border-radius: 2px; flex: none;
  background: var(--color-neutral-600);
}

/* ── credits page ───────────────────────────────────────────────────── */

.credit-note {
  max-width: 68ch; margin: 0 0 var(--space-6);
  font-size: 14px; color: var(--color-neutral-700);
}
.credit-author { margin-bottom: var(--space-6); }
.credit-author h3 {
  display: flex; align-items: baseline; gap: var(--space-3);
  margin: 0 0 var(--space-3); font-size: 14px;
  text-transform: uppercase; letter-spacing: 0.04em;
}
.credit-author h3 span {
  font-family: var(--font-body); font-weight: 400;
  font-size: 12px; text-transform: none; letter-spacing: 0;
  color: var(--color-neutral-600);
}
.credit-marks {
  list-style: none; margin: 0; padding: 0;
  display: grid; grid-template-columns: repeat(auto-fill, minmax(156px, 1fr));
  gap: var(--space-3);
}
.credit-marks a {
  display: flex; align-items: center; gap: var(--space-3);
  font-size: 13px; text-decoration: none; color: var(--color-text);
}
.credit-marks a:hover { color: var(--color-accent); }
/* Smaller than the grid's, and the mask still takes the link's colour. */
.credit-marks .picto-mark { width: 28px; height: 28px; }

.footer-credit a { color: inherit; text-decoration: underline; }

/* ── consent bar (js/consent.js) ────────────────────────────────────── */

.consent-bar {
  position: fixed; left: var(--space-4); right: var(--space-4); bottom: var(--space-4); z-index: 90;
  max-width: 760px; margin: 0 auto;
  display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-3) var(--space-4);
  padding: var(--space-4);
  background: var(--color-bg); color: var(--color-text);
  border: 2px solid var(--color-text);
  box-shadow: var(--shadow-lg);
  font-size: 13px; line-height: 1.5;
}
.consent-bar[hidden] { display: none; }
.consent-text { flex: 1 1 320px; margin: 0; }
.consent-text a { color: inherit; text-decoration: underline; }
.consent-actions { display: flex; gap: var(--space-2); }

/* ── quote request ──────────────────────────────────────────────────── */

/* Every piece of the request feature is printed hidden and revealed by
   request.js. The UA rule for [hidden] loses to any author display value,
   so these components restate it -- otherwise .req-add's flex would show
   the control on a page where the script never ran. */
.req-add[hidden],
.req-badge[hidden],
.req-fallback[hidden],
.req-app [hidden] { display: none !important; }

/* Product page: quantity and button side by side, at the button's height. */
.req-add { display: flex; gap: var(--space-2); align-items: stretch; }
.req-qty { display: flex; }
.req-qty .input { width: 76px; min-height: 100%; text-align: center; }
.btn.is-added,
.btn-req-variant.is-added { background: var(--color-text); color: var(--color-bg); border-color: var(--color-text); }

.req-status { margin: 0 0 var(--space-4); font-size: 14px; min-height: 0; }
.req-status:empty { display: none; }
.req-status a { color: var(--color-accent); font-weight: 600; }

/* The column request.js adds to the variants table. The code column was set
   to 40% when the table had two columns; with a third it squeezed each
   description down to a word per line, so the code shrinks to its content. */
.table.variants .req-cell { width: 1%; white-space: nowrap; text-align: right; }
.table.variants:has(.req-cell) td:first-child { width: 1%; }
.btn-req-variant {
  min-height: 28px; padding: 2px 10px; cursor: pointer;
  font: inherit; font-size: 12px; font-weight: 600; white-space: nowrap;
  color: var(--color-text); background: transparent;
  border: 1px solid var(--color-divider); border-radius: var(--radius-md);
}
.btn-req-variant:hover { border-color: var(--color-accent); color: var(--color-accent); }

/* Header counter, beside the language switch. */
.req-badge {
  display: inline-flex; align-items: center; gap: 6px; min-height: 24px;
  font-family: var(--font-heading); font-weight: 800; font-size: 13px;
  text-transform: uppercase; letter-spacing: 0.06em;
  text-decoration: none; color: var(--color-text);
}
.req-badge .icon { color: var(--color-accent); }
.req-badge:hover { color: var(--color-accent); }
.req-count {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px;
  background: var(--color-accent); color: var(--color-bg);
  font-size: 11px; letter-spacing: 0;
}

/* Request page. */
.sec-request .req-note { color: var(--color-neutral-700); }
.req-empty { padding: var(--space-6) 0; }
.req-empty p { margin: 0 0 var(--space-3); max-width: 60ch; }

.req-items { margin-bottom: var(--space-8); }
.req-items td { vertical-align: middle; }
.req-item { display: flex; align-items: center; gap: var(--space-3); }
.req-item img {
  width: 56px; height: 56px; object-fit: contain; flex: none;
  background: var(--color-neutral-100); border: 1px solid var(--color-divider);
}
.req-item-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.req-item-text a { color: var(--color-text); font-weight: 600; text-decoration: none; }
.req-item-text a:hover { color: var(--color-accent); }
.req-item-meta { font-size: 12px; color: var(--color-neutral-700); }
.req-qty-col { width: 96px; }
.req-qty-col .input { width: 76px; text-align: center; }
.req-remove-col { width: 48px; text-align: right; }
.req-remove {
  width: 32px; height: 32px; cursor: pointer; font-size: 20px; line-height: 1;
  color: var(--color-neutral-700); background: transparent;
  border: 1px solid var(--color-divider); border-radius: var(--radius-md);
}
.req-remove:hover { color: var(--color-accent); border-color: var(--color-accent); }

.req-form { max-width: 760px; }
.req-form h2 { font-size: 18px; margin: 0 0 var(--space-4); }
.req-grid {
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-3) var(--space-6);
}
.req-grid .field { margin: 0; }
.req-wide { grid-column: 1 / -1; }
.req-mark { color: var(--color-accent); }
.req-form .input[aria-invalid='true'] { border-color: var(--color-accent); }
.req-field-error { display: block; margin-top: 4px; font-size: 12px; color: var(--color-accent-700); }
.req-hint { margin: var(--space-3) 0 0; font-size: 13px; color: var(--color-neutral-700); }
.req-consent {
  display: flex; gap: var(--space-2); align-items: flex-start;
  margin: var(--space-4) 0 0; font-size: 14px;
}
.req-consent input { width: 24px; height: 24px; margin: 0; flex: none; accent-color: var(--color-accent); }
.req-consent a { color: var(--color-accent); }
.req-error {
  margin: var(--space-4) 0 0; padding: var(--space-3);
  background: var(--color-accent-100); color: var(--color-accent-700);
  border-left: 3px solid var(--color-accent); font-size: 14px;
}
.req-form .actions { margin-top: var(--space-4); }

/* Off-screen, not display:none: some bots skip fields that are hidden. */
.req-hp { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }

.req-done { padding: var(--space-6) 0; outline: none; }
.req-done h2 { font-size: 22px; margin: 0 0 var(--space-2); }

@media (max-width: 700px) {
  /* The main add button already gets 44px from the .actions rule; the
     quantity box matches it so the pair reads as one control. */
  .req-qty .input { min-height: 44px; }
  .btn-req-variant { min-height: 32px; }
  .req-badge { font-size: 12px; }
  .req-grid { grid-template-columns: 1fr; }
  .req-items th:first-child { width: auto; }
  .req-qty-col { width: 72px; }
  .req-qty-col .input { width: 60px; min-height: 40px; }
  .req-remove { width: 40px; height: 40px; }
  .req-item img { width: 44px; height: 44px; }
  .req-form .input { min-height: 44px; }
}
