/* Palette measured on the Roxy "Pop Surf Polynesia" jacket photo */
:root {
  --ink: #1F1D1B;      /* black neoprene */
  --turq: #3BA6B8;     /* printed front panel */
  --turq-deep: #2B8C9C;
  --indigo: #2C3AA8;   /* flowers, sleeve */
  --coral: #F27680;    /* blades */
  --peach: #F1A88A;    /* flower rays, sleeve palms */
  --sun: #F7E3A8;      /* pale leaves */
  --paper: #F7F5F0;    /* zip tape white */
  --radius: 14px;
  --font: "DM Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --display: "Shrikhand", "DM Sans", system-ui, sans-serif;
}

:root[data-theme="dark"] {
  --bg: #1F1D1B;
  --surface: #2A2725;
  --surface-2: #35312E;
  --text: #F7F5F0;
  --muted: #ABA59E;
  --line: #45403B;
  --link: #AAB1FF;
  --bg-line: var(--peach);
  --bg-leaf-opacity: .42;
  --panel-alpha: 80%;
  --shadow: 0 1px 2px rgba(0, 0, 0, .45), 0 10px 24px rgba(0, 0, 0, .28);
  --focus: var(--sun);
  color-scheme: dark;
}

:root[data-theme="light"] {
  --bg: #F7F5F0;
  --surface: #FFFFFF;
  --surface-2: #EFEBE4;
  --text: #1F1D1B;
  --muted: #5E5952;
  --line: #DDD7CC;
  --link: #2C3AA8;
  --bg-line: var(--indigo);
  --bg-leaf-opacity: .30;
  --panel-alpha: 78%;
  --shadow: 0 1px 2px rgba(28, 31, 29, .08), 0 8px 22px rgba(28, 31, 29, .07);
  --focus: var(--indigo);
  color-scheme: light;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font: 15px/1.45 var(--font);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}
[hidden] { display: none !important; }
a { color: var(--link); }
button, input, select { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 6px; }

.i { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }

/* Faint print behind everything */
.bg-leaves { position: fixed; inset: 0; z-index: -1; opacity: var(--bg-leaf-opacity); pointer-events: none; }
.bg-leaves svg { display: block; }

/* ---------------------------------------------------------------- banner */
/* Laid out like the jacket: indigo printed sleeve | printed front with its zip | black sleeve.
   The front panels are the jacket's own print, traced from the photo (tools/trace_jacket.py). */
