/* পরে দেখি — virtual try-on */
:root {
  --bg: #f7f3ee;
  --surface: #fffdfa;
  --surface-2: #f1eae1;
  --ink: #1f1a17;
  --ink-2: #6a5f56;
  --line: #e3d9cd;
  --accent: #a8325e;
  --accent-hover: #8f2950;
  --accent-ink: #ffffff;
  --accent-soft: #f6e2ea;
  --err: #b42318;
  --scrim: rgba(255, 253, 250, .88);
  --radius: 20px;
  --radius-sm: 14px;
  --shadow: 0 1px 2px rgba(40, 25, 15, .05), 0 12px 32px -14px rgba(40, 25, 15, .2);
  --font: 'Hind Siliguri', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --display: 'Noto Serif Bengali', 'Hind Siliguri', serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #151210;
    --surface: #1e1a17;
    --surface-2: #29231f;
    --ink: #f3ede7;
    --ink-2: #b4a99f;
    --line: #3a332d;
    --accent: #e57ca3;
    --accent-hover: #f093b5;
    --accent-ink: #22111a;
    --accent-soft: #3b222d;
    --err: #ff8a7a;
    --scrim: rgba(30, 26, 23, .88);
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 12px 32px -14px rgba(0, 0, 0, .6);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #151210; --surface: #1e1a17; --surface-2: #29231f; --ink: #f3ede7; --ink-2: #b4a99f;
  --line: #3a332d; --accent: #e57ca3; --accent-hover: #f093b5; --accent-ink: #22111a;
  --accent-soft: #3b222d; --err: #ff8a7a; --scrim: rgba(30, 26, 23, .88);
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 12px 32px -14px rgba(0, 0, 0, .6);
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 400 16px/1.65 var(--font);
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; display: block; }
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }
a { color: var(--accent); }
svg { flex: none; }

.wrap { max-width: 1160px; margin: 0 auto; padding: 0 16px; }

/* top bar */
.top { padding: 14px 0; }
.top-in { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); }
.mark {
  width: 36px; height: 36px; border-radius: 11px; display: grid; place-items: center;
  background: var(--accent); color: var(--accent-ink);
}
.mark svg { width: 22px; height: 22px; }
.brand-name { font: 700 1.3rem/1 var(--display); letter-spacing: .01em; }
.pill {
  font-size: .82rem; font-weight: 500; color: var(--accent);
  background: var(--accent-soft); padding: 4px 12px; border-radius: 999px; white-space: nowrap;
}

/* hero */
.hero { padding: 18px 0 26px; max-width: 720px; }
.hero h1 {
  font: 700 clamp(1.6rem, 4.4vw, 2.6rem)/1.4 var(--display);
  margin: 0 0 10px; letter-spacing: -.005em; text-wrap: balance;
}
.hero h1 em { font-style: normal; color: var(--accent); }
.hero p { margin: 0; color: var(--ink-2); font-size: 1.04rem; max-width: 60ch; }

/* studio grid */
.studio {
  display: grid;
  gap: 14px;
  grid-template-columns: 1fr 1fr;
  grid-template-areas: "p g" "c c" "s s";
  align-items: start;
}
@media (min-width: 920px) {
  .studio {
    gap: 18px;
    grid-template-columns: 1fr 1fr 1.25fr;
    grid-template-areas: "p g s" "c c s";
  }
}

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px;
  box-shadow: var(--shadow);
  min-width: 0;
}
.card-head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.card-head h2 { font-size: 1.02rem; font-weight: 600; margin: 0; line-height: 1.3; }
.num {
  width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center;
  background: var(--accent-soft); color: var(--accent); font-weight: 700; font-size: .95rem; flex: none;
}

/* drop zones */
.drop {
  position: relative;
  aspect-ratio: 3 / 4;
  border: 2px dashed var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  display: grid; place-items: center;
  cursor: pointer; overflow: hidden;
  transition: border-color .15s, background-color .15s;
  outline: none;
}
.drop:hover, .drop:focus-visible, .drop.over { border-color: var(--accent); }
.drop:focus-visible { box-shadow: 0 0 0 3px var(--accent-soft); }
.drop.over { background: var(--accent-soft); }
.drop.filled { border-style: solid; border-color: transparent; }
.drop-empty { text-align: center; padding: 12px; color: var(--ink-2); display: grid; justify-items: center; gap: 4px; }
.drop-empty svg { width: 42px; height: 42px; color: var(--accent); margin-bottom: 4px; }
.drop-empty strong { color: var(--ink); font-weight: 600; font-size: 1rem; }
.drop-empty span { font-size: .82rem; line-height: 1.45; max-width: 22ch; }
.drop-preview { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; }
.change-btn {
  margin-top: 10px; width: 100%; padding: 7px 10px; border-radius: 999px;
  border: 1px solid var(--line); background: transparent; font-size: .9rem; font-weight: 500;
}
.change-btn:hover { border-color: var(--accent); color: var(--accent); }

