/* SORA — beauty counter storefront */
:root {
  --ivory: #f3ece4;
  --ivory-2: #f8f3ec;
  --paper: #fcf9f3;
  --card: #f8f2e7;
  --plum: #5c1f3d;
  --plum-2: #4a1731;
  --plum-ink: #3a1428;
  --ink: #2c2024;
  --ink-soft: #5f4d51;
  --line: rgba(74, 24, 49, 0.14);
  --blush: #efc6c3;
  --serif: "Gilda Display", "Cormorant Garamond", Georgia, serif;
  --sans: "Jost", "Futura", "Century Gothic", "Avenir Next", system-ui, sans-serif;
  --nav-h: 64px;
  --bar-h: 132px;
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-soft: cubic-bezier(0.32, 0.72, 0, 1);
  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--ivory);
  color: var(--ink);
  font: 400 16px/1.5 var(--sans);
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
  -webkit-tap-highlight-color: transparent;
}
::selection { background: var(--blush); color: var(--plum-ink); }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
button:disabled { cursor: default; }
svg { width: 1em; height: 1em; flex: none; }
.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
:focus-visible { outline: 2px solid var(--plum); outline-offset: 3px; border-radius: 4px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.skip {
  position: fixed; left: 12px; top: -60px; z-index: 100; padding: 10px 16px;
  background: var(--plum); color: var(--ivory); border-radius: 6px; text-decoration: none;
}
.skip:focus { top: 12px; }

/* ---------------- navigation ---------------- */
.nav {
  position: relative; z-index: 30;
  height: var(--nav-h);
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center;
  padding: 0 clamp(16px, 3vw, 46px);
  background: var(--ivory);
  border-bottom: 1px solid var(--line);
}
.logo {
  justify-self: start;
  font: 500 27px/1 var(--sans);
  letter-spacing: 0.42em; margin-right: -0.42em;
  color: var(--plum-ink); text-decoration: none;
}
.nav-links { display: flex; gap: clamp(28px, 5vw, 74px); }
.nav-links a, .nav-link {
  font-size: 19px; color: var(--ink); text-decoration: none;
  padding: 6px 2px; background-image: linear-gradient(currentColor, currentColor);
  background-size: 0 1px; background-repeat: no-repeat; background-position: 0 100%;
  transition: background-size 0.35s var(--ease-out);
}
.nav-links a:hover, .nav-link:hover { background-size: 100% 1px; }
.nav-basket { justify-self: end; font-size: 19px; padding: 6px 2px; font-variant-numeric: tabular-nums; }
.nav-basket.bump { animation: bump 0.5s var(--ease-out); }
@keyframes bump { 30% { transform: translateY(-3px); } }

/* ---------------- counter stage ---------------- */
main { height: calc(100dvh - var(--nav-h)); display: flex; flex-direction: column; }
.counter {
  position: relative; flex: 1; min-height: 0; overflow: hidden;
  background: #b48a64;
  touch-action: none;
  user-select: none; -webkit-user-select: none;
  outline: none;
}
.plate {
  position: absolute; inset: 0;
  background-repeat: no-repeat;
  background-color: #b48a64;
}
.scene { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
/* a soft shade under the headline so ivory type holds on the warm wall */
.counter::before {
  content: ""; position: absolute; left: 0; right: 0; top: 0; height: 34%; z-index: 2; pointer-events: none;
  background: radial-gradient(70% 100% at 50% 20%, rgba(70, 38, 20, 0.3), rgba(70, 38, 20, 0) 70%);
}
.headline {
  position: absolute; left: 0; right: 0; top: 4.2%; margin: 0; z-index: 3;
  text-align: center; pointer-events: none;
  font: 400 clamp(42px, 6.3vw, 96px)/1.02 var(--serif);
  letter-spacing: -0.01em;
  color: #fcf7f0;
  text-shadow: 0 1px 1px rgba(80, 44, 22, 0.18), 0 6px 30px rgba(70, 36, 16, 0.28);
  text-wrap: balance;
}
.loading {
  position: absolute; inset: 0; z-index: 8; display: grid; place-items: center;
  background: rgba(180, 138, 100, 0.25);
  transition: opacity 0.6s var(--ease-out), visibility 0.6s;
}
.loading span {
  font: 500 13px/1 var(--sans); letter-spacing: 0.24em; text-transform: uppercase; color: #fff8ef;
  padding: 12px 18px; border-radius: 999px; background: rgba(58, 20, 40, 0.38);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
}
.is-ready .loading { opacity: 0; visibility: hidden; }
.no-gl {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); z-index: 9;
  max-width: 34ch; margin: 0; padding: 18px 22px; text-align: center;
  background: var(--paper); color: var(--ink); border-radius: 10px; box-shadow: 0 10px 40px rgba(40, 20, 10, 0.25);
}

/* products: hit areas and live cards follow the 3D models */
.belt-products { position: absolute; inset: 0; z-index: 4; pointer-events: none; }
.item { position: absolute; left: 0; top: 0; pointer-events: none; }
.item.is-off { visibility: hidden; }
.hit {
  position: absolute; left: 0; top: 0;
  pointer-events: auto; border-radius: 12px;
  cursor: grab; touch-action: none;
}
.hit:focus-visible { outline: 2px solid #fff6ec; outline-offset: 2px; box-shadow: 0 0 0 4px rgba(92, 31, 61, 0.55); }
.is-dragging .hit { cursor: grabbing; }
.tag {
  position: absolute; left: 0; top: 0;
  transform-origin: 50% 50%;
  pointer-events: none;
  transition: opacity 0.35s var(--ease-out);
}
.tag.is-hidden { opacity: 0; }
.tag.is-hidden .add { pointer-events: none; }
.card {
  display: grid; justify-items: center; gap: 1px;
  min-width: 92px; padding: 5px 12px 6px;
  background: linear-gradient(180deg, #fbf6ee, #f2eadd);
  border-radius: 2px;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.7) inset, 0 1px 2px rgba(60, 30, 14, 0.28), 0 4px 10px rgba(60, 30, 14, 0.14);
  font: 500 14px/1.18 var(--sans); color: #2a1f1b;
  white-space: nowrap;
}
.c-price { font-weight: 400; font-variant-numeric: tabular-nums; }
.add {
  position: absolute; right: -14px; top: -14px;
  width: 30px; height: 30px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--plum); color: #fbf3ea;
  box-shadow: 0 2px 8px rgba(58, 20, 40, 0.35);
  font-size: 17px;
  pointer-events: auto;
  opacity: 0; transform: scale(0.7);
  transition: opacity 0.2s, transform 0.25s var(--ease-out), background-color 0.2s;
}
.add::before { content: ""; position: absolute; inset: -8px; }
.item:hover .add, .add:focus-visible, .tag.show-add .add { opacity: 1; transform: none; }
.add:hover { background: var(--plum-2); }
.add.done { background: #3f6b4a; }

.fallback-row {
  position: absolute; left: 16px; right: 16px; bottom: 24px;
  display: flex; flex-wrap: wrap; justify-content: center; gap: 22px 26px;
}
.fallback-row .tag { position: relative; }

/* belt controls */
.belt-ui {
  /* top corner, over the wall: never crosses a product label on the belt */
  position: absolute; z-index: 6; right: clamp(16px, 2.6vw, 40px); top: 20px;
  display: flex; gap: 4px; padding: 4px;
  background: rgba(251, 246, 239, 0.82);
  border-radius: 999px;
  box-shadow: 0 4px 18px rgba(60, 30, 14, 0.18);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
}
.ctl {
  width: 40px; height: 40px; border-radius: 50%;
  display: grid; place-items: center; font-size: 21px; color: var(--plum-ink);
  transition: background-color 0.2s, transform 0.2s var(--ease-out);
}
.ctl:hover { background: rgba(92, 31, 61, 0.08); }
.ctl:active { transform: scale(0.94); }
.hint {
  /* centred just under the headline: clear of the title, the controls and every label */
  position: absolute; z-index: 5; left: 50%; transform: translateX(-50%); white-space: nowrap;
  top: calc(4.2% + clamp(42px, 6.3vw, 96px) * 1.02 + 14px); margin: 0;
  padding: 10px 16px; border-radius: 999px;
  font: 500 13px/1 var(--sans); letter-spacing: 0.02em; color: var(--plum-ink);
  background: rgba(251, 246, 239, 0.8);
  box-shadow: 0 4px 18px rgba(60, 30, 14, 0.16);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  pointer-events: none;
  transition: opacity 0.6s;
}
.has-cart .hint { opacity: 0; }

/* ---------------- ritual bar ---------------- */
.ritual {
  position: relative; z-index: 20;
  flex: none; height: var(--bar-h);
  display: grid;
  grid-template-columns: auto 1fr 104px 210px 1px minmax(240px, 340px) auto;
  grid-template-areas: "title . skin basket rule summary cta";
  align-items: center; column-gap: clamp(14px, 2vw, 30px);
  padding: 10px clamp(16px, 3vw, 56px);
  background: var(--ivory);
  border-top: 1px solid var(--line);
}
.ritual::before { content: ""; grid-area: rule; width: 1px; height: 64%; background: var(--line); }
.ritual-title {
  grid-area: title; margin: 0; white-space: nowrap;
  font: 400 clamp(32px, 3.4vw, 54px)/1 var(--serif); color: var(--plum-ink); letter-spacing: -0.01em;
}
.skin { grid-area: skin; margin: 0; display: grid; gap: 6px; justify-items: center; }
.skin-frame {
  position: relative; width: 84px; height: 84px; overflow: hidden;
  border-radius: 4px;
  box-shadow: 0 0 0 4px #fbf7f1, 0 0 0 5px rgba(74, 24, 49, 0.12), 0 6px 16px rgba(60, 30, 14, 0.18);
}
.skin-frame img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; transition: opacity 0.9s var(--ease-soft); }
.skin-frame img + img { opacity: 0; }
.skin-frame.flip img:first-child { opacity: 0; }
.skin-frame.flip img + img { opacity: 1; }
.skin figcaption { display: grid; justify-items: center; width: max-content; font: 400 12px/1.25 var(--sans); color: var(--ink-soft); text-align: center; white-space: nowrap; max-width: 130px; }
.skin figcaption span { letter-spacing: 0.16em; text-transform: uppercase; font-size: 9.5px; }
.skin figcaption b { font-weight: 500; color: var(--ink); max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
.basket {
  grid-area: basket; position: relative; height: 100%; width: 210px;
  display: grid; place-items: center; border-radius: 12px;
  transition: transform 0.3s var(--ease-out);
}
.basket-canvas { width: 196px; height: 110px; display: block; }
.basket-count {
  position: absolute; right: 8px; top: 14px; min-width: 22px; height: 22px; padding: 0 6px;
  border-radius: 999px; background: var(--plum); color: #fbf3ea;
  font: 600 12px/22px var(--sans); text-align: center; font-variant-numeric: tabular-nums;
  transform: scale(0); transition: transform 0.3s var(--ease-out);
}
.has-cart .basket-count { transform: none; }
.basket.is-over { transform: scale(1.06); }
.basket.is-over::after, .basket.is-target::after {
  content: ""; position: absolute; inset: 6px -4px; border-radius: 16px;
  border: 1.5px dashed rgba(92, 31, 61, 0.45); pointer-events: none;
}
.basket.is-over::after { border-style: solid; background: rgba(239, 198, 195, 0.22); }
.basket.drop { animation: drop 0.55s var(--ease-out); }
@keyframes drop { 30% { transform: translateY(5px) scale(1.04, 0.96); } 60% { transform: translateY(-2px); } }

.summary { grid-area: summary; min-width: 0; display: grid; gap: 4px; align-content: center; height: 100%; padding: 14px 0; }
.lines { list-style: none; margin: 0; padding: 0; overflow-y: auto; max-height: 68px; scrollbar-width: thin; scrollbar-color: rgba(92, 31, 61, 0.3) transparent; }
.line {
  display: grid; grid-template-columns: 20px 1fr auto auto; align-items: center; gap: 8px;
  font-size: 15px; line-height: 1.25; padding: 1px 0;
}
.line img { width: 20px; height: 26px; object-fit: contain; }
.l-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.l-name small { color: var(--ink-soft); font-size: 13px; margin-left: 4px; font-variant-numeric: tabular-nums; }
.l-price { font-variant-numeric: tabular-nums; text-align: right; min-width: 3ch; }
.stepper { display: inline-flex; border: 1px solid var(--line); border-radius: 999px; }
.stepper button { width: 24px; height: 22px; display: grid; place-items: center; font-size: 13px; color: var(--plum-ink); border-radius: 999px; }
.stepper button:hover { background: rgba(92, 31, 61, 0.08); }
.empty { margin: 0; color: var(--ink-soft); font-size: 14px; line-height: 1.35; }
.plus-chip { display: inline-grid; place-items: center; width: 18px; height: 18px; border-radius: 50%; background: var(--plum); color: #fbf3ea; font-size: 12px; vertical-align: -3px; }
.has-cart .empty { display: none; }
.total-row {
  margin: 0; display: flex; justify-content: space-between; align-items: baseline; gap: 12px;
  border-top: 1px solid var(--line); padding-top: 8px;
}
.total-label { font-size: 14px; color: var(--ink-soft); }
.total { font: 400 30px/1 var(--serif); color: var(--plum-ink); font-variant-numeric: tabular-nums; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 12px;
  height: 52px; padding: 0 22px 0 26px; border-radius: 8px; white-space: nowrap;
  font: 500 17px/1 var(--sans); letter-spacing: 0.01em;
  transition: background-color 0.2s, transform 0.2s var(--ease-out), opacity 0.2s;
}
.btn svg { font-size: 20px; transition: transform 0.3s var(--ease-out); }
.btn:hover svg { transform: translateX(3px); }
.btn:active { transform: scale(0.98); }
.btn-plum { background: var(--plum); color: #fbf3ea; box-shadow: 0 6px 18px rgba(74, 23, 49, 0.22); }
.btn-plum:hover { background: var(--plum-2); }
.btn:disabled { opacity: 0.38; box-shadow: none; }
.btn:disabled:hover svg { transform: none; }
.receipt-btn { grid-area: cta; }

/* ---------------- drag ghost ---------------- */
.ghost {
  position: fixed; left: 0; top: 0; z-index: 60; pointer-events: none;
  opacity: 0; will-change: transform;
}
.ghost img { display: block; height: 100%; width: auto; filter: drop-shadow(0 18px 18px rgba(40, 18, 8, 0.32)) drop-shadow(0 2px 3px rgba(40, 18, 8, 0.3)); }
.ghost.on { opacity: 1; }

/* ---------------- details ---------------- */
.detail {
  position: fixed; z-index: 40;
  left: 0; right: 0; top: var(--nav-h); bottom: var(--bar-h);
  display: grid; grid-template-columns: 1.65fr 1fr;
  background: var(--ivory);
  animation: fade 0.45s var(--ease-out);
}
.detail[hidden], .receipt[hidden], .studio-note[hidden] { display: none; }
@keyframes fade { from { opacity: 0; } }
.detail-media { position: relative; overflow: hidden; background: #b48a64; }
.viewer-host { position: absolute; inset: 0; cursor: grab; touch-action: none; outline: none; }
.viewer-host:active { cursor: grabbing; }
.viewer-host:focus-visible { box-shadow: inset 0 0 0 3px rgba(252, 247, 240, 0.9); }
.viewer-canvas { width: 100%; height: 100%; display: block; }
.viewer-hint {
  position: absolute; left: 50%; bottom: 18px; transform: translateX(-50%); margin: 0;
  display: inline-flex; align-items: center; gap: 8px;
  padding: 8px 14px; border-radius: 999px;
  font: 500 13px/1 var(--sans); color: var(--plum-ink);
  background: rgba(251, 246, 239, 0.84);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  pointer-events: none; transition: opacity 0.5s;
}
.viewer-hint svg { font-size: 18px; }
.viewer-host.touched ~ .viewer-hint { opacity: 0; }
.d-card { display: none; }
.detail-info {
  overflow-y: auto; padding: clamp(28px, 4vh, 48px) clamp(24px, 3.2vw, 52px);
  display: flex; flex-direction: column; gap: 14px;
  border-left: 1px solid var(--line);
  scrollbar-width: thin;
}
.d-head { display: flex; justify-content: space-between; align-items: baseline; gap: 16px; }
.d-head h2 { margin: 0; font: 400 clamp(36px, 3.4vw, 52px)/1.02 var(--serif); color: var(--plum-ink); letter-spacing: -0.01em; text-wrap: balance; }
.d-price { margin: 0; font: 400 clamp(28px, 2.4vw, 38px)/1 var(--serif); color: var(--plum-ink); font-variant-numeric: tabular-nums; }
.d-type { margin: -6px 0 0; font-size: 19px; color: var(--ink); }
.d-text { margin: 0; font-size: 16.5px; line-height: 1.55; color: var(--ink); max-width: 46ch; }
.d-facts { margin: 0; display: grid; grid-template-columns: auto 1fr; gap: 4px 18px; font-size: 14.5px; }
.d-facts div { display: contents; }
.d-facts dt { color: var(--ink-soft); }
.d-facts dd { margin: 0; }
.d-texture { position: relative; margin: 4px 0 0; border-radius: 6px; overflow: hidden; aspect-ratio: 16 / 7; background: #e7dccf; }
.d-texture img { width: 100%; height: 100%; object-fit: cover; display: block; transform: scale(1.04); transition: transform 1.6s var(--ease-soft); }
.detail:not([hidden]) .d-texture img { transform: none; }
.d-texture figcaption {
  position: absolute; left: 10px; bottom: 10px; padding: 5px 10px; border-radius: 999px;
  font: 500 11px/1 var(--sans); letter-spacing: 0.12em; text-transform: uppercase; color: var(--plum-ink);
  background: rgba(251, 246, 239, 0.86);
}
.d-add { width: 100%; justify-content: space-between; margin-top: 6px; }
.d-added { margin: -4px 0 0; min-height: 1.4em; font-size: 14px; color: var(--ink-soft); }
.back {
  align-self: flex-start; display: inline-flex; align-items: center; gap: 12px;
  font-size: 17px; color: var(--ink); padding: 8px 2px;
}
.back svg { font-size: 22px; transition: transform 0.3s var(--ease-out); }
.back:hover svg { transform: translateX(-3px); }

/* ---------------- receipt ---------------- */
.receipt {
  position: fixed; inset: 0; z-index: 50;
  display: grid; place-items: start center; overflow-y: auto;
  padding: clamp(16px, 7vh, 80px) 16px 40px;
  background: rgba(46, 22, 14, 0.42);
  backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px);
  animation: fade 0.35s var(--ease-out);
}
.printer { width: min(380px, 100%); position: relative; }
.printer-head {
  position: relative; z-index: 2; height: 58px; border-radius: 14px 14px 8px 8px;
  background: linear-gradient(180deg, #f7f1e8, #e9e0d3);
  box-shadow: 0 1px 0 #fff inset, 0 10px 30px rgba(30, 14, 6, 0.32), 0 2px 4px rgba(30, 14, 6, 0.2);
  display: grid; place-items: end center; padding-bottom: 14px;
}
.slot {
  width: 86%; height: 9px; border-radius: 5px;
  background: linear-gradient(180deg, #2b2220, #4a3d37);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.7);
}
.paper-run { position: relative; z-index: 1; margin: -14px auto 0; width: 82%; overflow: hidden; padding: 0 12px 24px; }
.paper {
  position: relative; padding: 34px 26px 34px; text-align: center;
  background-color: var(--paper);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0.35 0 0 0 0 0.25 0 0 0 0 0.2 0 0 0 .05 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  box-shadow: 0 14px 28px rgba(30, 14, 6, 0.26), 0 2px 4px rgba(30, 14, 6, 0.12);
  --zz: 9px;
  -webkit-mask: conic-gradient(from -45deg at bottom, #0000, #000 1deg 89deg, #0000 90deg) 50% / calc(2 * var(--zz)) 100%;
  mask: conic-gradient(from -45deg at bottom, #0000, #000 1deg 89deg, #0000 90deg) 50% / calc(2 * var(--zz)) 100%;
  padding-bottom: calc(34px + var(--zz));
}
.receipt.printing .paper { animation: feed 1.15s var(--ease-soft) both; }
@keyframes feed { from { transform: translateY(-100%); } }
.r-close { position: absolute; right: 12px; top: 12px; width: 36px; height: 36px; display: grid; place-items: center; font-size: 20px; border-radius: 50%; color: var(--ink); }
.r-close:hover { background: rgba(92, 31, 61, 0.08); }
.r-brand { margin: 0; font: 500 20px/1 var(--sans); letter-spacing: 0.42em; margin-right: -0.42em; color: var(--plum-ink); }
.paper h2 { margin: 8px 0 2px; font: 400 32px/1.1 var(--serif); color: var(--plum-ink); }
.r-meta { margin: 0 0 14px; font-size: 12.5px; color: var(--ink-soft); font-variant-numeric: tabular-nums; }
.r-meta span { white-space: nowrap; }
.r-thumbs { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px 10px; padding: 6px 0 14px; border-bottom: 1.5px dashed rgba(74, 24, 49, 0.28); }
.r-thumbs img { height: 76px; width: auto; }
.r-lines { list-style: none; margin: 0; padding: 12px 0 10px; text-align: left; border-bottom: 1.5px dashed rgba(74, 24, 49, 0.28); }
.r-lines li { display: grid; grid-template-columns: 1fr auto; gap: 2px 12px; padding: 6px 0; font-size: 16px; }
.r-lines .r-qty { grid-column: 1; font-size: 13px; color: var(--ink-soft); font-variant-numeric: tabular-nums; display: flex; align-items: center; gap: 10px; }
.r-lines .r-amt { grid-row: 1; grid-column: 2; font-variant-numeric: tabular-nums; }
.r-count { margin: 10px 0 0; text-align: left; font-size: 14px; color: var(--ink-soft); }
.r-total { margin: 2px 0 6px; display: flex; justify-content: space-between; align-items: baseline; font: 400 26px/1.2 var(--serif); color: var(--ink); }
.r-total span:last-child { font-variant-numeric: tabular-nums; }
.r-note { margin: 0 0 18px; font-size: 12px; color: var(--ink-soft); }
.r-print { width: 100%; gap: 10px; padding: 0 20px; }
.r-print svg { font-size: 19px; }
.r-print:hover svg { transform: none; }
.r-empty { padding: 14px 0; color: var(--ink-soft); font-size: 15px; text-align: center; }

/* ---------------- studio note ---------------- */
.studio-note { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; padding: 16px; background: rgba(46, 22, 14, 0.36); animation: fade 0.3s var(--ease-out); }
.studio-card { position: relative; width: min(460px, 100%); padding: 32px 30px 26px; background: var(--paper); border-radius: 12px; box-shadow: 0 20px 60px rgba(30, 14, 6, 0.3); }
.studio-card h2 { margin: 0 0 10px; font: 400 36px/1.05 var(--serif); color: var(--plum-ink); }
.studio-card p { margin: 0 0 12px; line-height: 1.55; }
.studio-card ul { margin: 0 0 14px; padding-left: 18px; line-height: 1.6; }
.studio-card .s-small { font-size: 13px; color: var(--ink-soft); margin: 0; }
.s-close { position: absolute; right: 12px; top: 12px; width: 36px; height: 36px; display: grid; place-items: center; font-size: 20px; border-radius: 50%; }
.s-close:hover { background: rgba(92, 31, 61, 0.08); }

/* ---------------- tablet ---------------- */
@media (max-width: 1180px) {
  .ritual { grid-template-columns: auto 0 76px 160px 1px minmax(230px, 1fr) auto; column-gap: 14px; }
  .ritual-title { font-size: 30px; }
  .basket { width: 160px; }
  .basket-canvas { width: 156px; height: 88px; }
  .skin-frame { width: 64px; height: 64px; }
  .btn { padding: 0 16px 0 18px; gap: 8px; font-size: 16px; }
}
@media (max-width: 920px) and (min-aspect-ratio: 1/1) {
  .ritual-title { display: none; }
  .ritual { grid-template-columns: 0 0 84px 180px 1px 1fr auto; }
}

/* ---------------- phones & portrait ---------------- */
@media (max-aspect-ratio: 1/1), (max-width: 640px) {
  :root { --nav-h: 54px; --bar-h: calc(150px + env(safe-area-inset-bottom)); }
  .nav { grid-template-columns: auto 1fr auto; column-gap: 12px; }
  .logo { font-size: 22px; }
  .nav-links { justify-self: center; gap: 22px; }
  .nav-links a, .nav-link, .nav-basket { font-size: 16px; }
  .headline { top: 3.5%; font-size: clamp(34px, 9.6vw, 64px); padding: 0 16px; }
  .belt-ui { top: auto; right: 50%; transform: translateX(50%); bottom: 14px; gap: 10px; padding: 5px; }
  .ctl { width: 48px; height: 48px; font-size: 24px; }
  .hint { display: none; }
  .ritual {
    grid-template-columns: 64px minmax(0, 1fr) auto;
    grid-template-rows: auto 1fr;
    grid-template-areas: "title title summary" "skin basket cta";
    column-gap: 12px; row-gap: 2px;
    padding: 10px 16px calc(10px + env(safe-area-inset-bottom));
    align-items: center;
  }
  .total-label .sep, .total-label .ot { display: none; }
  .total-label { align-self: center; }
  .ritual::before { display: none; }
  .ritual-title { font-size: 24px; align-self: center; }
  .skin { gap: 3px; }
  .skin-frame { width: 64px; height: 64px; }
  .skin figcaption { font-size: 10px; max-width: 72px; }
  .skin figcaption span { display: none; }
  .basket { width: 100%; max-width: 170px; height: 86px; justify-self: center; }
  .basket { min-width: 0; overflow: hidden; }
  .basket-canvas { width: 100%; max-width: 150px; height: auto; aspect-ratio: 150 / 85; }
  .receipt-btn { position: relative; z-index: 1; }
  .basket-count { right: 4px; top: 6px; }
  .summary { padding: 0; height: auto; }
  .lines, .empty { display: none; }
  .total-row { border: 0; padding: 0; gap: 10px; justify-content: flex-end; }
  .total-label .sep, .total-label { font-size: 13px; }
  .total { font-size: 26px; }
  .btn { height: 48px; padding: 0 16px; font-size: 15.5px; gap: 8px; }
  .receipt-btn { white-space: nowrap; }
  .card { font-size: 14px; min-width: 96px; padding: 5px 12px 6px; }
  .add { width: 34px; height: 34px; right: -15px; top: -16px; font-size: 18px; }

  .detail { top: 0; bottom: 0; z-index: 45; grid-template-columns: 1fr; grid-template-rows: 46% 1fr; }
  .detail-info { border-left: 0; border-top: 1px solid var(--line); padding: 20px 18px calc(22px + env(safe-area-inset-bottom)); gap: 12px; }
  .d-head h2 { font-size: 34px; }
  .d-price { font-size: 28px; }
  .d-type { font-size: 17px; }
  .d-text { font-size: 15.5px; }
  .d-texture { aspect-ratio: 16 / 8; }
  .back { order: -1; align-self: stretch; justify-content: flex-start; margin: -6px 0 0; font-size: 16px; }
  .viewer-hint { bottom: 12px; }
}
@media (max-width: 360px) {
  .nav-links { gap: 14px; }
  .receipt-btn .label-long { display: none; }
}

/* ---------------- reduced motion ---------------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
}
.rm *, .rm *::before, .rm *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }

/* ---------------- print: only the paper receipt ---------------- */
@media print {
  @page { margin: 12mm; }
  body { overflow: visible; background: #fff; }
  body > *:not(.receipt) { display: none !important; }
  .receipt { position: static; display: block !important; padding: 0; background: none; backdrop-filter: none; overflow: visible; }
  .printer { width: 80mm; margin: 0 auto; }
  .printer-head, .r-close, .r-print, .stepper { display: none !important; }
  .paper-run { width: 100%; margin: 0; padding: 0; overflow: visible; }
  .paper { animation: none !important; transform: none !important; box-shadow: none; background: #fff; -webkit-mask: none; mask: none; border: 1px solid #ccc; padding: 18px 14px; }
  .paper, .paper * { color: #000 !important; }
  .r-thumbs img { height: 56px; }
}
