/*
 Theme Name:     Rome Is More Next Gen
 Theme URI:      https://www.cloudfactory.it/
 Description:    Tema custom Rome Is More
 Author:         Cloudfactory S.r.l.
 Author URI:     https://www.cloudfactory.it
 Version:        1.0.0
 Requires PHP:   8.2
*/

@layer vendor, reset, tokens, base, components, utilities;

/* ============================================================
 * FONTS — Poppins served by the theme (assets/fonts, latin subset).
 * No request to Google Fonts: nothing to consent to, nothing to block.
 * ============================================================ */
@font-face { font-family: 'Poppins'; font-style: normal; font-weight: 400; font-display: swap; src: url('assets/fonts/poppins-normal-latin-400.woff2') format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'Poppins'; font-style: normal; font-weight: 500; font-display: swap; src: url('assets/fonts/poppins-normal-latin-500.woff2') format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'Poppins'; font-style: normal; font-weight: 700; font-display: swap; src: url('assets/fonts/poppins-normal-latin-700.woff2') format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'Poppins'; font-style: italic; font-weight: 400; font-display: swap; src: url('assets/fonts/poppins-italic-latin-400.woff2') format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'Poppins'; font-style: italic; font-weight: 500; font-display: swap; src: url('assets/fonts/poppins-italic-latin-500.woff2') format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }

/* ============================================================
 * TOKENS
 * ============================================================ */

@layer tokens {
  :root {
    /* Color primitives — raw palette */
    --color-ink: #272727;
    --color-paper: #fff;
    --color-cream: #fbf7f2;
    --color-stone: #6f6b69; /* was #868280 (3.8:1): now ≥ 4.5:1 on paper and cream, see DESIGN-SYSTEM.md */
    --color-red: #c8102e;
    --color-coral: #d47557;

    /* Color roles — use these in components */
    --color-fg: var(--color-ink);
    --color-bg: var(--color-paper);
    --color-surface: var(--color-cream);
    --color-muted: var(--color-stone);
    --color-on-fg: var(--color-paper);
    --color-promo: var(--color-red);
    --color-sale: var(--color-coral);
    --color-scrim: rgb(39 39 39 / 0.45);

    /* Spacing scale — 0.25rem (4px) base */
    --space-0: 0;
    --space-1: 0.25rem; /*  4px */
    --space-2: 0.5rem; /*  8px */
    --space-3: 0.75rem; /* 12px */
    --space-4: 1rem; /* 16px */
    --space-5: 1.25rem; /* 20px */
    --space-6: 1.5rem; /* 24px */
    --space-8: 2rem; /* 32px */
    --space-10: 2.5rem; /* 40px */
    --space-12: 3rem; /* 48px */
    --space-16: 4rem; /* 64px */
    --space-20: 5rem; /* 80px */

    /* Spacing aliases — semantic intent */
    --gutter-inline: var(--space-4); /* page side padding   */
    --section-block: var(--space-12); /* section vertical    */
    --stack-tight: var(--space-2);
    --stack: var(--space-4);
    --stack-loose: var(--space-6);

    /* Type scale — t-shirt */
    --text-2xs: 0.625rem; /* 10px */
    --text-xs: 0.75rem; /* 12px */
    --text-sm: 0.875rem; /* 14px */
    --text-md: 1rem; /* 16px */
    --text-lg: 1.125rem; /* 18px */
    --text-xl: 1.25rem; /* 20px */
    --text-2xl: 1.5rem; /* 24px */
    --text-3xl: 1.875rem; /* 30px */
    --text-4xl: 2.25rem; /* 36px */

    /* Weights */
    --weight-medium: 500;
    --weight-semibold: 600;
    --weight-bold: 700;

    /* Line heights */
    --leading-none: 1;
    --leading-tight: 1.1;
    --leading-snug: 1.25;
    --leading-base: 1.5;

    /* Fixed dimensions — not spacing, not on the scale */
    --header-height: 4.875rem; /* 78px */
    --notice-height: 3.125rem; /* 50px, the top bar on one line (used by the 404 page) */
    --header-gutter: var(--gutter-inline); /* side padding of the top bar and the header */
    --icon-header: 1.25rem; /* 20px, header icons on desktop */
    --icon-sm: 1.125rem; /* 18px */
    --icon-md: 1.25rem; /* 20px */
    --icon-lg: 1.5rem; /* 24px */

    /* Radii */
    --radius-pill: 9999px;

    /*
     * Form fields — every input on the site (account pages, checkout,
     * newsletter) reads these, so a restyle is a token change. Components:
     * .form-field, .form-check, .form-notice below.
     */
    --field-height: 4rem; /* 64px */
    --field-radius: 0.625rem; /* 10px */
    --field-border-width: 1px;
    --field-border-color: color-mix(
      in srgb,
      var(--color-ink) 15%,
      var(--color-paper)
    );
    --field-border-color-hover: var(--color-stone);
    --field-border-color-focus: var(--color-ink);
    --field-border-color-error: var(--color-red);
    --field-bg: var(--color-paper);
    --field-fg: var(--color-ink);
    --field-placeholder: var(--color-stone);
    --field-label: var(--color-stone);
    --field-font-size: var(--text-md);
    --field-label-size: var(--text-xs);
    --field-padding-x: var(--space-4);
    --field-gap: var(--space-5); /* between stacked fields */

    /* Cards (customer area: profile, orders, addresses) */
    --card-radius: 1.25rem; /* 20px */
    --card-border-color: color-mix(
      in srgb,
      var(--color-ink) 22%,
      var(--color-paper)
    );

    /* Typography */
    --font-base: 'Poppins', sans-serif;

    /* Wave decoration */
    --wave-default: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 36.21 13'%3E%3Cpath d='M0,10.5c9.05,0,9.05-8,18.11-8s9.05,8,18.11,8' style='fill:none;stroke:%23000;stroke-width:5px'/%3E%3C/svg%3E");
    --wave-white-top-bg: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 36.21 13'%3E%3Cpath d='M0 0 0 9.05 8.46 8.12 15.15 2.94 21.59 3.13 27.54 7.93 31.98 10.3 36.21 10.3 36.21 0 0 0z' style='fill:%23fff'/%3E%3Cpath d='M0,10.5c9.05,0,9.05-8,18.11-8s9.05,8,18.11,8' style='fill:none;stroke:%23000;stroke-width:5px'/%3E%3C/svg%3E");
    --wave-black-top-bg: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 36.21 13'%3E%3Cpath d='M0 0 0 9.05 8.46 8.12 15.15 2.94 21.59 3.13 27.54 7.93 31.98 10.3 36.21 10.3 36.21 0 0 0z' style='fill:%23272727'/%3E%3Cpath d='M0,10.5c9.05,0,9.05-8,18.11-8s9.05,8,18.11,8' style='fill:none;stroke:%23000;stroke-width:5px'/%3E%3C/svg%3E");
    --wave-cream-top-bg: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 36.21 13'%3E%3Cpath d='M0 0 0 9.05 8.46 8.12 15.15 2.94 21.59 3.13 27.54 7.93 31.98 10.3 36.21 10.3 36.21 0 0 0z' style='fill:%23fbf7f2'/%3E%3Cpath d='M0,10.5c9.05,0,9.05-8,18.11-8s9.05,8,18.11,8' style='fill:none;stroke:%23000;stroke-width:5px'/%3E%3C/svg%3E");
    --wave-white: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 36.21 13'%3E%3Cpath d='M0,10.5c9.05,0,9.05-8,18.11-8s9.05,8,18.11,8' style='fill:none;stroke:%23fff;stroke-width:5px'/%3E%3C/svg%3E");
    --wave-tile: 15px 5.5px;
    --wave-height: 6px;
  }

  /* Desktop: the top bar and the header keep their content further from the screen edge. */
  @media (min-width: 981px) {
    :root {
      --header-gutter: var(--space-8);
    }
  }
}

/* ============================================================
 * RESET
 * ============================================================ */

@layer reset {
  *,
  *::before,
  *::after {
    box-sizing: border-box;
    background-repeat: no-repeat;
  }

  * {
    margin: 0;
    padding: 0;
  }

  html {
    -webkit-text-size-adjust: none;
    text-size-adjust: none;
    line-height: var(--leading-base);
    -webkit-font-smoothing: antialiased;
    block-size: 100%;
  }

  body {
    min-block-size: 100%;
  }

  img,
  iframe,
  audio,
  video,
  canvas {
    display: block;
    max-inline-size: 100%;
    block-size: auto;
  }

  svg {
    max-inline-size: 100%;
  }

  svg:not([fill]) {
    fill: currentColor;
  }

  input,
  button,
  textarea,
  select {
    font: inherit;
  }

  textarea {
    resize: vertical;
  }

  fieldset,
  iframe {
    border: none;
  }

  p,
  h1,
  h2,
  h3,
  h4,
  h5,
  h6 {
    overflow-wrap: break-word;
  }

  p {
    text-wrap: pretty;
    font-variant-numeric: proportional-nums;
  }

  h1,
  h2,
  h3,
  h4,
  h5,
  h6 {
    font-variant-numeric: lining-nums;
  }

  input,
  label,
  button,
  h1,
  h2,
  h3,
  h4,
  h5,
  h6 {
    line-height: var(--leading-tight);
  }

  :disabled {
    opacity: 0.8;
    cursor: not-allowed;
  }
}

/* ============================================================
 * BASE
 * ============================================================ */

@layer base {
  html {
    font-family: var(--font-base);
    color: var(--color-fg);
    background-color: var(--color-bg);
  }

  /* Column flex so .site-footer (margin-top: auto) hugs the bottom on short pages. */
  body {
    display: flex;
    flex-direction: column;
    min-block-size: 100dvh;
  }

  ::selection {
    background-color: var(--color-fg);
    color: var(--color-on-fg);
  }

  a {
    color: inherit;
  }

  /* Keyboard focus ring for every interactive element (buttons, chips, cards,
   * summaries, links): ink ring with a paper halo, so it reads on the dark
   * bands (footer, FAQ, game sections) too. Fields swap it for a border
   * change (see below). */
  :focus-visible {
    outline: 2px solid var(--color-fg);
    outline-offset: 2px;
    box-shadow: 0 0 0 5px var(--color-on-fg);
  }

  input[type='text'],
  input[type='email'],
  input[type='password'],
  input[type='search'],
  input[type='tel'],
  input[type='url'],
  input[type='date'],
  input[type='number'],
  textarea {
    outline: none;
    font-size: var(--text-sm);
    border: 2px solid var(--color-muted);
    border-radius: var(--radius-pill);
    padding: var(--space-4) var(--space-6);

    &:hover {
      border-color: var(--color-fg);
    }

    &:focus-visible {
      border-color: var(--color-fg);
    }
  }
}

/* ============================================================
 * UTILITIES
 * ============================================================ */

@layer utilities {
  /* Kept in the accessibility tree, removed from the visual layout. */
  .visually-hidden,
  .screen-reader-text {
    position: absolute !important;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    border: 0;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
  }
}

/* ============================================================
 * COMPONENTS
 * ============================================================ */

