/* ==========================================================================
   InihaoStudio — components.css
   Reusable UI across all eight pages. Page-specific layout lives in
   css/pages/*.css. Depends on tokens.css and base.css.

   Contrast contract enforced here (measured against --paper):
     --ink   on --paper  15.6:1  body, headings, button labels
     --ink-2 on --paper   8.6:1  meta, secondary copy
     --teal  on --paper   5.5:1  links, quiet actions, category labels
     --ink-3 on --paper   4.2:1  FAILS body — decoration and >=18px only
     --accent on --paper  3.3:1  FAILS text — rules, fills, focus only
     --ink   on --accent  4.8:1  primary button label  <-- the reason
     --ink   on --marigold 9.4:1 badge ground
   Because --accent-ink on --accent is only 3.45:1, primary buttons use
   --ink. --accent-ink is reserved for >=19px semibold display type.
   ========================================================================== */

/* ---- Scroll lock ---------------------------------------------------- */

/* app.js and cart.js share one counter and set this attribute. base.css
   already reserves the scrollbar gutter on <html>, so locking does not
   shift the page horizontally — the CLS requirement in Section 11. */
html[data-scroll-lock="true"] {
  overflow: hidden;
}

/* ---- Cross-document transitions ------------------------------------- */

/* Native cross-fade between pages where supported. Browsers without it
   ignore the rule and navigate normally, so there is no blank-page
   failure mode and no JS interception to go wrong. Base.js style page
   scripts do not need to participate. */
@view-transition {
  navigation: auto;
}

@media (prefers-reduced-motion: reduce) {
  ::view-transition-group(*),
  ::view-transition-old(*),
  ::view-transition-new(*) {
    animation-duration: 1ms !important;
  }
}

/* ---- Buttons -------------------------------------------------------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  min-height: 48px;
  padding: var(--space-3) var(--space-5);
  border: 1.5px solid transparent;
  border-radius: var(--radius-sm);
  font-family: var(--font-body);
  font-size: var(--text-base);
  font-weight: 600;
  line-height: 1.1;
  letter-spacing: -0.005em;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  transition: background-color var(--dur-fast) var(--ease-out),
              border-color var(--dur-fast) var(--ease-out),
              color var(--dur-fast) var(--ease-out),
              transform var(--dur-fast) var(--ease-out);
}

.btn:active {
  transform: translateY(1px);
}

.btn[disabled],
.btn[aria-disabled="true"] {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

/* Primary: --ink label on --accent ground, 4.8:1. */
.btn--primary {
  background-color: var(--accent);
  border-color: var(--accent);
  color: var(--ink);
}

.btn--primary:hover {
  background-color: var(--ink);
  border-color: var(--ink);
  color: var(--paper);
}

/* Secondary: outlined, ink label. */
.btn--secondary {
  background-color: transparent;
  border-color: var(--ink);
  color: var(--ink);
}

.btn--secondary:hover {
  background-color: var(--ink);
  color: var(--paper);
}

/* Ghost: text-only, for in-flow actions that should not shout. */
.btn--ghost {
  background-color: transparent;
  border-color: transparent;
  color: var(--teal);
  padding-inline: var(--space-2);
}

.btn--ghost:hover {
  color: var(--ink);
  text-decoration: underline;
  text-underline-offset: 0.18em;
}

.btn--block {
  display: flex;
  width: 100%;
}

.btn--sm {
  min-height: 44px;
  padding: var(--space-2) var(--space-4);
  font-size: var(--text-sm);
}

/* Icon-only. Always pair with an accessible label. */
.btn--icon {
  min-width: 44px;
  min-height: 44px;
  padding: 0;
  border-radius: var(--radius-sm);
  background-color: transparent;
  border-color: transparent;
  color: var(--ink);
}

.btn--icon:hover {
  background-color: var(--paper-2);
}

.btn__icon {
  width: 20px;
  height: 20px;
  flex: 0 0 auto;
}

/* ---- Badges and pills ----------------------------------------------- */

.badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: 0.2em 0.55em;
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  font-weight: 500;
  line-height: 1.4;
  letter-spacing: 0.02em;
  text-transform: none;
  white-space: nowrap;
}

/* Instant-download markers read as informational, not promotional. */
.badge--info {
  background-color: var(--paper-2);
  color: var(--teal);
}

/* Category label. Colour by ground, never as body text. */
.badge--cat {
  font-family: var(--font-body);
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  background-color: var(--paper-2);
  color: var(--ink-2);
}

.badge--cat[data-category="templates"] {
  box-shadow: inset 3px 0 0 var(--accent);
}

