:root {
  --ink: #24313a;
  --muted: #6f7777;
  --line: #d8d5cd;
  --paper: #f8f6f1;
  --surface: #ffffff;
  --brand-blue: #4b697c;
  --brand-blue-dark: #385466;
  --brand-gold: #deba88;
  --brand-green: #5c6a58;
  --brand-gray: #a8abaa;
  --brand-taupe: #bea997;
  --tea: var(--brand-blue);
  --tea-dark: var(--brand-blue-dark);
  --amber: var(--brand-gold);
  --rose: #9a675d;
  --blue: var(--brand-blue);
  --shadow: 0 18px 50px rgba(75, 105, 124, 0.16);
  font-family: "Microsoft JhengHei", "Noto Sans TC", Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  color: var(--ink);
  background: var(--paper);
}

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

.site-header {
  background: var(--brand-blue);
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  min-height: 72px;
  padding: 12px clamp(18px, 4vw, 56px);
  background: rgba(248, 246, 241, 0.94);
  border-bottom: 1px solid rgba(75, 105, 124, 0.18);
  backdrop-filter: blur(18px);
}

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

.brand-logo {
  width: 58px;
  height: 58px;
  object-fit: cover;
  border: 3px solid var(--brand-gold);
  border-radius: 8px;
  background: var(--brand-blue);
}

.brand strong,
.brand small {
  display: block;
}

.brand small,
.eyebrow,
.category-tile small,
.product-meta,
.empty {
  color: var(--muted);
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.nav-links a {
  padding: 10px 12px;
  border: 1px solid transparent;
  border-radius: 999px;
  color: var(--brand-blue-dark);
}

.nav-links a[href="#leaf"] {
  border-color: rgba(75, 105, 124, 0.28);
}

.nav-links a[href="#corner-bags"] {
  border-color: rgba(92, 106, 88, 0.28);
}

.nav-links a[href="#tea-bags"] {
  border-color: rgba(190, 169, 151, 0.42);
}

.nav-links a[href="#herbal-bags"] {
  border-color: rgba(222, 186, 136, 0.48);
}

.nav-links a:hover,
.nav-links a.active {
  color: #fff;
  background: var(--tea);
}

.nav-links a[href="#corner-bags"]:hover,
.nav-links a[href="#corner-bags"].active {
  background: var(--brand-green);
}

.nav-links a[href="#tea-bags"]:hover,
.nav-links a[href="#tea-bags"].active {
  background: #8c7868;
}

.nav-links a[href="#herbal-bags"]:hover,
.nav-links a[href="#herbal-bags"].active {
  color: var(--brand-blue-dark);
  background: var(--brand-gold);
}

.hero {
  position: relative;
  min-height: min(74vh, 720px);
  display: flex;
  align-items: flex-end;
  overflow: hidden;
}

.hero > img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.hero::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(90deg, rgba(75, 105, 124, 0.9), rgba(75, 105, 124, 0.66) 48%, rgba(75, 105, 124, 0.28)),
    linear-gradient(180deg, rgba(36, 49, 58, 0.05), rgba(36, 49, 58, 0.34));
}

.hero-copy {
  position: relative;
  z-index: 1;
  width: min(760px, calc(100% - 36px));
  padding: clamp(42px, 9vw, 96px) clamp(18px, 4vw, 56px);
  color: #fff;
}

.hero-logo {
  width: clamp(112px, 16vw, 170px);
  aspect-ratio: 1;
  object-fit: cover;
  margin-bottom: 20px;
  border: 4px solid var(--brand-gold);
  border-radius: 12px;
  box-shadow: 0 18px 45px rgba(36, 49, 58, 0.28);
}

.hero-copy h1 {
  margin: 10px 0 14px;
  font-size: clamp(42px, 7vw, 84px);
  line-height: 1.02;
  letter-spacing: 0;
}

.hero-subtitle {
  color: var(--brand-gold);
  font-weight: 800;
}

.hero-copy p {
  max-width: 560px;
  margin: 0 0 22px;
  font-size: 18px;
  line-height: 1.8;
}

