/* Wardrobe Connect, try it on. One page, light and dark. */

:root {
  --bg: #f6f3ee;
  --surface: #ffffff;
  --surface-2: #faf8f4;
  --ink: #1d1b19;
  --muted: #6a645b;
  --line: #e4ded4;
  --accent: #a94a24;
  --accent-hover: #933e1c;
  --accent-ink: #ffffff;
  --accent-soft: #f5e6dd;
  --ok: #2f6a4c;
  --warn-bg: #fff5dc;
  --warn-ink: #6b4b00;
  --error-bg: #fdecea;
  --error-ink: #8a2516;
  --focus: #2b62d9;
  --shadow: 0 1px 2px rgba(29, 27, 25, 0.05), 0 8px 24px rgba(29, 27, 25, 0.06);
  --radius: 16px;
  --radius-sm: 10px;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, "Times New Roman", serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #151312;
    --surface: #1f1c1a;
    --surface-2: #252220;
    --ink: #f1ece5;
    --muted: #aaa298;
    --line: #36312c;
    --accent: #e98a5e;
    --accent-hover: #f29b72;
    --accent-ink: #1b0f09;
    --accent-soft: #3a2519;
    --ok: #7cc79f;
    --warn-bg: #3a2f12;
    --warn-ink: #f3dc9b;
    --error-bg: #3d1d18;
    --error-ink: #ffb7a8;
    --focus: #8fb2ff;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 8px 24px rgba(0, 0, 0, 0.25);
    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --bg: #151312;
  --surface: #1f1c1a;
  --surface-2: #252220;
  --ink: #f1ece5;
  --muted: #aaa298;
  --line: #36312c;
  --accent: #e98a5e;
  --accent-hover: #f29b72;
  --accent-ink: #1b0f09;
  --accent-soft: #3a2519;
  --ok: #7cc79f;
  --warn-bg: #3a2f12;
  --warn-ink: #f3dc9b;
  --error-bg: #3d1d18;
  --error-ink: #ffb7a8;
  --focus: #8fb2ff;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 8px 24px rgba(0, 0, 0, 0.25);
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.5 var(--sans);
  overflow-x: hidden;
}

img { max-width: 100%; display: block; }
a { color: var(--accent); }
a:hover { color: var(--accent-hover); }

:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 6px; }

.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: absolute; left: -999px; top: 8px; background: var(--surface); padding: 8px 12px; z-index: 10; }
.skip:focus { left: 8px; }

.wrap { width: 100%; max-width: 1080px; margin-left: auto; margin-right: auto; padding-left: 16px; padding-right: 16px; }
@media (min-width: 720px) { .wrap { padding-left: 24px; padding-right: 24px; } }

/* Header */
.top { border-bottom: 1px solid var(--line); background: var(--surface); }
.top-inner { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 64px; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; min-width: 0; }
.brand:hover { color: var(--ink); }
.brand-mark { width: 30px; height: 30px; color: var(--accent); flex: none; }
.brand-text { display: flex; flex-direction: column; line-height: 1.15; min-width: 0; }
.brand-name { font-family: var(--serif); font-size: 1.15rem; font-weight: 700; letter-spacing: 0.01em; }
.brand-sub { font-size: 0.78rem; color: var(--muted); }
.pill {
  flex: none; font-size: 0.8rem; font-weight: 600; padding: 4px 10px; border-radius: 999px;
  background: var(--accent-soft); color: var(--accent);
}

/* Hero */
.hero { padding-top: 28px; padding-bottom: 8px; }
.hero h1 {
  font-family: var(--serif); font-weight: 700; font-size: clamp(1.7rem, 5.4vw, 2.75rem);
  line-height: 1.12; margin: 0 0 12px; letter-spacing: -0.01em; max-width: 22ch;
}
.hero h1 em { font-style: italic; color: var(--accent); }
.lede { margin: 0; color: var(--muted); max-width: 62ch; font-size: 1.02rem; }

