/* หน้าเลือกแบบ E-Card · ใช้โทเคนและภาษาเลย์เอาต์ Modern Editorial จาก brand/BRAND-GUIDELINE.md (v1.2–v1.3) */
:root {
  --ink: #1C1A18;
  --ink2: #4A4642;
  --muted: #706C66;
  --paper: #F1EFEC;
  --paper2: #E9E5DF;
  --paper3: #E2DDD6;
  --line: #E2DDD6;
  --brass: #A0784E;
  --brass-ink: #7E5C39;
  --brass-light: #D6B58C;
  --brass-soft: #EFE3D4;
  --onyx: #100E0D;
  --display: 'Bodoni Moda', 'Trirong', Georgia, serif;
  --sans: 'Inter', 'IBM Plex Sans Thai', sans-serif;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --radius: 2px;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; background: var(--paper); }
body {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-weight: 400;
  font-size: 16px;
  line-height: 1.85;
  overflow-x: clip;
  -webkit-font-smoothing: antialiased;
}

main, .top, .foot { width: min(1200px, 100% - 32px); margin-inline: auto; }
@media (min-width: 720px) {
  main, .top, .foot { width: min(1200px, 100% - 64px); }
}

a { color: var(--brass-ink); text-underline-offset: 4px; }
button, input { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--brass); outline-offset: 2px; }
[hidden] { display: none !important; }

h1, h2, h3, h4, .price { font-variant-numeric: lining-nums; }

.eyebrow {
  font-family: 'Inter', sans-serif;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: .24em;
  text-transform: uppercase;
  color: var(--muted);
  line-height: 1.6;
}

/* แถบหัวเว็บ */
.top-wrap {
  position: sticky;
  top: 0;
  z-index: 20;
  background: color-mix(in srgb, var(--paper) 94%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  min-height: 60px;
}
.brand {
  font-family: var(--display);
  font-weight: 400;
  font-size: 17px;
  letter-spacing: .2em;
  color: var(--ink);
  text-decoration: none;
  padding: 8px 0;
}
@media (min-width: 720px) { .brand { font-size: 19px; } }
.top-line {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 6px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 500;
  color: var(--ink);
  text-decoration: none;
  transition: border-color 180ms var(--ease), background 180ms var(--ease);
}
.top-line:hover { border-color: var(--ink); background: var(--paper2); }

/* ส่วนนำ (Editorial Split) */
.intro {
  display: grid;
  gap: 24px;
  padding: 36px 0 32px;
}
.intro-copy h1 {
  font-family: var(--display);
  font-weight: 400;
  font-size: clamp(32px, 7.2vw, 56px);
  line-height: 1.32;
  letter-spacing: 0;
  margin-top: 10px;
  max-width: 14em;
}
.intro-copy .lead {
  color: var(--ink2);
  font-size: 15px;
  line-height: 1.9;
  margin-top: 14px;
  max-width: 560px;
}
.intro-price {
  padding-top: 20px;
  border-top: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
}
.price-label { font-size: 13px; color: var(--muted); }
.price {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-top: 2px;
}
.price b {
  font-family: var(--display);
  font-weight: 400;
  font-size: clamp(44px, 9vw, 64px);
  line-height: 1.05;
  color: var(--ink);
}
.price span { font-size: 15px; color: var(--ink2); }
.price-note { font-size: 13px; color: var(--muted); margin-top: 8px; line-height: 1.7; }

@media (min-width: 860px) {
  .intro {
    grid-template-columns: minmax(0, 1.55fr) minmax(260px, .85fr);
    gap: 48px;
    padding: 64px 0 48px;
    align-items: end;
  }
  .intro-copy .lead { font-size: 16px; }
  .intro-price {
    padding-top: 0;
    padding-left: 36px;
    border-top: 0;
    border-left: 1px solid var(--line);
  }
}

/* ตัวกรอง 3 แถว */
.filters { border-top: 1px solid var(--ink); }
.f-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}
.f-label {
  font-size: 13px;
  font-weight: 500;
  color: var(--muted);
  line-height: 1.6;
}
.f-opts {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 2px 2px 4px;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}
.f-opts::-webkit-scrollbar { display: none; }
.chip {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding: 6px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: transparent;
  font-size: 14px;
  font-weight: 400;
  color: var(--ink2);
  cursor: pointer;
  transition: border-color 180ms var(--ease), background 180ms var(--ease), color 180ms var(--ease);
}
.chip:hover { border-color: var(--ink2); color: var(--ink); }
.chip[aria-pressed="true"] {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--paper);
}
.sw {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  flex: none;
  box-shadow: inset 0 0 0 1px rgb(28 26 24 / .22);
}
.chip[aria-pressed="true"] .sw {
  box-shadow: 0 0 0 1px rgb(241 239 236 / .75);
}

