/* TRK-997: Sites > Websites as tiles with a preview of each home page, and Sites > Funnels as each funnel's goal and its
   steps in order (sites-list-997-view.js), in the app's own tokens. Calm: one preview per tile, plenty of space. */

/* ---- Previews: a fixed shape, so nothing moves while they draw ---- */
.sl-shot { position: relative; overflow: hidden; background: var(--sunken); border: 1px solid var(--border); border-radius: 10px; contain: strict; transition: border-color 150ms ease, box-shadow 150ms ease, transform 120ms ease; }
.sl-site-shot { aspect-ratio: 4 / 3; }
.fl-shot { aspect-ratio: 4 / 5; border-radius: 8px; }
.sl-shot iframe { position: absolute; top: 0; left: 0; border: 0; transform: scale(var(--sl-scale, 0.2)); transform-origin: 0 0; pointer-events: none; opacity: 0; transition: opacity 200ms ease; }
.sl-shot.is-drawn iframe { opacity: 1; }
.sl-shot.is-empty { display: grid; place-content: center; justify-items: center; gap: 6px; padding: 12px; background: transparent; border-style: dashed; color: var(--muted); font-size: 13px; text-align: center; contain: layout paint; }
.sl-icon { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0; }

/* ---- Websites ---- */
.sl-grid { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 280px), 1fr)); gap: 36px 28px; }
.sl-tile { position: relative; display: grid; gap: 12px; align-content: start; min-width: 0; }
.sl-meta { display: grid; gap: 4px; min-width: 0; }
.sl-top { display: flex; align-items: center; gap: 8px; min-width: 0; }
.sl-open { flex: 0 1 auto; min-width: 0; padding: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font: inherit; font-size: 15px; font-weight: 600; text-align: left; color: var(--text); background: none; border: 0; border-radius: 0; cursor: pointer; }
.sl-open:hover { background: none; }
/* No press shrink on the name: a transform would shrink the area below too, and a press on the preview would miss */
.sl-open:active { transform: none; }
.sl-tile:active .sl-shot:not(.is-empty) { transform: scale(0.99); }
/* The name's button covers the whole tile, so the preview opens the site too */
.sl-open::after { content: ""; position: absolute; inset: 0; border-radius: 10px; }
.sl-open:focus-visible { outline: none; }
.sl-tile:has(.sl-open:focus-visible) .sl-shot { outline: 2px solid var(--accent); outline-offset: 2px; }
.sl-lines { display: grid; gap: 2px; min-width: 0; }
.sl-numbers { font-size: 13px; font-variant-numeric: tabular-nums; color: var(--text); }
.sl-quiet { font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sl-place { overflow-wrap: anywhere; }
@media (hover: hover) and (pointer: fine) {
  .sl-tile:hover .sl-shot:not(.is-empty), .fl-step-open:hover .sl-shot:not(.is-empty) { border-color: var(--muted); box-shadow: 0 6px 18px -8px rgb(16 24 40 / 0.28); }
  .sl-tile:hover .sl-shot.is-empty, .fl-step-open:hover .sl-shot.is-empty { border-color: var(--muted); }
}
.sl-tile.is-loading .sl-shot { border-color: transparent; }
.sl-skel { height: 38px; width: 70%; border-radius: 6px; background: var(--sunken); }

/* ---- An empty list teaches the next step ---- */
.sl-empty { display: grid; justify-items: center; gap: 8px; max-width: 440px; margin: 56px auto; padding: 0 16px; text-align: center; }
.sl-empty h2 { margin: 12px 0 0; font-size: 18px; text-wrap: balance; }
.sl-empty p { margin: 0 0 8px; text-wrap: pretty; }
.sl-empty button { display: inline-flex; align-items: center; gap: 6px; }
.sl-empty button .sl-icon { width: 16px; height: 16px; stroke-width: 2; }
.sl-empty-art { display: flex; align-items: flex-end; justify-content: center; gap: 10px; height: 76px; }
.sl-empty-art span { display: block; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); box-shadow: 0 1px 2px rgb(16 24 40 / 0.06); }
.sl-empty-art span::before { content: ""; display: block; height: 30%; border-radius: 7px 7px 0 0; background: var(--sunken); }
.sl-empty-sites .sl-empty-art span { width: 72px; height: 54px; }
.sl-empty-sites .sl-empty-art span:nth-child(2) { width: 92px; height: 69px; }
.sl-empty-funnels .sl-empty-art span { width: 44px; height: 56px; }
.sl-empty-funnels .sl-empty-art { align-items: center; gap: 18px; }

/* ---- Funnels: the goal, then the steps in order ---- */
.fl-lanes { display: grid; gap: 16px; }
.fl-lane { padding-bottom: 18px; min-width: 0; }
.fl-line { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 8px; min-width: 0; }
.fl-goal { font-size: 13px; font-weight: 600; color: var(--text); }
.fl-numbers { color: var(--text); }
/* Under the name, past the arrow that opens the steps to arrange */
.fl-lane > .fl-steps, .fl-lane > .fl-none { margin: 4px 14px 0 40px; }
.fl-none { font-size: 13px; }
.fl-steps { --fl-w: 148px; list-style: none; padding: 4px 2px 6px; display: flex; gap: 32px; overflow-x: auto; overscroll-behavior-x: contain; scroll-snap-type: x proximity; scrollbar-width: thin; scrollbar-color: var(--border) transparent; }
.fl-step { position: relative; flex: 0 0 var(--fl-w); min-width: 0; scroll-snap-align: start; }
/* A small arrow between steps, in the gap */
.fl-step + .fl-step::before { content: ""; position: absolute; left: -19px; top: calc(var(--fl-w) * 5 / 8 + 4px); width: 7px; height: 7px; border-top: 1.5px solid var(--muted); border-right: 1.5px solid var(--muted); transform: translate(0, -50%) rotate(45deg); }
.fl-step-open { display: grid; gap: 8px; width: 100%; padding: 0; text-align: left; font: inherit; color: var(--text); background: none; border: 0; border-radius: 8px; cursor: pointer; }
.fl-step-open:hover { background: none; }
.fl-step-open:focus-visible { outline: none; }
.fl-step-open:focus-visible .sl-shot { outline: 2px solid var(--accent); outline-offset: 2px; }
.fl-step-name { display: flex; align-items: center; gap: 6px; min-width: 0; font-size: 13px; }
.fl-step-num { flex-shrink: 0; width: 18px; height: 18px; display: grid; place-items: center; border-radius: 999px; background: var(--sunken); border: 1px solid var(--border); color: var(--muted); font-size: 11px; font-weight: 600; font-variant-numeric: tabular-nums; }
.fl-step-text { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }


@media (max-width: 600px) {
  .sl-grid { gap: 32px; }
  .fl-steps { --fl-w: 116px; gap: 28px; }
  .fl-step + .fl-step::before { left: -17px; }
  .fl-lane > .fl-steps, .fl-lane > .fl-none { margin-left: 14px; }
}
@media (prefers-reduced-motion: reduce) { .sl-shot, .sl-shot iframe { transition: none; } }
