@font-face {
  font-family: 'Cormorant Garamond';
  font-style: normal;
  font-weight: 300 700;
  font-display: swap;
  src: url(fonts/cormorant-garamond.woff2) format('woff2');
}
@font-face {
  font-family: 'Cormorant Garamond';
  font-style: italic;
  font-weight: 300 700;
  font-display: swap;
  src: url(fonts/cormorant-garamond-italic.woff2) format('woff2');
}
@font-face {
  font-family: 'Raleway';
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url(fonts/raleway.woff2) format('woff2');
}

:root {
  --ink: #4A463F;
  --taupe: #5C574D;
  --muted: #7A7468;
  --sage: #717E5F;
  --sage-dark: #5D6A4D;
  --gold: #B59B64;
  --gold-soft: #F3ECDD;
  --panel: #F4F2EE;
  --stage: #EFEBE3;
  --line: #E4DFD5;
  --bg: #FFFFFF;
  --focus: #B59B64;
  --serif: 'Cormorant Garamond', 'Cormorant', Garamond, 'Times New Roman', serif;
  --sans: 'Raleway', 'Helvetica Neue', Arial, sans-serif;
  --radius: 14px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.45;
}
button { font: inherit; color: inherit; }
h1, h2, h3 { font-family: var(--serif); font-weight: 700; margin: 0; line-height: 1.1; }

.wrap { max-width: 1440px; margin: 0 auto; padding: 0 clamp(16px, 3vw, 40px); }

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

