/* The tool: four steps (screen, scene, frame, file), with the mockup in view the whole way. */

/* An app, not a document: no pull-to-refresh that would drop an upload, and edge to edge past the notch. */
html.tool { overscroll-behavior: none; }
body.tool .nav {
  padding-left: max(var(--gutter), env(safe-area-inset-left));
  padding-right: max(var(--gutter), env(safe-area-inset-right));
}

/* Steps, in the header. A step already reached can be opened again; a later one can't. */
.steps-nav { display: flex; gap: 6px; margin: 0; padding: 0; list-style: none; }
.steps-nav button {
  position: relative; display: inline-flex; align-items: center; gap: 8px; height: 36px; padding: 0 12px 0 6px;
  border: 0; border-radius: 999px; background: none; font: 500 14px/1 var(--sans); color: var(--faint); cursor: pointer;
  transition: color var(--t-hover) ease, background-color var(--t-hover) ease, transform var(--t-press) var(--ease-out);
}
.steps-nav button::before { content: ""; position: absolute; inset: -4px -3px; }  /* 44px to a finger */
.steps-nav .mono {
  display: grid; place-items: center; width: 24px; height: 24px; border-radius: 50%;
  font-size: 12px; box-shadow: inset 0 0 0 1px currentColor;
  transition: background-color var(--t-hover) ease, color var(--t-hover) ease, box-shadow var(--t-hover) ease;
}
.steps-nav button.done:active { transform: scale(0.96); }  /* a step that can be opened again */
.steps-nav button.done { color: var(--ink); }
.steps-nav button[aria-current="step"] { color: var(--ink); background: var(--panel); }
.steps-nav button[aria-current="step"] .mono { background: var(--ink); color: #fff; box-shadow: none; }
.steps-nav button:disabled { cursor: default; }
@media (hover: hover) and (pointer: fine) { .steps-nav button.done:not([aria-current]):hover { background: var(--panel); } }

.flow {
  display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 48px;
  height: calc(100dvh - 64px - var(--launch-h, 0px)); min-height: 600px;  /* make.js measures the launch banner */
  padding: 16px max(var(--gutter), env(safe-area-inset-right)) 28px max(var(--gutter), env(safe-area-inset-left));
}

/* The mockup, at the chosen frame, as large as the space allows. */
.view { display: flex; flex-direction: column; gap: 12px; min-height: 0; container-type: size; }
.frame-box {
  position: relative; overflow: hidden; align-self: center; flex: none;
  border-radius: 14px; background: var(--panel);
  aspect-ratio: var(--ar-n);
  width: min(100cqw, calc((100cqh - 36px) * var(--ar-n)));
  margin: auto 0 0;
}
/* A new frame reshapes the box in place, so the same picture is seen being cut again, rather than jumping. Not on the
   way in: only once the visitor has taken a step (make.js). */
@property --ar-n { syntax: "<number>"; inherits: false; initial-value: 1.7778; }
.flow[data-stepped] .frame-box { transition: --ar-n var(--t-morph) var(--ease-in-out); }
.frame-box img, .frame-box video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
#sample, #sampleFilm { transition: opacity 0.3s ease; }
/* The visitor's preview: transparent until its picture has loaded (make.js), then it fades in over the scene's sample. */
#previewImg, #previewFilm { opacity: 0; }
#previewImg.in, #previewFilm.in { opacity: 1; transition: opacity var(--t-morph) var(--ease-out); }
@starting-style { #previewImg.in, #previewFilm.in { opacity: 0; } }
.frame-box.waiting #sample, .frame-box.waiting #sampleFilm { opacity: 0.45; }
.working { position: absolute; inset: 0; display: grid; place-items: center; }
.caption { flex: none; margin-bottom: auto; text-align: center; font-size: 14px; }
.quiet { color: var(--mute); }

/* The step being answered, with Back and Continue under it. */
.panel-wrap { display: flex; flex-direction: column; min-height: 0; }
.step { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 8px 2px 16px; }
.flow[data-stepped] .step:not([hidden]) { animation: step-in var(--t-enter) var(--ease-out); }  /* not the first, on load */
@keyframes step-in { from { opacity: 0; transform: translateY(6px); } }
.step h1 { margin: 0 0 24px; font-size: 28px; font-weight: 500; letter-spacing: -0.02em; line-height: 1.15; }
.step-bar {
  flex: none; display: flex; align-items: center; gap: 16px;
  padding-top: 16px; border-top: 1px solid var(--line);
}
.step-bar .price { flex: 1; text-align: right; font-size: 15px; color: var(--ink); }
.step-bar .pill { margin-left: auto; }
.step-bar .text-button { position: relative; }
.step-bar .text-button::before { content: ""; position: absolute; inset: -12px; }
.error { color: var(--danger); font-size: 14px; }
.error:empty { display: none; }
.out-error { margin-top: 10px; text-align: right; }

/* 1. Screen */
.well {
  position: relative; display: grid; justify-items: center; align-content: center; gap: 16px; min-height: 240px;
  padding: 24px; border-radius: 16px; text-align: center; font-size: 15px; color: var(--mute);
  background: var(--panel); box-shadow: inset 0 0 0 1px var(--line); cursor: pointer;
  transition: box-shadow var(--t-hover) ease;
}
/* The whole well is the button (its input covers it), so its "Choose a file" answers the pointer and the press. */
@media (hover: hover) and (pointer: fine) {
  .well:hover { box-shadow: inset 0 0 0 1px var(--line-strong); }
  .well:hover .pill.wash { background: #e2e2e2; }
}
.well:active .pill { transform: scale(0.97); }
.well input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.well:has(input:focus-visible) { outline: 2px solid var(--ink); outline-offset: 3px; }
.flow.over .well { box-shadow: inset 0 0 0 2px var(--ink); }
.chosen { display: grid; grid-template-columns: 56px minmax(0, 1fr); gap: 16px; align-items: center; }
.screen-thumb { width: 56px; aspect-ratio: 1206 / 2622; border-radius: 8px; overflow: hidden; background: var(--panel); box-shadow: 0 0 0 1px var(--line); }
.screen-thumb img, .screen-thumb video { display: block; width: 100%; height: 100%; object-fit: cover; }
.chosen-text { display: grid; gap: 2px; justify-items: start; min-width: 0; }
.chosen-text .filename { color: var(--ink); max-width: 100%; }
.chosen-text .text-button { position: relative; margin-top: 6px; font-size: 14px; }
.chosen-text .text-button::before { content: ""; position: absolute; inset: -12px -10px; }
.step .dials { margin-top: 20px; }
.step .bar { margin-top: 20px; }

/* 2. Scene: the chosen collection's angles, then every collection. */
.angles { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 36px; margin-bottom: 16px; }
.angles h2 { margin: 0; font-size: 16px; font-weight: 500; }
.chips { display: flex; gap: 4px; }
.chip {
  position: relative; height: 34px; padding: 0 14px; border: 0; border-radius: 999px;
  font: 500 14px/1 var(--sans); color: var(--ink); background: var(--raised); cursor: pointer;
  transition: background-color var(--t-hover) ease, color var(--t-hover) ease, transform var(--t-press) var(--ease-out);
}
.chip::before { content: ""; position: absolute; inset: -5px 0; }  /* 34px chip, 44px to a finger */
.chip[aria-pressed="true"] { background: var(--ink); color: #fff; }
@media (hover: hover) and (pointer: fine) { .chip:not([aria-pressed="true"]):hover { background: #e2e2e2; } }
.collections { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px 8px; }
.collection-pick {
  display: grid; gap: 8px; padding: 0; border: 0; background: none; text-align: left; cursor: pointer;
  font: 400 13px/1.3 var(--sans); color: var(--mute); -webkit-touch-callout: none;
  transition: transform var(--t-press) var(--ease-out), color var(--t-hover) ease;
}
.collection-pick img {
  display: block; width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 10px; background: var(--panel);
  -webkit-touch-callout: none;
  outline: 2px solid transparent; outline-offset: 2px; transition: outline-color var(--t-hover) ease;
}
.collection-pick[aria-pressed="true"] { color: var(--ink); }
.collection-pick[aria-pressed="true"] img { outline-color: var(--ink); }
@media (hover: hover) and (pointer: fine) { .collection-pick:hover { color: var(--ink); } }

/* 3. Frame: one button per shape, drawn at its own proportions. */
.frames { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 6px; }
.shape {
  display: grid; justify-items: center; align-content: end; gap: 10px; height: 104px; padding: 10px 0;
  border: 0; border-radius: 12px; background: transparent; cursor: pointer;
  font: 500 13px/1 var(--sans); color: var(--mute);
  transition: background-color var(--t-hover) ease, color var(--t-hover) ease, transform var(--t-press) var(--ease-out);
}
.shape i {
  display: block; height: var(--h); aspect-ratio: var(--ar); border-radius: 4px; box-shadow: inset 0 0 0 1.5px currentColor;
  transition: background-color var(--t-hover) ease;
}
.shape[aria-pressed="true"] { background: var(--panel); color: var(--ink); }
.shape[aria-pressed="true"] i { background: var(--ink); }
.shape:disabled { opacity: 0.35; cursor: not-allowed; }
@media (hover: hover) and (pointer: fine) { .shape:not(:disabled):not([aria-pressed="true"]):hover { color: var(--ink); } }

/* 4. File */
.summary { margin: 0; }
.summary div { display: flex; justify-content: space-between; gap: 16px; padding: 14px 0; border-bottom: 1px solid var(--line); font-size: 15px; }
.summary dt { color: var(--mute); }
.summary dd { margin: 0; text-align: right; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.chip:active, .shape:not(:disabled):active, .collection-pick:active { transform: scale(0.97); }

@media (prefers-reduced-motion: reduce) {
  .flow[data-stepped] .step:not([hidden]) { animation: none; }
  .chip, .shape, .collection-pick, #sample, #sampleFilm { transition: none; }
  #previewImg, #previewFilm { opacity: 1; }  /* shown at once, loaded or not, as before the fade */
}

/* A phone: the mockup on top, the step under it, Back and Continue pinned above the home indicator. */
@media (max-width: 900px) {
  .flow { display: block; height: auto; min-height: 0; padding: 0; }
  .view { height: min(50svh, 440px); padding: 12px 16px 0; }
  .panel-wrap { padding: 20px max(16px, env(safe-area-inset-right)) calc(96px + env(safe-area-inset-bottom, 0px)) max(16px, env(safe-area-inset-left)); }
  .step { overflow: visible; padding: 0; }
  .step h1 { font-size: 24px; margin-bottom: 18px; }
  .step-bar {
    position: fixed; z-index: 5; left: 0; right: 0; bottom: 0;
    padding: 12px max(16px, env(safe-area-inset-right)) calc(12px + env(safe-area-inset-bottom, 0px)) max(16px, env(safe-area-inset-left));
    background: rgba(255, 255, 255, 0.92); backdrop-filter: saturate(1.6) blur(16px); -webkit-backdrop-filter: saturate(1.6) blur(16px);
  }
  .steps-nav button:not([aria-current="step"]) { padding-right: 6px; font-size: 0; gap: 0; }
  .steps-nav button:not([aria-current="step"]) .mono { font-size: 12px; }
  .well { min-height: 180px; }
}
