/* The stage of a canvas design (architecture 4.4, 4.5, 7.4; HOME-002, HOME-003, ABOUT-002, ABOUT-003): a fixed box of --canvas-w x --canvas-h that
   <fit-box> scales as a whole (--k is its factor; its height follows its width, so the observer never changes what it observes). Every
   number of a design is a custom property in the markup (--x, --y, --w, --fs ...); this file turns it into a box and has no width rule. */
fit-box { display: block; position: relative; width: 100%; margin: 0 auto; }
fit-box > * { transform: scale(var(--k, 1)); transform-origin: 0 0; }
fit-box.canvas { max-width: var(--canvas-w); min-height: 0; aspect-ratio: 1088 / 480; } /* min-height: 0, or the unscaled stage would keep the box at 480 px */

.stage { position: relative; width: var(--canvas-w); height: var(--canvas-h); overflow: hidden; background: var(--c, transparent); line-height: var(--lh, 1.3); text-align: left; }
.stage--hero { border-radius: 16px; box-shadow: 0 10px 30px rgba(0, 0, 0, 0.08); }
.stage--about { border: 1px solid rgba(0, 0, 0, 0.06); border-radius: var(--r, 20px); box-shadow: 0 10px 30px rgba(0, 0, 0, 0.06); }
.stage[data-surface="gradient"] { background: linear-gradient(135deg, #fdfbf7 0%, #fae8d4 50%, #f7d6be 100%); }
.stage__photo { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: var(--fx, 50%) var(--fy, 50%); pointer-events: none; }
.stage__veil { position: absolute; inset: 0; background: #000; opacity: var(--a, 0); pointer-events: none; }
.stage--about .stage__veil { background: var(--c, #fff); }

/* An element: a text block or a button, placed in percent of the stage and sized in its pixels (HOME-002 rules 6 to 10). */
.el {
  position: absolute; left: calc(var(--x, 10) * 1%); top: calc(var(--y, 10) * 1%); box-sizing: border-box; width: var(--w, auto); min-height: var(--mh, 0px); max-width: 95%;
  margin: 0; padding: 4px 6px; border-radius: var(--rad, 0px); background: var(--bg, transparent); color: var(--fg, #1e293b); text-align: var(--ta, left); white-space: pre-wrap; word-break: break-word;
  font-family: var(--ff, var(--font-heading)); font-size: var(--fs, 16px); font-weight: var(--fw, 400); font-style: var(--fi, normal); text-decoration: var(--fu, none);
}
.el--text { display: block; }
.el--filled { padding: 6px 14px; }
/* AF41: a button's words are one line of text, aligned as a text block's and centred in its height. As flex items every run was a paragraph to the browser's
   editing, and a Backspace between two runs put a copy of the button into it. */
.el--button { display: block; align-content: center; padding: 10px 22px; box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15); transition: transform 0.2s ease, box-shadow 0.2s ease; }
.el--button:hover { transform: translateY(-2px); box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2); }
.run { color: var(--rc, inherit); font-family: var(--rf, inherit); font-size: var(--rs, inherit); font-weight: var(--rw, inherit); font-style: var(--ri, inherit); text-decoration: var(--ru, none); }
/* The marker behind words (rule 11). An inline block does not take the underline of its element by itself, so it asks for it. */
.marker { display: inline-block; padding: 3px 8px; border-radius: var(--hr, 8px); background-color: var(--hl, transparent); text-decoration: inherit; }

/* The preview stage of a toy (architecture 4.4, 7.4; CUS-005, CUS-028, CUS-032, CUS-033; data-model 2.3): a fixed square of --stage units that
   <fit-box class="preview"> scales as a whole, so the main photo, the mini preview, the zoom slide and a cart thumbnail are one picture. A layer
   is placed by its centre in percent of the stage and turned about it; every number is a custom property that the scene gives (draw.js). */
fit-box.preview { aspect-ratio: 1; min-height: 0; overflow: hidden; }
.toy-stage { position: relative; width: var(--stage); height: var(--stage); overflow: hidden; text-align: left; }
.toy-stage__toy {
  position: absolute; left: calc(var(--x, 50) * 1%); top: calc(var(--y, 50) * 1%); width: 100%; height: 100%; object-fit: contain;
  transform: translate(-50%, -50%) scale(var(--s, 1)) rotate(calc(var(--r, 0) * 1deg));
}
.layer { position: absolute; left: calc(var(--x, 50) * 1%); top: calc(var(--y, 50) * 1%); width: calc(var(--w, 42) * 1%); max-width: none; transform: translate(-50%, -50%) rotate(calc(var(--r, 0) * 1deg)); pointer-events: none; }
.layer--garment, .layer--accessory { filter: drop-shadow(0 8px 18px rgba(0, 0, 0, 0.22)); }
.layer--patch { filter: drop-shadow(0 4px 12px rgba(0, 0, 0, 0.35)); }
/* The built-in felt shapes (CUS-032 rule 4): filled with the felt, outlined in the thread with a dashed seam. */
.layer--pill { height: calc(var(--h, 6.58) * 1%); border: 1.8px dashed var(--stroke, #d4af37); border-radius: 20px; background: var(--fill, #f5e6d3); box-shadow: 0 3px 8px rgba(0, 0, 0, 0.35); }
/* The embroidered name (CUS-033, STU-013): one line of "thread" writing; size is percent of the stage side, so 3.8 units each. */
.layer--text {
  width: auto; font-family: var(--font-embroidery); font-size: calc(var(--size, 6.74) * 3.8px); font-weight: 700; line-height: 1; letter-spacing: 1px; white-space: nowrap;
  color: var(--c, #d4af37); text-shadow: 0 1px 4px rgba(0, 0, 0, 0.9), 0 0 10px var(--c, #d4af37);
}