@layer components {
  /* ----- Wave ----- */

  .has-wave {
    position: relative;
  }

  .has-wave::after,
  .wave {
    content: '';
    height: var(--wave-height);
    background: var(--wave-default) repeat-x top left / var(--wave-tile);
    animation: wave-scroll 50s linear infinite;
  }

  .has-wave::after {
    position: absolute;
    top: calc(100% + var(--wave-height));
    left: 0;
    right: 0;
  }

  .wave {
    cursor: default;
    width: 100%;
  }

  .wave--white-top-bg {
    background-image: var(--wave-white-top-bg);
  }

  .wave--black-top-bg {
    background-image: var(--wave-black-top-bg);
  }

  .wave--cream-top-bg {
    background-image: var(--wave-cream-top-bg);
  }

  .wave--white {
    background-image: var(--wave-white);
  }
  .wave--absolute {
    position: absolute;
    top: -6px;
    left: 0;
    transform: rotate(180deg);
    animation-direction: reverse;
  }

  @keyframes wave-scroll {
    from {
      background-position: 0 0;
    }
    to {
      background-position: 600px 0;
    }
  }

  @media (prefers-reduced-motion: reduce) {
    .has-wave::after,
    .wave {
      animation: none;
    }
  }

  /* ----- Site notice ----- */

  .site-notice {
    background-color: var(--color-fg);
    color: var(--color-on-fg);
    padding: var(--space-4);
    font-size: var(--text-xs);
    text-align: center;

    /* Account / FAQ / Contatti: desktop only, on mobile they are in the menu. */
    .links {
      display: none;
    }

    /* Desktop: the message on the left, the links on the right, on the header's gutters. */
    @media (min-width: 981px) {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: var(--space-6);
      padding-inline: var(--header-gutter);
      text-align: left;

      .links {
        display: flex;
        align-items: center;
        gap: var(--space-6);
        font-weight: var(--weight-bold);
        text-transform: uppercase;
        white-space: nowrap;
      }

      .links a {
        color: inherit;
        text-decoration: none;

        &:hover {
          text-decoration: underline;
          text-underline-offset: 0.2em;
        }
      }
    }
  }

  /* ----- Button ----- */

  .button,
  .add-to-cart-btn {
    background-color: var(--color-fg);
    color: var(--color-on-fg);
    font-size: var(--text-md);
    font-weight: var(--weight-bold);
    line-height: var(--leading-tight);
    padding: var(--space-4) var(--space-6);
    border: none;
    border-radius: var(--radius-pill);
    text-decoration: none;
    -webkit-tap-highlight-color: transparent;

    &.is-inverse {
      background-color: var(--color-on-fg);
      color: var(--color-fg);
    }

    &.is-outline {
      background-color: var(--color-on-fg);
      color: var(--color-fg);
      border: 2px solid var(--color-fg);
    }

    /* Mouse feedback (DESIGN-SYSTEM: 0.15s ease); touch screens skip it. */
    transition: opacity 0.15s ease;

    @media (hover: hover) {
      &:hover {
        opacity: 0.85;
      }
    }

    /* Full-width submit (forms, drawers). Works on <a> and <button> alike. */
    &.is-block {
      display: block;
      width: 100%;
      text-align: center;
      cursor: pointer;
      -webkit-tap-highlight-color: transparent;
    }
  }

  /* ----- Form field -----
   *
   *   <div class="form-field">
   *     <input class="input" type="email" placeholder=" " …>
   *     <label class="label" for="…">Email</label>
   *   </div>
   *
   * The label doubles as the placeholder and floats to the top once the
   * field is focused or filled; placeholder=" " (a space) is what makes
   * :placeholder-shown track "filled". The border and background live on
   * the wrapper, so addons share the box:
   *
   *   .has-toggle  + <button class="toggle-password">  (js/account.js)
   *   .has-addon   + <select class="addon">             e.g. a phone prefix
   *   .is-floated  label always up, for inputs that draw their own
   *                placeholder (type=date, select)
   *   .is-invalid  error state (set by js/account.js on native validation,
   *                or server-side)
   */

  .form-field {
    position: relative;
    display: flex;
    align-items: stretch;
    min-height: var(--field-height);
    border: var(--field-border-width) solid var(--field-border-color);
    border-radius: var(--field-radius);
    background-color: var(--field-bg);
    color: var(--field-fg);
    transition: border-color 0.15s ease;

    &:hover {
      border-color: var(--field-border-color-hover);
    }

    &:focus-within {
      border-color: var(--field-border-color-focus);
    }

    &.is-invalid {
      border-color: var(--field-border-color-error);
    }

    .input {
      flex: 1 1 auto;
      min-width: 0;
      width: 100%;
      padding: calc(var(--field-label-size) + var(--space-3))
        var(--field-padding-x) var(--space-2);
      border: none;
      border-radius: inherit;
      background: transparent;
      color: inherit;
      font-size: var(--field-font-size);
      line-height: var(--leading-snug);
      outline: none;

      &::placeholder {
        color: transparent;
      }

      /* Firefox's own red glow on rejected fields; the wrapper shows it. */
      &:-moz-ui-invalid {
        box-shadow: none;
      }

      /* Chrome paints autofilled fields pale yellow; keep the field's own colours. */
      &:-webkit-autofill {
        -webkit-text-fill-color: var(--field-fg);
        box-shadow: 0 0 0 100rem var(--field-bg) inset;
      }
    }

    /* Multi-line: the top padding is the same, the height grows. */
    textarea.input {
      min-height: calc(var(--field-height) * 2);
    }

    /*
     * A select: same box, a chevron on the right. It has no placeholder, so
     * its label stays down while an empty first option is selected (the
     * floated rule below) or is pinned up with .is-floated.
     */
    select.input {
      appearance: none;
      padding-right: calc(var(--field-padding-x) + var(--icon-lg));
      background: transparent
        url(/wp-content/themes/romeismore-v2/assets/chevron-down.svg) right
        var(--field-padding-x) center / var(--icon-sm) no-repeat;
      cursor: pointer;
    }

    .label {
      position: absolute;
      top: 50%;
      left: var(--field-padding-x);
      right: var(--field-padding-x);
      translate: 0 -50%;
      color: var(--field-placeholder);
      font-size: var(--field-font-size);
      line-height: var(--leading-snug);
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
      pointer-events: none;
      transition:
        top 0.12s ease,
        translate 0.12s ease,
        font-size 0.12s ease;
    }

    .input:focus ~ .label,
    .input:not(select):not([type='date']):not(:placeholder-shown) ~ .label,
    .input[type='date'].has-value ~ .label,
    .input:-webkit-autofill ~ .label,
    select.input:not(:has(option[value='']:checked)) ~ .label,
    &.is-floated .label {
      top: var(--space-3);
      translate: 0;
      font-size: var(--field-label-size);
      letter-spacing: 0.02em;
      text-transform: uppercase;
      color: var(--field-label);
    }

    &.has-toggle .label {
      right: calc(var(--field-padding-x) + 2.5rem);
    }

    .toggle-password {
      flex: 0 0 auto;
      width: 3rem;
      border: none;
      border-radius: 0 var(--field-radius) var(--field-radius) 0;
      background: transparent
        url(/wp-content/themes/romeismore-v2/assets/eye.svg) center /
        var(--icon-lg) no-repeat;
      cursor: pointer;
      -webkit-tap-highlight-color: transparent;

      &[aria-pressed='true'] {
        background-image: url(/wp-content/themes/romeismore-v2/assets/eye-off.svg);
      }

      &:focus-visible {
        outline: 2px solid var(--color-fg);
        outline-offset: -4px;
      }
    }

    /* A select on the right, separated by a short rule ("ITA +39"). */
    .addon {
      flex: 0 0 auto;
      align-self: center;
      appearance: none;
      max-width: 40%;
      margin: var(--space-3) 0;
      padding: var(--space-2) calc(var(--field-padding-x) + var(--icon-sm))
        var(--space-2) var(--field-padding-x);
      border: none;
      border-left: var(--field-border-width) solid var(--field-border-color);
      border-radius: 0;
      background: transparent
        url(/wp-content/themes/romeismore-v2/assets/chevron-down.svg) right
        var(--space-3) center / var(--icon-sm) no-repeat;
      color: inherit;
      font-size: var(--field-font-size);
      line-height: var(--leading-snug);
      cursor: pointer;
      outline: none;
    }

    /* Date inputs: the browser's dd/mm/yyyy text sits where the value would. */
    .input[type='date'] {
      appearance: none;
      -webkit-appearance: none;

      &::-webkit-date-and-time-value {
        text-align: left;
      }

      &::-webkit-calendar-picker-indicator {
        opacity: 0.6;
        cursor: pointer;
      }
    }
  }

  /*
   * Native boxes and radios that are not restyled (browser UI) take the ink
   * colour: nothing on the site stays browser-blue when checked.
   */
  input[type='checkbox'],
  input[type='radio'] {
    accent-color: var(--color-fg);
  }

  /* ----- Form check -----
   *
   *   <label class="form-check">
   *     <input type="checkbox" name="…">
   *     <span>Accetto la privacy policy</span>
   *   </label>
   */

  .form-check {
    display: flex;
    align-items: flex-start;
    gap: var(--space-3);
    font-size: var(--text-sm);
    line-height: var(--leading-base);
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;

    input {
      appearance: none;
      flex: 0 0 auto;
      width: var(--icon-md);
      height: var(--icon-md);
      margin: 0.125rem 0 0;
      border: 1.5px solid var(--field-border-color-hover);
      border-radius: 3px;
      background-color: var(--field-bg);
      cursor: inherit;

      &:checked {
        border-color: var(--color-fg);
        background: var(--field-bg)
          url(/wp-content/themes/romeismore-v2/assets/check.svg) center / 80%
          no-repeat;
      }

      &:focus-visible {
        outline: 2px solid var(--color-fg);
        outline-offset: 2px;
      }
    }

    input[type='radio'] {
      border-radius: var(--radius-pill);
      display: grid;
      place-content: center;

      &::before {
        content: '';
        width: 0.5rem;
        height: 0.5rem;
        border-radius: var(--radius-pill);
        background-color: var(--color-fg);
        transform: scale(0);
        transition: transform 0.15s ease;
      }

      &:checked {
        background-image: none;

        &::before {
          transform: scale(1);
        }
      }
    }

    a {
      font-weight: var(--weight-semibold);
    }
  }

  /* ----- Form notice ----- */

  /*
   * Date input (registration): the browser paints its own "gg/mm/aaaa", so
   * it is hidden until the field is focused or filled and the label sits
   * inside like everywhere else (js/account.js toggles .has-value).
   */
  .form-field .input[type='date']:not(:focus):not(.has-value)::-webkit-datetime-edit {
    color: transparent;
  }

  /*
   * Firefox has no ::-webkit-datetime-edit: hide the text with the fill colour
   * instead. `color` would also blank the calendar icon, which is drawn in
   * currentColor; the fill colour only touches the glyphs.
   */
  @supports not selector(::-webkit-datetime-edit) {
    .form-field .input[type='date']:not(:focus):not(.has-value) {
      -webkit-text-fill-color: transparent;
    }
  }

  .form-notices {
    display: grid;
    gap: var(--space-3);
  }

  .form-notice {
    padding: var(--space-3) var(--space-4);
    border: 1px solid color-mix(in srgb, var(--color-fg) 20%, transparent);
    border-radius: var(--field-radius);
    background-color: var(--color-surface);
    font-size: var(--text-sm);
    line-height: var(--leading-base);

    a {
      font-weight: var(--weight-semibold);
    }

    &.is-error {
      border-color: color-mix(in srgb, var(--color-promo) 35%, transparent);
      background-color: color-mix(
        in srgb,
        var(--color-promo) 6%,
        var(--color-bg)
      );
      color: var(--color-promo);
    }

    &.is-success {
      border-color: var(--color-fg);
      background-color: var(--color-fg);
      color: var(--color-on-fg);
    }
  }

  /* ----- Social icon ----- */

  .social-icon {
    display: block;
    width: var(--space-12);
    height: var(--space-12);
    border: 1.5px solid var(--color-fg);
    border-radius: var(--radius-pill);
    background-size: auto var(--icon-md);
    background-position: center;
    -webkit-tap-highlight-color: transparent;
  }

  .social-icon--alt {
    border: none;
    background-color: var(--color-bg);
  }

  .social-icon--instagram {
    background-image: url(/wp-content/themes/romeismore-v2/assets/instagram.svg);
  }
  .social-icon--facebook {
    background-image: url(/wp-content/themes/romeismore-v2/assets/facebook.svg);
  }
  .social-icon--tiktok {
    background-image: url(/wp-content/themes/romeismore-v2/assets/tiktok.svg);
  }
  .social-icon--linkedin {
    background-image: url(/wp-content/themes/romeismore-v2/assets/linkedin.svg);
  }
  .social-icon--youtube {
    background-image: url(/wp-content/themes/romeismore-v2/assets/youtube.svg);
  }
  .social-icon--spotify {
    background-image: url(/wp-content/themes/romeismore-v2/assets/spotify.svg);
  }

  /* ----- Site header ----- */

  .site-header {
    position: relative;
    padding: 0 var(--header-gutter);
    height: var(--header-height);
    background-color: var(--color-surface);
    display: grid;
    grid-template-columns: 1fr 4fr 1fr;

    /* Explicit cells, so the search box can share the logo's on mobile. */
    .left {
      grid-area: 1 / 1;
    }

    .logo-container {
      grid-area: 1 / 2;
      display: flex;
      justify-content: center;
    }

    .right {
      grid-area: 1 / 3;
    }

    .logo {
      flex: 0 0 100%;
      max-width: 150px;
      background-image: url(/wp-content/themes/romeismore-v2/assets/logo.svg);
      background-size: contain;
      background-position: center;
    }

    .left,
    .right {
      position: relative;
      z-index: 10;
      display: flex;
      align-items: center;
      gap: var(--space-4);
    }

    .right {
      justify-content: flex-end;
    }

    /* The favorites heart is a link (to /wishlist/), styled like the buttons. */
    button,
    a.favorites-btn {
      flex: 0 0 auto;
      width: var(--icon-sm);
      height: var(--icon-sm);
      background-size: contain;
      background-position: center;
      border: none;
      background-color: transparent;
    }

    .menu-btn {
      background-image: url(/wp-content/themes/romeismore-v2/assets/burger.svg);
    }
    .search-btn {
      background-image: url(/wp-content/themes/romeismore-v2/assets/search.svg);
    }
    .favorites-btn {
      background-image: url(/wp-content/themes/romeismore-v2/assets/heart.svg);
    }
    .cart-btn {
      background-image: url(/wp-content/themes/romeismore-v2/assets/cart.svg);
    }

    /* Desktop: bolder icons (assets/header, stroke 2.4 instead of 1.8), a little larger. */
    @media (min-width: 981px) {
      button,
      a.favorites-btn {
        width: var(--icon-header);
        height: var(--icon-header);
      }

      .left,
      .right {
        gap: var(--space-5);
      }

      .menu-btn {
        background-image: url(/wp-content/themes/romeismore-v2/assets/header/burger.svg);
      }
      .search-btn {
        background-image: url(/wp-content/themes/romeismore-v2/assets/header/search.svg);
      }
      .favorites-btn {
        background-image: url(/wp-content/themes/romeismore-v2/assets/header/heart.svg);
      }
      .cart-btn {
        background-image: url(/wp-content/themes/romeismore-v2/assets/header/cart.svg);
      }
    }

    /*
     * The search box (js/search.js), shown in place of the search button,
     * which hides while it's open. Mobile: over the logo, in its cell.
     * Desktop: next to the menu button — positioned, not a grid item, so
     * its width never widens the left column and shifts the logo.
     */
    .site-search {
      grid-area: 1 / 2;
      z-index: 20;
      align-self: center;
      min-width: 0;

      @media (min-width: 981px) {
        grid-area: auto; /* an absolutely positioned grid child is placed within its area; auto means the header itself */
        position: absolute;
        top: 50%;
        left: calc(var(--header-gutter) + var(--icon-header) + var(--space-5));
        width: 22rem;
        translate: 0 -50%;
      }
    }

    &.search-open .search-btn {
      display: none;
    }
  }

  /* ----- Search box -----
   *
   *   <form class="search-box" role="search">
   *     <button type="submit" class="submit-btn">  the magnifier
   *     <input class="input" type="search">
   *     <button type="button" class="close-btn">   optional (header)
   *   </form>
   *
   * templates/search-box.php. A pill like the outline button, so the header
   * one and the results-page one match the chips.
   */

  .search-box {
    &:focus-within {
      outline: 2px solid var(--color-fg);
      outline-offset: 2px;
    }

    display: flex;
    align-items: center;
    gap: var(--space-2);
    height: 2.75rem;
    padding: 0 var(--space-3);
    border: 2px solid var(--color-fg);
    border-radius: var(--radius-pill);
    background-color: var(--color-on-fg);
    color: var(--color-fg);

    &[hidden] {
      display: none;
    }

    .submit-btn,
    .close-btn {
      flex: 0 0 auto;
      width: var(--icon-sm);
      height: var(--icon-sm);
      padding: 0;
      border: none;
      background: transparent center / contain no-repeat;
      cursor: pointer;
      -webkit-tap-highlight-color: transparent;

      &:focus-visible {
        outline: 2px solid var(--color-fg);
        outline-offset: 3px;
        border-radius: 2px;
      }
    }

    .submit-btn {
      background-image: url(/wp-content/themes/romeismore-v2/assets/search.svg);
    }

    .close-btn {
      background-image: url(/wp-content/themes/romeismore-v2/assets/x.svg);
    }

    .input {
      flex: 1 1 auto;
      min-width: 0;
      width: 100%;
      height: 100%;
      padding: 0 var(--space-1);
      border: none;
      background: transparent;
      color: inherit;
      font-size: var(--text-md);
      line-height: var(--leading-snug);
      appearance: none;
      outline: none;

      &::placeholder {
        color: var(--color-muted);
      }

      /* Our own × does the clearing; the native one doubles it. */
      &::-webkit-search-cancel-button,
      &::-webkit-search-decoration {
        appearance: none;
        display: none;
      }
      text-overflow: ellipsis;
    }
  }

  /* ----- Site menu ----- */

  body.menu-open {
    overflow: hidden;
  }

  .site-menu {
    position: fixed;
    inset: 0;
    z-index: 1000;

    .overlay {
      position: absolute;
      inset: 0;
      background-color: rgb(0 0 0 / 0.4);
      opacity: 0;
      transition: opacity 0.3s ease;
    }

    &.is-open .overlay {
      opacity: 1;
    }

    .panel {
      position: absolute;
      top: 0;
      left: 0;
      height: 100%;
      width: min(100%, 30rem);
      background-color: var(--color-bg);
      display: flex;
      flex-direction: column;
      overflow: hidden;
      transform: translateX(-100%);
      transition: transform 0.3s ease;
    }

    &.is-open .panel {
      transform: translateX(0);
    }

    .body {
      position: relative;
      flex: 1 1 auto;
      overflow: hidden;
    }

    .scroll {
      height: 100%;
      overflow-y: auto;
      overscroll-behavior: contain;
      display: flex;
      flex-direction: column;
    }

    .subpanel {
      position: absolute;
      inset: 0;
      z-index: 2;
      background-color: var(--color-bg);
      overflow-y: auto;
      overscroll-behavior: contain;
      transform: translateX(-100%);
      transition: transform 0.3s ease;
    }

    &.subpanel-open .subpanel {
      transform: translateX(0);
    }

    .menu-header {
      flex: 0 0 auto;
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: var(--space-4);
      min-height: var(--header-height);
      padding: var(--space-4) var(--gutter-inline);
      background-color: var(--color-fg);
      color: var(--color-on-fg);
    }

    .menu-login {
      color: var(--color-on-fg);
      font-size: var(--text-md);
      font-weight: var(--weight-medium);
      text-decoration: underline;
      text-underline-offset: 3px;
      text-transform: uppercase;
      -webkit-tap-highlight-color: transparent;
    }

    .close-btn,
    .back-btn {
      flex: 0 0 auto;
      width: var(--icon-md);
      height: var(--icon-md);
      border: none;
      background-color: transparent;
      background-size: contain;
      background-position: center;
      background-image: url(/wp-content/themes/romeismore-v2/assets/close.svg);
      cursor: pointer;
      -webkit-tap-highlight-color: transparent;
    }

    .close-btn {
      filter: brightness(0) invert(1);
    }

    .back-btn {
      background-image: url(/wp-content/themes/romeismore-v2/assets/arrow-left.svg);
    }

    .primary,
    .subpanel nav {
      padding: var(--space-8) var(--gutter-inline);
      background-color: var(--color-bg);
    }

    .title {
      font-size: var(--text-4xl);
      font-weight: var(--weight-bold);
      margin-bottom: var(--stack-loose);
    }

    .subpanel-header {
      display: flex;
      align-items: center;
      gap: var(--space-4);
      padding: var(--space-6) var(--gutter-inline) 0;
      font-size: var(--text-lg);
      font-weight: var(--weight-bold);
      text-transform: uppercase;
    }

    .list {
      list-style: none;
      display: flex;
      flex-direction: column;
      gap: var(--space-5);

      a {
        display: block;
        font-size: var(--text-xl);
        font-weight: var(--weight-bold);
        text-transform: uppercase;
        text-decoration: none;
        -webkit-tap-highlight-color: transparent;
      }

      .is-promo a {
        color: var(--color-promo);
      }

      .opens-subpanel a {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: var(--space-4);

        &::after {
          content: '';
          flex: 0 0 auto;
          width: var(--icon-md);
          height: var(--icon-md);
          background: url(/wp-content/themes/romeismore-v2/assets/arrow-left.svg)
            center / contain no-repeat;
          transform: scaleX(-1);
        }
      }
    }

    .secondary {
      position: relative;
      flex: 1 0 auto;
      padding: var(--space-10) var(--gutter-inline) var(--space-8);
      background-color: var(--color-surface);
    }

    .social {
      list-style: none;
      display: flex;
      justify-content: center;
      gap: var(--space-4);
      margin-top: var(--space-10);
    }
  }

  @media (prefers-reduced-motion: reduce) {
    .site-menu .overlay,
    .site-menu .panel,
    .site-menu .subpanel {
      transition: none;
    }
  }

  /* ----- Home slider ----- */

  .home-slider {
    width: 100%;

    /*
     * Bullets sit over the slide (the element lives outside .swiper-wrapper so
     * it doesn't scroll away with the first slide). Swiper reads these vars;
     * the block/margin reset undoes the account-orders .pagination rules.
     */
    .pagination {
      --swiper-pagination-bottom: var(--space-4);
      --swiper-pagination-bullet-size: 0.625rem;
      --swiper-pagination-bullet-horizontal-gap: 0.3125rem;
      --swiper-pagination-color: rgb(255 255 255 / 0.75);
      --swiper-pagination-bullet-inactive-color: var(--color-scrim);
      --swiper-pagination-bullet-inactive-opacity: 1;
      --swiper-pagination-bullet-opacity: 1;
      display: block;
      margin: 0;

      @media (min-width: 981px) {
        --swiper-pagination-bottom: var(--space-6);
      }
    }

    .slide {
      aspect-ratio: 828/1031;

      @media (min-width: 981px) {
        aspect-ratio: 3840/1264;
      }
    }

    .img,
    .video {
      width: 100%;
      height: 100%;
      object-fit: cover;
      object-position: center;
    }

    .img--mobile,
    .video--mobile {
      display: block;
    }

    .img--desktop,
    .video--desktop {
      display: none;
    }

    @media (min-width: 981px) {
      .img--mobile,
      .video--mobile {
        display: none;
      }

      .img--desktop,
      .video--desktop {
        display: block;
      }
    }
  }

  /* ----- Home section ----- */

  .site-section {
    > .container {
      display: flex;
      flex-direction: column;
      align-items: center;

      > .title {
        margin-bottom: var(--stack-tight);
        font-weight: var(--weight-bold);
        text-align: center;
        font-size: var(--text-xl);

        &.has-wave {
          margin-bottom: var(--stack-loose);
        }
      }

      > .subtitle {
        max-width: 40rem;
        font-weight: var(--weight-medium);
        color: var(--color-muted);
        margin-bottom: var(--stack-loose);
        text-align: center;
        text-wrap: pretty;
      }
    }
  }

  /* Larger section headings on the desktop homepage (other pages keep their mockup sizes). */
  @media (min-width: 981px) {
    body.home .site-section > .container > .title {
      font-size: var(--text-2xl);

      &.has-wave {
        margin-bottom: var(--space-8);
      }
    }

    body.home .site-section > .container > .subtitle {
      margin-bottom: var(--space-10);
      font-size: var(--text-lg);
    }
  }

  /*
   * Home sections share one column: full-bleed on phones, capped and
   * centred from desktop up. The two carousels (best sellers, partners)
   * keep it too — their .swiper is allowed to overflow the column so the
   * next slide peeks out past its edge, and the section clips at the
   * viewport (the intended "runs off the right edge" look).
   */
  .site-bestsellers,
  .home-featured-products,
  .home-partners,
  .home-categories,
  .home-gift-guides,
  .site-store-info,
  .product-slider {
    --home-max: 75rem;

    @media (min-width: 981px) {
      > .container {
        width: 100%;
        max-width: var(--home-max);
        margin-inline: auto;
      }
    }
  }

  .site-bestsellers,
  .product-slider {
    @media (min-width: 981px) {
      overflow: hidden;
      padding-inline: var(--space-10);

      /* !important: swiper-bundle.css is unlayered, so it outranks this layer. */
      .swiper {
        overflow: visible !important;
      }
    }
  }

  /* Prev/next arrows on the desktop carousels (mobile scrolls by touch). */
  .slider-btn {
    display: none;
    position: absolute;
    top: 40%;
    z-index: 2;
    width: 3rem;
    height: 3rem;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background-color: var(--color-bg);
    box-shadow: 0 2px 12px rgb(39 39 39 / 0.18);
    color: var(--color-fg);
    cursor: pointer;
    transform: translateY(-50%);
    transition: opacity 0.2s ease;

    &::before {
      content: '';
      display: block;
      width: var(--icon-md);
      height: var(--icon-md);
      margin: auto;
      background-color: currentColor;
      -webkit-mask: url(/wp-content/themes/romeismore-v2/assets/arrow-left.svg)
        center / contain no-repeat;
      mask: url(/wp-content/themes/romeismore-v2/assets/arrow-left.svg) center /
        contain no-repeat;
    }

    /* Centred on the column edges, over the gap to the peeking slides. */
    &.slider-btn--prev {
      left: -1.5rem;
    }

    &.slider-btn--next {
      right: -1.5rem;

      &::before {
        transform: scaleX(-1);
      }
    }

    &.swiper-button-disabled,
    &:disabled {
      opacity: 0;
      pointer-events: none;
    }

    @media (min-width: 981px) {
      display: grid;
    }
  }

  /* ----- Site bestsellers ----- */

  .site-bestsellers {
    padding: var(--section-block) 0;

    .swiper {
      position: relative;
      width: 100%;
      min-width: 0;
      margin-bottom: var(--stack);
    }

    @media (min-width: 981px) {
      .swiper {
        margin-bottom: var(--space-8);
      }
    }

    li.product .thumb img {
      border-top-left-radius: 200px;
      border-top-right-radius: 200px;
      aspect-ratio: 0.8;
    }

    /* "Scopri tutto il catalogo": the arch of the product thumbnails, ink-filled, with the text in the middle. */
    .catalog-card {
      .card-link {
        display: block;
        text-decoration: none;
        color: var(--color-on-fg);
      }

      .thumb {
        display: grid;
        place-content: center;
        aspect-ratio: 0.8;
        padding: var(--space-6);
        border-radius: 200px 200px 2px 2px;
        background-color: var(--color-fg);
        text-align: center;
        text-transform: uppercase;
        font-size: var(--text-sm);
        font-weight: var(--weight-bold);
        line-height: var(--leading-base);

        /* Mouse feedback as on .button (DESIGN-SYSTEM: 0.15s ease). */
        transition: opacity 0.15s ease;
      }

      @media (hover: hover) {
        .card-link:hover .thumb {
          opacity: 0.85;
        }
      }

      .label {
        display: block;
        max-width: 8em;
      }
    }
  }

  /* ----- Home featured products ----- */

  .home-featured-products {
    padding: var(--section-block) var(--gutter-inline);
    background-color: var(--color-surface);

    .products {
      width: 100%;
      display: grid;
      grid-template-columns: repeat(2, minmax(0, 1fr));
      gap: var(--space-4);

      @media (min-width: 640px) {
        gap: var(--space-8) var(--space-6);
      }

      @media (min-width: 981px) {
        grid-template-columns: repeat(4, minmax(0, 1fr));
      }
    }

    @media (min-width: 981px) {
      padding-inline: var(--space-10);
    }
  }

  /* ----- Home partners ----- */

  /* One row's width plus the gap to the next copy: at the end the copy is exactly where the row began. */
  @keyframes rimx-marquee {
    to {
      transform: translateX(calc(-100% - var(--logo-gap)));
    }
  }

  .home-partners {
    padding: var(--section-block) 0;
    background-color: var(--color-fg);
    color: var(--color-on-fg);
    container-type: inline-size;

    /*
     * Logo marquee: two identical rows slide left for ever; when the first
     * has gone past, the second is exactly where the first started. Pauses
     * under the pointer; with prefers-reduced-motion it is a still row that
     * scrolls by touch instead. Every logo gets a box of the same size, so
     * the strip reads as one row of equal marks.
     */
    .logo-marquee {
      --logo-box-w: 6.5rem;
      --logo-box-h: 2.5rem;
      --logo-gap: var(--space-8);

      display: flex;
      gap: var(--logo-gap);
      width: 100%; /* the column centres its children: without this the strip would be as wide as its two rows */
      overflow: hidden;
      margin-bottom: var(--section-block);

      @media (min-width: 981px) {
        --logo-box-w: 8rem;
        --logo-box-h: 3rem;
        --logo-gap: var(--space-10);
      }

      .track {
        display: flex;
        flex: 0 0 auto;
        gap: var(--logo-gap);
        min-width: 100%;
        justify-content: space-around;
        margin: 0;
        padding: 0;
        list-style: none;
        animation: rimx-marquee calc(var(--logo-count, 20) * 1.5s) linear infinite;
        will-change: transform;
      }

      li {
        flex: 0 0 var(--logo-box-w);
        height: var(--logo-box-h);
      }

      img {
        display: block;
        width: 100%;
        height: 100%;
        margin: 0;
        object-fit: contain;
        object-position: center;
        filter: brightness(0) invert(1);
      }

      @media (hover: hover) {
        &:hover .track {
          animation-play-state: paused;
        }
      }

      /*
       * js/home.js drives the strip (auto-scroll + swipe + drag): a native
       * horizontal scroller without a scrollbar, the CSS animation off.
       */
      &.is-scripted {
        overflow-x: auto;
        overscroll-behavior-x: contain;
        scrollbar-width: none;
        cursor: grab;

        &::-webkit-scrollbar {
          display: none;
        }

        &.is-dragging {
          cursor: grabbing;
          user-select: none;
        }

        .track {
          animation: none;
        }

        img {
          -webkit-user-drag: none;
        }
      }

      @media (prefers-reduced-motion: reduce) {
        overflow-x: auto;
        scrollbar-width: none;

        .track {
          animation: none;
          min-width: max-content;
          padding-inline: var(--gutter-inline);
        }

        .track[aria-hidden] {
          display: none;
        }
      }
    }

    .wave {
      margin-bottom: var(--section-block);

      /* Stays edge to edge even though the column is capped; the section clips it. */
      @media (min-width: 981px) {
        width: 100vw;
        margin-inline: calc(50% - 50vw);
      }
    }

    @media (min-width: 981px) {
      .contact {
        gap: var(--space-6);
      }

      .contact-title {
        font-size: var(--text-lg);
      }
    }

    .contact {
      padding: 0 var(--gutter-inline);
      display: flex;
      gap: var(--gutter-inline);
      align-items: center;
      justify-content: center;
    }

    .contact-title {
      font-size: var(--text-sm);
      font-weight: bold;

      @container (width>= 414px) {
        font-size: var(--text-md);
      }
    }
  }

  /* ----- Home categories ----- */

  .home-categories {
    padding: var(--section-block) var(--gutter-inline);

    .links {
      display: flex;
      flex-direction: row;
      flex-wrap: wrap;
      justify-content: center;
      gap: var(--space-4);

      @media (min-width: 981px) {
        gap: var(--space-5);
        max-width: 56rem;
      }
    }
  }

  /* ----- Home gift guides ----- */

  .home-gift-guides {
    padding: var(--section-block) var(--gutter-inline);
    background: var(--color-cream);

    .guides {
      width: 100%;
      display: grid;
      grid-template-columns: repeat(2, minmax(0, 1fr));
      gap: var(--space-12) var(--space-4);

      @media (min-width: 640px) {
        gap: var(--space-12) var(--space-6);
      }

      @media (min-width: 981px) {
        grid-template-columns: repeat(4, minmax(0, 1fr));
      }
    }

    @media (min-width: 981px) {
      padding-inline: var(--space-10);
      /* Room for the price pills hanging off the bottom of the tiles. */
      padding-bottom: var(--space-16);
    }

    .guide {
      position: relative;
      display: block;
      aspect-ratio: 1;
      min-width: 0;
    }

    .image {
      width: 100%;
      height: 100%;
      object-fit: cover;
      object-position: center;
    }

    .button {
      position: absolute;
      bottom: 0;
      left: 50%;
      transform: translate(-50%, 50%);
      white-space: nowrap;
      z-index: 1;
    }
  }

  /* ----- Site visit us ----- */
  .site-visit-us {
    padding: var(--section-block) var(--gutter-inline);
    background-color: var(--color-fg);
    color: var(--color-on-fg);

    > .container > .title,
    > .container > .subtitle {
      color: inherit;
    }

    /* Even lines: on phones the title broke leaving "TE!" alone on the second line. */
    > .container > .title {
      text-wrap: balance;
    }

    .button {
      display: block;
      margin-left: auto;
      margin-right: auto;
    }
  }

  /* ----- Site store info ----- */
  .site-store-info {
    padding: var(--section-block) 0;

    .swiper {
      width: 100%;
      min-width: 0;
      margin-bottom: var(--stack);

      .swiper-slide {
        width: auto !important;
      }

      .info {
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
      }

      .img {
        width: auto;
        height: 2.25rem;
        margin-bottom: var(--stack);
      }

      .title,
      .subtitle {
        text-align: center;
      }

      .title {
        font-size: var(--text-xs);
        font-weight: var(--weight-semibold);
        text-transform: uppercase;
      }

      .subtitle {
        font-size: var(--text-xs);
      }
    }

    /*
     * From tablet up all four items fit, so js/main.js disables the Swiper
     * (breakpoint 768) and this lays them out as equal columns instead of
     * a left-anchored strip.
     */
    @media (min-width: 768px) {
      padding-inline: var(--gutter-inline);

      .swiper {
        overflow: visible !important;
        margin-bottom: 0;

        .swiper-wrapper {
          justify-content: space-between;
          gap: var(--space-6);
          transform: none !important;
        }

        .swiper-slide {
          flex: 1 1 0;
          margin: 0 !important;
        }

        .info {
          height: 100%;
          justify-content: flex-start;
        }

        .title,
        .subtitle {
          text-wrap: balance;
        }
      }
    }

    @media (min-width: 981px) {
      padding-inline: var(--space-10);

      .swiper {
        .swiper-wrapper {
          gap: var(--space-8);
        }

        .img {
          height: 2.75rem;
          margin-bottom: var(--space-5);
        }

        .title,
        .subtitle {
          font-size: var(--text-sm);
        }
      }
    }
  }

  /* ----- Site newsletter ----- */
  .site-newsletter {
    position: relative;
    padding: var(--section-block) var(--gutter-inline);
    background: var(--color-cream);

    & > .container > .subtitle {
      font-weight: normal;
      color: var(--color-fg);
    }

    .form {
      display: flex;
      flex-direction: column;
      align-items: center;
      gap: var(--space-6);
      width: 100%;
      max-width: 30rem; /* a full address fits next to the button (REV SITO RIM 9/11) */
      margin-bottom: var(--space-8);
    }

    .form-input-group {
      display: grid;
      width: 100%;

      /* Stack both children in the same cell so the input slides under the
         button; align-items defaults to stretch, keeping equal heights. */
      > * {
        grid-area: 1 / 1;
      }
    }

    .email-input {
      min-width: 0;
      width: 100%;
      padding: 0 var(--space-6);
    }

    .submit-btn {
      justify-self: end;
    }

    /* .form-check with the newsletter's smaller type, box and text on one line. */
    .privacy {
      align-items: center;
      gap: var(--space-2);
      font-size: var(--text-xs);
    }

    /* "Se beccamo sui social!" with the handle on its own line (REV SITO RIM 9/11). */
    .social-line {
      display: flex;
      flex-direction: column;
      align-items: center;
      gap: var(--space-1);
      margin-bottom: var(--space-4);

      .text {
        margin: 0;
      }

      .handle {
        font-weight: bold;
        text-decoration: none;
      }
    }

    .social-icons {
      display: flex;
      justify-content: center;
      gap: var(--space-4);
    }
  }

  /* ----- Site footer ----- */

  .site-footer {
    margin-top: auto;
    background-color: var(--color-fg);
    color: var(--color-on-fg);
    text-align: center;

    .footer-main {
      padding: var(--space-10) var(--gutter-inline) var(--space-12);

      > .container {
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: var(--space-12);
      }
    }

    .brand {
      display: flex;
      flex-direction: column;
      align-items: center;
      gap: var(--space-4);
    }

    /*
     * The logo asset is ink-coloured; a mask paints it in the footer's text
     * colour. The mask sits on a pseudo-element so that it does not clip the
     * focus ring of the link itself.
     */
    .logo {
      display: block;
      width: 13.75rem; /* 220px */
      aspect-ratio: 150 / 14;

      &::before {
        content: '';
        display: block;
        inline-size: 100%;
        block-size: 100%;
        background-color: currentColor;
        -webkit-mask: url(/wp-content/themes/romeismore-v2/assets/logo.svg)
          center / contain no-repeat;
        mask: url(/wp-content/themes/romeismore-v2/assets/logo.svg) center /
          contain no-repeat;
      }
    }

    .tagline {
      font-size: var(--text-md);
      text-transform: uppercase;
      letter-spacing: 0.02em;
    }

    .footer-nav {
      .title {
        margin-bottom: var(--space-5);
        font-size: var(--text-xl);
        font-weight: var(--weight-bold);
        text-transform: uppercase;
      }

      .list {
        list-style: none;
        display: flex;
        flex-direction: column;
        gap: var(--space-2);
      }

      a {
        display: inline-block;
        padding: var(--space-1) 0;
        font-size: var(--text-sm);
        text-decoration: none;

        &:hover,
        &:focus-visible {
          text-decoration: underline;
          text-underline-offset: 0.2em;
        }
      }
    }

    /* Newsletter column (REV 21/11): the box's form, compact and on the dark footer. */
    .footer-newsletter {
      display: flex;
      flex-direction: column;
      align-items: center;
      width: 100%;
      max-width: 22rem;

      .title {
        margin-bottom: var(--space-5);
        font-size: var(--text-xl);
        font-weight: var(--weight-bold);
        text-transform: uppercase;
      }

      .form {
        display: flex;
        flex-direction: column;
        gap: var(--space-4);
        width: 100%;
      }

      .form-input-group {
        display: grid;
        width: 100%;

        > * {
          grid-area: 1 / 1;
        }
      }

      .email-input {
        min-width: 0;
        width: 100%;
        padding: 0 var(--space-5);
        color: var(--color-fg);
      }

      .submit-btn {
        justify-self: end;
      }

      .privacy {
        align-items: center;
        gap: var(--space-2);
        font-size: var(--text-xs);
        text-align: left;

        a {
          color: inherit;
        }
      }

      .form-notice {
        margin: var(--space-4) 0 0;
        font-size: var(--text-sm);
      }

      .form[hidden],
      .form-notice[hidden] {
        display: none;
      }
    }

    .footer-bottom {
      padding: var(--space-10) var(--gutter-inline) var(--space-8);

      > .container {
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: var(--space-10);
      }
    }

    .payments {
      list-style: none;
      display: flex;
      flex-wrap: wrap;
      justify-content: center;
      gap: var(--space-2);

      img {
        display: block;
        width: auto;
        height: 1.75rem; /* 28px */
      }
    }

    .legal {
      display: flex;
      flex-direction: column;
      gap: var(--space-1);
      font-size: var(--text-xs);
      color: color-mix(in srgb, var(--color-on-fg) 65%, var(--color-fg));
    }

    @media (min-width: 981px) {
      text-align: left;

      .footer-main,
      .footer-bottom {
        padding-inline: var(--space-8);
      }

      .footer-main > .container,
      .footer-bottom > .container {
        width: 100%;
        max-width: 75rem;
        margin-inline: auto;
      }

      .footer-main {
        padding-block: var(--space-16) var(--space-12);

        > .container {
          display: grid;
          grid-template-columns: 1.3fr 1fr 1fr 1.4fr;
          align-items: start;
          gap: var(--space-10);
        }
      }

      .brand {
        align-items: flex-start;
      }

      .footer-newsletter {
        align-items: stretch;
        max-width: none;
      }

      .footer-nav .list {
        gap: var(--space-1);
      }

      .footer-bottom {
        padding-block: var(--space-8);

        > .container {
          flex-direction: row;
          justify-content: space-between;
          align-items: center;
          gap: var(--space-8);
        }
      }

      .payments {
        justify-content: flex-start;
      }

      .legal {
        text-align: right;
      }
    }
  }

  /* ----- WooCommerce loop product ----- */

  /*
   * On WooCommerce pages (body.woocommerce) the vendor layer gives ul.products
   * a clearfix and floats/sizes each li for its own float grid. Neutralise
   * everything it sets so the card sizes purely from its grid or slide.
   */
  ul.products {
    &::before,
    &::after {
      content: none;
    }
  }

  li.product {
    display: block;
    float: none;
    width: auto;
    margin: 0;
    padding: 0;
    color: var(--color-fg);

    .card-link {
      display: block;
      text-decoration: none;
    }

    .thumb {
      position: relative;
      margin-bottom: var(--stack);
    }

    .thumb img {
      width: 100%;
      margin: 0;
      aspect-ratio: 1;
      object-fit: cover;
      border-radius: 2px;
    }

    .badge {
      position: absolute;
      top: var(--space-3);
      left: var(--space-3);
      padding: var(--space-1) var(--space-3);
      border-radius: var(--radius-pill);
      background-color: var(--color-scrim);
      color: var(--color-on-fg);
      font-size: var(--text-2xs);
      font-weight: var(--weight-semibold);
      line-height: var(--leading-base);
      white-space: nowrap;
    }

    .badge--sale {
      background-color: var(--color-sale);
    }

    .woocommerce-loop-product__title {
      padding: 0;
      margin: 0 0 var(--space-1);
      font-size: var(--text-sm);
      font-weight: var(--weight-bold);
    }

    .price {
      display: block;
      margin: 0;
      font-size: var(--text-sm);
      color: inherit;

      del {
        color: var(--color-muted);
        opacity: 1;
        margin-right: var(--space-2);
      }

      ins {
        text-decoration: none;
        font-weight: inherit;
      }
    }
  }

  /* ----- Shop archive ----- */

  .shop-archive {
    padding: var(--space-6) 0 var(--section-block);

    > .container {
      max-width: 75rem;
      margin-inline: auto;
    }

    .back-link {
      display: block;
      width: var(--icon-lg);
      height: var(--icon-lg);
      margin: 0 var(--gutter-inline) var(--space-6);
      background: url(/wp-content/themes/romeismore-v2/assets/arrow-left.svg)
        center / contain no-repeat;
      -webkit-tap-highlight-color: transparent;
    }

    .toolbar {
      display: flex;
      align-items: stretch;
      gap: var(--space-3);
      padding-left: var(--gutter-inline);
      margin-bottom: var(--space-10);
    }

    /* Static: sits left of the chip row and never scrolls with it. */
    .filters-btn {
      position: relative;
      flex: 0 0 auto;
      width: 3.375rem; /* matches the chip height */
      padding: 0;
      border: 2px solid var(--color-fg);
      border-radius: var(--radius-pill);
      background: var(--color-on-fg)
        url(/wp-content/themes/romeismore-v2/assets/filter.svg) center /
        var(--icon-lg) no-repeat;
      cursor: pointer;
      -webkit-tap-highlight-color: transparent;

      &.has-filters::after {
        content: '';
        position: absolute;
        top: -2px;
        right: -2px;
        width: 0.75rem;
        height: 0.75rem;
        border: 2px solid var(--color-on-fg);
        border-radius: var(--radius-pill);
        background-color: var(--color-promo);
      }
    }

    .categories-wrap {
      position: relative;
      flex: 1 1 auto;
      min-width: 0;
      display: flex;

      /*
       * Fades under the arrows, so the chip being cut off doesn't show through.
       * Each fade is fully opaque for the whole width of its arrow (plus a
       * little margin) and only then fades out: the row scrolls under the
       * arrows and all the way to the wrap's edge (its right padding is
       * scrollable content too), so anything short of opaque there let the
       * chips peek out beside and behind the arrow.
       */
      &::before,
      &::after {
        content: '';
        display: none;
        position: absolute;
        z-index: 1; /* above the scroll container, which otherwise paints over ::before */
        top: 0;
        bottom: 0;
        pointer-events: none;
      }

      &::before {
        left: 0;
        width: 7rem;
        background: linear-gradient(to right, var(--color-bg) calc(2.25rem + 1rem), transparent);
      }

      &::after {
        right: 0;
        width: calc(7rem + var(--gutter-inline));
        background: linear-gradient(to left, var(--color-bg) calc(var(--gutter-inline) + 2.25rem + 1rem), transparent);
      }

      @media (hover: hover) and (pointer: fine) {
        &:has(.nav-arrow--prev:not([hidden]))::before,
        &:has(.nav-arrow--next:not([hidden]))::after {
          display: block;
        }
      }
    }

    /*
     * The row hides its scrollbar, so a mouse has no way to move it. On
     * hover-capable devices show a round arrow over each end that has more.
     */
    .nav-arrow {
      display: none;
      position: absolute;
      z-index: 2; /* above the fades */
      top: 50%;
      width: 2.25rem;
      height: 2.25rem;
      translate: 0 -50%;
      border: 2px solid var(--color-fg);
      border-radius: var(--radius-pill);
      background: var(--color-on-fg)
        url(/wp-content/themes/romeismore-v2/assets/arrow-left.svg) center /
        var(--icon-sm) no-repeat;
      cursor: pointer;
      -webkit-tap-highlight-color: transparent;

      @media (hover: hover) and (pointer: fine) {
        &:not([hidden]) {
          display: block;
        }
      }
    }

    .nav-arrow--prev {
      left: 0;
    }

    .nav-arrow--next {
      right: var(--gutter-inline);
      transform: scaleX(-1);
    }

    .categories {
      flex: 1 1 auto;
      min-width: 0;
      display: flex;
      gap: var(--space-3);
      padding-right: var(--gutter-inline);
      overflow-x: auto;
      scrollbar-width: none;
      scroll-snap-type: x proximity;

      &::-webkit-scrollbar {
        display: none;
      }

      .button {
        flex: 0 0 auto;
        padding-inline: var(--space-8);
        white-space: nowrap;
        scroll-snap-align: start;

        /* The scroller clips an outside ring: draw it inside the chip. */
        &:focus-visible {
          outline-offset: -5px;
        }

        &.is-active:focus-visible {
          outline-color: var(--color-on-fg);
        }
      }
    }

    .results {
      transition: opacity 0.15s ease;

      &[aria-busy='true'] {
        opacity: 0.4;
        pointer-events: none;
      }
    }

    .products {
      list-style: none;
      display: grid;
      grid-template-columns: repeat(2, minmax(0, 1fr));
      gap: var(--space-10) var(--space-4);
      padding: 0 var(--gutter-inline);
      margin-bottom: var(--space-12);

      @media (min-width: 640px) {
        grid-template-columns: repeat(3, minmax(0, 1fr));
      }

      @media (min-width: 981px) {
        grid-template-columns: repeat(4, minmax(0, 1fr));
        gap: var(--space-12) var(--space-6);
      }
    }

    .no-products {
      padding: var(--space-8) var(--gutter-inline);
      text-align: center;
      color: var(--color-muted);
    }

    .load-more {
      display: block;
      width: fit-content;
      margin: 0 auto;

      &[aria-busy='true'] {
        opacity: 0.5;
        pointer-events: none;
      }
    }
  }

  /* ----- Search results page (woocommerce/archive-product.php, search branch) ----- */

  .search-archive {
    padding-top: var(--space-10);

    .search-header {
      max-width: 36rem;
      margin: 0 auto var(--space-10);
      padding: 0 var(--gutter-inline);
      text-align: center;
    }

    .search-header .title {
      margin-bottom: var(--space-4);
      font-size: var(--text-2xl);
      font-weight: var(--weight-bold);
      line-height: var(--leading-tight);
    }

    .search-header .term {
      margin-bottom: var(--space-6);
      font-size: var(--text-md);
      line-height: var(--leading-base);
      overflow-wrap: anywhere;

      q {
        font-weight: var(--weight-bold);
      }

      .count {
        display: block;
        margin-top: var(--space-1);
        font-size: var(--text-sm);
        color: var(--color-muted);
      }
    }

    .search-header .search-box {
      height: 3.375rem; /* the chip height */
      padding-inline: var(--space-5);
    }

    .no-products q {
      font-weight: var(--weight-bold);
    }

    @media (min-width: 981px) {
      padding-top: var(--space-16);

      .search-header {
        margin-bottom: var(--space-12);
      }

      .search-header .title {
        font-size: var(--text-3xl);
      }

      .search-header .term {
        font-size: var(--text-lg);
      }
    }
  }

  /* ----- Shop filters panel ----- */

  body.filters-open {
    overflow: hidden;
  }

  .shop-filters {
    position: fixed;
    inset: 0;
    z-index: 1000;

    .overlay {
      position: absolute;
      inset: 0;
      background-color: var(--color-scrim);
      opacity: 0;
      transition: opacity 0.3s ease;
    }

    &.is-open .overlay {
      opacity: 1;
    }

    .panel {
      position: absolute;
      top: 0;
      right: 0;
      height: 100%;
      width: min(100%, 26rem);
      background-color: var(--color-bg);
      display: flex;
      flex-direction: column;
      overflow: hidden;
      transform: translateX(100%);
      transition: transform 0.3s ease;
    }

    &.is-open .panel {
      transform: translateX(0);
    }

    .panel-header {
      flex: 0 0 auto;
      display: flex;
      align-items: center;
      gap: var(--space-3);
      min-height: var(--header-height);
      padding: var(--space-4) var(--gutter-inline);
      border-bottom: 1px solid
        color-mix(in srgb, var(--color-fg) 15%, transparent);
    }

    .title {
      font-size: var(--text-md);
      font-weight: var(--weight-bold);
      text-transform: uppercase;
    }

    .count {
      flex: 1 1 auto;
      font-size: var(--text-xs);
      text-align: right;
    }

    .close-btn,
    .back-btn {
      flex: 0 0 auto;
      width: var(--icon-md);
      height: var(--icon-md);
      border: none;
      background: transparent
        url(/wp-content/themes/romeismore-v2/assets/close.svg) center / contain
        no-repeat;
      filter: brightness(
        0
      ); /* close.svg is drawn light for the dark menu header */
      cursor: pointer;
      -webkit-tap-highlight-color: transparent;
    }

    .close-btn {
      margin-left: var(--space-2);
    }

    .back-btn {
      background-image: url(/wp-content/themes/romeismore-v2/assets/arrow-left.svg);
    }

    .body {
      position: relative;
      flex: 1 1 auto;
      overflow: clip; /* unlike hidden, can't be scrolled by focus() or scrollIntoView() */
    }

    .filter-list {
      height: 100%;
      overflow-y: auto;
      overscroll-behavior: contain;
      list-style: none;
      padding: var(--space-8) var(--gutter-inline);
    }

    .opens-subview {
      width: 100%;
      display: grid;
      grid-template-columns: 1fr auto;
      column-gap: var(--space-4);
      padding: var(--space-3) var(--space-2);
      border: none;
      background: transparent;
      color: inherit;
      font: inherit;
      text-align: left;
      cursor: pointer;
      -webkit-tap-highlight-color: transparent;

      .label {
        font-size: var(--text-md);
        font-weight: var(--weight-bold);
      }

      &::after {
        content: '';
        grid-row: 1;
        grid-column: 2;
        align-self: center;
        width: var(--icon-md);
        height: var(--icon-md);
        background: url(/wp-content/themes/romeismore-v2/assets/arrow-left.svg)
          center / contain no-repeat;
        transform: scaleX(-1);
      }

      .value {
        grid-column: 1 / -1;
        font-size: var(--text-xs);
        color: var(--color-muted);

        &:empty {
          display: none;
        }
      }
    }

    .subview {
      position: absolute;
      inset: 0;
      z-index: 2;
      display: flex;
      flex-direction: column;
      background-color: var(--color-bg);
      transform: translateX(100%);
      transition: transform 0.3s ease;
    }

    &.subview-open .subview:not([hidden]) {
      transform: translateX(0);
    }

    .subview-header {
      flex: 0 0 auto;
      display: flex;
      align-items: center;
      gap: var(--space-4);
      padding: var(--space-8) var(--gutter-inline) var(--space-6);
      padding-left: calc(var(--gutter-inline) + var(--space-2));

      h3 {
        font-size: var(--text-md);
        font-weight: var(--weight-bold);
      }
    }

    .options {
      flex: 1 1 auto;
      overflow-y: auto;
      overscroll-behavior: contain;
      list-style: none;
      padding-bottom: var(--space-6);
    }

    .option {
      display: flex;
      align-items: center;
      gap: var(--space-4);
      padding: var(--space-3) var(--gutter-inline);
      padding-left: calc(var(--gutter-inline) + var(--space-2));
      font-size: var(--text-md);
      cursor: pointer;
      -webkit-tap-highlight-color: transparent;

      &:has(input[type='radio']:checked) {
        background-color: var(--color-surface);
      }

      input {
        appearance: none;
        flex: 0 0 auto;
        width: var(--icon-md);
        height: var(--icon-md);
        margin: 0;
        border: 1.5px solid var(--color-muted);
        border-radius: 3px;
        background-color: var(--color-bg);
        display: grid;
        place-content: center;
        cursor: inherit;

        &:checked {
          border-color: var(--color-fg);
        }

        &:focus-visible {
          outline: 2px solid var(--color-fg);
          outline-offset: 2px;
        }
      }

      input[type='checkbox']:checked {
        background-image: url(/wp-content/themes/romeismore-v2/assets/check.svg);
        background-size: 80%;
        background-position: center;
        background-repeat: no-repeat;
      }

      input[type='radio'] {
        border-radius: var(--radius-pill);

        &::before {
          content: '';
          width: 0.5rem;
          height: 0.5rem;
          border-radius: var(--radius-pill);
          background-color: var(--color-fg);
          transform: scale(0);
          transition: transform 0.15s ease;
        }

        &:checked::before {
          transform: scale(1);
        }
      }
    }

    .panel-footer {
      position: relative;
      flex: 0 0 auto;
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: var(--space-4);
      padding: var(--space-6) var(--gutter-inline);
      padding-left: calc(var(--gutter-inline) + var(--space-2));
      background-color: var(--color-surface);
    }

    .clear-btn {
      flex: 0 0 auto;
      white-space: nowrap;
      border: none;
      background: transparent;
      color: inherit;
      font: inherit;
      font-size: var(--text-md);
      text-decoration: underline;
      text-underline-offset: 3px;
      cursor: pointer;
      -webkit-tap-highlight-color: transparent;
    }

    .panel-footer .button {
      white-space: nowrap;
      cursor: pointer;

      &:disabled {
        opacity: 0.35;
        cursor: not-allowed;
      }
    }

    .count,
    .done-btn {
      transition: opacity 0.15s ease;
    }

    &.is-loading .count,
    &.is-loading .done-btn {
      opacity: 0.4;
    }
  }

  @media (prefers-reduced-motion: reduce) {
    .shop-filters .overlay,
    .shop-filters .panel,
    .shop-filters .subview,
    .shop-archive .results {
      transition: none;
    }
  }

  /* ----- Cart drawer ----- */

  body.cart-open {
    overflow: hidden;
  }

  .site-header .cart-btn {
    position: relative;

    .cart-count {
      position: absolute;
      top: -0.5rem;
      right: -0.625rem;
      min-width: 1rem;
      height: 1rem;
      padding: 0 var(--space-1);
      border-radius: var(--radius-pill);
      background-color: var(--color-fg);
      color: var(--color-on-fg);
      font-size: var(--text-2xs);
      font-weight: var(--weight-semibold);
      line-height: 1rem;
      text-align: center;
      pointer-events: none;

      &[hidden] {
        display: none;
      }
    }
  }

  /* Same drawer mechanics as .shop-filters: scrim, panel from the right, body scroll lock. */
  .site-cart {
    position: fixed;
    inset: 0;
    z-index: 1000;

    .overlay {
      position: absolute;
      inset: 0;
      background-color: var(--color-scrim);
      opacity: 0;
      transition: opacity 0.3s ease;
    }

    &.is-open .overlay {
      opacity: 1;
    }

    .panel {
      position: absolute;
      top: 0;
      right: 0;
      height: 100%;
      width: min(100%, 26rem);
      background-color: var(--color-bg);
      display: flex;
      flex-direction: column;
      overflow: hidden;
      transform: translateX(100%);
      transition: transform 0.3s ease;
    }

    &.is-open .panel {
      transform: translateX(0);
    }

    .content {
      flex: 1 1 auto;
      min-height: 0;
      display: flex;
      flex-direction: column;
    }

    .panel-header {
      flex: 0 0 auto;
      display: flex;
      align-items: center;
      gap: var(--space-3);
      min-height: var(--header-height);
      padding: var(--space-4) var(--gutter-inline);
      border-bottom: 1px solid
        color-mix(in srgb, var(--color-fg) 15%, transparent);
    }

    .title {
      font-size: var(--text-md);
      font-weight: var(--weight-bold);
      text-transform: uppercase;
    }

    .count {
      flex: 1 1 auto;
      font-size: var(--text-xs);
      text-align: right;
      transition: opacity 0.15s ease 0.15s;
    }

    .close-btn {
      flex: 0 0 auto;
      width: var(--icon-md);
      height: var(--icon-md);
      margin-left: var(--space-2);
      border: none;
      background: transparent
        url(/wp-content/themes/romeismore-v2/assets/close.svg) center / contain
        no-repeat;
      filter: brightness(
        0
      ); /* close.svg is drawn light for the dark menu header */
      cursor: pointer;
      -webkit-tap-highlight-color: transparent;
    }

    /* Error from the server (out of stock, quantity limit…), over the content. */
    .notice {
      position: absolute;
      top: var(--header-height);
      left: var(--gutter-inline);
      right: var(--gutter-inline);
      z-index: 3;
      margin-top: var(--space-3);
      padding: var(--space-3) var(--space-4);
      border-radius: 4px;
      background-color: var(--color-fg);
      color: var(--color-on-fg);
      font-size: var(--text-sm);
      box-shadow: 0 4px 16px rgb(0 0 0 / 0.15);
    }

    .shipping-progress {
      flex: 0 0 auto;
      padding: var(--space-5) var(--gutter-inline);
      background-color: var(--color-surface);
      text-align: center;

      .label {
        margin-bottom: var(--space-3);
        font-size: var(--text-xs);
      }

      .bar {
        height: 0.625rem;
        border: 1px solid color-mix(in srgb, var(--color-fg) 25%, transparent);
        border-radius: var(--radius-pill);
        background-color: var(--color-bg);
        overflow: hidden;

        span {
          display: block;
          height: 100%;
          border-radius: var(--radius-pill);
          background-color: var(--color-fg);
          transition: width 0.4s ease;
        }
      }
    }

    .body {
      flex: 1 1 auto;
      min-height: 0;
      overflow-y: auto;
      overscroll-behavior: contain;
      transition: opacity 0.15s ease 0.15s;
    }

    .items {
      list-style: none;
    }

    .item {
      display: grid;
      grid-template-columns: 4.625rem minmax(0, 1fr) auto;
      column-gap: var(--space-4);
      align-items: start;
      padding: var(--space-5) var(--gutter-inline);
      border-bottom: 1px solid
        color-mix(in srgb, var(--color-fg) 12%, transparent);
      transition: opacity 0.15s ease;

      &.is-removing {
        opacity: 0.4;
        pointer-events: none;
      }
    }

    .thumb {
      display: block;

      img {
        display: block;
        width: 100%;
        aspect-ratio: 1;
        object-fit: cover;
        border-radius: 2px;
      }
    }

    .name {
      font-size: var(--text-md);
      font-weight: var(--weight-bold);
      line-height: var(--leading-snug);

      a {
        text-decoration: none;
      }
    }

    .meta {
      margin-top: var(--space-1);
      font-size: var(--text-xs);
      color: var(--color-muted);
    }

    .price,
    .subtotal .amount {
      font-size: var(--text-sm);
      font-weight: var(--weight-bold);

      del {
        margin-right: var(--space-2);
        color: var(--color-muted);
        font-weight: normal;
      }

      ins {
        text-decoration: none;
      }
    }

    .price {
      margin-top: var(--space-3);
    }

    .actions {
      align-self: end;
      display: flex;
      flex-direction: column;
      align-items: center;
      gap: var(--space-2);
    }

    .quantity {
      display: inline-flex;
      align-items: center;
      height: 2.25rem;
      border: 1.5px solid color-mix(in srgb, var(--color-fg) 25%, transparent);
      border-radius: var(--radius-pill);
      background-color: var(--color-bg);
    }

    .quantity-btn {
      width: 2rem;
      height: 100%;
      border: none;
      background: transparent;
      color: inherit;
      font: inherit;
      font-size: var(--text-md);
      cursor: pointer;
      -webkit-tap-highlight-color: transparent;

      &:disabled {
        opacity: 0.3;
        cursor: default;
      }
    }

    .quantity-value {
      min-width: 1.5rem;
      text-align: center;
      font-size: var(--text-sm);
      font-weight: var(--weight-medium);
      font-variant-numeric: tabular-nums;
    }

    .remove-btn {
      border: none;
      background: transparent;
      color: var(--color-muted);
      font: inherit;
      font-size: var(--text-xs);
      text-decoration: underline;
      text-underline-offset: 3px;
      cursor: pointer;
      -webkit-tap-highlight-color: transparent;
    }

    .empty {
      display: grid;
      justify-items: center;
      gap: var(--space-6);
      padding: var(--space-16) var(--gutter-inline);
      text-align: center;
    }

    .panel-footer {
      position: relative;
      flex: 0 0 auto;
      padding: var(--space-8) var(--gutter-inline) var(--space-5);
      background-color: var(--color-bg);
    }

    .subtotal {
      display: flex;
      justify-content: space-between;
      align-items: baseline;
      gap: var(--space-4);
      margin-bottom: var(--space-6);
      transition: opacity 0.15s ease 0.15s;

      .label {
        font-size: var(--text-lg);
        font-weight: var(--weight-bold);
        text-transform: uppercase;
      }

      .amount {
        font-size: var(--text-md);
      }
    }

    .checkout-btn {
      display: block;
      width: 100%;
      padding: var(--space-5) var(--space-6);
      font-size: var(--text-lg);
      text-align: center;
    }

    .note {
      margin-top: var(--space-4);
      font-size: var(--text-2xs);
      text-align: center;
    }

    /* The delay keeps a fast round trip from flashing. */
    &.is-loading :is(.body, .count, .subtotal) {
      opacity: 0.5;
    }
  }

  .product-form .add-to-cart-btn {
    transition: opacity 0.15s ease;

    &:disabled {
      opacity: 0.5;
      cursor: not-allowed;
    }

    &[aria-busy='true'] {
      opacity: 0.7;
      cursor: progress;
    }
  }

  @media (prefers-reduced-motion: reduce) {
    .site-cart .overlay,
    .site-cart .panel,
    .site-cart .shipping-progress .bar span {
      transition: none;
    }
  }

  /* ----- Product page -----
   *
   * Phones: rail gallery, info, then the add-to-cart form as a bar fixed to
   * the bottom of the viewport. From tablet up the bar is gone: .product-hero
   * is two columns, gallery left and everything else (form included) right.
   */
  body.single-product {
    --product-max: 75rem;
    --product-gutter: var(--gutter-inline);

    /* Room for the fixed add-to-cart bar; js/product.js sets the measured height. */
    @media (max-width: 767.98px) {
      padding-bottom: var(--product-form-height, 10rem);
    }

    @media (min-width: 768px) {
      --product-gutter: var(--space-6);
    }

    @media (min-width: 981px) {
      --product-gutter: var(--space-10);
    }
  }

  .product-hero {
    @media (min-width: 768px) {
      display: grid;
      grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
      gap: var(--space-8);
      align-items: start;
      max-width: var(--product-max);
      margin-inline: auto;
      margin-bottom: var(--space-10);
      padding-inline: var(--product-gutter);
    }

    @media (min-width: 981px) {
      grid-template-columns: minmax(0, 7fr) minmax(0, 5fr);
      gap: var(--space-16);
    }
  }

  /* The right column: the page paddings of its parts belong to the phone layout. */
  .product-info {
    @media (min-width: 768px) {
      > * {
        padding-inline: 0;
      }
    }
  }

  /* ----- Product header ----- */

  .product-header {
    display: flex;
    gap: var(--space-4);
    padding: var(--space-5) var(--gutter-inline);

    @media (min-width: 768px) {
      max-width: var(--product-max);
      margin-inline: auto;
      padding: var(--space-6) var(--product-gutter);
    }

    .category-link {
      text-decoration: none;
      background-image: url(/wp-content/themes/romeismore-v2/assets/arrow-left.svg);
      background-size: var(--icon-lg) auto;
      background-position: left center;
      padding-left: calc(var(--icon-lg) + var(--space-4));
      font-weight: var(--weight-semibold);
      text-transform: capitalize;
    }
  }

  /* ----- Product gallery ----- */

  /*
   *   <div class="product-gallery">
   *     <div class="viewport"><div class="rail"><img>…</div></div>
   *     <button class="slider-btn slider-btn--prev"> <button class="slider-btn slider-btn--next">
   *     <div class="thumbs"><button class="thumb" [aria-current]><img></button>…</div>
   *   </div>
   *
   * Phones: the rail peeks the next image past the edge and scrolls by
   * touch (or mouse drag, js/product-gallery.js). Tablet/desktop: one image
   * per view with mandatory snapping, moved by the arrows and thumbnails.
   */
  .product-gallery {
    margin-bottom: var(--stack);

    .viewport {
      overflow-x: auto;
      scrollbar-width: none;
      user-select: none;

      @media (pointer: coarse) {
        scroll-snap-type: x proximity;
      }

      &::-webkit-scrollbar {
        display: none;
      }
    }

    .rail {
      display: flex;
      gap: var(--space-4);
      width: fit-content;
    }

    img {
      width: 80vw;
      scroll-snap-align: center;

      &:first-child {
        padding-left: var(--gutter-inline);
      }
      &:last-child {
        padding-right: var(--gutter-inline);
      }
    }

    .thumbs {
      display: none;
    }

    @media (min-width: 768px) {
      position: relative;
      margin-bottom: 0;

      .viewport {
        scroll-snap-type: x mandatory;
      }

      .rail {
        gap: 0;
        width: 100%;
      }

      img {
        flex: 0 0 100%;
        width: 100%;
        scroll-snap-align: start;

        &:first-child,
        &:last-child {
          padding: 0;
        }
      }

      /* Inside the image, as the column has no room for them outside. */
      .slider-btn {
        display: grid;
        top: 50%;

        &.slider-btn--prev {
          left: var(--space-4);
        }

        &.slider-btn--next {
          right: var(--space-4);
        }
      }

      .thumbs {
        display: flex;
        gap: var(--space-3);
        margin-top: var(--space-4);
        overflow-x: auto;
        scrollbar-width: none;
        /* Space for the focus ring, which overflow would otherwise clip. */
        padding: 3px;
        margin-inline: -3px;

        &::-webkit-scrollbar {
          display: none;
        }
      }

      .thumb {
        flex: 0 0 auto;
        width: 4.5rem;
        padding: 0;
        border: 1.5px solid transparent;
        background: none;
        opacity: 0.6;
        cursor: pointer;
        transition:
          opacity 0.15s ease,
          border-color 0.15s ease;

        img {
          display: block;
          width: 100%;
          aspect-ratio: 6 / 7;
          object-fit: cover;
        }

        &:hover,
        &[aria-current] {
          opacity: 1;
        }

        &[aria-current] {
          border-color: var(--color-fg);
        }

        &:focus-visible {
          outline: 2px solid var(--color-fg);
          outline-offset: 2px;
        }
      }
    }
  }

  /* ----- Product main info ----- */

  .product-main-info {
    padding: 0 var(--gutter-inline);
    margin-bottom: var(--stack);

    .line-1 {
      display: flex;
      justify-content: space-between;
      align-items: center;
      gap: var(--space-8);
      margin-bottom: var(--stack-tight);
    }

    h1 {
      font-size: var(--text-3xl);
      font-weight: var(--weight-bold);
    }

    .favorites-btn {
      width: var(--icon-md);
      height: var(--icon-md);
      border: none;
      background-color: transparent;
      background-image: url(/wp-content/themes/romeismore-v2/assets/heart.svg);
      background-size: contain;
      background-position: center;
    }

    .price {
      font-size: var(--text-lg);
    }

    @media (min-width: 768px) {
      margin-bottom: var(--stack-loose);
    }

    @media (min-width: 981px) {
      h1 {
        font-size: var(--text-4xl);
      }

      .price {
        font-size: var(--text-xl);
      }
    }
  }

  /* ----- Product additional info ----- */
  .product-additional-info {
  }

  /* ----- Product form ----- */

  .product-form {
    --control-height: 3rem;

    /* Phones: a bar fixed to the bottom of the viewport, wave on its top edge. */
    @media (max-width: 767.98px) {
      z-index: 100;
      position: fixed;
      inset: auto 0 0;
      background-color: var(--color-surface);
      padding: var(--space-5) var(--gutter-inline);
      padding-bottom: max(var(--space-5), env(safe-area-inset-bottom));
    }

    /* Phones: product name and price on one line above the controls. */
    .bar-summary {
      display: flex;
      align-items: baseline;
      justify-content: space-between;
      gap: var(--space-4);
      margin-bottom: var(--space-3);

      .name {
        flex: 1 1 auto;
        min-width: 0;
        margin: 0;
        font-size: var(--text-md);
        font-weight: var(--weight-bold);
        line-height: var(--leading-tight);
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
      }

      .price {
        flex: 0 0 auto;
        font-size: var(--text-md);
        font-weight: var(--weight-semibold);
        white-space: nowrap;

        del {
          margin-right: var(--space-1);
          color: var(--color-muted);
          font-weight: normal;
        }

        ins {
          text-decoration: none;
        }
      }
    }

    /* Tablet/desktop: in the right column, under the price. */
    @media (min-width: 768px) {
      margin-bottom: var(--space-8);

      .wave,
      .bar-summary {
        display: none;
      }

      form {
        gap: var(--space-5);
      }
    }

    form {
      display: grid;
      gap: var(--space-4);
    }

    /* One row per attribute: "Taglia  [S/M] [L/XL]", chips scroll if they don't fit. */
    .variation {
      display: flex;
      align-items: center;
      gap: var(--space-4);
      min-width: 0;
      border: none;

      /* Floated, a legend is laid out like any other box (here: a flex item). */
      legend {
        float: left;
        flex: 0 0 auto;
        font-size: var(--text-sm);
        font-weight: var(--weight-semibold);
      }
    }

    .options {
      display: flex;
      gap: var(--space-2);
      flex: 1 1 auto;
      min-width: 0;
      overflow-x: auto;
      scrollbar-width: none;
      /* Space for the focus ring, which overflow would otherwise clip. */
      padding: 3px;
      margin: -3px;

      &::-webkit-scrollbar {
        display: none;
      }
    }

    .chip {
      position: relative;
      flex: 0 0 auto;
      display: grid;
      place-items: center;
      min-width: 2.75rem;
      height: 2.25rem;
      padding: 0 var(--space-4);
      border: 1.5px solid color-mix(in srgb, var(--color-fg) 25%, transparent);
      border-radius: var(--radius-pill);
      background-color: var(--color-bg);
      font-size: var(--text-sm);
      font-weight: var(--weight-medium);
      white-space: nowrap;
      cursor: pointer;
      -webkit-tap-highlight-color: transparent;
      transition:
        background-color 0.15s ease,
        border-color 0.15s ease;

      input {
        position: absolute;
        opacity: 0;
        pointer-events: none;
      }

      &.is-unavailable {
        border-style: dashed;
        color: var(--color-muted);
        text-decoration: line-through;
      }

      /* After .is-unavailable: a selected chip stays solid even when it's sold out. */
      &:has(:checked) {
        border-color: var(--color-fg);
        border-style: solid;
        background-color: var(--color-fg);
        color: var(--color-on-fg);
      }

      &:has(:focus-visible) {
        outline: 2px solid var(--color-fg);
        outline-offset: 2px;
      }
    }

    .line {
      display: flex;
      gap: var(--space-3);
    }

    .quantity {
      flex: 0 0 auto;
      display: flex;
      align-items: stretch;
      height: var(--control-height);
      border: 1.5px solid color-mix(in srgb, var(--color-fg) 25%, transparent);
      border-radius: var(--radius-pill);
      background-color: var(--color-bg);
    }

    .quantity-btn {
      width: 2.75rem;
      border: none;
      background: transparent;
      color: inherit;
      font: inherit;
      font-size: var(--text-lg);
      cursor: pointer;
      -webkit-tap-highlight-color: transparent;

      &:hover {
        background-color: rgba(0, 0, 0, 0.05);
      }
    }

    .quantity-btn--minus {
      border-radius: var(--radius-pill) 0 0 var(--radius-pill);
    }

    .quantity-btn--plus {
      border-radius: 0 var(--radius-pill) var(--radius-pill) 0;
    }

    /* Fixed width: Chrome otherwise sizes a number input from its max attribute (20ch without one). */
    .quantity-input {
      appearance: textfield;
      width: 2.25rem;
      padding: 0;
      border: none;
      border-radius: 0;
      background: transparent;
      font-size: var(--text-md); /* 16px: iOS doesn't zoom the page on focus */
      font-weight: var(--weight-medium);
      font-variant-numeric: tabular-nums;
      text-align: center;

      &::-webkit-inner-spin-button,
      &::-webkit-outer-spin-button {
        appearance: none;
      }
    }

    .add-to-cart-btn {
      flex: 1 1 auto;
      min-width: 0;
      display: grid;
      place-items: center;
      height: var(--control-height);
      padding-block: 0;
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
      cursor: pointer;
    }
  }

  /* ----- Product description ----- */

  .product-description {
    padding: 0 var(--gutter-inline);
    margin-bottom: var(--space-6);

    @media (min-width: 981px) {
      line-height: var(--leading-base);
    }
  }

  /* ----- Product details accordion -----
   *
   *   <div class="product-details">
   *     <details class="item" name="product-details" [open]>
   *       <summary>Caratteristiche</summary>
   *       <div class="content">…</div>
   *     </details>
   *   </div>
   *
   * Native <details>: the shared name makes them exclusive, the +/− disc is
   * the summary's ::after. Rules between items are the item's bottom border.
   */

  .product-details {
    padding: 0 var(--gutter-inline);
    margin-bottom: var(--space-4);

    .item {
      border-bottom: 1px solid var(--color-fg);
    }

    summary {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: var(--space-4);
      padding: var(--space-5) 0;
      list-style: none;
      font-size: var(--text-lg);
      font-weight: var(--weight-semibold);
      text-transform: uppercase;
      cursor: pointer;
      -webkit-tap-highlight-color: transparent;

      &::-webkit-details-marker {
        display: none;
      }

      &::after {
        content: '+';
        flex: 0 0 auto;
        display: grid;
        place-items: center;
        width: var(--icon-lg);
        height: var(--icon-lg);
        border: 1px solid currentColor;
        border-radius: 50%;
        font-size: var(--text-md);
        font-weight: 400;
        line-height: 1;
      }
    }

    .item[open] > summary::after {
      content: '−';
    }

    .content {
      padding-bottom: var(--space-6);

      p {
        margin: 0 0 var(--space-4);

        &:last-child {
          margin-bottom: 0;
        }
      }

      .more {
        color: var(--color-muted);
      }
    }

    .features {
      display: grid;
      gap: var(--space-2);
      margin: 0;
    }

    .feature {
      display: flex;
      gap: var(--space-2);

      dt {
        flex: 0 0 auto;
        font-weight: var(--weight-semibold);

        &::after {
          content: ':';
        }
      }

      dd {
        margin: 0;
      }
    }
  }

  /* ----- Product sliders: related ("Potrebbe piacerti anche") and recently viewed ----- */

  .product-slider {
    padding: var(--section-block) 0;

    .swiper {
      position: relative;
      width: 100%;
      min-width: 0;
    }

    .quick-add {
      margin-top: var(--space-4);
      padding-block: var(--space-3);
      cursor: pointer;

      &:disabled {
        opacity: 0.4;
        cursor: default;
      }
    }
  }

  /* Cream band with the scalloped top edge; the wave sits in the gap above. */
  .product-recently-viewed {
    position: relative;
    margin-top: 32px;
    background-color: var(--color-surface);

    /* Clips the overflowing carousel like the others, but not the wave rising
     * above the section. overflow-x: clip (not clip-path, which only paints)
     * also drops the slides from the page's scrollable width. */
    @media (min-width: 981px) {
      overflow-x: clip;
      overflow-y: visible;
    }

    /* The tile is a cream block with a wavy top: 32px of it rise above the section, the rest overlaps it. */
    &::before {
      content: '';
      position: absolute;
      bottom: calc(100% - 20px);
      left: 0;
      right: 0;
      height: 52px;
      background: url(/wp-content/themes/romeismore-v2/assets/static-wave.svg)
        left top / 56px 52px repeat-x;
    }
  }

  /* ----- Account pages (login, register, password recovery) ----- */

  .account-page {
    padding: var(--space-16) max(var(--gutter-inline), var(--space-6))
      var(--space-20);

    > .container {
      max-width: 26rem;
      margin-inline: auto;
    }

    .title {
      margin-bottom: var(--space-8);
      font-size: var(--text-3xl);
      font-weight: var(--weight-bold);
      line-height: var(--leading-tight);
      text-align: center;
      text-wrap: balance;
    }

    .switch,
    .intro {
      margin-bottom: var(--space-10);
      text-align: center;
      text-wrap: pretty;
    }

    .switch a {
      font-weight: var(--weight-bold);
      text-underline-offset: 3px;
    }

    .form-notices {
      margin-bottom: var(--space-6);
    }

    .form {
      display: grid;
      gap: var(--field-gap);
    }

    .forgot,
    .back {
      justify-self: center;
      margin-block: var(--space-1);
      font-weight: var(--weight-bold);
      text-underline-offset: 3px;
      -webkit-tap-highlight-color: transparent;
    }

    .submit {
      margin-top: var(--space-2);
      padding-block: var(--space-5);
      text-transform: uppercase;
    }

    /* WooCommerce's registration privacy text (Settings › Privacy). */
    .privacy {
      font-size: var(--text-xs);
      line-height: var(--leading-base);
      color: var(--color-muted);
      text-align: center;

      a {
        font-weight: var(--weight-semibold);
      }
    }

    @media (min-width: 981px) {
      padding-block: var(--space-20);
    }
  }
}