@media (min-width: 720px) {
  .f-row {
    grid-template-columns: 108px 1fr;
    align-items: center;
    gap: 16px;
    padding: 12px 0;
  }
  .f-opts { flex-wrap: wrap; overflow-x: visible; padding: 2px 0; }
  .chip { min-height: 38px; padding: 4px 14px; }
}

/* แถบจำนวนผลลัพธ์ */
.bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 22px 0 16px;
}
.count { font-size: 14px; color: var(--muted); }
.clear-btn {
  background: none;
  border: 0;
  padding: 6px 2px;
  min-height: 36px;
  font-size: 14px;
  color: var(--brass-ink);
  text-decoration: underline;
  text-underline-offset: 4px;
  cursor: pointer;
}
.clear-btn:hover { color: var(--ink); }

/* ตารางการ์ด: 2 คอลัมน์บน 375px · 3 คอลัมน์บนเดสก์ท็อป */
.grid {
  list-style: none;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 32px 14px;
}
@media (min-width: 720px) {
  .grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 56px 32px; }
}
.grid li { min-width: 0; }

.thumb {
  position: relative;
  display: block;
  width: 100%;
  aspect-ratio: 9 / 17;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--paper3);
  cursor: pointer;
}
.thumb .ec {
  pointer-events: none;
  width: 100%;
  min-height: 100%;
  transition: transform 620ms var(--ease);
}
.thumb:hover .ec { transform: scale(1.022); }
.thumb-cue {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 2;
  padding: 10px 12px;
  background: color-mix(in srgb, var(--onyx) 84%, transparent);
  color: var(--paper);
  font-size: 13px;
  text-align: center;
  opacity: 0;
  transform: translateY(6px);
  transition: opacity 240ms var(--ease), transform 240ms var(--ease);
  pointer-events: none;
}
@media (hover: hover) {
  .thumb:hover .thumb-cue,
  .thumb:focus-within .thumb-cue { opacity: 1; transform: translateY(0); }
}
.thumb button {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  background: transparent;
  border: 0;
  cursor: pointer;
  z-index: 3;
}
.thumb button:focus-visible { outline: 2px solid var(--brass); outline-offset: -4px; }

.meta {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-items: start;
  gap: 2px 8px;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}
.meta-code {
  font-family: 'Inter', sans-serif;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: .16em;
  color: var(--muted);
  line-height: 1.5;
}
.meta h3 {
  font-family: var(--sans);
  font-weight: 500;
  font-size: 16px;
  line-height: 1.5;
  color: var(--ink);
}
.meta p {
  font-size: 13px;
  color: var(--muted);
  line-height: 1.65;
  margin-top: 2px;
}
.minis {
  display: flex;
  align-items: center;
  gap: 2px;
  margin: 6px 0 0 -6px;
}
@media (min-width: 520px) {
  .meta { grid-template-columns: minmax(0, 1fr) auto; }
  .meta-code, .meta h3 { grid-column: 1; }
  .meta p { grid-column: 1 / -1; }
  .minis { grid-column: 2; grid-row: 1 / span 2; margin: 2px 0 0; }
}
.mini {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  background: none;
  border: 1px solid transparent;
  border-radius: 50%;
  cursor: pointer;
  transition: border-color 180ms var(--ease);
}
.mini:hover { border-color: var(--muted); }
.mini[aria-pressed="true"] { border-color: var(--ink); }
.mini .sw { width: 18px; height: 18px; }

.empty {
  padding: 64px 16px;
  text-align: center;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}
