/* ==========================================================================
   v8 — image pickers, stage backgrounds, winner sprinkles, stronger
   palette-following page background, long-form content. Classes only.
   ========================================================================== */

/* ---------- page background follows the wheel colours ---------- */
html.v8-tint {
  --tint-a: 13%; --tint-b: 9%; --tint-band: 9%;
  transition: --hero-c1 .7s ease, --hero-c2 .7s ease, --hero-c3 .7s ease;
}
html.v8-tint[data-theme="dark"] { --tint-a: 16%; --tint-b: 10%; --tint-band: 10%; }
html.v8-tint body {
  background:
    linear-gradient(180deg,
      color-mix(in srgb, var(--hero-c1) var(--tint-a), var(--bg)) 0,
      color-mix(in srgb, var(--hero-c2) var(--tint-b), var(--bg)) 900px,
      color-mix(in srgb, var(--hero-c1) var(--tint-b), var(--bg)) 100%);
  background-attachment: scroll;
}
html.v8-tint .below-fold .content-section.band-alt {
  --bg-muted: color-mix(in srgb, var(--hero-c1) var(--tint-band), var(--bg));
}
html.v8-tint .studio.studio-hero {
  --hero-a1: 40%; --hero-a2: 28%; --hero-a3: 26%; --glow-a: 34%;
  background:
    radial-gradient(80% 60% at 50% -12%, color-mix(in srgb, var(--hero-c1) var(--hero-a1), transparent) 0%, transparent 100%),
    radial-gradient(52% 70% at 0% 40%, color-mix(in srgb, var(--hero-c2) var(--hero-a2), transparent) 0%, transparent 74%),
    radial-gradient(52% 70% at 80% 100%, color-mix(in srgb, var(--hero-c3) var(--hero-a3), transparent) 0%, transparent 74%),
    color-mix(in srgb, var(--hero-c1) 12%, var(--bg));
}
html.v8-tint .studio.studio-hero.hero-mono { --hero-a1: 18%; --hero-a2: 12%; --hero-a3: 10%; }
html.v8-tint[data-theme="dark"] .studio.studio-hero { --hero-a1: 34%; --hero-a2: 22%; --hero-a3: 20%; }
@media (prefers-reduced-motion: reduce) { html.v8-tint { transition: none; } }

/* ---------- chosen stage background (gradient, pattern, photo or upload) ---------- */
html.v8-tint .studio.studio-hero.has-stage-bg,
.studio.studio-hero.has-stage-bg { background: var(--stage-bg); }
.studio.has-stage-bg .hero-head {
  background: color-mix(in srgb, var(--panel) 84%, transparent);
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
  border-radius: 16px; padding: 10px 18px; box-shadow: 0 6px 24px -14px rgba(15, 23, 42, .4);
  width: fit-content; max-width: 100%; margin-left: auto; margin-right: auto; box-sizing: border-box;
}
.studio.has-stage-bg .wheel-wrap::before { display: none; }
.studio.has-stage-bg .wheel-tools, .studio.has-stage-bg .stage-tools { background: color-mix(in srgb, var(--panel) 80%, transparent); border-radius: 999px; }