/* ============================================================
 * CUSTOMER AREA
 * ============================================================ */

@layer components {
  /* ----- Dialog -----
   *
   *   <dialog class="dialog" data-dialog="name" data-close-url="…">
   *     <form class="form">
   *       <header class="head"><h2 class="title">…</h2><button class="close"></button></header>
   *       <div class="body">…fields…</div>
   *       <footer class="actions"><button class="button is-outline cancel">…<button class="button">…</footer>
   *     </form>
   *   </dialog>
   *
   * A bottom sheet on small screens, a centred card from 640px up. The
   * body scrolls, head and actions stay. Opened by js/account.js.
   */

  .dialog {
    position: fixed;
    inset: auto 0 0;
    width: 100%;
    max-width: none;
    max-height: min(92dvh, 100%);
    margin: 0;
    padding: 0;
    border: none;
    border-radius: var(--card-radius) var(--card-radius) 0 0;
    background-color: var(--color-bg);
    color: var(--color-fg);
    overscroll-behavior: contain;

    &::backdrop {
      background-color: var(--color-scrim);
    }

    &[open] {
      display: flex;
      flex-direction: column;
      animation: dialog-up 0.25s ease;
    }

    > .form {
      display: flex;
      flex-direction: column;
      min-height: 0;
    }

    .head {
      flex: 0 0 auto;
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: var(--space-4);
      padding: var(--space-6) var(--space-6) var(--space-5);
    }

    /* Focus lands on the title when the dialog opens (js/account.js). */
    .title {
      font-size: var(--text-2xl);
      font-weight: var(--weight-bold);
      line-height: var(--leading-tight);
      outline: none;
    }

    .close {
      flex: 0 0 auto;
      width: var(--icon-lg);
      height: var(--icon-lg);
      border: none;
      background: transparent url(/wp-content/themes/romeismore-v2/assets/x.svg)
        center / contain no-repeat;
      cursor: pointer;
      -webkit-tap-highlight-color: transparent;
    }

    .body {
      flex: 1 1 auto;
      min-height: 0;
      display: grid;
      align-content: start;
      gap: var(--field-gap);
      padding: var(--space-1) var(--space-6);
      overflow-y: auto;
    }

    .actions {
      flex: 0 0 auto;
      display: grid;
      grid-template-columns: 1fr 1fr;
      gap: var(--space-4);
      padding: var(--space-6);

      .button {
        text-align: center;
        padding-block: var(--space-4);
        cursor: pointer;
      }

      .is-outline {
        border-width: 1px;
        background-color: var(--color-surface);
      }
    }

    /* "Elimina indirizzo": a text button with a bin, submitting its own form. */
    .delete {
      justify-self: start;
      display: inline-flex;
      align-items: center;
      gap: var(--space-3);
      padding: 0;
      border: none;
      background: none;
      font: inherit;
      font-size: var(--text-sm);
      font-weight: var(--weight-medium);
      text-decoration: underline;
      text-underline-offset: 3px;
      cursor: pointer;

      &::before {
        content: '';
        width: var(--icon-lg);
        height: var(--icon-lg);
        background: url(/wp-content/themes/romeismore-v2/assets/trash.svg)
          center / contain no-repeat;
      }
    }

    @media (min-width: 640px) {
      inset: 0;
      width: min(100% - 2rem, 30rem);
      max-height: min(90dvh, 100% - 2rem);
      margin: auto;
      border-radius: var(--card-radius);

      &[open] {
        animation-name: dialog-in;
      }
    }
  }

  @keyframes dialog-up {
    from {
      translate: 0 100%;
    }
  }

  @keyframes dialog-in {
    from {
      opacity: 0;
      scale: 0.96;
    }
  }

  body:has(.dialog[open]) {
    overflow: hidden;
  }

  @media (prefers-reduced-motion: reduce) {
    .dialog[open] {
      animation: none;
    }
  }

  /* ----- Account page: hero screens (welcome, no orders yet) ----- */

  .account-page {
    .emoji {
      display: block;
      margin-bottom: var(--space-4);
      font-size: var(--text-4xl);
      line-height: var(--leading-none);
      text-align: center;
    }

    &.account-page--welcome .title,
    &.account-page--empty .title {
      margin-bottom: var(--space-6);
      font-size: 2.75rem;
    }

    .actions {
      display: grid;
      gap: var(--space-4);

      .is-outline {
        border-width: 1px;
        background-color: var(--color-surface);
      }
    }
  }

  /* ----- Account area: the signed-in sections ----- */

  .account-area {
    padding: var(--space-8) max(var(--gutter-inline), var(--space-4))
      var(--space-20);

    > .container {
      max-width: 40rem;
      margin-inline: auto;
    }

    &.is-wide > .container {
      max-width: 64rem;
    }

    /* "Bella Stefania!" */
    > .container > .title {
      margin-bottom: var(--space-8);
      font-size: var(--text-3xl);
      font-weight: var(--weight-bold);
      line-height: var(--leading-tight);
    }

    /* "← Section" */
    .page-heading {
      display: flex;
      align-items: center;
      gap: var(--space-3);
      margin-bottom: var(--space-8);

      .back {
        flex: 0 0 auto;
        width: var(--icon-lg);
        height: var(--icon-lg);
        background: url(/wp-content/themes/romeismore-v2/assets/arrow-left.svg)
          center / contain no-repeat;
        -webkit-tap-highlight-color: transparent;
      }

      .title {
        font-size: 1.75rem;
        font-weight: var(--weight-bold);
        line-height: var(--leading-tight);
      }
    }

    .form-notices {
      margin-bottom: var(--space-6);
    }

    .empty {
      margin-bottom: var(--space-6);
      color: var(--color-muted);
      text-align: center;
    }

    @media (min-width: 981px) {
      padding-block: var(--space-12) var(--space-20);
    }
  }

  /* The menu on the account home. */
  .account-nav {
    .list {
      display: grid;
      gap: var(--space-4);
      margin: 0;
      padding: 0;
      list-style: none;
    }

    .item {
      display: flex;
      align-items: center;
      gap: var(--space-4);
      min-height: 3.75rem;
      padding: var(--space-4) var(--space-6);
      border: 1px solid var(--color-fg);
      border-radius: var(--radius-pill);
      font-weight: var(--weight-semibold);
      text-decoration: none;
      transition: background-color 0.15s ease;
      -webkit-tap-highlight-color: transparent;

      &::before {
        content: '';
        flex: 0 0 auto;
        width: var(--icon-lg);
        height: var(--icon-lg);
        background: var(--icon) center / contain no-repeat;
      }

      @media (hover: hover) and (pointer: fine) {
        &:hover {
          background-color: var(--color-surface);
        }
      }
    }

    .item--profile {
      --icon: url(/wp-content/themes/romeismore-v2/assets/user.svg);
    }
    .item--orders {
      --icon: url(/wp-content/themes/romeismore-v2/assets/cart.svg);
    }
    .item--addresses {
      --icon: url(/wp-content/themes/romeismore-v2/assets/map-pin.svg);
    }
    .item--password {
      --icon: url(/wp-content/themes/romeismore-v2/assets/lock.svg);
    }
    .item--logout {
      --icon: url(/wp-content/themes/romeismore-v2/assets/log-out.svg);
    }

    @media (min-width: 640px) {
      .list {
        grid-template-columns: 1fr 1fr;
      }
    }
  }

  /* A bordered card: profile data, an address, a block of the order page. */
  .account-card {
    padding: var(--space-5) var(--space-5) var(--space-6);
    border: 1px solid var(--card-border-color);
    border-radius: var(--card-radius);
    background-color: var(--color-bg);

    .head {
      display: flex;
      align-items: baseline;
      justify-content: space-between;
      gap: var(--space-4);
      margin-bottom: var(--space-4);
    }

    .heading {
      font-size: var(--text-md);
      font-weight: var(--weight-bold);
      letter-spacing: 0.02em;
      text-transform: uppercase;
    }

    .edit {
      font-size: var(--text-sm);
      font-weight: var(--weight-semibold);
      text-underline-offset: 3px;
      -webkit-tap-highlight-color: transparent;
    }

    .rows {
      display: grid;
      gap: var(--space-4);
      margin: 0;
    }

    .row dt {
      margin-bottom: var(--space-1);
      font-size: var(--text-sm);
      color: var(--color-muted);
    }

    .row dd {
      margin: 0;
      font-size: var(--text-sm);
    }

    .default {
      margin-bottom: var(--space-4);
      font-size: var(--text-sm);
      color: var(--color-muted);
    }

    .address,
    .method,
    .note {
      font-size: var(--text-sm);
      font-style: normal;
      line-height: 1.6;
    }

    .method {
      margin-bottom: var(--space-2);
      font-weight: var(--weight-semibold);
    }

    .note {
      margin-top: var(--space-3);
    }

    .muted {
      color: var(--color-muted);
    }
  }

  /* Status + date with an icon, on order cards and the order page. */
  .order-status {
    display: grid;
    grid-template-columns: auto 1fr;
    column-gap: var(--space-4);
    align-items: center;

    &::before {
      content: '';
      grid-row: 1 / 3;
      width: 1.75rem;
      height: 1.75rem;
      background: var(--icon) center / contain no-repeat;
    }

    .label {
      grid-column: 2;
      font-weight: var(--weight-semibold);
    }

    .date {
      grid-column: 2;
      font-size: var(--text-sm);
    }

    &.order-status--truck {
      --icon: url(/wp-content/themes/romeismore-v2/assets/truck.svg);
    }
    &.order-status--check-circle {
      --icon: url(/wp-content/themes/romeismore-v2/assets/check-circle.svg);
    }
    &.order-status--clock {
      --icon: url(/wp-content/themes/romeismore-v2/assets/clock.svg);
    }
    &.order-status--x-circle {
      --icon: url(/wp-content/themes/romeismore-v2/assets/x-circle.svg);
    }
    &.order-status--cart {
      --icon: url(/wp-content/themes/romeismore-v2/assets/cart.svg);
    }
  }

  /* ----- Orders ----- */

  .orders {
    display: grid;
    gap: var(--space-5);
    margin: 0;
    padding: 0;
    list-style: none;

    @media (min-width: 640px) {
      grid-template-columns: repeat(2, 1fr);
    }

    @media (min-width: 981px) {
      grid-template-columns: repeat(3, 1fr);
      gap: var(--space-6);
    }
  }

  .order-card {
    display: block;
    height: 100%;
    padding: var(--space-6);
    border: 1px solid var(--card-border-color);
    border-radius: var(--card-radius);
    text-decoration: none;
    transition: border-color 0.15s ease;
    -webkit-tap-highlight-color: transparent;

    @media (hover: hover) and (pointer: fine) {
      &:hover {
        border-color: var(--color-fg);
      }
    }

    .order-status {
      margin-bottom: var(--space-6);
    }

    .thumbs {
      display: grid;
      grid-template-columns: 1fr 1fr;
      gap: var(--space-1);
      margin-bottom: var(--space-6);
    }

    .thumb img {
      display: block;
      width: 100%;
      aspect-ratio: 1;
      object-fit: cover;
      border-radius: 4px;
    }

    /* One or three items: the first tile takes the whole row; alone it stays square (a 3:2 crop zoomed into the photo). */
    .thumbs.has-1 .thumb,
    .thumbs.has-3 .thumb:first-child {
      grid-column: span 2;
    }

    .thumbs.has-3 .thumb:first-child img {
      aspect-ratio: 3 / 2;
    }

    .meta {
      display: grid;
      gap: var(--space-2);
      font-size: var(--text-sm);
    }

    .count {
      color: var(--color-muted);
    }

    .number {
      font-weight: var(--weight-semibold);
      text-transform: uppercase;
    }

    .total {
      font-size: var(--text-lg);
      font-weight: var(--weight-bold);

      /* Refunded order: WooCommerce prints <del> full / <ins> new total. */
      del {
        color: var(--color-muted);
        margin-right: var(--space-1);
      }

      ins {
        text-decoration: none;
      }
    }
  }

  .pagination {
    display: flex;
    justify-content: center;
    gap: var(--space-3);
    margin-top: var(--space-8);

    .button {
      padding-block: var(--space-3);
      border-width: 1px;
      font-size: var(--text-sm);
    }
  }

  /* ----- One order ----- */

  .order-detail {
    display: grid;
    gap: var(--space-5);

    .tracking {
      margin-top: var(--space-4);
      padding-top: var(--space-4);
      border-top: 1px solid var(--card-border-color);
      font-size: var(--text-sm);
      line-height: 1.6;

      a {
        display: block;
        font-weight: var(--weight-semibold);
        text-underline-offset: 3px;
      }
    }

    .items {
      display: grid;
      gap: var(--space-4);
      margin: 0 0 var(--space-5);
      padding: 0;
      list-style: none;
    }

    .item {
      display: grid;
      grid-template-columns: 4.5rem 1fr auto;
      gap: var(--space-4);
      align-items: center;

      .thumb img {
        display: block;
        width: 100%;
        aspect-ratio: 1;
        object-fit: cover;
        border-radius: 6px;
      }

      .info {
        display: grid;
        gap: var(--space-1);
        min-width: 0;
        font-size: var(--text-sm);
      }

      .name {
        font-weight: var(--weight-semibold);
        text-decoration: none;
      }

      a.name:hover {
        text-decoration: underline;
      }

      .variation,
      .qty {
        color: var(--color-muted);
      }

      .price {
        font-size: var(--text-sm);
        font-weight: var(--weight-semibold);
        white-space: nowrap;
      }
    }

    .totals {
      display: grid;
      gap: var(--space-2);
      margin: 0;
      padding-top: var(--space-4);
      border-top: 1px solid var(--card-border-color);
      font-size: var(--text-sm);

      .row {
        display: flex;
        justify-content: space-between;
        gap: var(--space-4);
      }

      dd {
        margin: 0;
        text-align: right;
      }

      .row--order_total {
        margin-top: var(--space-2);
        padding-top: var(--space-3);
        border-top: 1px solid var(--card-border-color);
        font-size: var(--text-md);
        font-weight: var(--weight-bold);

        small {
          display: block;
          font-size: var(--text-xs);
          font-weight: normal;
          color: var(--color-muted);
        }
      }

      /* Refunded order: <del> full total, <ins> what was paid, as on the product cards. */
      del {
        color: var(--color-muted);
        font-weight: normal;
        margin-right: var(--space-1);
      }

      ins {
        text-decoration: none;
      }

      /* "tramite Spedizione Standard" on its own line, as the tax note of the total. */
      .shipped_via {
        display: block;
        font-size: var(--text-xs);
        color: var(--color-muted);
      }
    }

    .cards {
      display: grid;
      gap: var(--space-5);

      @media (min-width: 640px) {
        grid-template-columns: 1fr 1fr;
      }
    }

    .order-actions {
      display: flex;
      flex-wrap: wrap;
      gap: var(--space-3);

      .button {
        padding-block: var(--space-3);
        font-size: var(--text-sm);
      }

      .is-outline {
        border-width: 1px;
        background-color: var(--color-surface);
      }
    }
  }

  /* ----- Addresses ----- */

  .addresses {
    display: grid;
    gap: var(--space-5);
    margin-bottom: var(--space-8);

    @media (min-width: 640px) {
      grid-template-columns: 1fr 1fr;
    }
  }

  .add-address {
    display: block;
    width: fit-content;
    margin-inline: auto;
    font-weight: var(--weight-semibold);
    text-underline-offset: 3px;
    -webkit-tap-highlight-color: transparent;

    &::before {
      content: '+ ';
    }
  }
}

