/*
 * Components: the reusable parts, named in BEM (block__element--modifier).
 * Each block is one section of this file, in the order: icon, button, text link, field, rule, skip link, logo,
 * site bar, nav, mega menu, site header, mobile menu, back to top, site footer, card, accordion, table.
 */

@layer components {
  /* ---- Icon: an inline SVG from assets/icons (theme_icon) ---- */
  .icon { width: var(--icon-m); height: var(--icon-m); flex-shrink: 0; fill: currentColor; }
  .icon--xs { width: var(--icon-xs); height: var(--icon-xs); }

  /* ---- Button: square and in capitals. The main button (primary) is filled, the others (secondary) are
     outlined and fill on hover. WooCommerce's and Forminator's buttons read the same tokens (plugins/). ---- */
  .btn {
    display: inline-flex; align-items: center; justify-content: center; gap: var(--space-2xs);
    min-height: var(--button-height); padding: var(--button-padding);
    border: 1px solid var(--color-accent); border-radius: 0; background: transparent; color: var(--color-accent);
    font-size: var(--text-button); font-weight: var(--weight-normal); line-height: var(--leading-tight); letter-spacing: var(--tracking-label); text-align: center; text-decoration: none; text-transform: uppercase;
    transition: background-color var(--transition), border-color var(--transition), color var(--transition);
  }
  .btn--primary { background: var(--color-accent); color: var(--color-white); }
  /* Small: a cue inside a card or menu panel, not a call to action of its own */
  .btn--small {
    min-height: 0; padding: var(--space-2xs) var(--space-s); font-size: var(--text-2xsmall);
    & .icon { width: var(--icon-xs); height: var(--icon-xs); }
    /* A real link or button (not a card's cue) is 44px tall on touch screens */
    @media (pointer: coarse) { &:is(a, button) { min-height: var(--target-size); } }
  }
  /* Hover states are for devices that can hover, so a tapped button doesn't stay filled on a touch screen */
  @media (hover: hover) {
    :is(.btn--primary, .btn--secondary):hover, .card--link:hover .btn--secondary { border-color: var(--color-accent-hover); background: var(--color-accent-hover); color: var(--color-white); }
  }
  /* On dark surfaces and photos: a white fill, or a white outline over a light shade. These surfaces set
     --color-ink to white, so the dark text uses --color-ink-fixed. */
  :is(.section--dark, .hero--image, .cta--image) {
    & .btn--primary { border-color: var(--color-white); background: var(--color-white); color: var(--color-ink-fixed); text-shadow: none; }
    @media (hover: hover) { & .btn--primary:hover { border-color: var(--color-paper); background: var(--color-paper); color: var(--color-ink-fixed); } }
    & .btn--secondary { border-color: var(--color-white); background: var(--color-shade-light); color: var(--color-white); }
    @media (hover: hover) { & :is(.btn--secondary:hover, .card--link:hover .btn--secondary) { border-color: var(--color-white); background: var(--color-white); color: var(--color-ink-fixed); text-shadow: none; } }
  }
  /* The arrow in a small button moves a little to the right when the button, or the card it's a cue in, is
     hovered or has keyboard focus. Product cards do the same (plugins/woocommerce.css). */
  .btn--small .icon { transition: translate var(--transition); }
  @media (prefers-reduced-motion: no-preference) {
    :is(.btn--small:focus-visible, .card--link:has(.card__link:focus-visible) .btn--small) .icon { translate: var(--nudge) 0; }
    @media (hover: hover) { :is(.btn--small:hover, .card--link:hover .btn--small) .icon { translate: var(--nudge) 0; } }
  }

  .button-group { display: flex; flex-wrap: wrap; gap: var(--space-xs); margin-top: var(--space-m); }

  /* ---- Text link: a link that ends a block of text ("View mirrors"), dark, in capitals and underlined ---- */
  /* On touch screens it's 44px tall to tap */
  .text-link {
    @media (pointer: coarse) { display: inline-flex; align-items: center; min-height: var(--target-size); }
    color: var(--color-ink); font-size: var(--text-small); letter-spacing: var(--tracking-label); text-decoration: underline; text-decoration-thickness: 1px; text-transform: uppercase;
    &:hover { text-decoration-thickness: 2px; }
  }

  /* ---- Field: text inputs, selects and textareas. WooCommerce's and Forminator's fields match (plugins/). ---- */
  .field {
    display: block; width: 100%; min-height: var(--target-size); margin-top: var(--field-gap); padding: var(--field-padding);
    border: 1px solid var(--color-field-border); border-radius: 0; background: var(--color-white); color: var(--color-ink); line-height: var(--leading-snug);
  }

  /* ---- Rule: the short dark rule under a heading, only where text follows it (a section's intro, or the
     text of a text section). A heading that leads straight into cards, products or questions has none.
     The rule's bottom margin merges with the gap above the text, so the text starts the same distance below it.
     :where() keeps it easy to remove in sections.css. ---- */
  :where(
    .section__head > h2:has(+ .section__intro),
    .hero--banner .hero__title:has(+ :is(.hero__intro, .hero__text)),
    .text--center .text__heading:has(+ .prose),
    .text-image__heading:has(+ .prose)
  )::after {
    content: ""; display: block; width: var(--rule-width); margin: var(--space-m) auto; border-top: 1px solid var(--color-ink);
  }

  /* ---- Skip link: off screen until it has keyboard focus ---- */
  .skip-link {
    position: absolute; top: var(--space-s); left: var(--space-s); z-index: 60; translate: 0 -200%;
    background: var(--color-white); padding: var(--space-2xs) var(--space-s); color: var(--color-ink); font-weight: var(--weight-bold);
    &:focus { translate: 0; }
    .admin-bar & { top: calc(var(--wp-admin--admin-bar--height, 32px) + var(--space-s)); }
  }

  /* ---- Logo ---- */
  /* The logo file is cropped close to the circle, so the padding here is all the space around it */
  .logo {
    display: flex; align-items: center; height: var(--logo-height-small); padding-block: var(--space-2xs); text-decoration: none;
    & img { width: auto; height: 100%; }
    @media (min-width: 64rem) { height: var(--logo-height); padding-block: var(--space-xs); }
  }
  .logo__name { color: var(--color-ink); font-size: var(--text-h3); }

  /* ---- Site bar: the grey bar with the main menu, above the header on large screens. It stays on screen. ---- */
  .site-bar {
    position: sticky; top: 0; z-index: 40; background: var(--color-grey); color: var(--color-white);
    @media (width < 64rem) { display: none; }
    @media (min-width: 601px) { .admin-bar & { top: var(--wp-admin--admin-bar--height, 32px); } }
  }

  /* ---- Nav: the main menu in the site bar. A hovered or focused link turns light grey with dark text; the current
     page's link is white. An item with an open mega menu takes the panel's light grey, so the two read as one
     shape. The colours change at once, with no fade, so the white text never sits on the light grey. ---- */
  /* The mega menus are placed against the nav, and sized from its width (cqi units) */
  /* The space either side of a nav item's text: as much as the bar has room for, up to 20px (10px at 1024px) */
  .nav { --nav-padding: clamp(0.625rem, 5vw - 2.5rem, 1.25rem); position: relative; container-type: inline-size; }
  .nav__list { display: flex; justify-content: center; }
  .nav__link {
    display: flex; align-items: center; justify-content: center; gap: 0.375rem; height: var(--bar-height); padding-inline: var(--nav-padding);
    font-size: var(--text-nav); font-weight: var(--weight-bold); line-height: var(--leading-tight); text-decoration: none;
    @media (min-width: 80rem) { min-width: 6.125rem; }
    &:is([aria-current="page"], [data-current]) { background: var(--color-white); color: var(--color-ink); }
    &:is(:hover, :focus-visible, [aria-expanded="true"]) { background: var(--color-menu); color: var(--color-ink); }
  }
  /* The focus ring sits inside the link or button, so it doesn't run over its neighbour. On the white and light
     grey states it's dark, like on the page. */
  :is(.nav__link, .nav__toggle):focus-visible { outline-offset: calc(var(--focus-width) * -1); box-shadow: none; }
  :is(.nav__link:is([aria-current="page"], [data-current], :hover, :focus-visible, [aria-expanded="true"]),
    .nav__item--split:is(:hover, :has([aria-current="page"], [data-current], :focus-visible, [aria-expanded="true"]))) { --color-focus: var(--color-ink); }
  /* An item with a page of its own: the name is a link and the chevron beside it is the button that opens the
     mega menu. The item carries the background, so the two read as one. */
  .nav__item--split {
    display: flex;
    @media (min-width: 80rem) { min-width: 6.125rem; justify-content: center; }
    & > .nav__link { min-width: 0; padding-inline-end: 0; background: none; color: inherit; }
    &:has([aria-current="page"], [data-current]) { background: var(--color-white); color: var(--color-ink); }
    &:is(:hover, :has(:focus-visible, [aria-expanded="true"])) { background: var(--color-menu); color: var(--color-ink); }
  }
  .nav__toggle {
    display: flex; align-items: center; height: var(--bar-height); padding-inline: 0.375rem var(--nav-padding);
  }
  .nav__chevron {
    transition: rotate var(--transition);
    [aria-expanded="true"] > & { rotate: 180deg; }
  }

  /* ---- Mega menu: the panel under a nav item with children (assets/scripts/components/dropdown.js). On the left,
     the section's own page: its name, intro and a "View all" link. On the right, its links as cards, each with a
     photo and a line of detail.
     Every card is the same width in every menu, so the panel is as wide as its cards need, up to the page column.
     It starts under its nav item and moves left when it would run past the column (dropdown.js sets --panel-left).
     Three text styles only, all at the regular weight: the section's name (h3 size), link names (small, dark)
     and details (extra small, grey). ---- */
  .mega-menu {
    --color-focus: var(--color-ink); --color-focus-halo: var(--color-white); /* the panel is light, inside the grey bar */
    --color-text: var(--color-text-on-paper);
    --feature-width: 15rem; --column-gap: var(--space-xl);
    /* Five cards and the feature column fill the page column; cards never grow past 10rem */
    --card-width: min(10rem, (100cqi - 2 * var(--space-l) - var(--feature-width) - var(--column-gap) - 4 * var(--space-s)) / 5);
    position: absolute; top: 100%; left: var(--panel-left, var(--wrap-gutter)); z-index: 1;
    display: grid; grid-template-columns: var(--feature-width) auto; gap: var(--column-gap); width: max-content; padding: var(--space-l);
    background: var(--color-menu); box-shadow: var(--shadow-panel-strong); color: var(--color-text);
    font-weight: var(--weight-normal); text-align: left;
    @media (width < 80rem) { --feature-width: 12rem; --column-gap: var(--space-l); }
    /* It fades in and drops a little as it opens. Moving from one open menu to the next swaps them at once
       (dropdown.js sets data-swap), so the page never shows through between them. It closes at once. */
    transition: opacity var(--transition), translate var(--transition);
    @starting-style { opacity: 0; translate: 0 calc(var(--appear-distance) * -1); }
    &[data-swap] { transition: none; }
  }
  .mega-menu__title { color: var(--color-ink); font-size: var(--text-h3); line-height: var(--leading-heading); }
  :is(.mega-menu__text, .mega-menu__summary) { color: var(--color-text); font-size: var(--text-xsmall); line-height: var(--leading-snug); }
  .mega-menu__text { margin-top: var(--space-2xs); }
  .mega-menu__name { color: var(--color-ink); font-size: var(--text-small); line-height: var(--leading-snug); }
  .mega-menu__all { margin-top: var(--space-s); } /* a small secondary button (.btn--small) */
  /* header.php sets --columns: up to five, with longer lists split into even rows (nine links: five and four) */
  .mega-menu__links { display: grid; grid-template-columns: repeat(var(--columns, 5), var(--card-width)); align-content: start; gap: var(--space-s); }
  .mega-menu__link {
    display: block; height: 100%; padding: var(--space-2xs) var(--space-2xs) var(--space-xs);
    border: 1px solid var(--color-line); border-radius: var(--radius); background: var(--color-white); text-decoration: none;
    transition: border-color var(--transition);
    &[aria-current="page"] { border-color: var(--color-ink); }
    @media (hover: hover) {
      &:hover { border-color: var(--color-ink); }
      &:hover .mega-menu__name { text-decoration: underline; }
    }
    &:focus-visible { outline-offset: calc(var(--focus-width) * -1); box-shadow: none; }
  }
  .mega-menu__thumb { width: 100%; aspect-ratio: 4 / 3; margin-bottom: var(--space-xs); border-radius: var(--radius); object-fit: cover; }
  .mega-menu__name { display: block; }
  .mega-menu__summary { display: block; margin-top: 0.125rem; }

  /* ---- Site header: on large screens the logo in the middle, the social links on the left and the account,
     basket and menu links on the right. Below that the logo is on the left and the social links sit just
     before the account link, on the right. ---- */
  .site-header { position: relative; z-index: 30; border-bottom: 1px solid var(--color-line); background: var(--color-white); }
  .site-header__inner {
    display: flex; align-items: center; gap: var(--space-s); height: var(--logo-height-small);
    & .site-header__social { order: 1; margin-left: auto; margin-right: calc(var(--space-s) * -1); }
    & .site-header__actions { order: 2; margin-left: auto; }
    & .site-header__social + .logo + .site-header__actions { @media (min-width: 40rem) { margin-left: 0; } } /* the social links (hidden on phones) push it right */
    @media (min-width: 64rem) {
      display: grid; grid-template-columns: 1fr auto 1fr; height: var(--logo-height);
      & .site-header__social { grid-column: 1; justify-self: start; order: 0; margin: 0 0 0 calc(var(--space-xs) * -1); }
      & .logo { grid-column: 2; }
      & .site-header__actions { grid-column: 3; }
    }
  }
  .site-header__actions { display: flex; align-items: center; justify-self: end; margin-right: calc(var(--space-xs) * -1); }
  .site-header__action {
    display: grid; place-items: center; width: var(--target-size); height: var(--target-size); color: var(--color-icon); transition: color var(--transition);
    @media (hover: hover) { &:hover { color: var(--color-ink); } }
    & .icon { width: var(--icon-s); height: var(--icon-s); }
  }
  /* The social links are in the footer too, so phones leave them out of the header to keep it to one row.
     All four icons are Font Awesome 6.5.1 at one size: the brand logos, and the account and basket in the
     solid style, as are all the theme's other icons (assets/icons). */
  .site-header__social { display: flex; @media (width < 40rem) { display: none; } }
  .site-header__menu-button {
    position: relative; z-index: 2; /* above the open mobile menu, where it closes it */
    @media (min-width: 64rem) { display: none; }
    & .icon { width: var(--icon-l); height: var(--icon-l); }
    & .icon--close { display: none; }
    &[aria-expanded="true"] { color: var(--color-ink); }
    &[aria-expanded="true"] .icon--open { display: none; }
    &[aria-expanded="true"] .icon--close { display: block; }
  }

  /* ---- Mobile menu: a panel from the right, over the dimmed page (assets/scripts/components/mobile-menu.js).
     It follows the header bar: names in ink at the bar's bold weight, thin rules between them, and a section
     with children opened by a chevron button beside its name. An open section takes the mega menu's light grey,
     its row and links as one shape, as an open item and its mega menu do in the bar. The panel slides in and the
     shade fades in while it has data-open, and both run in reverse as it closes; the script sets hidden once the
     slide has finished. With reduced motion both just appear and disappear (base.css). ---- */
  .mobile-menu {
    position: fixed; inset: 0; z-index: 1; background: var(--color-shade);
    opacity: 0; transition: opacity var(--transition);
    &[data-open] { opacity: 1; }
    @media (min-width: 64rem) { display: none; }
    @media (min-width: 601px) { .admin-bar & { top: var(--wp-admin--admin-bar--height, 32px); } }
  }
  .has-open-menu { overflow: hidden; }
  .mobile-menu__panel {
    --menu-gutter: min(var(--wrap-gutter), var(--space-l)); /* the header's gutter on phones, so the chevrons line up under the close button */
    position: absolute; inset: 0 0 0 auto; width: calc(100% - var(--space-xl)); max-width: 26rem; overflow-y: auto; overscroll-behavior: contain;
    padding: var(--logo-height-small) 0 var(--space-xl); background: var(--color-white); box-shadow: var(--shadow-panel-strong);
    translate: 100% 0; transition: translate var(--transition);
    [data-open] > & { translate: 0; }
    /* The rules and grey of an open section reach the panel's edges, so the focus ring sits inside each row */
    & :is(a, button):focus-visible { outline-offset: calc(var(--focus-width) * -1); box-shadow: none; }
  }
  .mobile-menu__list { border-top: 1px solid var(--color-line); }
  .mobile-menu__item {
    border-bottom: 1px solid var(--color-line);
    &:has(> .mobile-menu__row [aria-expanded="true"]) { background: var(--color-menu); }
  }
  .mobile-menu__row { display: flex; }
  .mobile-menu__link {
    display: flex; flex: 1; align-items: center; justify-content: space-between; gap: var(--space-s); min-width: 0; min-height: 3rem; padding: var(--space-2xs) var(--menu-gutter);
    color: var(--color-ink); font-size: var(--text-base); font-weight: var(--weight-bold); line-height: var(--leading-tight); text-align: left; text-decoration: none;
  }
  /* The chevron button: a square the row's height, with the chevron in line with the panel's gutter */
  .mobile-menu__toggle:not(.mobile-menu__link) {
    display: grid; place-items: center; flex: none; width: calc(var(--target-size) + var(--menu-gutter) - var(--space-xs)); padding-right: calc(var(--menu-gutter) - var(--space-xs));
    color: var(--color-ink);
  }
  .mobile-menu__chevron {
    transition: rotate var(--transition);
    [aria-expanded="true"] > & { rotate: 180deg; }
  }
  /* A section's links, under its name. They fade in as the section opens. */
  .mobile-menu__sublist {
    padding-bottom: var(--space-2xs);
    transition: opacity var(--transition), translate var(--transition);
    @starting-style { opacity: 0; translate: 0 calc(var(--space-2xs) * -1); }
  }
  .mobile-menu__sublink {
    display: flex; align-items: center; min-height: var(--target-size); padding: var(--space-2xs) var(--menu-gutter) var(--space-2xs) calc(var(--menu-gutter) + var(--space-s));
    color: var(--color-ink); font-size: var(--text-small); line-height: var(--leading-snug); text-decoration: none;
  }
  :is(.mobile-menu__link, .mobile-menu__sublink):is(:hover, [aria-current="page"]) { text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 0.2em; }

  /* ---- Back to top: a small square button, bottom right, once the page has scrolled a screen
     (assets/scripts/components/back-to-top.js). The script shows it; without the script it stays hidden. ---- */
  .back-to-top {
    position: fixed; right: var(--space-s); bottom: var(--space-s); z-index: 20;
    display: grid; place-items: center; width: var(--target-size); height: var(--target-size); border-radius: var(--radius);
    background: var(--color-grey); box-shadow: var(--shadow-small); color: var(--color-white);
    --color-focus: var(--color-ink); --color-focus-halo: var(--color-white);
    opacity: 0; visibility: hidden; translate: 0 0.5rem;
    transition: opacity var(--transition), visibility var(--transition), translate var(--transition), background-color var(--transition);
    &[data-visible] { opacity: 1; visibility: visible; translate: 0; }
    & .icon { width: var(--icon-xs); height: var(--icon-xs); transition: translate var(--transition); }
    /* On hover it darkens and its arrow moves up a little */
    @media (hover: hover) {
      &:hover { background: var(--color-ink); }
      @media (prefers-reduced-motion: no-preference) { &:hover .icon { translate: 0 calc(var(--nudge) * -1); } }
    }
  }

  /* ---- Site footer: the logo and three text columns on grey, then the copyright bar ---- */
  .site-footer {
    --footer-column-gap: var(--space-2xl);
    background: var(--color-grey); color: var(--color-on-grey);
    /* The underline fades in on hover */
    & a { color: var(--color-white); text-decoration: underline transparent; text-decoration-thickness: 1px; transition: text-decoration-color var(--transition); }
    @media (hover: hover) { & a:hover { text-decoration-color: currentColor; } }
  }
  .site-footer__logo {
    display: block; width: 10rem;
    @media (width < 40rem) { width: 8rem; } /* a little smaller on phones, where it sits above the text */
    @media (64rem <= width < 80rem) { width: 8rem; } /* leaves the about text room beside it on small laptops */
    & img { width: 100%; height: auto; filter: brightness(0) invert(1); } /* the black logo, in white */
  }
  .site-footer__main {
    display: grid; gap: var(--space-l) var(--footer-column-gap); padding-block: var(--space-2xl);
    @media (width < 40rem) { padding-block: var(--space-xl); } /* 40px on phones, not 64px */
    @media (min-width: 40rem) { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    /* Each column is as wide as its content (the about text up to 21rem), and the space left over is shared
       equally between them, so the gaps you see between the logo, text, menu and contact details all match */
    @media (min-width: 64rem) { grid-template-columns: auto minmax(0, 21rem) max-content max-content; justify-content: space-between; }
  }
  /* The h3 style (type.css), with a short soft rule under it, the length of the rule under section text */
  .site-footer__heading {
    margin-bottom: var(--space-s);
    color: var(--color-white); font-size: var(--text-h3); line-height: var(--leading-heading); letter-spacing: normal;
    &::after { content: ""; display: block; width: var(--rule-width); margin-top: var(--space-xs); border-top: 1px solid var(--color-line-on-grey); }
  }
  /* Plain wrapping: "pretty" (reset.css) evens out the last lines here by breaking one early, which reads as a
     stray line break in this narrow column */
  .site-footer__text { text-wrap: wrap; }
  .site-footer__list li + li { margin-top: 0.375rem; }
  /* On touch screens each link is at least 44px tall, with no gap between them */
  @media (pointer: coarse) {
    .site-footer__list li + li { margin-top: 0; }
    :is(.site-footer__list, .site-footer__policy) a { padding-block: max(0px, (var(--target-size) - 1lh) / 2); }
    .site-footer__list a:not(.site-footer__icon-link), .site-footer__policy a { display: inline-block; }
  }
  .site-footer__icon-link {
    display: flex; align-items: flex-start; gap: var(--space-xs); width: fit-content; /* flex, not inline-flex, so these rows are as tall as the menu's */
    /* Level with the first line, so it stays beside the start of an email address that wraps after the @ */
    & .icon { width: var(--icon-s); height: var(--icon-s); margin-top: calc((1lh - var(--icon-s)) / 2); color: var(--color-on-grey); }
  }
  .site-footer__bottom { background: var(--color-charcoal); font-size: var(--text-small); }
  /* The copyright on the left and the policy links on the right, in line with the outer edges of the columns above */
  .site-footer__legal { display: flex; flex-wrap: wrap; justify-content: space-between; gap: var(--space-2xs) var(--space-m); padding-block: var(--space-m); }
  .site-footer__policy { display: flex; flex-wrap: wrap; gap: var(--space-2xs) var(--space-m); }

  /* ---- Card: image, title with a thin line after it, text and a "Read more" cue. When the card has a link, the
     title is the link, and its ::after covers the whole card, so the image and the cue open it too. The cue is
     only a picture of a link (aria-hidden), so screen readers hear one link. The text sits above the cover so
     it can be selected; assets/scripts/components/card.js passes a click on it to the link. ---- */
  /* A column, so the cue sits at the foot of the card and the cues in a row line up (grid rows stretch the cards) */
  .card { position: relative; display: flex; flex-direction: column; }
  /* The frame round the photo, so the photo can grow on hover without leaving its square */
  .card__media { overflow: hidden; border-radius: var(--radius); }
  .card__image { width: 100%; aspect-ratio: 1; border-radius: var(--radius); object-fit: cover; }
  .card__title {
    display: flex; align-items: center; gap: var(--space-s); margin-top: var(--space-m);
    &::after { content: ""; flex: 1; border-top: 1px solid var(--color-line); }
  }
  .card__link {
    color: inherit; text-decoration: none;
    &::after { content: ""; position: absolute; inset: 0; z-index: 1; }
    &:focus-visible { outline: none; box-shadow: none; }
  }
  .card__text { margin-top: var(--space-2xs); }
  .card--link {
    & .card__text { position: relative; z-index: 2; cursor: pointer; }
    /* On hover or keyboard focus the photo grows a little inside its frame. With reduced motion it fades a
       little instead, as it always did. */
    & .card__image { transition: opacity var(--transition), scale var(--duration-m) var(--ease-out); }
    @media (prefers-reduced-motion: no-preference) {
      &:has(.card__link:focus-visible) .card__image { scale: var(--zoom); }
      @media (hover: hover) { &:hover .card__image { scale: var(--zoom); } }
    }
    @media (prefers-reduced-motion: reduce) and (hover: hover) { &:hover .card__image { opacity: 0.85; } }
    &:has(.card__link:focus-visible) { outline: var(--focus-width) solid var(--color-focus); outline-offset: var(--focus-offset); box-shadow: 0 0 0 var(--focus-offset) var(--color-focus-halo); }
  }
  /* The cue is drawn as a small secondary button, which fills when the card is hovered (the button rules above).
     Its auto margin takes up the spare height; the item before it keeps the minimum gap. */
  .card__more { align-self: flex-start; margin-top: auto; }
  .card > :has(+ .card__more) { margin-bottom: var(--space-s); }

  /* ---- Accordion: native details and summary, so it works without a script. As the old site's FAQs: roomy
     rows with the question a step above body text, a circled plus that becomes a minus when open, and the
     answer in a light grey box. ---- */
  .accordion { max-width: var(--measure); margin-inline: auto; border-top: 1px solid var(--color-line); }
  .accordion__item { border-bottom: 1px solid var(--color-line); }
  /* The question wraps beside the icon and never runs under it, however long it is */
  .accordion__summary {
    display: flex; align-items: flex-start; justify-content: space-between; gap: var(--space-m); padding-block: var(--space-m);
    color: var(--color-ink); font-size: var(--text-question); line-height: var(--leading-snug); list-style: none; cursor: pointer;
    &::-webkit-details-marker { display: none; }
    &:focus-visible { outline-offset: 0; }
  }
  .accordion__question { flex: 1; min-width: 0; overflow-wrap: anywhere; }
  /* The circle is centred on the question's first line; on hover, and while open, its edge darkens */
  .accordion__icon {
    --circle: 1.75rem;
    display: grid; place-items: center; flex-shrink: 0; width: var(--circle); height: var(--circle); margin-block: calc((1lh - var(--circle)) / 2);
    border: 1px solid var(--color-line-on-grey); border-radius: 50%; color: var(--color-icon); transition: border-color var(--transition), color var(--transition), rotate var(--transition);
    & .icon { width: 0.75rem; height: 0.75rem; }
    & .icon--close { display: none; }
    :is(.accordion__summary:hover, [open] > .accordion__summary) & { border-color: var(--color-ink); color: var(--color-ink); }
    [open] > .accordion__summary & { rotate: 180deg; } /* a half turn as the plus becomes a minus, like the menus' chevrons */
    [open] > .accordion__summary & .icon--open { display: none; }
    [open] > .accordion__summary & .icon--close { display: block; }
  }
  .accordion__content {
    --color-text: var(--color-text-on-paper);
    max-width: none; margin-bottom: var(--space-m); padding: var(--space-m); background: var(--color-paper-light); color: var(--color-text); font-size: var(--text-small); line-height: var(--leading); overflow-wrap: anywhere;
    @media (min-width: 40rem) { padding: var(--space-l) var(--space-xl); }
    /* The answer fades in and drops a little as it opens (the keyframes are in motion.css) */
    [open] > & { animation: appear var(--duration-s) var(--ease-out); }
  }

  /* ---- Table: scrolls sideways inside .table-scroll on narrow screens ---- */
  .table-scroll { overflow-x: auto; }
  /* Columns of equal width and small type, as the old site's tables. Column headings are in capitals, as in the
     basket (plugins/woocommerce.css); row headings aren't. */
  .table {
    width: 100%; min-width: max(36rem, var(--table-columns) * var(--table-column-min)); table-layout: fixed; overflow-wrap: normal; word-break: normal; hyphens: manual; border: 1px solid var(--color-line); font-size: var(--text-xsmall); line-height: var(--leading); text-align: center;
    & :is(th, td) { padding: var(--space-xs); border: 1px solid var(--color-line); vertical-align: top; }
    & td { background: var(--color-paper-light); color: var(--color-text-on-paper); }
    & th { color: var(--color-text); font-weight: var(--weight-normal); }
    & thead th { letter-spacing: var(--tracking-label); text-transform: uppercase; }
  }
  /* On phones, a table with column headings becomes one block per row, each cell under its column's heading
     (data-label), instead of a table that scrolls sideways with words wrapping in narrow columns. The column
     headings stay for screen readers. */
  @media (width < 40rem) {
    .table--stack {
      display: block; min-width: 0; border: 0; font-size: var(--text-small); text-align: left;
      & thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
      & tbody { display: grid; gap: var(--space-xs); }
      & tr { display: block; padding: var(--space-xs) var(--space-s); border: 1px solid var(--color-line); background: var(--color-paper-light); }
      & :is(th, td) {
        display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 3fr); gap: var(--space-s); padding: var(--space-3xs) 0;
        border: 0; background: none; color: var(--color-text-on-paper);
        &::before { content: attr(data-label); color: var(--color-muted); font-size: var(--text-xsmall); letter-spacing: var(--tracking-label); text-transform: uppercase; line-height: inherit; }
        &:empty { display: none; }
      }
      & th { color: var(--color-ink); font-weight: var(--weight-bold); }
    }
    .table-scroll:has(> .table--stack) { overflow: visible; }
  }
}
