/* Shared foundation for all three mockups. Each demo sets the tokens below in its own stylesheet.
   z-index scale: header 40, overlays 80, toast 90, mockup switcher 95, skip link 100. */

:root {
  --bg: #f2ede5;
  --bg-2: #e8e0d4;
  --surface: #f7f3ed;
  --fg: #221d18;
  --muted: #6e6257;
  --line: rgb(34 29 24 / 0.14);
  --accent: #6b4a33;
  --accent-fg: #f7f3ed;
  --scrim: rgb(20 16 12 / 0.42);
  --font-display: system-ui, sans-serif;
  --font-text: system-ui, sans-serif;
  --r: 0px;
  --r-btn: 999px;
  --r-panel: 14px;
  --r-sm: 8px;
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-in-out: cubic-bezier(0.65, 0, 0.35, 1);
  --pad: clamp(1.25rem, 4vw, 3.5rem);
  --max: 1440px;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-text);
  font-size: 1rem;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  font-kerning: normal;
}
img, svg, video { display: block; max-width: 100%; }
img { height: auto; background-color: var(--ph, transparent); }
img[style*="--ph"] { background-color: var(--ph); }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; }
a { color: inherit; text-decoration: none; }
h1, h2, h3, h4, p, ul, ol, figure, blockquote { margin: 0; }
ul, ol { padding: 0; list-style: none; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 2px; }
::selection { background: var(--accent); color: var(--accent-fg); }

.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.skip { position: fixed; left: 1rem; top: -4rem; z-index: 100; background: var(--fg); color: var(--bg); padding: 0.6rem 1rem; border-radius: 8px; transition: top 0.2s; }
.skip:focus { top: 1rem; }
.wrap { width: min(100% - var(--pad) * 2, var(--max)); margin-inline: auto; }
@media (max-width: 767px) { .hide-sm { display: none !important; } }

/* Icons */
.ph, .ph-light, .ph-fill { font-size: 1.25em; line-height: 1; }

/* Buttons */
.btn {
  --h: 3.1rem;
  display: inline-flex; align-items: center; justify-content: center; gap: 0.6em;
  height: var(--h); padding: 0 1.6rem; white-space: nowrap;
  border-radius: var(--r-btn); font-weight: 500; font-size: 0.95rem; letter-spacing: 0.005em;
  transition: transform 0.25s var(--ease), background-color 0.25s, color 0.25s, border-color 0.25s, box-shadow 0.25s;
}
.btn:active { transform: scale(0.98) translateY(1px); }
.btn-primary { background: var(--accent); color: var(--accent-fg); }
.btn-primary:hover { background: color-mix(in oklab, var(--accent), var(--fg) 18%); }
.btn-ghost { border: 1px solid color-mix(in oklab, var(--fg), transparent 70%); color: var(--fg); }
.btn-ghost:hover { border-color: var(--fg); }
.btn-block { width: 100%; }
.btn .ph { font-size: 1.1em; transition: transform 0.3s var(--ease); }
.btn:hover .ph-arrow-right, .btn:hover .ph-arrow-up-right { transform: translateX(3px); }

.icon-btn {
  position: relative; display: inline-grid; place-items: center;
  width: 2.75rem; height: 2.75rem; border-radius: 999px; color: inherit;
  transition: background-color 0.2s, transform 0.2s var(--ease);
}
.icon-btn:hover { background: color-mix(in oklab, currentColor, transparent 92%); }
.icon-btn:active { transform: scale(0.94); }
.icon-btn .ph, .icon-btn .ph-light { font-size: 1.35rem; }
.badge {
  position: absolute; top: 0.3rem; right: 0.15rem; min-width: 1.15rem; height: 1.15rem; padding: 0 0.3rem;
  display: grid; place-items: center; border-radius: 999px;
  background: var(--accent); color: var(--accent-fg); font-size: 0.68rem; font-weight: 600; line-height: 1;
  font-variant-numeric: tabular-nums;
}
.badge.bump { animation: bump 0.5s var(--ease); }
@keyframes bump { 30% { transform: scale(1.45); } }
.hd-actions { display: flex; align-items: center; gap: 0.15rem; }

