/* ==========================================================================
   Duck Closet — shared base styles
   Layout unit: 1rem = 10 "design px" of the 1024px-wide mockup.
   On desktop the whole page scales with the viewport (capped at 1440px),
   so every section keeps the exact proportions of the design.
   ========================================================================== */

@font-face { font-family: "MD Inter"; src: url("../fonts/inter-var.woff") format("woff"); font-weight: 100 900; font-display: swap; }
@font-face { font-family: "MD Hand"; src: url("../fonts/kalam-light.woff") format("woff"); font-weight: 300; font-display: swap; }
@font-face { font-family: "MD Hand"; src: url("../fonts/kalam-regular.woff") format("woff"); font-weight: 400; font-display: swap; }
@font-face { font-family: "MD Hand CN"; src: url("../fonts/longcang-sub.woff") format("woff"); font-display: swap; }
@font-face { font-family: "MD Sans SC"; src: url("../fonts/notosanssc-400.woff") format("woff"); font-weight: 400; font-display: swap; }
@font-face { font-family: "MD Sans SC"; src: url("../fonts/notosanssc-500.woff") format("woff"); font-weight: 500; font-display: swap; }
@font-face { font-family: "MD Sans SC"; src: url("../fonts/notosanssc-700.woff") format("woff"); font-weight: 700; font-display: swap; }
@font-face { font-family: "MD Sans SC"; src: url("../fonts/notosanssc-900.woff") format("woff"); font-weight: 900; font-display: swap; }

:root {
  --ink: #111114;
  --ink-2: #2a2a2f;
  --muted: #76767c;
  --muted-2: #9a9aa0;
  --line: #e7e7eb;
  --bg: #f7f7f8;
  --card: #f2f2f4;
  --orange: #f08a24;
  --duck: #ffc928;
  --sans: "MD Inter", -apple-system, BlinkMacSystemFont, "Helvetica Neue", Arial, "MD Sans SC", "PingFang SC", "Microsoft YaHei", sans-serif;
  --sans-cn: "MD Inter", -apple-system, BlinkMacSystemFont, "MD Sans SC", "PingFang SC", "Microsoft YaHei", sans-serif;
  --hand: "MD Hand", "MD Hand CN", "Bradley Hand", "Segoe Print", cursive;
  --hand-cn: "MD Hand CN", "MD Hand", "Kaiti SC", "STKaiti", cursive;
}

html { font-size: calc(100vw / 102.4); -webkit-text-size-adjust: 100%; }
@media (min-width: 1440px) { html { font-size: 14.0625px; } }
@media (max-width: 900px) { html { font-size: 10px; } }