/* controls */
.controls { display: grid; gap: 10px; }
.field { display: grid; gap: 4px; font-size: .92rem; font-weight: 500; }
.field small { font-weight: 400; color: var(--ink-2); }
.field input {
  width: 100%; padding: 11px 14px; border-radius: 12px;
  border: 1px solid var(--line); background: var(--surface); outline: none;
}
.field input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.cta {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  height: 56px; border: 0; border-radius: 999px;
  background: var(--accent); color: var(--accent-ink);
  font-size: 1.15rem; font-weight: 600;
  transition: background-color .15s, transform .1s, opacity .15s;
}
.cta svg { width: 22px; height: 22px; }
.cta:hover:not(:disabled) { background: var(--accent-hover); }
.cta:active:not(:disabled) { transform: scale(.985); }
.cta:disabled { opacity: .42; cursor: not-allowed; }
.hint { margin: 0; text-align: center; font-size: .86rem; color: var(--ink-2); }

/* stage */
.stage {
  position: relative;
  aspect-ratio: 3 / 4;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  overflow: hidden;
}
.stage-empty, .stage-error {
  position: absolute; inset: 0; display: grid; place-content: center; justify-items: center;
  text-align: center; padding: 24px; color: var(--ink-2); gap: 6px;
}
.stage-empty svg { width: 56px; height: 56px; opacity: .45; }
.stage-empty p { margin: 4px 0 0; }
.stage-error svg { width: 44px; height: 44px; color: var(--err); }
.stage-error h3 { margin: 4px 0 0; color: var(--ink); font-size: 1.1rem; }
.stage-error p { margin: 0 0 8px; max-width: 34ch; font-size: .95rem; }
.stage-error details { font-size: .78rem; max-width: 100%; margin-bottom: 8px; }
.stage-error code { display: block; margin-top: 4px; word-break: break-word; white-space: pre-wrap; text-align: left; }