.badge--cat[data-category="courses"] {
  box-shadow: inset 3px 0 0 var(--teal);
}

.badge--cat[data-category="ebooks"] {
  box-shadow: inset 3px 0 0 var(--marigold);
}

.badge--cat[data-category="printables"] {
  box-shadow: inset 3px 0 0 var(--ink-2);
}

.pill-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  align-items: center;
}

/* ---- Media frame ---------------------------------------------------- */

.media {
  position: relative;
  display: block;
  overflow: hidden;
  background-color: var(--paper-2);
  border-radius: var(--radius-md);
  aspect-ratio: 4 / 5;
}

.media img,
.media svg {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform var(--dur-slow) var(--ease-out);
}

.media--wide {
  aspect-ratio: 16 / 10;
}

.media--square {
  aspect-ratio: 1 / 1;
}

/* Placeholder covers get a label so they are never mistaken for art. */
.media.is-placeholder::after {
  content: "Placeholder cover";
  position: absolute;
  left: var(--space-2);
  bottom: var(--space-2);
  padding: 0.15em 0.5em;
  border-radius: var(--radius-sm);
  background-color: var(--paper);
  color: var(--ink-2);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  pointer-events: none;
}

/* ---- Product card --------------------------------------------------- */

.product-card {
  position: relative;
  display: flex;
  flex-direction: column;
  height: 100%;
  background-color: var(--paper);
  border-radius: var(--radius-md);
}

.product-card__link {
  display: flex;
  flex-direction: column;
  flex: 1;
  color: inherit;
  text-decoration: none;
}

.product-card__link:hover .media img,
.product-card__link:focus-visible .media img {
  transform: scale(1.03);
}

.product-card__link:hover .product-card__title {
  text-decoration: underline;
  text-underline-offset: 0.16em;
  text-decoration-thickness: 1px;
}

.product-card__body {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  flex: 1;
  padding-top: var(--space-4);
}

.product-card__eyebrow {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-xs);
  color: var(--ink-2);
}

.product-card__title {
  font-family: var(--font-display);
  font-size: var(--text-lg);
  font-weight: 600;
  line-height: var(--leading-snug);
  letter-spacing: -0.01em;
  color: var(--ink);
  text-wrap: balance;
}

.product-card__meta {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--ink-2);
  font-variant-numeric: tabular-nums;
}

.product-card__foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  margin-top: auto;
  padding-top: var(--space-3);
}

.price {
  font-family: var(--font-display);
  font-size: var(--text-lg);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--ink);
}

.price--compare {
  font-family: var(--font-body);
  font-size: var(--text-sm);
  font-weight: 400;
  color: var(--ink-2);
  text-decoration: line-through;
  margin-left: var(--space-2);
}

/* --accent on --paper is 3.3:1 — legal for this >=18px display figure
   and for nothing else in the card. */
.price--accent {
  color: var(--accent);
  font-size: var(--text-2xl);
}

/* ---- Category card (asymmetric bento, Section 6 index.html) --------- */

.category-card {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  min-height: 220px;
  padding: var(--space-5);
  border-radius: var(--radius-lg);
  background-color: var(--paper-2);
  color: var(--ink);
  text-decoration: none;
  overflow: hidden;
  isolation: isolate;
  transition: transform var(--dur-base) var(--ease-out);
}

.category-card::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background-color: var(--paper-2);
  transition: background-color var(--dur-base) var(--ease-out);
}

.category-card:hover::before {
  background-color: var(--paper-3);
}

.category-card:active {
  transform: scale(0.995);
}

.category-card__label {
  font-family: var(--font-display);
  font-size: var(--text-2xl);
  font-weight: 600;
  line-height: var(--leading-tight);
  letter-spacing: -0.015em;
}

.category-card__count {
  margin-top: var(--space-1);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--ink-2);
}

.category-card__rule {
  height: 4px;
  width: 40px;
  margin-bottom: var(--space-4);
  border-radius: 999px;
  background-color: var(--accent);
}

.category-card[data-category="courses"] .category-card__rule {
  background-color: var(--teal);
}

.category-card[data-category="ebooks"] .category-card__rule {
  background-color: var(--marigold);
}

.category-card[data-category="printables"] .category-card__rule {
  background-color: var(--ink-2);
}

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

.site-header {
  position: sticky;
  top: 0;
  z-index: var(--z-sticky);
  background-color: var(--paper);
  border-bottom: 1px solid transparent;
  transition: border-color var(--dur-fast) var(--ease-out),
              background-color var(--dur-fast) var(--ease-out);
}

.site-header.is-scrolled {
  border-bottom-color: var(--line);
}

