/* ==========================================================================
   Components: buttons, cards, prices, forms, accordions, drawers, notices
   ========================================================================== */

/* --------------------------------------------------------------------------
   Buttons (approved: burgundy, 2px radius, 13px label, arrow glyph)
   ------------------------------------------------------------------------ */
.button {
  display: inline-flex; align-items: center; justify-content: center; gap: 14px;
  min-height: 46px; padding: 12px 25px;
  background: var(--berry); border: 1px solid var(--berry); color: var(--white);
  text-decoration: none; font-size: var(--fs-small); line-height: 1.2; text-align: center;
  border-radius: var(--radius);
  transition: background-color var(--dur-fast), border-color var(--dur-fast), color var(--dur-fast), transform var(--dur-fast), box-shadow var(--dur-fast);
}
.button:hover { background: var(--berry-hover); border-color: var(--berry-hover); }
.button:active { background: var(--berry-deep); transform: translateY(1px); }
.button .arrow { transition: transform var(--dur) var(--ease); display: inline-block; }
.button:hover .arrow, .text-link:hover .arrow { transform: translateX(4px); }
.button--large { min-height: 50px; padding: 14px 28px; }
.button--block { width: 100%; }
.button--ghost { background: transparent; color: var(--berry); }
.button--ghost:hover { background: var(--berry); color: var(--white); }
.button--light { background: var(--cream); border-color: var(--cream); color: var(--berry); }
.button--light:hover { background: var(--white); border-color: var(--white); color: var(--berry); }
.button[disabled], .button[aria-disabled="true"] {
  background: #d8cdc6; border-color: #d8cdc6; color: #5b4f4a; cursor: not-allowed; transform: none;
}
.button.is-loading { position: relative; color: transparent !important; pointer-events: none; }
.button.is-loading::after {
  content: ""; position: absolute; width: 18px; height: 18px; border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, .45); border-top-color: var(--white);
  animation: spin .7s linear infinite;
}
.button--ghost.is-loading::after { border-color: rgba(96, 17, 43, .3); border-top-color: var(--berry); }
@keyframes spin { to { transform: rotate(360deg); } }

.text-link {
  font-size: var(--fs-small); color: var(--berry); white-space: nowrap; text-underline-offset: 5px;
  display: inline-flex; align-items: center; gap: 6px; min-height: 44px;
}
.text-link:hover { color: var(--berry-hover); }
.link-button {
  border: 0; background: transparent; padding: 4px 0; min-height: 44px;
  font-size: var(--fs-small); font-weight: 700; text-decoration: underline; text-underline-offset: 4px;
  display: inline-flex; align-items: center; gap: 6px; color: var(--ink);
}
.link-button:hover { color: var(--berry); }

/* --------------------------------------------------------------------------
   Development markers — visible only when app.env != production
   ------------------------------------------------------------------------ */
