/* Cek shade (js/shade.js): the shade-finder dialog (.welcome.sf) and its inline form on /shade/ (.sf-inline).
   Loaded by js/shade.js on first use; /shade/ links it in <head>. Builds on css/style.css (tokens, .welcome,
   .btn, .kicker): hairlines, no shadows, one ember accent, Playfair headings, mono labels. */

.sf { width: min(560px, calc(100vw - 32px)); }
.sf-in { padding: 28px 28px 24px; }
.sf .kicker { margin-right: 44px; }
.sf h2 { margin-top: 10px; font: 400 clamp(28px, 4.4vw, 34px)/1.08 var(--serif); letter-spacing: -0.005em; text-wrap: balance; }
.sf h2 em { font-style: italic; color: var(--accent); }
.sf-lead { margin-top: 12px; font-size: 15px; line-height: 1.6; color: var(--fg-2); }
.sf-lead b { color: var(--fg); font-weight: 600; }
.sf-note { margin-top: 12px; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--tint); font-size: 13.5px; line-height: 1.55; color: var(--fg-2); }
.sf-fine { margin-top: 16px; font-size: 12.5px; line-height: 1.5; color: var(--muted); }
.sf-lbl { margin-top: 22px; font: 500 10.5px/1.3 var(--mono); letter-spacing: .12em; text-transform: uppercase; color: var(--dim); }
.sf-link { padding: 0; border: 0; background: none; color: var(--accent); font: 600 14px/1.3 var(--sans); text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.sf-link:hover { color: var(--accent-2); }
:root[data-theme="light"] .sf-link { color: var(--accent-2); }
.sf-warn { display: block; margin-top: 12px; color: var(--accent-2); font-size: 13.5px; font-weight: 500; line-height: 1.5; }

/* the three ways in */
.sf-ways { display: grid; gap: 10px; margin-top: 22px; }
.sf-way {
  display: grid; grid-template-columns: 40px minmax(0, 1fr); gap: 14px; align-items: center; text-align: left;
  padding: 14px 16px; border: 1px solid var(--line-2); border-radius: var(--r); background: none; color: var(--fg); cursor: pointer;
  transition: border-color .18s, background-color .18s;
}
.sf-way:hover { border-color: var(--line-3); background: var(--hover); }
.sf-way svg { width: 40px; height: 40px; fill: none; stroke: var(--accent); stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.sf-way b { display: block; font: 600 15px/1.3 var(--sans); }
.sf-way small { display: block; margin-top: 3px; color: var(--muted); font-size: 13px; line-height: 1.4; }
.sf-saved { margin-top: 16px; font-size: 13.5px; color: var(--muted); }
.sf-saved b { color: var(--fg); font-weight: 600; }

/* camera */
.sf-cam { position: relative; margin-top: 18px; aspect-ratio: 3 / 4; max-height: min(52vh, 440px); border-radius: var(--r); overflow: hidden; background: #000; border: 1px solid var(--line); }
.sf-video { width: 100%; height: 100%; object-fit: cover; transform: scaleX(-1); }
.sf-guide { position: absolute; inset: 0; pointer-events: none; }
.sf-guide::before {
  content: ''; position: absolute; left: 50%; top: 48%; width: 54%; aspect-ratio: 3 / 4; transform: translate(-50%, -50%);
  border: 1.5px dashed rgba(255, 255, 255, .75); border-radius: 50%; box-shadow: 0 0 0 999px rgba(0, 0, 0, .28);
}
.sf-cam-msg { position: absolute; inset: 0; display: grid; place-items: center; padding: 24px; text-align: center; background: var(--surface); color: var(--fg-2); font-size: 14px; line-height: 1.55; }

/* the photo and the sample spot */
.sf-shot { position: relative; margin-top: 18px; border-radius: var(--r); overflow: hidden; border: 1px solid var(--line); background: var(--bg-2); cursor: crosshair; touch-action: manipulation; }
.sf-canvas { display: block; width: 100%; height: auto; max-height: min(52vh, 440px); object-fit: contain; }
.sf-spot {
  position: absolute; width: 34px; height: 34px; transform: translate(-50%, -50%); pointer-events: none;
  border: 2px solid #fff; border-radius: 50%; box-shadow: 0 0 0 2px rgba(0, 0, 0, .45), inset 0 0 0 2px rgba(0, 0, 0, .35);
}
.sf-spot::after { content: ''; position: absolute; left: 50%; top: 50%; width: 4px; height: 4px; transform: translate(-50%, -50%); border-radius: 50%; background: #fff; }
.sf-read { display: flex; align-items: center; gap: 10px; min-height: 30px; margin-top: 14px; font-size: 15px; color: var(--fg-2); }
.sf-read b { color: var(--fg); font-weight: 600; }
.sf-read small { color: var(--muted); font-size: 13px; }
.sf-chip, .sf-sw-s { flex: none; width: 26px; height: 26px; border-radius: 50%; background: var(--c); border: 1px solid var(--line-2); }
.sf-sw-s { margin-left: auto; width: 20px; height: 20px; }
.sf-read .sf-warn { margin-top: 0; }

/* questions */
.sf-opts { display: grid; gap: 8px; margin-top: 20px; }
.sf-opt {
  display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 14px; align-items: center; text-align: left;
  min-height: 56px; padding: 10px 16px; border: 1px solid var(--line-2); border-radius: var(--r-sm); background: none; color: var(--fg); cursor: pointer;
  transition: border-color .18s, background-color .18s;
}
.sf-opt:hover { border-color: var(--line-3); background: var(--hover); }
.sf-opt[aria-checked="true"] { border-color: var(--accent); background: var(--tint-2); box-shadow: inset 0 0 0 1px var(--accent); }
.sf-opt b { display: block; font: 600 14.5px/1.3 var(--sans); }
.sf-opt small { display: block; margin-top: 2px; color: var(--muted); font-size: 12.5px; line-height: 1.4; }
.sf-opt > span:not(.sf-sw) { grid-column: 2; }
.sf-opt:not(:has(.sf-sw)) { grid-template-columns: minmax(0, 1fr); }
.sf-opt:not(:has(.sf-sw)) > span { grid-column: 1; }
.sf-sw { flex: none; width: 34px; height: 34px; border-radius: 50%; background: var(--c); border: 1px solid var(--line-2); }
.sf-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 20px; }
.sf-dots { display: inline-flex; gap: 6px; }
.sf-dots i { width: 7px; height: 7px; border-radius: 50%; background: var(--line-3); }
.sf-dots i.on { background: var(--accent); }

/* the result */
.sf-res { display: grid; grid-template-columns: 72px minmax(0, 1fr); gap: 18px; align-items: center; margin-top: 14px; }
.sf-big { width: 72px; height: 72px; border-radius: 50%; background: var(--c); border: 1px solid var(--line-2); box-shadow: inset 0 0 0 4px var(--pop-bg), inset 0 0 0 5px var(--line-2); }
.sf-res h2 { margin-top: 0; }
.sf-sure { display: flex; align-items: center; gap: 8px; margin-top: 8px; font-size: 13.5px; color: var(--muted); }
.sf-sure b { color: var(--fg); font-weight: 600; }
.sf-sure i { width: 8px; height: 8px; border-radius: 50%; background: var(--line-3); }
.sf-sure i.ok { background: var(--wa); }
.sf-sure i.mid { background: var(--sand); }
.sf-sure i.low { background: var(--accent); }
.sf-products { list-style: none; display: grid; gap: 8px; margin: 10px 0 0; padding: 0; }
.sf-prod { display: grid; grid-template-columns: 56px minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 8px 10px 8px 8px; border: 1px solid var(--line); border-radius: var(--r-sm); }
.sf-prod img { width: 56px; height: 56px; object-fit: cover; border-radius: 8px; background: var(--hover); }
.sf-prod > div b { display: block; font: 600 14px/1.3 var(--sans); }
.sf-prod small { display: block; margin-top: 2px; color: var(--muted); font-size: 12.5px; line-height: 1.4; }
.sf-prod small b { display: inline; color: var(--fg-2); font: inherit; font-weight: 600; }
.sf-prod.is-out { opacity: .6; }
.sf-added { display: inline-flex; align-items: center; gap: 6px; padding: 0 12px; height: 34px; border-radius: 999px; background: var(--tint-2); color: var(--accent); font: 600 13px/1 var(--sans); }
.sf-added svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
:root[data-theme="light"] .sf-added { color: var(--accent-2); }
.sf-actions { margin-top: 22px; }
.sf-actions .sf-link { justify-self: center; }
.welcome-actions.sf-actions { display: grid; gap: 12px; }

/* inline on /shade/: a card in the page, not a popup */
.sf-inline { position: static; width: 100%; max-width: 640px; max-height: none; margin: 0; animation: none; }
.sf-inline[open] { animation: none; }
.sf-inline .sf-in { padding: 26px 24px 22px; }
.sf-inline .sf-cam, .sf-inline .sf-canvas { max-height: min(60vh, 520px); }

@media (max-width: 560px) {
  .sf-in { padding: 24px 18px 20px; }
  .sf-way { padding: 12px 14px; }
  .sf-res { grid-template-columns: 60px minmax(0, 1fr); gap: 14px; }
  .sf-big { width: 60px; height: 60px; }
  .sf-prod { grid-template-columns: 48px minmax(0, 1fr) auto; gap: 10px; }
  .sf-prod img { width: 48px; height: 48px; }
}
@media (prefers-reduced-motion: reduce) { .sf-way, .sf-opt { transition: none; } }
