/* ==========================================================================
   HNGIA Mobile — Components
   Luxury Editorial Commerce · Quiet Luxury Minimalism
   ========================================================================== */

/* --------------------------------------------------------------------------
   Sticky header — centered wordmark
   -------------------------------------------------------------------------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: var(--z-sticky);
  background: rgba(247, 243, 239, 0.86);
  -webkit-backdrop-filter: saturate(150%) blur(16px);
  backdrop-filter: saturate(150%) blur(16px);
  padding-top: var(--sa-top);
  border-bottom: 1px solid transparent;
  transition: border-color var(--dur-base) var(--ease-out);
}

/* A hairline only appears once the page has scrolled. */
.site-header.is-stuck {
  border-bottom-color: var(--c-border);
}

.header-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-4);
  padding: 14px var(--screen-pad) 8px;
}

/* --- Wordmark --- */
.brand-lockup {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  min-width: 0;
}

.brand-name {
  font-family: var(--font-display);
  font-size: 1.625rem; /* 26px */
  line-height: 1;
  font-weight: 600;
  letter-spacing: 0.14em;
  color: var(--c-text);
  text-transform: uppercase;
}

/* Thin rule under the wordmark — a fashion-editorial device. */
.brand-rule {
  width: 22px;
  height: 1px;
  background: var(--c-accent);
  margin-top: 5px;
}

.brand-sub {
  margin-top: 7px;
  font-size: var(--fs-micro);
  line-height: 1.5;
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
  color: var(--c-text-subtle);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* --------------------------------------------------------------------------
   Search bar
   -------------------------------------------------------------------------- */
.search {
  /* 10px of air above the field so it does not read as one stuck-together
     element with the wordmark, and 4px below so it separates cleanly from
     the section title and the product grid underneath. */
  padding: 10px var(--screen-pad) 4px;
}

.search-box {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 46px;
  padding: 0 8px 0 15px;
  /* A narrower, centred field reads as an editorial inset rather than a
     full-bleed utility bar — it balances against the wordmark above. */
  max-width: 296px;
  margin: 0 auto;
  background: var(--c-bg);
  border: 1px solid var(--c-border);
  border-radius: var(--r-input);
  transition: border-color var(--dur-base) var(--ease-out),
    box-shadow var(--dur-base) var(--ease-out);
}

.search-box:focus-within {
  border-color: var(--c-accent-border);
  box-shadow: 0 0 0 3px rgba(139, 118, 103, 0.08);
}

.search-icon {
  flex: 0 0 auto;
  color: var(--c-text);
  display: grid;
  place-items: center;
  transition: color var(--dur-fast) var(--ease-out);
}

.search-input {
  flex: 1 1 auto;
  min-width: 0;
  border: none;
  background: none;
  outline: none;
  font-size: var(--fs-body);
  color: var(--c-text);
  height: 100%;
}

/* Safari adds its own search decorations — hide them for a clean look. */
.search-input::-webkit-search-decoration,
.search-input::-webkit-search-cancel-button,
.search-input::-webkit-search-results-button {
  -webkit-appearance: none;
  appearance: none;
}

.search-input::placeholder {
  color: var(--c-text-subtle);
}

.search-clear {
  flex: 0 0 auto;
  width: 28px;
  height: 28px;
  border-radius: var(--r-circle);
  display: grid;
  place-items: center;
  color: var(--c-text-muted);
  background: var(--c-bg-sunken);
  transition: background var(--dur-fast) var(--ease-out),
    color var(--dur-fast) var(--ease-out);
}

.search-clear:hover {
  background: var(--c-border);
  color: var(--c-text);
}

.search-clear[hidden] {
  display: none;
}

/* --------------------------------------------------------------------------
   -------------------------------------------------------------------------- */
.main {
  flex: 1 1 auto;
  padding: var(--sp-5) 0 calc(var(--sp-8) + var(--sa-bottom));
}

.section-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--sp-3);
  padding: 0 var(--screen-pad) 16px;
}

.section-title {
  font-family: var(--font-display);
  font-size: var(--fs-section);
  font-weight: 600;
  letter-spacing: var(--tracking-serif);
  color: var(--c-text);
  line-height: 1.15;
}

.section-meta {
  font-size: var(--fs-micro);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--c-text-subtle);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  padding-bottom: 3px;
}

