/*
 * The design's shared classes (its <helmet><style> block), without !important:
 * inside @layer the utilities layer wins anyway, and nothing is inline.
 */
@layer components {
  /* Buttons and button-like links */
  /* touch-action: quick taps on ± never trigger double-tap zoom. */
  .pl-btn {
    cursor: pointer;
    touch-action: manipulation;
    transition: opacity var(--pl-ease), transform var(--pl-ease);
  }

  /* Hover only where a pointer can hover: on phones a tap would leave it stuck. */
  @media (hover: hover) {
    .pl-btn:hover {
      opacity: 0.86;
    }
  }

  .pl-btn:active {
    transform: scale(0.98);
  }

  /* aria-disabled: the ± steppers at a bound keep keyboard focus. */
  .pl-btn:disabled,
  .pl-btn[aria-disabled="true"] {
    opacity: 0.35;
    cursor: default;
    transform: none;
  }

  /* Focused controls stay clear of the sticky header (and show their label)
     when the browser scrolls them into view, e.g. on Shift+Tab. */
  .pl-input,
  .pl-btn,
  .pl-link,
  .pl-cta {
    scroll-margin-top: calc(var(--pl-header-h) + 40px);
  }

  .pl-btn:focus-visible,
  .pl-link:focus-visible,
  .pl-navlink:focus-visible,
  .pl-cta:focus-visible {
    outline: 3px solid var(--pl-ink);
    outline-offset: 3px;
    box-shadow: 0 0 0 3px var(--pl-paper);
  }

  /* Text links */
  .pl-link {
    transition: opacity var(--pl-ease);
  }

  @media (hover: hover) {
    .pl-link:hover {
      opacity: 0.7;
    }
  }

  /* Header nav links */
  .pl-navlink {
    transition: background-color var(--pl-ease);
  }

  @media (hover: hover) {
    .pl-navlink:hover {
      background-color: var(--pl-fill-dark);
    }
  }

  /* Form fields: the design's input look (inline styles in the mockup). */
  .pl-input {
    width: 100%;
    height: 54px;
    padding: 0 15px;
    border: 1.5px solid var(--pl-border);
    border-radius: var(--pl-r-input);
    background: var(--pl-paper);
    color: var(--pl-ink);
    font-family: inherit;
    font-size: 16px;
    font-weight: 500;
    transition: border-color var(--pl-ease), background-color var(--pl-ease), box-shadow var(--pl-ease);
  }

  textarea.pl-input {
    display: block;
    height: auto;
    min-height: 92px;
    padding: 14px 15px;
    line-height: 1.45;
    resize: vertical;
  }

  .pl-input::placeholder {
    color: var(--pl-placeholder);
    opacity: 1;
  }

  /* Invalid, then focus (same specificity, later wins): a focused invalid field is black on white. */
  .pl-input[aria-invalid="true"] {
    border-color: var(--pl-error);
  }

  .pl-input:focus {
    outline: none;
    border-color: var(--pl-ink);
    background-color: var(--pl-paper);
    box-shadow: 0 0 0 3px var(--pl-focus-halo);
  }

  /*
   * − count + of one product (basket/_stepper: hero rows and menu cards; the
   * checkout summary builds the same around its real input). 44px buttons.
   */
  .pl-stepper {
    flex: none;
    display: flex;
    align-items: center;
    gap: 2px;
  }

  .pl-step {
    width: 44px;
    height: 44px;
    padding: 0;
    border: 0;
    border-radius: var(--pl-r-pill);
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--pl-paper);
    color: var(--pl-ink);
  }

  /* The menu cards' + */
  .pl-step--green {
    background: var(--pl-green-800);
    color: var(--pl-paper);
  }

  /* On the green summary card */
  .pl-step--glass {
    background: var(--pl-fill-light-strong);
    color: var(--pl-paper);
  }

  .pl-stepper__count {
    min-width: 34px;
    text-align: center;
    font-size: 18px;
    font-weight: 800;
    line-height: 1;
  }

  /* "New" badge: small in the hero's rows, --lg on menu pictures and the product page. */
  .pl-new {
    padding: 1px 7px;
    border-radius: var(--pl-r-pill);
    background: var(--pl-yellow);
    color: var(--pl-ink);
    font-size: 11.5px;
    font-weight: 700;
    white-space: nowrap;
  }

  .pl-new--lg {
    padding: 3px 12px;
    font-size: 13px;
  }

  /* CTA tile arrow */
  .pl-arrow {
    transition: transform 0.2s ease;
  }

  @media (hover: hover) {
    .pl-cta:hover .pl-arrow {
      transform: translateX(4px);
    }
  }

  /* Two-column layout of the product page's "What's inside". */
  .pl-split {
    display: grid;
    grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr);
    gap: clamp(28px, 5vw, 72px);
    align-items: start;
  }

  /* The three steps: as many columns as fit 280px each. */
  .pl-steps {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(280px, 100%), 1fr));
    gap: 12px;
  }

  /* Checkout: details and summary side by side while both fit, else stacked
     (the columns' flex bases are in order.css). */
  .pl-checkout {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    gap: clamp(28px, 4.5vw, 64px);
  }

  .pl-sticky {
    position: sticky;
    top: var(--pl-sticky-top);
  }

  @media (max-width: 900px) {
    .pl-split {
      grid-template-columns: minmax(0, 1fr);
    }

    .pl-sticky {
      position: static;
    }
  }

  @media (prefers-reduced-motion: reduce) {
    .pl-btn,
    .pl-input,
    .pl-link,
    .pl-navlink,
    .pl-arrow {
      transition: none;
    }
  }
}

/* Last layer: these beat any section rule without !important. */
@layer utilities {
  [hidden] {
    display: none;
  }

  .pl-visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0 0 0 0);
    clip-path: inset(50%);
    white-space: nowrap;
    border: 0;
  }

  /* <html class="no-js"> until application.js has loaded the controllers. */
  .no-js .pl-js-only {
    display: none;
  }

  .js .pl-no-js-only {
    display: none;
  }

  @media (max-width: 900px) {
    .pl-hide-md {
      display: none;
    }
  }

  @media (max-width: 480px) {
    .pl-hide-sm {
      display: none;
    }
  }
}
