/* Dom Sztuki try-on demo. Light base from RESEARCH-2026-10-10-design.md §5;
   dark theme per NEW_PROJECT_CHECKLIST §10. Colours ONLY as tokens, no literals in rules.
   No brand accent yet — owner has not picked burgundy vs sage (RESEARCH Q2). */

:root {
  --bg: #faf8f4;
  --bg2: #f1ece4;
  --line: #e2dcd2;
  --ink: #1f1d1b;
  --ink-soft: #6b655e;
  --btn-bg: #1f1d1b;
  --btn-ink: #faf8f4;
  --shadow: 0 1px 2px rgba(31, 29, 27, 0.06), 0 8px 24px rgba(31, 29, 27, 0.08);
  --radius: 14px;
  --maxw: 960px;
  --serif: 'Cormorant Garamond', Georgia, 'Times New Roman', serif;
  --sans: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) {
    --bg: #161514;
    --bg2: #201e1c;
    --line: #322e2a;
    --ink: #ede8e0;
    --ink-soft: #a79f95;
    --btn-bg: #ede8e0;
    --btn-ink: #161514;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 8px 24px rgba(0, 0, 0, 0.5);
  }
}

:root[data-theme='dark'] {
  --bg: #161514;
  --bg2: #201e1c;
  --line: #322e2a;
  --ink: #ede8e0;
  --ink-soft: #a79f95;
  --btn-bg: #ede8e0;
  --btn-ink: #161514;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 8px 24px rgba(0, 0, 0, 0.5);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
}

body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

a {
  color: inherit;
}

.wrap {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 16px;
}

/* ---- header ---- */
.site-header {
  border-bottom: 1px solid var(--line);
  background: var(--bg);
  position: sticky;
  top: 0;
  z-index: 5;
}
.site-header .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 60px;
  gap: 12px;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  font-weight: 700;
  letter-spacing: 0.14em;
  font-size: 14px;
}
.brand .mark {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--btn-bg);
  color: var(--btn-ink);
  display: grid;
  place-items: center;
  font-family: var(--serif);
  font-size: 15px;
  font-weight: 600;
}
.header-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}
.icon-btn {
  appearance: none;
  border: 1px solid var(--line);
  background: var(--bg);
  color: var(--ink);
  border-radius: 10px;
  min-height: 40px;
  padding: 0 12px;
  font: inherit;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
}
.icon-btn:hover {
  background: var(--bg2);
}
.badge {
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--btn-bg);
  color: var(--btn-ink);
  font-size: 12px;
  font-weight: 700;
  display: inline-grid;
  place-items: center;
}

/* ---- headings ---- */
h1,
h2 {
  font-family: var(--serif);
  font-weight: 600;
  line-height: 1.12;
  margin: 0;
}
h1 {
  font-size: clamp(28px, 7vw, 44px);
}
.lead {
  color: var(--ink-soft);
  margin: 10px 0 0;
  max-width: 44ch;
}
.page-intro {
  padding: 26px 0 8px;
}

