/* Create By Asking: paper snowflake maker. Loaded after style.css, tools.css and family.css. */

#snowflake-tool { scroll-margin-top: 84px; grid-template-columns: minmax(0, 1fr) 286px; align-items: start; gap: 20px 28px; }
.sf > * { min-width: 0; }
.sf-main { display: grid; gap: 12px; }
.sf-top { display: flex; flex-wrap: wrap; gap: 8px 14px; align-items: center; justify-content: space-between; min-height: 32px; }
.sf-openmsg { display: none; margin: 0; color: #CBBFE8; font-size: var(--step--1); }
.sf-openmsg b { color: #FFC93C; }
.sf[data-view="open"] .sf-top .f-row { display: none; }
.sf[data-view="open"] .sf-openmsg { display: block; }
.sf .chip-dark:disabled { opacity: 0.35; cursor: default; }
.sf .chip-dark:focus-visible, .sf-swatch:focus-visible, .sf-tray button:focus-visible, .sf .btn:focus-visible, .sf-side button:focus-visible { outline: 2px solid #FFC93C; outline-offset: 2px; }

/* the stage: a night sky with a few stars, the canvas on top */
.sf-stage {
  position: relative; height: clamp(360px, 46vw, 540px); border-radius: 14px; overflow: hidden; touch-action: none;
  background:
    radial-gradient(1.2px 1.2px at 12% 18%, rgba(255, 255, 255, 0.55), transparent 60%),
    radial-gradient(1px 1px at 78% 12%, rgba(255, 255, 255, 0.5), transparent 60%),
    radial-gradient(1.4px 1.4px at 88% 64%, rgba(255, 255, 255, 0.4), transparent 60%),
    radial-gradient(1px 1px at 22% 78%, rgba(255, 255, 255, 0.45), transparent 60%),
    radial-gradient(1.2px 1.2px at 60% 88%, rgba(255, 255, 255, 0.35), transparent 60%),
    radial-gradient(1px 1px at 40% 8%, rgba(255, 255, 255, 0.4), transparent 60%),
    radial-gradient(ellipse at 50% 40%, #33277A 0%, #1A1147 58%, #0B0624 100%);
}
.sf-stage canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; -webkit-user-select: none; user-select: none; }
.sf-hint { position: absolute; left: 50%; top: 14px; transform: translateX(-50%); margin: 0; padding: 8px 14px; border-radius: 999px; background: rgba(11, 6, 36, 0.78); color: #F2ECFF; font: 600 0.82rem/1.25 var(--body); text-align: center; pointer-events: none; width: max-content; max-width: calc(100% - 28px); box-shadow: 0 0 0 1px rgba(255, 201, 60, 0.35); animation: sf-bob 2.4s ease-in-out infinite; }
.sf-hint::before { content: "✂ "; color: #FFC93C; }
@keyframes sf-bob { 50% { transform: translate(-50%, -4px); } }
.sf-polybar { position: absolute; right: 12px; bottom: 12px; display: flex; gap: 8px; }
.sf-polybar .btn { padding: 9px 14px; font-size: 0.85rem; }
.sf-polybar .btn:disabled { opacity: 0.5; cursor: default; }
.sf-polybar .btn-ghost { background: rgba(11, 6, 36, 0.7); }

/* under the stage: the big Unfold button */
.sf-go { display: flex; flex-wrap: wrap; gap: 10px 12px; align-items: center; }
.sf-go .btn { font-size: 1.05rem; padding: 13px 22px; }
.sf-unfold, .sf-refold { min-width: 150px; justify-content: center; }
.tool-shell .sf-unfold { background: #FFC93C; box-shadow: 0 6px 22px -6px rgba(255, 201, 60, 0.7); }
.sf-unfold::before { content: ""; width: 18px; height: 18px; background: currentColor; -webkit-mask: var(--sf-flake) center / contain no-repeat; mask: var(--sf-flake) center / contain no-repeat; }
.sf { --sf-flake: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round'%3E%3Cpath d='M12 2v20M3.3 7l17.4 10M3.3 17 20.7 7M9.5 3.5 12 6l2.5-2.5M9.5 20.5 12 18l2.5 2.5'/%3E%3C/svg%3E"); }
.sf-status { flex: 1 1 220px; margin: 0; color: #CBBFE8; font-size: var(--step--1); min-height: 1.4em; }

/* the side panel */
.sf-side { display: grid; gap: 18px; align-content: start; }
.sf-group { display: grid; gap: 9px; }
.sf-h { margin: 0; font: 600 0.68rem/1 var(--mono); letter-spacing: 0.08em; text-transform: uppercase; color: #A597CC; display: flex; gap: 6px; align-items: baseline; }
.sf-h small { font: 500 0.68rem/1 var(--body); letter-spacing: 0; text-transform: none; color: #8C7FB8; }
.sf-swatches { display: grid; grid-template-columns: repeat(8, minmax(0, 1fr)); gap: 6px; }
.sf-swatch { aspect-ratio: 1; width: 100%; max-width: 34px; border-radius: 50%; border: 0; cursor: pointer; background: var(--c); box-shadow: inset 0 -3px 0 rgba(0, 0, 0, 0.12), 0 0 0 2px rgba(255, 255, 255, 0.06); padding: 0; }
.sf-swatch[aria-pressed="true"] { box-shadow: 0 0 0 2px #1C0F3F, 0 0 0 4px #FFC93C; }
.sf-presets { display: flex; flex-wrap: wrap; gap: 6px; }
.sf-btns { display: grid; gap: 7px; }
.sf-btns > button { display: flex; align-items: center; gap: 10px; width: 100%; border: 0; border-radius: 10px; padding: 10px 12px; background: rgba(255, 255, 255, 0.07); color: #F2ECFF; font: 600 0.88rem/1.2 var(--body); text-align: left; cursor: pointer; }
.sf-btns > button:hover { background: rgba(255, 255, 255, 0.13); }
.sf-btns > button svg { flex: none; width: 18px; height: 18px; fill: none; stroke: #FFC93C; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.sf-btns > button small { margin-left: auto; color: #A597CC; font-weight: 500; font-size: 0.72rem; }
.sf-check { display: flex !important; align-items: center; gap: 8px !important; font-size: 0.8rem !important; color: #CBBFE8 !important; cursor: pointer; padding-left: 2px; }
.tool-shell .sf-check input { width: 16px; height: 16px; accent-color: #FFC93C; margin: 0; padding: 0; flex: none; }
.tool-shell .sf-snow-btn { width: 100%; justify-content: center; background: linear-gradient(135deg, #8FD3FF, #C9B6FF); color: #1C0F3F; font-size: 1rem; padding: 13px 18px; }
.sf-snow-btn::before { content: "❄"; font-size: 1.1rem; line-height: 1; }
.sf-tray { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
.sf-tray:empty { display: none; }
.sf-tray-item { position: relative; }
.sf-tray-item > button:first-child { display: block; width: 100%; padding: 0; border: 0; border-radius: 9px; overflow: hidden; cursor: pointer; background: #1A1147; box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.08); }
.sf-tray-item img { display: block; width: 100%; height: auto; aspect-ratio: 1; }
.sf-tray-del { position: absolute; top: -5px; right: -5px; width: 20px; height: 20px; border-radius: 50%; border: 0; background: #2A1A5A; color: #CBBFE8; font: 700 0.8rem/1 var(--body); cursor: pointer; padding: 0; opacity: 0.85; }
.sf-tray-del:hover { background: #FF7A62; color: #1C0F3F; }
.sf-empty { margin: 0; font-size: 0.78rem; color: #A597CC; }
.sf > .tool-note { grid-column: 1 / -1; margin: 0; }

@media (max-width: 900px) {
  #snowflake-tool { grid-template-columns: minmax(0, 1fr); }
  .sf-tray { grid-template-columns: repeat(6, minmax(0, 1fr)); }
}
@media (max-width: 520px) {
  .sf-stage { height: 380px; }
  .sf-go .btn { flex: 1 1 140px; justify-content: center; }
  .sf-tray { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

/* let it snow: full screen night sky */
.sf-snow { position: fixed; inset: 0; z-index: 2000; background: #0B0624; }
.sf-snow[hidden] { display: none; }
.sf-snow canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.sf-snow-bar { position: absolute; top: max(14px, env(safe-area-inset-top)); left: 16px; right: 16px; display: flex; align-items: center; justify-content: space-between; gap: 12px; pointer-events: none; }
.sf-snow-bar p { margin: 0; color: rgba(242, 236, 255, 0.75); font: 600 0.85rem/1.3 var(--body); animation: sf-fade 6s 2s forwards; }
.sf-snow-bar .btn { pointer-events: auto; background: rgba(255, 255, 255, 0.14); color: #fff; backdrop-filter: blur(6px); }
.sf-snow-bar .btn:hover { background: rgba(255, 255, 255, 0.24); }
@keyframes sf-fade { to { opacity: 0; } }
.sf-snow-ctl { position: absolute; left: 50%; bottom: max(18px, env(safe-area-inset-bottom)); transform: translateX(-50%); display: flex; flex-wrap: wrap; justify-content: center; gap: 10px 22px; padding: 10px 18px; border-radius: 16px; background: rgba(11, 6, 36, 0.82); box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.14); color: #F2ECFF; font: 600 0.85rem/1.2 var(--body); width: max-content; max-width: calc(100% - 32px); }
.sf-snow-ctl label { display: grid; grid-template-columns: 4.6em 1fr 5.5em; align-items: center; gap: 10px; }
.sf-snow-ctl input { width: 130px; accent-color: #8FD3FF; }
.sf-snow-ctl output { min-width: 5.5em; color: #CBBFE8; font-weight: 500; }
html.sf-lock, html.sf-lock body { overflow: hidden; }

/* printing: only the snowflake pages print */
.sf-print { display: none; }
@media print {
  @page { margin: 10mm; }
  html, body { background: #fff !important; margin: 0 !important; padding: 0 !important; }
  body > *:not(.sf-print) { display: none !important; }
  .sf-print { display: block !important; color: #1C0F3F; font-family: "Figtree", Arial, sans-serif; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .sf-page { width: 186mm; margin: 0 auto; break-inside: avoid; page-break-inside: avoid; }
  .sf-page-one { text-align: center; padding-top: 18mm; }
  .sf-page-one img { width: 175mm; height: 175mm; display: block; margin: 0 auto; }
  .sf-page-one p { margin: 6mm 0 0; font-size: 11pt; color: #5F5580; }
  .sf-page-sheet { display: grid; grid-template-columns: repeat(2, 82mm); grid-auto-rows: 82mm; gap: 2mm 10mm; justify-content: center; }
  .sf-page-sheet img { width: 82mm; height: 82mm; display: block; }
  .sf-page-tpl h1 { font: 700 18pt/1.1 "Bricolage Grotesque", Arial, sans-serif; margin: 0 0 2mm; }
  .sf-tpl-sub { margin: 0 0 5mm; font-size: 10pt; color: #5F5580; }
  .sf-tpl-steps { list-style: none; margin: 0 0 6mm; padding: 0; display: grid; grid-template-columns: repeat(5, 1fr); gap: 4mm; }
  .sf-tpl-steps li { display: grid; gap: 2mm; align-content: start; justify-items: center; text-align: center; }
  .sf-tpl-steps svg, .sf-tpl-steps img { width: 24mm; height: 24mm; display: block; }
  .sf-tpl-steps p { margin: 0; font-size: 8.5pt; line-height: 1.3; }
  .sf-tpl-main { display: flex; gap: 10mm; align-items: flex-start; border-top: 0.3mm dashed #C7CEDB; padding-top: 5mm; }
  .sf-wedge { flex: none; display: block; }
  .sf-tpl-side { flex: 1; display: grid; gap: 3mm; font-size: 10pt; }
  .sf-tpl-side ul { margin: 1mm 0 0; padding-left: 5mm; display: grid; gap: 1.5mm; line-height: 1.35; }
  .sf-tpl-k { margin: 0; display: flex; align-items: center; gap: 3mm; }
  .sf-tpl-k i { width: 8mm; height: 5mm; display: inline-block; }
  .sf-tpl-k i.g { background: #C7CEDB; border: 0.3mm solid #1C0F3F; }
  .sf-tpl-k i.l { height: 0; border-top: 0.6mm solid #1C0F3F; }
  .sf-tpl-side figure { margin: 2mm 0 0; text-align: center; }
  .sf-tpl-side figure img { width: 62mm; height: 62mm; }
  .sf-tpl-side figcaption { font-size: 9pt; color: #5F5580; }
}
