/* Tails & Co. 尾巴百貨 - design system
   Palette: spruce green + bone + marigold, persimmon reserved for sale semantics.
   Radius system: 12px surfaces, pills only for badges and the search field. */

:root {
  --bone: #F7F5F0;
  --paper: #FFFFFF;
  --ink: #22271F;
  --ink-2: #5C6357;
  --line: #E5E2D9;
  --spruce: #1E5C48;
  --spruce-2: #174A3A;
  --spruce-t: #E4EEE9;
  --marigold: #E8A13C;
  --sale: #D4572E;
  --sale-t: #FBEAE2;
  --cat-t: #F5E8DC;
  --dog-t: #E2EAF2;
  --r: 12px;
  --shadow: 0 1px 2px rgba(34, 39, 31, .05), 0 8px 24px rgba(34, 39, 31, .06);
  --font: "Outfit", "Noto Sans TC", system-ui, -apple-system, sans-serif;
  --w: 1280px;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.7;
  color: var(--ink);
  background: var(--bone);
  -webkit-font-smoothing: antialiased;
}
img, svg { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; cursor: pointer; background: none; border: 0; padding: 0; }
input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3, h4, p, ul, ol, figure { margin: 0; }
ul, ol { padding: 0; list-style: none; }
:focus-visible { outline: 2px solid var(--spruce); outline-offset: 2px; border-radius: 2px; }

.wrap { max-width: var(--w); margin: 0 auto; padding: 0 20px; }
main { min-height: 60vh; }

/* ---------- type ---------- */
h1 { font-size: 30px; line-height: 1.3; font-weight: 700; letter-spacing: -.01em; }
h2 { font-size: 24px; line-height: 1.35; font-weight: 700; letter-spacing: -.01em; }
h3 { font-size: 17px; line-height: 1.45; font-weight: 600; }
.muted { color: var(--ink-2); }
.section { padding: 56px 0; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; margin-bottom: 24px; }
.section-head h2 { flex: none; }
.section-head .more { color: var(--spruce); font-weight: 500; white-space: nowrap; }
.section-head .more:hover { color: var(--spruce-2); text-decoration: underline; text-underline-offset: 3px; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 11px 22px; border-radius: var(--r); font-weight: 600; font-size: 15px;
  border: 1px solid transparent; transition: background .16s ease-out, border-color .16s ease-out, transform .06s ease-out;
  white-space: nowrap;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--spruce); color: #FDFCF9; }
.btn-primary:hover { background: var(--spruce-2); }
.btn-primary:disabled { background: var(--line); color: var(--ink-2); cursor: not-allowed; }
.btn-ghost { border-color: var(--ink); color: var(--ink); background: transparent; }
.btn-ghost:hover { background: var(--ink); color: var(--bone); }
.btn-quiet { border-color: var(--line); background: var(--paper); }
.btn-quiet:hover { border-color: var(--ink-2); }
.btn-sm { padding: 7px 14px; font-size: 14px; border-radius: 10px; }
.btn-block { width: 100%; }