/* Progress nav */
.steps-nav { padding-top: 18px; padding-bottom: 6px; }
.steps { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
.steps li {
  display: flex; align-items: center; gap: 8px; min-width: 0;
  padding: 8px 10px; border-radius: 999px; background: var(--surface); border: 1px solid var(--line);
  color: var(--muted); font-size: 0.86rem;
}
.steps .n {
  flex: none; width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center;
  font-size: 0.75rem; font-weight: 700; background: var(--surface-2); border: 1px solid var(--line);
}
.steps .l { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.steps li.is-done { color: var(--ink); }
.steps li.is-done .n { background: var(--ok); border-color: var(--ok); color: var(--surface); }
.steps li.is-current { color: var(--ink); border-color: var(--accent); }
.steps li.is-current .n { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
@media (max-width: 480px) {
  .steps li { padding: 6px; justify-content: center; flex-direction: column; gap: 2px; border-radius: 12px; font-size: 0.72rem; }
}

/* Cards */
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding-top: 20px; padding-bottom: 22px;
  width: auto; margin: 16px 16px 0;
}
@media (min-width: 720px) { .card { padding-top: 26px; padding-bottom: 28px; margin: 18px 24px 0; } }
@media (min-width: 1128px) { .card { max-width: 1032px; margin-left: auto; margin-right: auto; } }
.step.is-locked { opacity: 0.55; }
.step.is-locked .listings, .step.is-locked .photo-grid, .step.is-locked .actions, .step.is-locked .privacy { pointer-events: none; }
#step-result.is-locked .result { display: none; }

.step-head { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.step-num {
  flex: none; width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center;
  font-weight: 700; background: var(--accent-soft); color: var(--accent);
}
.step-head h2 { font-family: var(--serif); font-size: clamp(1.25rem, 3.6vw, 1.6rem); margin: 0; line-height: 1.2; }
.step-head h2:focus { outline: none; }

/* Segmented control */
.seg {
  display: inline-grid; grid-template-columns: 1fr 1fr; gap: 4px; padding: 4px; border-radius: 12px;
  background: var(--surface-2); border: 1px solid var(--line); margin-bottom: 14px; max-width: 100%;
}
.seg button {
  font: inherit; font-size: 0.92rem; font-weight: 600; border: 0; border-radius: 9px; padding: 8px 14px;
  background: transparent; color: var(--muted); cursor: pointer; min-height: 40px;
}
.seg button[aria-selected="true"] { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }

/* Fields */
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; min-width: 0; }
.label { font-weight: 600; font-size: 0.92rem; }
.opt { font-weight: 400; color: var(--muted); font-size: 0.82rem; }
.hint { color: var(--muted); font-size: 0.84rem; }
input[type="text"], input[type="url"], input[type="number"], textarea, select {
  font: inherit; color: var(--ink); background: var(--surface-2); width: 100%; min-width: 0;
  border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 11px 12px; min-height: 46px;
}
textarea { resize: vertical; min-height: 70px; }
input:focus, textarea:focus, select:focus { border-color: var(--focus); outline: 2px solid transparent; box-shadow: 0 0 0 3px color-mix(in srgb, var(--focus) 25%, transparent); }
.prefixed { position: relative; display: block; }
.prefixed .prefix { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.prefixed input { padding-left: 34px; }
.grid-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 12px; }
@media (min-width: 820px) { .grid-fields { grid-template-columns: repeat(4, minmax(0, 1fr)); } }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font: inherit; font-weight: 650; text-decoration: none; cursor: pointer;
  border-radius: 12px; border: 1px solid transparent; padding: 11px 18px; min-height: 46px;
  transition: background-color 0.15s ease, border-color 0.15s ease, transform 0.05s ease;
}
.btn:active { transform: translateY(1px); }
.btn svg { width: 20px; height: 20px; flex: none; }
.btn-primary { background: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { background: var(--accent-hover); color: var(--accent-ink); }
.btn-secondary { background: var(--surface); color: var(--ink); border-color: var(--line); }
.btn-secondary:hover { border-color: var(--muted); color: var(--ink); }
.btn-quiet { background: transparent; color: var(--accent); padding-left: 10px; padding-right: 10px; }
.btn-quiet:hover { background: var(--accent-soft); }
.btn-small { min-height: 38px; padding: 7px 12px; font-size: 0.9rem; }
.btn-big { min-height: 54px; font-size: 1.05rem; padding-left: 26px; padding-right: 26px; }
.btn-block { width: 100%; }
.btn[disabled], .btn[aria-disabled="true"] { opacity: 0.5; cursor: not-allowed; transform: none; }
label.btn:focus-within { outline: 3px solid var(--focus); outline-offset: 2px; }

.actions { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 16px; margin-top: 4px; }
.status { margin: 0; color: var(--muted); font-size: 0.92rem; min-height: 1.4em; }
.status.is-error { color: var(--error-ink); }
.muted { color: var(--muted); }
.small { font-size: 0.86rem; }
.fine { color: var(--muted); font-size: 0.8rem; margin: 12px 0 0; }

/* Listings */
.listings { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-top: 12px; }
@media (min-width: 640px) { .listings { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (min-width: 900px) { .listings { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; } }
.listing {
  position: relative; display: flex; flex-direction: column; text-align: left; min-width: 0;
  font: inherit; color: var(--ink); background: var(--surface-2); cursor: pointer; padding: 0;
  border: 1px solid var(--line); border-radius: 14px; overflow: hidden;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
}
.listing:hover { border-color: var(--muted); transform: translateY(-1px); }
.listing[aria-pressed="true"] { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 35%, transparent); }
.listing-img { width: 100%; aspect-ratio: 3 / 4; object-fit: cover; background: var(--line); }
.listing-body { padding: 10px 10px 12px; display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.listing-price { font-weight: 750; font-size: 1.02rem; }
.listing-title {
  font-size: 0.86rem; line-height: 1.3; color: var(--ink);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere;
}
.listing-meta { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 2px; }
.chip {
  font-size: 0.72rem; padding: 2px 7px; border-radius: 999px; background: var(--surface);
  border: 1px solid var(--line); color: var(--muted); white-space: nowrap; max-width: 100%; overflow: hidden; text-overflow: ellipsis;
}
.chip-ok { color: var(--ok); border-color: color-mix(in srgb, var(--ok) 40%, transparent); }
.listing-check {
  position: absolute; top: 8px; right: 8px; width: 28px; height: 28px; border-radius: 50%;
  background: var(--accent); color: var(--accent-ink); display: none; place-items: center; box-shadow: var(--shadow);
}
.listing[aria-pressed="true"] .listing-check { display: grid; }
.listing-check svg { width: 16px; height: 16px; }
.skeleton { border-radius: 14px; background: linear-gradient(90deg, var(--surface-2), var(--line), var(--surface-2)); background-size: 200% 100%; animation: shimmer 1.2s infinite linear; aspect-ratio: 3 / 5; }
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }
@media (prefers-reduced-motion: reduce) { .skeleton { animation: none; } }

/* Photo step */
.photo-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; }
@media (min-width: 760px) { .photo-grid { grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: 24px; } }
.chosen {
  display: flex; align-items: center; gap: 12px; padding: 10px; border-radius: 12px;
  background: var(--surface-2); border: 1px solid var(--line); margin-bottom: 14px;
}
.chosen img { width: 56px; height: 70px; object-fit: cover; border-radius: 8px; flex: none; background: var(--line); }
.chosen-text { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.chosen-text .label { font-size: 0.75rem; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; }
.chosen-title { font-size: 0.9rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chosen-price { font-weight: 700; font-size: 0.92rem; }
.photo-buttons { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 16px; }
.photo-buttons .btn { flex: 1 1 160px; }
.only-touch { display: none; }
@media (pointer: coarse) { .only-touch { display: inline-flex; } }
.tips { margin: 0; padding-left: 20px; color: var(--muted); font-size: 0.9rem; }
.tips li { margin: 3px 0; }
.preview {
  border: 1.5px dashed var(--line); border-radius: var(--radius); background: var(--surface-2);
  min-height: 260px; display: grid; place-items: center; overflow: hidden; aspect-ratio: 3 / 4; max-height: 520px; width: 100%;
}
.preview img { width: 100%; height: 100%; object-fit: contain; }
.preview-empty { display: flex; flex-direction: column; align-items: center; gap: 8px; color: var(--muted); font-size: 0.9rem; padding: 20px; text-align: center; }
.preview-empty svg { width: 56px; height: 56px; }
.privacy {
  display: flex; gap: 10px; align-items: flex-start; margin: 18px 0 16px; padding: 12px 14px; border-radius: 12px;
  background: var(--accent-soft); color: var(--ink); font-size: 0.88rem;
}
.privacy svg { width: 20px; height: 20px; flex: none; color: var(--accent); margin-top: 1px; }

.banner { border-radius: 12px; padding: 12px 14px; margin-bottom: 14px; font-size: 0.92rem; }
.banner p { margin: 0 0 8px; }
.banner p:last-child { margin-bottom: 0; }
.banner-warn { background: var(--warn-bg); color: var(--warn-ink); }
.banner-error { background: var(--error-bg); color: var(--error-ink); }

/* Progress */
.progress { display: flex; gap: 16px; align-items: flex-start; padding: 6px 0 4px; }
.spinner {
  flex: none; width: 36px; height: 36px; border-radius: 50%;
  border: 3px solid var(--line); border-top-color: var(--accent); animation: spin 0.9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation-duration: 3s; } }
.progress-title { font-weight: 700; margin: 4px 0 8px; }
.progress-steps { margin: 0 0 8px; padding-left: 20px; color: var(--muted); font-size: 0.92rem; }
.progress-steps li { margin: 2px 0; }
.progress-steps li.is-done { color: var(--ok); }
.progress-steps li.is-now { color: var(--ink); font-weight: 600; }

/* Result */
.result { display: grid; grid-template-columns: minmax(0, 1fr); gap: 20px; }
@media (min-width: 860px) { .result { grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); gap: 28px; align-items: start; } }
.compare {
  position: relative; width: 100%; aspect-ratio: 3 / 4; max-height: 78vh; border-radius: var(--radius); overflow: hidden;
  background: var(--surface-2); border: 1px solid var(--line); user-select: none; touch-action: pan-y;
}
.compare-img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; }
.compare-after { position: absolute; inset: 0; clip-path: inset(0 0 0 50%); }
.compare-line { position: absolute; top: 0; bottom: 0; left: 50%; width: 3px; margin-left: -1.5px; background: var(--surface); box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.15); pointer-events: none; }
.compare-knob {
  position: absolute; top: 50%; left: 50%; width: 40px; height: 40px; margin: -20px 0 0 -20px; border-radius: 50%;
  background: var(--surface); box-shadow: var(--shadow); border: 2px solid var(--accent);
}
.compare-knob::before, .compare-knob::after {
  content: ""; position: absolute; top: 50%; width: 0; height: 0; margin-top: -6px;
  border-top: 6px solid transparent; border-bottom: 6px solid transparent;
}
.compare-knob::before { left: 7px; border-right: 7px solid var(--accent); }
.compare-knob::after { right: 7px; border-left: 7px solid var(--accent); }
.compare-range {
  position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: ew-resize; touch-action: pan-y;
}
.compare-range:focus-visible + .compare-line, .compare:focus-within .compare-knob { box-shadow: 0 0 0 3px var(--focus); }
.tag {
  position: absolute; top: 10px; font-size: 0.75rem; font-weight: 700; padding: 4px 9px; border-radius: 999px;
  background: rgba(20, 18, 17, 0.72); color: #fff; pointer-events: none;
}
.tag-left { left: 10px; }
.tag-right { right: 10px; }

.buy { background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; min-width: 0; }
.buy-img { width: 96px; height: 120px; object-fit: cover; border-radius: 10px; background: var(--line); float: right; margin: 0 0 8px 12px; }
.buy-title { font-size: 1rem; font-weight: 600; line-height: 1.35; margin: 0 0 8px; overflow-wrap: anywhere; }
.buy-price { margin: 0 0 4px; }
#buy-price { font-size: 1.6rem; font-weight: 800; font-family: var(--serif); }
.buy-meta { margin: 0 0 14px; color: var(--muted); font-size: 0.9rem; clear: both; }
.buy-more { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }

/* Footer */
.foot { color: var(--muted); font-size: 0.86rem; padding-top: 28px; padding-bottom: 40px; }
.foot p { margin: 4px 0; }
