:root {
  --surface: #f9f9f9;
  --white: #ffffff;
  --platinum: #f7f7f7;
  --ink: #111111;
  --muted: #3e4947;
  --line: #dadada;
  --blue: #81d8d0;
  --blue-deep: #006a64;
  --error: #ba1a1a;
  --max: 1280px;
  --product-min: 300px;
  --product-gap: 24px;
  --product-max: calc((var(--product-min) * 4) + (var(--product-gap) * 3));
  --gutter: 24px;
  --serif: "EB Garamond", Georgia, "Times New Roman", serif;
  --sans: Inter, Arial, "Noto Sans TC", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--surface);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.6;
}

button,
input {
  font: inherit;
}

button,
a {
  color: inherit;
}

a {
  text-decoration: none;
}

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

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 72px;
  padding: 0 64px;
  background: rgba(249, 249, 249, 0.92);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(16px);
}

.brand {
  display: inline-flex;
  align-items: center;
  width: 140px;
  min-height: 44px;
}

.brand img {
  width: 100%;
  height: auto;
  max-height: 44px;
  object-fit: contain;
}

.top-nav {
  display: flex;
  align-items: center;
  gap: 28px;
  font-size: 13px;
}

.top-nav a,
.cart-button,
.filter-button,
.secondary-button,
.pay-button,
.primary-link {
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.cart-button,
.filter-button,
.secondary-button,
.pay-button,
.icon-button,
.product-image-button {
  cursor: pointer;
}

.cart-button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 0;
  background: transparent;
  border: 0;
}

.cart-count {
  display: inline-grid;
  min-width: 22px;
  height: 22px;
  place-items: center;
  background: var(--ink);
  color: var(--white);
  font-size: 12px;
}

.hero {
  position: relative;
  min-height: calc(100vh - 72px);
  display: grid;
  align-items: center;
  overflow: hidden;
  background: var(--white);
}

.hero-media {
  position: absolute;
  inset: 0;
}

.hero-media::after {
  position: absolute;
  inset: 0;
  content: "";
  background: linear-gradient(90deg, rgba(255, 255, 255, 0.92), rgba(255, 255, 255, 0.54), rgba(255, 255, 255, 0.16));
}

.hero-media img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transition: opacity 900ms ease;
}

.hero-media img.is-active {
  opacity: 1;
}

.hero-copy {
  position: relative;
  width: min(520px, calc(100% - 48px));
  margin-left: 64px;
  padding-bottom: 80px;
}

.eyebrow {
  margin: 0 0 12px;
  color: var(--blue-deep);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.1em;
  line-height: 1.2;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1,
h2,
h3 {
  font-family: var(--serif);
  font-weight: 400;
  letter-spacing: 0;
}

h1 {
  margin-bottom: 16px;
  font-size: 56px;
  line-height: 1.05;
}

h2 {
  margin-bottom: 0;
  font-size: 32px;
  line-height: 1.2;
}

h3 {
  margin-bottom: 4px;
  font-size: 24px;
  line-height: 1.25;
}

.product-card h3 {
  min-height: 60px;
  display: -webkit-box;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.hero-copy p:not(.eyebrow) {
  max-width: 420px;
  color: var(--muted);
  font-size: 18px;
}

.primary-link,
.pay-button,
.secondary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 0 22px;
  border: 1px solid var(--ink);
  font-size: 13px;
  font-weight: 600;
  line-height: 1;
}

.primary-link,
.secondary-button {
  background: transparent;
}

.pay-button {
  background: var(--blue);
  border-color: var(--blue);
  color: var(--ink);
}

.toolbar,
.checkout-section {
  width: min(var(--max), calc(100% - 128px));
  margin: 0 auto;
}

.toolbar {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 32px;
  padding: 88px 0 32px;
}

.filters {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.filter-button {
  min-height: 36px;
  padding: 0 14px;
  background: var(--white);
  border: 1px solid var(--line);
  font-size: 12px;
}

.filter-button.is-active {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--white);
}

.product-grid {
  width: min(var(--product-max), calc(100% - 128px));
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, var(--product-min)), 1fr));
  gap: 48px var(--product-gap);
  padding-bottom: 96px;
}