/* ============================================================
 * STORES PAGE
 * ============================================================ */

@layer components {
  /* ----- Stores page (/stores/) ----- */

  .stores-page {
    --stores-max: 64rem;
    --stores-gutter: var(--gutter-inline);

    /* Section titles ("Flagship Store", "Rivenditori ufficiali"). */
    .stores-flagship .title,
    .stores-resellers .title {
      margin-bottom: var(--space-6);
      font-size: var(--text-2xl);
      font-weight: var(--weight-bold);
      line-height: var(--leading-tight);
    }

    .stores-intro .text,
    .stores-flagship .subtitle,
    .stores-flagship .details,
    .stores-resellers .subtitle {
      font-size: var(--text-md);
      line-height: var(--leading-base);
      text-wrap: pretty;
    }

    @media (min-width: 981px) {
      --stores-gutter: var(--space-10);

      .stores-intro .text,
      .stores-flagship .subtitle,
      .stores-flagship .details,
      .stores-resellers .subtitle {
        font-size: var(--text-lg);
      }
    }
  }

  /* "Negozi" + intro */
  .stores-intro {
    padding: var(--space-12) var(--stores-gutter) var(--space-10);
    text-align: center;

    > .container {
      max-width: 36rem;
      margin-inline: auto;
    }

    .title {
      margin-bottom: var(--space-6);
      font-size: var(--text-2xl);
      font-weight: var(--weight-bold);
      line-height: var(--leading-tight);
      text-transform: uppercase;
    }

    @media (min-width: 981px) {
      padding-block: var(--space-16) var(--space-12);

      .title {
        font-size: var(--text-3xl);
      }
    }
  }

  /* ----- Flagship store ----- */

  .stores-flagship {
    padding: var(--space-10) var(--stores-gutter);

    > .container {
      display: grid;
      grid-template-areas:
        'text'
        'image'
        'details';
      gap: var(--space-8);
      max-width: var(--stores-max);
      margin-inline: auto;
    }

    .text {
      grid-area: text;
    }

    .image {
      grid-area: image;
      /* Edge to edge on phones, like the design. */
      width: calc(100% + 2 * var(--stores-gutter));
      max-width: none;
      margin-inline: calc(-1 * var(--stores-gutter));
      aspect-ratio: 414 / 460;
      object-fit: cover;
    }

    .details {
      grid-area: details;
    }

    .address {
      margin-bottom: var(--space-6);

      a {
        text-underline-offset: 3px;
      }
    }

    .hours {
      margin-bottom: var(--space-8);

      .row {
        display: grid;
        grid-template-columns: max-content 1fr;
        gap: 0 var(--space-4);
      }

      dt {
        font-weight: var(--weight-bold);
      }
    }

    .note {
      font-weight: var(--weight-bold);
      font-style: italic;
      text-wrap: pretty;

      a {
        text-underline-offset: 3px;
      }
    }

    @media (min-width: 768px) {
      padding-block: var(--space-12) var(--space-16);

      > .container {
        grid-template-areas:
          'image text'
          'image details';
        grid-template-columns: minmax(0, 5fr) minmax(0, 6fr);
        grid-template-rows: auto 1fr;
        column-gap: var(--space-16);
        align-items: start;
      }

      .image {
        width: 100%;
        height: 100%;
        margin-inline: 0;
        aspect-ratio: auto;
        border-radius: var(--card-radius);
      }

      .hours .row {
        grid-template-columns: 12rem 1fr;
      }
    }
  }

  /* ----- Resellers: cream band with the scalloped top edge, and the map ----- */

  .stores-resellers {
    position: relative;
    margin-top: 32px;
    padding: var(--space-10) 0 var(--space-12);
    background-color: var(--color-surface);

    /* Same device as .product-recently-viewed: 32px of the tile rise above the section. */
    &::before {
      content: '';
      position: absolute;
      bottom: calc(100% - 20px);
      left: 0;
      right: 0;
      height: 52px;
      background: url(/wp-content/themes/romeismore-v2/assets/static-wave.svg)
        left top / 56px 52px repeat-x;
    }

    > .container {
      max-width: var(--stores-max);
      margin-inline: auto;
      padding-inline: var(--stores-gutter);
    }

    .subtitle {
      margin-bottom: var(--space-8);
    }

    .nearest-btn {
      display: block;
      margin: var(--space-10) auto 0;
      padding-block: var(--space-5);
      cursor: pointer;

      &:disabled {
        opacity: 0.6;
        cursor: wait;
      }
    }

    .nearest-notice {
      margin-top: var(--space-4);
      min-height: 1.5em;
      font-size: var(--text-sm);
      text-align: center;
      text-wrap: balance;

      &:empty {
        display: none;
      }
    }

    @media (min-width: 981px) {
      padding-block: var(--space-12) var(--space-16);
    }
  }

  /* The map plus the popup that floats over it. */
  .stores-map {
    position: relative;
    isolation: isolate;
    height: 27rem;
    background-color: color-mix(
      in srgb,
      var(--color-ink) 8%,
      var(--color-paper)
    );

    .map {
      width: 100%;
      height: 100%;
    }

    /* Message when the API refused to load (bad key, no network…). */
    &.is-failed .map::after {
      content: 'La mappa non è disponibile al momento.';
      position: absolute;
      inset: 0;
      display: grid;
      place-items: center;
      padding: var(--space-6);
      font-size: var(--text-sm);
      color: var(--color-muted);
      text-align: center;
    }

    @media (min-width: 768px) {
      height: 36rem;
      max-width: var(--stores-max);
      margin-inline: auto;
      border-radius: var(--card-radius);
      overflow: hidden;
    }
  }

  /* Marker: a solid teardrop. Red for the flagship, black for resellers. */
  .store-pin {
    width: 28px;
    height: 38px;
    color: var(--color-fg);
    transition: transform 0.15s ease;
    transform-origin: bottom center;
    cursor: pointer;

    svg {
      display: block;
      fill: currentColor;
      /* 2px white border outside the shape, so overlapping pins stay readable. paint-order puts the stroke under the fill. */
      stroke: var(--color-paper);
      stroke-width: 4;
      stroke-linejoin: round;
      paint-order: stroke;
      filter: drop-shadow(0 1px 1px rgb(0 0 0 / 0.25));
    }

    &.is-flagship {
      color: var(--color-promo);
    }

    &:hover,
    &.is-active {
      transform: scale(1.2);
    }
  }

  /* The visitor's own position, from "Trova il negozio più vicino a te". */
  .user-dot {
    width: 16px;
    height: 16px;
    border: 3px solid var(--color-paper);
    border-radius: 50%;
    background-color: #4285f4;
    box-shadow:
      0 0 0 1px rgb(0 0 0 / 0.15),
      0 0 0 8px rgb(66 133 244 / 0.2);
    /* AdvancedMarkerElement anchors content bottom-centre; centre the dot on the point instead. */
    transform: translateY(50%);
  }

  /* Popup over the map, top-left so the zoom control and the Google logo stay clear. */
  .store-popup {
    position: absolute;
    top: var(--space-3);
    left: var(--space-3);
    z-index: 1;
    width: min(20rem, calc(100% - var(--space-3) * 2 - 3.5rem));
    padding: var(--space-5) var(--space-5) var(--space-5);
    background-color: var(--color-paper);
    border-radius: 1rem;
    box-shadow: 0 8px 24px rgb(0 0 0 / 0.18);

    .close {
      position: absolute;
      top: var(--space-3);
      right: var(--space-3);
      width: var(--space-8);
      height: var(--space-8);
      border: none;
      border-radius: 50%;
      background: transparent url(/wp-content/themes/romeismore-v2/assets/x.svg)
        center / var(--icon-md) no-repeat;
      cursor: pointer;
      -webkit-tap-highlight-color: transparent;

      &:hover {
        background-color: var(--color-surface);
      }
    }

    .body {
      padding-right: var(--space-8);
    }

    .kind {
      margin-bottom: var(--space-1);
      font-size: var(--text-2xs);
      font-weight: var(--weight-semibold);
      letter-spacing: 0.06em;
      text-transform: uppercase;
      color: var(--color-muted);
    }

    .name {
      font-size: var(--text-md);
      font-weight: var(--weight-bold);
      line-height: var(--leading-snug);
      text-wrap: balance;
    }

    .zone {
      margin-bottom: var(--space-3);
      font-size: var(--text-sm);
      color: var(--color-muted);
    }

    .name + .address {
      margin-top: var(--space-3);
    }

    .address,
    .phone {
      display: block;
      font-size: var(--text-sm);
      line-height: var(--leading-base);
      text-underline-offset: 3px;
    }

    .address {
      margin-bottom: var(--space-1);
    }

    @media (min-width: 981px) {
      top: var(--space-5);
      left: var(--space-5);
    }
  }

  /* ----- "Vuoi diventare rivenditore?" ----- */

  .stores-become {
    padding: var(--section-block) var(--stores-gutter);
    background-color: var(--color-fg);
    color: var(--color-on-fg);
    text-align: center;

    > .container > .title,
    > .container > .subtitle {
      color: inherit;
    }

    > .container > .subtitle {
      max-width: 32rem;
      font-weight: normal;
      text-wrap: pretty;

      a {
        text-underline-offset: 3px;
      }
    }

    /* The resellers' form (templates/contact-form.php): a light card on the dark band. */
    .become-form {
      width: 100%;
      max-width: 40rem;
      margin: var(--space-8) auto 0;
      padding: var(--space-6);
      border-radius: var(--card-radius);
      background-color: var(--color-bg);
      color: var(--color-fg);
      text-align: left;

      .form-success {
        background-color: transparent;
        color: inherit;
        padding: 0;
      }

      @media (min-width: 981px) {
        padding: var(--space-10);
      }
    }
  }
}