.site-header__inner {
  display: flex;
  align-items: center;
  gap: var(--space-5);
  min-height: var(--header-h);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  margin-right: auto;
  color: var(--ink);
  font-family: var(--font-display);
  font-size: var(--text-lg);
  font-weight: 600;
  letter-spacing: -0.02em;
  text-decoration: none;
  min-height: 44px;
}

.brand__mark {
  width: 28px;
  height: 34px;
  flex: 0 0 auto;
  background: url("../brand/inihao-mark-112.png") center / contain no-repeat;
}

/* The lockup: heavy serif wordmark with the quieter Studio beneath it,
   matching the logotype in assets/brand/logo-source.png. */
.brand__word {
  display: inline-flex;
  align-items: baseline;
  gap: 0.32em;
}

.brand__name {
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: -0.03em;
}

.brand__sub {
  font-family: var(--font-body);
  font-weight: 500;
  font-size: 0.72em;
  letter-spacing: 0.09em;
  color: inherit;
  opacity: 0.68;
}

.nav {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.nav__link {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  min-height: 44px;
  padding-inline: var(--space-3);
  border-radius: var(--radius-sm);
  color: var(--ink);
  font-size: var(--text-sm);
  font-weight: 600;
  text-decoration: none;
  transition: background-color var(--dur-fast) var(--ease-out);
}

.nav__link:hover {
  background-color: var(--paper-2);
}

.nav__link[aria-current="page"] {
  box-shadow: inset 0 -2px 0 var(--accent);
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
}

.nav__chevron {
  width: 12px;
  height: 12px;
  transition: transform var(--dur-fast) var(--ease-out);
}

/* ---- Mega-menu (Hallmark N11) --------------------------------------- */

.mega {
  position: absolute;
  inset-inline: 0;
  top: 100%;
  background-color: var(--paper);
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  box-shadow: var(--shadow-md);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-6px);
  transition: opacity var(--dur-fast) var(--ease-out),
              transform var(--dur-fast) var(--ease-out),
              visibility 0s linear var(--dur-fast);
}

.mega.is-open {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
  transition-delay: 0s;
}

.mega__inner {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr)) 1.4fr;
  gap: var(--space-6);
  padding-block: var(--space-6);
}

.mega__col-title {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--ink-2);
  margin-bottom: var(--space-3);
}

.mega__list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: var(--space-1);
}

.mega__item {
  display: block;
  padding: var(--space-2);
  border-radius: var(--radius-sm);
  color: var(--ink);
  font-size: var(--text-sm);
  text-decoration: none;
}

.mega__item:hover {
  background-color: var(--paper-2);
}

.mega__item span {
  display: block;
  color: var(--ink-2);
  font-size: var(--text-xs);
  margin-top: 2px;
}

.mega__feature {
  padding: var(--space-4);
  border-radius: var(--radius-md);
  background-color: var(--paper-2);
}

.mega__feature-title {
  font-family: var(--font-display);
  font-size: var(--text-lg);
  font-weight: 600;
  margin-block: var(--space-3) var(--space-2);
}

.mega-backdrop {
  position: fixed;
  inset: 0;
  z-index: calc(var(--z-sticky) - 1);
  background-color: rgba(28, 25, 21, 0.18);
  opacity: 0;
  visibility: hidden;
  transition: opacity var(--dur-fast) var(--ease-out),
              visibility 0s linear var(--dur-fast);
}

.mega-backdrop.is-open {
  opacity: 1;
  visibility: visible;
  transition-delay: 0s;
}

/* ---- Mobile menu ---------------------------------------------------- */

.menu-toggle {
  display: none;
}

.mobile-menu {
  position: fixed;
  inset: 0;
  z-index: var(--z-modal);
  display: flex;
  flex-direction: column;
  padding: var(--space-5) var(--gutter) var(--space-8);
  background-color: var(--paper);
  opacity: 0;
  visibility: hidden;
  transition: opacity var(--dur-base) var(--ease-out),
              visibility 0s linear var(--dur-base);
}

.mobile-menu.is-open {
  opacity: 1;
  visibility: visible;
  transition-delay: 0s;
}

.mobile-menu__top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: var(--header-h);
}

.mobile-menu__list {
  list-style: none;
  margin: var(--space-6) 0 0;
  padding: 0;
}

.mobile-menu__list li {
  margin: 0;
  border-bottom: 1px solid var(--line);
}

.mobile-menu__link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 64px;
  color: var(--ink);
  font-family: var(--font-display);
  font-size: var(--text-2xl);
  font-weight: 600;
  letter-spacing: -0.02em;
  text-decoration: none;
  /* Staggered reveal — index supplied by app.js as --i. */
  opacity: 0;
  transform: translateY(10px);
  transition: opacity var(--dur-base) var(--ease-out),
              transform var(--dur-base) var(--ease-out);
  transition-delay: calc(var(--i, 0) * 40ms);
}

