:root {
  --cream: #f3eee6;
  --paper: #faf7f2;
  --ink: #1a1714;
  --muted: #6b645c;
  --line: #ddd4c8;
  --accent: #1f3d32;
  --accent-2: #8a3b3b;
  --card: #fffdf9;
  --shadow: 0 10px 30px rgba(26, 23, 20, 0.08);
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--cream); color: var(--ink); }
body {
  font-family: "Segoe UI", "PingFang SC", "Noto Sans SC", sans-serif;
  min-height: 100vh;
}
a { color: inherit; text-decoration: none; }
button, input, select, textarea {
  font: inherit;
  ime-mode: auto;
}
img { display: block; max-width: 100%; }

.topbar {
  position: sticky; top: 0; z-index: 40;
  display: flex; align-items: center; gap: 18px;
  padding: 14px 28px;
  background: rgba(243, 238, 230, 0.94);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; flex-direction: column; min-width: 280px; color: #0a2f6b; }
.brand strong {
  font-family: Palatino, "Palatino Linotype", "Times New Roman", serif;
  letter-spacing: 0.1em;
  font-size: 23px;
  color: #0a2f6b;
  white-space: nowrap;
}
.brand span {
  font-size: 16px; color: #0a2f6b; letter-spacing: 0.08em; text-transform: uppercase;
  white-space: nowrap;
}
.brand.is-zh strong,
.brand.is-zh span { letter-spacing: 0.28em; text-transform: none; }
.main-nav {
  display: flex;
  align-items: center;
  gap: 2px;
  flex: 0 0 auto;
}
.nav-link,
.nav-product-btn {
  border: 0;
  background: transparent;
  color: #0a2f6b;
  font-size: 15px;
  letter-spacing: 0.08em;
  padding: 8px 12px;
  cursor: pointer;
  white-space: nowrap;
  font-family: Palatino, "Palatino Linotype", "Times New Roman", serif;
}
.nav-link:hover,
.nav-product-btn:hover,
.nav-item.is-open .nav-product-btn {
  color: #08224d;
  text-decoration: underline;
  text-underline-offset: 4px;
}
/* Attract attention until a preview shape is selected */
#nav-preview-btn.is-preview-flash {
  border-radius: 6px;
  animation: previewNavFlash 1.1s ease-in-out infinite;
}
@keyframes previewNavFlash {
  0%, 100% {
    color: #0a2f6b;
    background: transparent;
    box-shadow: none;
  }
  35% {
    color: #fff;
    background: #0a2f6b;
    box-shadow: 0 0 0 2px rgba(10, 47, 107, 0.25);
  }
  70% {
    color: #7a1f1f;
    background: #f3d9a4;
    box-shadow: 0 0 0 2px rgba(180, 120, 40, 0.28);
  }
}
@media (prefers-reduced-motion: reduce) {
  #nav-preview-btn.is-preview-flash { animation: none; }
}
.nav-item { position: relative; }
.nav-flyout {
  display: none;
  position: absolute;
  top: calc(100% - 2px);
  left: 0;
  min-width: 188px;
  max-height: min(70vh, 480px);
  overflow: auto;
  background: var(--card);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  padding: 6px 0;
  z-index: 60;
}
.nav-item.is-open .nav-flyout { display: block; }
@media (hover: hover) and (pointer: fine) {
  .nav-item:hover .nav-flyout { display: block; }
}
.nav-flyout a {
  display: block;
  padding: 8px 16px;
  color: var(--ink);
  font-size: 14px;
  letter-spacing: 0.04em;
  white-space: nowrap;
}
.nav-flyout a:hover {
  background: var(--cream);
  color: #0a2f6b;
}
.nav-preview-flyout {
  min-width: min(92vw, 520px);
  padding: 12px 14px 14px;
  max-height: min(78vh, 560px);
}
.preview-row {
  display: grid;
  grid-template-columns: 72px 1fr;
  gap: 10px;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid var(--line);
}
.preview-row:last-child { border-bottom: 0; padding-bottom: 2px; }
.preview-row-label {
  font-size: 12px;
  letter-spacing: 0.06em;
  color: var(--muted);
  text-transform: uppercase;
}
.preview-row-masks {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}
.preview-mask {
  width: 54px;
  height: 36px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background-color: #f3eee6;
  background-image: none;
  -webkit-mask-image: var(--mask);
  mask-image: var(--mask);
  -webkit-mask-size: contain;
  mask-size: contain;
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
  -webkit-mask-position: center;
  mask-position: center;
  /* show silhouette: cream bg + dark fill via box + mask trick */
  background: #2a2622;
  cursor: pointer;
  padding: 0;
  transition: box-shadow 0.15s ease, border-color 0.15s ease, transform 0.15s ease;
}
.preview-row[data-kind="temple"] .preview-mask {
  width: 72px;
  height: 22px;
}
.preview-row[data-kind="ornament"] .preview-mask {
  width: 34px;
  height: 42px;
}
.preview-mask:hover {
  border-color: #0a2f6b;
  transform: translateY(-1px);
}
.preview-mask.is-selected {
  border-color: #0a2f6b;
  box-shadow: 0 0 0 2px rgba(10, 47, 107, 0.22);
}
.preview-tryon-row {
  margin-top: 10px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}
