*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--cp-header-height) + var(--cp-space-sm));
}

body {
  margin: 0;
  background: var(--cp-page);
  color: var(--cp-ink);
  font-family: var(--cp-font-body);
  font-size: var(--cp-text-md);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

img,
svg,
canvas {
  display: block;
  max-width: 100%;
}

h1,
h2,
h3,
p,
dl,
dd,
figure {
  margin: 0;
}

a {
  color: inherit;
}

:focus-visible {
  outline: 3px solid var(--cp-amber);
  outline-offset: 3px;
}

/*
 * Form-control floor, REQ-22.
 *
 * This sits in base.css and not in a page stylesheet on purpose: every screen that can
 * render a field has to obey it, including the WooCommerce My Account forms, which the
 * theme does not otherwise style at all (they carried 13.33px inputs — QA F-08).
 *
 * The list is explicit rather than a bare `input` because `font-size` resizes a range
 * thumb, a radio and a checkbox too, and none of those zoom on focus — only a control
 * you can type into does. A later, more specific rule may raise this; nothing in the
 * theme may lower it, and tests/e2e/specs/control-font-size.cjs fails the suite if one does.
 */
input:not([type]),
input[type='text'],
input[type='email'],
input[type='tel'],
input[type='url'],
input[type='number'],
input[type='password'],
input[type='search'],
input[type='date'],
input[type='datetime-local'],
input[type='month'],
input[type='week'],
input[type='time'],
input[type='file'],
select,
textarea {
  font-size: var(--cp-control-font-min);
}

.cp-container {
  width: min(100% - var(--cp-gutter) * 2, var(--cp-container));
  margin-inline: auto;
}

.cp-visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.cp-skip {
  position: absolute;
  top: var(--cp-space-xs);
  left: var(--cp-space-xs);
  z-index: 100;
  padding: var(--cp-space-xs) var(--cp-space-sm);
  background: var(--cp-ink);
  color: var(--cp-sheet);
  transform: translateY(-200%);
}

.cp-skip:focus {
  transform: none;
}

.cp-display {
  font-family: var(--cp-font-display);
  font-weight: 400;
  line-height: 0.98;
  letter-spacing: 0.005em;
  text-transform: uppercase;
  text-wrap: balance;
}

/* Button: a race-plate block — square, framed, filled on hover. */
.cp-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 3.25rem;
  padding: 0 1.5rem;
  border: 2px solid var(--cp-ink);
  background: var(--cp-ink);
  color: var(--cp-sheet);
  font-family: var(--cp-font-body);
  font-size: var(--cp-text-md);
  font-weight: 600;
  line-height: 1;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  transition:
    background-color var(--cp-duration) var(--cp-ease),
    color var(--cp-duration) var(--cp-ease),
    box-shadow var(--cp-duration) var(--cp-ease),
    transform var(--cp-duration) var(--cp-ease);
}

.cp-button:hover {
  background: var(--cp-amber);
  color: var(--cp-ink);
  box-shadow: 4px 4px 0 var(--cp-ink);
  transform: translate(-2px, -2px);
}

.cp-button:active {
  box-shadow: 0 0 0 var(--cp-ink);
  transform: none;
}

.cp-button--amber {
  background: var(--cp-amber);
  color: var(--cp-ink);
}

.cp-button--amber:focus-visible {
  outline-color: var(--cp-ink);
}

.cp-button--ghost {
  background: transparent;
  color: var(--cp-ink);
}

.cp-button--small {
  min-height: 2.75rem;
  padding: 0 1.125rem;
  font-size: var(--cp-text-sm);
}

.cp-icon-link {
  display: grid;
  place-items: center;
  width: 2.75rem;
  height: 2.75rem;
  color: var(--cp-ink);
}

.cp-icon-link svg {
  width: 1.5rem;
  height: 1.5rem;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linejoin: round;
}

.cp-icon-link circle {
  fill: currentColor;
  stroke: none;
}

/*
 * Cart badge. It lives in base.css and not in shop.css because `header.php` renders it on
 * every page while shop.css is enqueued on the front page only — which is exactly how it
 * came to render as a bare underlined "1" under the cart icon on every other page.
 * `tests/e2e/specs/header-badge.cjs` fails if it ever drifts back into a page-scoped file.
 */
.cp-cart {
  position: relative;
}

.cp-cart__count {
  position: absolute;
  top: 0.125rem;
  right: 0;
  display: grid;
  place-items: center;
  min-width: 1.125rem;
  height: 1.125rem;
  padding: 0 0.25rem;
  border-radius: var(--cp-radius-pill);
  background: var(--cp-amber);
  /* Punches the pill out of the header bar so the digit stays legible over the icon. */
  box-shadow: 0 0 0 2px var(--cp-page);
  font-size: 0.6875rem;
  font-weight: 700;
}

.cp-cart__count[hidden] {
  display: none;
}

.cp-cart[data-bump='true'] .cp-cart__count {
  animation: cp-bump 360ms var(--cp-ease);
}

@keyframes cp-bump {
  40% {
    transform: scale(1.35);
  }
}

.cp-swatches {
  display: flex;
  gap: var(--cp-space-2xs);
}

.cp-swatch {
  width: 1.625rem;
  height: 1.625rem;
  padding: 0;
  border: 2px solid var(--cp-sheet);
  border-radius: var(--cp-radius-circle);
  background: var(--swatch);
  box-shadow: 0 0 0 1px var(--cp-line);
  cursor: pointer;
}

.cp-swatch[aria-checked='true'] {
  box-shadow: 0 0 0 2px var(--cp-ink);
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  /*
   * The flag is unavoidable here: `*` is the weakest selector there is, so every component
   * rule in the theme outranks it. A reader who asked their OS to stop motion outranks all
   * of them. 0.01ms rather than 0 so transitionend still fires and nothing that waits on it
   * hangs.
   */
  *,
  *::before,
  *::after {
    transition-duration: 0.01ms !important;
  }
}

/*
 * Account link in the header.
 *
 * The shop requires an account and sells order tracking, so "where do I see my order"
 * has to be answerable from any page. Signed in it carries the customer's name; signed
 * out it is the icon alone, so the header does not grow for a visitor who has no
 * account yet.
 */
/*
 * `.cp-icon-link` is a one-column grid sized for a single glyph. This link carries an
 * icon and a name, so it lays them out in a row and stops inheriting the underline the
 * global link style gives every anchor.
 */
.cp-account-link {
  display: inline-flex;
  flex-direction: row;
  gap: var(--cp-space-2xs);
  align-items: center;
  justify-content: center;
  width: auto;
  padding-inline: var(--cp-space-2xs);
  text-decoration: none;
}

.cp-account-link svg {
  flex: none;
}

.cp-account-link__name {
  max-width: 8rem;
  overflow: hidden;
  font-size: var(--cp-text-sm);
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

@media (max-width: 600px) {
  .cp-account-link__name {
    /* The header is tight on a phone; the icon alone still reaches the account. */
    display: none;
  }
}