.mobile-menu.is-open .mobile-menu__link {
  opacity: 1;
  transform: translateY(0);
}

.mobile-menu__link small {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  font-weight: 400;
  color: var(--ink-2);
}

.mobile-menu__foot {
  margin-top: auto;
  padding-top: var(--space-6);
}

@media (max-width: 899px) {
  .nav,
  .mega,
  .mega-backdrop {
    display: none;
  }

  .menu-toggle {
    display: inline-flex;
  }
}

@media (min-width: 900px) {
  .mobile-menu {
    display: none;
  }
}

/* ---- Cart badge ----------------------------------------------------- */

.cart-button {
  position: relative;
}

.cart-badge {
  position: absolute;
  top: 2px;
  right: 0;
  min-width: 18px;
  height: 18px;
  padding-inline: 4px;
  border-radius: 999px;
  background-color: var(--accent);
  color: var(--ink);
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  font-weight: 600;
  line-height: 18px;
  text-align: center;
  font-variant-numeric: tabular-nums;
  transform: scale(0);
  transition: transform var(--dur-fast) var(--ease-out);
}

.cart-badge.is-visible {
  transform: scale(1);
}

/* --ease-spring overshoots past 1.0. Decorative settle only: this is the
   single place it is allowed, because a badge pop is not a control. */
.cart-badge.is-pop {
  animation: badge-pop var(--dur-base) var(--ease-spring) 1;
}

@keyframes badge-pop {
  0%   { transform: scale(1); }
  45%  { transform: scale(1.35); }
  100% { transform: scale(1); }
}

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

.cart-backdrop {
  position: fixed;
  inset: 0;
  z-index: calc(var(--z-drawer) - 1);
  background-color: rgba(28, 25, 21, 0.38);
  opacity: 0;
  visibility: hidden;
  transition: opacity var(--dur-base) var(--ease-out),
              visibility 0s linear var(--dur-base);
  overscroll-behavior: contain;
}

.cart-backdrop.is-open {
  opacity: 1;
  visibility: visible;
  transition-delay: 0s;
}

.cart-drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  z-index: var(--z-drawer);
  display: flex;
  flex-direction: column;
  width: min(420px, 100vw);
  background-color: var(--paper);
  border-left: 1px solid var(--line);
  transform: translateX(100%);
  visibility: hidden;
  transition: transform var(--dur-base) var(--ease-out),
              visibility 0s linear var(--dur-base);
  overscroll-behavior: contain;
}

.cart-drawer.is-open {
  transform: translateX(0);
  visibility: visible;
  transition-delay: 0s;
}

.cart-drawer__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  padding: var(--space-4) var(--space-5);
  border-bottom: 1px solid var(--line);
}

.cart-drawer__title {
  font-family: var(--font-display);
  font-size: var(--text-xl);
  font-weight: 600;
  letter-spacing: -0.015em;
}

.cart-drawer__count {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--ink-2);
}

.cart-drawer__body {
  flex: 1;
  overflow-y: auto;
  padding: var(--space-4) var(--space-5);
  -webkit-overflow-scrolling: touch;
}

.cart-drawer__foot {
  padding: var(--space-4) var(--space-5) var(--space-5);
  border-top: 1px solid var(--line);
  background-color: var(--paper);
}

.cart-line {
  display: grid;
  grid-template-columns: 56px 1fr auto;
  gap: var(--space-3);
  padding-block: var(--space-4);
  border-bottom: 1px solid var(--line);
}

.cart-line:first-child {
  padding-top: 0;
}

.cart-line:last-child {
  border-bottom: 0;
}

.cart-line__thumb {
  width: 56px;
  aspect-ratio: 4 / 5;
  border-radius: var(--radius-sm);
  object-fit: cover;
  background-color: var(--paper-2);
}

.cart-line__title {
  font-family: var(--font-display);
  font-size: var(--text-base);
  font-weight: 600;
  line-height: var(--leading-snug);
  color: var(--ink);
  text-decoration: none;
}

.cart-line__title:hover {
  text-decoration: underline;
  text-underline-offset: 0.16em;
}

.cart-line__meta {
  margin-top: 2px;
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--ink-2);
}