.preview-tryon-btn {
  width: 100%;
  border: 1px solid #0a2f6b;
  background: #0a2f6b;
  color: #fff;
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 14px;
  letter-spacing: 0.04em;
  cursor: pointer;
}
.preview-tryon-btn:hover { background: #082554; }
.preview-tryon-hint {
  margin: 8px 2px 0;
  font-size: 12px;
  line-height: 1.4;
  color: var(--muted);
}

/* Face try-on (camera) */
body.is-face-tryon { overflow: hidden; }
.face-tryon {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(12, 10, 8, 0.72);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px;
}
.face-tryon[hidden] { display: none !important; }
.face-tryon-panel {
  position: relative;
  width: min(100%, 420px);
  max-height: min(92vh, 820px);
  background: #141210;
  color: #f6f1ea;
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.45);
  display: flex;
  flex-direction: column;
}
.face-tryon-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  background: #1c1916;
}
.face-tryon-title { font-size: 15px; letter-spacing: 0.04em; }
.face-tryon-close {
  border: 0;
  background: transparent;
  color: #f6f1ea;
  font-size: 28px;
  line-height: 1;
  cursor: pointer;
  padding: 0 4px;
}
.face-tryon-stage {
  position: relative;
  width: 100%;
  aspect-ratio: 3 / 4;
  background: #000;
  overflow: hidden;
}
.face-tryon-stage video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: scaleX(-1);
  /* Mild clarity so live preview matches sharper capture */
  filter: contrast(1.08) saturate(1.04);
}
.face-tryon-frame {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 40%;
  height: 18%;
  opacity: 0;
  pointer-events: none;
  background-color: transparent;
  background-image: none;
  background-size: cover;
  background-position: center;
  -webkit-mask-image: var(--mask);
  mask-image: var(--mask);
  -webkit-mask-size: contain;
  mask-size: contain;
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
  -webkit-mask-position: center;
  mask-position: center;
  /* Frame dimmed (0.64 ≈ prior 0.80 then −20% more) */
  filter: brightness(0.64) drop-shadow(0 2px 3px rgba(0, 0, 0, 0.35));
  transition: opacity 0.15s ease;
}
.face-tryon-wait {
  position: absolute;
  inset: 0;
  z-index: 9;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(12, 10, 8, 0.88);
}
.face-tryon-wait[hidden] { display: none !important; }
.face-tryon-wait-text {
  margin: 0;
  font-size: 20px;
  letter-spacing: 0.12em;
  color: #f6f1ea;
}
.face-tryon-hint {
  position: absolute;
  left: 50%;
  top: 14px;
  transform: translateX(-50%);
  max-width: 90%;
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
  font-size: 13px;
  text-align: center;
  z-index: 3;
}
.face-tryon-shutter {
  position: absolute;
  left: 50%;
  bottom: 16px;
  transform: translateX(-50%);
  width: 68px;
  height: 68px;
  border: 0;
  padding: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.22);
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.85);
  cursor: pointer;
  z-index: 4;
}
.face-tryon-shutter-ring {
  display: block;
  width: 54px;
  height: 54px;
  margin: 7px auto;
  border-radius: 50%;
  background: #fff;
}
.face-tryon-shutter:active .face-tryon-shutter-ring { transform: scale(0.92); }
.face-tryon-flash {
  position: absolute;
  inset: 0;
  background: #fff;
  opacity: 0;
  pointer-events: none;
  z-index: 5;
  transition: opacity 0.12s ease;
}
.face-tryon-flash.is-on { opacity: 0.85; }
.face-tryon-controls { padding: 14px 16px 18px; background: #1c1916; }
.face-tryon-size {
  display: grid;
  grid-template-columns: 48px 1fr;
  gap: 10px;
  align-items: center;
  font-size: 13px;
  color: #d9d0c4;
}
.face-tryon-size input[type="range"] { width: 100%; }
.face-tryon-capture-btn {
  width: 100%;
  margin-top: 12px;
  border: 1px solid rgba(255, 255, 255, 0.28);
  background: #2a2622;
  color: #f6f1ea;
  border-radius: 10px;
  padding: 11px 14px;
  font-size: 14px;
  letter-spacing: 0.04em;
  cursor: pointer;
}
.face-tryon-capture-btn:hover { background: #3a342e; }
.face-tryon-note {
  margin: 10px 0 0;
  font-size: 12px;
  line-height: 1.45;
  color: #a89c8e;
}
.face-tryon-result {
  position: absolute;
  inset: 0;
  z-index: 8;
  background: rgba(12, 10, 8, 0.94);
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: center;
  padding: 16px;
  gap: 12px;
}
.face-tryon-result[hidden] { display: none !important; }
.face-tryon-result-title {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-align: center;
  color: #fff;
}
.face-tryon-result-img {
  width: 100%;
  max-height: 52vh;
  object-fit: contain;
  border-radius: 12px;
  background: #000;
  border: 2px solid rgba(255, 255, 255, 0.35);
  -webkit-touch-callout: default;
  user-select: none;
  -webkit-user-select: none;
}
.face-tryon-result-img.is-pulse {
  animation: faceTryonPulse 1.1s ease-in-out 0s 3;
}
@keyframes faceTryonPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(255, 255, 255, 0.15); }
  50% { box-shadow: 0 0 0 6px rgba(255, 255, 255, 0.35); }
}
.face-tryon-result-actions {
  display: grid;
  gap: 8px;
}
.face-tryon-save-photos {
  border: 0;
  border-radius: 10px;
  padding: 13px 14px;
  background: #0a2f6b;
  color: #fff;
  font-size: 15px;
  letter-spacing: 0.04em;
  cursor: pointer;
}
.face-tryon-save-photos:hover { background: #082554; }
.face-tryon-result-back {
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 10px;
  padding: 11px 14px;
  background: transparent;
  color: #f6f1ea;
  font-size: 14px;
  cursor: pointer;
}
.face-tryon-result-hint {
  margin: 0;
  font-size: 12px;
  line-height: 1.45;
  color: #a89c8e;
  text-align: center;
}
.tryon-chip {
  position: fixed;
  right: 14px;
  bottom: 18px;
  z-index: 90;
  border: 0;
  border-radius: 999px;
  padding: 12px 16px;
  background: #0a2f6b;
  color: #fff;
  font-size: 13px;
  letter-spacing: 0.04em;
  box-shadow: 0 8px 24px rgba(10, 47, 107, 0.35);
  cursor: pointer;
}
.tryon-chip:hover { background: #082554; }
body.is-face-tryon .tryon-chip { display: none; }
@media (min-width: 900px) {
  .tryon-chip { bottom: 28px; right: 28px; }
}
.search {
  flex: 1;
  display: flex;
  align-items: center;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0 6px 0 16px;
  min-width: 180px;
}
.search input {
  flex: 1; border: 0; background: transparent; outline: none;
  padding: 10px 8px; color: var(--ink);
}
.search button {
  border: 0; background: var(--accent); color: #f7f3ec;
  border-radius: 999px; padding: 8px 16px; cursor: pointer;
}
.tools { display: flex; align-items: center; gap: 10px; }
.icon-btn, .lang-btn {
  border: 1px solid var(--line); background: var(--card);
  border-radius: 999px; padding: 8px 12px; cursor: pointer; color: var(--ink);
}
.icon-btn { position: relative; }
.badge {
  position: absolute; top: -6px; right: -4px;
  background: var(--accent-2); color: white; font-size: 10px;
  min-width: 16px; height: 16px; border-radius: 99px;
  display: grid; place-items: center; padding: 0 4px;
}
.wrap { width: min(1400px, calc(100% - 40px)); margin: 0 auto; padding: 28px 0 80px; }
.hero { padding: 18px 0 8px; }
.hero.is-compact { padding: 8px 0 0; }
.hero.is-compact h1 { font-size: 32px; }
.hero h1 {
  font-family: Palatino, "Palatino Linotype", serif;
  font-weight: 500; font-size: 42px; margin: 0 0 8px;
}
.hero p { margin: 0; color: var(--muted); max-width: 640px; line-height: 1.55; }

.filters {
  display: flex; flex-wrap: wrap; gap: 10px; align-items: center;
  margin: 22px 0 8px; padding: 14px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line);
}
.filters label { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.08em; }
.filters select {
  border: 1px solid var(--line); background: var(--card); border-radius: 8px;
  padding: 7px 10px; color: var(--ink);
}
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  border: 1px solid var(--line); background: transparent; border-radius: 999px;
  padding: 6px 12px; cursor: pointer; color: var(--muted); font-size: 13px;
}
.chip.on { background: var(--ink); color: var(--paper); border-color: var(--ink); }

