:root {
  --ink: #211c19;
  --paper: #f6f1e9;
  --white: #fffdf9;
  --rose: #bd746c;
  --wine: #713d3d;
  --line: #d9d0c3;
  --muted: #766e67;
  --shadow: 0 20px 55px rgba(58, 39, 29, 0.1);
}

* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: "DM Sans", sans-serif;
}

button, input, select { font: inherit; }

.hero {
  min-height: 610px;
  padding: 28px clamp(24px, 6vw, 92px) 48px;
  background:
    radial-gradient(circle at 83% 24%, rgba(232, 179, 167, 0.5), transparent 28%),
    linear-gradient(135deg, #f8f1e8 0%, #ead8ca 100%);
  display: grid;
  grid-template-rows: auto 1fr auto;
  overflow: hidden;
  position: relative;
}

.hero:after {
  content: "";
  position: absolute;
  width: 380px;
  height: 380px;
  border: 1px solid rgba(113, 61, 61, 0.2);
  border-radius: 50%;
  right: -80px;
  bottom: -140px;
  box-shadow: 0 0 0 70px rgba(255, 255, 255, 0.12), 0 0 0 140px rgba(255, 255, 255, 0.08);
}

nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: relative;
  z-index: 1;
}

.wordmark {
  font-size: 17px;
  letter-spacing: 0.34em;
  font-weight: 600;
}

.eyebrow, .kicker {
  text-transform: uppercase;
  letter-spacing: 0.18em;
  font-size: 11px;
  font-weight: 600;
}

.hero-copy {
  align-self: center;
  position: relative;
  z-index: 1;
  max-width: 800px;
}

.kicker {
  color: var(--wine);
  margin: 0 0 16px;
}

.hero h1 {
  font-family: "Playfair Display", serif;
  font-size: clamp(54px, 8vw, 104px);
  line-height: 0.9;
  letter-spacing: -0.045em;
  margin: 0;
}

.hero h1 em { color: var(--wine); }

.intro {
  font-size: 16px;
  line-height: 1.65;
  color: #5f554e;
  max-width: 620px;
  margin: 30px 0 0;
}

.metrics {
  display: flex;
  gap: 12px;
  position: relative;
  z-index: 1;
  flex-wrap: wrap;
}

.metric {
  border: 1px solid rgba(113, 61, 61, 0.2);
  background: rgba(255, 253, 249, 0.5);
  backdrop-filter: blur(8px);
  padding: 15px 18px;
  min-width: 125px;
}

.metric strong { display: block; font-family: "Playfair Display", serif; font-size: 30px; }
.metric span { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.12em; }

main {
  max-width: 1500px;
  margin: auto;
  padding: 0 clamp(20px, 5vw, 72px) 80px;
}

.toolbar {
  position: sticky;
  top: 0;
  z-index: 10;
  margin: 0 calc(clamp(20px, 5vw, 72px) * -1);
  padding: 20px clamp(20px, 5vw, 72px);
  background: rgba(246, 241, 233, 0.92);
  backdrop-filter: blur(18px);
  border-bottom: 1px solid var(--line);
  display: flex;
  gap: 18px;
  align-items: flex-end;
}

.search { flex: 1; min-width: 230px; }

.search span, .select {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--muted);
}

input, select {
  display: block;
  border: 0;
  border-bottom: 1px solid #9f9388;
  background: transparent;
  padding: 9px 3px;
  width: 100%;
  outline: none;
  color: var(--ink);
}

input:focus, select:focus { border-color: var(--wine); }

.filters { display: flex; gap: 7px; flex-wrap: wrap; }

.filter {
  border: 1px solid var(--line);
  background: var(--white);
  padding: 9px 13px;
  border-radius: 99px;
  font-size: 12px;
  cursor: pointer;
  color: var(--ink);
}

.filter.active { background: var(--wine); border-color: var(--wine); color: white; }

.select { width: 130px; }

.results-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  padding: 58px 0 24px;
}

.results-heading h2, .failures h2, .empty h2 {
  font-family: "Playfair Display", serif;
  font-size: 38px;
  margin: 0;
}

.legend { display: flex; gap: 18px; font-size: 12px; color: var(--muted); }

.dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; margin-right: 6px; }
.dot.parsed { background: #597b67; }
.dot.review { background: #c48b4f; }

.catalog {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 20px;
}

.card {
  background: var(--white);
  border: 1px solid #e2d9ce;
  box-shadow: 0 1px 0 rgba(50, 35, 25, 0.03);
  min-width: 0;
  transition: 0.25s ease;
}

.card:hover { transform: translateY(-4px); box-shadow: var(--shadow); }

.image-wrap {
  aspect-ratio: 1 / 1;
  background: #eee6dd;
  overflow: hidden;
  position: relative;
}

.image-wrap img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.45s ease; }

.card:hover img { transform: scale(1.025); }

.badge {
  position: absolute;
  top: 12px;
  left: 12px;
  background: rgba(255, 253, 249, 0.9);
  backdrop-filter: blur(8px);
  padding: 7px 9px;
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.14em;
}

.card-body { padding: 18px; }
.brand { font-size: 10px; text-transform: uppercase; letter-spacing: 0.16em; color: var(--wine); font-weight: 600; }
.card h3 { font-family: "Playfair Display", serif; font-size: 23px; line-height: 1.05; margin: 10px 0 15px; }

.details {
  border-top: 1px solid var(--line);
  padding-top: 12px;
  display: grid;
  gap: 8px;
  font-size: 12px;
}

.detail { display: flex; justify-content: space-between; gap: 12px; }
.detail span:first-child { color: var(--muted); }
.detail span:last-child { text-align: right; overflow-wrap: anywhere; }

.card-actions { display: flex; justify-content: space-between; align-items: center; margin-top: 17px; gap: 12px; }

.source, .palette-link {
  color: var(--wine);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  text-decoration: none;
  border-bottom: 1px solid;
}

.palette-link { color: #6d3d2a; }
.palette-link.disabled { color: #9a8c80; border-bottom-color: transparent; cursor: not-allowed; opacity: 0.7; }
.status { font-size: 10px; color: #597b67; }
.palette-note { margin: 9px 0 0; font-size: 11px; color: #8a7c72; }
.inclusion-filters { border-left:1px solid var(--line); padding-left:14px; }

.card-palette-toggle { display:flex; align-items:center; gap:9px; margin-top:12px; padding:10px 11px; border:1px solid var(--line); border-radius:9px; background:#f8f3ed; color:#4e463f; font-size:12px; font-weight:600; cursor:pointer; }
.card-palette-toggle input { width:22px; height:22px; flex:0 0 22px; accent-color:var(--wine); }

.palette-preview {
  margin-top: 14px;
  border: 1px solid var(--line);
  background: #f7f1e9;
  position: relative;
  aspect-ratio: 1.8 / 1;
  overflow: hidden;
}

.palette-preview img { width: 100%; height: 100%; object-fit: cover; }

.failures {
  margin-top: 80px;
  border-top: 1px solid var(--line);
  padding-top: 42px;
  display: grid;
  grid-template-columns: 1fr 2fr;
  gap: 40px;
}

.failure {
  padding: 15px 0;
  border-bottom: 1px solid var(--line);
  display: grid;
  grid-template-columns: 140px 1fr auto;
  gap: 18px;
  font-size: 12px;
}

.failure a { color: var(--wine); overflow-wrap: anywhere; }

.empty { padding: 100px 0; text-align: center; }

footer {
  padding: 28px clamp(24px, 6vw, 92px);
  background: var(--ink);
  color: #f5eee7;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

footer p { font-size: 11px; color: #bdb2aa; }

.palette-page { background: var(--paper); padding: 0 0 72px; }
.palette-page > main { max-width:none; padding-top:0; }
.palette-shell { max-width: 1240px; margin: 0 auto; padding: 34px clamp(16px, 5vw, 72px); }

.palette-hero {
  min-height: 480px;
  padding: 26px clamp(24px, 6vw, 92px) 48px;
  background: radial-gradient(circle at 83% 24%,rgba(232,179,167,.5),transparent 28%),linear-gradient(135deg,#f8f1e8 0%,#ead8ca 100%);
  overflow:hidden;
  position:relative;
}
.palette-hero:after { content:""; position:absolute; width:340px; height:340px; border:1px solid rgba(113,61,61,.2); border-radius:50%; right:-70px; bottom:-145px; box-shadow:0 0 0 65px rgba(255,255,255,.12),0 0 0 130px rgba(255,255,255,.08); }
.palette-hero__inner { max-width:1500px; margin:0 auto; position:relative; z-index:1; }
.palette-logo { display:inline-flex; align-items:center; }
.palette-logo img { width:172px; height:auto; display:block; }
.palette-hero__copy { max-width:900px; margin-top:76px; }
.palette-hero .palette-title { margin:0; font-size:clamp(54px,8vw,104px); letter-spacing:-.045em; }
.palette-hero .palette-title em { color:var(--wine); }
.palette-hero .intro { margin-top:24px; }

.palette-nav { display: flex; justify-content: space-between; align-items: center; }
.catalog-nav-links { display:flex; align-items:center; justify-content:flex-end; gap:10px; flex-wrap:wrap; }
.hero .catalog-nav-links a { color:#fff; text-decoration:none; border:1px solid rgba(255,255,255,.38); padding:10px 13px; font-size:12px; }

.palette-title {
  font-family: "Playfair Display", serif;
  font-size: clamp(40px, 7vw, 80px);
  line-height: 0.95;
  margin: 30px 0 10px;
}

.palette-grid {
  display: grid;
  grid-template-columns: 1.1fr 1fr;
  gap: 28px;
}

.palette-card {
  background: var(--white);
  border: 1px solid var(--line);
  padding: 16px;
}

.palette-image {
  margin: 0;
  border: 1px solid var(--line);
  background: #f2ece3;
}

.palette-image img { width: 100%; display: block; }

.palette-swatches {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.palette-product-choice {
  color: var(--ink);
  text-decoration: none;
  text-align: center;
  min-width: 0;
  display: grid;
  justify-items: center;
  gap: 7px;
  padding: 10px 6px 14px;
  border-radius: 16px;
  transition: background .2s ease, transform .2s ease;
}

.palette-product-choice-wrap { position: relative; min-width: 0; border-radius: 16px; }
.palette-product-choice-wrap:focus-within { outline: 3px solid rgba(113,61,61,.22); outline-offset: 2px; }

.palette-product-choice:hover { background: #f5eee6; transform: translateY(-2px); }
.palette-product-choice strong { font-family: "Playfair Display", serif; font-size: 15px; line-height: 1.1; }
.palette-product-choice > span:last-child { color: var(--muted); font-size: 10px; text-transform: uppercase; letter-spacing: .1em; }

.palette-favorite {
  min-height: 48px;
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding: 10px 15px;
  border: 1px solid #cfc4b8;
  border-radius: 999px;
  background: #fff;
  color: var(--wine);
  cursor: pointer;
  font: inherit;
}
.palette-favorite span { font-size: 24px; line-height: 1; }
.palette-favorite strong { font-size: 13px; }
.palette-favorite:hover, .palette-favorite.is-favorite { border-color: var(--wine); background: #f6e9e7; }
.palette-favorite:focus-visible { outline: 3px solid rgba(113,61,61,.28); outline-offset: 2px; }
.palette-favorite:disabled { cursor: wait; opacity: .65; }
.palette-favorite--compact { position: absolute; z-index: 2; top: 4px; right: 4px; width: 46px; min-height: 46px; justify-content: center; padding: 0; box-shadow: 0 5px 14px rgba(58,39,29,.12); }
.palette-favorite-row { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin: 10px 0 16px; }
.palette-favorite-row p, .palette-client-status { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.5; }
.palette-client-status { margin: 12px 0; padding: 12px 14px; border-left: 3px solid var(--wine); background: #f8f1eb; }
.palette-client-status a, .palette-favorite-row a { color: var(--wine); font-weight: 600; }
.palette-btn--favorite { color: var(--wine); }

.picker-swatch {
  width: 82px;
  height: 126px;
  display: block;
  overflow: hidden;
  border-radius: 48% 48% 42% 42% / 34% 34% 58% 58%;
  border: 1px solid rgba(33, 28, 25, .12);
  background: #eee5dc;
  box-shadow: inset 0 0 0 4px rgba(255,255,255,.55), 0 7px 18px rgba(58,39,29,.12);
}

.palette-result-count {
  grid-column: 1 / -1;
  margin: 0 0 4px;
  color: var(--muted);
  font-size: 12px;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.picker-swatch img { width: 100%; height: 100%; object-fit: cover; display: block; }
.picker-swatch-empty { background: repeating-linear-gradient(135deg,#eee5dc,#eee5dc 8px,#f7f2ec 8px,#f7f2ec 16px); }

.palette-filter-bar {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  margin: 18px 0 22px;
  padding: 14px;
  border: 1px solid var(--line);
  background: #f8f3ed;
}
.palette-filter-bar label > span { display:block; margin-bottom:6px; color:var(--muted); font-size:10px; font-weight:600; letter-spacing:.12em; text-transform:uppercase; }
.palette-filter-bar input { width:100%; min-height:54px; padding:12px 16px; border:1px solid #d4ccc3; border-radius:12px; background:#fff; font-size:16px; }
.touch-filter { min-width:0; margin:0; padding:0; border:0; display:flex; gap:10px; overflow-x:auto; overscroll-behavior-inline:contain; scroll-snap-type:x proximity; -webkit-overflow-scrolling:touch; }
.touch-filter legend { margin-bottom:8px; color:var(--muted); font-size:10px; font-weight:600; letter-spacing:.12em; text-transform:uppercase; }
.palette-chip { flex:0 0 auto; min-height:50px; padding:12px 18px; border:1px solid #cfc4b8; border-radius:999px; background:#fff; color:var(--ink); font-size:15px; font-weight:600; cursor:pointer; scroll-snap-align:start; touch-action:manipulation; -webkit-tap-highlight-color:transparent; }
.palette-chip.active { background:var(--wine); border-color:var(--wine); color:#fff; box-shadow:0 5px 14px rgba(113,61,61,.2); }
.palette-chip:focus-visible { outline:3px solid rgba(113,61,61,.28); outline-offset:2px; }
.color-family-chip { display:inline-flex; align-items:center; gap:8px; text-transform:capitalize; }
.color-family-chip i { width:22px; height:22px; border-radius:50%; background:var(--chip-color); border:1px solid rgba(0,0,0,.14); }
#palette-color { --color-pink:#ef88b7; --color-red:#c93d45; --color-orange:#e98645; --color-yellow:#e5c94d; --color-green:#5b9b62; --color-blue:#5689c9; --color-purple:#8b68aa; --color-brown:#8b6049; --color-white:#f8f5ef; --color-gray:#999; --color-black:#242424; }

.palette-swatch {
  border: 1px solid var(--line);
  background: #fff;
  padding: 10px 12px;
  font-size: 12px;
  border-radius: 10px;
  display: grid;
  grid-template-columns: 48px 1fr;
  gap: 10px;
  align-items: center;
  min-height: 60px;
}

.palette-swatch small {
  color: var(--muted);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  display: block;
}

.palette-swatch .swatch-thumb {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: 1px solid #e6ddd3;
  background: #efe6dc;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.palette-swatch .swatch-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.palette-swatch .swatch-fallback {
  font-size: 10px;
  color: #5a4b41;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  border-radius: 50%;
}

.palette-actions { display: flex; gap: 10px; justify-content: flex-start; align-items: center; flex-wrap: wrap; margin-top: 14px; }
.palette-btn {
  display: inline-block;
  border: 1px solid var(--line);
  padding: 10px 12px;
  background: #fff;
  font-size: 12px;
  text-decoration: none;
  color: #3d2b1f;
}
.palette-btn--primary { background: var(--wine); border-color: var(--wine); color: #fff; }
.palette-page--client .palette-product-choice,
.palette-page--client .palette-product-choice-wrap,
.palette-page--client .palette-favorite,
.palette-page--client .palette-filter-bar input,
.palette-page--client .palette-chip,
.palette-page--client .palette-swatch,
.palette-page--client .color-wheel-meta { border-radius:0; }
.palette-inclusion-toggle { display:flex; align-items:center; gap:12px; margin:16px 0; padding:14px; border:1px solid var(--line); border-radius:12px; background:#f8f3ed; cursor:pointer; }
.palette-inclusion-toggle input { width:26px; height:26px; accent-color:var(--wine); }
.palette-inclusion-toggle span { display:grid; gap:2px; }
.palette-inclusion-toggle small, .color-wheel-meta small { color:var(--muted); }
.palette-image-choice { padding:0; overflow:hidden; }
.palette-image-choice > button { width:100%; min-height:100%; display:grid; gap:7px; padding:10px; border:0; background:transparent; color:inherit; text-align:left; cursor:pointer; font:inherit; }
.palette-image-choice > button:focus-visible { outline:3px solid var(--wine); outline-offset:-3px; }
.palette-image-choice.is-selected { border-color:var(--wine); box-shadow:inset 0 0 0 2px var(--wine); background:#f8efeb; }
.palette-image-choice.is-selected small { color:var(--wine); font-weight:700; }
.color-wheel-meta { display:flex; align-items:center; gap:12px; margin:12px 0 18px; padding:12px; border:1px solid var(--line); border-radius:12px; }
.color-wheel-meta > span:last-child { display:grid; gap:2px; }
.color-wheel-dot { width:44px; height:44px; flex:0 0 44px; border-radius:50%; background:var(--matched-color); border:1px solid rgba(0,0,0,.15); box-shadow:inset 0 0 0 3px rgba(255,255,255,.45); }
.reference-upload { display:grid; gap:9px; margin:14px 0; padding:14px; border:1px dashed #b9aa9d; border-radius:12px; background:#fbf8f4; cursor:pointer; }
.reference-upload input { position:absolute; width:1px; height:1px; opacity:0; pointer-events:none; }
.reference-upload > span:first-child { display:grid; gap:2px; }
.reference-upload__action { width:max-content; padding:9px 12px; border-radius:8px; background:var(--ink); color:#fff; font-size:12px; font-weight:600; }
.reference-upload__preview { min-height:52px; display:flex; align-items:center; justify-content:center; overflow:hidden; border:1px solid var(--line); border-radius:8px; background:#fff; color:var(--muted); font-size:11px; text-align:center; }
.reference-upload__preview img { width:100%; max-height:180px; object-fit:contain; display:block; }
.reference-upload--card { margin-bottom:10px; }
.reference-upload--card .reference-upload__preview img { max-height:120px; }
.reference-upload__controls { display:flex; align-items:center; gap:12px; margin:-4px 0 18px; flex-wrap:wrap; }
.reference-upload__controls button:disabled { opacity:.45; cursor:not-allowed; }
.reference-upload__controls [role="status"] { color:var(--muted); font-size:12px; }
.palette-empty { padding: 76px 0; text-align: center; color: var(--muted); }

@media (max-width: 1100px) {
  .catalog { grid-template-columns: repeat(3, 1fr); }
  .toolbar { flex-wrap: wrap; }
  .search { flex-basis: 100%; }
}

@media (max-width: 1000px) {
  .palette-grid { grid-template-columns: 1fr; }
  .palette-title { font-size: 48px; }
  .palette-shell { padding-top: 8px; }
}
@media (max-width: 700px) {
  .palette-hero { min-height:410px; padding-inline:18px; }
  .palette-logo img { width:125px; }
  .palette-nav { align-items:flex-start; gap:16px; }
  .palette-hero__copy { margin-top:58px; }
  .palette-hero .palette-title { font-size:52px; }
}

@media (max-width: 760px) {
  .hero { min-height: 540px; }
  .catalog { grid-template-columns: repeat(2, 1fr); }
  .select { display: none; }
  .failures { grid-template-columns: 1fr; }
  .results-heading { align-items: start; }
  .legend { display: none; }
  .failure { grid-template-columns: 1fr; }
  .card h3 { font-size: 19px; }
  .palette-filter-bar { grid-template-columns: 1fr; }
}

@media (max-width: 480px) {
  .catalog { grid-template-columns: 1fr; }
  .filters { flex-wrap: nowrap; overflow: auto; width: 100%; padding-bottom: 4px; }
  .filter { white-space: nowrap; }
  .toolbar { gap: 12px; }
  .hero h1 { font-size: 52px; }
  .metrics { gap: 7px; }
  .metric { min-width: calc(50% - 4px); }
  footer { display: block; }
  footer p { margin-top: 16px; }
}
