/* The card maker, on top of app.css and about/about.css (header, footer, headings, buttons). */

/* The script hand for a card's lettering: Sofia (SIL Open Font License, fonts/OFL.txt), the one the site's logo is drawn in. */
@font-face { font-family: "Sofia"; src: url("fonts/sofia.woff2") format("woff2"); font-display: swap; }

.cd-hero { max-width: 780px; margin: 0 auto; text-align: center; }
.cd-hero .ab-lead { margin: 18px auto 0; }
.cd-hero .nb { display: inline-block; }

/* ---------------------------------------------------------------- the card beside the steps */

.cd-maker {
  display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); gap: 40px; align-items: start;
  max-width: 1140px; margin: 46px auto 0;
}
.cd-preview { position: sticky; top: calc(var(--head-h) - var(--head-hide, 0px) + 14px); }
.cd-stage { position: relative; display: flex; align-items: center; justify-content: center; min-height: 320px; padding: 9px; }
.cd-stage canvas {
  display: block; width: auto; height: auto; max-width: 100%; max-height: calc(100dvh - var(--head-h) - 178px);
  border-radius: 14px; opacity: 0; transition: opacity 0.25s; touch-action: none; user-select: none; -webkit-user-select: none;
  box-shadow: 0 0 0 6px #fff, 0 0 0 8px var(--sky-2), 0 24px 48px rgba(20, 70, 120, 0.18);
}
.cd-stage.ready canvas { opacity: 1; }
.cd-stage.dealt canvas { animation: cd-deal 0.34s cubic-bezier(0.3, 1.5, 0.5, 1); }   /* a new arrangement lands */
@keyframes cd-deal { from { transform: scale(0.955) rotate(-0.8deg); } to { transform: none; } }
.cd-wait { position: absolute; inset: 0; display: grid; place-items: center; margin: 0; color: var(--muted); font-size: 14.5px; pointer-events: none; }
.cd-stage.ready .cd-wait { display: none; }