.stage-busy { position: absolute; inset: 0; }
.busy-photo { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; filter: saturate(.6) blur(1px); opacity: .75; }
.scan {
  position: absolute; inset: 0;
  background: linear-gradient(180deg, transparent 0%, color-mix(in srgb, var(--accent) 35%, transparent) 48%, transparent 52%, transparent 100%);
  background-size: 100% 220%;
  animation: scan 2.4s ease-in-out infinite;
  mix-blend-mode: normal;
}
@keyframes scan { 0% { background-position: 0 100%; } 100% { background-position: 0 -10%; } }
.busy-panel {
  position: absolute; left: 12px; right: 12px; bottom: 12px;
  background: var(--scrim); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px;
}
.busy-text { margin: 0 0 8px; font-weight: 600; font-size: .98rem; line-height: 1.4; }
.bar { height: 6px; border-radius: 99px; background: var(--line); overflow: hidden; }
.bar span { display: block; height: 100%; width: 0; background: var(--accent); border-radius: inherit; transition: width .35s ease; }
.busy-row { display: flex; justify-content: space-between; align-items: center; margin-top: 6px; font-size: .85rem; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.link { background: none; border: 0; padding: 2px 4px; color: var(--accent); font-weight: 600; font-size: .88rem; }

/* compare slider */
.compare { position: absolute; inset: 0; user-select: none; -webkit-user-select: none; touch-action: pan-y; cursor: ew-resize; }
.compare img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; pointer-events: none; }
.compare .before { clip-path: inset(0 calc(100% - var(--pos)) 0 0); }
.handle {
  position: absolute; top: 0; bottom: 0; left: var(--pos); width: 2px; margin-left: -1px;
  background: #fff; box-shadow: 0 0 0 1px rgba(0, 0, 0, .15); pointer-events: none;
}
.handle span {
  position: absolute; top: 50%; left: 50%; width: 38px; height: 38px; margin: -19px 0 0 -19px;
  border-radius: 50%; background: #fff; box-shadow: 0 2px 10px rgba(0, 0, 0, .25);
}
.handle span::before, .handle span::after {
  content: ''; position: absolute; top: 50%; width: 0; height: 0; margin-top: -5px;
  border: 5px solid transparent;
}
.handle span::before { left: 7px; border-right: 6px solid #6a5f56; border-left: 0; }
.handle span::after { right: 7px; border-left: 6px solid #6a5f56; border-right: 0; }
.compare input[type=range] {
  position: absolute; inset: 0; width: 100%; height: 100%; margin: 0;
  opacity: 0; pointer-events: none; -webkit-appearance: none; appearance: none;
}
.compare input[type=range]:focus-visible ~ .tag { outline: 2px solid var(--accent); }
.tag {
  position: absolute; top: 10px; font-size: .78rem; font-weight: 600; padding: 2px 10px;
  border-radius: 999px; background: rgba(0, 0, 0, .55); color: #fff; pointer-events: none;
}
.tag-l { left: 10px; }
.tag-r { right: 10px; }

.result-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 12px; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 46px; padding: 0 16px; border-radius: 999px; font-weight: 600; font-size: .98rem;
  text-decoration: none; border: 1px solid transparent; transition: background-color .15s, border-color .15s;
}
.btn svg { width: 18px; height: 18px; }
.btn.primary { background: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { background: var(--accent-hover); }
.btn.ghost { background: transparent; border-color: var(--line); color: var(--ink); }
.btn.ghost:hover { border-color: var(--accent); color: var(--accent); }

/* history */
.history { margin-top: 32px; }
.history h2, .tips h3 { margin: 0; }
.history h2 { font-size: 1.15rem; font-weight: 600; }
.history .sub { margin: 2px 0 12px; color: var(--ink-2); font-size: .9rem; }
.thumbs { display: flex; gap: 10px; overflow-x: auto; padding: 2px 2px 8px; scrollbar-width: thin; }
.thumb {
  position: relative; flex: none; width: 88px; aspect-ratio: 3 / 4; padding: 0;
  border-radius: 12px; overflow: hidden; border: 2px solid var(--line); background: var(--surface-2);
}
.thumb.active { border-color: var(--accent); }
.thumb > img { width: 100%; height: 100%; object-fit: cover; }
.thumb .g {
  position: absolute; right: 4px; bottom: 4px; width: 30px; height: 30px; border-radius: 8px;
  object-fit: cover; background: #fff; border: 1.5px solid #fff; box-shadow: 0 1px 4px rgba(0, 0, 0, .25);
}

/* tips */
.tips { display: grid; gap: 14px; margin: 40px 0 8px; }
@media (min-width: 760px) { .tips { grid-template-columns: repeat(3, 1fr); gap: 18px; } }
.tip { display: flex; gap: 12px; align-items: flex-start; }
.tip-ic {
  width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; flex: none;
  background: var(--accent-soft); color: var(--accent);
}
.tip-ic svg { width: 21px; height: 21px; }
.tip h3 { font-size: 1rem; font-weight: 600; }
.tip p { margin: 2px 0 0; color: var(--ink-2); font-size: .92rem; line-height: 1.6; }

/* footer */
.foot { margin-top: 36px; border-top: 1px solid var(--line); padding: 20px 0 36px; color: var(--ink-2); font-size: .86rem; }
.foot p { margin: 0 0 6px; max-width: 80ch; }

@media (max-width: 420px) {
  .card { padding: 10px; border-radius: 16px; }
  .card-head { margin-bottom: 8px; gap: 8px; }
  .card-head h2 { font-size: .95rem; }
  .num { width: 24px; height: 24px; font-size: .85rem; }
  .drop-empty span { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .scan { animation: none; opacity: .4; }
  .bar span, .cta, .btn { transition: none; }
}

/* garment type picker */
.types { border: 0; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; min-width: 0; }
.types legend { font-size: .92rem; font-weight: 500; padding: 0; margin-bottom: 6px; }
.type { position: relative; display: block; min-width: 0; cursor: pointer; }
.type input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.type > span {
  display: grid; justify-items: center; text-align: center; gap: 1px; height: 100%;
  padding: 10px 6px 9px; border-radius: 14px; border: 1.5px solid var(--line); background: var(--surface);
  transition: border-color .15s, background-color .15s;
}
.type svg { width: 26px; height: 26px; color: var(--ink-2); margin-bottom: 3px; }
.type b { font-weight: 600; font-size: .92rem; line-height: 1.3; }
.type small { font-size: .74rem; color: var(--ink-2); line-height: 1.35; }
.type:hover > span { border-color: var(--accent); }
.type input:checked + span { border-color: var(--accent); background: var(--accent-soft); }
.type input:checked + span svg { color: var(--accent); }
.type input:focus-visible + span { box-shadow: 0 0 0 3px var(--accent-soft); }
.type-hint { margin: -2px 0 0; font-size: .85rem; color: var(--ink-2); line-height: 1.5; }
.fine { margin: -4px 0 0; text-align: center; font-size: .78rem; color: var(--ink-2); }
@media (max-width: 420px) {
  .type small { display: none; }
  .type b { font-size: .85rem; }
}
@media (prefers-reduced-motion: reduce) { .type > span { transition: none; } }