/* --------------------------------------------------------------------------
   Product grid — a premium gallery, not a list.
   Two columns on a phone, three on a tablet, four on a wide screen.
   -------------------------------------------------------------------------- */
.grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  /* 22px between rows, 13px between columns — tight enough to read as one
     gallery block, open enough for the photography to breathe. */
  gap: 22px var(--grid-gap);
  padding: 0 var(--screen-pad);
  align-items: start;
}

/* --------------------------------------------------------------------------
   Product card — no border, no shadow. The photo carries the card.
   -------------------------------------------------------------------------- */
.card {
  position: relative;
  display: flex;
  flex-direction: column;
  background: none;
  border: none;
  border-radius: var(--r-card);
  padding: 0;
  box-shadow: none;
  text-align: left;
  -webkit-tap-highlight-color: transparent;
  min-width: 0;
  animation: card-in var(--dur-slow) var(--ease-out) both;
  transition: transform var(--dur-base) var(--ease-out);
}

/* Light touch feedback only — no shadow, no fill. */
.card:active {
  transform: scale(0.98);
}

@media (hover: hover) {
  .card:hover .card-img {
    transform: scale(1.03);
  }
}

@keyframes card-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

/* --------------------------------------------------------------------------
   Card media — a strict 1:1 frame with a neutral warm ground.
   Whatever the source image looks like, every frame in the grid ends up
   exactly the same size, so the rows stay perfectly aligned.
   -------------------------------------------------------------------------- */
.card-media {
  position: relative;
  aspect-ratio: 1 / 1;
  border-radius: var(--r-image);
  overflow: hidden;
  background: var(--c-media-bg);
  /* A hairline keeps a pale product from dissolving into the frame. */
  box-shadow: inset 0 0 0 1px rgba(33, 31, 28, 0.04);
}

/* `contain` is the default: the whole product stays visible and nothing is
   ever cropped. Very wide banner images switch to `cover` once decoded
   (see `markMediaFit`), because scaling a 5:1 banner down to fit would
   leave an unreadable sliver. */
.card-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  transition: transform var(--dur-slow) var(--ease-out),
    opacity var(--dur-base) var(--ease-out);
}

/* Wide/decorative sources: fill the frame instead of shrinking to a sliver. */
.card-img.is-wide {
  object-fit: cover;
}

/* Fade in after decode; hidden while still loading. */
.card-img:not(.is-loaded) {
  opacity: 0;
}

.card-img.is-loaded {
  opacity: 1;
}

.card-media-fallback {
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
  color: var(--c-text-subtle);
  background: var(--c-media-bg);
}

/* --------------------------------------------------------------------------
   Card body — a single content block (name + category) and the action.
   No `min-height` reservation, no `space-between`: the name and the
   category stay glued together, and the button follows immediately. Only
   the name reserves two lines, because that is what keeps the buttons of
   neighbouring cards on one baseline.
   -------------------------------------------------------------------------- */
.card-body {
  padding: 10px 0 0;
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
}