/* Wishlist heart */
.wish {
  display: grid; place-items: center; width: 2.5rem; height: 2.5rem; border-radius: 999px;
  color: var(--fg); transition: transform 0.25s var(--ease), background-color 0.2s;
}
.wish:hover { transform: scale(1.08); }
.wish[aria-pressed="true"] { color: var(--accent); }
.wish.pop i { animation: pop 0.45s var(--ease); }
@keyframes pop { 40% { transform: scale(1.35); } }

/* Chips */
.chips { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.chip {
  height: 2.25rem; padding: 0 1rem; border-radius: 999px; border: 1px solid var(--line);
  font-size: 0.875rem; transition: background-color 0.2s, border-color 0.2s, color 0.2s;
}
.chip:hover { border-color: var(--fg); }
.chip[aria-pressed="true"] { background: var(--fg); border-color: var(--fg); color: var(--bg); }

/* Payment / shipping marks */
.marks { display: flex; flex-wrap: wrap; align-items: center; gap: 0.6rem 1.25rem; }
.mark { height: 1.15rem; width: auto; flex: none; opacity: 0.8; }
.mark-vipps { height: 1.05rem; }
.mark-klarna, .mark-americanexpress { height: 1.3rem; }
.mark-posten, .mark-bring { height: 1.25rem; }
.mark-postnord { height: 0.95rem; }

/* ---------- Overlays ---------- */
.ov { position: fixed; inset: 0; z-index: 80; }
.ov[hidden] { display: none; }
.ov-scrim { position: absolute; inset: 0; background: var(--scrim); opacity: 0; transition: opacity 0.4s var(--ease); }
.ov.is-open .ov-scrim { opacity: 1; }
body.is-locked { overflow: hidden; }

.drawer {
  position: absolute; top: 0; right: 0; bottom: 0; width: min(100%, 27rem);
  display: flex; flex-direction: column; background: var(--surface); color: var(--fg);
  transform: translateX(100%); transition: transform 0.55s var(--ease);
  box-shadow: -30px 0 80px rgb(0 0 0 / 0.12);
}
.ov.is-open .drawer { transform: none; }
.drawer-h { display: flex; align-items: center; justify-content: space-between; padding: 1.1rem 1.25rem 0.75rem 1.5rem; }
.drawer-h h2 { font-family: var(--font-display); font-size: 1.35rem; font-weight: 500; }
.drawer-count { color: var(--muted); font-weight: 400; }
.ship { padding: 0 1.5rem 1rem; border-bottom: 1px solid var(--line); }
.ship-text { font-size: 0.875rem; margin-bottom: 0.6rem; }
.ship-text strong { font-weight: 600; }
.ship-line { height: 2px; position: relative; overflow: hidden; }
.ship-line span { position: absolute; inset: 0; background: var(--accent); transform-origin: left; transform: scaleX(var(--p, 0)); transition: transform 0.7s var(--ease); }
.drawer-body { flex: 1; overflow-y: auto; padding: 0.5rem 1.5rem 1.5rem; overscroll-behavior: contain; }
.cart-lines li {
  display: grid; grid-template-columns: 4.75rem 1fr auto; gap: 1rem; align-items: center;
  padding: 1rem 0; border-bottom: 1px solid var(--line);
  animation: line-in 0.5s var(--ease) both;
}
@keyframes line-in { from { opacity: 0; transform: translateY(8px); } }
.cart-lines img { width: 4.75rem; height: 4.75rem; object-fit: cover; border-radius: calc(var(--r) * 0.6); }
.cart-lines .nm { font-size: 0.925rem; font-weight: 500; line-height: 1.3; }
.cart-lines .mt { font-size: 0.8rem; color: var(--muted); margin-top: 0.15rem; }
.cart-lines .pr { font-size: 0.925rem; font-variant-numeric: tabular-nums; text-align: right; }
.qty { display: inline-flex; align-items: center; margin-top: 0.5rem; border: 1px solid var(--line); border-radius: var(--r-btn); height: 2rem; }
.qty button { width: 2rem; height: 2rem; display: grid; place-items: center; border-radius: var(--r-btn); }
.qty button:hover { background: color-mix(in oklab, var(--fg), transparent 93%); }
.qty span { min-width: 1.5rem; text-align: center; font-size: 0.85rem; font-variant-numeric: tabular-nums; }
.line-rm { font-size: 0.75rem; color: var(--muted); text-decoration: underline; text-underline-offset: 3px; margin-top: 0.4rem; display: block; margin-left: auto; }
.cart-empty { display: grid; justify-items: center; text-align: center; gap: 0.6rem; padding: 3.5rem 1rem 2rem; color: var(--muted); }
.cart-empty .ph-light { font-size: 3rem; color: var(--fg); opacity: 0.6; }
.cart-empty-title { font-family: var(--font-display); font-size: 1.25rem; color: var(--fg); }
.cart-empty .btn { margin-top: 0.75rem; }
.upsell { margin-top: 1.5rem; }
.upsell-label { font-size: 0.8rem; color: var(--muted); margin-bottom: 0.6rem; }
.upsell-card { display: grid; grid-template-columns: 3.75rem 1fr auto; gap: 0.9rem; align-items: center; padding: 0.75rem; border-radius: var(--r-sm); background: color-mix(in oklab, var(--fg), transparent 95%); }
.upsell-card img { width: 3.75rem; height: 3.75rem; object-fit: cover; border-radius: calc(var(--r) * 0.5); }
.upsell-card .nm { font-size: 0.875rem; line-height: 1.3; }
.upsell-card .pr { font-size: 0.8rem; color: var(--muted); }
.upsell-card .icon-btn { border: 1px solid var(--line); width: 2.25rem; height: 2.25rem; }
.drawer-f { padding: 1.25rem 1.5rem calc(1.25rem + env(safe-area-inset-bottom)); border-top: 1px solid var(--line); display: grid; gap: 0.6rem; }
.drawer-f[hidden] { display: none; }
.sum { display: flex; justify-content: space-between; align-items: baseline; font-size: 1.05rem; }
.sum strong { font-weight: 600; font-variant-numeric: tabular-nums; }
.fine { font-size: 0.8rem; color: var(--muted); margin-bottom: 0.4rem; }
.btn-express { border: 1px solid var(--line); color: var(--fg); }
.btn-express:hover { border-color: var(--fg); }
.btn-express .mark { height: 0.95rem; opacity: 1; }
.drawer-pay { display: flex; justify-content: center; gap: 1rem; padding-top: 0.5rem; color: var(--muted); }
.drawer-pay .mark { height: 0.85rem; }

/* Search */
.search {
  position: absolute; left: 50%; top: clamp(0.75rem, 8vh, 6rem); width: min(100% - 1.5rem, 46rem);
  max-height: min(80vh, 44rem); display: flex; flex-direction: column;
  background: var(--surface); color: var(--fg); border-radius: var(--r-panel);
  box-shadow: 0 40px 100px rgb(0 0 0 / 0.22);
  transform: translate(-50%, -12px) scale(0.98); opacity: 0;
  transition: transform 0.5s var(--ease), opacity 0.3s;
}
.ov.is-open .search { transform: translate(-50%, 0); opacity: 1; }
.search-form { display: flex; align-items: center; gap: 0.75rem; padding: 0 0.75rem 0 1.4rem; height: 4.25rem; border-bottom: 1px solid var(--line); }
.search-form > .ph { font-size: 1.4rem; color: var(--muted); }
.search-form input { flex: 1; height: 100%; border: 0; background: none; font-size: 1.15rem; outline: none; }
.search-form input::placeholder { color: var(--muted); opacity: 1; }
.search-form input::-webkit-search-cancel-button { display: none; }
.search-close { font-size: 0.85rem; color: var(--muted); padding: 0.5rem 0.75rem; border-radius: 999px; }
.search-close:hover { color: var(--fg); }
.search-body { overflow-y: auto; padding: 1.25rem 1.4rem 1.5rem; }
.search-label { font-size: 0.8rem; color: var(--muted); margin-bottom: 0.7rem; }
.search-results { display: grid; gap: 0.25rem; }
.search-results:not(:empty) { margin-top: 0.5rem; }
.search-results a, .search-results button.res {
  display: grid; grid-template-columns: 3.5rem 1fr auto; gap: 1rem; align-items: center; width: 100%; text-align: left;
  padding: 0.5rem; border-radius: var(--r-sm); transition: background-color 0.2s;
}
.search-results .res:hover, .search-results .res:focus-visible { background: color-mix(in oklab, var(--fg), transparent 94%); }
.search-results img { width: 3.5rem; height: 3.5rem; object-fit: cover; border-radius: var(--r-sm); }
.search-results .nm { font-size: 0.95rem; }
.search-results .nm mark { background: none; color: inherit; font-weight: 600; }
.search-results .mt { font-size: 0.8rem; color: var(--muted); }
.search-results .pr { font-size: 0.9rem; font-variant-numeric: tabular-nums; }
.search-empty { color: var(--muted); padding: 1rem 0.5rem; }

/* Quick view */
.quick {
  position: absolute; left: 50%; top: 50%; width: min(100% - 1.5rem, 60rem); max-height: calc(100dvh - 2rem); overflow-y: auto;
  display: grid; grid-template-columns: 1.05fr 1fr;
  background: var(--surface); color: var(--fg); border-radius: var(--r-panel); box-shadow: 0 40px 120px rgb(0 0 0 / 0.28);
  transform: translate(-50%, -48%) scale(0.97); opacity: 0; transition: transform 0.55s var(--ease), opacity 0.35s;
}
.ov.is-open .quick { transform: translate(-50%, -50%); opacity: 1; }
.quick-media { position: relative; background: var(--ph, var(--bg-2)); aspect-ratio: 1; }
.quick-media img { width: 100%; height: 100%; object-fit: cover; }
.quick-info { padding: clamp(1.5rem, 3vw, 2.75rem); display: flex; flex-direction: column; gap: 1rem; }
.quick-info .icon-btn { position: absolute; top: 0.75rem; right: 0.75rem; background: var(--surface); }
.quick-title { font-family: var(--font-display); font-size: clamp(1.5rem, 2.4vw, 2.1rem); line-height: 1.1; font-weight: 500; padding-right: 2.5rem; }
.quick-price { font-size: 1.2rem; font-variant-numeric: tabular-nums; }
.quick-desc { color: var(--muted); max-width: 42ch; }
.quick-meta { display: grid; gap: 0.5rem; font-size: 0.875rem; padding: 1rem 0; border-block: 1px solid var(--line); }
.quick-meta div { display: flex; gap: 0.6rem; align-items: center; }
.quick-meta .ph { color: var(--muted); }
.quick-buy { display: flex; gap: 0.75rem; align-items: stretch; margin-top: auto; }
.quick-buy .qty { height: 3.1rem; margin: 0; }
.quick-buy .qty button { width: 2.75rem; height: 3rem; }
.quick-buy .btn { flex: 1; }
.quick-klarna { font-size: 0.8rem; color: var(--muted); display: flex; gap: 0.5rem; align-items: center; }
.quick-klarna .mark { height: 0.9rem; }
@media (max-width: 767px) {
  .quick { grid-template-columns: 1fr; top: auto; bottom: 0; transform: translate(-50%, 100%); width: 100%; max-height: 92dvh; border-radius: var(--r-panel) var(--r-panel) 0 0; }
  .ov.is-open .quick { transform: translate(-50%, 0); }
  .quick-media { aspect-ratio: 4 / 3; }
}

/* Toast */
.toast {
  position: fixed; z-index: 90; left: 50%; bottom: calc(1.25rem + env(safe-area-inset-bottom)); transform: translate(-50%, 1.5rem);
  display: flex; align-items: center; gap: 0.9rem; padding: 0.55rem 0.6rem 0.55rem 0.55rem; min-width: 18rem; max-width: calc(100% - 2rem);
  background: var(--fg); color: var(--bg); border-radius: 999px; box-shadow: 0 20px 50px rgb(0 0 0 / 0.25);
  opacity: 0; visibility: hidden; pointer-events: none;
  transition: transform 0.6s var(--ease), opacity 0.3s, visibility 0s 0.6s;
}
.toast.is-on { transform: translate(-50%, 0); opacity: 1; visibility: visible; pointer-events: auto; transition: transform 0.6s var(--ease), opacity 0.3s, visibility 0s; }
.toast img { width: 2.6rem; height: 2.6rem; border-radius: 999px; object-fit: cover; }
.toast p { font-size: 0.875rem; line-height: 1.25; flex: 1; }
.toast p span { display: block; opacity: 0.65; font-size: 0.8rem; }
.toast button { height: 2.4rem; padding: 0 1rem; border-radius: 999px; background: var(--bg); color: var(--fg); font-size: 0.8rem; font-weight: 500; white-space: nowrap; }

/* Fly-to-cart ghost */
.fly { position: fixed; z-index: 85; pointer-events: none; border-radius: 999px; object-fit: cover; box-shadow: 0 10px 30px rgb(0 0 0 / 0.2); }

/* Mockup switcher (not part of the design) */
.mk {
  position: fixed; z-index: 95; right: 1rem; bottom: calc(1rem + env(safe-area-inset-bottom));
  display: flex; align-items: center; gap: 0.15rem; padding: 0.25rem; border-radius: 999px;
  background: rgb(24 21 18 / 0.78); color: #efe9e0; font: 500 0.75rem/1 system-ui, sans-serif; letter-spacing: 0.01em;
  backdrop-filter: blur(14px) saturate(160%); -webkit-backdrop-filter: blur(14px) saturate(160%);
  box-shadow: inset 0 1px 0 rgb(255 255 255 / 0.12), 0 10px 30px rgb(0 0 0 / 0.2);
}
.mk { transition: opacity 0.3s; }
.is-locked .mk { opacity: 0; pointer-events: none; }
.mk a { padding: 0.55rem 0.8rem; border-radius: 999px; opacity: 0.72; transition: opacity 0.2s, background-color 0.2s; }
.mk a:hover { opacity: 1; }
.mk a[aria-current="page"] { background: rgb(255 255 255 / 0.14); opacity: 1; }
.mk .mk-home { padding: 0.45rem 0.6rem; }
.mk .ph { font-size: 1rem; }
@media (max-width: 767px) {
  .mk { right: 0.75rem; bottom: calc(0.75rem + env(safe-area-inset-bottom)); }
  .mk a:not(.mk-home) { display: none; }
  .mk .mk-home { padding: 0.7rem; }
}

/* Reveal on scroll (common.js adds .is-in). Content stays visible without JS. */
.js [data-reveal] { opacity: 0; transform: translateY(28px); transition: opacity 1s var(--ease), transform 1.1s var(--ease); transition-delay: calc(var(--i, 0) * 70ms); }
.js [data-reveal="fade"] { transform: none; }
.js [data-reveal].is-in { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; scroll-behavior: auto !important; }
  .js [data-reveal] { opacity: 1; transform: none; }
}
@media (prefers-reduced-transparency: reduce) {
  .mk { background: #1c1916; backdrop-filter: none; -webkit-backdrop-filter: none; }
}