.cart-line__price {
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.cart-line__controls {
  grid-column: 2 / -1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  margin-top: var(--space-2);
}

/* Quantity stepper — 44px targets, no keyboard traps. */
.qty {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.qty__btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  background-color: transparent;
  color: var(--ink);
  border: 0;
  font-size: var(--text-lg);
  line-height: 1;
  cursor: pointer;
  transition: background-color var(--dur-fast) var(--ease-out);
}

.qty__btn:hover {
  background-color: var(--paper-2);
}

.qty__btn:disabled {
  color: var(--ink-3);
  cursor: not-allowed;
}

.qty__value {
  min-width: 32px;
  text-align: center;
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  font-variant-numeric: tabular-nums;
}

.cart-line__remove {
  background: none;
  border: 0;
  padding: var(--space-2);
  min-height: 44px;
  color: var(--ink-2);
  font-size: var(--text-sm);
  text-decoration: underline;
  text-underline-offset: 0.18em;
  cursor: pointer;
}

.cart-line__remove:hover {
  color: var(--ink);
}

.cart-totals {
  display: grid;
  gap: var(--space-2);
  margin-bottom: var(--space-4);
}

.cart-totals__row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--space-3);
  font-size: var(--text-sm);
  color: var(--ink-2);
}

.cart-totals__row--grand {
  padding-top: var(--space-2);
  border-top: 1px solid var(--line);
  color: var(--ink);
  font-size: var(--text-lg);
  font-weight: 600;
}

.cart-totals__row--grand span:last-child {
  font-family: var(--font-display);
  font-variant-numeric: tabular-nums;
}

/* ---- Empty state ---------------------------------------------------- */

.empty {
  display: grid;
  justify-items: center;
  gap: var(--space-3);
  padding: var(--space-8) var(--space-4);
  text-align: center;
}

.empty__title {
  font-family: var(--font-display);
  font-size: var(--text-xl);
  font-weight: 600;
}

.empty__body {
  max-width: 34ch;
  color: var(--ink-2);
  font-size: var(--text-sm);
}

.empty__mark {
  width: 56px;
  height: 56px;
  margin-bottom: var(--space-2);
  border-radius: var(--radius-md);
  background-color: var(--paper-2);
  box-shadow: inset 0 0 0 1px var(--line);
}

/* ---- Filters -------------------------------------------------------- */

.filter-bar {
  position: sticky;
  top: var(--header-h);
  z-index: calc(var(--z-sticky) - 1);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-3);
  padding-block: var(--space-3);
  background-color: var(--paper);
  border-bottom: 1px solid var(--line);
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  min-height: 44px;
  padding: var(--space-2) var(--space-4);
  border: 1px solid var(--line);
  border-radius: 999px;
  background-color: transparent;
  color: var(--ink-2);
  font-size: var(--text-sm);
  font-weight: 600;
  cursor: pointer;
  transition: background-color var(--dur-fast) var(--ease-out),
              border-color var(--dur-fast) var(--ease-out),
              color var(--dur-fast) var(--ease-out);
}

.chip:hover {
  border-color: var(--ink-2);
  color: var(--ink);
}

.chip[aria-pressed="true"] {
  background-color: var(--ink);
  border-color: var(--ink);
  color: var(--paper);
}

.chip[disabled] {
  opacity: 0.45;
  cursor: not-allowed;
}

.chip__x {
  width: 12px;
  height: 12px;
}

.search {
  position: relative;
  flex: 1 1 220px;
  min-width: 0;
}

.search input {
  width: 100%;
  padding-left: var(--space-6);
}

.search__icon {
  position: absolute;
  left: var(--space-3);
  top: 50%;
  width: 16px;
  height: 16px;
  transform: translateY(-50%);
  color: var(--ink-2);
  pointer-events: none;
}

.filter-count {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--ink-2);
  margin-left: auto;
}

/* ---- Fields --------------------------------------------------------- */

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

.label {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--ink);
}

.hint {
  font-size: var(--text-xs);
  color: var(--ink-2);
}

.error-text {
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--accent);
}

/* ---- Consent checkbox ----------------------------------------------- */

.field--check {
  gap: var(--space-1);
  margin-block: var(--space-2) var(--space-4);
}

.check {
  display: flex;
  gap: var(--space-2);
  align-items: flex-start;
  cursor: pointer;
}

.check input[type="checkbox"] {
  flex: none;
  width: 1.25rem;
  height: 1.25rem;
  min-height: 0;
  margin: 0.15em 0 0;
  padding: 0;
  border: 0;
  background: none;
  accent-color: var(--accent);
  cursor: pointer;
}

.check span {
  font-size: var(--text-sm);
  line-height: var(--leading-body);
  color: var(--ink-2);
  max-width: 56ch;
}

.check a {
  color: var(--ink);
  text-decoration: underline;
  text-underline-offset: 2px;
  text-decoration-thickness: 1px;
}