/* Name + category travel together as one block. */
.card-info {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.card-name {
  font-size: var(--fs-card-title);
  font-weight: 600;
  line-height: 1.4;
  color: var(--c-text);
  letter-spacing: -0.005em;
  /* Centred, so the name reads as a quiet editorial caption under the
     photograph rather than as body copy. */
  text-align: center;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  word-break: break-word;
  /* Reserve exactly two lines so cards in a row share one rhythm, whether
     the name is long or short. */
  min-height: calc(2 * var(--fs-card-title) * 1.4);
}

/* The primary action — a solid charcoal button, full card width.
   It fills the card so the grid reads as a set of complete, deliberate
   units rather than a wall of thumbnails. */
.card-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  align-self: stretch;
  width: 100%;
  /* 44px — comfortably tappable with one thumb. */
  height: 44px;
  margin-top: 12px;
  border-radius: 10px;
  background: var(--c-text);
  color: var(--c-text-inverse);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.005em;
  line-height: 1;
  white-space: nowrap;
  overflow: hidden;
  transition: background var(--dur-fast) var(--ease-out),
    transform var(--dur-fast) var(--ease-out);
}
.card-action-label {
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Pressed state — a subtle lift in the charcoal, never a colour change.
   The card itself already scales, so only the colour shifts here. */
.card:active .card-action {
  background: #3a3632;
}

/* No affiliate link available: the button is present but inert. */
.card-action.is-disabled,
.card-action[aria-disabled="true"] {
  background: #b8b1ab;
  cursor: not-allowed;
  pointer-events: none;
}

/* The disabled button must not react to a card press either. */
.card:active .card-action.is-disabled,
.card:active .card-action[aria-disabled="true"] {
  background: #b8b1ab;
}

.card-action svg {
  flex: 0 0 auto;
  transition: transform var(--dur-base) var(--ease-out);
}

@media (hover: hover) {
  .card:hover .card-action {
    background: #3a3632;
  }

  .card:hover .card-action svg {
    transform: translate(1px, -1px);
  }
}

/* --------------------------------------------------------------------------
   Skeleton
   -------------------------------------------------------------------------- */
.skeleton {
  display: flex;
  flex-direction: column;
  background: none;
  border: none;
  border-radius: var(--r-card);
  padding: 0;
}

.sk-media {
  aspect-ratio: 1 / 1;
  border-radius: var(--r-image);
}

/* Two text lines that mirror the card's two-line product name. */
.sk-text {
  height: 10px;
  border-radius: 5px;
  margin: 11px 2px 0;
}

.sk-text.short {
  width: 42%;
  margin-top: 8px;
}

/* Placeholder for the solid action button. */
.sk-button {
  height: 44px;
  border-radius: 10px;
  margin-top: 12px;
}

.shimmer {
  background: linear-gradient(
    100deg,
    #efe8e1 20%,
    #f6f1ec 40%,
    #efe8e1 60%
  );
  background-size: 220% 100%;
  animation: shimmer 1.5s ease-in-out infinite;
}

@keyframes shimmer {
  from {
    background-position: 160% 0;
  }
  to {
    background-position: -60% 0;
  }
}

/* --------------------------------------------------------------------------
   Pagination
   -------------------------------------------------------------------------- */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-2);
  padding: var(--sp-7) var(--screen-pad) var(--sp-2);
}

.page-numbers {
  display: flex;
  align-items: center;
  gap: 4px;
  min-width: 0;
  overflow: hidden;
}

.page-btn {
  min-width: 36px;
  height: 36px;
  padding: 0 8px;
  border-radius: var(--r-xs);
  border: 1px solid transparent;
  background: transparent;
  color: var(--c-text-muted);
  font-size: var(--fs-caption);
  font-weight: var(--fw-medium);
  font-variant-numeric: tabular-nums;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  transition: background var(--dur-fast) var(--ease-out),
    color var(--dur-fast) var(--ease-out),
    transform var(--dur-fast) var(--ease-out);
}

.page-btn:active:not([disabled]) {
  transform: scale(0.94);
}

.page-btn.is-current {
  background: var(--c-text);
  color: var(--c-text-inverse);
  font-weight: var(--fw-medium);
}

.page-btn[disabled] {
  color: var(--c-text-subtle);
  opacity: 0.4;
  cursor: not-allowed;
}

.page-arrow {
  color: var(--c-text);
  border-color: var(--c-border);
}

.page-gap {
  flex: 0 0 auto;
  width: 18px;
  text-align: center;
  color: var(--c-text-subtle);
  font-size: var(--fs-caption);
  user-select: none;
}

@media (hover: hover) {
  .page-btn:hover:not([disabled]):not(.is-current) {
    color: var(--c-text);
    background: var(--c-bg-sunken);
  }
}

.pagination-info {
  text-align: center;
  font-size: var(--fs-micro);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--c-text-subtle);
  font-variant-numeric: tabular-nums;
  padding-bottom: var(--sp-2);
}

/* Narrow phones: shrink the controls so the whole row still fits. */
@media (max-width: 420px) {
  .pagination {
    gap: 6px;
  }

  .page-numbers {
    gap: 3px;
  }

  .page-btn {
    min-width: 32px;
    height: 34px;
    padding: 0 6px;
  }

  .page-gap {
    width: 14px;
  }
}

/* --------------------------------------------------------------------------
   States: empty / error
   -------------------------------------------------------------------------- */