/* ---------- picker dialogs ---------- */
dialog.v8-picker {
  border: 0; padding: 0; background: transparent; max-width: min(620px, calc(100vw - 24px)); width: 100%;
  max-height: calc(100vh - 32px); overflow: visible; color: var(--text);
}
dialog.v8-picker::backdrop { background: rgba(15, 23, 42, .55); -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px); }
.v8pk-box {
  background: var(--panel); border: 1px solid var(--border); border-radius: 20px; box-shadow: 0 30px 80px -30px rgba(15, 23, 42, .55);
  display: flex; flex-direction: column; gap: 14px; padding: 18px 20px 16px; max-height: calc(100vh - 40px); box-sizing: border-box;
}
.v8pk-head { display: flex; align-items: center; gap: 12px; }
.v8pk-ico { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; color: var(--accent); background: var(--accent-soft, color-mix(in srgb, var(--accent) 14%, transparent)); flex: none; }
.v8pk-title { margin: 0; font-size: 1.15rem; font-weight: 750; letter-spacing: -.01em; flex: 1; }
.v8pk-x { width: 36px; height: 36px; border-radius: 10px; border: 1px solid var(--border); background: var(--panel); color: var(--text-secondary); display: grid; place-items: center; cursor: pointer; }
.v8pk-x:hover { color: var(--text); background: var(--bg-muted); }
.v8pk-seg { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; padding: 4px; border-radius: 12px; background: var(--bg-muted); border: 1px solid var(--border); }
.v8pk-tab { border: 0; border-radius: 9px; padding: 8px 10px; font: inherit; font-weight: 650; font-size: .9rem; color: var(--text-secondary); background: transparent; cursor: pointer; }
.v8pk-tab.is-on { background: var(--panel); color: var(--text); box-shadow: 0 1px 3px rgba(15, 23, 42, .14); }
.v8pk-current { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 14px; background: var(--bg-muted); }
.v8pk-cur-thumb { width: 48px; height: 48px; border-radius: 10px; overflow: hidden; flex: none; background: var(--panel); border: 1px solid var(--border); display: grid; place-items: center; }
.v8pk-cur-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.v8pk-cur-thumb.is-empty { background: repeating-linear-gradient(45deg, var(--bg-muted) 0 6px, var(--panel) 6px 12px); }
.v8pk-cur-thumb .v8pk-swatch { width: 100%; height: 100%; }
.v8pk-cur-txt { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.v8pk-cur-label { font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; font-weight: 700; color: var(--text-secondary); }
.v8pk-cur-name { font-weight: 650; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.v8pk-remove { display: inline-flex; align-items: center; gap: 6px; border: 1px solid color-mix(in srgb, #dc2626 35%, var(--border)); color: #dc2626; background: color-mix(in srgb, #dc2626 8%, var(--panel)); border-radius: 10px; padding: 7px 12px; font: inherit; font-weight: 650; font-size: .86rem; cursor: pointer; }
.v8pk-remove:hover:not(:disabled) { background: #dc2626; color: #fff; }
.v8pk-remove:disabled { opacity: .45; cursor: not-allowed; }
.v8pk-pane { min-height: 0; display: flex; flex-direction: column; gap: 12px; overflow: auto; max-height: min(52vh, 440px); padding: 2px; }
.v8pk-pane[hidden] { display: none; }
.v8pk-chips { display: flex; flex-wrap: wrap; gap: 8px; position: sticky; top: 0; z-index: 1; background: var(--panel); padding-bottom: 4px; }
.v8pk-chip { display: inline-flex; align-items: center; gap: 8px; border: 1px solid var(--border); background: var(--panel); color: var(--text); border-radius: 999px; padding: 6px 8px 6px 14px; font: inherit; font-weight: 650; font-size: .88rem; cursor: pointer; }
.v8pk-count { min-width: 24px; padding: 1px 7px; border-radius: 999px; font-size: .75rem; background: var(--bg-muted); color: var(--text-secondary); text-align: center; }
.v8pk-chip.is-on { background: var(--accent); border-color: var(--accent); color: #fff; }
.v8pk-chip.is-on .v8pk-count { background: rgba(255, 255, 255, .25); color: #fff; }
.v8pk-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.v8pk-tile { position: relative; aspect-ratio: 1 / 1; border-radius: 14px; overflow: hidden; padding: 0; border: 2px solid var(--border); background: var(--bg-muted); cursor: pointer; transition: transform .15s ease, border-color .15s ease, box-shadow .15s ease; }
.v8pk-grid-bg .v8pk-tile { aspect-ratio: 4 / 3; }
.v8pk-tile img { width: 100%; height: 100%; object-fit: cover; display: block; }
.v8pk-tile:hover { transform: translateY(-2px); border-color: color-mix(in srgb, var(--accent) 50%, var(--border)); }
.v8pk-tile:focus-visible { outline: 3px solid color-mix(in srgb, var(--accent) 45%, transparent); outline-offset: 2px; }
.v8pk-tile.is-selected { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 35%, transparent); }
.v8pk-tile.is-selected::after { content: ""; position: absolute; right: 6px; top: 6px; width: 20px; height: 20px; border-radius: 50%; background: var(--accent) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 6 9 17l-5-5'/%3E%3C/svg%3E") center / 13px no-repeat; }
.v8pk-swatch { display: block; width: 100%; height: 100%; background: var(--sw); }
.v8pk-drop { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; text-align: center; padding: 34px 18px; border: 2px dashed var(--border); border-radius: 16px; background: var(--bg-muted); cursor: pointer; }
.v8pk-drop.is-over, .v8pk-drop:hover { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 6%, var(--panel)); }
.v8pk-drop-ico { color: var(--accent); }
.v8pk-drop-note { font-size: .84rem; color: var(--text-secondary); max-width: 360px; }
.v8pk-file { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.v8pk-foot { display: flex; justify-content: flex-end; padding-top: 4px; border-top: 1px solid var(--border); }
.v8pk-cancel { margin-top: 10px; }
@media (max-width: 520px) {
  .v8pk-box { padding: 14px 14px 12px; gap: 12px; }
  .v8pk-grid { gap: 8px; }
  .v8pk-remove span { display: none; }
}
.v8-toast { position: fixed; left: 50%; bottom: 22px; transform: translate(-50%, 20px); opacity: 0; z-index: 2147483000; background: #0f172a; color: #fff; padding: 10px 16px; border-radius: 12px; font-size: .9rem; box-shadow: 0 10px 30px -10px rgba(0, 0, 0, .5); transition: opacity .2s ease, transform .2s ease; pointer-events: none; max-width: calc(100vw - 32px); }
.v8-toast.is-on { opacity: 1; transform: translate(-50%, 0); }

/* ---------- winner sprinkles over the banner ---------- */
.stw-banner canvas.v8-sprinkles { position: fixed; inset: 0; width: 100vw; height: 100vh; pointer-events: none; z-index: 5; opacity: var(--sprinkle-o, 1); display: none; }
.stw-banner canvas.v8-sprinkles.is-on { display: block; }
.stw-banner .stw-banner-ribbon { z-index: 3; }

/* ---------- tool pages use the homepage width ---------- */
.below-fold .prose.prose-wide.v8-tool { max-width: 1120px; }

/* ---------- long-form content (guides and tool pages) ---------- */
.below-fold .content-section.v8-long .section-head { max-width: 780px; }
.below-fold .content-section.v8-long .section-body.v8-read { max-width: 780px; text-align: left; }
.v8-read h3 { margin: 26px 0 8px; }
.v8-read h3:first-child { margin-top: 0; }
.v8-read ul, .v8-read ol { margin: 0 0 16px; padding-left: 1.3em; }
.v8-read li { margin: 0 0 8px; }
.v8-read .v8-note { margin: 18px 0; padding: 14px 18px; border-left: 4px solid var(--accent); border-radius: 0 12px 12px 0; background: color-mix(in srgb, var(--accent) 7%, var(--panel)); }
.v8-read .v8-note p { margin: 0; color: var(--text); }
.v8-table-wrap { overflow-x: auto; margin: 6px 0 18px; border: 1px solid var(--border); border-radius: 12px; }
.v8-table-wrap table { border-collapse: collapse; width: 100%; font-size: .94rem; }
.v8-table-wrap th, .v8-table-wrap td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--border); vertical-align: top; }
.v8-table-wrap th { background: var(--bg-muted); color: var(--text); font-weight: 700; }
.v8-table-wrap tr:last-child td { border-bottom: 0; }
.v8-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 18px; text-align: left; }
.v8-cards .ibox { padding: 20px; }
.v8-cards .ibox h3 { margin: 0 0 8px; }
.v8-cards .ibox p { font-size: .95rem; }
.v8-steps { list-style: none; counter-reset: v8s; padding: 0; margin: 0; display: grid; gap: 14px; max-width: 860px; margin-inline: auto; text-align: left; }
.v8-steps > li { counter-increment: v8s; position: relative; padding: 18px 20px 18px 70px; border: 1px solid var(--border); border-radius: 16px; background: var(--panel); }
.v8-steps > li::before { content: counter(v8s); position: absolute; left: 18px; top: 18px; width: 36px; height: 36px; border-radius: 12px; display: grid; place-items: center; font-weight: 800; color: #fff; background: var(--accent); }
.v8-steps h3 { margin: 4px 0 6px; }
.below-fold .content-section:not(.band-alt) .v8-steps > li { background: var(--bg-muted); }
@media (max-width: 640px) { .v8-steps > li { padding: 16px 16px 16px 62px; } .v8-steps > li::before { left: 14px; } }

/* guide hero image */
.post-cover.v8-hero { margin: 0 auto 8px; border-radius: 20px; overflow: hidden; border: 1px solid var(--border); aspect-ratio: 16 / 9; background: var(--bg-muted); }
.post-cover.v8-hero img { display: block; width: 100%; height: 100%; object-fit: cover; margin: 0; border: 0; border-radius: 0; }
.below-fold .content-section.v8-long .v8-read p, .below-fold .content-section.v8-long .v8-read li { font-size: 17px; line-height: 1.75; color: var(--text); }
/* v8: original v7 copy on tool pages matches the long-form sections */
article.prose.v8-tool .content-section p, article.prose.v8-tool .content-section li { font-size: 17px; line-height: 1.75; color: var(--text); }
article.prose.v8-tool .content-section .ibox p[class*="ibox-tone"], article.prose.v8-tool .content-section .v8-cards p { font-size: 16px; }
article.prose.v8-tool .faq .faq-a, article.prose.v8-tool .faq .faq-a p { font-size: 16px; line-height: 1.7; color: var(--text); }
article.prose.v8-tool .content-section td, article.prose.v8-tool .content-section th { font-size: 16px; }