/* ============================================================
 * CONTACT PAGE
 * ============================================================ */

@layer components {
  /* ----- Contact page (/contatti/) ----- */

  .contact-page {
    --contact-max: 40rem; /* reading column: FAQ, form */
    --contact-wide: 64rem; /* the visit block with the map beside the text */
    --contact-gutter: var(--gutter-inline);

    .contact-section .title {
      margin-bottom: var(--space-5);
      font-size: var(--text-xl);
      font-weight: var(--weight-bold);
      line-height: var(--leading-tight);
      text-wrap: balance;
    }

    .contact-section .text {
      font-size: var(--text-md);
      line-height: var(--leading-base);
      text-wrap: pretty;

      a {
        text-underline-offset: 3px;
      }
    }

    @media (min-width: 981px) {
      --contact-gutter: var(--space-10);

      .contact-section .title {
        font-size: var(--text-2xl);
      }

      .contact-section .text {
        font-size: var(--text-lg);
      }
    }
  }

  /* "Contatti" + "Te serve 'na mano?" */
  .contact-intro {
    padding: var(--space-12) var(--contact-gutter) var(--space-10);
    text-align: center;

    .title {
      margin-bottom: var(--space-4);
      font-size: var(--text-2xl);
      font-weight: var(--weight-bold);
      line-height: var(--leading-tight);
    }

    .text {
      font-size: var(--text-md);
    }

    @media (min-width: 981px) {
      padding-block: var(--space-16) var(--space-12);

      .title {
        font-size: var(--text-3xl);
      }

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

  /* One block per topic; the wave between them is the separator. */
  .contact-section {
    padding: var(--space-10) var(--contact-gutter);

    > .container {
      max-width: var(--contact-max);
      margin-inline: auto;
    }

    @media (min-width: 981px) {
      padding-block: var(--space-12);
    }
  }

  /* ----- Form ----- */

  .contact-form {
    .form {
      display: grid;
      gap: var(--field-gap);

      /* js/contact.js hides it after submit; display: grid would otherwise win over [hidden]. */
      &[hidden] {
        display: none;
      }
    }

    .submit {
      justify-self: start;
      padding: var(--space-5) var(--space-10);
      cursor: pointer;
    }

    /* Shown by js/contact.js in the form's place once the message went out. */
    .form-success {
      padding: var(--space-6);
      border-radius: var(--card-radius);
      background-color: var(--color-fg);
      color: var(--color-on-fg);
      line-height: var(--leading-base);
      text-wrap: pretty;

      .heading {
        margin-bottom: var(--space-2);
        font-size: var(--text-lg);
        font-weight: var(--weight-bold);
      }
    }
  }

  /* ----- Phone: sits right above the visit block, no wave between. ----- */

  .contact-phone {
    padding-bottom: 0;

    .text a {
      white-space: nowrap;
    }

    /* Lines up with the visit block's text column on wide screens. */
    @media (min-width: 981px) {
      > .container {
        max-width: var(--contact-wide);
      }
    }
  }

  /* ----- Visit us: text, the map, the opening hours ----- */

  .contact-visit {
    > .container {
      display: grid;
      grid-template-areas:
        'text'
        'map'
        'details';
      gap: var(--space-6);
    }

    .text-block {
      grid-area: text;
    }

    .details {
      grid-area: details;
      font-size: var(--text-md);
      line-height: var(--leading-base);
    }

    .stores-map {
      grid-area: map;
      /* The /stores/ rule centres a 64rem box with auto margins; here it must fill its column, or a grid item shrinks to nothing. */
      width: 100%;
      max-width: none;
      margin-inline: 0;
      height: 20rem;
      border-radius: var(--card-radius);
      overflow: hidden;
    }

    .hours-title {
      margin-bottom: var(--space-3);
    }

    .hours {
      margin-bottom: var(--space-6);

      .row {
        display: grid;
        grid-template-columns: max-content 1fr;
        gap: 0 var(--space-4);
      }

      dt {
        font-weight: var(--weight-bold);
      }
    }

    .note {
      font-style: italic;
      text-wrap: pretty;

      a {
        text-underline-offset: 3px;
      }
    }

    @media (min-width: 981px) {
      padding-bottom: var(--space-16);

      > .container {
        grid-template-areas:
          'text map'
          'details map';
        grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
        grid-template-rows: auto 1fr;
        column-gap: var(--space-12);
        align-items: start;
        max-width: var(--contact-wide);
      }

      .details {
        font-size: var(--text-lg);
      }

      .stores-map {
        /* Fills both rows of the grid; align-self so the area, not the content, sets the height. */
        align-self: stretch;
        height: auto;
        min-height: 26rem;
      }
    }
  }

  /* ----- "Sapevi che puoi trovarci anche in altri negozi?" ----- */

  .contact-resellers {
    padding: var(--section-block) var(--contact-gutter);
    background-color: var(--color-fg);
    color: var(--color-on-fg);
    text-align: center;

    > .container > .title,
    > .container > .subtitle {
      color: inherit;
    }

    > .container > .title {
      max-width: 22rem;
      text-wrap: balance;
    }

    > .container > .subtitle {
      font-weight: normal;
    }
  }
}

/* ============================================================
 * 404 PAGE
 * ============================================================ */

@layer components {
  /* ----- 404: the animated "404" video, a line of copy, back to the shop ----- */

  /*
   * The whole message (video, copy, button) sits centred in the first screen,
   * under the top bar and the header, with no scrolling needed: the section is
   * as tall as what is left of the viewport and its spacing and video shrink
   * on short screens. The footer starts below the fold.
   */
  .error-hero {
    --error-video-width: 19rem; /* 304px */
    --error-gap: clamp(var(--space-6), 5svh, var(--space-12));

    display: grid;
    align-content: center;
    min-height: calc(100svh - var(--notice-height) - var(--header-height));
    padding: clamp(var(--space-6), 4svh, var(--space-12)) var(--gutter-inline);
    text-align: center;

    > .container {
      display: flex;
      flex-direction: column;
      align-items: center;
    }

    .error-video {
      display: block;
      width: auto;
      max-width: min(100%, var(--error-video-width));
      height: auto;
      max-height: 30svh;
      aspect-ratio: 16 / 9;
      margin-bottom: var(--error-gap);
      pointer-events: none;
    }

    .title {
      margin-bottom: var(--space-6);
      max-width: 12em;
      font-size: var(--text-2xl);
      font-weight: var(--weight-bold);
      line-height: var(--leading-tight);
      text-wrap: balance;
    }

    .text {
      margin-bottom: var(--space-8);
      font-size: var(--text-md);
      line-height: var(--leading-base);
    }

    .button {
      display: inline-block;
      padding-inline: var(--space-8);
    }

    @media (min-width: 981px) {
      --error-video-width: 30rem; /* 480px */

      .title {
        font-size: var(--text-4xl);
      }

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

/* ============================================================
 * WORK IN PROGRESS (index.php fallback)
 * ============================================================ */

@layer components {
  /* ----- Placeholder for pages that have no dedicated template yet ----- */

  .wip-hero {
    padding: var(--space-20) var(--gutter-inline);
    text-align: center;

    .title {
      font-size: var(--text-2xl);
      font-weight: var(--weight-bold);
      line-height: var(--leading-tight);
    }

    @media (min-width: 981px) {
      padding-block: calc(var(--space-20) * 2);

      .title {
        font-size: var(--text-4xl);
      }
    }
  }
}

/* ============================================================
 * CHECKOUT (page-checkout.php + woocommerce/checkout/*)
 * ============================================================ */
@layer components {
  /* ----- Checkout page -----
   *
   * Built from the customer area (see DESIGN-SYSTEM.md): .account-area.is-wide
   * for the page, .page-heading for the title, .form-field/.form-check for
   * the fields, .account-card + .order-detail for the summary. Phones:
   * heading, details, summary, payment, stacked. From 981px two columns:
   * details and payment left, the summary right — as wide as the cart
   * drawer's panel — and sticky. form.checkout and #order_review are
   * display: contents there, so the blocks WooCommerce's checkout.js swaps on
   * every update (.woocommerce-checkout-review-order-table and
   * .woocommerce-checkout-payment) land in the grid wherever they are in the DOM.
   */

  .checkout-page {
    /* The shortcode wraps its output in div.woocommerce; let the grid see through it. */
    .woocommerce {
      display: contents;
    }

    .form-notices {
      margin-bottom: var(--space-6);
    }

    /*
     * WooCommerce's own sheet (vendor layer) still paints a few things: the
     * grey #payment box, 47% half-width rows, the red-topped notices and the
     * "(facoltativo)" / red asterisk the address-i18n script writes into the
     * labels. Neutralised here.
     */
    .form-row {
      float: none;
      width: auto;
      margin: 0;
      padding: 0;
    }

    .form-row .required,
    .form-field .label .required {
      color: inherit;
      font-weight: inherit;
      border: none;
      text-decoration: none;
      visibility: visible;
    }

    .form-field .label .optional {
      display: none;
    }

    #payment,
    #payment .payment_box,
    #payment ul.payment_methods {
      padding: 0;
      border: none;
      border-radius: 0;
      background: transparent;
    }

    #payment ul.payment_methods li {
      margin: 0;
      line-height: inherit;
      text-align: left;
      font-weight: inherit;
    }

    #payment .payment_box::before {
      display: none;
    }

    .form-notices.woocommerce-error,
    .form-notices.woocommerce-message,
    .form-notices.woocommerce-info {
      margin: 0 0 var(--space-6);
      padding: 0;
      border: none;
      background: transparent;
      list-style: none;

      &::before {
        display: none;
      }
    }

    /* The static "Paese: Italia" line when the shop ships to one country only. */
    .form-row--static .static {
      font-size: var(--text-sm);

      .static-label {
        color: var(--color-muted);
      }
    }

    /* checkout.js marks rejected fields on the .form-row; here that is the field itself. */
    .form-row.woocommerce-invalid.form-field,
    .form-row.is-invalid.form-field {
      border-color: var(--field-border-color-error);
    }

    .form-row.woocommerce-invalid .form-check input {
      border-color: var(--field-border-color-error);
    }

    /* Inline "required" hints WooCommerce may print under a field. */
    .form-row .checkout-inline-error-message {
      margin: var(--space-1) 0 0;
      font-size: var(--text-xs);
      color: var(--color-promo);
    }

    @media (min-width: 981px) {
      > .container {
        display: grid;
        grid-template-columns: minmax(0, 1fr) 26rem;
        column-gap: var(--space-12);
        align-items: start;
      }

      .checkout-heading,
      .form-notices,
      .woocommerce-NoticeGroup,
      .checkout-cart-errors {
        grid-column: 1 / -1;
      }

      form.checkout,
      #order_review {
        display: contents;
      }

      .checkout-details,
      .woocommerce-checkout-payment {
        grid-column: 1;
      }

      .checkout-summary {
        grid-column: 2;
        grid-row: span 2;
        position: sticky;
        top: var(--space-6);
      }

      /* The "updating" veil checkout.js draws over #order_review: with display: contents it has no box, so veil the page. */
      #order_review > .blockUI {
        position: fixed !important;
        inset: 0 !important;
        width: auto !important;
        height: auto !important;
      }
    }
  }

  /* "← Checkout" (templates/account/heading.php) with the login hint under it, like the login page's .switch. */
  .checkout-heading {
    margin-bottom: var(--space-8);

    .page-heading {
      margin-bottom: var(--space-2);
    }

    .switch {
      font-size: var(--text-sm);

      a {
        font-weight: var(--weight-bold);
        text-underline-offset: 3px;
      }
    }
  }

  /* ----- Details column ----- */

  .checkout-details,
  .customer-details {
    display: grid;
    gap: var(--space-8);
  }

  .checkout-details {
    margin-bottom: var(--space-8);
  }

  .checkout-section {
    /* Same heading as the cards of the customer area. */
    .heading {
      margin-bottom: var(--space-5);
      font-size: var(--text-md);
      font-weight: var(--weight-bold);
      letter-spacing: 0.02em;
      text-transform: uppercase;
    }

    /* One column, as the registration form and the address dialog. */
    .fields {
      display: grid;
      gap: var(--field-gap);
    }

    /* "Spedisci a un indirizzo diverso" / "Crea un account" switches. */
    > .form-check {
      align-items: center;
    }

    /* The blocks checkout.js shows and hides under the switches. */
    .shipping_address,
    .create-account {
      margin-top: var(--space-5);
    }
  }

  /* ----- Order summary -----
   * An .account-card that is also an .order-detail, so the items and the
   * totals are drawn by the customer area's rules. Added here: the head, the
   * free-shipping bar (the cart drawer's), the coupon and the shipping methods.
   */

  .checkout-summary {
    margin-bottom: var(--space-8);

    > .head {
      margin-bottom: 0;
    }

    .count {
      font-size: var(--text-xs);
      color: var(--color-muted);
    }

    .shipping-progress {
      padding: var(--space-5);
      background-color: var(--color-surface);
      text-align: center;

      .label {
        margin-bottom: var(--space-3);
        font-size: var(--text-xs);
      }

      .bar {
        height: 0.625rem;
        border: 1px solid color-mix(in srgb, var(--color-fg) 25%, transparent);
        border-radius: var(--radius-pill);
        background-color: var(--color-bg);
        overflow: hidden;

        span {
          display: block;
          height: 100%;
          border-radius: var(--radius-pill);
          background-color: var(--color-fg);
          transition: width 0.4s ease;
        }
      }
    }

    .items {
      margin-bottom: 0;
    }

    /* Code + "Applica": the newsletter's input group, with a .form-field as the field. */
    .coupon {
      .form-input-group {
        display: grid;

        > * {
          grid-area: 1 / 1;
        }
      }

      .form-field .label {
        right: calc(var(--field-padding-x) + 7rem);
      }

      .apply {
        justify-self: end;
        align-self: center;
        margin-right: var(--space-2);
        padding-block: var(--space-3);
        font-size: var(--text-sm);
        cursor: pointer;

        &:disabled {
          opacity: 0.5;
          cursor: wait;
        }
      }

      .coupon-notice {
        margin-top: var(--space-3);

        .form-notices {
          margin: 0;
        }
      }
    }

    /* Shipping methods: .form-check rows, cream when chosen, like the filter panel's options. */
    .shipping-methods {
      .subheading {
        margin-bottom: var(--space-3);
        font-size: var(--text-sm);
        font-weight: var(--weight-bold);
        letter-spacing: 0.02em;
        text-transform: uppercase;
      }

      .methods {
        display: grid;
        margin: 0;
        padding: 0;
        list-style: none;
      }

      .method {
        align-items: center;
        padding: var(--space-3) var(--space-4);
        border-radius: var(--field-radius);

        &:has(input:checked) {
          background-color: var(--color-surface);
        }
      }

      .method .text {
        flex: 1 1 auto;
        display: flex;
        justify-content: space-between;
        gap: var(--space-3);
      }

      .method .woocommerce-Price-amount {
        font-weight: var(--weight-semibold);
        white-space: nowrap;
      }

      .hint,
      .contents {
        margin: 0;
        font-size: var(--text-sm);
        color: var(--color-muted);
      }
    }

    .totals {
      .muted {
        color: var(--color-muted);
      }

      /* "Rimuovi" under the coupon amount, as in the cart drawer (.remove-btn). */
      .row--discount dd a {
        display: block;
        margin-top: var(--space-1);
        font-size: var(--text-xs);
        color: var(--color-muted);
        text-underline-offset: 3px;
      }
    }
  }

  /* ----- Payment + submit ----- */

  .checkout-payment {
    .methods {
      display: grid;
      margin: 0;
      padding: 0;
      list-style: none;
    }

    .method > .form-check {
      align-items: center;
      padding: var(--space-4);
      border-radius: var(--field-radius);

      &:has(input:checked) {
        background-color: var(--color-surface);
      }
    }

    .method .text {
      flex: 1 1 auto;
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: var(--space-3);
      min-width: 0;
    }

    .method .name {
      font-weight: var(--weight-semibold);
    }

    .method img {
      max-height: var(--icon-lg);
      width: auto;
    }

    /* "What's this?" link PayPal appends to its icon. */
    .method .about_paypal {
      font-size: var(--text-xs);
      white-space: nowrap;
    }

    .payment_box {
      margin: 0 var(--space-4) var(--space-2);
      padding: var(--space-2) 0;
      font-size: var(--text-sm);
      color: var(--color-muted);

      p {
        margin: 0;
      }
    }

    .hint .form-notices {
      margin: 0;
    }

    .place-order {
      display: grid;
      gap: var(--space-5);
      margin-top: var(--space-6);
    }

    .terms {
      display: grid;
      gap: var(--space-4);

      .woocommerce-privacy-policy-text {
        margin: 0;
        font-size: var(--text-xs);
        line-height: var(--leading-base);
        color: var(--color-muted);

        a {
          font-weight: var(--weight-semibold);
        }
      }
    }

    /* Same submit as the account forms. */
    .submit {
      padding-block: var(--space-5);
      text-transform: uppercase;
      cursor: pointer;

      &:disabled {
        opacity: 0.5;
        cursor: wait;
      }
    }
  }

  /* ----- Cart errors (checkout/cart-errors.php) ----- */

  .checkout-cart-errors {
    display: grid;
    gap: var(--space-4);
    justify-items: start;
  }
}