.empty p { color: var(--ink2); margin-bottom: 18px; }

/* ปุ่ม (มุมเหลี่ยม 2px ตาม Brand Guideline) */
.btn {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  min-height: 48px;
  padding: 10px 22px;
  border: 1px solid var(--ink);
  border-radius: var(--radius);
  background: transparent;
  color: var(--ink);
  text-decoration: none;
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
  transition: background 180ms var(--ease), color 180ms var(--ease), border-color 180ms var(--ease);
}
.btn:hover { background: var(--paper2); }
.btn.solid { background: var(--ink); color: var(--paper); }
.btn.solid:hover { background: #2E2A26; border-color: #2E2A26; }
.small { font-size: 13px; color: var(--muted); line-height: 1.75; }

/* ส่วนรายละเอียดและขั้นตอนการสั่ง */
.about {
  display: grid;
  gap: 44px;
  margin-top: 72px;
  padding-top: 48px;
  border-top: 1px solid var(--ink);
}
@media (min-width: 760px) {
  .about { grid-template-columns: 1fr 1fr; gap: 64px; margin-top: 96px; padding-top: 64px; }
}
.about h2 {
  font-family: var(--display);
  font-weight: 400;
  font-size: clamp(24px, 4vw, 32px);
  line-height: 1.4;
  margin: 8px 0 20px;
}
.feat-list { list-style: none; border-top: 1px solid var(--line); }
.feat-list li {
  position: relative;
  padding: 12px 0 12px 18px;
  border-bottom: 1px solid var(--line);
  color: var(--ink2);
  font-size: 15px;
}
.feat-list li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 23px;
  width: 6px;
  height: 1px;
  background: var(--brass);
}
.step-list { list-style: none; counter-reset: st; border-top: 1px solid var(--line); }
.step-list li {
  counter-increment: st;
  display: grid;
  grid-template-columns: 36px 1fr;
  align-items: baseline;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
  color: var(--ink2);
  font-size: 15px;
}
.step-list li::before {
  content: "0" counter(st);
  font-family: var(--display);
  font-size: 18px;
  color: var(--brass-ink);
  font-variant-numeric: lining-nums tabular-nums;
}
.about .small { margin-top: 16px; }

/* ท้ายเว็บ (Onyx ตาม Brand Guideline) */
.foot-wrap {
  margin-top: 72px;
  background: var(--onyx);
  color: var(--paper);
}
.foot {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 36px 0 44px;
  font-size: 13px;
  color: color-mix(in srgb, var(--paper) 74%, transparent);
}
.foot-brand {
  font-family: var(--display);
  font-size: 16px;
  letter-spacing: .2em;
  color: var(--paper);
}
.foot a { color: var(--brass-light); width: fit-content; }
@media (min-width: 720px) {
  .foot {
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
    padding: 40px 0;
  }
}

/* แผ่นดูตัวอย่างการ์ดเต็มใบ */
.view {
  width: 100%;
  max-width: 100%;
  height: 100%;
  max-height: 100%;
  border: 0;
  padding: 0;
  background: var(--paper2);
  color: var(--ink);
}
.view::backdrop { background: rgb(16 14 13 / .76); backdrop-filter: blur(3px); }
.view-shell { display: flex; flex-direction: column; height: 100%; }

.view-stage {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  background: var(--paper2);
}
.view-stage-head {
  flex: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 16px;
  border-bottom: 1px solid var(--line);
  background: var(--paper);
}
.view-hint { font-size: 13px; color: var(--muted); }
.close-mob {
  min-width: 48px;
  min-height: 36px;
  padding: 4px 10px;
  background: none;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  font-size: 14px;
  color: var(--ink);
  cursor: pointer;
}
.view-card {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 0;
}
.view-card .ec {
  max-width: 430px;
  margin: 0 auto;
}

