/* 米多小花坊｜聖誕花圈型錄
   色彩：米白、鼠尾草綠、暖灰。要調整品牌色，只需改 :root 內的變數。 */

:root {
  --bg: #F7F4EE;          /* 米白 */
  --surface: #FFFDF9;
  --media: #EFEBE3;       /* 圖片底色（去背圖會放在這個底上） */
  --media-2: #E8E3D9;
  --ink: #33372F;
  --ink-2: #6E6A62;       /* 暖灰 */
  --ink-3: #9A958B;
  --line: #E4DED3;
  --sage: #7F907A;        /* 鼠尾草綠 */
  --sage-deep: #55654F;
  --sage-tint: #E7ECE2;
  --sold: #A7A196;
  --line-green: #06C755;

  --serif-en: "Cormorant Garamond", "Noto Serif TC", "Songti TC", serif;
  --serif: "Noto Serif TC", "Songti TC", "PMingLiU", serif;
  --sans: "Noto Sans TC", -apple-system, BlinkMacSystemFont, "PingFang TC", "Microsoft JhengHei", system-ui, sans-serif;

  --radius: 16px;
  --gutter: 16px;
  --maxw: 1200px;
  --header-h: 60px;

  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; scroll-padding-top: calc(var(--header-h) + 12px); }
html.is-locked { overflow: hidden; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

html[lang="en"] body { letter-spacing: 0.005em; }

img { max-width: 100%; display: block; }
button, select { font: inherit; color: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }

:focus-visible { outline: 2px solid var(--sage-deep); outline-offset: 2px; border-radius: 6px; }

.skip-link {
  position: absolute; left: 12px; top: -48px; z-index: 50;
  background: var(--ink); color: #fff; padding: 8px 14px; border-radius: 8px; text-decoration: none;
}
.skip-link:focus { top: 12px; }

/* ---------- Header ---------- */

.site-header {
  position: sticky; top: 0; z-index: 20;
  background: rgba(247, 244, 238, 0.86);
  -webkit-backdrop-filter: saturate(140%) blur(12px);
  backdrop-filter: saturate(140%) blur(12px);
  border-bottom: 1px solid rgba(228, 222, 211, 0.7);
  padding-top: env(safe-area-inset-top);
}

.header-bar {
  max-width: var(--maxw); margin: 0 auto;
  height: var(--header-h);
  padding: 0 max(var(--gutter), env(safe-area-inset-right)) 0 max(var(--gutter), env(safe-area-inset-left));
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
}

.brand { display: flex; align-items: center; gap: 10px; color: inherit; text-decoration: none; min-width: 0; }
.brand-mark { width: 30px; height: 30px; color: var(--sage); flex: none; }
.brand-text { display: flex; flex-direction: column; line-height: 1.15; min-width: 0; }
.brand-primary { font-family: var(--serif); font-weight: 600; font-size: 17px; letter-spacing: 0.08em; white-space: nowrap; }
html[lang="en"] .brand-primary { font-family: var(--serif-en); font-size: 20px; letter-spacing: 0.02em; }
.brand-secondary { font-size: 10.5px; color: var(--ink-3); letter-spacing: 0.14em; white-space: nowrap; }
.brand-secondary:lang(en) { text-transform: uppercase; }

.header-actions { display: flex; align-items: center; gap: 10px; flex: none; }

.lang-switch {
  display: flex; align-items: center;
  background: var(--surface); border: 1px solid var(--line); border-radius: 999px; padding: 3px;
}
.lang-switch button {
  border: 0; background: transparent; border-radius: 999px;
  min-width: 44px; height: 32px; padding: 0 10px;
  font-size: 13px; color: var(--ink-2); letter-spacing: 0.04em;
  transition: background-color .2s, color .2s;
}
.lang-switch button[aria-pressed="true"] { background: var(--sage-deep); color: #fff; }
.lang-divider { color: var(--line); font-size: 12px; padding: 0 1px; }

/* ---------- LINE ---------- */

.line-link {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 40px; padding: 0 16px; border-radius: 999px;
  background: var(--line-green); color: #fff; text-decoration: none; font-size: 14px; font-weight: 500;
}
.line-link--header { display: none; }
@media (min-width: 720px) { .line-link--header:not([hidden]) { display: inline-flex; } }
.line-link--viewer { width: 100%; min-height: 46px; margin-top: 6px; }
.line-link--footer { margin: 4px 0 6px; }

/* ---------- Hero ---------- */

main { max-width: var(--maxw); margin: 0 auto; padding: 0 var(--gutter) 56px; outline: none; }

.hero { text-align: center; padding: 36px 8px 26px; }
.eyebrow {
  margin: 0 0 8px; font-size: 12px; letter-spacing: 0.24em; color: var(--sage-deep); text-transform: uppercase;
}
.hero-title {
  margin: 0; font-family: var(--serif); font-weight: 500;
  font-size: clamp(28px, 7.4vw, 44px); letter-spacing: 0.12em; line-height: 1.25;
}
html[lang="en"] .hero-title { font-family: var(--serif-en); letter-spacing: 0.01em; font-size: clamp(34px, 9vw, 56px); }
.hero-lede { margin: 12px auto 0; max-width: 34em; color: var(--ink-2); font-size: 14px; }
.hero::after {
  content: ""; display: block; width: 36px; height: 1px; background: var(--sage); margin: 22px auto 0; opacity: .7;
}

/* ---------- Controls ---------- */

.controls { display: grid; gap: 14px; margin-bottom: 14px; }
.control-label { display: block; font-size: 12px; color: var(--ink-3); letter-spacing: 0.08em; margin-bottom: 6px; }

.tone-filter { min-width: 0; }
.chips {
  display: flex; gap: 8px; overflow-x: auto; scroll-snap-type: x proximity; scroll-padding-inline: var(--gutter);
  margin: 0 calc(var(--gutter) * -1); padding: 2px var(--gutter) 6px;
  scrollbar-width: none; -webkit-overflow-scrolling: touch;
}
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: none; scroll-snap-align: start;
  display: inline-flex; align-items: center; gap: 7px;
  height: 38px; padding: 0 14px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--surface); color: var(--ink-2);
  font-size: 13.5px; white-space: nowrap;
  transition: border-color .2s, background-color .2s, color .2s;
}
.chip[aria-pressed="true"] { background: var(--sage-tint); border-color: var(--sage); color: var(--sage-deep); font-weight: 500; }
@media (hover: hover) { .chip:hover { border-color: var(--sage); } }