.check a:hover {
  color: var(--accent);
}

.field.has-error input {
  border-color: var(--accent);
}

.select {
  appearance: none;
  background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath d='M2 4l4 4 4-4' fill='none' stroke='%234A443B' stroke-width='1.5' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right var(--space-3) center;
  padding-right: var(--space-7);
}

/* ---- Breadcrumbs ---------------------------------------------------- */

.breadcrumbs {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-1);
  padding-block: var(--space-3);
  font-size: var(--text-xs);
  color: var(--ink-2);
}

.breadcrumbs ol {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-1);
  list-style: none;
  margin: 0;
  padding: 0;
}

.breadcrumbs li + li {
  margin: 0;
}

.breadcrumbs li + li::before {
  content: "/";
  margin-right: var(--space-1);
  color: var(--ink-3);
}

/* Padded out to a 44px touch target; the negative margin keeps the
   visual rhythm of the trail unchanged. */
.breadcrumbs a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  margin-block: -14px;
  color: var(--ink-2);
  text-decoration: none;
}

.breadcrumbs a:hover {
  color: var(--ink);
  text-decoration: underline;
  text-underline-offset: 0.16em;
}

.breadcrumbs [aria-current="page"] {
  color: var(--ink);
  font-weight: 600;
}

/* ---- Footer (Hallmark Ft5 Statement) -------------------------------- */

.site-footer {
  margin-top: var(--space-8);
  padding-block: var(--space-7) var(--space-5);
  border-top: 1px solid var(--line);
  background-color: var(--paper-2);
}

.site-footer__statement {
  font-family: var(--font-display);
  font-size: var(--text-2xl);
  font-weight: 600;
  line-height: var(--leading-snug);
  letter-spacing: -0.02em;
  max-width: 34ch;
  text-wrap: balance;
  margin-bottom: var(--space-5);
}

.site-footer__cols {
  display: grid;
  grid-template-columns: minmax(0, 1fr) repeat(4, max-content);
  column-gap: clamp(1.5rem, 2.6vw, 2.5rem);
  row-gap: var(--space-5);
  align-content: start;
}

.site-footer__cols > div:first-child .hint {
  max-width: 44ch;
}

.site-footer__col-title {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  line-height: 1.3;
  color: var(--ink-2);
  margin-bottom: 0.5rem;
}

.site-footer__list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  row-gap: 0.125rem;
}

.site-footer__list li + li {
  margin-top: 0;
}

.site-footer__list a {
  display: inline-flex;
  align-items: center;
  min-height: 1.5rem;
  color: var(--ink);
  font-size: var(--text-sm);
  line-height: 1.4;
  text-decoration: none;
}

@media (pointer: coarse) {
  .site-footer__list a {
    min-height: 44px;
  }
}

.site-footer__list a:hover {
  text-decoration: underline;
  text-underline-offset: 0.18em;
  text-decoration-color: var(--accent);
}

.site-footer__base {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  margin-top: var(--space-6);
  padding-top: var(--space-4);
  border-top: 1px solid var(--line);
  font-size: var(--text-xs);
  color: var(--ink-2);
}

.site-footer__base > * {
  margin: 0;
}

/* ---- Whop trust pill ------------------------------------------------ */

.trust-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.5em;
  padding: 0.4em 0.85em;
  border: 1px solid var(--line);
  border-radius: 999px;
  background-color: var(--paper);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  line-height: 1.2;
  letter-spacing: 0.01em;
  color: var(--ink-2);
  text-decoration: none;
  white-space: nowrap;
}

.trust-pill svg {
  flex: none;
  color: var(--accent);
}

.trust-pill--block {
  display: flex;
  width: 100%;
  margin-top: var(--space-3);
  justify-content: center;
  white-space: normal;
  text-align: center;
}

/* Desktop: statement + brand stack on the left, link columns sit beside
   them from the top, so no empty band opens up beside the statement. */
@media (min-width: 900px) {
  .site-footer > .shell {
    display: grid;
    grid-template-columns: minmax(0, 1fr) repeat(4, max-content);
    column-gap: clamp(1.5rem, 2.6vw, 2.5rem);
    align-items: start;
  }

  .site-footer__cols {
    display: contents;
  }

  .site-footer__statement {
    grid-column: 1;
    grid-row: 1;
    margin-bottom: var(--space-4);
  }

  .site-footer__cols > :first-child {
    grid-column: 1;
    grid-row: 2;
  }

  .site-footer__cols > :nth-child(2) { grid-column: 2; grid-row: 1 / span 2; }
  .site-footer__cols > :nth-child(3) { grid-column: 3; grid-row: 1 / span 2; }
  .site-footer__cols > :nth-child(4) { grid-column: 4; grid-row: 1 / span 2; }
  .site-footer__cols > :nth-child(5) { grid-column: 5; grid-row: 1 / span 2; }

  .site-footer__base {
    grid-column: 1 / -1;
    grid-row: 3;
  }
}

