/* ============================================================
   Suiren · Shared components
   ============================================================ */

/* ─── Buttons ─────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 48px;
  padding: 12px 26px;
  border: 2px solid transparent;
  border-radius: var(--radius-pill);
  font-size: 1rem;
  font-weight: 500;
  letter-spacing: .02em;
  line-height: 1.2;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  transition: transform .18s ease, box-shadow .18s ease, background-color .18s ease;
}
.btn:hover { transform: translateY(-1px); box-shadow: var(--shadow-lift); text-decoration: none; }
.btn:active { transform: none; }
.btn[disabled], .btn[aria-disabled="true"] { opacity: .55; cursor: not-allowed; transform: none; box-shadow: none; }

.btn--primary   { background: var(--color-rose-strong); color: var(--color-white); }
.btn--secondary { background: var(--color-white); color: var(--color-rose-strong); border-color: var(--color-rose-strong); }
.btn--soft      { background: var(--color-cream); color: var(--color-text); }
.btn--teal      { background: var(--color-teal); color: var(--color-text); }
.btn--ghost     { background: transparent; color: var(--color-rose-strong); padding-inline: 12px; }
.btn--ghost:hover { box-shadow: none; text-decoration: underline; }
.btn--block     { width: 100%; }
.btn--small     { min-height: var(--tap); padding: 8px 18px; font-size: .92rem; }

.icon { width: 22px; height: 22px; flex: none; }

/* ─── Header ──────────────────────────────────────────────── */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  min-height: 116px; /* reserved before JS renders it (no layout shift) */
  background: color-mix(in srgb, var(--color-white) 94%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--color-line);
}

.site-header__inner {
  display: grid;
  grid-template-columns: auto 1fr auto;
  grid-template-areas:
    "logo nav cart"
    "search search search";
  align-items: center;
  gap: 4px 12px;
  padding-block: 8px 10px;
}

.site-header__logo { grid-area: logo; display: inline-flex; align-items: center; min-height: var(--tap); }
.site-header__logo img { height: 40px; width: auto; }

.site-nav { grid-area: nav; justify-self: end; }
.site-nav ul { display: flex; gap: 4px; margin: 0; padding: 0; list-style: none; }
.site-nav a {
  display: inline-flex;
  align-items: center;
  min-height: var(--tap);
  padding-inline: 10px;
  border-radius: var(--radius-pill);
  color: var(--color-text);
  font-weight: 500;
  font-size: .95rem;
  text-decoration: none;
}
.site-nav a:hover { background: var(--color-bg-blush); }
.site-nav a[aria-current="page"] { color: var(--color-rose-strong); }
.site-nav .site-nav__extra { display: none; }

.site-search { grid-area: search; position: relative; }
.site-search input {
  width: 100%;
  min-height: var(--tap);
  padding: 10px 48px 10px 18px;
  border: 1.5px solid var(--color-line);
  border-radius: var(--radius-pill);
  background: var(--color-white);
  font-size: 1rem; /* 16px avoids iOS zoom on focus */
}
.site-search input::placeholder { color: var(--color-text-soft); }
.site-search input:focus-visible { outline: var(--focus-ring); outline-offset: 1px; border-color: transparent; }
.site-search button {
  position: absolute;
  top: 0; right: 0;
  width: var(--tap); height: 100%;
  display: grid; place-items: center;
  border: 0;
  border-radius: var(--radius-pill);
  background: none;
  color: var(--color-text);
}

/* Search suggestions (components/search-suggest.js) */
.search-suggest {
  position: absolute;
  top: calc(100% + 6px);
  left: 0; right: 0;
  z-index: 10;
  max-height: min(60vh, 440px);
  overflow-y: auto;
  padding: 6px;
  border: 1px solid var(--color-line);
  border-radius: var(--radius-md);
  background: var(--color-white);
  box-shadow: var(--shadow-lift);
}
.search-suggest__title { margin: 6px 10px 4px; font-size: .85rem; color: var(--color-text-soft); }
.search-suggest__list { margin: 0; padding: 0; list-style: none; }
.search-suggest__list a {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: var(--tap);
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  color: var(--color-text);
  text-decoration: none;
}
.search-suggest__list a:hover,
.search-suggest__list [aria-selected="true"] a { background: var(--color-bg-blush); }
.search-suggest__media {
  flex: none;
  width: 40px; height: 50px;
  overflow: hidden;
  border-radius: 8px;
  background: var(--color-cream);
}
.search-suggest__media img { width: 100%; height: 100%; object-fit: cover; }
.search-suggest__art { display: grid; place-items: center; height: 100%; color: var(--color-rose); }
.search-suggest__art svg { width: 26px; height: auto; }
.search-suggest__text { display: grid; min-width: 0; }
.search-suggest__name { font-weight: 500; overflow-wrap: anywhere; }
.search-suggest__name mark { background: none; color: var(--color-rose-strong); font-weight: 700; }
.search-suggest__meta { font-size: .8rem; color: var(--color-text-soft); }
.search-suggest__all {
  display: block;
  margin-top: 4px;
  padding: 10px;
  border-top: 1px solid var(--color-line);
  color: var(--color-rose-strong);
  font-weight: 500;
  text-align: center;
  text-decoration: none;
}
.search-suggest__all:hover { text-decoration: underline; }