.section { margin-top: 36px; }
.section-head {
  display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 14px;
}
.section-head h2 {
  font-family: Palatino, "Palatino Linotype", serif;
  font-weight: 500; font-size: 26px; margin: 0;
}
.more { font-size: 13px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--accent); }

.cat-row {
  display: grid;
  grid-template-columns: 168px minmax(0, 1fr);
  gap: 16px 28px;
  align-items: start;
  padding: 28px 0 32px;
  border-bottom: 1px solid var(--line);
}
.cat-row-meta h2 {
  font-family: Palatino, "Palatino Linotype", serif;
  font-weight: 500;
  font-size: 22px;
  margin: 0 0 12px;
  line-height: 1.25;
}
.cat-row-meta .more { display: inline-block; }
.cat-row-colors {
  display: grid;
  grid-template-columns: repeat(8, minmax(0, 1fr));
  gap: 8px;
}
.card.is-chip {
  position: relative;
  background: #d8cfc3;
  border: 0;
  box-shadow: none;
  overflow: hidden;
}
.card.is-chip .pic {
  aspect-ratio: 2 / 1;
  background: #d8cfc3;
  overflow: hidden; /* keep 2:1 even for tall portrait thumbs */
  height: auto;
}
/* Frame+temple taller box is for grid/detail only — not homepage chips */
.card.is-chip .pic.is-frame-temple {
  height: auto;
  aspect-ratio: 2 / 1;
  overflow: hidden;
}
/* Homepage: both shapes must fit the short chip (full-sheet mm sizes clip) */
.card.is-chip .pic.is-preview-mode.is-frame-temple .shape-stage-frame-temple {
  gap: 3px;
  padding: 4px 6px;
  overflow: hidden;
  justify-content: center;
}
.card.is-chip .pic.is-preview-mode.is-frame-temple .shape-slot-frame {
  aspect-ratio: auto;
  width: 100%;
  height: auto;
  flex: 1 1 auto;
  min-height: 0;
}
.card.is-chip .pic.is-preview-mode.is-frame-temple .shape-slot-temple {
  width: 100%;
  height: 14px;
  min-height: 0;
  aspect-ratio: auto;
  flex: 0 0 14px;
}
.card.is-chip .pic.is-preview-mode.is-frame-temple .shape-slot-frame .shape-large.is-frame {
  -webkit-mask-size: contain;
  mask-size: contain;
  -webkit-mask-position: center;
  mask-position: center;
  background-size: cover;
}
.card.is-chip .pic.is-preview-mode.is-frame-temple .shape-slot-temple .shape-large.is-temple {
  -webkit-mask-size: 90% auto;
  mask-size: 90% auto;
  -webkit-mask-position: center;
  mask-position: center;
  background-size: cover;
}
.card.is-chip img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.card.is-chip .sku {
  position: absolute;
  top: 5px;
  left: 7px;
  z-index: 2;
  font-size: 10px;
  letter-spacing: 0.03em;
  color: #fff;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.55);
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, 165mm);
  gap: 16px 20px;
  justify-content: start;
}
.card {
  background: var(--card); border: 1px solid var(--line); overflow: hidden;
  box-shadow: var(--shadow); cursor: pointer; display: flex; flex-direction: column;
  user-select: none;
  -webkit-user-select: none;
}
.grid .card { width: 165mm; }
.card .pic {
  position: relative;
  overflow: hidden; background: #e8e0d4;
  container-type: inline-size;
}
.grid .card .pic {
  width: 165mm;
  height: 60mm;
  aspect-ratio: 165 / 60;
}
.card img { width: 100%; height: 100%; object-fit: cover; display: block; }
.card .pic > img:first-child { transition: opacity 0.18s ease; }
.shape-view {
  position: absolute;
  inset: 0;
  z-index: 1;
  background: var(--cream);
  opacity: 0;
  pointer-events: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  overflow: hidden;
  padding: 12px 10px 22px;
  transition: opacity 0.18s ease;
}
.shape-picker {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 18px;
  pointer-events: auto;
  z-index: 2;
}
.shape-mini,
.shape-large {
  border: 0;
  padding: 0;
  background-color: transparent;
  background-image: var(--sheet);
  background-size: auto calc(100cqw * 60 / 165);
  background-position: center;
  -webkit-mask-image: var(--mask);
  mask-image: var(--mask);
  -webkit-mask-size: contain;
  mask-size: contain;
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
  -webkit-mask-position: center;
  mask-position: center;
  -webkit-mask-source-type: alpha;
  mask-mode: alpha;
  image-rendering: auto;
  cursor: pointer;
}
.shape-mini {
  position: relative;
  flex: 0 0 auto;
}
.shape-mini.is-frame { width: 118px; height: 44px; }
.shape-mini.is-temple { width: 148px; height: 18px; }
.shape-mini.is-ornament,
.shape-mini.is-ornament_heart,
.shape-mini.is-ornament_star { width: 56px; height: 72px; }
.shape-mini span {
  position: absolute;
  left: 50%;
  top: 100%;
  transform: translate(-50%, 3px);
  font-size: 10px;
  letter-spacing: 0.04em;
  color: var(--muted);
  white-space: nowrap;
  -webkit-mask-image: none;
  mask-image: none;
  background: none;
}
.shape-stage {
  display: none;
  align-items: center;
  justify-content: center;
  width: 100%;
  flex: 1 1 auto;
  min-height: 0;
}
.pic.is-shape-open .shape-view {
  justify-content: flex-end;
  padding: 8px 10px 10px;
}
.pic.is-shape-open .shape-stage {
  display: block;
  position: absolute;
  inset: 0;
  z-index: 1;
}
.pic.is-shape-open .shape-picker { padding: 0; gap: 14px; }
.pic.is-shape-open .shape-mini.is-frame { width: 48px; height: 18px; }
.pic.is-shape-open .shape-mini.is-temple { width: 64px; height: 10px; }
.pic.is-shape-open .shape-mini.is-ornament { width: 24px; height: 30px; }
.pic.is-shape-open .shape-mini.is-ornament_heart,
.pic.is-shape-open .shape-mini.is-ornament_star { width: 24px; height: 30px; }
.pic.is-shape-open .shape-mini span { display: none; }
.shape-large {
  pointer-events: none;
  cursor: default;
  max-width: 100%;
  max-height: 100%;
}
.pic.is-shape-open .shape-large {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  max-width: none;
  max-height: none;
  aspect-ratio: auto;
  background-size: cover;
  background-position: center;
  -webkit-mask-position: center 40%;
  mask-position: center 40%;
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
}
.pic[data-kind="frame"] .shape-large,
.pic[data-shape="frame"] .shape-large {
  -webkit-mask-size: calc(135 / 165 * 100%) auto;
  mask-size: calc(135 / 165 * 100%) auto;
  -webkit-mask-position: center;
  mask-position: center;
}
.pic[data-kind="temple"] .shape-large,
.pic[data-shape="temple"] .shape-large {
  -webkit-mask-size: 88% auto;
  mask-size: 88% auto;
}
.pic[data-kind="ornament"] .shape-large,
.pic[data-shape="ornament"] .shape-large {
  -webkit-mask-size: auto 72%;
  mask-size: auto 72%;
}
/* Ornament preview: one row of 3, inside the normal sheet size */
.pic.is-preview-mode.is-ornament-set .shape-stage-ornament-set {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  position: absolute;
  inset: 0;
  padding: 6px 8px;
  box-sizing: border-box;
}
.pic.is-preview-mode.is-ornament-set .ornament-group {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  gap: 6%;
  width: 100%;
  height: 100%;
}
/* Three ornaments in a row. Wide sheets keep sheet scale; tall pattern sheets cover each shape. */
.pic.is-preview-mode.is-ornament-set .shape-large.is-ornament {
  position: relative;
  inset: auto;
  flex: 0 0 auto;
  width: 26%;
  height: 86%;
  max-width: none;
  max-height: none;
  aspect-ratio: auto;
  background-size: 100cqw auto;
  background-position: center;
  -webkit-mask-size: contain;
  mask-size: contain;
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
  -webkit-mask-position: center;
  mask-position: center;
}
.pic.is-tall-sheet.is-ornament-set .shape-large.is-ornament,
.pic.is-ornament-set.is-tall-sheet .shape-large.is-ornament {
  background-size: cover;
  background-position: center;
}
/* Global Preview menu: one selected shape, no 3 mini pickers */
.pic.is-preview-mode .shape-picker { display: none; }
.pic.is-preview-mode .shape-stage-global {
  display: flex;
  position: absolute;
  inset: 0;
  z-index: 1;
  align-items: center;
  justify-content: center;
}
.pic.is-preview-mode .shape-large {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  max-width: none;
  max-height: none;
  aspect-ratio: auto;
  background-size: cover;
  background-position: center;
  -webkit-mask-position: center;
  mask-position: center;
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
  pointer-events: none;
}
/*
 * Frame + temple stack — taller pic so both shapes show in full (no clip).
 * Frame & temple keep prior mask sizing; 1cm gap between them.
 */