.view-panel {
  position: relative;
  flex: none;
  max-height: 50%;
  overflow-y: auto;
  padding: 16px 16px calc(16px + env(safe-area-inset-bottom));
  background: var(--paper);
  border-top: 1px solid var(--line);
}
.close {
  display: none;
  position: absolute;
  top: 18px;
  right: 22px;
  background: none;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  min-width: 56px;
  min-height: 38px;
  padding: 4px 12px;
  font-size: 14px;
  color: var(--ink);
  cursor: pointer;
  transition: border-color 180ms var(--ease), background 180ms var(--ease);
}
.close:hover { border-color: var(--ink); background: var(--paper2); }

.view-eyebrow {
  font-size: 13px;
  font-weight: 400;
  letter-spacing: 0;
  color: var(--brass-ink);
  line-height: 1.6;
}
.view-eyebrow .view-no {
  font-family: 'Inter', sans-serif;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: .16em;
}
.view-panel h2 {
  font-family: var(--display);
  font-weight: 400;
  font-size: 22px;
  line-height: 1.4;
  margin-top: 2px;
}
.view-note { margin-top: 2px; }

.panel-group { margin-top: 12px; }
.panel-label { font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.sets { display: flex; gap: 8px; overflow-x: auto; padding: 2px 0 4px; scrollbar-width: none; }
.sets::-webkit-scrollbar { display: none; }

.try {
  margin-top: 12px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}
.try summary {
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  color: var(--ink);
  padding: 11px 0;
  list-style: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.try summary::-webkit-details-marker { display: none; }
.try summary::after {
  content: "+";
  font-family: 'Inter', sans-serif;
  font-size: 18px;
  font-weight: 400;
  color: var(--brass-ink);
  line-height: 1;
}
.try[open] summary::after { content: "−"; }
.try-body { padding: 4px 0 14px; }
.try-modes { display: flex; gap: 8px; margin-bottom: 10px; }
.mode-btn {
  flex: 1;
  min-height: 38px;
  padding: 4px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: transparent;
  font-size: 13px;
  color: var(--ink2);
  cursor: pointer;
}
.mode-btn[aria-pressed="true"] {
  background: var(--paper2);
  border-color: var(--ink);
  color: var(--ink);
  font-weight: 500;
}
.try-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  margin-bottom: 8px;
}
@media (min-width: 440px) {
  .try-grid { grid-template-columns: 1fr 1fr; }
}
.try label {
  display: block;
  font-size: 12px;
  color: var(--ink2);
}
.try input {
  display: block;
  width: 100%;
  min-height: 44px;
  margin-top: 4px;
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--paper);
  font-size: 15px;
}
.try input:focus { border-color: var(--ink); }

.order { margin-top: 14px; }
.order-code {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 8px 12px;
  margin-bottom: 10px;
  background: var(--paper2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  font-size: 13px;
  color: var(--ink2);
}
.order-code b {
  font-family: 'Inter', sans-serif;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: .12em;
  color: var(--ink);
}
.order-acts { display: flex; flex-wrap: wrap; gap: 8px; }
.order-acts .solid { flex: 1 1 180px; }
.order-acts button.btn { flex: 0 1 auto; }

@media (min-width: 860px) {
  .view {
    width: min(980px, 92vw);
    height: min(860px, 90vh);
    margin: auto;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: 0 24px 64px rgb(16 14 13 / .28);
  }
  .view-shell { flex-direction: row; }
  .view-stage { flex: 0 0 468px; border-right: 1px solid var(--line); }
  .view-stage-head { padding: 10px 20px; background: var(--paper2); }
  .close-mob { display: none; }
  .view-card { padding: 20px 28px 28px; }
  .view-card .ec {
    max-width: 400px;
    border: 1px solid color-mix(in srgb, var(--ink) 12%, transparent);
  }
  .view-panel {
    flex: 1;
    max-height: none;
    border-top: 0;
    padding: 56px 36px 32px;
    display: flex;
    flex-direction: column;
  }
  .close { display: inline-flex; align-items: center; justify-content: center; }
  .view-panel h2 { font-size: 28px; padding-right: 68px; }
  .sets { flex-wrap: wrap; overflow-x: visible; }
  .order { margin-top: auto; padding-top: 20px; }
}

@media (prefers-reduced-motion: reduce) {
  .thumb .ec, .thumb-cue, .chip, .btn, .top-line, .mini, .close { transition: none; }
  .thumb:hover .ec { transform: none; }
}