/* ---- catalog ---- */
.grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 18px;
  padding: 18px 0 40px;
}
@media (min-width: 620px) {
  .grid {
    grid-template-columns: 1fr 1fr;
    gap: 24px;
  }
}
.card {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow);
}
.card .photo {
  background: var(--bg2);
  aspect-ratio: 3 / 4;
  display: grid;
  place-items: center;
  overflow: hidden;
}
.card .photo img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}
.card .body {
  padding: 14px 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.card .title {
  font-family: var(--serif);
  font-size: 22px;
  font-weight: 600;
}
.card .meta {
  color: var(--ink-soft);
  font-size: 14px;
}
.card .price {
  color: var(--ink-soft);
  font-size: 14px;
  margin-top: 2px;
}
.card .btn {
  margin-top: 12px;
}

/* ---- buttons ---- */
.btn {
  appearance: none;
  border: 1px solid var(--btn-bg);
  background: var(--btn-bg);
  color: var(--btn-ink);
  border-radius: 12px;
  min-height: 52px;
  padding: 0 20px;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  text-decoration: none;
  width: 100%;
  text-align: center;
}
.btn:hover {
  opacity: 0.9;
}
.btn.ghost {
  background: transparent;
  color: var(--ink);
  border-color: var(--line);
}
.btn[disabled] {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ---- try-on page ---- */
.tryon {
  padding: 18px 0 48px;
}
.tryon .back {
  display: inline-block;
  color: var(--ink-soft);
  text-decoration: none;
  font-size: 14px;
  margin-bottom: 12px;
}
.tryon h1 {
  margin-bottom: 4px;
}
.tryon .sub {
  color: var(--ink-soft);
  margin: 0 0 16px;
}
.hint {
  background: var(--bg2);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px 14px;
  color: var(--ink-soft);
  font-size: 14px;
  margin: 0 0 16px;
}
model-viewer {
  width: 100%;
  height: min(70vh, 560px);
  background: var(--bg2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  --poster-color: transparent;
}
.mv-wrap {
  position: relative;
}
.ar-btn {
  /* model-viewer slot=ar-button */
  position: static;
  margin-top: 14px;
}
.actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 14px;
}
@media (min-width: 620px) {
  .actions {
    flex-direction: row;
  }
  .actions .btn {
    width: auto;
    flex: 1;
  }
}

/* desktop fallback (no AR): QR + open-on-phone */
.desktop-panel {
  margin-top: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg2);
  padding: 18px;
  display: flex;
  gap: 18px;
  align-items: center;
}
.desktop-panel .qr {
  background: #fff;
  padding: 10px;
  border-radius: 10px;
  line-height: 0;
  flex: 0 0 auto;
}
.desktop-panel .qr img,
.desktop-panel .qr canvas {
  display: block;
  width: 132px;
  height: 132px;
}
.desktop-panel p {
  margin: 0;
  color: var(--ink-soft);
  font-size: 14px;
}
.desktop-panel strong {
  color: var(--ink);
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%) translateY(20px);
  background: var(--btn-bg);
  color: var(--btn-ink);
  padding: 12px 20px;
  border-radius: 999px;
  font-weight: 600;
  box-shadow: var(--shadow);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s, transform 0.25s;
  z-index: 50;
}
.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ---- cart ---- */
.cart {
  padding: 18px 0 48px;
}
.cart-list {
  list-style: none;
  margin: 18px 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.cart-item {
  display: flex;
  align-items: center;
  gap: 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 12px;
  background: var(--bg);
}
.cart-item .thumb {
  width: 60px;
  height: 80px;
  object-fit: contain;
  background: var(--bg2);
  border-radius: 8px;
  flex: 0 0 auto;
}
.cart-item .ci-body {
  flex: 1;
  min-width: 0;
}
.cart-item .ci-title {
  font-family: var(--serif);
  font-size: 20px;
  font-weight: 600;
}
.cart-item .ci-meta {
  color: var(--ink-soft);
  font-size: 14px;
}
.cart-item .remove {
  appearance: none;
  border: 1px solid var(--line);
  background: var(--bg);
  color: var(--ink-soft);
  border-radius: 10px;
  width: 40px;
  height: 40px;
  font-size: 20px;
  cursor: pointer;
  flex: 0 0 auto;
}
.cart-item .remove:hover {
  background: var(--bg2);
  color: var(--ink);
}
.empty {
  color: var(--ink-soft);
  padding: 30px 0;
}
.pay-note {
  color: var(--ink-soft);
  font-size: 13px;
  text-align: center;
  margin: 10px 0 0;
}
.footer {
  border-top: 1px solid var(--line);
  color: var(--ink-soft);
  font-size: 13px;
  padding: 20px 0 40px;
}

/* ===== surprise flow (brief #04): screen 1 pick, screen 2 place ===== */

.screen {
  min-height: 100vh;
  min-height: 100svh;
}

/* Screen 1 must never scroll — pin it to the small-viewport height. */
.screen1 {
  height: 100vh;
  height: 100svh;
  overflow: hidden;
}
.s1 {
  height: 100vh;
  height: 100svh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: clamp(16px, 4vh, 30px);
  padding: 20px 16px;
}
.s1-row {
  display: flex;
  gap: clamp(12px, 5vw, 28px);
  width: 100%;
  max-width: 760px;
  justify-content: center;
  align-items: center;
  min-height: 0;
}
.s1-pick {
  flex: 1 1 0;
  min-width: 0;
  max-width: 320px;
  display: block;
  text-decoration: none;
  background: var(--bg2);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
}
.s1-pick img {
  display: block;
  width: 100%;
  aspect-ratio: 3 / 4;
  object-fit: contain;
}
.s1-cap {
  margin: 0;
  text-align: center;
  font-family: var(--serif);
  font-weight: 600;
  font-size: clamp(22px, 6.5vw, 32px);
  color: var(--ink);
}
.s1-err {
  color: var(--ink-soft);
  font-size: 14px;
  text-align: center;
}

/* Screen 2 — the chosen painting (photo), one line, GO. */
.s2 {
  min-height: 100vh;
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 24px 16px;
}
.s2-art {
  width: 100%;
  max-width: 420px;
}
.s2 model-viewer {
  width: 100%;
  height: min(58vh, 460px);
  background: var(--bg2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  --poster-color: transparent;
}
.ar-trigger {
  display: none !important;
}
.s2-cap {
  margin: 0;
  text-align: center;
  font-family: var(--serif);
  font-weight: 600;
  font-size: clamp(21px, 5.6vw, 30px);
  line-height: 1.15;
  color: var(--ink);
}
.s2 .btn {
  width: 100%;
  max-width: 420px;
}
.s2-note {
  margin: 0;
  max-width: 420px;
  text-align: center;
  color: var(--ink-soft);
  font-size: 14px;
}
.s2-after {
  display: flex;
  gap: 20px;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
}
.s2-link {
  color: var(--ink-soft);
  font-size: 14px;
  text-decoration: underline;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.s2-qr {
  width: 100%;
  max-width: 420px;
  margin-top: 0;
}
