:root {
  --store-ink: #17201c;
  --store-muted: #66716b;
  --store-surface: #ffffff;
  --store-bg: #f4f6f3;
  --store-line: #d9dfda;
  --store-deep: #17251f;
  --store-teal: #257d78;
  --store-coral: #bd5f4c;
  --store-gold: #b88736;
  --store-shadow: 0 16px 38px rgba(23, 32, 28, 0.12);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  min-width: 320px;
  color: var(--store-ink);
  background: var(--store-bg);
  font-family: "Noto Sans Thai", system-ui, sans-serif;
}
button, input, select, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
img { display: block; max-width: 100%; }
a { color: inherit; }
[hidden] { display: none !important; }

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.store-header {
  position: sticky;
  top: 0;
  z-index: 20;
  min-height: 72px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 10px clamp(18px, 5vw, 72px);
  color: #f6f7f4;
  background: rgba(23, 37, 31, 0.96);
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
  backdrop-filter: blur(16px);
}

.store-brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
}
.store-brand img {
  width: 48px;
  height: 48px;
  object-fit: cover;
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 6px;
}
.store-brand span { display: grid; }
.store-brand strong { font-size: 18px; line-height: 1.2; }
.store-brand small {
  margin-top: 2px;
  color: #b9c8c0;
  font-size: 11px;
  text-transform: uppercase;
}

.store-nav { display: flex; align-items: center; gap: 24px; }
.store-nav a {
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  font-weight: 700;
  text-decoration: none;
}
.store-nav a:hover { color: #86d0ca; }
.store-nav .admin-link {
  padding: 8px 14px;
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 6px;
}

.store-hero {
  position: relative;
  min-height: min(650px, 68vh);
  display: flex;
  align-items: flex-end;
  isolation: isolate;
  color: #ffffff;
  background: #24342d url("assets/medaka-daily-banner.png") center 44% / cover no-repeat;
}
.store-hero::before {
  position: absolute;
  inset: 0;
  z-index: -1;
  content: "";
  background: rgba(8, 17, 13, 0.56);
}
.store-hero-content {
  width: min(1180px, 100%);
  margin: 0 auto;
  padding: clamp(54px, 10vh, 110px) clamp(20px, 5vw, 72px) clamp(56px, 8vh, 88px);
}
.store-eyebrow {
  margin: 0 0 8px;
  color: var(--store-teal);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}
.store-hero .store-eyebrow { color: #8fd7d0; }
.store-hero h1 {
  margin: 0;
  max-width: 720px;
  font-size: clamp(48px, 8vw, 94px);
  line-height: 1;
  letter-spacing: 0;
}
.store-hero-content > p:not(.store-eyebrow) {
  max-width: 650px;
  margin: 20px 0 28px;
  color: #edf3ef;
  font-size: clamp(17px, 2vw, 21px);
  line-height: 1.75;
}
.store-primary-button,
.catalog-error button {
  min-height: 46px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 18px;
  border: 0;
  border-radius: 6px;
  color: #fff;
  background: var(--store-coral);
  font-weight: 800;
  text-decoration: none;
  cursor: pointer;
}
.store-primary-button:hover,
.catalog-error button:hover { background: #a84d3c; }

.catalog-section {
  width: min(1180px, calc(100% - 40px));
  margin: 0 auto;
  padding: 54px 0 42px;
  scroll-margin-top: 82px;
}
.catalog-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 22px;
}
.catalog-heading h2 {
  margin: 0;
  font-size: clamp(28px, 4vw, 44px);
  letter-spacing: 0;
}
.catalog-heading > p { margin: 0; color: var(--store-muted); font-weight: 700; }

.catalog-toolbar {
  display: grid;
  grid-template-columns: minmax(240px, 1fr) minmax(150px, 220px) minmax(170px, 220px);
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--store-line);
  background: var(--store-surface);
}
.catalog-toolbar label { display: grid; gap: 5px; }
.catalog-toolbar label > span:not(.visually-hidden) {
  color: var(--store-muted);
  font-size: 12px;
  font-weight: 700;
}
.catalog-toolbar input,
.catalog-toolbar select {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--store-line);
  border-radius: 6px;
  padding: 9px 12px;
  color: var(--store-ink);
  background: #fff;
}
.catalog-toolbar input:focus,
.catalog-toolbar select:focus {
  outline: 2px solid rgba(37, 125, 120, 0.24);
  border-color: var(--store-teal);
}