/* ============================================================
 * THANK-YOU PAGE (woocommerce/checkout/thankyou.php)
 * ============================================================ */
@layer components {
  /* The hero is .account-page--welcome (design/FEEDBACK/feedback.pdf, page 1);
   * the order block is .account-area + .order-detail from the customer area.
   * Only the seams between the two are set here. */
  .thankyou-page {
    .thankyou-hero {
      padding-bottom: var(--space-8);

      .order-number {
        margin-bottom: var(--space-6);
        font-size: var(--text-xl);
        font-weight: var(--weight-bold);
        text-align: center;
      }

      .intro {
        margin-bottom: var(--space-6);
        line-height: var(--leading-base);

        a {
          font-weight: var(--weight-bold);
          text-decoration: none;
        }
      }

      /* Cream discs, as the design shows them on the white page. */
      .social-icons {
        display: flex;
        justify-content: center;
        gap: var(--space-4);
        margin-bottom: var(--space-10);

        .social-icon {
          border: none;
          background-color: var(--color-surface);
        }
      }

      .actions {
        margin-top: 0;
      }
    }

    .thankyou-order {
      padding-top: 0;
    }

    /* Gateway instructions (bank details, cash on delivery note…). */
    .instructions .text {
      font-size: var(--text-sm);
      line-height: 1.6;

      p,
      h2,
      h3 {
        margin: 0 0 var(--space-2);
      }

      h2,
      h3 {
        font-size: var(--text-sm);
        font-weight: var(--weight-bold);
      }

      ul {
        margin: 0;
        padding-left: var(--space-5);
      }
    }

    .woocommerce-bacs-bank-details .wc-bacs-bank-details {
      display: grid;
      gap: var(--space-1);
      margin: 0;
      padding: 0;
      list-style: none;
    }

    @media (min-width: 981px) {
      .thankyou-hero {
        padding-bottom: var(--space-10);
      }
    }
  }

  /* Email check before an older order-received page (checkout/form-verify-email.php). */
  .thankyou-verify {
    .form {
      display: grid;
      gap: var(--field-gap);
    }

    .submit {
      padding-block: var(--space-5);
      text-transform: uppercase;
      cursor: pointer;
    }
  }
}