/* ---------- badges + chips ---------- */
.badge { display: inline-flex; align-items: center; padding: 2px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; line-height: 1.8; }
.badge-new { background: var(--spruce-t); color: var(--spruce-2); }
.badge-hot { background: #F7ECD9; color: #9A6414; }
.badge-sale { background: var(--sale); color: #FFF6F1; }
.badge-out { background: var(--line); color: var(--ink-2); }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 3px 12px; border-radius: 999px; font-size: 13px; font-weight: 500; }
.chip-pending { background: #F7ECD9; color: #9A6414; }
.chip-confirmed { background: var(--spruce-t); color: var(--spruce-2); }
.chip-shipped { background: var(--dog-t); color: #2C4A66; }
.chip-completed { background: var(--spruce); color: #FDFCF9; }
.chip-cancelled { background: var(--line); color: var(--ink-2); }

/* ---------- header ---------- */
.topbar { background: var(--spruce); color: #EAF1ED; font-size: 13px; }
.topbar .wrap { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 36px; }
.topbar a { font-weight: 500; text-underline-offset: 3px; }
.topbar a:hover { text-decoration: underline; }
.topbar .tb-note { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.masthead { background: var(--paper); border-bottom: 1px solid var(--line); }
.masthead .wrap { display: flex; align-items: center; gap: 24px; padding-top: 16px; padding-bottom: 16px; }
.logo { flex: none; line-height: 1.15; }
.logo .logo-en { font-weight: 700; font-size: 22px; letter-spacing: .04em; }
.logo .logo-zh { font-size: 12.5px; color: var(--ink-2); letter-spacing: .32em; }
.search { flex: 1; display: flex; max-width: 560px; }
.search input {
  flex: 1; min-width: 0; border: 1px solid var(--line); border-right: 0; background: var(--bone);
  border-radius: 999px 0 0 999px; padding: 9px 18px; font-size: 14px;
}
.search input::placeholder { color: var(--ink-2); }
.search input:focus { outline: none; border-color: var(--spruce); }
.search button {
  border: 1px solid var(--spruce); background: var(--spruce); color: #FDFCF9;
  border-radius: 0 999px 999px 0; padding: 0 20px; font-weight: 600; font-size: 14px;
}
.search button:hover { background: var(--spruce-2); }
.mast-actions { margin-left: auto; display: flex; align-items: center; gap: 20px; }
.mast-link { display: inline-flex; align-items: center; gap: 7px; font-weight: 500; font-size: 14px; }
.mast-link:hover { color: var(--spruce); }
.mast-link svg { width: 21px; height: 21px; }
.cart-count {
  min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px; background: var(--sale);
  color: #FFF; font-size: 11px; font-weight: 700; display: inline-flex; align-items: center; justify-content: center;
}
.cart-count[data-zero] { display: none; }

.mainnav { background: var(--paper); border-bottom: 1px solid var(--line); position: relative; z-index: 40; }
.mainnav .wrap { display: flex; align-items: stretch; gap: 4px; }
.nav-item { position: relative; }
.nav-link {
  display: inline-flex; align-items: center; gap: 5px; padding: 13px 14px; font-weight: 500; font-size: 15px;
  border-bottom: 2px solid transparent;
}
.nav-link:hover, .nav-item:hover > .nav-link, .nav-link[aria-current="page"] { color: var(--spruce); border-bottom-color: var(--spruce); }
.nav-link .caret { width: 10px; height: 10px; }
.nav-deal { color: var(--sale); }
.nav-deal:hover { color: var(--sale); border-bottom-color: var(--sale); }
.nav-spacer { flex: 1; }

.mega {
  position: absolute; top: 100%; left: 0; min-width: 640px; background: var(--paper);
  border: 1px solid var(--line); border-top: 0; border-radius: 0 0 var(--r) var(--r);
  box-shadow: var(--shadow); padding: 24px 28px; display: none;
  grid-template-columns: repeat(4, minmax(130px, 1fr)); gap: 20px 28px;
}
.nav-item:hover .mega, .nav-item:focus-within .mega { display: grid; }
.mega-group h4 { font-size: 13px; font-weight: 700; color: var(--ink); margin-bottom: 8px; padding-bottom: 6px; border-bottom: 1px solid var(--line); }
.mega-group a { display: block; padding: 3px 0; font-size: 13.5px; color: var(--ink-2); }
.mega-group a:hover { color: var(--spruce); }
.mega-all { grid-column: 1 / -1; padding-top: 4px; }
.mega-all a { font-weight: 600; color: var(--spruce); font-size: 14px; }

.menu-toggle { display: none; }

/* mobile drawer */
.drawer-scrim { position: fixed; inset: 0; background: rgba(34, 39, 31, .45); z-index: 90; opacity: 0; pointer-events: none; transition: opacity .2s ease-out; }
.drawer {
  position: fixed; top: 0; bottom: 0; left: 0; width: min(320px, 86vw); background: var(--paper); z-index: 95;
  transform: translateX(-102%); transition: transform .24s ease-out; overflow-y: auto; padding: 20px;
}
body.drawer-open { overflow: hidden; }
body.drawer-open .drawer { transform: none; }
body.drawer-open .drawer-scrim { opacity: 1; pointer-events: auto; }
.drawer .logo { margin-bottom: 16px; }
.drawer-close { position: absolute; top: 14px; right: 14px; padding: 6px; color: var(--ink-2); }
.drawer h4 { font-size: 13px; color: var(--ink-2); font-weight: 600; margin: 18px 0 6px; }
.drawer a.d-link { display: block; padding: 8px 0; font-weight: 500; border-bottom: 1px solid var(--line); }
.drawer a.d-sub { display: block; padding: 6px 0 6px 12px; font-size: 14px; color: var(--ink-2); }

/* ---------- product card ---------- */
.grid { display: grid; gap: 20px; }
.grid-products { grid-template-columns: repeat(5, 1fr); }
.card {
  background: var(--paper); border: 1px solid var(--line); border-radius: var(--r);
  overflow: hidden; display: flex; flex-direction: column; position: relative;
  transition: border-color .16s ease-out;
}
.card:hover { border-color: var(--ink-2); }
.card .card-media { position: relative; background: var(--bone); aspect-ratio: 1; }
.card .card-media img { width: 100%; height: 100%; object-fit: cover; }
.card .card-badges { position: absolute; top: 10px; left: 10px; display: flex; flex-direction: column; gap: 6px; align-items: flex-start; }
.card .card-body { padding: 14px 16px 16px; display: flex; flex-direction: column; gap: 6px; flex: 1; }
.card .card-brand { font-size: 12px; color: var(--ink-2); font-weight: 500; letter-spacing: .02em; }
.card .card-name {
  font-size: 14.5px; font-weight: 500; line-height: 1.5; min-height: 3em;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.card:hover .card-name { color: var(--spruce); }
.card .card-price { margin-top: auto; display: flex; align-items: baseline; gap: 8px; }
.price { font-weight: 700; font-size: 16px; }
.price-sale { color: var(--sale); }
.price-was { font-size: 13px; color: var(--ink-2); text-decoration: line-through; font-weight: 400; }
.card.is-out .card-media img { opacity: .45; }

/* ---------- forms ---------- */
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; }
.field label { font-weight: 600; font-size: 14px; }
.field .hint { font-size: 13px; color: var(--ink-2); }
.field input, .field select, .field textarea {
  border: 1px solid var(--line); border-radius: var(--r); background: var(--paper);
  padding: 10px 14px; font-size: 15px; width: 100%;
}
.field input:focus, .field select:focus, .field textarea:focus { outline: none; border-color: var(--spruce); }
.field.has-error input, .field.has-error select { border-color: var(--sale); }
.field .error { font-size: 13px; color: var(--sale); }
.radio-row { display: flex; flex-direction: column; gap: 10px; }
.radio-tile {
  display: flex; align-items: flex-start; gap: 10px; border: 1px solid var(--line); border-radius: var(--r);
  padding: 12px 14px; cursor: pointer; background: var(--paper); transition: border-color .16s ease-out;
}
.radio-tile:hover { border-color: var(--ink-2); }
.radio-tile input { accent-color: var(--spruce); margin-top: 4px; }
.radio-tile.checked { border-color: var(--spruce); background: var(--spruce-t); }
.radio-tile .rt-title { font-weight: 600; font-size: 14.5px; }
.radio-tile .rt-sub { font-size: 13px; color: var(--ink-2); }

/* variant pills */
.opt-pills { display: flex; flex-wrap: wrap; gap: 8px; }
.opt-pill {
  border: 1px solid var(--line); border-radius: var(--r); padding: 7px 16px; font-size: 14px; font-weight: 500;
  background: var(--paper); transition: border-color .16s ease-out, background .16s ease-out;
}
.opt-pill:hover { border-color: var(--ink-2); }
.opt-pill.selected { border-color: var(--spruce); background: var(--spruce-t); color: var(--spruce-2); }
.opt-pill:disabled { color: var(--ink-2); background: var(--bone); text-decoration: line-through; cursor: not-allowed; }

/* qty stepper */
.qty { display: inline-flex; align-items: center; border: 1px solid var(--line); border-radius: var(--r); background: var(--paper); }
.qty button { width: 38px; height: 40px; font-size: 18px; color: var(--ink-2); }
.qty button:hover { color: var(--spruce); }
.qty input { width: 44px; text-align: center; border: 0; background: none; font-weight: 600; -moz-appearance: textfield; }
.qty input::-webkit-outer-spin-button, .qty input::-webkit-inner-spin-button { -webkit-appearance: none; }

/* ---------- helpers ---------- */
.toast {
  position: fixed; left: 50%; bottom: 28px; transform: translate(-50%, 8px); z-index: 120;
  background: var(--ink); color: var(--bone); padding: 11px 22px; border-radius: var(--r);
  font-size: 14px; font-weight: 500; opacity: 0; transition: opacity .2s ease-out, transform .2s ease-out;
  box-shadow: var(--shadow); max-width: min(90vw, 420px); text-align: center;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

.skeleton { position: relative; overflow: hidden; background: var(--line); border-radius: var(--r); }
.skeleton::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .55), transparent);
  animation: shimmer 1.4s infinite;
}
@keyframes shimmer { from { transform: translateX(-100%); } to { transform: translateX(100%); } }

.empty { text-align: center; padding: 64px 20px; }
.empty .empty-mark { width: 72px; height: 72px; margin: 0 auto 18px; border-radius: 999px; background: var(--spruce-t); display: flex; align-items: center; justify-content: center; color: var(--spruce); }
.empty h3 { margin-bottom: 6px; }
.empty p { color: var(--ink-2); margin-bottom: 20px; }

.breadcrumb { display: flex; flex-wrap: wrap; gap: 6px; font-size: 13px; color: var(--ink-2); padding: 18px 0 0; }
.breadcrumb a:hover { color: var(--spruce); text-decoration: underline; text-underline-offset: 3px; }
.breadcrumb .sep { color: var(--line); }

.pagination { display: flex; justify-content: center; align-items: center; gap: 6px; padding: 36px 0 8px; }
.page-btn {
  min-width: 38px; height: 38px; padding: 0 10px; border: 1px solid var(--line); border-radius: 10px;
  background: var(--paper); font-weight: 500; font-size: 14px; display: inline-flex; align-items: center; justify-content: center;
}
.page-btn:hover { border-color: var(--spruce); color: var(--spruce); }
.page-btn.current { background: var(--spruce); border-color: var(--spruce); color: #FDFCF9; }
.page-btn:disabled { color: var(--ink-2); background: var(--bone); cursor: not-allowed; }

.progress { height: 8px; border-radius: 999px; background: var(--line); overflow: hidden; }
.progress .bar { height: 100%; border-radius: 999px; background: var(--spruce); transition: width .3s ease-out; }

.tabs { display: inline-flex; gap: 4px; border: 1px solid var(--line); border-radius: 999px; padding: 4px; background: var(--paper); }
.tab { padding: 7px 20px; border-radius: 999px; font-weight: 500; font-size: 14px; color: var(--ink-2); }
.tab.active { background: var(--spruce); color: #FDFCF9; }

.panel { background: var(--paper); border: 1px solid var(--line); border-radius: var(--r); padding: 24px; }

/* reveal on scroll */
.reveal { opacity: 0; transform: translateY(14px); transition: opacity .5s ease-out, transform .5s ease-out; }
.reveal.in { opacity: 1; transform: none; }

/* ---------- footer ---------- */
.foot { background: var(--spruce); color: #D9E5DF; margin-top: 72px; }
.foot a:hover { color: #FFF; text-decoration: underline; text-underline-offset: 3px; }
.foot-grid { display: grid; grid-template-columns: 1.4fr 1fr 1fr 1.3fr; gap: 36px; padding: 52px 0 40px; }
.foot .logo .logo-en { color: #FDFCF9; }
.foot .logo .logo-zh { color: #A9C3B8; }
.foot .foot-blurb { margin-top: 12px; font-size: 13.5px; line-height: 1.8; }
.foot .demo-note { margin-top: 10px; font-size: 12px; color: #A9C3B8; }
.foot h4 { color: #FDFCF9; font-size: 14px; font-weight: 700; margin-bottom: 12px; }
.foot li { margin-bottom: 8px; font-size: 13.5px; }
.foot .foot-contact li { display: flex; gap: 8px; align-items: baseline; }
.foot-bottom { border-top: 1px solid rgba(253, 252, 249, .16); }
.foot-bottom .wrap { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding-top: 16px; padding-bottom: 16px; font-size: 12.5px; color: #A9C3B8; flex-wrap: wrap; }

/* KERN footer signature (from kern-footer-signature-v2 package) */
.kern-credit {
  display: inline-flex; width: 220px; height: 44px; align-items: center; justify-content: center;
  overflow: hidden; vertical-align: middle; border-radius: 2px; text-decoration: none;
}
.kern-credit img { display: block; flex: none; width: 220px; height: auto; max-width: none; filter: brightness(0); }
.kern-credit--on-dark img { filter: brightness(0) invert(1); }
.kern-credit:focus-visible { outline: 2px solid currentColor; outline-offset: 4px; }
.kern-credit--on-dark { color: #f0ede5; }

/* ---------- responsive ---------- */
@media (max-width: 1100px) {
  .grid-products { grid-template-columns: repeat(4, 1fr); }
}
@media (max-width: 900px) {
  .grid-products { grid-template-columns: repeat(3, 1fr); }
  .mainnav { display: none; }
  .menu-toggle { display: inline-flex; padding: 8px; margin-right: 4px; color: var(--ink); }
  .menu-toggle svg { width: 24px; height: 24px; }
  .masthead .wrap { flex-wrap: wrap; gap: 12px; }
  .search { order: 3; flex-basis: 100%; max-width: none; }
  .mast-actions { gap: 14px; }
  .mast-link .lbl { display: none; }
  .foot-grid { grid-template-columns: 1fr 1fr; gap: 28px; padding: 40px 0 28px; }
}
@media (max-width: 640px) {
  body { font-size: 14px; }
  h1 { font-size: 24px; }
  h2 { font-size: 20px; }
  .section { padding: 36px 0; }
  .grid-products { grid-template-columns: repeat(2, 1fr); gap: 12px; }
  .grid { gap: 12px; }
  .card .card-body { padding: 10px 12px 12px; }
  .topbar .tb-right { display: none; }
  .foot-grid { grid-template-columns: 1fr; }
  .foot-bottom .wrap { justify-content: center; text-align: center; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
  .reveal { opacity: 1; transform: none; }
}
