/* The photo sphere on the shop's product page (web/shop/kugel.js). Takes the theme's font and
   colours where the theme (Dawn) offers them; everything is scoped to .fomio-kugel and the crop
   dialog (.crop-back) so the shop's own styles stay untouched. */

.fomio-kugel, .fomio-upload, .crop-back {
  --fk-text: rgb(var(--color-foreground, 36 30 26));
  --fk-muted: rgba(var(--color-foreground, 36 30 26), 0.68);
  --fk-hair: rgba(var(--color-foreground, 36 30 26), 0.16);
  --fk-bg: rgb(var(--color-background, 255 255 255));
  --fk-soft: rgba(var(--color-foreground, 36 30 26), 0.04);
  --fk-accent: rgb(var(--color-button, 181 78 53));
  --fk-on-accent: rgb(var(--color-button-text, 255 255 255));
  --fk-error: #b3261e;
  --fk-ok: #2e7d32;
}

.fomio-kugel, .fomio-upload { display: grid; gap: 14px; margin: 18px 0 22px; padding: 18px; border: 1px solid var(--fk-hair); border-radius: 14px; background: var(--fk-bg); color: var(--fk-text); }
.fomio-kugel *, .fomio-upload * { box-sizing: border-box; }
.fk-head { display: grid; gap: 4px; }
.fk-title { margin: 0; font-size: 1.15em; letter-spacing: 0.01em; }
.fk-sub { margin: 0; font-size: 0.9em; line-height: 1.45; color: var(--fk-muted); }