.cart-link {
  grid-area: cart;
  position: relative;
  display: grid;
  place-items: center;
  width: var(--tap); height: var(--tap);
  border-radius: 50%;
  color: var(--color-text);
  text-decoration: none;
}
.cart-link:hover { background: var(--color-bg-blush); }
.cart-link[aria-current="page"] { background: var(--color-bg-blush); }
.cart-link__count {
  position: absolute;
  top: 2px; right: 0;
  min-width: 20px; height: 20px;
  padding-inline: 5px;
  display: grid; place-items: center;
  border-radius: var(--radius-pill);
  background: var(--color-rose-strong);
  color: var(--color-white);
  font-size: .72rem;
  font-weight: 700;
  line-height: 1;
}
.cart-link__count[data-empty="true"] { display: none; }
.cart-link.is-bumped .cart-link__count { animation: bump .4s ease; }
@keyframes bump { 50% { transform: scale(1.35); } }

@media (min-width: 900px) {
  .site-header { min-height: 73px; }
  .site-header__inner {
    grid-template-columns: auto 1fr minmax(240px, 320px) auto;
    grid-template-areas: "logo nav search cart";
    gap: 24px;
    padding-block: 12px;
  }
  .site-header__logo img { height: 46px; }
  .site-nav { justify-self: start; }
  .site-nav .site-nav__extra { display: list-item; }
}

/* ─── Footer ──────────────────────────────────────────────── */
.site-footer {
  margin-top: auto;
  padding-block: 40px 28px;
  background: var(--color-blush);
  color: var(--color-text);
  font-size: .95rem;
}
.site-footer__grid { display: grid; gap: 24px; }
.site-footer__brand img { height: 44px; width: auto; mix-blend-mode: multiply; margin-bottom: 10px; }
.site-footer__brand p { margin: 0; max-width: 36ch; }
.site-footer h2 { font-size: 1rem; font-family: var(--font-body); font-weight: 700; margin-bottom: 8px; }
.site-footer ul { margin: 0; padding: 0; list-style: none; }
.site-footer li a {
  display: inline-flex; align-items: center;
  min-height: var(--tap);
  color: var(--color-text);
}
.site-footer__legal { margin: 28px 0 0; padding-top: 16px; border-top: 1px solid color-mix(in srgb, var(--color-rose) 25%, transparent); font-size: .85rem; }

@media (min-width: 720px) {
  .site-footer__grid { grid-template-columns: 2fr 1fr 1fr; }
}

/* ─── Chips (category filter) ─────────────────────────────── */
.chip-row {
  display: flex;
  gap: 8px;
  margin: 0 calc(var(--gutter) * -1);
  padding: 4px var(--gutter) 10px;
  overflow-x: auto;
  scrollbar-width: thin;
  scroll-snap-type: x proximity;
}
.chip {
  flex: none;
  scroll-snap-align: start;
  min-height: var(--tap);
  padding: 8px 18px;
  border: 1.5px solid var(--color-line);
  border-radius: var(--radius-pill);
  background: var(--color-white);
  color: var(--color-text);
  font-size: .95rem;
  white-space: nowrap;
  transition: background-color .15s ease, border-color .15s ease;
}
.chip:hover { border-color: var(--color-teal-lt); }
.chip[aria-pressed="true"] {
  background: var(--color-teal-lt);
  border-color: var(--color-teal);
  font-weight: 500;
}

/* ─── Product grid & card ─────────────────────────────────── */
.product-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px 12px;
  margin: 0;
  padding: 0;
  list-style: none;
}
@media (min-width: 640px) { .product-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 24px 18px; } }
@media (min-width: 960px) { .product-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }

.product-card {
  position: relative;
  display: flex;
  flex-direction: column;
  height: 100%;
  border-radius: var(--radius-md);
  background: var(--color-white);
  box-shadow: var(--shadow-soft);
  overflow: hidden;
  transition: transform .2s ease, box-shadow .2s ease;
}
.product-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lift); }
.product-card__body { display: flex; flex-direction: column; gap: 2px; padding: 12px 14px 14px; }
.product-card__category { font-size: .78rem; color: var(--color-text-soft); }
.product-card__name { margin: 0; font-family: var(--font-display); font-size: 1.05rem; line-height: 1.25; }
.product-card__name a { color: var(--color-text); text-decoration: none; }
.product-card__name a::after { content: ''; position: absolute; inset: 0; } /* whole card clickable */
.product-card__name a:focus-visible { outline: none; }
.product-card:has(a:focus-visible) { outline: var(--focus-ring); outline-offset: 3px; }
.product-card__price { margin-top: 4px; font-size: .9rem; color: var(--color-text-soft); }
.product-card__price strong { color: var(--color-text); font-weight: 700; }
.product-card__badge {
  position: absolute;
  top: 10px; left: 10px;
  z-index: 1;
  padding: 3px 10px;
  border-radius: var(--radius-pill);
  background: var(--color-gold);
  color: var(--color-text);
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .04em;
}

/* Photo arrows inside a card (above the card-wide link) */
.card-gallery { position: relative; }
.card-gallery__arrow {
  position: absolute;
  top: 50%;
  z-index: 2;
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: color-mix(in srgb, var(--color-white) 88%, transparent);
  color: var(--color-text);
  box-shadow: var(--shadow-soft);
  cursor: pointer;
  transform: translateY(-50%);
  transition: opacity .2s ease, background-color .2s ease;
}
.card-gallery__arrow::before { content: ''; position: absolute; inset: -4px; } /* 44px touch target */
.card-gallery__arrow--prev { left: 8px; }
.card-gallery__arrow--next { right: 8px; }
.card-gallery__arrow:hover { background: var(--color-white); }
.card-gallery__arrow:focus-visible { outline: var(--focus-ring); outline-offset: 2px; }
.card-gallery__arrow .icon { width: 20px; height: 20px; }
.card-gallery__dots {
  position: absolute;
  bottom: 8px;
  left: 0;
  right: 0;
  display: flex;
  justify-content: center;
  gap: 4px;
  pointer-events: none;
}
.card-gallery__dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: color-mix(in srgb, var(--color-white) 75%, transparent);
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--color-text) 15%, transparent);
}
.card-gallery__dot[data-active] { background: var(--color-rose); }
/* With a mouse, arrows appear on hover; on touch screens they are always visible. */
@media (hover: hover) {
  .card-gallery__arrow { opacity: 0; }
  .product-card:hover .card-gallery__arrow,
  .card-gallery__arrow:focus-visible { opacity: 1; }
}

/* ─── Product media & placeholder ─────────────────────────── */
.product-media {
  position: relative;
  aspect-ratio: 4 / 5;
  background: var(--color-cream);
  overflow: hidden;
}
.product-media img { width: 100%; height: 100%; object-fit: cover; }

.product-placeholder {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 16px;
  background:
    radial-gradient(circle at 50% 38%, color-mix(in srgb, var(--color-gold) 55%, transparent) 0, transparent 55%),
    var(--color-cream);
  color: var(--color-rose);
  text-align: center;
}
.product-placeholder svg { width: 38%; max-width: 120px; height: auto; }
.product-placeholder__name {
  font-family: var(--font-display);
  font-size: .95rem;
  color: var(--color-text);
  line-height: 1.2;
}

/* ─── Mascot ──────────────────────────────────────────────── */
.mascot { margin: 0 auto; }
.mascot img { width: 100%; height: auto; mix-blend-mode: multiply; }

/* Reserved slot for a future Ren pose: visible on localhost only. */
.mascot-placeholder { display: none; }
[data-env="dev"] .mascot-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  aspect-ratio: 2 / 3;
  width: 100%;
  padding: 16px;
  border: 2px dashed var(--color-pink);
  border-radius: var(--radius-md);
  background: var(--color-bg-blush);
  color: var(--color-text-soft);
  font-size: .8rem;
  text-align: center;
}
[data-env="dev"] .mascot-placeholder strong { color: var(--color-text); font-size: .85rem; }

/* ─── State panels (empty, error, not found) ──────────────── */
.state-panel {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  max-width: 460px;
  margin: 24px auto;
  padding: 24px 16px;
  text-align: center;
}
.state-panel .mascot { width: min(200px, 60%); margin-bottom: 8px; }
.state-panel h2 { font-size: 1.5rem; margin-bottom: 0; }
.state-panel p { color: var(--color-text-soft); margin: 0 0 12px; }
.state-panel__actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; }