.empty-state {
  grid-column: 1 / -1;
  padding: 64px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  text-align: center;
}

.product-card {
  min-width: 0;
}

.product-image-button {
  width: 100%;
  padding: 0;
  overflow: hidden;
  background: var(--platinum);
  border: 0;
  aspect-ratio: 1 / 1;
}

.product-image-button img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 400ms ease;
}

.product-image-button:hover img {
  transform: scale(1.04);
}

.product-info {
  padding-top: 18px;
}

.product-code {
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 12px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.product-name-zh {
  min-height: 26px;
  margin-bottom: 20px;
  color: var(--muted);
}

.product-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-top: 1px solid var(--line);
  padding-top: 16px;
}

.price {
  white-space: nowrap;
}

.secondary-button {
  min-height: 40px;
  padding: 0 14px;
  font-size: 12px;
}

.checkout-section {
  display: grid;
  grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.2fr);
  gap: 64px;
  padding: 72px 0 96px;
  border-top: 1px solid var(--line);
}

.checkout-copy p:not(.eyebrow) {
  color: var(--muted);
}

.checkout-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 26px 24px;
}

.checkout-form label {
  display: grid;
  gap: 6px;
}

.checkout-form label span {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.checkout-form input {
  width: 100%;
  min-height: 44px;
  padding: 6px 0;
  background: transparent;
  border: 0;
  border-bottom: 1px solid var(--ink);
  border-radius: 0;
  outline: 0;
}

.checkout-form input:focus {
  border-bottom-color: var(--blue-deep);
}

.full,
.checkout-total,
.checkout-form .pay-button,
.form-message {
  grid-column: 1 / -1;
}

.checkout-total {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 8px;
  border-top: 1px solid var(--line);
}

.checkout-total strong,
.cart-foot strong,
[data-dialog-price] {
  font-size: 22px;
}

.form-message {
  min-height: 24px;
  margin: 0;
  color: var(--muted);
}

.form-message.is-error {
  color: var(--error);
}

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

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

.cart-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(17, 17, 17, 0.28);
  opacity: 0;
  transition: opacity 180ms ease;
}

.cart-panel.is-open .cart-backdrop {
  opacity: 1;
}

.cart-drawer {
  position: absolute;
  top: 0;
  right: 0;
  display: grid;
  grid-template-rows: auto 1fr auto;
  width: min(420px, 100%);
  height: 100%;
  background: var(--white);
  border-left: 1px solid var(--line);
  transform: translateX(100%);
  transition: transform 220ms ease;
}

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

.cart-head,
.cart-foot {
  padding: 28px;
}

.cart-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  border-bottom: 1px solid var(--line);
}

.icon-button {
  display: inline-grid;
  width: 40px;
  height: 40px;
  place-items: center;
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 0;
  font-size: 24px;
  line-height: 1;
}

.cart-items {
  overflow: auto;
  padding: 8px 28px;
}

.cart-item {
  display: grid;
  grid-template-columns: 72px 1fr auto;
  gap: 14px;
  padding: 20px 0;
  border-bottom: 1px solid var(--line);
}

.cart-item img {
  width: 72px;
  height: 84px;
  object-fit: cover;
  background: var(--platinum);
}

.cart-item h3 {
  margin: 0 0 4px;
  font-size: 19px;
}

.cart-item p {
  margin-bottom: 10px;
  color: var(--muted);
  font-size: 13px;
}

.qty-controls {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--line);
}

.qty-controls button {
  width: 32px;
  height: 32px;
  background: transparent;
  border: 0;
  cursor: pointer;
}

.qty-controls span {
  min-width: 32px;
  text-align: center;
}