/* ============================================================
 * LEGAL PAGES (page-legal.php)
 * ============================================================ */
@layer components {
  /* ----- Legal page -----
   * The content-page pattern (Contatti, Negozi): centred intro, the wave,
   * then the text as a 40rem reading column. The "in questa pagina" index
   * is an .account-card: collapsed under the intro on phones, a sticky
   * column beside the text from 981px (as wide as the header's search box).
   */

  .legal-intro {
    padding: var(--space-12) var(--gutter-inline) var(--space-10);
    text-align: center;

    .title {
      margin-bottom: var(--space-4);
      font-size: var(--text-2xl);
      font-weight: var(--weight-bold);
      line-height: var(--leading-tight);
      text-wrap: balance;
    }

    .meta {
      font-size: var(--text-sm);
      color: var(--color-muted);
    }

    @media (min-width: 981px) {
      padding-block: var(--space-16) var(--space-12);

      .title {
        font-size: var(--text-3xl);
      }
    }
  }

  .legal-body {
    padding: var(--space-10) var(--gutter-inline) var(--space-20);

    > .container {
      max-width: 40rem;
      margin-inline: auto;
    }

    @media (min-width: 981px) {
      padding-block: var(--space-12) var(--space-20);

      > .container.has-toc {
        display: grid;
        grid-template-columns: 22rem minmax(0, 1fr);
        column-gap: var(--space-12);
        align-items: start;
        max-width: 64rem;
      }
    }
  }

  .legal-toc {
    margin-bottom: var(--space-8);

    /* The card's heading as the <summary>, with the accordion's +/− disc. */
    .heading {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: var(--space-4);
      list-style: none;
      cursor: pointer;
      -webkit-tap-highlight-color: transparent;

      &::-webkit-details-marker {
        display: none;
      }

      &::after {
        content: '+';
        flex: 0 0 auto;
        display: grid;
        place-items: center;
        width: var(--icon-lg);
        height: var(--icon-lg);
        border: 1px solid currentColor;
        border-radius: 50%;
        font-size: var(--text-md);
        font-weight: 400;
        letter-spacing: 0;
        line-height: 1;
      }
    }

    .toc[open] .heading::after {
      content: '−';
    }

    /* Links as in the footer's menu. */
    .list {
      display: grid;
      gap: var(--space-2);
      margin: var(--space-4) 0 0;
      padding: 0;
      list-style: none;
      font-size: var(--text-sm);
      line-height: var(--leading-snug);
    }

    .item--h3 {
      padding-left: var(--space-3);
    }

    a {
      text-decoration: none;

      &:hover,
      &:focus-visible {
        text-decoration: underline;
        text-underline-offset: 3px;
      }
    }

    @media (min-width: 981px) {
      position: sticky;
      top: var(--space-6);
      margin-bottom: 0;

      .heading {
        pointer-events: none;

        &::after {
          display: none;
        }
      }
    }
  }

  /* ----- Prose: long-form text (legal pages, Complianz's cookie statement) ----- */

  .prose {
    font-size: var(--text-md);
    line-height: var(--leading-base);
    text-wrap: pretty;

    > :first-child {
      margin-top: 0;
    }

    /* Section titles on the scale of .contact-section .title. */
    h2,
    h3 {
      margin: var(--space-10) 0 var(--space-5);
      font-weight: var(--weight-bold);
      line-height: var(--leading-tight);
      scroll-margin-top: var(--space-8);
    }

    h2 {
      font-size: var(--text-xl);
    }

    h3 {
      font-size: var(--text-lg);
    }

    h4 {
      margin: var(--space-6) 0 var(--space-2);
      font-size: var(--text-md);
      font-weight: var(--weight-bold);
    }

    p {
      margin: 0 0 var(--space-4);
    }

    ul,
    ol {
      margin: 0 0 var(--space-4);
      padding-left: var(--space-5);
    }

    li {
      margin-bottom: var(--space-2);
    }

    li > ul,
    li > ol {
      margin-top: var(--space-2);
      padding-left: var(--space-3); /* lettered sub-points: a shallower second indent on phones */
    }

    /* Numbered clauses with lettered sub-points, as in the sale conditions. */
    ol {
      list-style: decimal;
    }

    ol ul {
      list-style: lower-alpha;
    }

    a {
      font-weight: var(--weight-semibold);
      text-underline-offset: 3px;
    }

    strong {
      font-weight: var(--weight-bold);
    }

    address {
      font-style: normal;
    }

    /* Tables (the cookie list Complianz generates): rows ruled like .totals. Not in Mats' theme. */
    table {
      width: 100%;
      margin: 0 0 var(--space-4);
      border-collapse: collapse;
      font-size: var(--text-sm);

      th,
      td {
        padding: var(--space-2) var(--space-3);
        border-bottom: 1px solid var(--card-border-color);
        text-align: left;
        vertical-align: top;
      }
    }

    /*
     * Service accordions in the Complianz cookie policy (one <details> per
     * service, the cookie list inside): the FAQ accordion, so the document
     * reads like /faq/. The "Consent to service" labels and the empty
     * consent container are dropped in includes/legal.php.
     */
    details {
      margin: 0;
      border-bottom: 1px solid var(--color-fg);

      &:first-of-type {
        border-top: 1px solid var(--color-fg);
      }

      summary {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: var(--space-4);
        padding: var(--space-5) 0;
        list-style: none;
        cursor: pointer;
        -webkit-tap-highlight-color: transparent;

        &::-webkit-details-marker {
          display: none;
        }

        > div {
          display: flex;
          flex-wrap: wrap;
          align-items: baseline;
          gap: 0 var(--space-3);
        }

        h3,
        h4 {
          margin: 0;
          font-size: var(--text-md);
          font-weight: var(--weight-bold);
          line-height: var(--leading-snug);
        }

        p {
          margin: 0;
          font-size: var(--text-sm);
          color: var(--color-muted);
        }

        &::after {
          content: '+';
          flex: 0 0 auto;
          display: grid;
          place-items: center;
          width: var(--icon-lg);
          height: var(--icon-lg);
          border: 1px solid currentColor;
          border-radius: 50%;
          font-size: var(--text-md);
          font-weight: 400;
          line-height: 1;
        }
      }

      &[open] summary::after {
        content: '−';
      }

      > div {
        padding-bottom: var(--space-5);
        font-size: var(--text-sm);

        h4 {
          margin: var(--space-4) 0 var(--space-1);
          font-size: var(--text-sm);
        }

        p {
          margin: 0 0 var(--space-2);
        }
      }

      /* Each cookie: label/value rows ruled like .totals. */
      .cookies-per-purpose {
        display: grid;
        grid-template-columns: 7rem minmax(0, 1fr);
        gap: var(--space-1) var(--space-3);
        margin-top: var(--space-4);
        padding-top: var(--space-3);
        border-top: 1px solid var(--card-border-color);

        .purpose {
          grid-column: 1 / -1;

          h4 {
            margin: 0 0 var(--space-2);
          }
        }

        h5 {
          margin: 0;
          font-size: var(--text-xs);
          font-weight: var(--weight-semibold);
          text-transform: uppercase;
          letter-spacing: 0.04em;
          color: var(--color-muted);
        }

        [class$='-header'] {
          grid-column: 1;
        }

        .name,
        .retention,
        .function {
          grid-column: 2;
        }
      }
    }

    @media (min-width: 981px) {
      h2 {
        font-size: var(--text-2xl);
      }
    }
  }
}