.pending {
  display: inline-flex; align-items: center; gap: 5px; vertical-align: middle;
  font: 700 10px/1 var(--sans); letter-spacing: .08em; text-transform: uppercase;
  color: var(--dev); background: var(--dev-bg); border: 1px dashed #d8b965;
  padding: 4px 7px; border-radius: 3px; white-space: nowrap;
}
.pending::before { content: "•"; font-size: 13px; line-height: 0; }
.dev-note { font-size: var(--fs-xs); color: var(--dev); background: var(--dev-bg); border: 1px dashed #d8b965; padding: 10px 12px; border-radius: 3px; }

/* --------------------------------------------------------------------------
   Section heading (approved: centred serif title, link on the right)
   ------------------------------------------------------------------------ */
.section-heading { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-bottom: 25px; }
.section-heading h2 { flex: 1; text-align: center; }
.section-heading::before { content: ""; width: 90px; flex-shrink: 0; }
.section-heading--left::before { display: none; }
.section-heading--left h2 { text-align: left; }
@media (max-width: 600px) {
  .section-heading { align-items: flex-end; gap: 12px; }
  .section-heading::before { display: none; }
  .section-heading h2 { text-align: left; font-size: 30px; }
  .section-heading .text-link { font-size: var(--fs-xs); }
}

/* --------------------------------------------------------------------------
   Filter chips (approved collection tabs)
   ------------------------------------------------------------------------ */
.chips { display: flex; justify-content: center; gap: 9px; flex-wrap: wrap; margin: 0 0 28px; }
.chips--left { justify-content: flex-start; }
.chip {
  border: 1px solid var(--line); background: transparent; border-radius: 24px;
  padding: 10px 19px; min-height: 44px; font-size: var(--fs-xs); text-decoration: none;
  display: inline-flex; align-items: center; gap: 6px; white-space: nowrap;
  transition: background-color var(--dur-fast), border-color var(--dur-fast), color var(--dur-fast);
}
.chip:hover { border-color: var(--berry); color: var(--berry); }
.chip[aria-pressed="true"], .chip[aria-current="page"] { background: var(--berry); color: var(--white); border-color: var(--berry); }
.chip small { font-size: 11px; opacity: .75; }
@media (max-width: 600px) {
  .chips { justify-content: flex-start; flex-wrap: nowrap; overflow-x: auto; margin-inline: calc(var(--gutter) * -1); padding: 2px var(--gutter) 6px; scrollbar-width: none; }
  .chips::-webkit-scrollbar { display: none; }
  .chip { padding: 9px 14px; }
}

/* --------------------------------------------------------------------------
   Category tiles (approved strip)
   ------------------------------------------------------------------------ */
.categories { display: grid; grid-template-columns: repeat(5, 1fr); gap: 12px; }
.category-tile { text-decoration: none; text-align: center; background: var(--tile); overflow: hidden; display: flex; flex-direction: column; }
.category-tile__media { aspect-ratio: 1.45; overflow: hidden; }
.category-tile__media img { height: 100%; transition: transform var(--dur-slow) var(--ease); }
.category-tile:hover img { transform: scale(1.04); }
.category-tile span { display: block; padding: 9px; font: 17px var(--serif); }
.category-tile b { font: 20px var(--sans); margin-left: 12px; font-weight: 400; display: inline-block; transition: transform var(--dur) var(--ease); }
.category-tile:hover b { transform: translateX(4px); }
@media (max-width: 760px) {
  .categories { grid-template-columns: repeat(3, 1fr); gap: 8px; }
  .category-tile span { font-size: 13px; padding: 10px 3px; }
  .category-tile b { margin-left: 3px; font-size: 15px; }
}

/* --------------------------------------------------------------------------
   Product card (approved "product-first" card)
   ------------------------------------------------------------------------ */
.product-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.product-grid--4 { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 1100px) { .product-grid--4 { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 900px) { .product-grid, .product-grid--4 { grid-template-columns: repeat(2, 1fr); gap: 14px; } }
@media (max-width: 380px) { .product-grid, .product-grid--4 { gap: 10px; } }

.product-card {
  position: relative; display: flex; flex-direction: column; text-align: left;
  background: var(--card); border: 1px solid var(--card-line); border-radius: var(--radius-card); overflow: hidden;
  transition: box-shadow var(--dur) var(--ease), transform var(--dur) var(--ease), border-color var(--dur);
}
.product-card:hover { box-shadow: var(--shadow-lift); transform: translateY(-3px); border-color: #e5d9ce; }
.product-card__media { display: block; text-decoration: none; aspect-ratio: 1.15; background: var(--stage); overflow: hidden; }
.product-card__media img { height: 100%; object-fit: contain; transition: transform var(--dur-slow) var(--ease); }
.product-card__media img[style*="object-position"] { object-fit: cover; }
.product-card:hover .product-card__media img { transform: scale(1.035); }
.product-card__body { padding: 20px; display: flex; flex-direction: column; flex: 1; }
.product-card__type { color: var(--berry); font-size: 10px; letter-spacing: .14em; text-transform: uppercase; }
.product-card h3 { margin: 9px 0 10px; font-size: 21px; line-height: 1.25; min-height: 2.5em; }
.product-card h3 a { text-decoration: none; }
.product-card h3 a::after { content: ""; position: absolute; inset: 0; z-index: 1; } /* whole card clickable */
.product-card h3 a:hover { color: var(--berry); }
.product-card__summary { font-size: var(--fs-small); line-height: 1.65; color: var(--muted); margin-bottom: 14px; flex: 1; }
.product-card__meta { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; min-height: 22px; }
.product-card__actions { position: relative; z-index: 2; display: flex; gap: 8px; }
.product-card__actions .button, .product-card__actions form { flex: 1; }
.product-card__actions form .button { width: 100%; }
.product-card .button { font-size: var(--fs-xs); }

.fav {
  position: absolute; right: 0; top: 0; z-index: 3; width: 58px; height: 52px; border: 0;
  background: var(--stage); color: var(--berry); display: grid; place-items: center; border-bottom-left-radius: var(--radius-card);
  transition: background-color var(--dur-fast);
}
.fav:hover { background: #ece4d8; }
.fav .icon { transition: transform var(--dur) var(--ease), fill var(--dur-fast); }
.fav[aria-pressed="true"] .icon { fill: var(--berry); }
.fav.is-popping .icon { animation: pop .42s var(--ease); }
@keyframes pop { 45% { transform: scale(1.28); } }
.fav form { display: contents; }

@media (max-width: 900px) {
  .product-card__body { padding: 14px; }
  .product-card h3 { font-size: 18px; }
  .product-card__summary { font-size: var(--fs-xs); }
}
@media (max-width: 600px) {
  .product-card h3 { font-size: 17px; line-height: 1.3; }
  .product-card__body { padding: 12px; }
  .product-card__type { font-size: 9px; }
  .product-card__summary { display: none; }
  .product-card .button { padding: 10px 8px; gap: 8px; }
  .fav { width: 46px; height: 44px; }
}

/* Photo-pending placeholder: honest, on-brand, same proportions */
.photo-pending {
  width: 100%; height: 100%; min-height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px;
  background: radial-gradient(circle at 50% 42%, #fbf6ef 0, var(--stage) 60%); color: var(--berry); text-align: center; padding: 16px;
}
.photo-pending__mark {
  width: 64px; height: 64px; border: 1px solid rgba(96, 17, 43, .3); border-radius: 50%;
  display: grid; place-items: center; font: 28px/1 var(--serif); letter-spacing: .05em;
}
.photo-pending__text { font-size: 10px; letter-spacing: .18em; text-transform: uppercase; color: var(--muted); }

/* --------------------------------------------------------------------------
   Price & availability
   ------------------------------------------------------------------------ */
.price { font: 19px/1.2 var(--serif); color: var(--ink); }
.price--large { font-size: 30px; }
.price-unset { font-size: var(--fs-xs); color: var(--muted); }
.badge {
  display: inline-flex; align-items: center; gap: 5px; font-size: 10px; letter-spacing: .1em; text-transform: uppercase;
  padding: 4px 8px; border-radius: 3px; font-weight: 700; white-space: nowrap;
}
.badge--test { background: var(--dev-bg); color: var(--dev); border: 1px dashed #d8b965; }
.badge--soldout { background: #efe7e2; color: var(--muted); }
.badge--concept { background: rgba(255, 253, 249, .92); color: var(--muted); border: 1px solid var(--line); }
.availability { display: inline-flex; align-items: center; gap: 8px; font-size: var(--fs-small); }
.availability::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: #b9ada6; }
.availability--in::before { background: #5f7d4f; }
.availability--out::before { background: #b35c5c; }

/* --------------------------------------------------------------------------
   Forms
   ------------------------------------------------------------------------ */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px 16px; }
.form-grid .span-2 { grid-column: 1 / -1; }
@media (max-width: 600px) { .form-grid { grid-template-columns: 1fr; } .form-grid .span-2 { grid-column: auto; } }

.field { display: flex; flex-direction: column; gap: 7px; min-width: 0; }
.field label, .field legend, .label { font-size: var(--fs-small); font-weight: 700; color: var(--ink); }
.field .optional { font-weight: 400; color: var(--muted); }
.field .hint { font-size: var(--fs-xs); color: var(--muted); margin-top: -2px; }
.input, .select, .textarea {
  width: 100%; min-height: 48px; padding: 12px 14px; background: var(--white);
  border: 1px solid #cbbcb0; border-radius: var(--radius); font-size: 16px; /* 16px avoids iOS zoom */
  transition: border-color var(--dur-fast), box-shadow var(--dur-fast);
}
.input:hover, .select:hover, .textarea:hover { border-color: #a99488; }
.input:focus, .select:focus, .textarea:focus { border-color: var(--berry); box-shadow: 0 0 0 3px rgba(150, 115, 52, .3); }
.textarea { min-height: 130px; resize: vertical; line-height: 1.5; }
.select {
  appearance: none; -webkit-appearance: none; padding-right: 40px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%2360112b' stroke-width='1.6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 15px center;
}
.field--error .input, .field--error .select, .field--error .textarea { border-color: var(--error); background: #fffafa; }
.error-text { display: flex; gap: 6px; align-items: flex-start; font-size: var(--fs-xs); color: var(--error); font-weight: 700; }
.error-text::before { content: "!"; flex-shrink: 0; width: 16px; height: 16px; border-radius: 50%; background: var(--error); color: var(--white); font-size: 11px; line-height: 16px; text-align: center; }

fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }
.check { display: flex; gap: 12px; align-items: flex-start; font-size: var(--fs-small); line-height: 1.5; cursor: pointer; }
.check input { width: 20px; height: 20px; margin: 1px 0 0; accent-color: var(--berry); flex-shrink: 0; }
.check-row { display: flex; flex-wrap: wrap; gap: 10px; }
.check-pill { position: relative; }
.check-pill input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.check-pill span {
  display: inline-flex; align-items: center; min-height: 44px; padding: 10px 18px; border: 1px solid #cbbcb0;
  border-radius: 24px; font-size: var(--fs-small); background: var(--white); transition: all var(--dur-fast);
}
.check-pill input:checked + span { background: var(--berry); border-color: var(--berry); color: var(--white); }
.check-pill input:focus-visible + span { outline: 3px solid var(--focus); outline-offset: 2px; }

.error-summary {
  border: 1px solid #e3b7b5; border-left: 4px solid var(--error); background: var(--error-bg);
  padding: 18px 20px; border-radius: var(--radius); margin-bottom: 26px;
}
.error-summary h2 { font: 700 15px var(--sans); color: var(--error); margin-bottom: 8px; }
.error-summary ul { margin: 0; padding-left: 18px; font-size: var(--fs-small); }
.error-summary a { color: var(--error); }

/* Quantity stepper */
.qty { display: inline-flex; align-items: stretch; border: 1px solid #cbbcb0; border-radius: var(--radius); background: var(--white); height: 48px; }
.qty button { width: 44px; border: 0; background: transparent; color: var(--berry); font-size: 20px; line-height: 1; transition: background-color var(--dur-fast); }
.qty button:hover { background: var(--stage); }
.qty button:disabled { color: #b9ada6; cursor: not-allowed; background: transparent; }
.qty input { width: 48px; border: 0; border-inline: 1px solid var(--card-line); text-align: center; font-size: 16px; -moz-appearance: textfield; background: transparent; }
.qty input::-webkit-outer-spin-button, .qty input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.qty--small { height: 40px; }
.qty--small button { width: 38px; }
.qty--small input { width: 40px; font-size: 15px; }

/* --------------------------------------------------------------------------
   Accordion (native details/summary, animated where supported)
   ------------------------------------------------------------------------ */
.accordion { border-top: 1px solid var(--line); }
.accordion details { border-bottom: 1px solid var(--line); }
.accordion summary {
  list-style: none; cursor: pointer; display: flex; justify-content: space-between; align-items: center; gap: 16px;
  padding: 17px 0; min-height: 56px; font-size: 14px; font-weight: 700;
}
.accordion summary::-webkit-details-marker { display: none; }
.accordion summary::after {
  content: ""; width: 12px; height: 12px; flex-shrink: 0; margin-right: 4px;
  background: linear-gradient(var(--berry), var(--berry)) center/12px 1.5px no-repeat, linear-gradient(var(--berry), var(--berry)) center/1.5px 12px no-repeat;
  transition: transform var(--dur) var(--ease);
}
.accordion details[open] > summary::after { transform: rotate(45deg); }
.accordion summary:hover { color: var(--berry); }
.accordion__body { padding: 0 0 20px; font-size: 14px; color: var(--muted); line-height: 1.7; overflow: hidden; }
.accordion__body > * + * { margin-top: 12px; }
.accordion__body ul { padding-left: 18px; margin: 0; }

/* --------------------------------------------------------------------------
   Notices, flash, toast, empty states
   ------------------------------------------------------------------------ */
.notice {
  display: flex; gap: 12px; align-items: flex-start; padding: 14px 16px; border-radius: var(--radius);
  font-size: var(--fs-small); line-height: 1.55; background: var(--sand); border: 1px solid #eadbc9;
}
.notice .icon { color: var(--berry); margin-top: -1px; }
.notice--success { background: var(--success-bg); border-color: #cfd6b9; }
.notice--success .icon { color: var(--success); }
.notice--error { background: var(--error-bg); border-color: #e3b7b5; }
.notice--error .icon { color: var(--error); }
.notice strong { display: block; margin-bottom: 2px; }
.flash { margin-top: 18px; }

.toast-region { position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%); z-index: 90; width: min(92vw, 460px); pointer-events: none; }
.toast {
  display: flex; align-items: center; gap: 12px; padding: 13px 18px; border-radius: var(--radius-card);
  background: var(--berry); color: var(--white); box-shadow: 0 10px 30px rgba(33, 19, 22, .28); font-size: 14px;
  animation: toast-in var(--dur) var(--ease);
}
.toast.is-leaving { animation: toast-out var(--dur) var(--ease) forwards; }
.toast--error { background: #5a1a22; }
@keyframes toast-in { from { opacity: 0; transform: translateY(12px); } }
@keyframes toast-out { to { opacity: 0; transform: translateY(8px); } }

.empty-state { text-align: center; padding: 56px 24px; max-width: 560px; margin: 0 auto; }
.empty-state__icon { width: 74px; height: 74px; border-radius: 50%; background: var(--blush); color: var(--berry); display: grid; place-items: center; margin: 0 auto 22px; }
.empty-state h2 { font-size: clamp(28px, 3vw, 38px); margin-bottom: 12px; }
.empty-state p { color: var(--muted); margin-bottom: 24px; }
.empty-state .chips { margin-top: 22px; }

/* --------------------------------------------------------------------------
   Breadcrumbs + page header band
   ------------------------------------------------------------------------ */
.breadcrumbs ol { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 4px 10px; font-size: var(--fs-xs); color: var(--muted); }
.breadcrumbs li + li::before { content: "/"; margin-right: 10px; color: #b3a39a; }
.breadcrumbs a { text-decoration: none; }
.breadcrumbs a:hover { color: var(--berry); text-decoration: underline; }
.breadcrumbs [aria-current] { color: var(--ink); }

.page-header { background: var(--blush); }
.page-header__inner { padding-top: 40px; padding-bottom: 44px; display: grid; grid-template-columns: 1fr auto; gap: 40px; align-items: end; }
.page-header h1 { font-size: var(--fs-page-title); margin: 18px 0 14px; }
.page-header p { max-width: 560px; font-size: 16px; }
.page-header--sage { background: var(--sage); }
.page-header--sand { background: var(--sand); }
.page-header--plain { background: transparent; border-bottom: 1px solid var(--line); }
.page-header__art { width: 190px; aspect-ratio: .82; border-radius: 95px 95px 3px 3px; overflow: hidden; background: var(--tile); box-shadow: 0 0 0 8px rgba(255, 253, 249, .45); }
.page-header__art img { height: 100%; }
@media (max-width: 760px) {
  .page-header__inner { grid-template-columns: 1fr; gap: 0; padding-top: 26px; padding-bottom: 32px; }
  .page-header__art { display: none; }
}

/* --------------------------------------------------------------------------
   Drawer (mini bag) + dialog
   ------------------------------------------------------------------------ */
.drawer {
  position: fixed; inset: 0 0 0 auto; z-index: 70; width: min(100vw, 430px);
  background: var(--cream); display: flex; flex-direction: column; box-shadow: var(--shadow-drawer);
  transform: translateX(100%); visibility: hidden;
  transition: transform var(--dur) var(--ease), visibility 0s linear var(--dur);
}
.drawer.is-open { transform: none; visibility: visible; transition: transform var(--dur) var(--ease); }
.drawer__head { display: flex; align-items: center; justify-content: space-between; padding: 16px 12px 16px 24px; border-bottom: 1px solid var(--line); }
.drawer__head h2 { font-size: 26px; }
.drawer__body { flex: 1; overflow-y: auto; padding: 8px 24px 24px; }
.drawer__foot { border-top: 1px solid var(--line); padding: 18px 24px 22px; background: var(--card); }
.drawer__foot .button + .button { margin-top: 10px; }
.drawer__status { margin: 16px 0 6px; }
.close-button { width: 44px; height: 44px; border: 0; background: transparent; display: grid; place-items: center; color: var(--ink); border-radius: 50%; transition: background-color var(--dur-fast); }
.close-button:hover { background: rgba(96, 17, 43, .07); color: var(--berry); }

.mini-line { display: grid; grid-template-columns: 72px 1fr auto; gap: 14px; align-items: center; padding: 14px 0; border-bottom: 1px solid var(--line); }
.mini-line__media { width: 72px; height: 72px; background: var(--stage); border-radius: var(--radius-card); overflow: hidden; }
.mini-line__media img { height: 100%; object-fit: contain; }
.mini-line__media img[style*="object-position"] { object-fit: cover; }
.mini-line__media .photo-pending__mark { width: 36px; height: 36px; font-size: 16px; }
.mini-line__media .photo-pending__text { display: none; }
.mini-line h3 { font-size: 16px; line-height: 1.3; }
.mini-line h3 a { text-decoration: none; }
.mini-line p { font-size: var(--fs-xs); color: var(--muted); margin-top: 3px; }
.mini-line__price { font: 15px var(--serif); text-align: right; white-space: nowrap; }

.summary-row { display: flex; justify-content: space-between; gap: 16px; font-size: 14px; padding: 5px 0; }
.summary-row--total { font: 20px var(--serif); border-top: 1px solid var(--line); margin-top: 10px; padding-top: 14px; }
.summary-note { font-size: var(--fs-xs); color: var(--muted); margin-top: 8px; line-height: 1.5; }

/* --------------------------------------------------------------------------
   Reveal-on-scroll (only when JS confirms support; content never depends on it)
   ------------------------------------------------------------------------ */
.reveal-ready .reveal { opacity: 0; transform: translateY(16px); transition: opacity .6s var(--ease), transform .6s var(--ease); }
.reveal-ready .reveal.is-visible { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) { .reveal-ready .reveal { opacity: 1; transform: none; } }
.drawer__content { flex: 1; min-height: 0; display: flex; flex-direction: column; }