.state {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: var(--sp-8) var(--sp-6);
  margin: 0 var(--screen-pad);
  border-radius: var(--r-card);
  background: var(--c-bg);
  border: 1px solid var(--c-border);
}

.state-icon {
  width: 52px;
  height: 52px;
  border-radius: var(--r-circle);
  display: grid;
  place-items: center;
  background: var(--c-bg-sunken);
  color: var(--c-accent);
  margin-bottom: var(--sp-4);
}

.state-icon.danger {
  background: var(--c-danger-soft);
  color: var(--c-danger);
}

.state-title {
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 600;
  letter-spacing: var(--tracking-serif);
  color: var(--c-text);
}

.state-text {
  margin-top: 8px;
  font-size: var(--fs-body-sm);
  color: var(--c-text-muted);
  max-width: 32ch;
  line-height: 1.6;
}

.state-action {
  margin-top: var(--sp-5);
  height: 44px;
  padding: 0 var(--sp-5);
  border-radius: var(--r-btn);
  background: var(--c-text);
  color: var(--c-text-inverse);
  font-size: var(--fs-body-sm);
  font-weight: var(--fw-medium);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: opacity var(--dur-fast) var(--ease-out),
    transform var(--dur-fast) var(--ease-out);
}

.state-action:active {
  transform: scale(0.97);
  opacity: 0.9;
}

/* --------------------------------------------------------------------------
   Bottom sheet
   -------------------------------------------------------------------------- */
.sheet-overlay {
  position: fixed;
  inset: 0;
  z-index: var(--z-overlay);
  background: rgba(33, 31, 28, 0.42);
  opacity: 0;
  transition: opacity var(--dur-base) var(--ease-out);
  -webkit-backdrop-filter: blur(3px);
  backdrop-filter: blur(3px);
}

.sheet-overlay.is-open {
  opacity: 1;
}

.sheet {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: var(--z-sheet);
  max-width: var(--app-max);
  margin: 0 auto;
  background: var(--c-bg);
  border-radius: var(--r-sheet) var(--r-sheet) 0 0;
  box-shadow: var(--sh-lg);
  transform: translateY(100%);
  transition: transform var(--dur-base) var(--ease-out);
  display: flex;
  flex-direction: column;
  max-height: 92vh;
  max-height: 92dvh;
  will-change: transform;
  padding-bottom: var(--sa-bottom);
  overscroll-behavior: contain;
}

.sheet.is-open {
  transform: translateY(0);
}

.sheet.is-dragging {
  transition: none;
}

.sheet-handle {
  flex: 0 0 auto;
  padding: 12px 0 6px;
  display: grid;
  place-items: center;
  cursor: grab;
  touch-action: none;
}

.sheet-handle::before {
  content: "";
  width: 36px;
  height: 3px;
  border-radius: var(--r-chip);
  background: var(--c-border-strong);
}

.sheet-header {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-3);
  padding: var(--sp-2) var(--screen-pad) var(--sp-4);
}

.sheet-eyebrow {
  font-size: var(--fs-micro);
  font-weight: var(--fw-medium);
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
  color: var(--c-text-muted);
}

.sheet-close {
  flex: 0 0 auto;
  width: 32px;
  height: 32px;
  border-radius: var(--r-circle);
  display: grid;
  place-items: center;
  background: var(--c-bg-sunken);
  color: var(--c-text-muted);
  transition: background var(--dur-fast) var(--ease-out),
    color var(--dur-fast) var(--ease-out);
}

.sheet-close:hover {
  background: var(--c-border);
  color: var(--c-text);
}

.sheet-body {
  flex: 1 1 auto;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 0 var(--screen-pad) var(--sp-6);
  display: flex;
  flex-direction: column;
  gap: var(--sp-4);
}

/* Large, centred product image — the LUXÉ product screen. */
.sheet-hero {
  display: flex;
  justify-content: center;
}

.preview-media {
  width: 100%;
  max-width: 260px;
  aspect-ratio: 1 / 1;
  border-radius: var(--r-image);
  overflow: hidden;
  background: var(--c-media-bg);
  box-shadow: inset 0 0 0 1px rgba(33, 31, 28, 0.04);
}

.preview-media img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

/* Wide promotional sources fill the frame instead of shrinking to a
   sliver — same rule as the product grid. */