/* the frame round the picked-up thing: only its two handles take the pointer, the card under it takes the rest */
.cd-sel {
  position: absolute; z-index: 2; box-sizing: border-box; border: 2px dashed var(--blue); border-radius: 10px; pointer-events: none;
  box-shadow: 0 0 0 1.5px rgba(255, 255, 255, 0.85), inset 0 0 0 1.5px rgba(255, 255, 255, 0.85);
}
.cd-sel[hidden] { display: none; }
.cd-h {
  position: absolute; display: grid; place-items: center; width: 30px; height: 30px; padding: 0; border: 0; border-radius: 50%;
  pointer-events: auto; touch-action: none; cursor: pointer; box-shadow: 0 0 0 2px #fff, 0 3px 8px rgba(20, 70, 120, 0.3);
}
.cd-h svg { width: 17px; height: 17px; }
.cd-h.grip { right: -16px; bottom: -16px; cursor: nwse-resize; background: var(--blue); color: #fff; }
.cd-h.x { left: -16px; top: -16px; background: #fff; color: var(--danger); }
.cd-sel.fixed .cd-h.x { display: none; }   /* the note stays */
@media (pointer: coarse) {
  .cd-h { width: 36px; height: 36px; }
  .cd-h.grip { right: -19px; bottom: -19px; }
  .cd-h.x { left: -19px; top: -19px; }
}

.cd-tools { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin-top: 14px; }
.cd-tool-set { display: flex; gap: 2px; padding: 4px; border-radius: 16px; background: #fff; box-shadow: 0 0 0 2px var(--sky-2), 0 6px 16px rgba(44, 132, 198, 0.1); }
.cd-tool {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px; min-width: 50px; padding: 5px 6px 4px; border: 0; border-radius: 12px;
  background: transparent; color: var(--deep); font: inherit; font-size: 11.5px; line-height: 1.3; cursor: pointer; transition: background 0.12s, transform 0.12s;
}
.cd-tool svg { width: 22px; height: 22px; }
.cd-tool:hover:not(:disabled) { background: var(--sky-1); }
.cd-tool:active:not(:disabled) { transform: scale(0.92); }
.cd-tool:disabled { opacity: 0.32; cursor: default; }
.cd-tool.danger { color: var(--danger); }
.cd-tool.bare { min-width: 40px; }
.cd-tool.bare span { display: none; }
.cd-word-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 8px 10px; margin-top: 10px; }
.cd-word-row[hidden] { display: none; }
.cd-word-row input {
  width: 190px; box-sizing: border-box; padding: 8px 12px; border: 1.5px solid var(--line); border-radius: 12px; background: #fff; color: var(--ink);
  font: inherit; font-size: 16px;
}
.cd-word-row input:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 3px rgba(74, 166, 224, 0.18); }
.cd-dots { display: flex; gap: 7px; }
.cd-dot { width: 24px; height: 24px; padding: 0; border: 0; border-radius: 50%; background: var(--c); cursor: pointer; box-shadow: 0 0 0 2px #fff, 0 0 0 3px rgba(35, 71, 106, 0.14); }
.cd-dot.on { box-shadow: 0 0 0 2px #fff, 0 0 0 4px var(--blue); }
.cd-seg { display: flex; gap: 2px; padding: 3px; border-radius: 999px; background: #fff; box-shadow: 0 0 0 1.5px var(--sky-2); }
.cd-seg button {
  padding: 4px 10px; border: 0; border-radius: 999px; background: transparent; color: var(--deep); font: inherit; font-size: 12.5px; line-height: 1.4; cursor: pointer;
}
.cd-seg button:hover { background: var(--sky-1); }
.cd-seg button.on { background: var(--blue); color: #fff; }
.cd-tip { max-width: 31em; margin: 12px auto 0; text-align: center; font-size: 12.5px; line-height: 1.6; color: var(--muted); }

.cd-steps { display: grid; grid-template-columns: minmax(0, 1fr); gap: 18px; }   /* minmax: a chip row's width must not widen it */
.cd-step { padding: 18px 20px 20px; border-radius: 20px; background: #fff; box-shadow: 0 0 0 2px var(--sky-2), 0 10px 26px rgba(44, 132, 198, 0.1); }
.cd-step h3 { display: flex; align-items: center; gap: 10px; margin: 0 0 14px; font-size: 19px; font-weight: normal; color: var(--deep); }
.cd-n { display: grid; place-items: center; width: 28px; height: 28px; flex: none; border-radius: 50%; background: var(--sky-1); font-size: 15px; }
.cd-sub { margin: 18px 0 8px; font-size: 13.5px; color: var(--muted); }
.cd-sub.first { margin-top: 0; }

/* 1. the occasion, and the dice */
.cd-occ { display: flex; flex-wrap: wrap; gap: 6px; }
.cd-chip {
  display: inline-flex; align-items: center; gap: 5px; padding: 6px 12px; border: 0; border-radius: 999px; cursor: pointer;
  background: var(--sky-1); color: var(--deep); font: inherit; font-size: 14px; line-height: 1.3; transition: background 0.12s;
}
.cd-chip:hover { background: var(--sky-2); }
.cd-chip.on { background: var(--blue); color: #fff; }
.cd-chip .cd-emo { font-size: 14px; }
.cd-chip small { padding: 0 7px; border-radius: 999px; background: #fff3c9; color: #a5791a; font-size: 11.5px; }
/* the occasion's templates: a row of small cards to scroll through */
.cd-gallery {
  display: flex; gap: 10px; margin: 0 -20px; padding: 4px 20px 10px; overflow-x: auto; overscroll-behavior-x: contain;
  scroll-snap-type: x proximity; scrollbar-width: thin; scrollbar-color: var(--sky-2) transparent;
}
.cd-tpl {
  flex: none; display: flex; flex-direction: column; align-items: center; gap: 5px; width: 96px; padding: 0; border: 0; background: none;
  color: var(--ink); font: inherit; font-size: 12.5px; line-height: 1.3; cursor: pointer; scroll-snap-align: center;
}
.cd-tpl canvas {
  display: block; width: 96px; height: 120px; border-radius: 10px; background: var(--sky-1);
  box-shadow: 0 0 0 2px var(--sky-2), 0 4px 10px rgba(44, 132, 198, 0.14); transition: transform 0.18s cubic-bezier(0.3, 1.5, 0.5, 1), box-shadow 0.15s;
}
.cd-tpl:hover canvas { transform: translateY(-3px) rotate(-1.5deg); }
.cd-tpl.on canvas { box-shadow: 0 0 0 3px var(--blue), 0 6px 14px rgba(44, 132, 198, 0.28); }
.cd-tpl.on { color: var(--deep); }
.cd-deal { display: flex; align-items: center; gap: 14px; margin-top: 8px; padding-top: 14px; border-top: 1px dashed var(--line); }
.cd-deal p { margin: 0; font-size: 13px; line-height: 1.55; color: var(--muted); }
.cd-dice { flex: none; gap: 8px; }
.cd-dice svg { width: 22px; height: 22px; }

/* 2. the sticker tray */
.cd-tray {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(76px, 1fr)); gap: 8px; max-height: 262px; margin: 12px -4px 0; padding: 4px;
  overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; scrollbar-color: var(--sky-2) transparent;
}
.cd-st {
  display: grid; place-items: center; aspect-ratio: 1; min-width: 0; padding: 6px; border: 0; border-radius: 14px; cursor: pointer;
  background: var(--sky-1); transition: transform 0.18s cubic-bezier(0.3, 1.5, 0.5, 1), background 0.12s;
}
.cd-st img, .cd-st canvas { display: block; width: 100%; height: 100%; min-height: 0; object-fit: contain; filter: drop-shadow(0 2px 3px rgba(30, 70, 110, 0.2)); }
.cd-st:hover { background: var(--sky-2); transform: translateY(-2px) rotate(-3deg); }   /* peeling up */
.cd-st:active { transform: scale(0.9); }
.cd-st.art { padding: 0; overflow: hidden; }
.cd-st.art img { object-fit: cover; object-position: top; filter: none; }
.cd-st.word { font: inherit; font-size: 27px; color: var(--blue); text-shadow: 0 0 0 #fff, 2px 0 #fff, -2px 0 #fff, 0 2px #fff, 0 -2px #fff, 0 3px 4px rgba(30, 70, 110, 0.25); }
.cd-tray-note { margin: 8px 0 0; font-size: 13px; color: var(--nudge); }
.cd-tray-note:empty { display: none; }
.cd-tray-tip { margin: 10px 0 0; font-size: 12.5px; line-height: 1.6; color: var(--muted); }

/* 3. the words */
.cd-field { position: relative; display: grid; gap: 5px; margin-top: 12px; }
.cd-field:first-of-type { margin-top: 0; }
.cd-field > span { font-size: 13.5px; color: var(--muted); }
.cd-field input, .cd-field textarea {
  width: 100%; box-sizing: border-box; padding: 10px 13px; border: 1.5px solid var(--line); border-radius: 12px;
  background: #fff; color: var(--ink); font: inherit; font-size: 16px; line-height: 1.55; transition: border-color 0.12s, box-shadow 0.12s;
}
.cd-field textarea { min-height: 96px; resize: vertical; }
.cd-field input:focus, .cd-field textarea:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 3px rgba(74, 166, 224, 0.18); }
.cd-field input::placeholder, .cd-word-row input::placeholder { color: #a9bccb; }
.cd-count { position: absolute; right: 10px; bottom: 7px; font-size: 11.5px; color: #a9bccb; font-variant-numeric: tabular-nums; pointer-events: none; }
.cd-marks { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 8px; font-size: 13px; color: var(--muted); }
.cd-mark {
  display: grid; place-items: center; width: 32px; height: 32px; padding: 0; border: 0; border-radius: 10px; cursor: pointer;
  background: var(--sky-1); color: var(--deep); font: inherit; font-size: 16px; transition: background 0.12s, transform 0.12s;
}
.cd-mark:hover { background: var(--sky-2); }
.cd-mark:active { transform: scale(0.9); }
.cd-mark svg { width: 20px; height: 20px; }
.cd-ideas { margin-top: 12px; font-size: 13px; color: var(--muted); }
.cd-idea-list { display: grid; gap: 6px; margin-top: 6px; }
.cd-idea {
  padding: 8px 12px; border: 1.5px dashed var(--line); border-radius: 12px; cursor: pointer; text-align: left;
  background: transparent; color: var(--ink); font: inherit; font-size: 13.5px; line-height: 1.5; transition: background 0.12s, border-color 0.12s;
}
.cd-idea:hover { background: var(--sky-0); border-color: #a9d6f3; }
.cd-idea.on { border-style: solid; border-color: var(--blue); background: var(--sky-0); }
.cd-styles { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.cd-style {
  display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 10px 6px 8px; border: 0; border-radius: 14px; cursor: pointer;
  background: var(--sky-0); color: var(--deep); font: inherit; font-size: 14px; box-shadow: 0 0 0 1.5px var(--line); transition: box-shadow 0.12s, background 0.12s;
}
.cd-style svg { width: 32px; height: 32px; }
.cd-style:hover { background: var(--sky-1); }
.cd-style.on { background: #fff; box-shadow: 0 0 0 2.5px var(--blue), 0 4px 12px rgba(44, 132, 198, 0.18); }

/* 4. the paper */
.cd-papers { display: flex; flex-wrap: wrap; gap: 10px; }
.cd-paper {
  width: 36px; height: 36px; padding: 0; border: 0; border-radius: 50%; cursor: pointer;
  background: var(--c); box-shadow: inset 0 0 0 1.5px rgba(35, 71, 106, 0.12); transition: transform 0.12s, box-shadow 0.12s;
}
.cd-paper:hover { transform: scale(1.08); }
.cd-paper.on { box-shadow: inset 0 0 0 1.5px rgba(35, 71, 106, 0.12), 0 0 0 3px #fff, 0 0 0 5px var(--blue); }
.cd-pats { display: grid; grid-template-columns: repeat(auto-fill, minmax(72px, 1fr)); gap: 8px; }
.cd-pat {
  display: flex; flex-direction: column; align-items: center; gap: 5px; padding: 8px 6px 6px; border: 0; border-radius: 12px; cursor: pointer;
  background: var(--sky-0); color: var(--deep); font: inherit; font-size: 13px; box-shadow: 0 0 0 1.5px var(--line); transition: box-shadow 0.12s, background 0.12s;
}
.cd-pat canvas { display: block; width: 100%; height: auto; border-radius: 8px; box-shadow: 0 0 0 1px rgba(35, 71, 106, 0.1); }
.cd-pat:hover { background: var(--sky-1); }
.cd-pat.on { background: #fff; box-shadow: 0 0 0 2.5px var(--blue), 0 4px 12px rgba(44, 132, 198, 0.18); }

/* 5. send it */
.cd-btns { display: flex; flex-wrap: wrap; gap: 10px; }
.cd-btns .btn { justify-content: center; }
.cd-btns .btn:not(.primary) { box-shadow: 0 0 0 1.5px var(--sky-2); }
.cd-hint { margin: 10px 0 0; font-size: 13px; line-height: 1.6; color: var(--muted); }

/* ---------------------------------------------------------------- dos and don'ts, and the way to the reel maker */

.cd-rules { max-width: 640px; margin: 64px auto 0; padding: 18px 24px 20px; border-radius: 18px; background: #fff; box-shadow: 0 0 0 2px var(--sky-2), 0 10px 26px rgba(44, 132, 198, 0.1); }
.cd-rules-h { margin: 0 0 10px; text-align: center; font-size: 18px; font-weight: normal; color: var(--deep); }
.cd-rules ul { display: grid; gap: 8px; margin: 0; padding: 0; list-style: none; }
.cd-rules li { position: relative; padding-left: 32px; font-size: 14.5px; line-height: 1.7; }
.cd-rules li::before {   /* a drawn tick (app.css --tick-yes) in a green circle, a cross in a pink one */
  content: ""; position: absolute; left: 0; top: 1px; width: 22px; height: 22px; border-radius: 50%;
  background: var(--tick-yes) center / 14px no-repeat, #d9f3e6;
}
.cd-rules li.no::before { background: var(--tick-no) center / 12px no-repeat, #ffe1ea; }

/* On phones the card stays on screen, pinned under the header, while the steps scroll past below it. */
@media (max-width: 860px) {
  .cd-maker { grid-template-columns: minmax(0, 1fr); gap: 16px; margin-top: 26px; }
  .cd-preview {
    top: calc(var(--head-h) - var(--head-hide, 0px)); z-index: 6; margin: 0 -16px; padding: 8px 16px 10px; overflow: hidden;
    border-radius: 0 0 20px 20px; background: rgba(226, 243, 253, 0.92); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
    box-shadow: 0 10px 20px -12px rgba(20, 70, 120, 0.35);
  }
  .cd-stage { min-height: 0; padding: 7px; }
  .cd-stage canvas { max-height: 38dvh; border-radius: 10px; box-shadow: 0 0 0 4px #fff, 0 0 0 6px var(--sky-2); transition: opacity 0.25s, max-height 0.2s; }
  .cd-maker:has(.cd-field :focus) .cd-stage canvas { max-height: 24dvh; }   /* typing: leave room for the keyboard */
  .cd-tools { gap: 6px; margin-top: 9px; }
  .cd-tool-set { padding: 3px; border-radius: 14px; }
  .cd-tool { min-width: 44px; padding: 3px 4px 2px; font-size: 10.5px; }
  .cd-tool svg { width: 20px; height: 20px; }
  .cd-tool.bare { min-width: 34px; }
  .cd-word-row { margin-top: 8px; }
  .cd-tip { display: none; }
}
@media (max-width: 600px) {
  .cd-occ { flex-wrap: nowrap; overflow-x: auto; margin: 0 -16px; padding: 2px 16px 4px; scrollbar-width: none; }
  .cd-occ::-webkit-scrollbar { display: none; }
  .cd-chip { flex: none; }
  .cd-step { padding: 16px 16px 18px; }
  .cd-gallery { margin: 0 -16px; padding-inline: 16px; }
  .cd-tpl, .cd-tpl canvas { width: 88px; }
  .cd-tpl canvas { height: 110px; }
  .cd-deal { gap: 10px; }
  .cd-tray { grid-template-columns: repeat(4, minmax(0, 1fr)); max-height: 240px; }
  .cd-btns .btn { flex: 1; }
  .cd-btns .btn.big { padding: 12px 16px; font-size: 16px; }
  .cd-rules { margin-top: 48px; padding: 16px 18px 18px; }
}