.hero .eyebrow {
  color: var(--brand-gold);
  font-weight: 700;
}

.hero-actions,
.final-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.submit-status {
  min-height: 24px;
  margin: 12px 0 0;
  color: var(--brand-blue);
  font-weight: 800;
}

.submit-status.error {
  color: #9a4f45;
}

.submit-status a {
  color: var(--brand-blue-dark);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  padding: 0 18px;
  border: 1px solid transparent;
  border-radius: 8px;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.button.primary {
  color: var(--brand-blue-dark);
  background: var(--brand-gold);
}

.button.primary:hover {
  background: #e8c79b;
}

.button.ghost {
  color: var(--brand-blue-dark);
  background: rgba(255, 255, 255, 0.9);
  border-color: rgba(222, 186, 136, 0.65);
}

.button.full {
  width: 100%;
}

main {
  width: min(1180px, calc(100% - 36px));
  margin: 0 auto;
}

.home-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
  margin: -42px 0 32px;
  position: relative;
  z-index: 2;
}

.category-tile {
  min-height: 170px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 12px;
  padding: 22px;
  background: var(--surface);
  border: 1px solid rgba(75, 105, 124, 0.14);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.category-tile.leaf {
  border-top: 5px solid var(--brand-blue);
  background: linear-gradient(180deg, rgba(75, 105, 124, 0.12), #fff 68%);
}

.category-tile.corner {
  border-top: 5px solid var(--brand-green);
  background: linear-gradient(180deg, rgba(92, 106, 88, 0.12), #fff 68%);
}

.category-tile.bags {
  border-top: 5px solid var(--brand-taupe);
  background: linear-gradient(180deg, rgba(190, 169, 151, 0.2), #fff 68%);
}

.category-tile.herbal {
  border-top: 5px solid var(--brand-gold);
  background: linear-gradient(180deg, rgba(222, 186, 136, 0.24), #fff 68%);
}

.category-tile strong {
  font-size: 24px;
}

.category-tile.leaf strong {
  color: var(--brand-blue-dark);
}

.category-tile.corner strong {
  color: var(--brand-green);
}

.category-tile.bags strong {
  color: #806f61;
}

.category-tile.herbal strong {
  color: #9a6f32;
}

.category-tile:hover {
  transform: translateY(-2px);
}

.layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 24px;
  align-items: start;
}

.catalog {
  min-width: 0;
}

.catalog-page {
  display: none;
  padding-top: 22px;
}

.catalog-page.active {
  display: block;
}

.catalog-page {
  --category-accent: var(--brand-blue);
  --category-tint: rgba(75, 105, 124, 0.08);
}

.catalog-page.corner-bags {
  --category-accent: var(--brand-green);
  --category-tint: rgba(92, 106, 88, 0.08);
}

.catalog-page.tea-bags {
  --category-accent: var(--brand-taupe);
  --category-tint: rgba(190, 169, 151, 0.14);
}

.catalog-page.herbal-bags {
  --category-accent: var(--brand-gold);
  --category-tint: rgba(222, 186, 136, 0.18);
}

.section-heading {
  margin: 0 0 18px;
}

.catalog-page .section-heading {
  padding: 16px 18px;
  background: var(--category-tint);
  border-left: 6px solid var(--category-accent);
  border-radius: 8px;
}

.section-heading h2 {
  margin: 6px 0 8px;
  font-size: clamp(30px, 4vw, 46px);
  letter-spacing: 0;
}

.section-heading p:last-child {
  margin: 0;
  color: var(--muted);
}

.product-group {
  margin: 0 0 24px;
}

.group-title {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  margin: 0 0 12px;
  padding: 0 12px;
  color: #fff;
  background: var(--category-accent);
  border-radius: 999px;
  font-size: 15px;
}

.product-list {
  display: grid;
  gap: 10px;
}

.product-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 112px 110px;
  gap: 14px;
  align-items: center;
  min-height: 76px;
  padding: 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-left: 5px solid var(--category-accent);
  border-radius: 8px;
}

.product-name {
  font-weight: 800;
  word-break: keep-all;
  overflow-wrap: anywhere;
}

.product-price {
  font-weight: 800;
  text-align: right;
}

.qty-control {
  display: grid;
  grid-template-columns: 34px 1fr 34px;
  height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: #fff;
}

.qty-control button,
.qty-control input {
  min-width: 0;
  border: 0;
  background: transparent;
  color: var(--ink);
  font: inherit;
  text-align: center;
}

.qty-control button {
  cursor: pointer;
  font-weight: 900;
  background: #f0eadf;
}

.qty-control button:hover {
  background: var(--brand-gold);
}

.qty-control input {
  width: 100%;
  font-weight: 800;
  appearance: textfield;
}

.qty-control input::-webkit-outer-spin-button,
.qty-control input::-webkit-inner-spin-button {
  appearance: none;
  margin: 0;
}

.order-panel,
.final-order {
  background: var(--surface);
  border: 1px solid rgba(75, 105, 124, 0.16);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.order-panel {
  position: sticky;
  top: 92px;
  padding: 18px;
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
  font-weight: 800;
}

.summary-list {
  max-height: 280px;
  overflow: auto;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.summary-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  padding: 12px 0;
  border-bottom: 1px solid #ebe8df;
}

.summary-item:last-child {
  border-bottom: 0;
}

.summary-item strong {
  display: block;
  overflow-wrap: anywhere;
}

.summary-item small {
  color: var(--muted);
}

.summary-item span {
  font-weight: 800;
}

.empty {
  padding: 18px 0;
  margin: 0;
}

.totals {
  margin: 16px 0;
}

.totals div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 0;
}

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

.totals dd {
  margin: 0;
  font-weight: 800;
}

.grand-total {
  margin-top: 8px;
  padding-top: 14px !important;
  border-top: 1px solid var(--line);
}

.grand-total dd {
  color: var(--brand-blue);
  font-size: 26px;
}

.checkout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 420px;
  gap: 24px;
  padding: 72px 0;
}

.checkout .section-heading {
  grid-column: 1 / -1;
}

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

label {
  display: grid;
  gap: 7px;
  font-weight: 800;
}

label.wide {
  grid-column: 1 / -1;
}

input,
select,
textarea {
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  font: inherit;
}

textarea {
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  outline: 3px solid rgba(222, 186, 136, 0.4);
  border-color: var(--tea);
}

.final-order {
  align-self: start;
  padding: 18px;
}

pre {
  min-height: 260px;
  max-height: 430px;
  overflow: auto;
  padding: 14px;
  background: #f1eee6;
  border: 1px solid var(--line);
  border-radius: 8px;
  white-space: pre-wrap;
  word-break: break-word;
  font: 14px/1.65 "Microsoft JhengHei", "Noto Sans TC", Arial, sans-serif;
}

footer {
  display: flex;
  justify-content: center;
  gap: 14px;
  flex-wrap: wrap;
  padding: 28px 18px 42px;
  color: #edf0eb;
  background: var(--brand-blue);
  border-top: 1px solid rgba(222, 186, 136, 0.28);
}

footer a {
  color: var(--brand-gold);
  font-weight: 800;
}

@media (max-width: 980px) {
  .layout,
  .checkout {
    grid-template-columns: 1fr;
  }

  .order-panel {
    position: static;
  }

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

@media (max-width: 780px) {
  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

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

  .hero {
    min-height: 620px;
  }

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

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

  .product-price {
    text-align: left;
  }

  .qty-control {
    grid-column: 1 / -1;
    width: min(220px, 100%);
  }
}

@media print {
  .topbar,
  .hero,
  .home-grid,
  .catalog,
  .order-panel,
  .final-actions,
  footer {
    display: none !important;
  }

  body,
  main {
    background: #fff;
  }

  .checkout {
    display: block;
    padding: 0;
  }

  .checkout-form {
    display: none;
  }

  .final-order {
    box-shadow: none;
    border: 0;
  }
}
