/* ==========================================================================
   Usability layer: same theme, colours and glass as styles.css. Layout and
   behaviour only.
   - her photo is always in view while she uses the controls
   - nothing written is ever drawn over her photo
   ========================================================================== */

/* ---------- nothing written over the photo ---------- */
/* status and tips live in the header strip, on every screen size */
.toast {
  top: calc(env(safe-area-inset-top) + var(--bar-gap, 10px) + 4px) !important;
  bottom: auto !important;
  left: 50% !important;
  max-width: min(520px, calc(100% - 24px));
  min-height: calc(var(--bar-h) - 8px);
  display: flex; align-items: center; justify-content: center; text-align: center;
  z-index: 70;
}
.toast[hidden] { display: none; }
/* the before / after words are spoken by the header strip instead of sitting on her face */
.cmp-tag { display: none !important; }
/* while her face is being read, only the ring shows on the photo; the words go to the header strip */
.loader { width: auto; padding: var(--s4); border-radius: 999px; }
.loader-text, .loader-sub {
  position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden;
  clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; border: 0;
}

/* ---------- which tabs have makeup on ---------- */
.tab-dot {
  position: absolute; top: 7px; right: calc(50% - 17px);
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--accent);
  transform: scale(0); opacity: 0;
  transition: transform 320ms var(--spring, ease), opacity 200ms ease;
  pointer-events: none;
}
.tab.has-on .tab-dot { transform: scale(1); opacity: 1; }

/* the look she is wearing */
.look.is-on { border-color: var(--accent); }
.look.is-on .look-name::after { content: " ✓"; color: var(--accent); font-weight: 600; }

/* ---------- phone: the photo is pinned, only the controls scroll ---------- */
@media (max-width: 767.98px) {
  html.studio-on, html.studio-on body { height: 100%; overflow: hidden; overscroll-behavior: none; }
  html.studio-on body { display: flex; flex-direction: column; min-height: 0; height: 100dvh; }
  html.studio-on .bar { flex: none; }
  html.studio-on .app.has-photo {
    flex: 1 1 auto; min-height: 0; height: auto;
    grid-template-rows: var(--photo, 56%) minmax(0, 1fr);
    gap: 0;
  }
  /* drag the little handle to give the photo or the controls more room */
  .grab {
    flex: none; position: relative; height: 22px; margin: 0; cursor: ns-resize; touch-action: none;
    display: flex; align-items: center; justify-content: center;
  }
  .grab::before {
    content: ""; width: 40px; height: 5px; border-radius: 3px; background: var(--hair-strong);
    transition: transform 200ms ease, width 200ms ease;
  }
  .grab:active::before, .grab.dragging::before { width: 56px; transform: scaleY(1.2); }
  .grab:focus-visible { outline: 2px solid var(--accent); outline-offset: -4px; border-radius: 12px; }
  .app.has-photo .panel { margin-top: var(--s2); }
  .app.has-photo .panel .tabs { margin-top: 0; }

  /* looks: two to a row, so all seven are a glance away */
  #preset-looks { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s2); }
  #preset-looks > .look { padding: var(--s3); grid-template-columns: 1fr; gap: var(--s2); align-content: space-between; min-height: 76px; }
  #preset-looks .look-desc { display: none; }
  #preset-looks .look-dots { grid-row: auto; grid-column: auto; padding-left: 5px; }
  #preset-looks .look-name { font-size: 0.9375rem; line-height: 1.2; }
}
@media (min-width: 768px) { .grab { display: none; } }

/* ---------- a phone on its side: photo left, controls right ---------- */
@media (max-width: 1023.98px) and (orientation: landscape) and (max-height: 540px) {
  html.studio-on, html.studio-on body { height: 100%; overflow: hidden; }
  html.studio-on body { display: flex; flex-direction: column; height: 100dvh; }
  html.studio-on .app.has-photo {
    flex: 1 1 auto; min-height: 0; height: auto;
    display: grid; grid-template-columns: minmax(0, 1fr) minmax(280px, 46%); grid-template-rows: minmax(0, 1fr);
    gap: var(--s2); padding: var(--s2);
  }
  html.studio-on .app.has-photo .stage { height: auto; min-height: 0; position: relative; }
  html.studio-on .app.has-photo .panel { min-height: 0; overflow: hidden; display: flex; flex-direction: column; margin-top: 0; border-radius: var(--r-l); }
  html.studio-on .app.has-photo .panes { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; }
  .grab { display: none; }
  .app.has-photo .tab { min-height: 44px; }
}

@media (prefers-reduced-motion: reduce) { .tab-dot { transition: none; } }

/* wide screens: the studio fills the window, so the page itself has nothing to scroll */
@media (min-width: 768px) { html.studio-on, html.studio-on body { overflow: hidden; } }
