/* ============================================================
 * Cloudrest Home — storefront styles
 * ============================================================ */
:root {
  --bg: #faf8f4;
  --bg-soft: #f2eee6;
  --ink: #22302a;
  --ink-soft: #45524b;
  --muted: #8b918c;
  --line: #e6e0d5;
  --accent: #2f4a3d;
  --accent-soft: #e7eee8;
  --gold: #b08a5a;
  --danger: #b4463c;
  --radius: 14px;
  --shadow-sm: 0 1px 2px rgba(34, 48, 42, .05), 0 4px 14px rgba(34, 48, 42, .05);
  --shadow-md: 0 10px 40px rgba(34, 48, 42, .12);
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, "Songti SC", "Noto Serif SC", serif;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", Inter, Roboto, sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}
body.no-scroll { overflow: hidden; }
img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }
h1, h2, h3 { font-family: var(--serif); font-weight: 500; letter-spacing: .01em; }
.wrap { width: min(1180px, calc(100% - 40px)); margin-inline: auto; }

/* ---------- top bar ---------- */
.topbar {
  background: var(--accent);
  color: #f2efe8;
  font-size: 12.5px;
  letter-spacing: .08em;
  text-align: center;
  padding: 8px 0;
  text-transform: uppercase;
}
.topbar .wrap { display: flex; justify-content: center; }

/* ---------- header ---------- */
.site-head {
  position: sticky;
  top: 0;
  z-index: 40;
  background: rgba(250, 248, 244, .92);
  backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--line);
}
.head-inner {
  display: flex;
  align-items: center;
  gap: 20px;
  height: 74px;
}
.brand { display: flex; align-items: center; gap: 11px; flex: 0 0 auto; }
.brand-mark {
  width: 36px; height: 36px; border-radius: 50%;
  background: var(--accent); color: #fff;
  display: grid; place-items: center;
  font-family: var(--serif); font-size: 19px; line-height: 1;
}
.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-text strong { font-family: var(--serif); font-size: 19px; font-weight: 500; }
.brand-text small { font-size: 9.5px; letter-spacing: .22em; color: var(--muted); }
.nav { display: flex; gap: 26px; margin-inline-start: 26px; font-size: 14px; }
.nav a { color: var(--ink-soft); position: relative; padding: 6px 0; }
.nav a:hover { color: var(--accent); }
.nav a::after {
  content: ""; position: absolute; left: 0; bottom: 0; height: 1px; width: 0;
  background: var(--accent); transition: width .25s;
}
.nav a:hover::after { width: 100%; }
.actions { margin-inline-start: auto; display: flex; align-items: center; gap: 10px; }
.mini-select {
  appearance: none;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink-soft);
  border-radius: 8px;
  padding: 6px 10px;
  font-size: 12.5px;
  max-width: 118px;
}
.mini-select:focus { outline: 2px solid var(--accent-soft); }
.cart-btn {
  display: inline-flex; align-items: center; gap: 7px;
  border: 1px solid var(--accent); background: var(--accent); color: #fff;
  border-radius: 9px; padding: 8px 13px; font-size: 13px;
}
.cart-btn span {
  background: rgba(255, 255, 255, .22); border-radius: 20px;
  min-width: 19px; padding: 0 5px; font-size: 11.5px; text-align: center;
}