.preview-media img.is-wide {
  object-fit: cover;
}

.preview-info {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.preview-name {
  font-family: var(--font-display);
  font-size: 1.375rem;
  font-weight: 600;
  line-height: 1.28;
  letter-spacing: var(--tracking-serif);
  color: var(--c-text);
  display: -webkit-box;
  -webkit-line-clamp: 3;
  line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  word-break: break-word;
}

.preview-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--sp-2) var(--sp-3);
}

.preview-cat {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: var(--r-chip);
  background: var(--c-bg-sunken);
  color: var(--c-accent);
  font-size: var(--fs-micro);
  font-weight: var(--fw-medium);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.preview-source {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: var(--fs-micro);
  letter-spacing: 0.04em;
  color: var(--c-text-subtle);
}

/* Affiliate link field */
.field-label {
  display: block;
  font-size: var(--fs-micro);
  font-weight: var(--fw-medium);
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
  color: var(--c-text-muted);
  margin-bottom: 8px;
}

.link-field {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  padding: 0 var(--sp-3);
  height: 48px;
  background: var(--c-bg-soft);
  border: 1px solid var(--c-border);
  border-radius: var(--r-input);
  transition: border-color var(--dur-base) var(--ease-out),
    box-shadow var(--dur-base) var(--ease-out);
}

.link-field:focus-within {
  border-color: var(--c-accent-border);
  box-shadow: 0 0 0 3px rgba(139, 118, 103, 0.08);
}

.link-field input {
  flex: 1 1 auto;
  min-width: 0;
  border: none;
  background: none;
  outline: none;
  font-size: var(--fs-body-sm);
  color: var(--c-text-muted);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  text-overflow: ellipsis;
}

.link-field input::selection {
  background: var(--c-accent-soft);
}

.link-field .link-fallback {
  flex: 0 0 auto;
  font-size: var(--fs-caption);
  color: var(--c-text-muted);
  padding: 0 var(--sp-2);
}

.field-hint {
  margin-top: 8px;
  font-size: var(--fs-micro);
  color: var(--c-text-subtle);
  line-height: 1.5;
}

/* Primary CTA — charcoal, full width */
.sheet-cta {
  width: 100%;
  height: 54px;
  border-radius: var(--r-btn);
  background: var(--c-text);
  color: var(--c-text-inverse);
  font-size: var(--fs-body-sm);
  font-weight: var(--fw-medium);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  transition: background var(--dur-fast) var(--ease-out),
    transform var(--dur-fast) var(--ease-out);
}

.sheet-cta:hover {
  background: #000;
}

.sheet-cta:active {
  transform: scale(0.99);
}

.sheet-cta.is-copied {
  background: var(--c-success);
}

.sheet-cta[disabled] {
  background: var(--c-border);
  color: var(--c-text-subtle);
  cursor: not-allowed;
}

.sheet-secondary {
  width: 100%;
  height: 46px;
  border-radius: var(--r-btn);
  border: 1px solid var(--c-border);
  background: var(--c-bg);
  color: var(--c-text);
  font-size: var(--fs-body-sm);
  font-weight: var(--fw-medium);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: border-color var(--dur-fast) var(--ease-out),
    color var(--dur-fast) var(--ease-out),
    background var(--dur-fast) var(--ease-out),
    transform var(--dur-fast) var(--ease-out);
}

.sheet-secondary:hover {
  border-color: var(--c-accent-border);
  color: var(--c-accent);
  background: var(--c-bg-soft);
}

.sheet-secondary:active {
  transform: scale(0.99);
}

/* Unavailable link notice */
.notice {
  display: flex;
  gap: var(--sp-2);
  align-items: flex-start;
  padding: var(--sp-3);
  border-radius: var(--r-sm);
  font-size: var(--fs-caption);
  line-height: 1.55;
}

.notice.warn {
  background: var(--c-warning-soft);
  border: 1px solid #e8dcc4;
  color: #6d5228;
}

.notice.danger {
  background: var(--c-danger-soft);
  border: 1px solid var(--c-danger-border);
  color: #7d2f27;
}

.notice svg {
  flex: 0 0 auto;
  margin-top: 1px;
}

/* --------------------------------------------------------------------------
   Toast
   -------------------------------------------------------------------------- */
.toast-layer {
  position: fixed;
  left: 0;
  right: 0;
  bottom: calc(var(--sp-6) + var(--sa-bottom));
  z-index: var(--z-toast);
  display: flex;
  justify-content: center;
  pointer-events: none;
  padding: 0 var(--screen-pad);
}

.toast {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  max-width: 100%;
  padding: 12px 18px;
  border-radius: var(--r-chip);
  background: var(--c-text);
  color: var(--c-text-inverse);
  font-size: var(--fs-body-sm);
  font-weight: var(--fw-medium);
  box-shadow: var(--sh-md);
  transform: translateY(10px);
  opacity: 0;
  transition: transform var(--dur-base) var(--ease-out),
    opacity var(--dur-base) var(--ease-out);
}

.toast.is-visible {
  transform: translateY(0);
  opacity: 1;
}

.toast.success {
  background: var(--c-success);
}

.toast.error {
  background: var(--c-danger);
}

/* --------------------------------------------------------------------------
   Data-source banner
   -------------------------------------------------------------------------- */
.source-banner {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  margin: 0 var(--screen-pad) var(--sp-4);
  padding: 10px 14px;
  border-radius: var(--r-sm);
  background: var(--c-bg-sunken);
  border: 1px solid var(--c-border);
  color: var(--c-text-muted);
  font-size: var(--fs-micro);
  line-height: 1.5;
}

.source-banner svg {
  flex: 0 0 auto;
}

/* ==========================================================================
   Tablet and wider — a real editorial shopping layout
   The phone layout above stays exactly as designed; from 760px up the page
   becomes a landscape catalogue: wide search and a multi-column grid.
   ========================================================================== */

@media (min-width: 760px) {
  /* --- Shell: the page now fills the width ---------------------------- */
  .app-shell {
    max-width: 1180px;
  }

  /* --- Header: wordmark left, search right, one row ------------------ */
  .header-bar {
    padding: 16px var(--screen-pad) 12px;
    align-items: center;
  }

  .brand-lockup {
    flex-direction: row;
    align-items: baseline;
    gap: 14px;
  }

  .brand-name {
    font-size: 1.875rem; /* 30px */
  }

  .brand-rule {
    display: none;
  }

  .brand-sub {
    margin-top: 0;
    padding-left: 14px;
    border-left: 1px solid var(--c-border-strong);
    font-size: var(--fs-micro);
  }

  /* --- Search moves out of the header into its own wide row ----------- */
  .search {
    padding: 4px var(--screen-pad) 12px;
    max-width: 640px;
    margin: 0 auto;
  }

  .search-box {
    max-width: none;
    height: 52px;
    padding: 0 10px 0 20px;
    border-radius: var(--r-btn);
  }

  .search-input {
    font-size: var(--fs-body);
  }

  /* --- Section head ---------------------------------------------------- */
  .main {
    padding: var(--sp-7) 0 calc(var(--sp-8) + var(--sa-bottom));
  }

  .section-head {
    padding: 0 var(--screen-pad) 20px;
  }

  .section-title {
    font-size: 1.5rem;
  }

  /* --- Product grid: three columns on a tablet ------------------------- */
  .grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 30px var(--grid-gap);
  }

  /* Slightly larger product name, still a single comfortable size. */
  .card-name {
    font-size: 0.9375rem;
  }

  /* --- Bottom sheet becomes a centred dialog --------------------------- */
  .sheet {
    max-width: var(--sheet-max);
    bottom: 24px;
    border-radius: var(--r-sheet);
    max-height: 88vh;
  }

  .sheet-body {
    padding-bottom: var(--sp-6);
  }

  .preview-media {
    max-width: 220px;
  }
}

/* --- Large tablets and small desktops ---------------------------------- */
@media (min-width: 1000px) {
  .grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

/* --- Coarse pointers get a bigger tap target on the card action -------- */
@media (min-width: 760px) and (pointer: coarse) {
  .card-action {
    min-height: 40px;
  }
}

/* --------------------------------------------------------------------------
   Reduced motion
   -------------------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }

  .shimmer {
    animation: none;
    background: var(--c-bg-sunken);
  }

  .card {
    animation: none;
  }

  /* Images must still appear — the fade is the only thing that changes. */
  .card-img {
    opacity: 1;
  }
}
