:root {
  --paper: #f4efe2;
  --paper-deep: #e3dac8;
  --ink: #17231d;
  --muted: #6e746d;
  --line: #c7baa4;
  --green: #263c31;
  --green-2: #415f4c;
  --wine: #7a2631;
  --gold: #a47b42;
  --blue-gray: #6f7d86;
  --white: #fffdf8;
  --shadow: 0 22px 50px rgba(23, 35, 29, 0.16);
  --radius: 6px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  color: var(--ink);
  font-family: "Microsoft JhengHei", "PingFang SC", "Noto Serif SC", serif;
  background:
    linear-gradient(90deg, rgba(38, 60, 49, 0.05) 1px, transparent 1px),
    linear-gradient(rgba(38, 60, 49, 0.045) 1px, transparent 1px),
    var(--paper);
  background-size: 48px 48px;
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

img {
  display: block;
  max-width: 100%;
}

a {
  color: inherit;
  text-decoration: none;
}

:focus-visible {
  outline: 2px solid var(--wine);
  outline-offset: 3px;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 76px;
  padding: 14px 28px;
  color: var(--white);
  background: rgba(23, 35, 29, 0.94);
  border-bottom: 1px solid rgba(255, 253, 248, 0.14);
  backdrop-filter: blur(16px);
}

.brand-lockup {
  display: inline-flex;
  align-items: center;
  gap: 12px;
}

.brand-lockup strong,
.editorial-panel h1,
.drawer-header h2 {
  font-family: Georgia, "Times New Roman", "SimSun", serif;
}

.brand-mark {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  background: var(--green);
  border: 1px solid rgba(255, 253, 248, 0.22);
  border-radius: var(--radius);
  overflow: hidden;
}

.brand-mark img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.brand-lockup small {
  display: block;
  margin-top: 2px;
  color: rgba(255, 253, 248, 0.66);
  font-size: 0.76rem;
}

.top-nav {
  display: flex;
  align-items: center;
  gap: 22px;
}

.top-nav a {
  color: rgba(255, 253, 248, 0.78);
  font-size: 0.92rem;
}

.cart-button,
.checkout-button,
.catalog-meta button,
.product-card button,
.dialog-actions button,
.pay-link {
  min-height: 42px;
  color: var(--white);
  background: var(--wine);
  border: 1px solid rgba(255, 253, 248, 0.14);
  border-radius: var(--radius);
}

.cart-button {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
}

.cart-button b {
  display: grid;
  min-width: 24px;
  height: 24px;
  place-items: center;
  color: var(--ink);
  background: var(--paper);
  border-radius: 50%;
}

.shop-shell {
  display: grid;
  grid-template-columns: minmax(310px, 0.72fr) minmax(0, 1.58fr);
  gap: 28px;
  width: min(1500px, calc(100% - 44px));
  margin: 28px auto 72px;
}

.editorial-panel {
  position: sticky;
  top: 104px;
  align-self: start;
  min-height: 660px;
  padding: 34px;
  color: var(--white);
  background:
    linear-gradient(135deg, rgba(164, 123, 66, 0.16), transparent 38%),
    linear-gradient(180deg, var(--green), #17231d);
  border: 1px solid rgba(255, 253, 248, 0.16);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.editorial-panel::before {
  content: "";
  position: absolute;
  inset: 18px;
  pointer-events: none;
  border: 1px solid rgba(255, 253, 248, 0.16);
}

.eyebrow {
  margin: 0 0 18px;
  color: var(--gold);
  font-size: 0.74rem;
  text-transform: uppercase;
}

.editorial-panel h1 {
  position: relative;
  margin: 0;
  font-size: 3.9rem;
  line-height: 0.95;
  font-weight: 500;
}

.lede {
  position: relative;
  max-width: 30rem;
  margin: 28px 0 34px;
  color: rgba(255, 253, 248, 0.82);
  font-size: 1.08rem;
  line-height: 1.9;
}

.price-rules {
  position: relative;
  display: grid;
  margin: 0;
  border-top: 1px solid rgba(255, 253, 248, 0.18);
}

.price-rules div {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 18px;
  padding: 18px 0;
  border-bottom: 1px solid rgba(255, 253, 248, 0.18);
}

.price-rules dt {
  color: rgba(255, 253, 248, 0.68);
}

.price-rules dd {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.45rem;
}

.provenance {
  position: relative;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 36px;
}

.provenance span,
.tag {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 4px 9px;
  border: 1px solid currentColor;
  border-radius: var(--radius);
  font-size: 0.78rem;
}

.provenance span {
  color: rgba(255, 253, 248, 0.74);
}

.catalog-area {
  min-width: 0;
}

.toolbar {
  display: grid;
  grid-template-columns: minmax(220px, 1.3fr) repeat(4, minmax(120px, 0.7fr));
  gap: 10px;
  padding: 12px;
  background: rgba(255, 253, 248, 0.78);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 10px 30px rgba(23, 35, 29, 0.08);
}

label span,
.shipping-form h3,
.payment-box h3 {
  display: block;
  margin-bottom: 7px;
  color: var(--muted);
  font-size: 0.76rem;
}

input,
select {
  width: 100%;
  min-height: 42px;
  padding: 9px 10px;
  color: var(--ink);
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.catalog-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin: 18px 0;
}

.catalog-meta p {
  margin: 0;
  color: var(--muted);
}

.catalog-meta button {
  min-height: 36px;
  padding: 6px 12px;
  color: var(--green);
  background: transparent;
  border-color: var(--green-2);
}

.product-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
}

.product-card {
  display: grid;
  grid-template-rows: auto 1fr;
  min-width: 0;
  background: rgba(255, 253, 248, 0.86);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: 0 14px 28px rgba(23, 35, 29, 0.08);
}

.product-media {
  position: relative;
  aspect-ratio: 4 / 5;
  background: var(--paper-deep);
  overflow: hidden;
}

.product-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.side-switch {
  position: absolute;
  right: 10px;
  bottom: 10px;
  min-height: 34px;
  padding: 6px 10px;
  color: var(--ink);
  background: rgba(255, 253, 248, 0.9);
  border: 1px solid rgba(23, 35, 29, 0.18);
  border-radius: var(--radius);
}

.product-info {
  display: grid;
  gap: 12px;
  padding: 14px;
}

.product-title-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.product-title-row h2 {
  margin: 0;
  font-size: 1rem;
  line-height: 1.45;
  font-weight: 700;
}

.price {
  flex: 0 0 auto;
  font-family: Georgia, "Times New Roman", serif;
  color: var(--wine);
  font-size: 1.2rem;
}

.tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.tag {
  color: var(--green);
  background: rgba(38, 60, 49, 0.06);
}

.product-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 4px;
}

.product-actions button {
  padding: 9px 10px;
}

.product-actions .secondary {
  color: var(--green);
  background: transparent;
  border-color: var(--green-2);
}

.cart-drawer {
  position: fixed;
  inset: 0;
  z-index: 30;
  pointer-events: none;
  visibility: hidden;
}

.cart-drawer.open {
  pointer-events: auto;
  visibility: visible;
}

.drawer-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(23, 35, 29, 0.46);
  opacity: 0;
  transition: opacity 180ms ease;
}