*, *::before, *::after { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}
img { display: block; max-width: 100%; }
main { overflow-x: clip; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
h1, h2, h3, h4, p { margin: 0; }

/* width of the design canvas, centred on very wide screens */
.frame { position: relative; width: 100%; max-width: 102.4rem; margin: 0 auto; }

.hand { font-family: var(--hand); font-weight: 300; }
.hand-cn { font-family: var(--hand-cn); font-weight: 400; }

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

/* content is always visible at rest; sections get a gentle lift on hover only */

/* ---------------------------------------------------------------- utility bar */
.utility {
  position: fixed; top: calc(1.6rem + env(safe-area-inset-top, 0px)); right: 1.8rem; z-index: 60;
  display: flex; align-items: center; gap: .4rem;
  padding: .4rem; border-radius: 99rem;
  background: rgba(255, 255, 255, .72);
  -webkit-backdrop-filter: saturate(1.6) blur(14px); backdrop-filter: saturate(1.6) blur(14px);
  box-shadow: 0 .2rem 1.2rem rgba(20, 20, 30, .08), inset 0 0 0 1px rgba(255, 255, 255, .6);
  font-family: var(--sans-cn);
}
.utility a, .utility button {
  height: 2.8rem; min-width: 2.8rem; padding: 0 1rem; border-radius: 99rem;
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  font-size: 1.15rem; font-weight: 600; color: var(--ink-2); transition: background .2s;
}
.utility a:hover, .utility button:hover { background: rgba(0, 0, 0, .06); }
.utility .is-current { background: var(--ink); color: #fff; }
.utility .is-current:hover { background: var(--ink); }
.utility .sep { width: 1px; height: 1.4rem; background: rgba(0, 0, 0, .12); margin: 0 .2rem; }
.utility svg { width: 1.6rem; height: 1.6rem; }
.cart-count {
  min-width: 1.7rem; height: 1.7rem; padding: 0 .45rem; border-radius: 99rem;
  background: var(--orange); color: #fff; font-size: 1rem; line-height: 1.7rem; text-align: center;
}
.cart-count[data-n="0"] { display: none; }
@media (max-width: 900px) {
  .utility { top: calc(1.2rem + env(safe-area-inset-top, 0px)); right: 1.2rem; }
  .utility a, .utility button { font-size: 1.3rem; height: 3.2rem; min-width: 3.2rem; }
  .utility svg { width: 1.8rem; height: 1.8rem; }
}

/* ---------------------------------------------------------------- cart drawer */
.drawer-scrim {
  position: fixed; inset: 0; z-index: 80; background: rgba(15, 15, 20, .32);
  opacity: 0; pointer-events: none; transition: opacity .3s;
}
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; z-index: 90;
  width: min(42rem, 100vw); background: #fff; display: flex; flex-direction: column;
  transform: translateX(102%); visibility: hidden;
  transition: transform .38s cubic-bezier(.2, .8, .2, 1), visibility 0s linear .38s, box-shadow .38s;
  font-family: var(--sans-cn);
}
.cart-open .drawer { transform: none; visibility: visible; transition: transform .38s cubic-bezier(.2, .8, .2, 1), visibility 0s, box-shadow .38s; box-shadow: -1rem 0 4rem rgba(0, 0, 0, .12); }
.cart-open .drawer-scrim { opacity: 1; pointer-events: auto; }
.drawer-head { display: flex; align-items: center; justify-content: space-between; padding: 2.2rem 2.4rem 1.6rem; border-bottom: 1px solid var(--line); }
.drawer-head h2 { font-size: 2rem; font-weight: 700; letter-spacing: -.01em; }
.icon-btn { width: 3.2rem; height: 3.2rem; border-radius: 50%; display: grid; place-items: center; background: #f1f1f3; transition: background .2s; }
.icon-btn:hover { background: #e6e6ea; }
.icon-btn svg { width: 1.6rem; height: 1.6rem; }
.drawer-body { flex: 1; overflow-y: auto; padding: .8rem 2.4rem; }
.drawer-empty { padding: 6rem 0; text-align: center; color: var(--muted); font-size: 1.4rem; }
.drawer-empty .hand { display: block; font-size: 2rem; color: var(--ink-2); margin-bottom: .6rem; }
.line-item { display: grid; grid-template-columns: 7.2rem 1fr auto; gap: 1.4rem; align-items: center; padding: 1.4rem 0; border-bottom: 1px solid var(--line); }
.line-item img { width: 7.2rem; height: 7.2rem; border-radius: 1rem; object-fit: cover; background: var(--card); }
.line-item h4 { font-size: 1.4rem; font-weight: 600; line-height: 1.3; }
.line-item .li-price { font-size: 1.25rem; color: var(--muted); margin-top: .3rem; }
.qty { display: inline-flex; align-items: center; margin-top: .8rem; border: 1px solid var(--line); border-radius: 99rem; height: 2.8rem; }
.qty button { width: 2.8rem; height: 2.8rem; font-size: 1.5rem; line-height: 1; color: var(--ink-2); }
.qty span { min-width: 2.2rem; text-align: center; font-size: 1.3rem; font-weight: 600; }
.li-remove { font-size: 1.15rem; color: var(--muted); text-decoration: underline; text-underline-offset: 2px; align-self: start; margin-top: .4rem; }
.drawer-foot { padding: 1.8rem 2.4rem 2.4rem; border-top: 1px solid var(--line); }
.drawer-foot .row { display: flex; justify-content: space-between; font-size: 1.4rem; margin-bottom: .6rem; color: var(--muted); }
.drawer-foot .row.total { color: var(--ink); font-weight: 700; font-size: 1.7rem; margin: 1rem 0 1.6rem; }
.btn-block {
  width: 100%; height: 4.8rem; border-radius: 99rem; background: var(--ink); color: #fff;
  font-size: 1.5rem; font-weight: 600; display: inline-flex; align-items: center; justify-content: center; gap: .8rem;
  transition: transform .15s, background .2s;
}
.btn-block:hover { background: #000; }
.btn-block:active { transform: scale(.98); }
.btn-block[disabled] { opacity: .35; pointer-events: none; }

/* ---------------------------------------------------------------- checkout modal */
.modal { position: fixed; inset: 0; z-index: 100; display: none; place-items: center; padding: 2rem; background: rgba(15, 15, 20, .4); font-family: var(--sans-cn); }
.modal.is-open { display: grid; }
.modal-card { width: min(48rem, 100%); max-height: 92vh; overflow-y: auto; background: #fff; border-radius: 2rem; padding: 2.8rem; box-shadow: 0 2rem 6rem rgba(0, 0, 0, .2); }
.modal-card h2 { font-size: 2.2rem; font-weight: 700; margin-bottom: .4rem; }
.modal-card .muted { color: var(--muted); font-size: 1.3rem; margin-bottom: 2rem; }
.field { display: block; margin-bottom: 1.2rem; }
.field span { display: block; font-size: 1.2rem; font-weight: 600; margin-bottom: .5rem; color: var(--ink-2); }
.field input, .field textarea {
  width: 100%; border: 1px solid #dcdce2; border-radius: 1.2rem; padding: 1.1rem 1.3rem;
  font: inherit; font-size: 1.4rem; background: #fafafb; outline: none; transition: border-color .2s, box-shadow .2s;
}
.field input:focus, .field textarea:focus { border-color: var(--ink); box-shadow: 0 0 0 3px rgba(0, 0, 0, .06); background: #fff; }
.modal-actions { display: flex; gap: 1rem; margin-top: 2rem; }
.btn-ghost { flex: 0 0 auto; height: 4.8rem; padding: 0 2.2rem; border-radius: 99rem; background: #f1f1f3; font-size: 1.4rem; font-weight: 600; }
.done-mark { width: 5.6rem; height: 5.6rem; border-radius: 50%; background: var(--duck); display: grid; place-items: center; margin-bottom: 1.6rem; }
.done-mark svg { width: 2.6rem; height: 2.6rem; }

/* ---------------------------------------------------------------- toast */
.toast {
  position: fixed; left: 50%; bottom: 3rem; z-index: 110; transform: translate(-50%, 2rem);
  background: var(--ink); color: #fff; border-radius: 99rem; padding: 1.1rem 2rem;
  font-size: 1.3rem; font-weight: 600; font-family: var(--sans-cn);
  opacity: 0; pointer-events: none; transition: opacity .25s, transform .25s; white-space: nowrap;
}
.toast.is-on { opacity: 1; transform: translate(-50%, 0); }