/* ─── Forms ───────────────────────────────────────────────── */
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 18px; }
.field label, .field-label { font-weight: 500; }
.field__hint { font-size: .85rem; color: var(--color-text-soft); }
.field__optional { font-weight: 400; color: var(--color-text-soft); font-size: .9em; }
.input, .textarea, .select {
  width: 100%;
  min-height: var(--tap);
  padding: 10px 14px;
  border: 1.5px solid var(--color-line);
  border-radius: var(--radius-sm);
  background: var(--color-white);
  font-size: 1rem;
}
.textarea { min-height: 96px; resize: vertical; }
.input:focus-visible, .textarea:focus-visible, .select:focus-visible { outline: var(--focus-ring); outline-offset: 1px; }
.input[aria-invalid="true"], .textarea[aria-invalid="true"] { border-color: var(--color-rose-strong); }
.field__error, .group-error {
  margin: 0;
  font-size: .88rem;
  font-weight: 500;
  color: var(--color-rose-strong);
}

fieldset.option-group { margin: 0 0 24px; padding: 0; border: 0; min-width: 0; }
.option-group legend {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 10px;
  align-items: baseline;
  margin-bottom: 10px;
  padding: 0;
  font-weight: 700;
  font-size: 1.02rem;
}
.option-group__value { font-weight: 400; color: var(--color-text-soft); }

/* Radio inputs stay in the DOM (keyboard + screen readers) and are visually hidden. */
.option-input { position: absolute; opacity: 0; width: 1px; height: 1px; pointer-events: none; }

/* Color swatches */
.swatch-list { display: flex; flex-wrap: wrap; gap: 10px; }
.swatch {
  position: relative;
  display: grid;
  place-items: center;
  width: 48px; height: 48px;
  border-radius: 50%;
  cursor: pointer;
}
.swatch__dot {
  width: 38px; height: 38px;
  border-radius: 50%;
  border: 1px solid color-mix(in srgb, var(--color-text) 18%, transparent);
  box-shadow: inset 0 -3px 6px color-mix(in srgb, var(--color-text) 8%, transparent);
}
.option-input:checked + .swatch { box-shadow: 0 0 0 2.5px var(--color-text); }
.option-input:focus-visible + .swatch { outline: var(--focus-ring); outline-offset: 3px; }

/* Text chips (fragrance) */
.choice-list { display: flex; flex-wrap: wrap; gap: 8px; }
.choice-families { display: grid; gap: 14px; }
.choice-family__title { margin: 0 0 6px; font-size: .8rem; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--color-text-soft); }
.choice {
  display: inline-flex;
  flex-direction: column;
  justify-content: center;
  min-height: var(--tap);
  padding: 6px 16px;
  border: 1.5px solid var(--color-line);
  border-radius: var(--radius-md);
  background: var(--color-white);
  cursor: pointer;
  line-height: 1.25;
}
.choice small { font-size: .76rem; color: var(--color-text-soft); }
.choice:hover { border-color: var(--color-teal-lt); }
.option-input:checked + .choice { background: var(--color-bg-teal); border-color: var(--color-teal); box-shadow: inset 0 0 0 1px var(--color-teal); }
.option-input:focus-visible + .choice { outline: var(--focus-ring); outline-offset: 2px; }

