:root {
  --cream: #FBF6EC;
  --cream-2: #F3EADA;
  --card: #FFFDF8;
  --ink: #2B1D12;
  --ink-soft: rgba(43, 29, 18, .66);
  --gold: #B8913F;
  --gold-deep: #9A7630;
  --line: rgba(43, 29, 18, .14);
  --serif: "Cormorant Garamond", "Cormorant", Georgia, "Times New Roman", serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --ar: 1.5;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--cream);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.4;
  overflow-x: hidden;
}
button, input, textarea { font: inherit; color: inherit; }
h2 { font-family: var(--serif); font-weight: 600; font-size: 22px; line-height: 1.1; margin: 0 0 10px; }
.muted { color: var(--ink-soft); font-family: var(--sans); font-size: 13px; font-weight: 400; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* header */
.top {
  height: 56px; padding: 0 16px;
  display: flex; align-items: baseline; justify-content: center; gap: 10px;
  flex-wrap: nowrap; overflow: hidden;
  border-bottom: 1px solid var(--line);
  align-items: center;
}
.wordmark { font-family: var(--serif); font-weight: 600; font-size: 26px; letter-spacing: .02em; white-space: nowrap; }
.tagline { font-size: 11px; letter-spacing: .14em; text-transform: uppercase; color: var(--gold-deep); white-space: nowrap; }

/* layout: single column on phones, canvas left / controls right on desktop */
.layout { max-width: 1100px; margin: 0 auto; display: block; }
.stage { padding: 0; }
.controls { padding: 12px 16px 8px; min-width: 0; }

.canvas-wrap {
  position: relative; width: min(100%, calc(70vh * var(--ar))); margin: 0 auto;
  aspect-ratio: var(--ar); background: var(--cream-2); overflow: hidden;
  touch-action: pan-y; user-select: none; -webkit-user-select: none;
}
.canvas-wrap canvas, .canvas-wrap #hd { pointer-events: none; -webkit-user-drag: none; position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
#hd[hidden] { display: none; }
#hd { object-fit: contain; background: var(--cream-2); }
.canvas-wrap.comparing #hd { visibility: hidden; }

/* only keep the preview pinned on phones when it is short enough to leave room for the palette */
@media (max-width: 859px) {
  .stage[data-orient="wide"] { position: sticky; top: 0; z-index: 20; background: var(--cream); box-shadow: 0 6px 14px -10px rgba(43, 29, 18, .55); }
}

.skeleton {
  position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(100deg, var(--cream-2) 30%, #fbf3e4 50%, var(--cream-2) 70%);
  background-size: 200% 100%; animation: shimmer 1.4s linear infinite;
  opacity: 0; transition: opacity .2s;
}
.canvas-wrap.loading .skeleton { opacity: 1; }
@keyframes shimmer { from { background-position: 120% 0; } to { background-position: -120% 0; } }

.vmsg {
  position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px;
  background: rgba(251, 246, 236, .94); text-align: center; padding: 16px;
}
.vmsg[hidden] { display: none; }
.vmsg p { margin: 0; font-family: var(--serif); font-size: 22px; font-weight: 600; }
.vmsg-actions { display: flex; gap: 8px; }

.nav {
  position: absolute; top: 50%; transform: translateY(-50%);
  width: 44px; height: 44px; border-radius: 50%; border: 0; cursor: pointer;
  background: rgba(255, 253, 248, .82); color: var(--ink);
  display: grid; place-items: center; box-shadow: 0 1px 6px rgba(43, 29, 18, .25);
}
.nav.prev { left: 8px; } .nav.next { right: 8px; }
.nav[hidden] { display: none; }

.chip {
  position: absolute; bottom: 8px; padding: 6px 12px; border-radius: 999px; font-size: 13px; font-weight: 600;
  background: rgba(255, 253, 248, .9); box-shadow: 0 1px 6px rgba(43, 29, 18, .22); max-width: calc(100% - 100px);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; pointer-events: none;
}
.shade-chip { left: 8px; display: flex; align-items: center; gap: 8px; }
.shade-chip .dot { width: 16px; height: 16px; border-radius: 50%; flex: none; border: 1px solid rgba(43, 29, 18, .3); }
.count-chip { right: 8px; top: 8px; bottom: auto; font-weight: 500; }
.ai-chip { top: 8px; left: 8px; bottom: auto; background: var(--ink); color: var(--cream); letter-spacing: .06em; text-transform: uppercase; font-size: 11px; }
.ai-chip[hidden] { display: none; }

/* view strip */
.strip[hidden], .canvas-wrap[hidden] { display: none; }
.strip { display: flex; gap: 10px; overflow-x: auto; padding: 2px 2px 10px; margin: 0 -16px 4px; padding-left: 16px; padding-right: 16px; scroll-snap-type: x proximity; scrollbar-width: thin; }
.vt { flex: none; width: 108px; background: none; border: 0; padding: 0; text-align: left; cursor: pointer; scroll-snap-align: start; }
.vt .th { display: block; width: 100%; aspect-ratio: 3 / 2; border-radius: 6px; background: var(--cream-2) center / cover no-repeat; border: 2px solid transparent; outline: 1px solid var(--line); }
.vt .tt { display: block; margin-top: 5px; font-size: 12px; line-height: 1.2; color: var(--ink-soft); min-height: 29px; }
.vt[aria-current="true"] .th { border-color: var(--gold); outline-color: var(--gold); }
.vt[aria-current="true"] .tt { color: var(--ink); font-weight: 600; }

/* buttons */
.btn {
  min-height: 44px; padding: 0 16px; border-radius: 999px; cursor: pointer; display: inline-flex; align-items: center; justify-content: center;
  background: var(--card); border: 1px solid var(--gold); color: var(--ink); font-size: 15px; font-weight: 600; white-space: nowrap;
  touch-action: manipulation; user-select: none; -webkit-user-select: none;
}
.btn[hidden] { display: none; }
.btn.small { min-height: 44px; padding: 0 14px; }
.btn.primary { background: var(--gold); color: #fff; border-color: var(--gold); }
.btn.primary:active, .btn.primary.held { background: var(--gold-deep); }
.btn[aria-pressed="true"]:not(.icon) { background: var(--ink); color: var(--cream); border-color: var(--ink); }
.btn.icon { width: 48px; padding: 0; }
.btn.icon .heart-path { fill: none; }
.btn.icon[aria-pressed="true"] { color: #B23A48; border-color: #B23A48; }
.btn.icon[aria-pressed="true"] .heart-path { fill: currentColor; }
.btn:disabled { opacity: .45; cursor: default; }
:focus-visible { outline: 3px solid var(--ink); outline-offset: 2px; }
.hold { touch-action: none; flex: 1 1 0; min-width: 0; padding: 0 12px; }

/* row 1: compare / shortlist / realistic never wrap; row 2: three equal secondary buttons */
.actions { display: flex; flex-direction: column; gap: 8px; margin: 4px 0 16px; }
.actions-main { display: flex; gap: 8px; }
.actions-main .btn:not(.hold) { flex: 0 0 auto; }
.actions-share { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.actions-share .btn { padding: 0 6px; font-size: 14px; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.actions-share .btn.busy { font-size: 12px; letter-spacing: -.01em; padding: 0 4px; }

/* panels and blocks */
.panel { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 14px; margin-bottom: 18px; }
.panel[hidden], .block[hidden] { display: none; }
.field { display: block; margin-bottom: 10px; }
.field span { display: block; font-size: 12px; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-soft); margin-bottom: 4px; }
.field input { width: 100%; min-height: 44px; padding: 0 12px; border: 1px solid var(--line); border-radius: 8px; background: #fff; font-size: 16px; }
.upload-row { display: flex; flex-wrap: wrap; gap: 8px; }
.block { margin-bottom: 20px; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.sc { display: inline-flex; align-items: stretch; border: 1px solid var(--line); border-radius: 999px; background: var(--card); overflow: hidden; }
.sc[data-on="true"] { border-color: var(--gold); box-shadow: 0 0 0 2px var(--gold); }
.sc button { border: 0; background: none; cursor: pointer; min-height: 44px; display: inline-flex; align-items: center; gap: 8px; }
.sc .pick { padding: 0 6px 0 12px; font-weight: 600; font-size: 14px; }
.sc .rm { width: 40px; justify-content: center; color: var(--ink-soft); font-size: 20px; line-height: 1; }
.sc .dot { width: 20px; height: 20px; border-radius: 50%; border: 1px solid rgba(43, 29, 18, .3); }

.rec-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.sw {
  position: relative; border: 0; background: none; padding: 0; cursor: pointer; text-align: center; font-size: 12px; color: var(--ink);
  touch-action: manipulation;
}
.sw .chipc { display: flex; align-items: center; justify-content: center; border-radius: 10px; border: 1px solid rgba(43, 29, 18, .22); background: var(--c); font-weight: 700; font-size: 13px; }
.sw.big .chipc { height: 56px; }
.sw.big .nm { display: block; margin-top: 4px; font-size: 13px; line-height: 1.15; font-weight: 600; }
.sw.small .chipc { aspect-ratio: 1; min-height: 44px; }
.sw[aria-pressed="true"] .chipc { box-shadow: 0 0 0 2px var(--cream), 0 0 0 4px var(--ink); }
.sw.white .chipc { background: repeating-linear-gradient(135deg, #fff 0 6px, #f1ece1 6px 12px); color: var(--ink); }
.grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px; padding: 4px; }

.foot { padding: 8px 16px 32px; max-width: 1100px; margin: 0 auto; }
.cta {
  display: flex; align-items: center; justify-content: center; text-align: center; width: 100%; min-height: 52px; padding: 10px 18px; border-radius: 12px;
  background: var(--ink); color: var(--cream); border: 0; cursor: pointer; font: inherit; font-weight: 600; font-size: 16px; line-height: 1.25;
  touch-action: manipulation;
}
.cta-alt { display: block; text-align: center; margin-top: 4px; padding: 12px 8px; color: var(--ink-soft); font-size: 14px; text-decoration: underline; text-underline-offset: 3px; }

.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 20px); opacity: 0; pointer-events: none; z-index: 50;
  background: var(--ink); color: var(--cream); padding: 10px 16px; border-radius: 10px; font-size: 14px; max-width: calc(100vw - 32px); text-align: center;
  transition: opacity .2s, transform .2s;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* desktop: canvas left, controls right */
@media (min-width: 860px) {
  .layout { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(340px, 1fr); gap: 28px; padding: 20px 20px 0; align-items: start; }
  .stage { position: sticky; top: 16px; }
  .canvas-wrap { border-radius: 10px; width: min(100%, calc(70vh * var(--ar))); }
  .controls { padding: 0; }
  .foot { padding: 12px 20px 40px; }
  .grid { grid-template-columns: repeat(8, 1fr); }
}

/* compare two shades: split view */
.chip[hidden] { display: none; }
.chip-b { right: 8px; display: flex; align-items: center; gap: 8px; }
.chip-b .dot { width: 16px; height: 16px; border-radius: 50%; flex: none; border: 1px solid rgba(43, 29, 18, .3); }
.canvas-wrap { --x: .5; }
.canvas-wrap.cmp .shade-chip { max-width: max(52px, calc(var(--x) * 100% - 14px)); }
.canvas-wrap.cmp .chip-b { max-width: max(52px, calc((1 - var(--x)) * 100% - 14px)); }
.canvas-wrap.cmp .shade-chip span:last-child, .chip-b span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.split { position: absolute; inset: 0; pointer-events: none; z-index: 5; }
.split[hidden] { display: none; }
.canvas-wrap.comparing .split, .canvas-wrap.loading .split { visibility: hidden; }
.split-line { position: absolute; top: 0; bottom: 0; left: calc(var(--x) * 100%); width: 2px; margin-left: -1px; background: #fff; box-shadow: 0 0 0 .5px rgba(43, 29, 18, .3), 0 0 6px rgba(43, 29, 18, .35); }
.split-handle {
  position: absolute; top: 40%; left: calc(var(--x) * 100%); width: 44px; height: 44px; margin: -22px 0 0 -22px; border-radius: 50%;
  background: #fff; color: var(--ink); display: grid; place-items: center; pointer-events: auto; touch-action: none; cursor: grab;
  box-shadow: 0 1px 8px rgba(43, 29, 18, .45); user-select: none; -webkit-user-select: none;
}
.split-handle.dragging { cursor: grabbing; }

.actions-cmp { display: flex; }
.actions-cmp .btn { flex: 1 1 auto; }
.sides-block { margin-bottom: 16px; }
.sides { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto; gap: 8px; }
.side {
  display: flex; align-items: center; gap: 8px; min-height: 52px; min-width: 0; padding: 4px 10px; text-align: left; cursor: pointer;
  background: var(--card); border: 1px solid var(--line); border-radius: 12px; touch-action: manipulation;
}
.side .dot { width: 22px; height: 22px; border-radius: 50%; flex: none; border: 1px solid rgba(43, 29, 18, .3); background: #fff; }
.side .st { display: flex; flex-direction: column; min-width: 0; line-height: 1.2; }
.side .k { font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-soft); }
.side .v { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.side[aria-pressed="true"] { border-color: var(--ink); box-shadow: 0 0 0 2px var(--ink); }
.hint { margin: 6px 2px 0; font-size: 12px; color: var(--ink-soft); }
.controls.cmp .sw .chipc { box-shadow: none; }
.controls.cmp .sw[data-l] .chipc { box-shadow: 0 0 0 2px var(--cream), 0 0 0 4px var(--ink); }
.controls.cmp .sw[data-r] .chipc { box-shadow: 0 0 0 2px var(--cream), 0 0 0 4px var(--gold-deep); }
.controls.cmp .sw[data-l][data-r] .chipc { box-shadow: 0 0 0 2px var(--cream), 0 0 0 4px var(--ink), 0 0 0 6px var(--cream), 0 0 0 8px var(--gold-deep); }
.controls.cmp .sw[data-l]::after, .controls.cmp .sw[data-r]::after {
  position: absolute; top: -5px; right: -5px; min-width: 18px; height: 18px; padding: 0 4px; border-radius: 9px; font-size: 11px; font-weight: 700; line-height: 18px;
  color: #fff; background: var(--ink); box-shadow: 0 0 0 2px var(--cream); pointer-events: none;
}
.controls.cmp .sw[data-l]::after { content: "L"; }
.controls.cmp .sw[data-r]::after { content: "R"; background: var(--gold-deep); }
.controls.cmp .sw[data-l][data-r]::after { content: "L·R"; background: linear-gradient(90deg, var(--ink) 50%, var(--gold-deep) 50%); }
.controls.cmp .sw.big { padding-top: 5px; }
.controls.cmp .grid { padding: 8px 8px 4px; }

@media (prefers-reduced-motion: reduce) {
  .skeleton { animation: none; }
  .toast { transition: none; }
  html { scroll-behavior: auto; }
}

/* enquiry dialog */
body.enq-open { overflow: hidden; }
.enq { border: 0; padding: 0; background: var(--cream); color: var(--ink); width: 100%; max-width: 100%; max-height: 90vh; max-height: 90dvh; margin: auto 0 0; border-radius: 18px 18px 0 0; overflow: hidden; }
.enq::backdrop { background: rgba(43, 29, 18, .55); }
.enq-card { position: relative; max-height: 90vh; max-height: 90dvh; overflow-y: auto; overscroll-behavior: contain; padding: 22px 18px calc(22px + env(safe-area-inset-bottom)); }
.enq h2 { font-size: 28px; margin: 0 40px 12px 0; }
.enq h2:focus { outline: none; }
.enq-x { position: absolute; top: 8px; right: 8px; width: 44px; height: 44px; border: 0; border-radius: 50%; background: transparent; font-size: 30px; line-height: 1; cursor: pointer; color: var(--ink); }
.enq-look { display: flex; align-items: center; gap: 12px; padding: 10px 12px; background: var(--card); border: 1px solid var(--line); border-radius: 12px; }
.enq-sw { display: flex; flex: none; }
.enq-sw i { width: 34px; height: 34px; border-radius: 50%; border: 1px solid rgba(43, 29, 18, .3); background: #fff; }
.enq-sw i + i { margin-left: -10px; box-shadow: -2px 0 0 var(--card); }
.enq-lt { min-width: 0; }
.enq-ln { font-weight: 600; font-size: 15px; overflow-wrap: anywhere; }
.enq-lv { font-size: 13px; color: var(--ink-soft); }
.enq-note { margin: 8px 2px 14px; font-size: 13px; color: var(--ink-soft); }
.enq-err { margin: 0 0 14px; padding: 12px 14px; border-radius: 10px; background: #FBE9E7; border: 1px solid #B23A48; color: #7A1F2B; font-size: 14px; }
.enq-err[hidden], .ee[hidden] { display: none; }
.enq-err a { display: inline-flex; align-items: center; min-height: 44px; margin-top: 6px; padding: 0 16px; border-radius: 999px; background: var(--ink); color: var(--cream); font-weight: 600; text-decoration: none; }
.ef { margin-bottom: 12px; min-width: 0; }
.ef label { display: block; font-size: 12px; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-soft); margin-bottom: 4px; }
.ef label b { color: var(--gold-deep); }
.ef .opt { text-transform: none; letter-spacing: 0; }
.ef input, .ef textarea { width: 100%; min-height: 44px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; background: #fff; font-size: 16px; }
.ef input:focus-visible, .ef textarea:focus-visible { outline: 3px solid var(--gold); outline-offset: 1px; border-color: var(--gold); }
.ef textarea { resize: vertical; }
.ef input[aria-invalid="true"] { border-color: #B23A48; }
.ee { margin-top: 4px; font-size: 13px; color: #B23A48; }
.ef-row { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: 10px; }
.enq-hp { position: absolute; left: -10000px; top: auto; width: 1px; height: 1px; overflow: hidden; }
.enq-send { width: 100%; min-height: 52px; font-size: 16px; margin-top: 4px; }
.enq-doneP { font-size: 16px; margin: 0 0 18px; }
@media (min-width: 600px) {
  .enq { width: 480px; max-width: calc(100vw - 32px); margin: auto; border-radius: 18px; max-height: 90vh; }
}
@media (prefers-reduced-motion: no-preference) {
  .enq[open] { animation: enqIn .22s ease-out; }
  @keyframes enqIn { from { transform: translateY(24px); opacity: 0; } to { transform: none; opacity: 1; } }
}
.enq button, .cta { -webkit-tap-highlight-color: transparent; }

/* "See all views" toggle + board */
.modebar { display: flex; align-items: center; gap: 8px; padding: 8px 16px; background: var(--cream); }
.mode-toggle { flex: 1 1 auto; gap: 10px; min-width: 0; }
.mode-toggle svg { flex: none; }
.modebar .jump { display: none; flex: none; padding: 0 14px; gap: 6px; }
.stage.board-on .modebar { position: sticky; top: 0; z-index: 25; box-shadow: 0 6px 14px -12px rgba(43, 29, 18, .55); }
.stage.board-on .jump { display: inline-flex; }
#board[hidden] { display: none; }
.board { --bg: 7px; padding: 6px 12px 18px; }
.board-head { display: flex; align-items: center; gap: 12px; padding: 4px 2px 12px; }
.bh-sw { display: flex; flex: none; }
.bh-sw i { width: 30px; height: 30px; border-radius: 50%; border: 1px solid rgba(43, 29, 18, .3); background: #fff; }
.bh-sw i + i { margin-left: -10px; box-shadow: -2px 0 0 var(--cream); }
.bh-title { font-family: var(--serif); font-weight: 600; font-size: 21px; line-height: 1.15; overflow-wrap: anywhere; }
.bh-hint { margin-top: 2px; font-size: 12px; color: var(--ink-soft); }
.board-grid { display: flex; flex-direction: column; gap: var(--bg); }
.brow { display: flex; gap: var(--bg); align-items: stretch; }
.bstack { display: flex; flex-direction: column; gap: var(--bg); min-width: 0; }
.tile {
  position: relative; display: block; min-width: 0; min-height: 0; padding: 0; border: 0; border-radius: 10px; overflow: hidden; cursor: pointer;
  background: linear-gradient(100deg, var(--cream-2) 30%, #fbf3e4 50%, var(--cream-2) 70%) 0 0 / 200% 100%;
  animation: shimmer 1.4s linear infinite; -webkit-tap-highlight-color: transparent; touch-action: manipulation;
}
.tile.ready, .tile.failed { animation: none; background: var(--cream-2); }
.tile canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; object-fit: cover; opacity: 0; }
.tile.ready canvas { opacity: 1; transition: opacity .3s; }
.tile:active canvas { filter: brightness(.95); }
.tchip {
  position: absolute; left: 6px; bottom: 6px; max-width: calc(100% - 12px); padding: 4px 10px; border-radius: 999px; pointer-events: none;
  background: rgba(255, 253, 248, .92); color: var(--ink); font-size: 12px; font-weight: 600; line-height: 1.25; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  box-shadow: 0 1px 5px rgba(43, 29, 18, .22);
}
.terr { display: none; position: absolute; inset: 0; align-items: center; justify-content: center; padding: 8px; font-size: 13px; color: var(--ink-soft); text-align: center; }
.tile.failed .terr { display: flex; }
@media (min-width: 860px) {
  .modebar { padding: 0 0 10px; }
  .stage.board-on { position: static; }
  .stage.board-on .jump { display: none; }
  .stage.board-on .modebar { padding-top: 4px; }
  .layout.board-on { grid-template-columns: minmax(0, 1.9fr) minmax(340px, 1fr); }
  .board { padding: 4px 0 18px; }
  .tile:hover canvas { filter: brightness(1.03); }
}
@media (max-width: 859px) {
  .stage.board-on[data-orient] { position: static; box-shadow: none; }
}
@media (prefers-reduced-motion: reduce) {
  .tile { animation: none; }
  .tile.ready canvas { transition: none; }
}

/* signature looks */
.look-caption { margin: -4px 0 10px; font-size: 12px; line-height: 1.3; color: var(--ink-soft); }
.look-caption[hidden] { display: none; }
.sw.look .chipc { background: var(--c); }
.look-note-chip { left: 8px; bottom: 44px; max-width: calc(100% - 16px); white-space: normal; font-size: 12px; font-weight: 500; line-height: 1.25; padding: 5px 10px; border-radius: 12px; }
