/* ===========================================================
   Wishlist viewer (index.html?list=...) — the public page a
   shared link opens. Page-only styles; tokens, base type and
   buttons live in ../site.css. Both colour schemes come from
   the tokens, nothing branches on theme here.

   One action colour rule: the viewer has many "buy" links, so
   they use the quiet spruce action colour, never persimmon.
   =========================================================== */

/* the viewer relied on a blanket reset; scope it with zero specificity */
:where(#viewer) * { margin: 0; padding: 0; }

/* ---------- app banner ---------- */
.app-banner {
  background: var(--spruce-900); color: var(--paper-1);
  padding: 12px var(--margin);
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  position: sticky; top: 0; z-index: 100;
  border-bottom: 4px solid var(--spruce-800);
}
.app-banner-left { display: flex; align-items: center; gap: 10px; min-width: 0; }
.app-banner-text { min-width: 0; }
.app-banner-title { font: 700 var(--step-body)/1.2 var(--font-body); }
.app-banner-subtitle { font: 400 var(--step-small)/1.3 var(--font-body); color: var(--spruce-200); }
.app-banner-btn {
  display: inline-flex; align-items: center; min-height: 44px; padding: 0 20px;
  background: var(--paper-1); color: var(--spruce-900);
  border-radius: var(--radius-md); font: 700 var(--step-small)/1 var(--font-body);
  text-decoration: none; white-space: nowrap; flex-shrink: 0;
  transition: transform var(--t-press) var(--ease-out);
}
.app-banner-btn:active { transform: scale(0.97); }

/* ---------- header ---------- */
.header { background: var(--bg-card); border-bottom: 1px solid var(--border-line); }
.header-inner { max-width: 640px; margin: 0 auto; padding: 24px 16px; }
.header-cover {
  width: 100vw; height: 220px; object-fit: cover;
  margin-left: calc(-50vw + 50%); margin-bottom: 16px; border-radius: 0;
}
.header-owner {
  font: 600 var(--step-small)/1.3 var(--font-body); color: var(--text-secondary);
  text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 4px;
}
.header-title { font-size: var(--step-title); line-height: 1.15; color: var(--text-primary); margin-bottom: 8px; }
.header-description { font: 400 var(--step-body)/1.5 var(--font-body); color: var(--text-secondary); }
.header-meta { margin-top: 12px; display: flex; gap: 16px; font: 500 var(--step-small)/1.3 var(--font-body); color: var(--text-muted); }

/* ---------- content ---------- */
.content { max-width: 640px; margin: 0 auto; padding: 16px; }
.section-header {
  font: 700 var(--step-body)/1.3 var(--font-body); color: var(--text-primary);
  padding: 16px 0 8px; border-bottom: 1px solid var(--border-line); margin-bottom: 12px;
}

/* ---------- item cards (flat surface, one tone step up) ---------- */
.item-card {
  background: var(--bg-card); border-radius: var(--radius-lg);
  border: 1px solid var(--border-line); overflow: hidden; margin-bottom: 12px;
}
.item-card-inner { display: flex; gap: 12px; padding: 12px; }
.item-image, .item-image-placeholder {
  width: 100px; height: 100px; border-radius: var(--radius-sm); flex-shrink: 0;
}
.item-image { object-fit: contain; background: var(--bg-sunken); }
.item-image-placeholder {
  background: var(--surface-brand-soft); color: var(--text-brand);
  display: flex; align-items: center; justify-content: center;
  font: 400 32px/1 var(--font-display);
}
.item-details { flex: 1; min-width: 0; display: flex; flex-direction: column; justify-content: center; }
.item-name {
  font: 600 var(--step-body)/1.3 var(--font-body); color: var(--text-primary); margin-bottom: 4px;
  overflow: hidden; text-overflow: ellipsis;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
}
.item-description {
  font: 400 var(--step-small)/1.4 var(--font-body); color: var(--text-secondary); margin-bottom: 8px;
  overflow: hidden; text-overflow: ellipsis;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
}
.item-price { font: 700 var(--step-body)/1.3 var(--font-body); color: var(--text-primary); margin-bottom: 4px; }
.item-price-range { font: 400 var(--step-small)/1.3 var(--font-body); color: var(--text-muted); }
.item-status-reserved {
  display: inline-block; align-self: flex-start;
  background: var(--surface-brand-soft); color: var(--text-brand);
  font: 600 var(--step-small)/1.3 var(--font-body);
  padding: 2px 10px; border-radius: var(--radius-sm); margin-bottom: 4px;
}
.item-buy-btn {
  display: inline-flex; align-items: center; gap: 6px; align-self: flex-start;
  min-height: 44px; padding: 0 18px; margin-top: auto;
  background: var(--action-secondary); color: var(--bg-canvas);
  border-radius: var(--radius-md); font: 700 var(--step-small)/1 var(--font-body);
  text-decoration: none; transition: transform var(--t-press) var(--ease-out);
}
.item-buy-btn:active { transform: scale(0.97); }
.item-buy-btn svg { width: 14px; height: 14px; }

/* ---------- price options ---------- */
.price-options { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.price-option {
  display: inline-flex; align-items: center; gap: 4px; min-height: 44px; padding: 0 12px;
  background: var(--bg-sunken); color: var(--text-secondary);
  border-radius: var(--radius-sm); font: 600 var(--step-small)/1 var(--font-body);
  text-decoration: none; transition: background-color var(--t-hover) ease;
}
@media (hover: hover) { .price-option:hover { background: var(--surface-brand-soft); } }

/* ---------- loading / error / empty ---------- */
.loading-container, .error-container { text-align: center; padding: 60px 20px; }
.loading-spinner {
  width: 40px; height: 40px; margin: 0 auto 16px; border-radius: 50%;
  border: 3px solid var(--border-line); border-top-color: var(--action-secondary);
}
@media (prefers-reduced-motion: no-preference) {
  .loading-spinner { animation: viewer-spin 0.8s linear infinite; }
}
@keyframes viewer-spin { to { transform: rotate(360deg); } }
.loading-text { font: 400 var(--step-body)/1.4 var(--font-body); color: var(--text-secondary); }
.error-title { font: 400 var(--step-title)/1.2 var(--font-display); color: var(--text-primary); margin-bottom: 8px; }
.error-message { font: 400 var(--step-body)/1.5 var(--font-body); color: var(--text-secondary); margin: 0 auto 20px; }
.error-btn {
  display: inline-flex; align-items: center; min-height: 44px; padding: 0 24px;
  background: var(--action-secondary); color: var(--bg-canvas);
  border-radius: var(--radius-md); font: 700 var(--step-body)/1 var(--font-body); text-decoration: none;
}
.empty-state { text-align: center; padding: 40px 20px; color: var(--text-muted); }
.empty-state-text { font: 400 var(--step-body)/1.4 var(--font-body); }

/* ---------- viewer footer ---------- */
.viewer-footer { text-align: center; padding: 32px 16px; color: var(--text-muted); font: 400 var(--step-small)/1.5 var(--font-body); }
.viewer-footer p { margin-inline: auto; }
.viewer-footer a { color: var(--link); text-decoration: underline; text-underline-offset: 0.15em; }
.viewer-footer-note { margin-top: 8px; }

@media (min-width: 768px) {
  .header-inner { padding: 32px 24px; }
  .content { padding: 24px; }
  .header-cover { height: 240px; }
  .item-image, .item-image-placeholder { width: 120px; height: 120px; }
}
