/* ---------------------------------------------------------------------------
   /sofa-colors — the sofa colour matcher.

   Everything is scoped under `.sf` because the class names the prototype used
   (.board, .tag, .pc, .sw, .panel, .step) are the kind that collide: the
   outfit matcher already owns .pc and .tag under its own scope.

   THE ROOM DOES NOT FOLLOW THE THEME. It is a photograph of a living room in
   warm daylight, and a dark version of it would be a different room rather
   than the same one at night — the point of the tool is judging colours
   against a fixed light. So the board keeps its own surface in both themes and
   everything around it follows the page.
--------------------------------------------------------------------------- */
.sf {
  --board: #F1EDE6;
  --tag-bg: #fff;
  --tag-line: #DED8CE;
  --tag-ink: #3C3832;
  --panel: rgb(var(--c-ink2));
  --line: rgb(var(--c-ink3));
  --ink: rgb(var(--c-bone));
  --muted: rgb(var(--c-muted));
  font-family: 'DM Sans', 'Work Sans', system-ui, sans-serif;
  color: var(--ink);
}

.sf *, .sf *::before, .sf *::after { box-sizing: border-box; }
.sf [hidden] { display: none !important; }
.sf button, .sf input { font: inherit; color: inherit; }
.sf button { cursor: pointer; }

.sf-grid { display: grid; grid-template-columns: 340px minmax(0, 1fr); gap: 24px; align-items: start; }

.sf-panel { background: var(--panel); border: 1px solid var(--line); border-radius: 20px; padding: 18px; }
.sf-step { font-size: 12px; font-weight: 700; letter-spacing: .14em; color: var(--action); text-transform: uppercase; margin: 4px 0 10px; }
.sf-step:first-child { margin-top: 0; }

