/* Shop (กำไลพร้อมส่ง): the stone tray filter + grid. Builds on styles.css tokens. */

.nav-links a[aria-current="page"] { font-weight: 500; text-decoration: underline 1px; text-underline-offset: 8px; }
.nav-links a[aria-current="page"]::after { display: none; }

/* Intro */
.shop-head { display: flex; flex-direction: column; align-items: center; gap: 18px; padding: 88px 24px 0; text-align: center; }
.shop-head h1 { font-size: 44px; line-height: 60px; }
.shop-head .body { max-width: 600px; }

/* Intent chips */
.intents { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; padding-top: 22px; }
.intents button {
  display: inline-flex; align-items: center; gap: 9px;
  font: inherit; font-size: 15px; line-height: 20px; color: var(--ink);
  padding: 13px 22px; border-radius: 999px; border: 1px solid var(--rule); background: #fff; cursor: pointer;
  transition: border-color 160ms ease, background-color 160ms ease, transform 160ms var(--ease-out);
}
.intents button:active { transform: scale(0.97); }
.intents button[aria-pressed="true"] { border-color: var(--ink); background: #F7F6F3; font-weight: 500; }
.intents button:focus-visible { outline: 2px solid var(--sage); outline-offset: 2px; }
.dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; transition: transform 200ms var(--ease-out); }
.intents button[aria-pressed="true"] .dot { transform: scale(1.3); }