.fk-slots { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.fk-slot { display: flex; align-items: center; gap: 12px; min-height: 76px; padding: 10px; border: 1.5px dashed var(--fk-hair); border-radius: 12px; background: var(--fk-soft); color: inherit; font: inherit; text-align: left; cursor: pointer; transition: border-color 0.15s, background 0.15s; }
.fk-slot:hover, .fk-slot:focus-visible { border-color: var(--fk-accent); outline: none; }
.fk-slot.has { border-style: solid; background: var(--fk-bg); }
.fk-thumb { position: relative; flex: none; display: grid; place-items: center; width: 56px; height: 56px; border-radius: 8px; overflow: hidden; background: var(--fk-bg); }
.fk-thumb svg { width: 28px; height: 28px; fill: none; stroke: var(--fk-accent); stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.fk-thumb img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.fk-thumb img:not([src]), .fk-thumb img[src=""] { display: none; }
.fk-label { display: grid; gap: 2px; min-width: 0; }
.fk-label b { font-size: 0.95em; }
.fk-label small { font-size: 0.82em; color: var(--fk-muted); }
.fk-slot.has .fk-label small { color: var(--fk-accent); font-weight: 600; }

.fk-switch { display: flex; align-items: flex-start; gap: 12px; cursor: pointer; }
.fk-switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.fk-track { position: relative; flex: none; width: 40px; height: 24px; margin-top: 1px; border-radius: 999px; background: var(--fk-hair); transition: background 0.15s; }
.fk-track::after { content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgb(0 0 0 / 0.25); transition: transform 0.15s; }
.fk-switch input:checked + .fk-track { background: var(--fk-accent); }
.fk-switch input:checked + .fk-track::after { transform: translateX(16px); }
.fk-switch input:focus-visible + .fk-track { outline: 2px solid var(--fk-accent); outline-offset: 2px; }
.fk-switch-text { display: grid; gap: 2px; }
.fk-switch-text b { font-size: 0.95em; }
.fk-switch-text small { font-size: 0.82em; line-height: 1.4; color: var(--fk-muted); }

.fk-stage { position: relative; aspect-ratio: 1; width: 100%; max-width: 460px; justify-self: center; border-radius: 14px; overflow: hidden; background: radial-gradient(circle at 50% 45%, #f7f3ee, #e6ded4); transition: background 0.3s; }
.fk-stage.lit { background: radial-gradient(circle at 50% 45%, #2a211b, #110d0a); }
.fk-stage[hidden] { display: none; }
.fk-canvas { display: block; width: 100%; height: 100%; touch-action: none; cursor: grab; }
.fk-canvas:active { cursor: grabbing; }
.fk-wait { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; background: rgb(20 15 12 / 0.55); color: #fff; font-size: 0.92em; text-align: center; padding: 16px; }
.fk-wait[hidden] { display: none; }
.fk-spin { width: 34px; height: 34px; border: 3px solid rgb(255 255 255 / 0.3); border-top-color: #fff; border-radius: 50%; animation: fk-spin 0.9s linear infinite; }
@keyframes fk-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .fk-spin { animation-duration: 3s; } }
.fk-tools { position: absolute; left: 10px; right: 10px; bottom: 10px; display: flex; align-items: center; justify-content: space-between; gap: 8px; pointer-events: none; }
.fk-tool { pointer-events: auto; height: 32px; padding: 0 14px; border: 1px solid rgb(255 255 255 / 0.35); border-radius: 999px; background: rgb(20 15 12 / 0.55); color: #fff; font: inherit; font-size: 0.82em; font-weight: 600; cursor: pointer; }
.fk-tool[aria-pressed="false"] { background: rgb(255 255 255 / 0.85); color: #2a211b; border-color: rgb(0 0 0 / 0.12); }
.fk-hint { font-size: 0.78em; color: rgb(255 255 255 / 0.8); text-shadow: 0 1px 2px rgb(0 0 0 / 0.5); }
.fk-stage:not(.lit) .fk-hint { color: rgb(42 33 27 / 0.7); text-shadow: none; }

.fk-status { margin: 0; font-size: 0.9em; line-height: 1.45; }
.fk-status:empty { display: none; }
.fk-status[data-kind="error"] { color: var(--fk-error); font-weight: 600; }
.fk-status[data-kind="ok"] { color: var(--fk-ok); font-weight: 600; }
.fk-tips { font-size: 0.86em; color: var(--fk-muted); }
.fk-tips summary { cursor: pointer; font-weight: 600; color: var(--fk-text); }
.fk-tips ul { margin: 8px 0 0; padding-left: 18px; display: grid; gap: 4px; }
.fk-tips b { color: var(--fk-text); }
.fk-note { margin: 0; font-size: 0.78em; color: var(--fk-muted); }
@media (max-width: 480px) {
  .fomio-kugel, .fomio-upload { padding: 14px; }
  .fk-slots { grid-template-columns: 1fr; }
}

/* the crop dialog of the studio (web/photo-crop.js) */
.crop-back { position: fixed; inset: 0; z-index: 2147483000; display: grid; place-items: center; padding: 16px; background: rgb(30 24 20 / 0.6); font-family: inherit; }
.crop-back * { box-sizing: border-box; }
.crop-dlg { display: grid; gap: 12px; max-width: min(960px, 100%); padding: 20px; border-radius: 14px; background: var(--fk-bg); color: var(--fk-text); box-shadow: 0 20px 50px rgb(0 0 0 / 0.35); }
.crop-dlg h2 { margin: 0; font-size: 19px; }
.crop-sub { margin: 0; font-size: 13.5px; line-height: 1.45; color: var(--fk-muted); }
.crop-stage { display: grid; place-items: center; background: #1e1814; border-radius: 8px; padding: 8px; }
.crop-stage canvas { touch-action: none; }
.crop-btns { display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; }
.crop-back .btn { display: inline-flex; align-items: center; justify-content: center; height: 40px; padding: 0 18px; border-radius: 999px; border: 1px solid var(--fk-hair); background: var(--fk-bg); color: var(--fk-text); font: inherit; font-size: 14px; font-weight: 600; cursor: pointer; }
.crop-back .btn-primary { border-color: var(--fk-accent); background: var(--fk-accent); color: var(--fk-on-accent); }
.crop-back .btn:hover { filter: brightness(0.96); }

/* photo upload (web/shop/upload.js): one or two slots, each with a remove button */
.fk-slots.one { grid-template-columns: 1fr; }
.fk-slot-wrap { position: relative; display: grid; }
.fk-remove { position: absolute; top: 6px; right: 6px; width: 26px; height: 26px; border: 1px solid var(--fk-hair); border-radius: 50%; background: var(--fk-bg); color: var(--fk-muted); font: inherit; font-size: 12px; line-height: 1; cursor: pointer; }
.fk-remove:hover { color: var(--fk-error); border-color: var(--fk-error); }
.fk-remove[hidden] { display: none; }

/* the 3D view in a box of the page (data-stage): it fills the box, the photo there steps back */
.fk-stage.fk-stage-external { position: absolute; inset: 0; width: 100%; max-width: none; height: 100%; aspect-ratio: auto; border-radius: 0; z-index: 1; }
.fk-has-stage > :not(.fk-stage) { visibility: hidden; }