.swatch {
  display: inline-block; width: 12px; height: 12px; border-radius: 50%; flex: none;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.12);
}

.selects { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.field { display: block; min-width: 0; }
.field select {
  width: 100%; height: 44px; padding: 0 36px 0 14px;
  border: 1px solid var(--line); border-radius: 12px; background-color: var(--surface);
  appearance: none; -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M6 9l6 6 6-6' fill='none' stroke='%236E6A62' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center; background-size: 16px;
  font-size: 14px; color: var(--ink); text-overflow: ellipsis;
}

.result-bar { display: flex; align-items: center; justify-content: space-between; min-height: 32px; margin-bottom: 12px; }
.result-count { margin: 0; font-size: 13px; color: var(--ink-3); }
.text-btn { border: 0; background: none; padding: 6px 0; color: var(--sage-deep); font-size: 13px; text-decoration: underline; text-underline-offset: 3px; }

@media (min-width: 900px) {
  .controls { grid-template-columns: 1fr auto; align-items: end; gap: 24px; }
  .chips { flex-wrap: wrap; overflow: visible; margin: 0; padding: 0; }
  .selects { grid-template-columns: 200px 200px; }
}

/* ---------- Grid & cards ---------- */

.grid {
  list-style: none; margin: 0; padding: 0;
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px 12px;
}
@media (min-width: 720px) { .grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 28px 20px; } }
@media (min-width: 1080px) { .grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }

.card { min-width: 0; display: flex; flex-direction: column; }