/* ---------- hero ---------- */
.hero { position: relative; min-height: 520px; display: flex; align-items: center; overflow: hidden; }
.hero-media { position: absolute; inset: 0; }
.hero-media img { width: 100%; height: 100%; object-fit: cover; }
.hero-veil {
  position: absolute; inset: 0;
  background: linear-gradient(90deg, rgba(28, 38, 32, .72) 0%, rgba(28, 38, 32, .42) 45%, rgba(28, 38, 32, .08) 100%);
}
.hero-inner { position: relative; z-index: 2; color: #f7f4ee; padding-block: 80px; max-width: 700px; }
.hero-kicker { font-size: 11.5px; letter-spacing: .3em; text-transform: uppercase; color: #d9d2c4; margin: 0 0 14px; }
.hero h1 { font-size: clamp(30px, 4.6vw, 54px); line-height: 1.18; margin: 0 0 16px; font-weight: 400; }
.hero-sub { max-width: 480px; color: #e2ddd2; margin: 0 0 28px; font-size: 15.5px; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border-radius: 10px; padding: 11px 22px; font-size: 14px; border: 1px solid transparent;
  transition: transform .15s, background .2s, color .2s, border-color .2s;
  background: #fff; color: var(--ink);
}
.btn:hover { transform: translateY(-1px); }
.btn.primary { background: var(--accent); color: #fff; }
.btn.primary:hover { background: #264036; }
.btn.ghost { background: transparent; border-color: currentColor; color: #f4f1ea; }
.btn.ghost:hover { background: rgba(255, 255, 255, .12); }
.btn:disabled { opacity: .55; cursor: not-allowed; transform: none; }
.btn.block { width: 100%; }

/* ---------- trust ---------- */
.trust { border-bottom: 1px solid var(--line); background: #fff; }
.trust-inner { display: flex; flex-wrap: wrap; gap: 30px; justify-content: center; padding: 16px 0; }
.trust-item { display: flex; align-items: center; gap: 9px; font-size: 13px; color: var(--ink-soft); }
.dot { width: 6px; height: 6px; border-radius: 50%; background: var(--gold); }

/* ---------- sections ---------- */
.section { padding-block: 62px; }
.section-head { margin-bottom: 30px; }
.section-head h2 { font-size: 30px; margin: 0 0 6px; }
.section-sub { color: var(--muted); margin: 0; font-size: 14px; }
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(255px, 1fr));
  gap: 26px 22px;
}
.loading { color: var(--muted); padding: 40px 0; grid-column: 1 / -1; text-align: center; letter-spacing: .3em; }

/* ---------- product card ---------- */
.card {
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius);
  overflow: hidden; display: flex; flex-direction: column;
  transition: box-shadow .25s, transform .25s;
}
.card:hover { box-shadow: var(--shadow-md); transform: translateY(-3px); }
.card-media { position: relative; aspect-ratio: 1 / 1; background: var(--bg-soft); overflow: hidden; cursor: pointer; }
.card-media img { width: 100%; height: 100%; object-fit: cover; transition: transform .6s ease; }
.card:hover .card-media img { transform: scale(1.04); }
.card-tag {
  position: absolute; inset-block-start: 12px; inset-inline-start: 12px;
  background: rgba(255, 255, 255, .93); color: var(--accent);
  font-size: 11px; letter-spacing: .08em; padding: 4px 9px; border-radius: 20px;
}
.card-tag.sold { background: rgba(34, 48, 42, .85); color: #fff; }
.card-body { padding: 15px 16px 17px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.card-title { font-size: 15px; line-height: 1.45; margin: 0; font-weight: 500; min-height: 43px; }
.card-price { display: flex; align-items: baseline; gap: 8px; margin-top: auto; }
.price-now { font-family: var(--serif); font-size: 20px; color: var(--ink); }
.price-was { font-size: 13px; color: var(--muted); text-decoration: line-through; }
.card-actions { display: flex; gap: 8px; margin-top: 6px; }
.card-actions .btn { flex: 1; padding: 9px 10px; font-size: 13px; border-radius: 9px; }
.btn.outline { background: transparent; border-color: var(--line); color: var(--ink-soft); }
.btn.outline:hover { border-color: var(--accent); color: var(--accent); }

/* ---------- contact band ---------- */
.contact-band { background: var(--bg-soft); border-top: 1px solid var(--line); padding-block: 52px; }
.contact-inner { display: flex; flex-wrap: wrap; gap: 24px; justify-content: space-between; align-items: center; }
.contact-inner h2 { font-size: 26px; margin: 0 0 8px; }
.contact-note { color: var(--ink-soft); margin: 0; max-width: 520px; font-size: 14px; }
.contact-links { display: flex; flex-wrap: wrap; gap: 12px; }
.contact-chip {
  display: inline-flex; align-items: center; gap: 8px;
  background: #fff; border: 1px solid var(--line); border-radius: 999px;
  padding: 9px 16px; font-size: 13.5px; color: var(--ink-soft);
}
.contact-chip:hover { border-color: var(--accent); color: var(--accent); }

/* ---------- footer ---------- */
.site-foot { border-top: 1px solid var(--line); padding: 22px 0; font-size: 12.5px; color: var(--muted); }
.foot-inner { display: flex; justify-content: space-between; gap: 14px; flex-wrap: wrap; }
.foot-admin a:hover { color: var(--accent); }

/* ---------- modal / drawer ---------- */
.modal, .drawer { position: fixed; inset: 0; z-index: 60; display: flex; }
.modal[hidden], .drawer[hidden] { display: none; }
.modal-backdrop, .drawer-backdrop { position: absolute; inset: 0; background: rgba(26, 34, 29, .45); backdrop-filter: blur(2px); }
.modal-panel {
  position: relative; margin: auto; background: #fff; border-radius: 18px;
  width: min(980px, calc(100% - 32px)); max-height: calc(100vh - 60px);
  overflow: auto; box-shadow: var(--shadow-md);
  animation: pop .22s ease-out;
}
@keyframes pop { from { opacity: 0; transform: translateY(12px) scale(.99); } }
.modal-close {
  position: absolute; inset-block-start: 12px; inset-inline-end: 12px; z-index: 3;
  width: 34px; height: 34px; border-radius: 50%; border: 1px solid var(--line);
  background: rgba(255, 255, 255, .9); font-size: 20px; line-height: 1; color: var(--ink-soft);
}
.modal-close:hover { background: #fff; color: var(--ink); }
.product-body { display: grid; grid-template-columns: 1.05fr 1fr; }
.pd-gallery { background: var(--bg-soft); padding: 18px; }
.pd-main { aspect-ratio: 1 / 1; border-radius: 12px; overflow: hidden; background: #fff; }
.pd-main img { width: 100%; height: 100%; object-fit: cover; }
.pd-thumbs { display: flex; gap: 9px; margin-top: 12px; flex-wrap: wrap; }
.pd-thumbs button { width: 62px; height: 62px; border-radius: 8px; overflow: hidden; border: 1px solid transparent; padding: 0; background: #fff; }
.pd-thumbs button.on { border-color: var(--accent); }
.pd-thumbs img { width: 100%; height: 100%; object-fit: cover; }
.pd-info { padding: 30px 32px 34px; display: flex; flex-direction: column; gap: 14px; }
.pd-title { font-size: 25px; margin: 0; line-height: 1.3; }
.pd-price { display: flex; align-items: baseline; gap: 10px; }
.pd-price .price-now { font-size: 26px; }
.pd-desc { color: var(--ink-soft); font-size: 14px; margin: 0; white-space: pre-line; }
.pd-spec { display: flex; gap: 8px; font-size: 12.5px; color: var(--muted); flex-wrap: wrap; }
.pd-spec b { color: var(--ink-soft); font-weight: 500; }
.opt-label { font-size: 12.5px; color: var(--muted); letter-spacing: .04em; margin-bottom: 7px; }
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip {
  border: 1px solid var(--line); background: #fff; color: var(--ink-soft);
  border-radius: 8px; padding: 7px 13px; font-size: 13px;
}
.chip.on { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }
.qty { display: inline-flex; align-items: center; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.qty button { width: 34px; height: 36px; border: 0; background: #fff; font-size: 17px; color: var(--ink-soft); }
.qty button:hover { background: var(--bg-soft); }
.qty input { width: 46px; height: 36px; border: 0; text-align: center; font-size: 14px; }

/* ---------- cart ---------- */
.drawer { justify-content: flex-end; }
.drawer-panel {
  position: relative; width: min(420px, 100%); background: #fff;
  height: 100%; display: flex; flex-direction: column; box-shadow: var(--shadow-md);
  animation: slide .24s ease-out;
}
@keyframes slide { from { transform: translateX(24px); opacity: .6; } }
.drawer-head { display: flex; align-items: center; justify-content: space-between; padding: 20px 22px; border-bottom: 1px solid var(--line); }
.drawer-head h3 { margin: 0; font-size: 19px; }
.drawer-head .modal-close { position: static; }
.drawer-body { flex: 1; overflow: auto; padding: 16px 22px; display: flex; flex-direction: column; gap: 16px; }
.drawer-foot { border-top: 1px solid var(--line); padding: 18px 22px 22px; }
.cart-line { display: flex; gap: 12px; }
.cl-img { width: 74px; height: 74px; border-radius: 9px; overflow: hidden; background: var(--bg-soft); flex: 0 0 auto; }
.cl-img img { width: 100%; height: 100%; object-fit: cover; }
.cl-main { flex: 1; min-width: 0; }
.cl-title { font-size: 13.5px; margin: 0 0 3px; line-height: 1.4; }
.cl-meta { font-size: 12px; color: var(--muted); margin: 0 0 7px; }
.cl-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.cl-qty { display: inline-flex; align-items: center; border: 1px solid var(--line); border-radius: 7px; }
.cl-qty button { width: 26px; height: 26px; border: 0; background: #fff; color: var(--ink-soft); }
.cl-qty span { width: 26px; text-align: center; font-size: 12.5px; }
.cl-price { font-size: 14px; font-family: var(--serif); }
.cl-del { border: 0; background: none; color: var(--muted); font-size: 12px; text-decoration: underline; padding: 0; }
.cart-total { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 14px; font-size: 14px; }
.cart-total b { font-family: var(--serif); font-size: 22px; font-weight: 500; }
.empty { color: var(--muted); text-align: center; padding: 60px 0; font-size: 14px; }

/* ---------- checkout ---------- */
.checkout-panel { width: min(760px, calc(100% - 32px)); }
#checkoutBody { padding: 28px 30px 32px; }
.co-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 18px; }
.co-head h3 { margin: 0; font-size: 22px; }
.co-lines { border: 1px solid var(--line); border-radius: 12px; overflow: hidden; margin-bottom: 22px; }
.co-line { display: flex; gap: 10px; align-items: center; padding: 11px 14px; font-size: 13px; border-bottom: 1px solid var(--line); }
.co-line:last-child { border-bottom: 0; background: var(--bg-soft); }
.co-line .grow { flex: 1; min-width: 0; }
.co-line small { color: var(--muted); display: block; font-size: 11.5px; }
.co-form { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 16px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field.full { grid-column: 1 / -1; }
.field label { font-size: 12.5px; color: var(--muted); }
.field input, .field select, .field textarea {
  border: 1px solid var(--line); border-radius: 9px; padding: 10px 12px;
  font-size: 14px; font-family: inherit; color: var(--ink); background: #fff;
}
.field input:focus, .field select:focus, .field textarea:focus { outline: 2px solid var(--accent-soft); border-color: var(--accent); }
.field textarea { min-height: 74px; resize: vertical; }
.co-actions { grid-column: 1 / -1; display: flex; gap: 10px; align-items: center; margin-top: 4px; }
.co-err { color: var(--danger); font-size: 13px; margin: 0; }
.success { text-align: center; padding: 14px 4px 6px; }
.success .big { font-size: 40px; }
.success h3 { font-size: 23px; margin: 8px 0 6px; }
.success .order-no { display: inline-block; background: var(--bg-soft); border-radius: 8px; padding: 6px 14px; font-size: 14px; margin-bottom: 16px; letter-spacing: .06em; }
.wa-btn { background: #25d366; color: #07543a; font-weight: 600; }
.wa-btn:hover { background: #1fbe5b; }
.success .hint { color: var(--ink-soft); font-size: 14px; max-width: 430px; margin: 0 auto 18px; }
.success .wx { color: var(--ink-soft); font-size: 14px; }
.success .wx b { color: var(--ink); letter-spacing: .04em; }

/* ---------- toast ---------- */
.toast {
  position: fixed; inset-block-end: 26px; inset-inline-start: 50%; transform: translate(-50%, 20px);
  background: var(--ink); color: #fff; padding: 10px 20px; border-radius: 999px;
  font-size: 13.5px; opacity: 0; pointer-events: none; transition: all .25s; z-index: 90;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- responsive ---------- */
@media (max-width: 860px) {
  .nav { display: none; }
  .hero { min-height: 430px; }
  .hero-inner { padding-block: 56px; }
  .product-body { grid-template-columns: 1fr; }
  .pd-info { padding: 22px 20px 26px; }
  .co-form { grid-template-columns: 1fr; }
  .head-inner { height: 66px; gap: 10px; }
  .brand-text small { display: none; }
  .mini-select { max-width: 92px; padding: 6px 7px; font-size: 11.5px; }
  .section { padding-block: 42px; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 16px 12px; }
  .card-title { font-size: 13.5px; min-height: 39px; }
  .price-now { font-size: 17px; }
  .card-actions .btn { font-size: 12px; padding: 8px 6px; }
  .trust-inner { gap: 14px; font-size: 12px; }
}
[dir="rtl"] .nav a::after { left: auto; right: 0; }
[dir="rtl"] .hero-veil { background: linear-gradient(270deg, rgba(28,38,32,.72), rgba(28,38,32,.08)); }