.remove-button {
  align-self: start;
  background: transparent;
  border: 0;
  color: var(--muted);
  cursor: pointer;
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.cart-foot {
  display: grid;
  gap: 18px;
  border-top: 1px solid var(--line);
}

.cart-foot > div {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

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

.product-dialog::backdrop {
  background: rgba(17, 17, 17, 0.38);
}

.dialog-close {
  position: absolute;
  top: 18px;
  right: 18px;
  z-index: 2;
  background: var(--white);
}

.dialog-grid {
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  min-height: 560px;
}

.gallery {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1px;
  background: var(--line);
}

.gallery img {
  width: 100%;
  height: 100%;
  min-height: 280px;
  object-fit: cover;
  background: var(--platinum);
}

.dialog-info {
  align-self: center;
  padding: 56px;
}

.dialog-info p:not(.eyebrow) {
  color: var(--muted);
}

.dialog-info .pay-button {
  margin-top: 28px;
  width: 100%;
}

.site-footer {
  border-top: 1px solid var(--line);
  background: var(--white);
}

.footer-inner {
  width: min(var(--max), calc(100% - 128px));
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  min-height: 96px;
  color: var(--muted);
  font-size: 13px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 18px 28px;
}

.footer-brand {
  display: inline-flex;
  align-items: center;
  width: 128px;
  min-height: 40px;
}

.footer-brand img {
  width: 100%;
  height: auto;
  max-height: 40px;
  object-fit: contain;
}

.footer-links a {
  color: var(--ink);
}

.legal-page {
  width: min(920px, calc(100% - 128px));
  margin: 0 auto;
  padding: 96px 0 112px;
}

.legal-hero {
  padding-bottom: 48px;
  border-bottom: 1px solid var(--line);
}

.legal-hero h1 {
  margin-bottom: 18px;
}

.legal-hero p:not(.eyebrow) {
  max-width: 640px;
  color: var(--muted);
  font-size: 18px;
}

.legal-content {
  display: grid;
  gap: 0;
}

.legal-content article {
  display: grid;
  grid-template-columns: minmax(180px, 0.34fr) minmax(0, 1fr);
  gap: 48px;
  padding: 34px 0;
  border-bottom: 1px solid var(--line);
}

.legal-content h2 {
  font-size: 24px;
}

.legal-content p {
  margin-bottom: 0;
  color: var(--muted);
}

@media (max-width: 980px) {
  .site-header {
    padding: 0 24px;
  }

  .top-nav {
    gap: 16px;
  }

  .top-nav > a {
    display: none;
  }

  .hero {
    min-height: 680px;
  }

  .hero-media::after {
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.22), rgba(255, 255, 255, 0.9));
  }

  .hero-copy {
    align-self: end;
    margin: 0 24px;
    padding-bottom: 56px;
  }

  h1 {
    font-size: 40px;
    line-height: 1.15;
  }

  .toolbar,
  .checkout-section,
  .product-grid,
  .footer-inner,
  .legal-page {
    width: calc(100% - 48px);
  }

  .toolbar,
  .checkout-section {
    display: grid;
  }

  .filters {
    justify-content: flex-start;
  }

  .product-grid {
    gap: 40px 18px;
  }

  .checkout-section,
  .checkout-form,
  .dialog-grid {
    grid-template-columns: 1fr;
  }

  .dialog-info {
    padding: 32px 24px;
  }

  .legal-page {
    padding: 72px 0 88px;
  }

  .legal-content article {
    grid-template-columns: 1fr;
    gap: 12px;
    padding: 30px 0;
  }
}

@media (max-width: 560px) {
  .product-grid {
    grid-template-columns: 1fr;
  }

  .checkout-form {
    gap: 22px;
  }

  .cart-item {
    grid-template-columns: 64px 1fr;
  }

  .remove-button {
    grid-column: 2;
  }

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

  .footer-inner {
    align-items: flex-start;
    flex-direction: column;
    justify-content: center;
    min-height: 128px;
  }

  .footer-links {
    justify-content: flex-start;
  }
}