.cart-drawer.open .drawer-backdrop {
  opacity: 1;
}

.drawer-panel {
  position: absolute;
  top: 0;
  right: 0;
  display: flex;
  flex-direction: column;
  width: min(520px, 100%);
  height: 100%;
  padding: 24px;
  background: var(--white);
  border-left: 1px solid var(--line);
  box-shadow: var(--shadow);
  transform: translateX(100%);
  transition: transform 220ms ease;
  overflow-y: auto;
}

.cart-drawer.open .drawer-panel {
  transform: translateX(0);
}

.drawer-header,
.cart-row,
.cart-total {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.drawer-header h2 {
  margin: 0;
  font-size: 2.4rem;
  font-weight: 500;
}

.icon-button {
  display: grid;
  width: 40px;
  height: 40px;
  place-items: center;
  color: var(--ink);
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 50%;
  font-size: 1.35rem;
  line-height: 1;
}

.cart-items {
  display: grid;
  gap: 10px;
  margin: 18px 0 24px;
}

.cart-row {
  padding: 10px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.cart-row img {
  width: 70px;
  height: 88px;
  object-fit: cover;
  border-radius: var(--radius);
}

.cart-row h4 {
  margin: 0 0 5px;
  font-size: 0.95rem;
}

.cart-row p {
  margin: 0;
  color: var(--muted);
  font-size: 0.82rem;
}

.cart-row button {
  min-height: 34px;
  color: var(--wine);
  background: transparent;
  border: 1px solid rgba(122, 38, 49, 0.38);
  border-radius: var(--radius);
}

.shipping-form,
.payment-box {
  display: grid;
  gap: 12px;
  margin-bottom: 22px;
}

.field-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.quote-list {
  display: grid;
  gap: 8px;
}

.quote-option {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  padding: 10px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.quote-option strong {
  color: var(--wine);
}

.segmented {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.segmented.single-option {
  grid-template-columns: 1fr;
}

.segmented label {
  position: relative;
}

.segmented input {
  position: absolute;
  opacity: 0;
}

.segmented span {
  display: grid;
  min-height: 44px;
  place-items: center;
  margin: 0;
  color: var(--green);
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.segmented input:checked + span {
  color: var(--white);
  background: var(--green);
  border-color: var(--green);
}

.cart-total {
  position: sticky;
  bottom: -24px;
  margin: auto -24px -24px;
  padding: 18px 24px 24px;
  background: var(--white);
  border-top: 1px solid var(--line);
}

.cart-total span {
  display: block;
  color: var(--muted);
  font-size: 0.8rem;
}

.cart-total strong {
  font-family: Georgia, "Times New Roman", serif;
  color: var(--wine);
  font-size: 1.8rem;
}

.checkout-button {
  min-width: 150px;
  padding: 10px 16px;
}

.product-dialog,
.pay-dialog {
  width: min(980px, calc(100% - 30px));
  padding: 0;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.product-dialog::backdrop,
.pay-dialog::backdrop {
  background: rgba(23, 35, 29, 0.54);
}

.dialog-close {
  position: absolute;
  top: 14px;
  right: 14px;
  z-index: 2;
  background: rgba(255, 253, 248, 0.92);
}

.detail-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(300px, 0.8fr);
}

.detail-media {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
  background: var(--paper-deep);
}

.detail-media img {
  width: 100%;
  height: 100%;
  max-height: 760px;
  object-fit: cover;
}

.detail-copy {
  display: grid;
  align-content: start;
  gap: 18px;
  padding: 34px;
}

.detail-copy h2 {
  margin: 0;
  font-size: 2rem;
  line-height: 1.24;
}

.detail-copy p {
  margin: 0;
  color: var(--muted);
  line-height: 1.8;
}

.spec-list {
  display: grid;
  gap: 8px;
  margin: 0;
}

.spec-list div {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--line);
}

.spec-list dt {
  color: var(--muted);
}

.spec-list dd {
  margin: 0;
  text-align: right;
}

.dialog-actions {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}

.pay-slip {
  display: grid;
  gap: 18px;
  padding: 34px;
}

.pay-slip h2 {
  margin: 0;
  font-size: 2rem;
}

.pay-link {
  display: inline-grid;
  width: fit-content;
  min-width: 180px;
  place-items: center;
  padding: 10px 16px;
}

.qr-box {
  display: grid;
  min-height: 180px;
  place-items: center;
  padding: 20px;
  color: var(--green);
  background:
    linear-gradient(45deg, rgba(38, 60, 49, 0.08) 25%, transparent 25%),
    linear-gradient(-45deg, rgba(38, 60, 49, 0.08) 25%, transparent 25%),
    var(--paper);
  background-size: 22px 22px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  font-family: Consolas, "Courier New", monospace;
  overflow-wrap: anywhere;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  z-index: 60;
  max-width: min(420px, calc(100% - 36px));
  padding: 12px 16px;
  color: var(--white);
  background: var(--green);
  border: 1px solid rgba(255, 253, 248, 0.16);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  transform: translate(-50%, 120px);
  opacity: 0;
  transition: transform 180ms ease, opacity 180ms ease;
}

.toast.show {
  transform: translate(-50%, 0);
  opacity: 1;
}

.empty-state {
  padding: 42px;
  color: var(--muted);
  background: rgba(255, 253, 248, 0.7);
  border: 1px dashed var(--line);
  border-radius: var(--radius);
}

.site-footer {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  width: min(1500px, calc(100% - 44px));
  margin: -38px auto 28px;
  padding: 18px 0 0;
  color: var(--muted);
  border-top: 1px solid rgba(199, 186, 164, 0.7);
  font-size: 0.82rem;
}

.site-footer a {
  color: var(--green);
}

@media (max-width: 1180px) {
  .shop-shell {
    grid-template-columns: 1fr;
  }

  .editorial-panel {
    position: relative;
    top: auto;
    min-height: auto;
  }

  .product-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 760px) {
  .site-header {
    align-items: flex-start;
    min-height: auto;
    padding: 14px 16px;
  }

  .top-nav {
    gap: 10px;
  }

  .top-nav a {
    display: none;
  }

  .shop-shell {
    width: calc(100% - 24px);
    margin-top: 14px;
  }

  .editorial-panel {
    padding: 24px;
  }

  .editorial-panel h1 {
    font-size: 3rem;
  }

  .toolbar,
  .field-grid,
  .detail-layout,
  .detail-media {
    grid-template-columns: 1fr;
  }

  .product-grid {
    grid-template-columns: 1fr;
  }

  .catalog-meta {
    align-items: flex-start;
    flex-direction: column;
  }

  .drawer-panel {
    padding: 18px;
  }

  .cart-total {
    margin: auto -18px -18px;
    padding: 16px 18px 18px;
  }

  .site-footer {
    width: calc(100% - 24px);
    flex-direction: column;
    gap: 6px;
    margin-top: -36px;
  }
}
