/* The home page visualiser tool, #visualiser. Tokens from site.css only.
   The demo above it is vis-demo.css; the finish picker is finish-picker.css. */

.vis-nojs { max-width: 70ch; }
.vis-nojs a { font-weight: 700; color: var(--c-teal-deep); }
.vis-tool[hidden], .vis-step[hidden], .vis-result[hidden], .vis-nojs[hidden], .vis-frame[hidden], .vis-drop[hidden],
.vis-check[hidden], .vis-tag[hidden], .vis-frame__after[hidden], .vis-frame__edge[hidden], .vis-frame__handle[hidden],
.vis-scan[hidden], .vis-progress[hidden], .vis-drop__reading[hidden] { display: none; }

/* The tool: closed under the demo until opened. */
.vis-tool { display: grid; gap: var(--space-5); margin-top: var(--space-6); scroll-margin-top: calc(var(--header-h) + var(--space-3)); }
.vis-tool:focus { outline: none; }
.vis--open .vis-tool { animation: vis-open .5s ease both; }
@keyframes vis-open { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
.vis-tool__head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--space-3); }
.vis-how { margin: 0; font-weight: 650; color: var(--c-ink-2); }

/* Two steps, shown as a short line of numbered dots. */
.vis-steps { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-3); margin: 0; padding: 0; list-style: none; }
.vis-steps__item { display: inline-flex; align-items: center; gap: var(--space-2); font-weight: 650; color: var(--c-muted); }
.vis-steps__item + .vis-steps__item::before {
  content: ''; width: 2rem; height: 2px; border-radius: 2px; background: var(--c-grey-300); margin-right: var(--space-1);
}
.vis-steps__num {
  display: inline-grid; place-items: center; width: 1.9rem; height: 1.9rem; border-radius: 50%;
  background: var(--c-grey-100); color: var(--c-ink-2); font-size: .9rem; font-weight: 750;
}
.vis-steps__item.is-on { color: var(--c-ink); }
.vis-steps__item.is-on .vis-steps__num { background: var(--c-teal-deep); color: #fff; box-shadow: var(--glow-strong, 0 0 0 3px var(--c-teal-soft)); }
.vis-steps__item.is-done .vis-steps__num { background: var(--c-teal-soft); color: var(--c-teal-deep); }
.vis-steps__item.is-done + .vis-steps__item::before { background: var(--c-teal); }

.vis-step { display: grid; gap: var(--space-4); scroll-margin-top: calc(var(--header-h) + var(--space-3)); }
.vis-step--details { max-width: 760px; }
.vis-step__title { display: flex; align-items: center; gap: var(--space-3); margin: 0; font-size: clamp(1.15rem, 1rem + .5vw, 1.4rem); }
.vis-step__num {
  flex: none; display: inline-grid; place-items: center; width: 2rem; height: 2rem; border-radius: 50%;
  background: var(--c-teal-deep); color: #fff; font-size: .95rem; font-weight: 750;
}
.vis-fields { display: grid; gap: var(--space-4); grid-template-columns: minmax(0, 1fr); }
@media (min-width: 720px) {
  .vis-fields { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .vis-fields .field:last-child { grid-column: 1 / -1; }
}
.vis-field-err { margin: var(--space-1) 0 0; font-size: .875rem; font-weight: 650; color: var(--c-ink); }
.vis-tool [aria-invalid="true"] { border-color: var(--c-ink); box-shadow: 0 0 0 1px var(--c-ink); }
.vis-step .notice { margin-bottom: 0; }
.vis-step [data-vis-saved]:empty { display: none; }

/* Turnstile, quiet unless Cloudflare needs the visitor. */
.vis-check { display: grid; gap: var(--space-2); }
.vis-check__title { margin: 0; font-weight: 650; font-size: .9375rem; }
.vis-turnstile { max-width: 100%; }
.vis-check.is-quiet { height: 0; overflow: hidden; margin: 0; gap: 0; }
.vis-check.is-quiet .vis-check__title { display: none; }
.vis-step.stack > .vis-check.is-quiet { margin-top: 0; }

/* Buttons that show they are working */
.vis-go { justify-self: start; gap: var(--space-2); }
.vis-go.is-busy { cursor: progress; opacity: 1; }
.vis-go__spin { display: none; }
.vis-go.is-busy .vis-go__spin {
  display: inline-block; width: 1.1rem; height: 1.1rem; border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, .35); border-top-color: #fff; animation: vis-spin .8s linear infinite;
}
@keyframes vis-spin { to { transform: rotate(360deg); } }
.vis-go--make { justify-self: stretch; width: 100%; min-height: 3.75rem; font-size: 1.125rem; }

/* Step 2: two columns. Left the photo and result, right the picker and Generate. */
.vis-work { display: grid; gap: var(--space-6); grid-template-columns: minmax(0, 1fr); align-items: start; }
.vis-work__left, .vis-work__right { display: grid; gap: var(--space-4); min-width: 0; align-content: start; }
.vis-step__title--plain { padding-left: 0; }
@media (min-width: 960px) {
  .vis-work { grid-template-columns: minmax(0, 1.3fr) minmax(340px, 1fr); gap: var(--space-6) var(--space-7); }
  .vis-work__left { position: sticky; top: calc(var(--header-h) + var(--space-4)); }
}
.vis-saved { max-width: 760px; }

/* The photo area. Phones: two big buttons. Laptops: a drop area. No bare file input. */
.vis-stage { display: grid; gap: var(--space-3); min-width: 0; scroll-margin-top: calc(var(--header-h) + var(--space-3)); }
.vis-file {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; opacity: 0;
}
.vis-drop {
  display: grid; gap: var(--space-3); padding: var(--space-5); border-radius: var(--radius-lg);
  background: linear-gradient(160deg, #fff 0%, var(--c-teal-soft) 100%);
  box-shadow: var(--glow, 0 0 0 1px var(--c-line));
}
.vis-drop__title { margin: 0; font-weight: 750; font-size: 1.125rem; color: var(--c-ink); }
.vis-drop__hint { margin: 0; font-size: .9375rem; color: var(--c-muted); }
.vis-drop__reading { margin: 0; font-weight: 650; color: var(--c-teal-deep); }
.vis-drop__phone { display: grid; gap: var(--space-3); }
.vis-bigbtn {
  position: relative; display: flex; align-items: center; justify-content: center; gap: var(--space-3);
  min-height: 4rem; padding: var(--space-3) var(--space-4); border-radius: 14px; cursor: pointer;
  background: #fff; color: var(--c-teal-deep); font-weight: 750; font-size: 1.125rem; text-align: center;
  box-shadow: var(--glow, 0 0 0 1px var(--c-teal)); transition: box-shadow .15s ease, transform .15s ease;
}
.vis-bigbtn--primary { background: var(--c-teal-deep); color: #fff; }
.vis-bigbtn:hover, .vis-bigbtn:focus-within { box-shadow: var(--glow-strong, 0 0 0 2px var(--c-teal)); }
.vis-bigbtn:focus-within { outline: 3px solid var(--c-teal); outline-offset: 3px; }
.vis-bigbtn:active { transform: scale(.985); }
.vis-drop__zone {
  position: relative; display: none; place-items: center; align-content: center; gap: var(--space-2); text-align: center;
  min-height: 300px; padding: var(--space-6); border-radius: 16px; cursor: pointer; background: rgba(255, 255, 255, .8);
  border: 2px dashed var(--c-teal); box-shadow: var(--glow, none);
  transition: background-color .2s ease, box-shadow .2s ease, border-color .2s ease;
}
.vis-drop__zone:hover, .vis-drop__zone:focus-within, .vis-drop__zone.is-over {
  background: #fff; border-color: var(--c-teal-deep); box-shadow: var(--glow-strong, 0 0 0 2px var(--c-teal));
}
.vis-drop__zone:focus-within { outline: 3px solid var(--c-teal); outline-offset: 3px; }
.vis-drop__zone.is-over { background: var(--c-teal-soft); transform: scale(1.01); }
.vis-drop__zone.is-wanted { animation: vis-wanted .5s ease 2; }
@keyframes vis-wanted { 50% { box-shadow: 0 0 0 4px var(--c-teal), 0 0 28px 0 var(--c-teal); } }
.vis-drop__icon {
  display: grid; place-items: center; width: 4.5rem; height: 4.5rem; border-radius: 50%;
  background: var(--c-teal-soft); color: var(--c-teal-deep); margin-bottom: var(--space-2);
}
.vis-drop__big { font-weight: 750; font-size: 1.25rem; color: var(--c-ink); }
.vis-drop__small { color: var(--c-muted); font-size: .9375rem; }
@media (hover: hover) and (pointer: fine) and (min-width: 640px) {
  .vis-drop__phone { display: none; }
  .vis-drop__zone { display: grid; }
}

/* The frame: their photo, then the result over it. */
.vis-frame { margin: 0; display: grid; gap: var(--space-3); justify-items: center; }
.vis-frame__pane {
  --pos: 50%;
  position: relative; width: 100%; aspect-ratio: var(--ar, 1.3333);
  max-width: min(100%, calc(72vh * var(--ar, 1.3333)));
  border-radius: var(--radius-lg); overflow: hidden; background: var(--c-grey-100);
  box-shadow: var(--shadow-lg); isolation: isolate;
}
.vis-frame__before, .vis-frame__after-img {
  position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block;
  user-select: none; -webkit-user-drag: none;
}
.vis-frame__pane.is-over { box-shadow: 0 0 0 3px var(--c-teal), var(--shadow-lg); }
.vis-frame__after { position: absolute; inset: 0; z-index: 2; clip-path: inset(0 calc(100% - var(--pos)) 0 0); }
.vis-frame__pane.is-result { touch-action: pan-y; cursor: ew-resize; user-select: none; -webkit-user-select: none; }

/* Labels: "Example" on the new side (left), "Before" on the old side (right). */
.vis-tag { position: absolute; top: var(--space-3); z-index: 3; pointer-events: none; }
.vis-tag--after { left: var(--space-3); }
.vis-tag--before {
  right: var(--space-3); z-index: 1; font-size: .75rem; font-weight: 750; letter-spacing: .1em; text-transform: uppercase; line-height: 1;
  color: var(--c-ink); background: rgba(255, 255, 255, .94); border-radius: 999px; padding: .4rem .7rem;
}

/* The bar, and the teal light that rides along it during the sweep. */
.vis-frame__edge {
  position: absolute; top: 0; bottom: 0; left: var(--pos); z-index: 4; width: 3px; margin-left: -1.5px; pointer-events: none;
  background: #fff; box-shadow: 0 0 0 1px rgba(15, 21, 19, .18), 0 0 12px rgba(15, 21, 19, .25);
}
.vis-frame__edge::before {
  content: ''; position: absolute; top: 0; bottom: 0; right: 100%; width: 140px; opacity: 0;
  background: linear-gradient(90deg, rgba(15, 143, 122, 0) 0%, rgba(15, 143, 122, .14) 55%, rgba(110, 231, 210, .55) 100%);
  transition: opacity .35s ease;
}
.vis-frame__edge::after {
  content: ''; position: absolute; top: -10%; bottom: -10%; left: -6px; width: 15px; opacity: 0; border-radius: 50%;
  background: radial-gradient(closest-side, rgba(255, 255, 255, .95), rgba(110, 231, 210, .6) 45%, rgba(15, 143, 122, 0));
  transition: opacity .35s ease;
}
.is-sweeping .vis-frame__edge { background: #e9fffa; box-shadow: 0 0 18px 4px rgba(45, 212, 182, .75), 0 0 46px 10px rgba(15, 143, 122, .45); }
.is-sweeping .vis-frame__edge::before, .is-sweeping .vis-frame__edge::after { opacity: 1; }
.is-settling .vis-frame__edge { box-shadow: 0 0 14px 2px rgba(45, 212, 182, .55); transition: box-shadow 1s ease; }

/* The handle with its pulsing teal arrows. */
.vis-frame__handle {
  position: absolute; top: 50%; left: var(--pos); z-index: 5; width: 3.5rem; height: 3.5rem; pointer-events: none;
  transform: translate(-50%, -50%); border-radius: 50%; background: #fff;
  box-shadow: 0 0 0 3px var(--c-teal), 0 6px 20px rgba(15, 21, 19, .3);
  display: flex; align-items: center; justify-content: center; gap: .55rem;
}
.is-ready .vis-frame__handle { animation: vis-handle-in .45s cubic-bezier(.3, 1.4, .5, 1) both; }
.is-ready:not(.is-touched) .vis-frame__handle::before {
  content: ''; position: absolute; inset: -3px; border-radius: 50%; border: 3px solid var(--c-teal);
  animation: vis-ring 1.8s ease-out infinite;
}
@keyframes vis-handle-in { from { transform: translate(-50%, -50%) scale(.4); opacity: 0; } to { transform: translate(-50%, -50%) scale(1); opacity: 1; } }
@keyframes vis-ring { from { transform: scale(1); opacity: .8; } to { transform: scale(1.7); opacity: 0; } }
.vis-arrow { width: 0; height: 0; border-top: .5rem solid transparent; border-bottom: .5rem solid transparent; }
.vis-arrow--left { border-right: .65rem solid var(--c-teal); }
.vis-arrow--right { border-left: .65rem solid var(--c-teal); }
.is-ready:not(.is-touched) .vis-arrow--left { animation: vis-nudge-left 1.2s ease-in-out infinite; }
.is-ready:not(.is-touched) .vis-arrow--right { animation: vis-nudge-right 1.2s ease-in-out infinite; }
@keyframes vis-nudge-left { 0%, 100% { transform: translateX(0); opacity: 1; } 50% { transform: translateX(-5px); opacity: .55; } }
@keyframes vis-nudge-right { 0%, 100% { transform: translateX(0); opacity: 1; } 50% { transform: translateX(5px); opacity: .55; } }
.is-focus .vis-frame__handle { box-shadow: 0 0 0 3px #fff, 0 0 0 6px var(--c-teal-deep), 0 6px 20px rgba(15, 21, 19, .3); }

/* The range input: for the keyboard and screen readers; pointer dragging is on the frame. */
.vis-frame__range {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}

/* While the example is being made: a soft scan over the photo and a progress panel. */
.vis-frame__pane.is-making .vis-frame__before { filter: saturate(.75) brightness(.92); transition: filter .6s ease; }
.vis-scan {
  position: absolute; inset: 0; z-index: 3; pointer-events: none; overflow: hidden;
  background: linear-gradient(180deg, rgba(10, 92, 80, .05), rgba(10, 92, 80, .2));
}
.vis-scan::before {
  content: ''; position: absolute; top: 0; bottom: 0; left: -40%; width: 40%;
  background: linear-gradient(90deg, rgba(110, 231, 210, 0), rgba(110, 231, 210, .35), rgba(255, 255, 255, .5), rgba(110, 231, 210, .35), rgba(110, 231, 210, 0));
  animation: vis-scan 2.6s ease-in-out infinite;
}
@keyframes vis-scan { from { transform: translateX(0); } to { transform: translateX(350%); } }
.vis-progress {
  position: absolute; left: var(--space-3); right: var(--space-3); bottom: var(--space-3); z-index: 6;
  display: grid; gap: var(--space-2); padding: var(--space-3) var(--space-4); border-radius: 14px;
  background: rgba(15, 21, 19, .78); color: #fff; box-shadow: 0 8px 30px rgba(0, 0, 0, .3);
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
}
.vis-progress__line { margin: 0; font-weight: 700; font-size: 1rem; min-height: 1.4em; }
.vis-progress__line::after { content: ''; display: inline-block; width: 1.2em; text-align: left; animation: vis-dots 1.4s steps(4) infinite; }
@keyframes vis-dots { 0% { content: ''; } 25% { content: '.'; } 50% { content: '..'; } 75% { content: '...'; } }
.vis-progress__line.is-in { animation: vis-line .45s ease both; }
@keyframes vis-line { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.vis-progress__track { height: .6rem; border-radius: 999px; background: rgba(255, 255, 255, .18); overflow: hidden; }
.vis-progress__bar {
  height: 100%; width: 3%; border-radius: 999px; transition: width .35s ease-out;
  background: linear-gradient(90deg, var(--c-teal), #5eead4) 0 0 / 100% 100%;
  box-shadow: 0 0 12px rgba(94, 234, 212, .7); position: relative; overflow: hidden;
}
.vis-progress__bar::after {
  content: ''; position: absolute; inset: 0;
  background: repeating-linear-gradient(115deg, rgba(255, 255, 255, .28) 0 10px, rgba(255, 255, 255, 0) 10px 20px);
  background-size: 40px 100%; animation: vis-stripes .8s linear infinite;
}
@keyframes vis-stripes { from { background-position: 0 0; } to { background-position: 40px 0; } }

/* "Change photo" under the frame */
.vis-change {
  position: relative; display: inline-flex; align-items: center; justify-content: center; min-height: 2.75rem;
  padding: .5rem 1.1rem; border-radius: 999px; cursor: pointer; background: #fff; font-weight: 650; color: var(--c-teal-deep);
  box-shadow: var(--glow, 0 0 0 1px var(--c-line)); transition: box-shadow .15s ease;
}
.vis-change:hover, .vis-change:focus-within { box-shadow: var(--glow-strong, 0 0 0 2px var(--c-teal)); }
.vis-change:focus-within { outline: 3px solid var(--c-teal); outline-offset: 3px; }
.vis-stage[data-state="making"] .vis-change { visibility: hidden; }

/* The result line and the next steps, under the picture. */
.vis-result { display: grid; gap: var(--space-3); padding: var(--space-4) var(--space-5); border-radius: var(--radius-lg); background: var(--c-teal-soft); animation: vis-open .5s ease both; }
.vis-result:focus { outline: none; }
.vis-result p { margin: 0; }
.vis-result__line { font-size: .9375rem; color: var(--c-ink-2); }
.vis-left { font-weight: 650; color: var(--c-ink-2); }
.vis-result__cta { font-weight: 700; color: var(--c-ink); }

@media (max-width: 420px) {
  .vis-step--details.card { padding: var(--space-4); }
  .vis-drop { padding: var(--space-4); }
  .vis-progress { left: var(--space-2); right: var(--space-2); bottom: var(--space-2); padding: var(--space-2) var(--space-3); }
  .vis-progress__line { font-size: .9375rem; }
  .vis-steps__item + .vis-steps__item::before { width: 1.25rem; }
  .vis-result { padding: var(--space-4); }
}

@media (prefers-reduced-motion: reduce) {
  .vis--open .vis-tool, .vis-result, .vis-progress__line.is-in, .is-ready .vis-frame__handle { animation: none; }
  .vis-scan::before, .vis-progress__bar::after, .vis-go.is-busy .vis-go__spin, .vis-progress__line::after { animation: none; }
  .is-ready:not(.is-touched) .vis-arrow--left, .is-ready:not(.is-touched) .vis-arrow--right,
  .is-ready:not(.is-touched) .vis-frame__handle::before { animation: none; }
  .is-ready:not(.is-touched) .vis-frame__handle::before { display: none; }
  .vis-bigbtn, .vis-drop__zone, .vis-change, .vis-progress__bar, .vis-frame__edge::before, .vis-frame__edge::after { transition: none; }
}