.grid .card .pic.is-frame-temple,
.detail .pic.is-frame-temple {
  height: 135mm;
  aspect-ratio: 165 / 135;
}
/* Only enlarge/overflow on full cards — chips stay compact 2:1 */
.grid .card .pic.is-preview-mode.is-frame-temple,
.detail .pic.is-preview-mode.is-frame-temple {
  overflow: visible;
}
.grid .card .pic.is-preview-mode.is-frame-temple .shape-view,
.detail .pic.is-preview-mode.is-frame-temple .shape-view {
  overflow: visible;
}
.pic.is-preview-mode.is-frame-temple .shape-stage-frame-temple {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1cm;
  position: absolute;
  inset: 0;
  padding: 8mm 4mm;
  box-sizing: border-box;
  overflow: visible;
}
.pic.is-preview-mode.is-frame-temple .shape-slot {
  position: relative;
  width: 100%;
  flex: 0 0 auto;
  max-height: none;
}
/* Frame: same mask sizing as frame-only preview */
.pic.is-preview-mode.is-frame-temple .shape-slot-frame {
  aspect-ratio: 165 / 52;
  width: 100%;
}
.pic.is-preview-mode.is-frame-temple .shape-slot-frame .shape-large.is-frame {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  -webkit-mask-size: calc(135 / 165 * 100%) auto;
  mask-size: calc(135 / 165 * 100%) auto;
  -webkit-mask-position: center;
  mask-position: center;
  background-size: cover;
  background-position: center;
}
/*
 * Temple length as before (temple-only): mask-size 88% auto on a full-width
 * band tall enough that the long temple is not height-squeezed.
 */