@media (max-width: 899px) {
  .site-footer__cols {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 899px) {
  .site-footer__cols > :first-child {
    grid-column: 1 / -1;
  }
}

@media (max-width: 599px) {
  .site-footer__statement {
    font-size: var(--text-xl);
  }

  .site-footer__base {
    flex-direction: column;
    align-items: flex-start;
  }
}

/* ---- Diagram frame (Section 5) -------------------------------------- */

.diagram {
  position: relative;
  width: 100%;
  margin-block: var(--space-6);
  padding: var(--space-5);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background-color: var(--paper);
  overflow: hidden;
}

.diagram svg {
  width: 100%;
  height: auto;
  overflow: visible;
}

.diagram__caption {
  margin-top: var(--space-4);
  font-size: var(--text-xs);
  color: var(--ink-2);
  max-width: 60ch;
}

/* Path-draw on scroll hooks: app.js adds .is-drawn. */
.diagram .draw-path {
  stroke-dasharray: var(--len, 1000);
  stroke-dashoffset: var(--len, 1000);
  transition: stroke-dashoffset var(--dur-slow) var(--ease-out);
}

.diagram.is-drawn .draw-path {
  stroke-dashoffset: 0;
}

/* Diagrams never scroll horizontally — they stack (Section 11). */
@media (max-width: 599px) {
  .diagram {
    padding: var(--space-3);
  }
}

/* ---- Toast ---------------------------------------------------------- */

.toast {
  position: fixed;
  left: 50%;
  bottom: var(--space-5);
  z-index: var(--z-toast);
  display: flex;
  align-items: center;
  gap: var(--space-3);
  max-width: calc(100vw - var(--space-6));
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-md);
  background-color: var(--ink);
  color: var(--paper);
  font-size: var(--text-sm);
  box-shadow: var(--shadow-lg);
  opacity: 0;
  transform: translate(-50%, 12px);
  visibility: hidden;
  transition: opacity var(--dur-fast) var(--ease-out),
              transform var(--dur-fast) var(--ease-out),
              visibility 0s linear var(--dur-fast);
}

.toast.is-open {
  opacity: 1;
  transform: translate(-50%, 0);
  visibility: visible;
  transition-delay: 0s;
}

.toast a {
  color: var(--marigold);
  font-weight: 600;
}

/* ---- Reveal utilities (Section 8 choreography) ---------------------- */

/* Default state is visible. JS opts in by adding .reveal, so a page with
   no JS or a failed script tag can never end up blank. */
.reveal {
  opacity: 0;
  transform: translateY(14px);
  transition: opacity var(--dur-base) var(--ease-out),
              transform var(--dur-base) var(--ease-out);
}

.reveal.is-in {
  opacity: 1;
  transform: none;
}

.reveal[data-stagger] {
  transition-delay: calc(var(--i, 0) * 60ms);
}

@media (prefers-reduced-motion: reduce) {
  .reveal {
    opacity: 1;
    transform: none;
    transition-delay: 0ms;
  }

  .mobile-menu__link {
    transform: none;
    transition-delay: 0ms;
  }

  .product-card__link:hover .media img {
    transform: none;
  }

  .diagram .draw-path {
    stroke-dashoffset: 0;
  }

  .cart-drawer,
  .mobile-menu,
  .mega,
  .mega-backdrop,
  .toast {
    transition-duration: 1ms;
  }
}

/* ---- Stacking sheets (deck) -----------------------------------------
   Shared by home and shop. Geometry lifted verbatim from the homepage:
   the slots dissolve so every sheet is a sticky sibling of one container,
   each pins on arrival and later sheets pile over earlier ones. The page
   supplies the shell geometry (.stack radius, margins) and the sheets. */