/* The tray: one painting, dimmed, with a lit copy masked around the chosen stone. */
@property --lx { syntax: "<percentage>"; inherits: true; initial-value: 18.2%; }
.tray-wrap { display: flex; flex-direction: column; align-items: center; padding: 40px 24px 0; }
.tray { position: relative; width: 1100px; max-width: 100%; aspect-ratio: 1100 / 300; --lx: 18.2%; transition: --lx 520ms var(--ease-in-out); }
.tray i {
  position: absolute; inset: 0;
  background: url(assets/tray.png) 50% 54% / 100% auto no-repeat;
}
.tray .base { opacity: 0.3; transition: opacity 360ms ease; }
.tray .lit {
  -webkit-mask-image: radial-gradient(11.4% 50% at var(--lx) 52%, #000 62%, transparent 100%);
  mask-image: radial-gradient(11.4% 50% at var(--lx) 52%, #000 62%, transparent 100%);
}
.tray.all .base { opacity: 1; }

.captions { position: relative; width: 1100px; max-width: 100%; height: 50px; }
.captions li {
  position: absolute; top: 0; width: 160px; margin-left: -80px;
  display: flex; flex-direction: column; align-items: center; gap: 4px; text-align: center;
  color: var(--muted); transition: color 240ms ease;
}
.captions b { font-weight: 400; font-size: 15px; line-height: 22px; }
.captions small { font-size: 13px; line-height: 18px; }
.captions li.on { color: var(--ink); }
.captions li.on b { font-weight: 600; }
.captions li.on small { color: var(--sand-ink); }

.belief-line { max-width: 720px; padding-top: 26px; color: var(--muted); font-size: 15px; line-height: 24px; text-align: center; min-height: 50px; }
.belief-line a { color: var(--ink); text-decoration: underline 1px; text-underline-offset: 4px; }

/* Results */
.results { display: flex; flex-direction: column; align-items: center; padding: 72px 24px 0; }
.bar, .grid, .grid-note { width: 1200px; max-width: 100%; }
.bar { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; flex-wrap: wrap; padding-bottom: 18px; border-bottom: 1px solid var(--rule); }
.bar-title { display: flex; align-items: baseline; gap: 12px; }
.bar-title h2 { font-family: var(--head); font-weight: 600; font-size: 20px; line-height: 30px; }
.bar-title span { color: var(--muted); font-size: 15px; line-height: 22px; }
.bar-tools { display: flex; align-items: center; gap: 28px; font-size: 15px; line-height: 22px; }

.switch { display: flex; align-items: center; gap: 10px; cursor: pointer; }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch .track { width: 36px; height: 20px; padding: 2px; border: 1px solid var(--field); border-radius: 999px; display: flex; align-items: center; transition: background-color 160ms ease, border-color 160ms ease; }
.switch .knob { width: 14px; height: 14px; border-radius: 50%; background: var(--muted); transition: transform 200ms var(--ease-out), background-color 160ms ease; }
.switch input:checked + .track { background: var(--sage); border-color: var(--sage); }
.switch input:checked + .track .knob { transform: translateX(16px); background: #fff; }
.switch input:focus-visible + .track { outline: 2px solid var(--sage); outline-offset: 2px; }

.sort { display: flex; align-items: center; gap: 8px; }
.sort span { color: var(--muted); }
.sort select {
  font: inherit; color: var(--ink); border: 0; background: transparent; cursor: pointer;
  appearance: none; padding-right: 18px;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath d='M2.5 4.5 6 8l3.5-3.5' fill='none' stroke='%23111827' stroke-width='1.4' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") right center no-repeat;
}

.grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); column-gap: 24px; row-gap: 64px; padding-top: 40px; }
.card-p { display: flex; flex-direction: column; gap: 10px; color: inherit; }
.card-p[hidden], .custom-card[hidden] { display: none; }
.card-p .ph { aspect-ratio: 1; overflow: hidden; }
.card-p .ph img { width: 100%; height: 100%; object-fit: cover; filter: brightness(1.07) contrast(1.06) saturate(1.05); transition: transform 420ms var(--ease-out); }
.card-p .meta { display: flex; flex-direction: column; gap: 8px; padding-top: 6px; }
.card-p h3 { font-family: var(--head); font-weight: 600; font-size: 20px; line-height: 30px; }
.tags { display: flex; flex-wrap: wrap; gap: 8px; }
.tag { padding: 5px 12px; border-radius: 999px; background: var(--sand-wash); color: var(--sand-ink); font-size: 13px; font-weight: 500; line-height: 18px; }
.card-p .desc { color: var(--muted); font-size: 15px; line-height: 24px; }
.price-row { display: flex; align-items: baseline; gap: 10px; padding-top: 4px; }
.price-row b { font-size: 17px; font-weight: 600; line-height: 26px; }
.price-row span { color: var(--muted); font-size: 13px; line-height: 18px; }

.custom-card {
  display: flex; flex-direction: column; justify-content: space-between; aspect-ratio: 1;
  padding: 34px 32px 32px; border: 1px solid var(--rule); border-radius: 18px; color: inherit;
  transition: border-color 160ms ease;
}
.custom-card .top { display: flex; flex-direction: column; gap: 14px; }
.custom-card .ic { width: 44px; height: 44px; border-radius: 50%; background: var(--sage-wash); display: flex; align-items: center; justify-content: center; }
.custom-card h3 { font-family: var(--head); font-weight: 600; font-size: 24px; line-height: 36px; }
.custom-card p { color: var(--muted); font-size: 15px; line-height: 24px; }
.custom-card .go { display: flex; align-items: center; gap: 8px; color: var(--sage); font-size: 15px; font-weight: 500; line-height: 22px; }
.custom-card .go svg { transition: transform 200ms var(--ease-out); }

.empty { grid-column: 1 / span 2; align-self: center; display: flex; flex-direction: column; gap: 12px; max-width: 520px; }
.empty[hidden] { display: none; }
.empty h3 { font-family: var(--head); font-weight: 600; font-size: 28px; line-height: 40px; }
.empty p { color: var(--muted); font-size: 17px; line-height: 30px; }

.grid-note { padding-top: 48px; color: var(--muted); font-size: 13px; line-height: 20px; }

/* Label key */
.key { display: flex; justify-content: center; padding: 140px 24px; }
.key-in { display: flex; justify-content: space-between; align-items: flex-start; gap: 48px; width: 1200px; max-width: 100%; }
.key-text { width: 440px; display: flex; flex-direction: column; gap: 18px; }
.key-list { width: 640px; border-top: 1px solid var(--rule); }
.key-list li { display: flex; gap: 24px; padding: 24px 0; border-bottom: 1px solid var(--rule); }
.key-list .k { width: 160px; flex-shrink: 0; padding-top: 2px; }
.key-list .tag { display: inline-flex; }
.key-list h3 { font-size: 17px; font-weight: 500; line-height: 28px; }
.key-list p { color: var(--muted); font-size: 15px; line-height: 24px; }

/* Grid re-entry when the filter changes */
.grid.swapping .card-p, .grid.swapping .custom-card, .grid.swapping .empty { opacity: 0; transform: translateY(6px); transition: none; }
.grid .card-p, .grid .custom-card, .grid .empty { transition: opacity 360ms var(--ease-out), transform 360ms var(--ease-out); }

@media (hover: hover) and (pointer: fine) {
  .intents button:hover { border-color: var(--muted); }
  .card-p:hover .ph img { transform: scale(1.03); }
  .card-p:hover h3 { text-decoration: underline 1px; text-underline-offset: 5px; }
  .custom-card:hover { border-color: var(--sage); }
  .custom-card:hover .go svg { transform: translateX(3px); }
}

@media (max-width: 1280px) {
  .key-text { width: 360px; }
}
@media (max-width: 960px) {
  .shop-head { padding-top: 48px; }
  .shop-head h1 { font-size: 30px; line-height: 44px; }
  .intents { flex-wrap: nowrap; justify-content: flex-start; overflow-x: auto; max-width: 100vw; margin: 0 -24px; padding: 22px 20px 4px; scrollbar-width: none; }
  .intents::-webkit-scrollbar { display: none; }
  .intents button { flex-shrink: 0; padding: 11px 18px; }
  .tray-wrap { padding-top: 24px; }
  .captions { height: 40px; }
  .captions li { width: 72px; margin-left: -36px; }
  .captions b { font-size: 12px; line-height: 16px; }
  .captions small { display: none; }
  .belief-line { padding-top: 14px; }
  .results { padding-top: 48px; }
  .bar-tools { gap: 18px; font-size: 14px; }
  .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 16px; row-gap: 40px; padding-top: 28px; }
  .card-p h3 { font-size: 16px; line-height: 24px; }
  .card-p .desc { display: none; }
  .tag { font-size: 12px; padding: 4px 10px; }
  .custom-card { aspect-ratio: auto; grid-column: 1 / -1; padding: 24px; gap: 20px; }
  .custom-card h3 { font-size: 20px; line-height: 30px; }
  .empty { grid-column: 1 / -1; }
  .key { padding: 96px 20px; }
  .key-in { flex-direction: column; gap: 28px; }
  .key-text, .key-list { width: 100%; }
  .key-list li { flex-direction: column; gap: 10px; }
}

@media (prefers-reduced-motion: reduce) {
  .tray, .tray .base, .captions li { transition: none; }
  .grid .card-p, .grid .custom-card, .grid .empty { transition: none; }
}