.pic.is-preview-mode.is-frame-temple .shape-slot-temple {
  width: 100%;
  height: 36mm;
  aspect-ratio: auto;
  min-height: 36mm;
}
.pic.is-preview-mode.is-frame-temple .shape-slot-temple .shape-large.is-temple {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  -webkit-mask-size: 88% auto;
  mask-size: 88% auto;
  -webkit-mask-position: center;
  mask-position: center;
  background-size: cover;
  background-position: center;
}
.card.is-chip .shape-mini,
.card.is-chip .shape-large {
  background-size: auto calc(100cqw * 0.5);
}
.card.is-chip .shape-mini.is-frame { width: 56px; height: 22px; }
.card.is-chip .shape-mini.is-temple { width: 72px; height: 10px; }
.card.is-chip .shape-mini.is-ornament,
.card.is-chip .shape-mini.is-ornament_heart,
.card.is-chip .shape-mini.is-ornament_star { width: 28px; height: 36px; }
.card.is-chip .shape-mini span { display: none; }
.card .pic,
.detail .pic { touch-action: manipulation; }
.pic.is-shape-open,
.pic.is-shape-open .shape-view,
.pic.is-shape-open .shape-stage,
.pic.is-shape-open .shape-large {
  touch-action: pan-x pan-y pinch-zoom;
}
.card.is-framed .shape-view,
.card .pic:active .shape-view,
.detail .pic.is-framed .shape-view,
.detail .pic:active .shape-view,
.pic.is-shape-open .shape-view { opacity: 1; pointer-events: auto; }
.card.is-framed .pic > img:first-child,
.card .pic:active > img:first-child,
.detail .pic.is-framed > img:first-child,
.detail .pic:active > img:first-child,
.pic.is-shape-open > img:first-child { opacity: 0; }
@media (hover: hover) and (pointer: fine) {
  .card:hover .shape-view,
  .card:focus-within .shape-view,
  .detail .pic:hover .shape-view { opacity: 1; pointer-events: auto; }
  .card:hover .pic > img:first-child,
  .card:focus-within .pic > img:first-child,
  .detail .pic:hover > img:first-child { opacity: 0; }
  /* Lead sheet: click toggles shape/sheet — hover must not override sheet mode */
  .card.is-preview-lead:not(.is-framed):hover .shape-view,
  .card.is-preview-lead:not(.is-framed):focus-within .shape-view,
  .detail.is-preview-lead .pic:not(.is-framed):hover .shape-view {
    opacity: 0;
    pointer-events: none;
  }
  .card.is-preview-lead:not(.is-framed):hover .pic > img:first-child,
  .card.is-preview-lead:not(.is-framed):focus-within .pic > img:first-child,
  .detail.is-preview-lead .pic:not(.is-framed):hover > img:first-child { opacity: 1; }
}
.card.is-colorway .pic { background: #efe8dc; }
.card.is-colorway .pic > img:first-child { object-fit: cover; }
.card.is-current { outline: 2px solid var(--accent); outline-offset: -2px; }
.card .meta { padding: 12px 12px 14px; }
.card .sku { font-size: 11px; color: var(--muted); letter-spacing: 0.06em; }
.card h3 { margin: 4px 0 0; font-size: 15px; font-weight: 600; }
.heart {
  margin-left: auto; border: 0; background: transparent; cursor: pointer; font-size: 16px;
}
.row-top { display: flex; align-items: center; gap: 8px; }

.detail {
  display: grid; grid-template-columns: 165mm minmax(0, 1fr); gap: 36px; align-items: start;
}
.detail .pic {
  position: relative;
  width: 165mm;
  height: 60mm;
  min-height: 0;
  max-width: 100%;
  background: var(--card);
  border: 1px solid var(--line);
  overflow: hidden;
  container-type: inline-size;
}
.detail .pic > img:first-child {
  width: 100%;
  height: 100%;
  max-height: none;
  object-fit: cover;
  transition: opacity 0.18s ease;
}
@media (hover: hover) and (pointer: fine) {
  .detail .pic:hover .shape-view { opacity: 1; pointer-events: auto; }
  .detail .pic:hover > img:first-child { opacity: 0; }
}
.spec { color: var(--muted); line-height: 1.7; }
.spec dt { font-size: 11px; text-transform: uppercase; letter-spacing: 0.08em; margin-top: 12px; }
.spec dd { margin: 0; color: var(--ink); }
.actions { display: flex; gap: 10px; margin-top: 22px; }
.primary, .ghost {
  border-radius: 999px; padding: 10px 18px; cursor: pointer;
}
.primary { border: 0; background: var(--accent); color: #f6f1ea; }
.ghost { border: 1px solid var(--line); background: var(--card); }

.empty { padding: 48px 0; color: var(--muted); }
.crumb { font-size: 13px; color: var(--muted); margin-bottom: 18px; }
.crumb a { text-decoration: underline; text-underline-offset: 3px; }

.about {
  background: var(--card); border: 1px solid var(--line); padding: 28px 32px;
  line-height: 1.75; max-width: 720px;
}
.about p { margin: 0 0 1.05em; }
.about p:last-child { margin-bottom: 0; }

footer {
  border-top: 1px solid var(--line); padding: 22px 28px; color: var(--muted); font-size: 13px;
  display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap;
}

.grid.is-related {
  grid-template-columns: repeat(auto-fill, 50mm);
}
.grid.is-related .card {
  width: 50mm;
}
.grid.is-related .card .pic {
  width: 50mm;
  height: calc(50mm * 60 / 165);
  overflow: hidden;
}
/* Related thumbs are short — fit frame + temple inside (full-sheet mm sizes clip the frame) */
.grid.is-related .pic.is-preview-mode.is-frame-temple .shape-stage-frame-temple {
  gap: 2px;
  padding: 2px 3px;
  overflow: hidden;
  justify-content: center;
}
.grid.is-related .pic.is-preview-mode.is-frame-temple .shape-slot-frame {
  aspect-ratio: auto;
  width: 100%;
  height: auto;
  flex: 1 1 auto;
  min-height: 0;
}
.grid.is-related .pic.is-preview-mode.is-frame-temple .shape-slot-temple {
  width: 100%;
  height: 10px;
  min-height: 0;
  aspect-ratio: auto;
  flex: 0 0 10px;
}
.grid.is-related .pic.is-preview-mode.is-frame-temple .shape-slot-frame .shape-large.is-frame {
  -webkit-mask-size: contain;
  mask-size: contain;
  -webkit-mask-position: center;
  mask-position: center;
  background-size: cover;
}
.grid.is-related .pic.is-preview-mode.is-frame-temple .shape-slot-temple .shape-large.is-temple {
  -webkit-mask-size: 90% auto;
  mask-size: 90% auto;
  -webkit-mask-position: center;
  mask-position: center;
  background-size: cover;
}
.grid.is-related .card h3 { font-size: 12px; }
.grid.is-related .card .meta { padding: 8px 8px 10px; }

@media (max-width: 1100px) {
  .cat-row-colors { grid-template-columns: repeat(6, minmax(0, 1fr)); }
}
@media (max-width: 980px) {
  .cat-row { grid-template-columns: 1fr; gap: 12px; padding: 22px 0; }
  .cat-row-colors { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .detail { grid-template-columns: 1fr; }
  .hero h1 { font-size: 32px; }
}
@media (max-width: 720px) {
  .grid,
  .grid.is-related { grid-template-columns: minmax(0, 1fr); }
  .grid .card,
  .grid .card .pic,
  .grid.is-related .card,
  .grid.is-related .card .pic,
  .detail .pic {
    width: 100%;
    height: auto;
  }
  .grid .card .pic,
  .grid.is-related .card .pic,
  .detail .pic { aspect-ratio: 165 / 60; }
  .grid .card .pic.is-frame-temple,
  .detail .pic.is-frame-temple { aspect-ratio: 165 / 120; height: auto; }
  /*
   * Mobile only: keep gap at true 1cm. Desktop left unchanged.
   * Extra space was empty padding inside tall temple/frame slots — tighten
   * slots and pin masks face-to-face (frame bottom / temple top).
   */
  .pic.is-preview-mode.is-frame-temple .shape-stage-frame-temple {
    gap: 1cm;
    padding: 8px 6px;
    justify-content: center;
  }
  .pic.is-preview-mode.is-frame-temple .shape-slot-frame {
    aspect-ratio: 165 / 48;
  }
  .pic.is-preview-mode.is-frame-temple .shape-slot-frame .shape-large.is-frame {
    -webkit-mask-position: center bottom;
    mask-position: center bottom;
  }
  .pic.is-preview-mode.is-frame-temple .shape-slot-temple {
    height: auto;
    min-height: 0;
    /* Tight band ≈ temple height at 88% width (aspect ~9.76) */
    aspect-ratio: 11 / 1;
  }
  .pic.is-preview-mode.is-frame-temple .shape-slot-temple .shape-large.is-temple {
    -webkit-mask-size: 88% auto;
    mask-size: 88% auto;
    -webkit-mask-position: center top;
    mask-position: center top;
  }
  .cat-row-colors { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .topbar { flex-wrap: wrap; }
  .brand { min-width: 0; }
  .main-nav { order: 3; flex-basis: 100%; justify-content: flex-start; }
  .search { order: 5; flex-basis: 100%; }
  .tools { margin-left: auto; }
  .brand strong,
  .brand span { white-space: normal; }
}