.fill-display {
  background-image: linear-gradient(180deg, var(--ink-3) 0%, var(--paper) 92%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
}

.stack {
  position: relative;
  z-index: 2;
  padding: clamp(3rem, 7vw, 6rem) 0 clamp(3rem, 7vw, 5rem);
  background-color: var(--ink);
  color: var(--paper);
}

.stack__title {
  max-width: 14ch;
  margin: 0 auto clamp(2rem, 5vw, 4rem);
  padding-inline: var(--gutter);
  font-family: var(--font-display);
  font-size: clamp(2.2rem, 8.5vw, 7.5rem);
  font-weight: 600;
  line-height: 0.88;
  letter-spacing: -0.045em;
  text-align: center;
  text-transform: uppercase;
}

.stack__slots {
  position: relative;
  padding-inline: var(--gutter);
  padding-bottom: clamp(3rem, 12vh, 8rem);
}

.stack__slot {
  display: contents;
}

.stack__card + .stack__card,
.stack__slot + .stack__slot > .stack__card {
  margin-top: clamp(14rem, 48vh, 30rem);
}

.stack__card {
  position: sticky;
  top: calc(var(--header-h) + 1.25rem + var(--i, 0) * 26px);
  padding: clamp(0.85rem, 1.8vw, 1.6rem);
  border: 2px solid rgba(231, 218, 198, 0.28);
  border-radius: clamp(1.25rem, 3.4vw, 2.75rem);
  background-color: var(--ink);
  transform-origin: top center;
  will-change: transform;
}

.stack__top {
  display: flex;
  align-items: center;
  gap: clamp(0.75rem, 2vw, 1.75rem);
  padding-bottom: clamp(0.7rem, 1.6vw, 1.4rem);
}

.stack__num {
  flex: none;
  font-family: var(--font-display);
  font-size: clamp(1.8rem, 5vw, 4.25rem);
  font-weight: 600;
  line-height: 0.8;
  letter-spacing: -0.05em;
}

.stack__id {
  display: grid;
  gap: 0.15rem;
  margin-right: auto;
  min-width: 0;
}

.stack__cat {
  margin: 0;
  color: var(--paper-3);
  font-size: clamp(0.75rem, 1vw, 0.8125rem);
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.stack__name {
  margin: 0;
  font-size: clamp(1rem, 2.1vw, 1.75rem);
  font-weight: 600;
  line-height: 1.1;
}

/* Written as a button too: on shop the same control applies a category
   filter in place, on home it is a link to the filtered grid. */
.stack__btn {
  flex: none;
  display: inline-flex;
  align-items: center;
  padding: 0.6em 1.2em;
  border: 1.5px solid var(--paper-3);
  border-radius: 999px;
  background-color: transparent;
  color: var(--paper-3);
  font-family: inherit;
  font-size: clamp(0.75rem, 1.05vw, 0.8125rem);
  font-weight: 600;
  letter-spacing: 0.08em;
  line-height: 1.2;
  text-transform: uppercase;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  transition: background-color var(--dur-fast) var(--ease-out),
              color var(--dur-fast) var(--ease-out);
}

.stack__btn:hover {
  background-color: var(--paper-3);
  color: var(--ink);
}

.stack__btn:focus-visible {
  outline: 2px solid var(--marigold);
  outline-offset: 3px;
}

.stack__grid {
  --stack-gap: clamp(0.4rem, 1vw, 0.85rem);
  --stack-r: clamp(0.9rem, 2.4vw, 2rem);
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--stack-gap);
}

.stack__shot {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 5;
  object-fit: cover;
  border-radius: var(--stack-r);
  background-color: var(--paper-2);
}

@media (max-width: 767px) {
  .stack__slot + .stack__slot > .stack__card {
    margin-top: 38vh;
  }

  .stack__slots {
    padding-bottom: 32vh;
  }

  .stack__card {
    top: calc(var(--header-h) + 0.75rem + var(--i, 0) * 16px);
  }

  /* The shelf action drops onto its own row rather than crushing the name
     into a narrow column beside it. */
  .stack__top {
    flex-wrap: wrap;
    row-gap: 0.7rem;
  }

  .stack__btn {
    order: 2;
    flex: 1 1 100%;
    justify-content: center;
    min-height: 44px;
  }

  /* Two stacked on the left, one tall on the right. Auto-placement would
     drop the third shot under the first and leave a hole beside it. */
  .stack__grid {
    grid-template-columns: 0.42fr 0.58fr;
    grid-template-rows: 0.44fr 0.56fr;
  }

  .stack__grid > .stack__shot:nth-child(1) {
    grid-column: 1;
    grid-row: 1;
  }

  .stack__grid > .stack__shot:nth-child(2) {
    grid-column: 2;
    grid-row: 1 / span 2;
  }

  .stack__grid > .stack__shot:nth-child(3) {
    grid-column: 1;
    grid-row: 2;
  }

  /* The grid needs a height to divide, since the images are no longer
     sized by a shared aspect ratio alone. */
  .stack__grid {
    aspect-ratio: 4 / 5;
  }

  .stack__shot {
    height: 100%;
    aspect-ratio: auto;
  }
}

@media (prefers-reduced-motion: reduce) {
  .stack__card {
    transform: none !important;
    will-change: auto;
  }
}