/* swatches */
.sf-sw { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.sf-sw button { width: 38px; height: 38px; border-radius: 10px; border: 1px solid rgb(0 0 0 / .12); padding: 0; position: relative; }
.sf-sw button[aria-pressed='true'] { outline: 2px solid var(--action); outline-offset: 2px; }
.sf-sw button:focus-visible { outline: 2px solid var(--action); outline-offset: 2px; }
.sf-cust { width: 38px; height: 38px; border-radius: 10px; background: conic-gradient(red, yellow, lime, cyan, blue, magenta, red); display: block; position: relative; border: 1px solid rgb(0 0 0 / .12); cursor: pointer; }
.sf-cust input { opacity: 0; position: absolute; inset: 0; width: 100%; height: 100%; cursor: pointer; }

/* segmented controls */
.sf-seg { display: flex; background: rgb(var(--c-ink)); border: 1px solid var(--line); border-radius: 12px; padding: 4px; gap: 4px; margin-bottom: 12px; }
.sf-seg button { flex: 1; border: 0; background: none; padding: 9px 6px; border-radius: 9px; font-size: 14px; font-weight: 500; color: var(--muted); }
.sf-seg button[aria-pressed='true'] { background: var(--action); color: var(--on-action); font-weight: 600; }

.sf-moods { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 16px; }
.sf-moods button { border: 1.5px solid var(--line); background: rgb(var(--c-ink)); border-radius: 12px; padding: 10px; text-align: start; font-size: 14px; font-weight: 600; color: var(--ink); }
.sf-moods button small { display: block; font-weight: 400; color: var(--muted); font-size: 12px; margin-top: 2px; }
.sf-moods button[aria-pressed='true'] { border-color: var(--action); box-shadow: inset 0 0 0 1px var(--action); }

.sf-btns { display: flex; gap: 8px; flex-wrap: wrap; }
.sf-btn { border: 1.5px solid var(--line); background: transparent; border-radius: 12px; padding: 10px 14px; font-size: 14px; font-weight: 600; color: var(--ink); }
.sf-btn:hover { border-color: var(--action); color: var(--action); }
.sf-btn--primary { background: var(--action); border-color: var(--action); color: var(--on-action); }
.sf-btn--primary:hover { background: var(--action-hover); border-color: var(--action-hover); color: var(--on-action); }
.sf-btn:focus-visible { outline: 2px solid var(--action); outline-offset: 2px; }
.sf-tip { font-size: 13px; color: var(--muted); margin: 10px 2px 0; }

/* the room */
.sf-boardwrap { background: var(--panel); border: 1px solid var(--line); border-radius: 20px; padding: 12px; }
.sf-board { position: relative; width: 100%; aspect-ratio: 1200 / 1190; background: var(--board); border-radius: 14px; overflow: hidden; container-type: inline-size; }
.sf-pc { position: absolute; filter: drop-shadow(.6cqw 1.2cqw 1.1cqw rgb(70 55 40 / .22)); cursor: pointer; }
.sf-pc .c, .sf-pc .s, .sf-pc .h { position: absolute; inset: 0; width: 100%; height: 100%; }
.sf-pc .c { -webkit-mask-size: 100% 100%; mask-size: 100% 100%; -webkit-mask-repeat: no-repeat; mask-repeat: no-repeat; }
.sf-pc .s { mix-blend-mode: multiply; }
.sf-pc:hover { filter: drop-shadow(.6cqw 1.2cqw 1.1cqw rgb(70 55 40 / .22)) brightness(1.04); }
.sf-pc:focus-visible { outline: 3px solid var(--action); outline-offset: 2px; border-radius: 6px; }
.sf-pc.is-flat { filter: drop-shadow(0 .5cqw .8cqw rgb(70 55 40 / .12)); }
.sf-art svg { position: absolute; left: 6%; top: 8%; width: 88%; height: 84%; }

.sf-tag { position: absolute; background: var(--tag-bg); border: 1px solid var(--tag-line); border-radius: .7cqw; padding: .45cqw .9cqw; font-size: 1.55cqw; line-height: 1.2; white-space: nowrap; color: var(--tag-ink); pointer-events: none; }
.sf-tag b { color: var(--action); margin-inline-end: .5cqw; }
.sf-tag strong { color: #1F1F1F; margin-inline-start: .5cqw; }
.sf-dot { display: none; position: absolute; width: 4.4cqw; height: 4.4cqw; border-radius: 50%; background: var(--action); color: #fff; font-size: 2.3cqw; font-weight: 700; align-items: center; justify-content: center; pointer-events: none; transform: translate(-10%, -10%); }
.sf-ttl { position: absolute; inset-inline-start: 5.8%; top: 1.6%; font-size: 2.6cqw; font-weight: 700; color: #1F2A44; }
.sf-brand { position: absolute; inset-inline-start: 5.8%; bottom: 1.8%; font-size: 1.6cqw; color: #7a6f64; }

.sf-why { margin: 12px 6px 4px; color: var(--muted); font-size: 15px; line-height: 1.55; }

/* the list that replaces the tags on a phone */
.sf-list { display: none; list-style: none; margin: 10px 0 0; padding: 0; gap: 2px 14px; flex-wrap: wrap; font-size: 13.5px; color: var(--muted); }
.sf-list li { display: flex; align-items: baseline; gap: 5px; }
.sf-list b { color: var(--action); font-weight: 700; }
.sf-list strong { color: var(--ink); font-weight: 600; }

/* the popover */
.sf-pop { position: fixed; z-index: 50; background: var(--panel); border: 1px solid var(--line); border-radius: 16px; box-shadow: 0 12px 30px rgb(0 0 0 / .18); padding: 12px; width: 300px; max-width: calc(100vw - 16px); }
.sf-pop h4 { margin: 0 0 8px; font-size: 14px; font-weight: 700; color: var(--ink); }
.sf-pop .sf-sw { margin-bottom: 0; }
.sf-pop .sf-sw button { width: 30px; height: 30px; border-radius: 8px; }

@media (max-width: 900px) {
  .sf-grid { grid-template-columns: 1fr; }
}

/* Phones: the room comes first and stays put while the controls scroll under
   it, because every control changes something you need to be looking at. */
@media (max-width: 700px) {
  .sf-grid { display: flex; flex-direction: column; gap: 16px; }
  .sf-room { order: -1; position: sticky; top: calc(var(--st-hdr-h, 4rem) + 4px); z-index: 5; background: rgb(var(--c-ink)); padding-bottom: 6px; }
  .sf-board { height: 45vh; aspect-ratio: auto; }
  .sf-boardwrap { padding: 8px; }
  /* The tags are three pixels tall at this size, so the room carries numbers
     and the names go underneath it where they can be read. */
  .sf-tag { display: none; }
  .sf-dot { display: flex; }
  .sf-list { display: flex; }
  .sf-why { font-size: 14px; margin: 8px 2px 0; }
  .sf-moods { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  .sf-pc { transition: none; }
}

/* The "what colors go with a ___ sofa?" cards under the tool. Same shape as
   the outfit page's combination cards, so the two tools' written halves look
   like one site. */
.sofa-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 14px; margin: 18px 0 8px; }
.sofa-combo { background: rgb(var(--c-ink2)); border: 1px solid rgb(var(--c-ink3)); border-radius: 16px; padding: 16px; }
.sofa-combo__name { display: flex; align-items: center; gap: 9px; margin: 0 0 10px; font-size: 15px; font-weight: 600; color: rgb(var(--c-bone)); line-height: 1.3; }
.sofa-combo__dot { width: 18px; height: 18px; border-radius: 50%; border: 1px solid rgb(var(--c-ink3)); flex: none; }
.sofa-combo__list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; font-size: 13.5px; color: rgb(var(--c-muted)); }
.sofa-combo__list b { color: rgb(var(--c-bone)); font-weight: 600; }
.sofa-combo__go { display: inline-block; margin-top: 12px; font-size: 13.5px; font-weight: 600; color: var(--action); text-underline-offset: 3px; }