.banner {
  position: relative; color: var(--paper); overflow: hidden;
  background: var(--indigo) url(/static/print/sleeve.svg) left center / auto 100% no-repeat;  /* ~8x as wide as tall: never repeats */
}
.banner-panel { position: absolute; top: 0; bottom: 0; }
.banner-panel svg { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.panel-right { right: 0; width: max(24%, 300px); }
.jacket-front {  /* between the title label and the black sleeve */
  position: absolute; top: 0; bottom: 0; left: clamp(300px, 34vw, 640px); right: calc(max(24%, 300px) - 96px);
}
.jf-panels {
  position: absolute; inset: 0; display: flex; justify-content: center; overflow: hidden;
  clip-path: polygon(7% 0, 100% 0, 100% 100%, 0 100%, 1.5% 80%, 3.5% 60%, 5% 40%, 6.2% 20%);  /* raglan seam */
}
.fp { flex: none; height: 100%; background-repeat: no-repeat; background-size: 100% 100%; }
.fp-left { aspect-ratio: 1692 / 660; background-image: url(/static/print/front-left.svg); }
.fp-right { aspect-ratio: 1764 / 768; background-image: url(/static/print/front-right.svg); }
.zip-v { flex: 0 0 34px; display: grid; grid-template-columns: 12px 10px 12px; background: var(--ink); }
.zip-v i { background: repeating-linear-gradient(180deg, var(--paper) 0 11px, var(--ink) 11px 22px); }
.zip-v b { background: repeating-linear-gradient(180deg, #4A4541 0 3px, #141210 3px 6px); border-inline: 1px solid #141210; }
.seam-line { fill: none; stroke: var(--ink); stroke-width: 6; vector-effect: non-scaling-stroke; }
.seam-stitch { fill: none; stroke: var(--paper); stroke-width: 1.4; stroke-dasharray: 3 4; opacity: .75; vector-effect: non-scaling-stroke; }
.banner-inner {
  position: relative; padding: 34px 28px 30px max(16px, 4vw);
  display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap;
}
.brand { position: relative; background: var(--ink); padding: 13px 24px; border-radius: 18px; }
.brand::after {  /* flatlock stitching, like the jacket seams */
  content: ""; position: absolute; inset: 5px; border: 1.5px dashed rgba(247, 245, 240, .5); border-radius: 13px; pointer-events: none;
}
.brand h1 {
  margin: 0; font: 400 clamp(21px, 3vw, 36px)/1.08 var(--display); color: var(--sun);
  text-shadow: 3px 3px 0 var(--coral); letter-spacing: .4px;
}
.brand h1 span { display: block; }
.brand h1 .h1-2 { color: var(--coral); text-shadow: 3px 3px 0 var(--indigo); padding-left: .6em; }
.brand p { margin: 6px 0 0; font-size: 13px; color: #CFC9C1; letter-spacing: .3px; }
.banner-actions { display: flex; align-items: center; gap: 10px; background: var(--ink); padding: 8px; border-radius: 999px; }

/* The zip: two striped tapes around the teeth */
.zip { display: grid; grid-template-rows: 9px 8px 9px; background: var(--ink); }
.zip .tape { background: repeating-linear-gradient(90deg, var(--paper) 0 12px, var(--ink) 12px 24px); }
.zip .teeth { background: repeating-linear-gradient(90deg, #4A4541 0 3px, #141210 3px 6px); border-block: 1px solid #141210; }

/* ---------------------------------------------------------------- buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 0; border-radius: 999px; padding: 10px 18px; font-weight: 700; cursor: pointer;
  transition: background .15s, transform .1s;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--turq); color: var(--ink); }
.btn-primary:hover { background: #4FB6C6; }
.btn-primary[disabled] { opacity: .7; cursor: progress; }
.btn-ghost { background: transparent; color: var(--text); box-shadow: inset 0 0 0 1.5px var(--line); }
.btn-ghost:hover { box-shadow: inset 0 0 0 1.5px var(--turq); }
.btn-sm { padding: 7px 14px; font-size: 14px; }
.icon-btn {
  display: inline-grid; place-items: center; width: 38px; height: 38px; border-radius: 50%;
  border: 0; background: var(--surface-2); color: var(--text); cursor: pointer;
}
.icon-btn.on-ink { background: #2E2B28; color: var(--sun); }
.icon-btn.on-ink:hover { background: #3A3633; }
.link-btn { border: 0; background: none; color: var(--link); cursor: pointer; text-decoration: underline; padding: 0; }
:root[data-theme="dark"] .i-moon, :root[data-theme="light"] .i-sun { display: none; }
#update-btn.spinning .i { animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------------------------------------------------------------- update panel */
.update-panel { max-width: 1500px; margin: 12px auto 0; padding: 0 16px; }
.update-box {
  background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 12px 16px; display: grid; gap: 6px; border-left: 5px solid var(--turq);
}
.update-box.has-problem { border-left-color: var(--coral); }
.update-box .u-title { font-weight: 700; display: flex; justify-content: space-between; gap: 12px; }
.update-row {
  display: grid; grid-template-columns: 92px 82px minmax(120px, 1fr) minmax(0, 1.3fr);
  gap: 6px 12px; align-items: center; font-size: 14px;
}
.update-row .pill { justify-self: start; }
.u-count { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.u-count strong { font-variant-numeric: tabular-nums; }
.bar { height: 10px; border-radius: 999px; background: var(--surface-2); overflow: hidden; position: relative; }
.bar > span { display: block; height: 100%; border-radius: inherit; background: var(--turq); transition: width .8s ease; }
.bar.done > span { background: var(--turq); }
.bar.stop > span { background: var(--coral); }
.bar.indet > span { width: 35% !important; animation: indet 1.3s ease-in-out infinite; }
@keyframes indet { from { transform: translateX(-100%); } to { transform: translateX(290%); } }
.pill { font-size: 12px; font-weight: 700; padding: 2px 9px; border-radius: 999px; background: var(--surface-2); }
.pill.ok { background: var(--turq); color: var(--ink); }
.pill.running { background: var(--sun); color: var(--ink); }
.pill.blocked, .pill.error { background: var(--coral); color: var(--ink); }

/* ---------------------------------------------------------------- toolbar */
.toolbar {
  position: sticky; top: 0; z-index: 30;
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.toolbar-inner {
  max-width: 1500px; margin: 0 auto; padding: 10px 16px;
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
}
.tabs { display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; }
.tabs button {
  border: 0; background: none; padding: 8px 12px; border-radius: 999px; cursor: pointer; font-weight: 600;
  color: var(--muted); white-space: nowrap;
}
.tabs button[aria-selected="true"] { background: var(--indigo); color: #fff; }
.tabs .count { font-weight: 500; opacity: .8; font-size: 13px; }
.tabs button[data-view="new"] .count:not(:empty) { color: var(--coral); opacity: 1; font-weight: 800; }
.tabs button[data-view="new"][aria-selected="true"] .count { color: var(--sun); }
.toolbar-tools { display: flex; gap: 8px; align-items: center; flex: 1 1 380px; justify-content: flex-end; }
.search {
  display: flex; align-items: center; gap: 8px; background: var(--surface); border: 1.5px solid var(--line);
  border-radius: 999px; padding: 0 12px; flex: 1 1 200px; max-width: 360px; color: var(--muted);
}
.search input { border: 0; background: none; padding: 8px 0; width: 100%; outline: none; color: var(--text); }
.search:focus-within { border-color: var(--turq); }
select, input[type="text"], input[type="number"], input[type="password"] {
  background: var(--surface); border: 1.5px solid var(--line); border-radius: 10px; padding: 8px 10px; min-width: 0;
}
select:focus, input:focus { outline: none; border-color: var(--turq); }
.filters-toggle { display: none; }
.filters-toggle .count:not(:empty) {
  background: var(--indigo); color: #fff; border-radius: 999px; padding: 0 7px; font-size: 12px;
}

/* ---------------------------------------------------------------- layout */
.layout {
  max-width: 1500px; margin: 0 auto; padding: 18px 16px 60px;
  display: grid; grid-template-columns: 290px minmax(0, 1fr); gap: 26px; align-items: start;
}
.filters {
  position: sticky; top: 74px; max-height: calc(100vh - 90px); overflow-y: auto;
  background: color-mix(in srgb, var(--surface) var(--panel-alpha), transparent); border-radius: var(--radius); box-shadow: var(--shadow); padding: 6px 16px 16px;
  scrollbar-width: thin;
}
.filters-head { display: flex; align-items: center; justify-content: space-between; }
.filters-head h2 { font: 400 22px/1 var(--display); color: var(--coral); margin: 12px 0 6px; }
#filters-close { display: none; }
.f-group { padding: 12px 0; border-bottom: 1px dashed var(--line); display: grid; gap: 8px; }
.f-group h3 { margin: 0; font-size: 12px; letter-spacing: 1.2px; text-transform: uppercase; color: var(--muted); }
.row { display: flex; gap: 8px; align-items: flex-end; }
.row.end { justify-content: flex-end; }
.row > * { flex: 1 1 0; min-width: 0; }
.row > .btn { flex: none; }
.field { display: grid; gap: 4px; font-size: 13px; color: var(--muted); }
.field > input, .field > select { color: var(--text); width: 100%; }
.f-group > input, .f-group > select { width: 100%; }
.hint { margin: 0; font-size: 13px; color: var(--muted); }
.stack { display: grid; gap: 8px; }
.error-line { color: var(--coral); font-weight: 600; }
.origin-label { margin: 0; font-size: 13px; }
.origin-label button { border: 0; background: none; color: var(--coral); cursor: pointer; font-weight: 700; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  border: 1.5px solid var(--line); background: transparent; border-radius: 999px; padding: 5px 12px;
  cursor: pointer; font-size: 14px;
}
.chip[aria-pressed="true"] { background: var(--indigo); border-color: var(--indigo); color: #fff; }
.segmented { display: flex; background: var(--surface-2); border-radius: 999px; padding: 3px; }
.segmented button { flex: 1; border: 0; background: none; border-radius: 999px; padding: 6px 8px; cursor: pointer; font-size: 14px; }
.segmented button[aria-pressed="true"] { background: var(--indigo); color: #fff; }
.reset { margin-top: 14px; width: 100%; }

/* ---------------------------------------------------------------- results */
.results-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin: 0 0 12px; }
.results-head p { margin: 0; color: var(--muted); }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 18px; }

.card {  /* slightly see-through so the palms show behind the listings; the photo stays opaque */
  position: relative; background: color-mix(in srgb, var(--surface) var(--panel-alpha), transparent);
  border-radius: var(--radius); overflow: hidden;
  box-shadow: var(--shadow); display: flex; flex-direction: column; min-width: 0;
}
.card::before {  /* zip tape */
  content: ""; height: 8px; flex: none;
  background: repeating-linear-gradient(90deg, var(--paper) 0 10px, var(--ink) 10px 20px);
  border-bottom: 1px solid var(--ink);
}
.card.is-fav { box-shadow: var(--shadow), inset 0 0 0 2px var(--coral); }
.photo {
  position: relative; aspect-ratio: 3 / 4; background: var(--surface-2); overflow: hidden; cursor: zoom-in;
  border: 0; padding: 0; display: block; width: 100%;
}
.photo .blur {
  position: absolute; inset: -20px; background: var(--img) center / cover no-repeat;
  filter: blur(18px) saturate(1.1); opacity: .55;
}
.photo img { position: relative; width: 100%; height: 100%; object-fit: contain; display: block; }
.photo .no-photo { position: absolute; inset: 0; display: grid; place-items: center; color: var(--muted); font-size: 13px; }
.badges { position: absolute; top: 16px; left: 8px; display: flex; flex-direction: column; gap: 4px; align-items: flex-start; }
.badge {
  font-size: 11.5px; font-weight: 800; letter-spacing: .4px; text-transform: uppercase;
  padding: 3px 8px; border-radius: 6px; color: var(--ink); background: var(--sun);
}
.badge.coral { background: var(--coral); }
.badge.indigo { background: var(--indigo); color: #fff; }
.card-actions { position: absolute; top: 16px; right: 8px; display: flex; flex-direction: column; gap: 6px; }
.card-actions .icon-btn { width: 34px; height: 34px; background: rgba(28, 31, 29, .72); color: var(--paper); }
.card-actions .icon-btn:hover { background: rgba(28, 31, 29, .9); }
.card-actions .fav[aria-pressed="true"] { background: var(--coral); color: var(--ink); }
.card-actions .fav[aria-pressed="true"] .i { fill: currentColor; }
.card-actions .ban { background: var(--coral); color: var(--ink); }
.card-actions .ban:hover { background: #F58D95; }
.admin-pill {
  align-self: center; margin-left: 4px; padding: 4px 10px; border-radius: 999px; background: var(--coral); color: var(--ink);
  font-size: 11.5px; font-weight: 800; letter-spacing: .5px; text-transform: uppercase; white-space: nowrap;
}
.tabs .admin-tab { color: var(--coral); }
.tabs .admin-tab[aria-selected="true"] { background: var(--coral); color: var(--ink); }
.photo-count {
  position: absolute; bottom: 8px; right: 8px; font-size: 12px; background: rgba(28, 31, 29, .72); color: var(--paper);
  padding: 2px 8px; border-radius: 999px; display: flex; align-items: center; gap: 4px;
}
.photo-count .i { width: 13px; height: 13px; }

.body { padding: 10px 12px 12px; display: grid; gap: 5px; flex: 1; align-content: start; }
.price-row { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.price { font-size: 22px; font-weight: 800; letter-spacing: -.3px; }
.price-sub { font-size: 12.5px; color: var(--muted); }
.title {
  color: var(--text); text-decoration: none; font-weight: 600; line-height: 1.3;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.title:hover { color: var(--link); text-decoration: underline; }
.specs, .loc { font-size: 13.5px; color: var(--muted); display: flex; flex-wrap: wrap; gap: 4px 6px; align-items: center; }
.specs strong { color: var(--text); font-weight: 700; }
.est { font-size: 11px; border: 1px dashed var(--muted); border-radius: 4px; padding: 0 4px; }
.type { font-weight: 700; color: var(--text); }
.ai-badge {
  display: inline-flex; align-items: center; gap: 3px; font-size: 11px; font-weight: 700;
  color: var(--ink); background: var(--turq); border-radius: 4px; padding: 1px 5px;
}
.ai-badge .i { width: 12px; height: 12px; }
.loc .i { width: 14px; height: 14px; }
.tags { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 2px; }
.tag {
  font-size: 12px; font-weight: 700; padding: 2px 8px; border-radius: 999px; background: var(--surface-2); color: var(--text);
  white-space: nowrap;
}
.tag.sun { background: var(--sun); color: var(--ink); }
.tag.outline { background: none; box-shadow: inset 0 0 0 1.5px var(--line); color: var(--muted); }
.foot { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-top: 4px; font-size: 12.5px; color: var(--muted); }
.src { display: inline-flex; align-items: center; gap: 6px; font-weight: 700; color: var(--text); }
.src::before { content: ""; width: 9px; height: 9px; border-radius: 50%; background: var(--dot); }
.src-alltroc { --dot: var(--turq); }
.src-vinted { --dot: #8F97F2; }
.src-leboncoin { --dot: var(--sun); }
.dups { font-size: 12.5px; border-top: 1px dashed var(--line); padding-top: 6px; margin-top: 2px; }
.dups a { font-weight: 600; }
.restore { margin-top: 6px; }

.empty {
  text-align: center; padding: 60px 16px; color: var(--muted); display: grid; justify-items: center; gap: 10px;
}
.empty svg { width: 150px; height: 140px; }
.empty h3 { margin: 0; color: var(--text); font: 400 24px/1.2 var(--display); }

/* ---------------------------------------------------------------- dialogs */
.modal {
  border: 0; padding: 0; border-radius: 18px; background: var(--surface); color: var(--text);
  width: min(920px, calc(100vw - 32px)); max-height: calc(100vh - 40px); box-shadow: 0 20px 60px rgba(0, 0, 0, .45);
}
.modal-sm { width: min(520px, calc(100vw - 32px)); }
.modal::backdrop { background: rgba(28, 31, 29, .6); }
.modal::before {
  content: ""; display: block; height: 10px;
  background: repeating-linear-gradient(90deg, var(--paper) 0 12px, var(--ink) 12px 24px);
  border-bottom: 1px solid var(--ink);
}
.modal-body { padding: 14px 20px 20px; display: grid; gap: 12px; }
.modal-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.modal-head h2 { margin: 0; font-size: 20px; line-height: 1.3; }
.modal h3 { margin: 6px 0 0; font-size: 12px; letter-spacing: 1.2px; text-transform: uppercase; color: var(--muted); }
.gallery { display: flex; gap: 10px; overflow-x: auto; scroll-snap-type: x mandatory; padding-bottom: 6px; }
.gallery img {
  height: min(52vh, 460px); max-width: 85%; object-fit: contain; border-radius: 10px;
  background: var(--surface-2); scroll-snap-align: start; flex: none;
}
.facts { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 8px 16px; margin: 0; }
.facts div { display: grid; }
.facts dt { font-size: 12px; color: var(--muted); }
.facts dd { margin: 0; font-weight: 600; }
.desc { white-space: pre-wrap; margin: 0; font-size: 14.5px; background: var(--surface-2); border-radius: 10px; padding: 12px; }
.status-line { margin: 0; font-weight: 700; }
.details-actions { justify-content: space-between; align-items: center; flex-wrap: wrap; }
.details-actions .tags { flex: 1 1 auto; }

/* ---------------------------------------------------------------- responsive */
@media (max-width: 980px) {
  .layout { grid-template-columns: minmax(0, 1fr); }
  .filters-toggle { display: inline-flex; }
  #filters-close { display: inline-grid; }
  .filters {
    position: fixed; z-index: 50; top: 0; left: 0; bottom: 0; width: min(92vw, 380px);
    max-height: none; border-radius: 0 18px 18px 0; transform: translateX(-105%); transition: transform .22s ease;
  }
  .filters.open { transform: none; }
  .scrim { position: fixed; inset: 0; z-index: 45; background: rgba(28, 31, 29, .55); }
}
@media (max-width: 640px) {
  body { font-size: 14px; }
  .update-row { grid-template-columns: 80px 1fr; }
  .update-row .bar, .update-row .u-count { grid-column: 1 / -1; }
  .panel-right { display: none; }
  .jacket-front { left: 0; right: 0; }
  .jf-panels { clip-path: none; }
  .jacket-front .seam { display: none; }
  .banner-inner { padding: 18px 12px 16px; }
  .brand { padding: 9px 15px; }
  .brand p { display: none; }
  .banner-actions { padding: 6px; gap: 6px; }
  #update-btn span { display: none; }
  #update-btn { padding: 10px; }
  .toolbar-tools { flex-basis: 100%; flex-wrap: wrap; }
  .search { max-width: none; flex-basis: 100%; }
  #sort { flex: 1; }
  .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .body { padding: 8px 9px 10px; gap: 3px; }
  .price { font-size: 18px; }
  .title { font-size: 13.5px; }
  .specs, .loc { font-size: 12.5px; }
  .tag { font-size: 11px; padding: 1px 6px; }
  .card-actions .icon-btn { width: 30px; height: 30px; }
  .modal-body { padding: 12px 14px 16px; }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}