.card-media {
  position: relative; display: block; width: 100%; aspect-ratio: 1 / 1;
  padding: 0; border: 0; border-radius: var(--radius); overflow: hidden;
  background: radial-gradient(circle at 50% 42%, var(--surface) 0%, var(--media) 62%, var(--media-2) 100%);
  -webkit-tap-highlight-color: transparent;
}
.card-media img {
  position: absolute; inset: 0; width: 100%; height: 100%;
  object-fit: contain; padding: 7%;
  opacity: 0; transition: opacity .35s ease, transform .5s ease;
  filter: drop-shadow(0 10px 14px rgba(60, 50, 35, 0.12));
}
.card-media img.is-loaded { opacity: 1; }
.card-media.has-image .ph { opacity: 0; }
@media (hover: hover) {
  .card-media:hover img.is-loaded { transform: scale(1.03); }
  .card-media:hover .zoom-hint { opacity: 1; }
}

.ph {
  position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px;
  color: var(--sage); transition: opacity .3s; padding: 10px; text-align: center;
}
.ph svg { width: 42%; max-width: 120px; height: auto; opacity: .8; }
.ph-text { font-size: 11.5px; letter-spacing: 0.08em; color: var(--ink-3); line-height: 1.4; }

.zoom-hint {
  position: absolute; right: 8px; bottom: 8px; width: 30px; height: 30px; border-radius: 50%;
  display: grid; place-items: center; background: rgba(255, 253, 249, 0.9); color: var(--ink-2);
  opacity: .85; transition: opacity .2s;
}
.zoom-hint svg { width: 17px; height: 17px; }
@media (hover: hover) { .zoom-hint { opacity: 0; } }

.sold-tag {
  position: absolute; left: 8px; top: 8px; padding: 3px 10px; border-radius: 999px;
  background: rgba(255, 253, 249, 0.92); color: var(--ink-2); font-size: 12px; letter-spacing: 0.04em;
}
.card.is-sold .card-media img, .viewer-media.is-sold img { filter: grayscale(.55); opacity: .55; }