.skip { position: absolute; left: -999px; top: 8px; background: var(--ink); color: #fff; padding: 8px 12px; border-radius: 6px; z-index: 50; }
.skip:focus { left: 8px; }

.svg-defs { position: absolute; width: 0; height: 0; overflow: hidden; }

/* ---------- Header ---------- */
.site-header { border-bottom: 1px solid var(--line); background: #fff; }
.header-row { display: flex; align-items: center; gap: 24px; height: 64px; }
.wordmark {
  font-family: var(--serif); font-weight: 700; font-size: 26px; letter-spacing: .32em;
  color: var(--ink); text-decoration: none; margin-right: auto;
}
.site-nav { display: flex; gap: 28px; font-size: 14px; color: var(--muted); }
.site-nav [aria-current] { color: var(--ink); }
.cart-button {
  display: inline-flex; align-items: center; gap: 8px; background: none; border: 1px solid var(--line);
  border-radius: 999px; padding: 7px 14px 7px 12px; cursor: pointer; font-weight: 600; font-size: 14px;
}
.cart-button svg { width: 20px; height: 20px; }
.cart-button:hover { border-color: var(--sage); }
.cart-count {
  min-width: 22px; height: 22px; border-radius: 11px; background: var(--sage); color: #fff;
  display: inline-grid; place-items: center; font-size: 12px; padding: 0 6px;
}
.cart-count.bump { animation: bump .35s ease-out; }
@keyframes bump { 40% { transform: scale(1.3); } }

/* ---------- Intro ---------- */
.intro {
  display: grid; grid-template-columns: 1fr auto; grid-template-areas: "title note" "filters filters";
  align-items: end; gap: 14px 24px; padding: 22px 0 18px;
}
.title-block { grid-area: title; }
.intro h1 { font-size: clamp(32px, 3.4vw, 46px); color: var(--ink); }
.preset-line { margin: 4px 0 0; font-family: var(--serif); font-style: italic; font-size: clamp(19px, 1.7vw, 24px); color: var(--taupe); }
.proto-note {
  grid-area: note; margin: 0; font-size: 12px; font-weight: 600; letter-spacing: .12em; text-transform: uppercase;
  color: #8A7447; background: var(--gold-soft); padding: 6px 12px; border-radius: 999px; align-self: start; white-space: nowrap;
}
.filters { grid-area: filters; display: flex; flex-wrap: wrap; gap: 10px 28px; }
.filter-group { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; border: 0; margin: 0; padding: 0; }
.filter-label { font-size: 11px; font-weight: 700; letter-spacing: .16em; text-transform: uppercase; color: var(--sage); margin-right: 2px; }
.chip {
  border: 1.5px solid var(--sage); background: #fff; color: var(--sage-dark); border-radius: 999px;
  padding: 6px 14px; font-size: 14px; font-weight: 600; cursor: pointer; transition: background-color .15s, color .15s;
}
.chip:hover { background: #EEF0E9; }
.chip[aria-pressed="true"] { background: var(--sage); color: #fff; }

.link-button { background: none; border: 0; padding: 2px 0; cursor: pointer; color: var(--sage-dark); font-weight: 600; text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1px; }
.link-button:hover { color: var(--ink); }
.preset-line .link-button { font-family: var(--sans); font-style: normal; font-size: 13px; margin-left: 12px; vertical-align: middle; }

/* ---------- Layout ---------- */
.shop { display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(330px, 1fr); gap: clamp(20px, 2.5vw, 40px); align-items: start; }

.stage { background: var(--stage); border-radius: var(--radius); padding: clamp(8px, 1.4vw, 20px); outline: none; }
/* Keep the whole table (and its caption) on screen on short displays such as a 720p projector. */
.stage-inner { position: relative; margin-inline: auto; max-width: max(520px, calc((100vh - var(--stage-top, 195px) - 146px) * 1140 / 800)); }
.table-svg { display: block; width: 100%; height: auto; }
.stage-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 8px 4px 0; flex-wrap: wrap; }
.stage-hint { margin: 0; font-size: 13px; color: var(--muted); }
.surface-toggle { display: flex; align-items: center; gap: 6px; }
.surface-label { font-size: 11px; font-weight: 700; letter-spacing: .16em; text-transform: uppercase; color: var(--sage); margin-right: 2px; }
.chip-small { padding: 4px 11px; font-size: 13px; }
.stage .table-svg { border-radius: 10px; }

.table-svg .spot { cursor: pointer; }
.table-svg .spot:hover { filter: brightness(1.04) saturate(1.08); }
.table-svg .card-name { font-family: var(--serif); font-style: italic; font-weight: 600; font-size: 12.5px; }
.table-svg .spot.swap, .table-svg .spot.swap-all { animation: swapIn .42s cubic-bezier(.2, .7, .3, 1); transform-box: fill-box; transform-origin: center; }
@keyframes swapIn { from { opacity: 0; transform: scale(.9); } to { opacity: 1; transform: scale(1); } }

.markers { position: absolute; inset: 0; pointer-events: none; }
.marker {
  position: absolute; transform: translate(-50%, -50%); pointer-events: auto;
  width: clamp(26px, 2.5vw, 34px); height: clamp(26px, 2.5vw, 34px); border-radius: 50%;
  border: 2px solid #fff; background: var(--gold); color: #fff; font-weight: 700; font-size: clamp(13px, 1.1vw, 16px);
  display: grid; place-items: center; cursor: pointer; box-shadow: 0 2px 6px rgba(74, 70, 63, .3);
  transition: transform .15s;
}
.marker:hover, .marker:focus-visible { transform: translate(-50%, -50%) scale(1.15); }
.marker:focus-visible { outline: 3px solid var(--ink); outline-offset: 2px; border-radius: 50%; }
.marker.suggested::after {
  content: ''; position: absolute; inset: -7px; border-radius: 50%; border: 2px solid var(--gold);
  animation: ring 1.6s ease-out 3;
}
@keyframes ring { from { opacity: 1; transform: scale(.8); } to { opacity: 0; transform: scale(1.5); } }
.marker-tip {
  position: absolute; left: 50%; bottom: calc(100% + 8px); transform: translateX(-50%);
  background: var(--ink); color: #fff; font-size: 12px; font-weight: 600; padding: 4px 8px; border-radius: 6px;
  white-space: nowrap; opacity: 0; pointer-events: none; transition: opacity .12s;
}
.marker:hover .marker-tip, .marker:focus-visible .marker-tip { opacity: 1; }

/* ---------- Panel ---------- */
.panel { background: #fff; }
.panel-head { display: flex; align-items: baseline; justify-content: space-between; border-bottom: 1px solid var(--line); padding-bottom: 8px; }
.panel h2 { font-size: 26px; }
.panel-sub { font-size: 13px; color: var(--muted); }
.item-list { list-style: none; margin: 0; padding: 0; }
.item {
  display: grid; grid-template-columns: 26px 52px 1fr auto; gap: 4px 12px; align-items: center;
  padding: 10px 0; border-bottom: 1px solid var(--line);
}
.num {
  width: 24px; height: 24px; border-radius: 50%; background: var(--gold); color: #fff; font-size: 12px; font-weight: 700;
  display: grid; place-items: center;
}
.swatch { width: 52px; height: 52px; border-radius: 10px; background: var(--panel); display: grid; place-items: center; overflow: hidden; }
.swatch .swatch-img, .pick-art .swatch-img { width: 88%; height: 88%; object-fit: contain; mix-blend-mode: multiply; }
.table-svg .light, .table-svg .scenery { pointer-events: none; }
.table-svg .cloth { mix-blend-mode: multiply; }
.styled-with { margin: 4px 4px 0; font-size: 12.5px; color: var(--muted); font-style: italic; }
.item-name { font-weight: 600; font-size: 14.5px; line-height: 1.25; }
.item-meta { font-size: 12.5px; color: var(--muted); }
.item-price { font-weight: 700; font-size: 14.5px; align-self: start; padding-top: 2px; }
.item-actions { grid-column: 3 / 5; display: flex; gap: 16px; font-size: 13px; }
.item-body { min-width: 0; }
.item.changed .swatch { animation: swapIn .42s cubic-bezier(.2, .7, .3, 1); }

.suggest {
  grid-column: 2 / 5; display: grid; grid-template-columns: 40px 1fr auto; gap: 2px 10px; align-items: center;
  background: var(--gold-soft); border-radius: 10px; padding: 8px 10px; margin-top: 6px;
  animation: fadeUp .35s ease-out;
}
@keyframes fadeUp { from { opacity: 0; transform: translateY(4px); } }
.suggest-label { grid-column: 1 / 4; font-size: 10.5px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: #8A7447; }
.suggest .swatch { width: 40px; height: 40px; background: #fff; border-radius: 8px; }
.suggest-name { font-size: 13.5px; font-weight: 600; line-height: 1.2; }
.suggest-meta { font-size: 12px; color: var(--muted); }
.suggest-actions { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; }
.btn-small { border: 0; background: var(--sage); color: #fff; font-weight: 600; font-size: 12.5px; border-radius: 999px; padding: 6px 12px; cursor: pointer; white-space: nowrap; }
.btn-small:hover { background: var(--sage-dark); }
.suggest .link-button { font-size: 12px; }

.whole {
  padding: 14px 0 12px; display: grid; gap: 8px;
  position: sticky; bottom: 0; z-index: 2; background: #fff; border-top: 1px solid var(--line); margin-top: -1px;
}
.whole-total { display: flex; justify-content: space-between; align-items: baseline; font-size: 14px; color: var(--taupe); }
.whole-total strong { font-size: 20px; color: var(--ink); }
.btn {
  border: 0; border-radius: 10px; padding: 14px 18px; font-weight: 700; font-size: 16px; cursor: pointer;
  transition: background-color .15s;
}
.btn-primary { background: var(--sage); color: #fff; }
.btn-primary:hover { background: var(--sage-dark); }
.btn-primary:disabled { background: #B8BDAE; cursor: not-allowed; }
.btn-quiet { background: var(--panel); color: var(--ink); font-size: 14px; padding: 10px 16px; }
.btn-quiet:hover { background: #ECE8E0; }
.panel-foot { padding-top: 10px; display: flex; justify-content: center; }

.site-foot { margin: 36px 0 28px; padding-top: 14px; border-top: 1px solid var(--line); font-size: 12.5px; color: var(--muted); max-width: 900px; }

/* ---------- Sheets (picker, cart, share) ---------- */
.sheet {
  border: 0; padding: 0; margin: 0 0 0 auto; height: 100dvh; max-height: 100dvh; width: min(440px, 100vw);
  background: #fff; color: var(--ink); box-shadow: -12px 0 40px rgba(74, 70, 63, .18);
  display: none; flex-direction: column;
}
.sheet[open] { display: flex; animation: slideIn .24s cubic-bezier(.2, .7, .3, 1); }
@keyframes slideIn { from { transform: translateX(40px); opacity: 0; } }
.sheet::backdrop { background: rgba(74, 70, 63, .28); }
.sheet-small { width: min(400px, 100vw); }
.sheet-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; padding: 22px 22px 14px; border-bottom: 1px solid var(--line); }
.sheet h2 { font-size: 28px; outline: none; }
.sheet-sub { margin: 4px 0 0; font-size: 13px; color: var(--muted); }
.icon-button { background: var(--panel); border: 0; width: 36px; height: 36px; border-radius: 50%; font-size: 22px; line-height: 1; cursor: pointer; flex: none; }
.icon-button:hover { background: #ECE8E0; }

.pick-grid { list-style: none; margin: 0; padding: 16px 22px 28px; display: grid; grid-template-columns: 1fr 1fr; grid-auto-rows: max-content; align-content: start; gap: 14px; overflow-y: auto; flex: 1; min-height: 0; overscroll-behavior: contain; }
.pick { border: 1.5px solid var(--line); border-radius: 12px; overflow: hidden; display: flex; flex-direction: column; }
.pick.current { border-color: var(--sage); box-shadow: 0 0 0 1px var(--sage); }
.pick-main { background: none; border: 0; padding: 0; text-align: left; cursor: pointer; display: flex; flex-direction: column; flex: 1; }
.pick-main:hover .pick-art { background: #EAE6DD; }
.pick-art { background: var(--panel); aspect-ratio: 1 / 1; display: grid; place-items: center; position: relative; transition: background-color .15s; }
.pick-badge { position: absolute; top: 8px; left: 8px; font-size: 10.5px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; background: var(--sage); color: #fff; border-radius: 999px; padding: 3px 8px; }
.pick-match { position: absolute; top: 8px; right: 8px; font-size: 10.5px; font-weight: 700; color: #8A7447; background: #fff; border-radius: 999px; padding: 3px 8px; }
.pick-text { padding: 10px 12px 4px; display: grid; gap: 2px; }
.pick-name { font-weight: 600; font-size: 14px; line-height: 1.25; }
.pick-meta { font-size: 12.5px; color: var(--muted); }
.pick-add { margin: 6px 12px 12px; align-self: flex-start; background: none; border: 1.5px solid var(--sage); color: var(--sage-dark); border-radius: 999px; padding: 5px 12px; font-size: 12.5px; font-weight: 600; cursor: pointer; }
.pick-add:hover { background: #EEF0E9; }

.cart-lines { list-style: none; margin: 0; padding: 6px 22px; overflow-y: auto; flex: 1; min-height: 0; overscroll-behavior: contain; }
.cart-line { display: grid; grid-template-columns: 52px 1fr auto; gap: 4px 12px; padding: 12px 0; border-bottom: 1px solid var(--line); align-items: start; }
.cart-line .swatch { width: 52px; height: 52px; }
.cart-name { font-weight: 600; font-size: 14px; line-height: 1.25; }
.cart-meta { font-size: 12.5px; color: var(--muted); }
.cart-price { font-weight: 700; text-align: right; }
.qty { display: inline-flex; align-items: center; gap: 2px; margin-top: 6px; border: 1px solid var(--line); border-radius: 999px; }
.qty button { background: none; border: 0; width: 30px; height: 28px; cursor: pointer; font-size: 17px; border-radius: 999px; }
.qty button:hover { background: var(--panel); }
.qty output { min-width: 22px; text-align: center; font-weight: 700; font-size: 14px; }
.cart-remove { font-size: 12px; margin-left: 12px; }
.cart-empty { padding: 30px 0; color: var(--muted); text-align: center; }
.cart-foot { padding: 16px 22px 22px; border-top: 1px solid var(--line); display: grid; gap: 10px; background: #fff; }
.cart-total { display: flex; justify-content: space-between; align-items: baseline; font-size: 16px; }
.cart-total strong { font-size: 24px; }
.fine { font-size: 12px; color: var(--muted); margin: 0; text-align: center; }
#cart-clear { justify-self: center; font-size: 13px; }

.share-body { padding: 20px 22px; display: grid; gap: 10px; }
.qr { width: min(240px, 70vw); justify-self: center; border: 1px solid var(--line); border-radius: 12px; padding: 8px; background: #fff; }
.qr svg { display: block; width: 100%; height: auto; }
.share-url { width: 100%; font: inherit; font-size: 13px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; color: var(--ink); background: var(--panel); }
.share-body .fine { text-align: left; }

.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 20px); background: var(--ink); color: #fff;
  padding: 12px 18px; border-radius: 12px; font-size: 14px; font-weight: 600; opacity: 0; pointer-events: none;
  transition: opacity .2s, transform .2s; z-index: 30; display: flex; gap: 14px; align-items: center; max-width: calc(100vw - 32px);
  box-shadow: 0 8px 24px rgba(74, 70, 63, .25);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); pointer-events: auto; }
.toast button { background: #fff; color: var(--ink); border: 0; border-radius: 999px; padding: 6px 12px; font-weight: 700; font-size: 13px; cursor: pointer; white-space: nowrap; }

/* ---------- Tablet and phone ---------- */
@media (min-width: 1081px) and (max-height: 820px) {
  .header-row { height: 56px; }
  .intro { padding: 12px 0 12px; gap: 8px 24px; }
  .intro h1 { font-size: 36px; }
  .preset-line { font-size: 20px; margin-top: 2px; }
  .item { grid-template-columns: 24px 44px 1fr auto; padding: 7px 0; gap: 2px 10px; }
  .item .swatch { width: 44px; height: 44px; }
  .panel h2 { font-size: 23px; }
  .btn { padding: 12px 16px; }
}
@media (max-width: 1080px) {
  .shop { grid-template-columns: 1fr; }
  .site-nav { display: none; }
}
@media (max-width: 700px) {
  body { font-size: 14.5px; }
  .header-row { height: 56px; }
  .wordmark { font-size: 21px; letter-spacing: .26em; }
  .intro { grid-template-columns: 1fr; grid-template-areas: "note" "title" "filters"; padding-top: 14px; gap: 10px; }
  .proto-note { justify-self: start; font-size: 10.5px; }
  .preset-line { margin-top: 2px; }
  .filters {
    flex-wrap: nowrap; overflow-x: auto; gap: 18px; margin: 0 -16px; padding: 2px 16px 6px;
    scrollbar-width: none; -webkit-overflow-scrolling: touch;
  }
  .filters::-webkit-scrollbar { display: none; }
  .filters { -webkit-mask-image: linear-gradient(to right, #000 82%, transparent); mask-image: linear-gradient(to right, #000 82%, transparent); }
  .filter-group[data-dim="look"] { order: -1; }
  .filter-group { flex: none; flex-wrap: nowrap; gap: 6px; }
  .chip { padding: 6px 12px; font-size: 13.5px; white-space: nowrap; }
  .stage { margin: 0 -8px; padding: 6px; }
  .sheet {
    width: 100vw; max-width: 100vw; height: auto; max-height: 86dvh; margin: auto 0 0; border-radius: 18px 18px 0 0;
    box-shadow: 0 -12px 40px rgba(74, 70, 63, .2);
  }
  .sheet[open] { animation: slideUp .26s cubic-bezier(.2, .7, .3, 1); }
  .sheet-head { padding: 16px 16px 12px; }
  .sheet h2 { font-size: 24px; }
  .pick-grid { padding: 12px 16px 24px; gap: 10px; }
  .cart-lines { padding: 4px 16px; }
  .cart-foot { padding: 14px 16px calc(16px + env(safe-area-inset-bottom)); }
  .toast { bottom: calc(16px + env(safe-area-inset-bottom)); width: calc(100vw - 32px); justify-content: space-between; }
}
@keyframes slideUp { from { transform: translateY(60px); opacity: 0; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