/* Option cards (wax, packaging) */
.card-options { display: grid; gap: 10px; }
@media (min-width: 520px) { .card-options { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.option-card {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 2px 12px;
  height: 100%;
  padding: 12px 14px;
  border: 1.5px solid var(--color-line);
  border-radius: var(--radius-md);
  background: var(--color-white);
  cursor: pointer;
}
.option-card:hover { border-color: var(--color-teal-lt); }
.option-card__name { font-weight: 700; }
.option-card__price { font-weight: 500; white-space: nowrap; }
.option-card__desc { grid-column: 1 / -1; font-size: .85rem; color: var(--color-text-soft); }
.option-input:checked + .option-card { background: var(--color-bg-teal); border-color: var(--color-teal); box-shadow: inset 0 0 0 1px var(--color-teal); }
.option-input:checked + .option-card .option-card__name::before { content: '✓ '; }
.option-input:focus-visible + .option-card { outline: var(--focus-ring); outline-offset: 2px; }

/* Segmented radios (delivery method) */
.segmented { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.segmented .choice { align-items: center; text-align: center; }

/* Quantity stepper */
.stepper {
  display: inline-flex;
  align-items: center;
  border: 1.5px solid var(--color-line);
  border-radius: var(--radius-pill);
  background: var(--color-white);
}
.stepper button {
  width: var(--tap); height: var(--tap);
  border: 0;
  border-radius: 50%;
  background: none;
  font-size: 1.3rem;
  line-height: 1;
}
.stepper button:hover:not([disabled]) { background: var(--color-bg-blush); }
.stepper button[disabled] { opacity: .35; cursor: not-allowed; }
.stepper input {
  width: 3ch;
  min-height: var(--tap);
  border: 0;
  background: none;
  text-align: center;
  font-weight: 700;
  -moz-appearance: textfield;
  appearance: textfield;
}
.stepper input::-webkit-outer-spin-button,
.stepper input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }

/* ─── Notice ──────────────────────────────────────────────── */
.notice {
  padding: 14px 16px;
  border-radius: var(--radius-md);
  background: var(--color-gold);
  color: var(--color-text);
  font-size: .95rem;
}
.notice p:last-child { margin-bottom: 0; }
.notice--soft { background: var(--color-bg-warm); border: 1px solid var(--color-line); }

/* ─── Toast ───────────────────────────────────────────────── */
.toast-region {
  position: fixed;
  left: 50%;
  bottom: calc(16px + env(safe-area-inset-bottom));
  z-index: 300;
  width: min(440px, calc(100% - 2 * var(--gutter)));
  transform: translateX(-50%);
  pointer-events: none;
}
.toast {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 12px 12px 18px;
  border-radius: var(--radius-md);
  background: var(--color-text);
  color: var(--color-white);
  box-shadow: var(--shadow-lift);
  pointer-events: auto;
  animation: toast-in .25s ease;
}
.toast a { color: var(--color-gold); font-weight: 700; white-space: nowrap; min-height: var(--tap); display: inline-flex; align-items: center; padding-inline: 6px; }
.toast.is-leaving { opacity: 0; transition: opacity .3s ease; }
@keyframes toast-in { from { opacity: 0; transform: translateY(10px); } }

/* ─── Loading skeleton ────────────────────────────────────── */
.skeleton {
  border-radius: var(--radius-md);
  background: linear-gradient(90deg, var(--color-bg-warm) 0%, var(--color-cream) 50%, var(--color-bg-warm) 100%);
  background-size: 200% 100%;
  animation: shimmer 1.4s linear infinite;
}
.skeleton--card { aspect-ratio: 4 / 6; }
@keyframes shimmer { to { background-position: -200% 0; } }

/* ─── Breadcrumb ──────────────────────────────────────────── */
.breadcrumb ol { display: flex; flex-wrap: wrap; gap: 4px; margin: 0; padding: 16px 0 0; list-style: none; font-size: .9rem; color: var(--color-text-soft); }
.breadcrumb li + li::before { content: '›'; margin-right: 4px; }
.breadcrumb a { color: var(--color-text-soft); }

/* ─── Modal (native <dialog>: focus trap, Escape and inert page for free) ─── */
.modal {
  width: min(480px, calc(100% - 2 * var(--gutter)));
  max-height: calc(100dvh - 2 * var(--gutter));
  overflow-y: auto;
  padding: 0;
  border: 0;
  border-radius: var(--radius-lg);
  background: var(--color-white);
  color: var(--color-text);
  box-shadow: var(--shadow-lift);
}
.modal::backdrop { background: var(--color-overlay); }
.modal[open] { animation: modal-in .2s ease-out; }
@keyframes modal-in { from { opacity: 0; transform: translateY(12px); } }
@media (prefers-reduced-motion: reduce) { .modal[open] { animation: none; } }

.modal__panel { position: relative; padding: 28px 24px 24px; background: var(--color-bg-blush); }
.modal__panel h2 { margin-top: 0; }
.modal__panel .btn { margin-top: 8px; }
.modal__mascot { width: 110px; margin: 0 auto 8px; }
.modal__close {
  position: absolute;
  top: 8px; right: 8px;
  width: var(--tap); height: var(--tap);
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--color-text);
  font-size: 1.8rem;
  line-height: 1;
  cursor: pointer;
}
.modal__close:hover { background: var(--color-white); }
.modal__close:focus-visible { outline: var(--focus-ring); }
.modal .payment-list { margin: 0 0 1em; padding: 0; list-style: none; display: grid; gap: 8px; }
.modal .payment-list li { padding: 10px 14px; border-radius: var(--radius-sm); background: var(--color-white); }

/* Confirmation variant: text + two actions */
.modal--confirm { width: min(420px, calc(100% - 2 * var(--gutter))); }
.modal--confirm .modal__panel { background: var(--color-white); }
.modal--confirm p { color: var(--color-text-soft); }
.modal__actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 10px; margin-top: 8px; }
.modal__actions .btn { margin-top: 0; }