.card-body { padding: 11px 2px 0; display: flex; flex-direction: column; flex: 1; }
.card-swatches { display: flex; gap: 4px; margin-bottom: 7px; min-height: 12px; }
.card-swatches .swatch { width: 10px; height: 10px; }
.card-title {
  margin: 0; font-family: var(--serif); font-weight: 500; font-size: 15px; line-height: 1.4; letter-spacing: 0.04em;
  overflow-wrap: anywhere;
}
html[lang="en"] .card-title { font-family: var(--serif-en); font-size: 17.5px; font-weight: 600; letter-spacing: 0; line-height: 1.2; }
.card-size { margin: 4px 0 0; font-size: 12.5px; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.card-price { margin: 6px 0 0; font-size: 16px; font-weight: 500; letter-spacing: 0.02em; font-variant-numeric: tabular-nums; }
.card-foot { margin-top: auto; padding-top: 6px; display: flex; flex-direction: column; align-items: flex-start; gap: 8px; }
.card-foot .card-price { margin: 0; }

.stock {
  align-self: flex-start; display: inline-block; margin: 0;
  padding: 3px 10px; border-radius: 999px;
  background: var(--sage-tint); color: var(--sage-deep);
  font-size: 12px; letter-spacing: 0.03em; line-height: 1.5;
}
.stock.is-sold { background: #ECE9E3; color: var(--sold); }

.card.is-sold .card-title, .card.is-sold .card-price { color: var(--ink-3); }

@media (min-width: 720px) {
  .card-title { font-size: 16px; }
  html[lang="en"] .card-title { font-size: 19px; }
  .card-price { font-size: 17px; }
}

.status-msg { grid-column: 1 / -1; text-align: center; padding: 48px 16px; color: var(--ink-3); font-size: 14px; }
.status-msg small { display: inline-block; margin-top: 6px; }
.empty-state { text-align: center; padding: 40px 16px; color: var(--ink-2); }

.pill-btn {
  margin-top: 12px; height: 40px; padding: 0 18px; border-radius: 999px;
  border: 1px solid var(--sage); background: var(--surface); color: var(--sage-deep); font-size: 14px;
}

/* ---------- Footer ---------- */

.site-footer { border-top: 1px solid var(--line); background: #F2EEE6; }
.footer-inner {
  max-width: var(--maxw); margin: 0 auto; text-align: center;
  padding: 36px var(--gutter) calc(36px + env(safe-area-inset-bottom));
}
.footer-brand { margin: 0 0 12px; font-family: var(--serif); font-size: 16px; letter-spacing: 0.12em; }
html[lang="en"] .footer-brand { font-family: var(--serif-en); font-size: 19px; letter-spacing: 0.03em; }
.footer-notes { list-style: none; margin: 0 auto 12px; padding: 0; max-width: 36em; color: var(--ink-2); font-size: 12.5px; line-height: 1.8; }
.copyright { margin: 6px 0 0; font-size: 11.5px; color: var(--ink-3); letter-spacing: 0.06em; }

/* ---------- Viewer（圖片放大） ---------- */

.viewer {
  padding: 0; border: 0; margin: auto;
  width: 100%; height: 100%; max-width: 100%; max-height: 100%;
  background: var(--bg); color: var(--ink);
}
.viewer::backdrop { background: rgba(40, 38, 33, 0.55); }
.viewer[open] { animation: viewer-in .22s ease-out; }
@keyframes viewer-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.viewer-panel { position: relative; height: 100%; display: flex; flex-direction: column; overflow-y: auto; }

.icon-btn {
  width: 44px; height: 44px; border-radius: 50%; border: 0;
  display: grid; place-items: center;
  background: rgba(255, 253, 249, 0.92); color: var(--ink);
  box-shadow: 0 1px 4px rgba(50, 40, 30, 0.12);
}
.icon-btn svg { width: 22px; height: 22px; }

.viewer-close { position: absolute; top: calc(10px + env(safe-area-inset-top)); right: 12px; z-index: 3; }

.viewer-stage { position: relative; flex: none; }
.viewer-media {
  position: relative; margin: 0; width: 100%; aspect-ratio: 1 / 1; max-height: 68vh;
  background: radial-gradient(circle at 50% 42%, var(--surface) 0%, var(--media) 62%, var(--media-2) 100%);
}
.viewer-media img {
  position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; padding: 5%;
  opacity: 0; transition: opacity .3s;
  filter: drop-shadow(0 14px 20px rgba(60, 50, 35, 0.14));
}
.viewer-media img.is-loaded { opacity: 1; }
.viewer-media.has-image .ph { opacity: 0; }
.viewer-media .ph svg { width: 34%; }
.viewer-media .ph-text { font-size: 13px; }

.viewer-nav { position: absolute; top: 50%; transform: translateY(-50%); z-index: 2; }
.viewer-prev { left: 10px; }
.viewer-next { right: 10px; }

.viewer-info { padding: 20px var(--gutter) calc(28px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 10px; }
.viewer-swatches { display: flex; gap: 6px; }
.viewer-title { margin: 0; font-family: var(--serif); font-weight: 500; font-size: 22px; letter-spacing: 0.06em; line-height: 1.35; }
html[lang="en"] .viewer-title { font-family: var(--serif-en); font-weight: 600; font-size: 27px; letter-spacing: 0; line-height: 1.15; }
.viewer-specs { margin: 4px 0; display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.viewer-specs div { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; }
.viewer-specs dt { font-size: 11.5px; color: var(--ink-3); letter-spacing: 0.08em; }
.viewer-specs dd { margin: 2px 0 0; font-size: 16px; font-weight: 500; font-variant-numeric: tabular-nums; }
.viewer-info .stock { font-size: 13px; padding: 4px 12px; }
.viewer-counter { margin: 4px 0 0; font-size: 12px; color: var(--ink-3); letter-spacing: 0.08em; }

@media (min-width: 820px) {
  .viewer {
    width: min(1040px, calc(100vw - 64px)); height: min(660px, calc(100vh - 64px));
    border-radius: 22px; overflow: hidden; box-shadow: 0 30px 80px rgba(40, 30, 20, 0.25);
  }
  .viewer-panel { flex-direction: row; height: 100%; }
  .viewer-stage { flex: 1 1 62%; display: flex; }
  .viewer-media { flex: 1; max-height: none; height: 100%; aspect-ratio: auto; }
  .viewer-info { flex: 1 1 38%; justify-content: center; padding: 48px 36px; }
  .viewer-close { top: 14px; right: 14px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}

.noscript { text-align: center; padding: 24px; color: var(--ink-2); }