.catalog-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
  margin-top: 22px;
}
.listing-card {
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--store-line);
  border-radius: 8px;
  background: var(--store-surface);
  box-shadow: 0 8px 22px rgba(23, 32, 28, 0.06);
}
.listing-card-image {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  background: #dfe6e1;
}
.listing-card-body { display: grid; gap: 10px; padding: 16px; }
.listing-meta { display: flex; flex-wrap: wrap; gap: 8px; }
.listing-meta span {
  padding: 4px 8px;
  border-radius: 999px;
  color: #1f5c57;
  background: #e4f1ef;
  font-size: 12px;
  font-weight: 800;
}
.listing-card h3 { margin: 0; font-size: 20px; line-height: 1.4; }
.listing-card p { margin: 0; color: var(--store-muted); line-height: 1.6; }
.listing-card-footer {
  min-height: 46px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.listing-price { color: var(--store-coral); font-size: 22px; font-weight: 800; }
.listing-detail-button {
  min-height: 40px;
  border: 1px solid var(--store-deep);
  border-radius: 6px;
  padding: 8px 12px;
  color: var(--store-deep);
  background: #fff;
  font-weight: 800;
  cursor: pointer;
}

.catalog-empty,
.catalog-error {
  min-height: 330px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 8px;
  margin-top: 22px;
  border: 1px dashed #bdc7c0;
  background: #fff;
  text-align: center;
}
.catalog-empty img { width: 76px; height: 76px; object-fit: cover; border-radius: 8px; }
.catalog-empty h3,
.catalog-error h3 { margin: 8px 0 0; font-size: 22px; }
.catalog-empty p,
.catalog-error p { max-width: 520px; margin: 0; padding: 0 18px; color: var(--store-muted); }

.store-assurance {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0;
  width: min(1180px, calc(100% - 40px));
  margin: 12px auto 64px;
  border-block: 1px solid var(--store-line);
}
.store-assurance div { display: grid; gap: 6px; padding: 24px; }
.store-assurance div + div { border-left: 1px solid var(--store-line); }
.store-assurance strong { color: var(--store-deep); }
.store-assurance span { color: var(--store-muted); line-height: 1.6; }

.store-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 28px;
  padding: 28px clamp(18px, 5vw, 72px);
  color: #e8eeea;
  background: var(--store-deep);
}
.store-footer p { margin: 0; color: #b9c8c0; }
.footer-brand img { width: 44px; height: 44px; }

.listing-dialog {
  width: min(680px, calc(100% - 28px));
  max-height: calc(100vh - 32px);
  overflow: auto;
  border: 0;
  border-radius: 8px;
  padding: 0;
  color: var(--store-ink);
  background: #fff;
  box-shadow: var(--store-shadow);
}
.listing-dialog::backdrop { background: rgba(7, 12, 9, 0.72); }
.dialog-close {
  position: sticky;
  top: 10px;
  z-index: 1;
  float: right;
  width: 42px;
  height: 42px;
  margin: 10px 10px -52px 0;
  border: 0;
  border-radius: 50%;
  color: #fff;
  background: rgba(23, 37, 31, 0.88);
  font-size: 28px;
  line-height: 1;
  cursor: pointer;
}
.listing-dialog-gallery { display: grid; background: #dfe6e1; }
.listing-dialog-media-stage {
  width: 100%;
  aspect-ratio: 16 / 10;
  overflow: hidden;
  background: #101713;
}
.listing-dialog-image,
.listing-dialog-video { width: 100%; height: 100%; object-fit: contain; background: #101713; }
.listing-dialog-media-controls {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1px;
  border-top: 1px solid var(--store-line);
  background: var(--store-line);
}
.listing-media-tab {
  min-height: 44px;
  border: 0;
  padding: 8px 12px;
  color: var(--store-muted);
  background: #fff;
  font-weight: 800;
  cursor: pointer;
}
.listing-media-tab.is-active { color: #fff; background: var(--store-teal); }
.listing-dialog-body { display: grid; gap: 14px; padding: 22px; }
.listing-dialog-body h2 { margin: 0; font-size: 28px; }
.listing-dialog-body p { margin: 0; color: var(--store-muted); line-height: 1.7; }
.listing-facts { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.listing-facts div { padding: 12px; border: 1px solid var(--store-line); }
.listing-facts span { display: block; color: var(--store-muted); font-size: 12px; }
.listing-facts strong { display: block; margin-top: 3px; }
.listing-order-actions { display: flex; justify-content: flex-end; }
.listing-order-actions .store-primary-button { width: 100%; }

.order-dialog {
  width: min(680px, calc(100% - 28px));
  max-height: calc(100vh - 32px);
  overflow: auto;
  border: 0;
  border-radius: 8px;
  padding: 0;
  color: var(--store-ink);
  background: #fff;
  box-shadow: var(--store-shadow);
}
.order-dialog::backdrop { background: rgba(7, 12, 9, 0.72); }
.order-dialog-content { padding: 26px; }
.order-dialog-head { padding-right: 48px; }
.order-dialog-head h2,
.order-success h2 { margin: 0; font-size: 28px; }
.order-dialog-head > p:last-child,
.order-success p { margin: 6px 0 0; color: var(--store-muted); line-height: 1.7; }
.order-form { display: grid; gap: 14px; margin-top: 20px; }
.order-form label { display: grid; gap: 6px; color: var(--store-deep); font-size: 13px; font-weight: 800; }
.order-form input,
.order-form select,
.order-form textarea {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--store-line);
  border-radius: 6px;
  padding: 9px 11px;
  color: var(--store-ink);
  background: #fff;
  font-weight: 500;
}
.order-form textarea { resize: vertical; }
.order-form input:focus,
.order-form select:focus,
.order-form textarea:focus { outline: 2px solid rgba(37, 125, 120, 0.24); border-color: var(--store-teal); }
.order-product-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 14px;
  border-left: 3px solid var(--store-teal);
  background: #eef5f2;
}
.order-product-summary strong,
.order-product-summary span { display: block; }
.order-product-summary span { margin-top: 3px; color: var(--store-muted); font-size: 13px; }
.order-form-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.order-total { display: grid; align-content: center; gap: 3px; min-height: 70px; padding: 10px 14px; border: 1px solid var(--store-line); }
.order-total span { color: var(--store-muted); font-size: 12px; }
.order-total strong { color: var(--store-coral); font-size: 22px; }
.order-consent { grid-template-columns: 20px 1fr; align-items: start; font-weight: 600 !important; line-height: 1.6; }
.order-consent input { width: 18px; min-height: 18px; margin-top: 2px; }
.order-honeypot { position: absolute; left: -10000px; opacity: 0; pointer-events: none; }
.order-form-status { min-height: 20px; margin: 0; color: var(--store-muted); font-size: 13px; }
.order-form-status.is-error { color: #a33f32; font-weight: 800; }
.order-success { display: grid; justify-items: start; gap: 12px; padding: 34px 28px; }
.order-success > strong { padding: 10px 14px; border: 1px solid var(--store-teal); color: var(--store-teal); font-size: 24px; letter-spacing: 0; }
.order-success > .store-primary-button { width: 100%; }

.tracking-page {
  width: min(1060px, calc(100% - 40px));
  min-height: calc(100vh - 174px);
  margin: 0 auto;
  padding: 52px 0 72px;
}
.tracking-heading { max-width: 720px; margin-bottom: 28px; }
.tracking-heading h1 { margin: 0; font-size: clamp(34px, 5vw, 52px); letter-spacing: 0; }
.tracking-heading > p:last-child { margin: 10px 0 0; color: var(--store-muted); font-size: 17px; line-height: 1.7; }
.tracking-lookup { padding: 24px; border: 1px solid var(--store-line); background: #fff; }
.tracking-lookup h2 { margin: 0 0 16px; font-size: 22px; }
.tracking-lookup form label { display: block; margin-bottom: 6px; color: var(--store-muted); font-size: 13px; font-weight: 800; }
.tracking-lookup-row { display: grid; grid-template-columns: 1fr auto; gap: 10px; }
.tracking-lookup-row input {
  min-width: 0;
  min-height: 46px;
  border: 1px solid var(--store-line);
  border-radius: 6px;
  padding: 9px 12px;
  font: inherit;
}
.tracking-contact-verification { margin-top: 14px; }
.tracking-contact-verification input { width: 100%; min-height: 44px; margin-top: 6px; border: 1px solid var(--store-line); border-radius: 6px; padding: 9px 12px; font: inherit; }
.tracking-lookup-note { margin: 10px 0 0; color: var(--store-muted); font-size: 12px; line-height: 1.6; }
.tracking-message { min-height: 24px; margin: 14px 0; color: #a33f32; font-weight: 700; }
.recent-orders { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin-top: 20px; }
.recent-orders > p { grid-column: 1 / -1; margin: 0; color: var(--store-muted); font-size: 13px; font-weight: 800; }
.recent-orders a { display: grid; gap: 2px; padding: 11px 12px; border: 1px solid var(--store-line); color: var(--store-ink); text-decoration: none; }
.recent-orders a:hover { border-color: var(--store-teal); }
.recent-orders span { color: var(--store-muted); font-size: 12px; }
.tracking-content { display: grid; gap: 22px; }
.tracking-summary-band {
  display: grid;
  grid-template-columns: 1fr 1fr 44px;
  gap: 18px;
  align-items: center;
  padding: 20px 22px;
  color: #fff;
  background: var(--store-deep);
}
.tracking-summary-band div { display: grid; gap: 4px; }
.tracking-summary-band span { color: #b9c8c0; font-size: 12px; }
.tracking-summary-band strong { font-size: 20px; overflow-wrap: anywhere; }
.tracking-refresh { width: 44px; height: 44px; border: 1px solid rgba(255,255,255,.3); border-radius: 50%; color: #fff; background: transparent; font-size: 24px; cursor: pointer; }
.order-timeline { display: grid; grid-template-columns: repeat(6, 1fr); margin: 0; padding: 20px 0; list-style: none; }
.order-timeline li { position: relative; display: grid; justify-items: center; gap: 8px; color: #89958e; text-align: center; font-size: 12px; }
.order-timeline li::before { position: absolute; top: 17px; left: -50%; width: 100%; height: 2px; content: ""; background: var(--store-line); }
.order-timeline li:first-child::before { display: none; }
.order-timeline li > span { z-index: 1; width: 36px; height: 36px; display: grid; place-items: center; border: 2px solid var(--store-line); border-radius: 50%; background: var(--store-bg); font-weight: 800; }
.order-timeline li.is-complete,
.order-timeline li.is-current { color: var(--store-deep); }
.order-timeline li.is-complete::before,
.order-timeline li.is-current::before { background: var(--store-teal); }
.order-timeline li.is-complete > span { border-color: var(--store-teal); color: #fff; background: var(--store-teal); }
.order-timeline li.is-current > span { border-color: var(--store-coral); color: var(--store-coral); }
.order-timeline li.is-cancelled { color: #a33f32; }
.order-timeline li.is-cancelled > span { border-color: #a33f32; color: #fff; background: #a33f32; }
.tracking-columns { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 18px; align-items: start; }
.tracking-section { padding: 24px; border: 1px solid var(--store-line); background: #fff; }
.tracking-section h2 { margin: 0 0 18px; font-size: 23px; }
.tracking-detail-list { display: grid; grid-template-columns: 1fr auto; gap: 0; margin: 0; }
.tracking-detail-list dt,
.tracking-detail-list dd { margin: 0; padding: 10px 0; border-bottom: 1px solid var(--store-line); }
.tracking-detail-list dt { color: var(--store-muted); }
.tracking-detail-list dd { max-width: 280px; text-align: right; overflow-wrap: anywhere; }
.tracking-detail-list .tracking-total { color: var(--store-coral); font-size: 20px; font-weight: 800; }
.payment-state { margin: 0 0 16px; color: var(--store-muted); line-height: 1.7; }
.payment-qr-wrap { display: grid; justify-items: center; gap: 8px; padding: 16px; border: 1px solid var(--store-line); text-align: center; }
.payment-qr-wrap img { width: min(100%, 320px); aspect-ratio: 1; object-fit: contain; }
.payment-qr-wrap p { margin: 0; color: var(--store-muted); white-space: pre-line; }
.slip-form { display: grid; gap: 10px; margin-top: 18px; }
.slip-form label { display: grid; gap: 6px; font-size: 13px; font-weight: 800; }
.slip-form input { width: 100%; min-height: 44px; padding: 8px; border: 1px solid var(--store-line); border-radius: 6px; }
.slip-form small,
.slip-form p { margin: 0; color: var(--store-muted); }
.shipment-tracking-code { display: flex; flex-wrap: wrap; gap: 10px 18px; margin: 0; }
.shipment-tracking-code span { color: var(--store-teal); font-size: 20px; font-weight: 800; overflow-wrap: anywhere; }
.shipment-live-status { display: grid; gap: 4px; margin-top: 16px; padding: 14px; border-left: 4px solid var(--store-teal); background: #eef7f4; }
.shipment-live-status strong { color: var(--store-deep); }
.shipment-live-status span,
.shipment-live-status small { color: var(--store-muted); font-size: 13px; }
.shipment-live-status.delivery-delivered { border-left-color: #4d8e58; background: #eff8ef; }
.shipment-live-status.delivery-delivery_failure,
.shipment-live-status.delivery-exception,
.shipment-live-status.delivery-expired { border-left-color: var(--store-coral); background: #fff1ed; }
.shipment-live-status.delivery-out_for_delivery,
.shipment-live-status.delivery-available_for_pickup { border-left-color: var(--store-gold); background: #fff8e9; }
.tracking-contact { display: flex; align-items: center; justify-content: space-between; gap: 22px; padding: 22px; border-block: 1px solid var(--store-line); }
.tracking-contact > div:first-child { display: grid; gap: 4px; }
.tracking-contact > div:first-child span { color: var(--store-muted); }
.tracking-contact-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; }
.tracking-contact-button { min-height: 42px; display: inline-flex; align-items: center; padding: 8px 13px; border: 1px solid var(--store-deep); border-radius: 6px; color: var(--store-deep); background: transparent; font: inherit; font-weight: 800; text-decoration: none; cursor: pointer; }
.tracking-contact-button.line-button { border-color: #16803a; color: #16803a; }

@media (max-width: 820px) {
  .catalog-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .catalog-toolbar { grid-template-columns: 1fr 1fr; }
  .catalog-search { grid-column: 1 / -1; }
  .store-assurance { grid-template-columns: 1fr; }
  .store-assurance div + div { border-left: 0; border-top: 1px solid var(--store-line); }
  .store-footer { align-items: flex-start; flex-direction: column; }
  .tracking-columns { grid-template-columns: 1fr; }
  .order-timeline { grid-template-columns: repeat(3, 1fr); row-gap: 24px; }
  .order-timeline li:nth-child(4)::before { display: none; }
}

@media (max-width: 580px) {
  .store-header { min-height: 64px; padding: 8px 14px; }
  .store-brand img { width: 42px; height: 42px; }
  .store-brand strong { font-size: 16px; }
  .store-brand small, .store-nav > a:first-child { display: none; }
  .tracking-body .store-nav > a:first-child { display: inline-flex; }
  .store-nav { gap: 8px; }
  .store-nav .admin-link { min-height: 40px; padding: 7px 10px; font-size: 13px; }
  .store-hero { min-height: 540px; background-position: 55% center; }
  .store-hero-content { padding: 62px 20px 52px; }
  .store-hero h1 { font-size: 52px; }
  .catalog-section { width: min(100% - 28px, 1180px); padding-top: 38px; }
  .catalog-heading { align-items: flex-start; flex-direction: column; gap: 8px; }
  .catalog-toolbar { grid-template-columns: 1fr; }
  .catalog-search { grid-column: auto; }
  .catalog-grid { grid-template-columns: 1fr; }
  .store-assurance { width: min(100% - 28px, 1180px); }
  .listing-facts { grid-template-columns: 1fr; }
  .order-dialog-content { padding: 22px 18px; }
  .order-form-row { grid-template-columns: 1fr; }
  .tracking-page { width: min(100% - 28px, 1060px); padding-top: 34px; }
  .tracking-lookup { padding: 18px; }
  .tracking-lookup-row,
  .recent-orders { grid-template-columns: 1fr; }
  .tracking-summary-band { grid-template-columns: 1fr 44px; gap: 12px; }
  .tracking-summary-band div:nth-child(2) { grid-column: 1; }
  .tracking-refresh { grid-column: 2; grid-row: 1 / span 2; }
  .order-timeline { grid-template-columns: repeat(2, 1fr); }
  .order-timeline li:nth-child(3)::before,
  .order-timeline li:nth-child(5)::before { display: none; }
  .order-timeline li:nth-child(4)::before { display: block; }
  .tracking-section { padding: 19px; }
  .tracking-contact { align-items: flex-start; flex-direction: column; }
  .tracking-contact-actions { justify-content: flex-start; }
}