/* ============================================================
 * COOKIE CONSENT (Complianz) — seams with the theme
 * ============================================================ */
@layer components {
  /*
   * Complianz's floating "Gestisci consenso" button: on phones it sits over
   * the fixed add-to-cart bar and takes the taps. The footer has "Gestisci i
   * cookie" for the same thing, so the floating one is off.
   */
  #cmplz-manage-consent {
    display: none !important;
  }

  /* The map area while the marketing consent is missing (js/stores.js). */
  .stores-map .map .consent-note {
    display: grid;
    place-content: center;
    gap: var(--space-4);
    height: 100%;
    min-height: 16rem;
    padding: var(--space-6);
    text-align: center;
    font-size: var(--text-sm);
    line-height: var(--leading-base);
    background-color: var(--color-surface);

    .button {
      justify-self: center;
      cursor: pointer;
    }
  }
}

/* ============================================================
 * FORMS: contact (CF7) and newsletter (MailPoet) seams
 * ============================================================ */
@layer components {
  /* Honeypot field: off-screen, never display:none (bots skip those). */
  .hp {
    position: absolute;
    left: -200vw;
    width: 1px;
    height: 1px;
    overflow: hidden;
  }

  /* CF7's message under a rejected field (js/contact.js). */
  .contact-form .field-error {
    margin: calc(var(--field-gap) * -1 + var(--space-2)) 0 0;
    font-size: var(--text-xs);
    color: var(--color-promo);
  }

  .contact-form .form-notice[hidden],
  .site-newsletter .form-notice[hidden],
  .site-newsletter .form[hidden] {
    display: none;
  }

  .site-newsletter .form-notice {
    max-width: 32rem;
    margin: var(--space-4) auto 0;
    text-align: center;
  }
}

/* ============================================================
 * FAVORITES (includes/favorites.php, js/favorites.js, page-wishlist.php)
 * ============================================================ */
@layer components {
  /* Header: the heart is a link to /wishlist/ with the count, like the cart. */
  .site-header .favorites-btn {
    position: relative;
    display: block;
    text-decoration: none;

    .favorites-count {
      position: absolute;
      top: -0.5rem;
      right: -0.625rem;
      min-width: 1rem;
      height: 1rem;
      padding: 0 var(--space-1);
      border-radius: var(--radius-pill);
      background-color: var(--color-fg);
      color: var(--color-on-fg);
      font-size: var(--text-2xs);
      font-weight: var(--weight-semibold);
      line-height: 1rem;
      text-align: center;
    }
  }

  /* A pressed heart is filled (product page and cards). */
  .favorites-btn[aria-pressed='true'],
  .favorite-btn[aria-pressed='true'] {
    background-image: url(/wp-content/themes/romeismore-v2/assets/heart-filled.svg);
  }

  .product-main-info .favorites-btn {
    cursor: pointer;
    transition: scale 0.15s ease;
    -webkit-tap-highlight-color: transparent;

    &:active {
      scale: 0.85;
    }
  }

  /* The heart on a product card (wishlist page): a white disc over the photo. */
  li.product {
    position: relative;

    .favorite-btn {
      position: absolute;
      top: var(--space-2);
      right: var(--space-2);
      width: 2.75rem; /* 44px touch target */
      height: 2.75rem;
      border: none;
      border-radius: var(--radius-pill);
      background: var(--color-bg) url(/wp-content/themes/romeismore-v2/assets/heart.svg) center / 1.25rem no-repeat;
      box-shadow: 0 2px 12px rgb(39 39 39 / 0.18); /* the carousel arrows' shadow */
      cursor: pointer;
      -webkit-tap-highlight-color: transparent;

      &[aria-pressed='true'] {
        background-image: url(/wp-content/themes/romeismore-v2/assets/heart-filled.svg);
      }
    }

    &.is-leaving {
      opacity: 0;
      scale: 0.96;
      transition: opacity 0.3s ease, scale 0.3s ease;
    }
  }

  /* ----- /wishlist/ ----- */

  .wishlist-page {
    .hint {
      margin: calc(var(--space-8) * -1 + var(--space-2)) 0 var(--space-8);
      font-size: var(--text-sm);
      color: var(--color-muted);

      a {
        font-weight: var(--weight-semibold);
        text-underline-offset: 3px;
      }
    }

    .favorites-grid {
      display: grid;
      grid-template-columns: repeat(2, minmax(0, 1fr));
      gap: var(--space-8) var(--space-4);
      margin: 0;
      padding: 0;
      list-style: none;

      @media (min-width: 640px) {
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: var(--space-10) var(--space-6);
      }

      @media (min-width: 981px) {
        grid-template-columns: repeat(4, minmax(0, 1fr));
      }
    }

    /* .account-page--empty inside the area: no second block of padding. */
    .wishlist-empty {
      display: none;
      padding: var(--space-4) 0;
    }

    &.is-empty .favorites-grid,
    &.is-empty .hint,
    &.is-empty > .container > .title {
      display: none;
    }

    &.is-empty .wishlist-empty {
      display: block;
    }
  }
}

/* ============================================================
 * GAME PRODUCT PAGES (includes/games.php, templates/product-game*.php)
 * ============================================================ */
@layer components {
  /* Colors come from the game's configuration as --game-* custom properties on each block. */

  /* ----- Hero band ----- */

  .game-hero {
    position: relative;
    overflow: hidden;
    padding: var(--space-10) var(--gutter-inline) var(--space-12);
    background: var(--game-bg) var(--game-pattern, none) center / 470px repeat; /* 940×416 tile = 4 glyph columns × 2 staggered rows, cut mid-gap so it repeats without cutting a glyph */
    color: var(--game-fg);
    text-align: center;

    .media {
      display: flex;
      justify-content: center;
    }

    .video {
      display: block;
      width: auto;
      max-width: 100%;
      max-height: min(46vh, 22rem);
      border-radius: 16px;
      object-fit: contain;
      background-color: var(--game-bg);
    }

    .image {
      display: block;
      width: 100%;
      max-width: 28rem;
      height: auto;
    }

    /* With a video the still is only the poster. */
    &.has-video .image {
      display: none;
    }

    .claim {
      max-width: 22rem;
      margin: var(--space-6) auto 0;
      font-size: var(--text-2xl);
      font-weight: var(--weight-bold);
      line-height: var(--leading-tight);
      text-wrap: balance;
    }

    .media:empty + .container .claim {
      margin-top: 0;
    }

    /* Full-bleed illustrations: no padding, the picture is the band. */
    &.game-hero--romano-in-fiera,
    &.game-hero--tombola:not(.has-video) {
      padding: 0;

      .image {
        max-width: none;
        max-height: 70vh;
        object-fit: cover;
      }
    }

    &.game-hero--tombola.has-video {
      padding-block: var(--space-8);
    }

    @media (min-width: 768px) {
      padding-block: var(--space-12);

      .claim {
        max-width: 30rem;
        font-size: var(--text-3xl);
      }

      .video {
        max-height: 26rem;
      }

      &.game-hero--romano-in-fiera .image,
      &.game-hero--tombola:not(.has-video) .image {
        max-height: 26rem;
        width: 100%;
      }
    }
  }

  .game-wave {
    margin-top: -1px;
  }

  /* ----- Game section ----- */

  .game-section {
    position: relative;
    padding: var(--space-16) var(--gutter-inline) var(--space-16);
    background-color: var(--game-bg);
    color: var(--game-fg);
    text-align: center;

    > .container {
      display: grid;
      gap: var(--space-8);
      max-width: 40rem;
      margin-inline: auto;
    }

    .head {
      display: grid;
      gap: var(--space-4);
    }

    .title {
      font-size: var(--text-2xl);
      font-weight: var(--weight-bold);
      letter-spacing: 0.02em;
      text-transform: uppercase;
    }

    .intro {
      line-height: var(--leading-base);
      text-wrap: pretty;
    }

    .downloads {
      display: grid;
      gap: var(--space-3);
      justify-items: center;
      margin-top: var(--space-2);

      .button {
        min-width: 14rem;
        background-color: var(--game-accent);
        color: var(--game-accent-fg);
        text-transform: uppercase;
        text-align: center;
      }

      /* The design gives the second download its own color (--game-accent-2). */
      .button:nth-of-type(2) {
        background-color: var(--game-accent-2, var(--game-accent));
        color: var(--game-accent-2-fg, var(--game-accent-fg));
      }

      /* Buttons waiting for their file (templates/product-game.php). */
      &[hidden],
      .button[hidden] {
        display: none;
      }
    }

    .illustration {
      display: block;
      width: 100%;
      height: auto;
      border-radius: 12px;
    }

    /* Story, box, stats, credits, partner. */
    .body {
      display: grid;
      gap: var(--space-8);
    }

    /* Second band (Er Giro: the grey street under the blue sky), full-bleed down to the next section.
     * overflow-x: clip because 100vw includes a classic scrollbar and the bleed would widen the page. */
    &.has-band {
      padding-bottom: 0;
      overflow-x: clip;

      .body {
        margin-inline: calc(50% - 50vw);
        padding: var(--space-12) calc(50vw - 50% + var(--gutter-inline)) var(--space-16);
        background-color: var(--game-band);
        color: var(--game-band-fg, var(--game-fg));
      }
    }

    .story p {
      margin: 0 0 var(--space-4);
      font-size: var(--text-lg);
      line-height: var(--leading-base);
      text-wrap: pretty;

      &:last-child {
        margin-bottom: 0;
      }
    }

    .box {
      padding: var(--space-6);
      border-radius: 16px;
      background-color: var(--game-box);
      color: var(--game-box-fg);
      text-align: left;

      .box-image {
        display: block;
        width: 100%;
        height: auto;
        margin-bottom: var(--space-5);
        border-radius: 8px;
      }

      .box-title {
        margin-bottom: var(--space-3);
        font-size: var(--text-sm);
        font-weight: var(--weight-bold);
        letter-spacing: 0.04em;
        text-transform: uppercase;
      }

      .contents {
        display: grid;
        gap: var(--space-1);
        margin: 0;
        padding: 0;
        list-style: none;
        line-height: var(--leading-base);

        li::before {
          content: '·';
          margin-right: var(--space-2);
          font-weight: var(--weight-bold);
        }
      }
    }

    .stats {
      display: flex;
      flex-wrap: wrap;
      justify-content: center;
      gap: var(--space-8);
      margin: 0;

      .stat {
        display: grid;
        gap: var(--space-3);
        justify-items: center;
      }

      /* Pictogram in the text color: the design's icon as a mask. */
      .icon {
        display: block;
        width: 2.5rem;
        height: 2.5rem;
        background-color: currentColor;
        mask: var(--stat-icon) center / contain no-repeat;
        -webkit-mask: var(--stat-icon) center / contain no-repeat;
      }

      .stat--giocatori {
        --stat-icon: url(/wp-content/themes/romeismore-v2/assets/games/stat-players.png);
      }

      .stat--durata {
        --stat-icon: url(/wp-content/themes/romeismore-v2/assets/games/stat-duration.png);
      }

      .stat--eta {
        --stat-icon: url(/wp-content/themes/romeismore-v2/assets/games/stat-age.png);
      }

      dd {
        margin: 0;
        font-size: var(--text-md);
        font-weight: var(--weight-medium);
        font-variant-numeric: tabular-nums;
      }
    }

    .credits {
      max-width: 28rem;
      margin-inline: auto;
      font-size: var(--text-sm);
      line-height: var(--leading-base);
      opacity: 0.9;
    }

    .partner {
      display: grid;
      gap: var(--space-2);
      justify-items: center;

      .label {
        font-size: var(--text-xs);
        letter-spacing: 0.04em;
        text-transform: uppercase;
        opacity: 0.8;
      }

      .partner-logo {
        display: block;
        width: min(100%, 14rem);
        height: auto;
      }
    }

    @media (min-width: 981px) {
      padding-block: var(--space-20);

      > .container {
        max-width: 44rem;
        gap: var(--space-10);
      }

      .title {
        font-size: var(--text-3xl);
      }

      .downloads {
        grid-auto-flow: column;
      }
    }
  }

  /* ----- Bundle box in the product info ----- */

  .game-bundle {
    display: grid;
    grid-template-columns: 5.5rem minmax(0, 1fr);
    gap: var(--space-4);
    align-items: center;
    margin: 0 var(--gutter-inline) var(--space-6);
    padding: var(--space-4);
    border: 1px solid var(--card-border-color);
    border-radius: var(--card-radius);
    background-color: var(--color-surface);

    .thumb img {
      display: block;
      width: 100%;
      aspect-ratio: 1;
      object-fit: cover;
      border-radius: 8px;
    }

    .info {
      font-size: var(--text-sm);
      line-height: var(--leading-snug);
    }

    .names {
      margin-bottom: var(--space-1);
      font-weight: var(--weight-bold);
      letter-spacing: 0.02em;
    }

    .prices {
      margin-bottom: var(--space-1);

      del {
        margin-right: var(--space-2);
        color: var(--color-muted);
      }

      ins {
        font-weight: var(--weight-bold);
        color: var(--game-accent);
        text-decoration: none;
      }
    }

    .claim {
      font-style: italic;
      color: var(--color-muted);
    }

    .bundle-add {
      grid-column: 1 / -1;
      padding-block: var(--space-4);
      background-color: var(--game-accent);
      color: var(--game-accent-fg);
      text-align: center;
      cursor: pointer;

      &[aria-busy='true'] {
        opacity: 0.6;
        cursor: progress;
      }
    }

    @media (min-width: 768px) {
      margin-inline: 0;
    }
  }
}

/* ============================================================
 * FAQ (page-faq.php) — design/faq.png
 * ============================================================ */
@layer components {
  /* "Aiuto & FAQ", the line under it, the search (.search-box, as in the header). */
  .faq-intro {
    padding: var(--space-12) var(--gutter-inline) var(--space-10);
    text-align: center;

    > .container {
      max-width: 40rem;
      margin-inline: auto;
    }

    .title {
      margin-bottom: var(--space-4);
      font-size: var(--text-2xl);
      font-weight: var(--weight-bold);
      line-height: var(--leading-tight);
    }

    .text {
      margin-bottom: var(--space-8);
    }

    .search-box {
      text-align: left;
    }

    @media (min-width: 981px) {
      padding-block: var(--space-16) var(--space-12);

      .title {
        font-size: var(--text-3xl);
      }

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

  .faq-body {
    padding: 0 var(--gutter-inline) var(--space-16);

    > .container {
      display: grid;
      gap: var(--space-12);
      max-width: 40rem;
      margin-inline: auto;
    }
  }

  .faq-section {
    .heading {
      margin-bottom: var(--space-4);
      font-size: var(--text-md);
      font-weight: var(--weight-bold);
      letter-spacing: 0.02em;
      text-transform: uppercase;
    }

    &[hidden] {
      display: none;
    }
  }

  /* One question: the product page's accordion (.product-details), with the question in sentence case as the design. */
  .faq-item {
    border-bottom: 1px solid var(--color-fg);

    .question {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: var(--space-4);
      padding: var(--space-5) 0;
      font-size: var(--text-md);
      font-weight: var(--weight-bold);
      line-height: var(--leading-snug);
      list-style: none;
      cursor: pointer;
      -webkit-tap-highlight-color: transparent;

      &::-webkit-details-marker {
        display: none;
      }

      &::after {
        content: '+';
        flex: 0 0 auto;
        display: grid;
        place-items: center;
        width: var(--icon-lg);
        height: var(--icon-lg);
        border: 1px solid currentColor;
        border-radius: 50%;
        font-size: var(--text-md);
        font-weight: 400;
        line-height: 1;
      }
    }

    &[open] .question::after {
      content: '−';
    }

    .answer {
      padding-bottom: var(--space-6);
      font-size: var(--text-sm);
      line-height: var(--leading-base);
      text-wrap: pretty;

      p,
      ul,
      ol {
        margin: 0 0 var(--space-4);
      }

      ul,
      ol {
        padding-left: var(--space-5);
      }

      li {
        margin-bottom: var(--space-1);
      }

      a {
        font-weight: var(--weight-semibold);
        text-underline-offset: 3px;
      }

      > :last-child {
        margin-bottom: 0;
      }
    }

    &[hidden] {
      display: none;
    }

    @media (min-width: 981px) {
      .answer {
        font-size: var(--text-md);
      }
    }
  }

  .faq-no-results,
  .faq-empty {
    text-align: center;
    color: var(--color-muted);

    a {
      font-weight: var(--weight-semibold);
    }

    &[hidden] {
      display: none;
    }
  }

  /* "Non riesci a trovare la risposta?": the dark band before the store info (.form-success / footer colours). */
  .faq-contact {
    padding: var(--space-12) var(--gutter-inline);
    background-color: var(--color-fg);
    color: var(--color-on-fg);
    text-align: center;

    > .container {
      display: grid;
      gap: var(--space-4);
      justify-items: center;
      max-width: 40rem;
      margin-inline: auto;
    }

    .title {
      font-size: var(--text-xl);
      font-weight: var(--weight-bold);
      line-height: var(--leading-tight);
      text-wrap: balance;
    }

    .text {
      line-height: var(--leading-base);
    }

    /* Cream, as the tavola and the light buttons of the account screens. */
    .button {
      margin-top: var(--space-2);
      background-color: var(--color-surface);
    }

    @media (min-width: 981px) {
      padding-block: var(--space-16);

      .title {
        font-size: var(--text-2xl);
      }
    }
  }

  /* Complianz prints an empty third item in the banner's document list. */
  .cmplz-cookiebanner .cmplz-links li:empty {
    display: none;
  }

  /*
   * The banner's palette (cream, ink border, pill buttons) is set in
   * Complianz; what its settings can't reach is done here so the panel
   * matches the account dialogs: category rows as bordered boxes instead of
   * grey fills, "Sempre attivo" in the text color instead of green, toggles
   * in the theme's greys, a focus ring on the close icon like everywhere else.
   */
  .cmplz-cookiebanner {
    --cmplz_category_header_always_active_color: var(--color-fg);
    --cmplz_slider_active_color: var(--color-fg);
    --cmplz_slider_inactive_color: color-mix(in srgb, var(--color-fg) 25%, var(--color-surface));

    /* !important: Complianz's CSS is unlayered, so it outranks this layer. */
    .cmplz-categories .cmplz-category {
      background-color: transparent !important;
      border: 1px solid color-mix(in srgb, var(--color-fg) 15%, transparent) !important;
      border-radius: var(--field-radius) !important;
    }

    .cmplz-categories .cmplz-category .cmplz-category-header .cmplz-category-title {
      font-weight: var(--weight-semibold) !important;
    }

    .cmplz-close:focus-visible {
      outline-offset: 4px;
      border-radius: 4px;
    }
  }
}
