/* wearfits.me — app layout that sits on top of styles.css: the model wizard as a sheet and the compact top of Style
   (the app bar is header.css). Loaded after styles.css, so its rules win at equal specificity. */

/* ---------- model wizard: a sheet over the product (bottom sheet on phones, centred dialog from 900 px) ---------- */
dialog.wizard-sheet {
  --wiz-pad: var(--s4);
  margin: auto auto 0; width: 100%; max-width: none; max-height: 84dvh; padding: 0;
  overflow-y: auto; overscroll-behavior: contain; border-width: 2px 0 0;
}
.wizard-sheet > .view { padding: 0 var(--wiz-pad) var(--s5); }
.wizard-sheet .sheet-head { margin: 0 calc(-1 * var(--wiz-pad)) var(--s3); padding: 0 var(--s2) 0 var(--wiz-pad); }
/* One column inside the sheet at every width; the waiting piece stays a small row on top. */
.wizard-sheet .cols { display: flex; flex-direction: column; gap: var(--s3); }
.wizard-sheet .col-side { position: static; }
.wizard-sheet .wizard-form > #wiz-waiting { order: -1; padding: var(--s2); }
.wizard-sheet #wiz-waiting > p { display: none; }
.wizard-sheet #wiz-waiting .item-row { grid-template-columns: 36px minmax(0, 1fr); padding: 0; align-items: center; }
.wizard-sheet #wiz-waiting .item-thumb { width: 36px; }
.wizard-sheet #wiz-waiting .item-title { font-size: 17px; }
.wizard-sheet .h2 { font-size: 24px; line-height: 0.95; }

.wizard-sheet .wiz-plate { min-height: 160px; padding: var(--s3); }

/* ---------- Try on: a link pasted in the header shows its message even when the card hides the field ---------- */
.has-product:not(.link-open) #url-form:has(#url-error:not([hidden]), #url-status:not([hidden])) { display: block; }

/* =================== desktop ≥ 900px =================== */
@media (min-width: 900px) {
  dialog.wizard-sheet { --wiz-pad: var(--s5); margin: auto; width: calc(100% - 32px); max-width: 520px; max-height: min(88dvh, 820px); border-width: 2px; }

  .result-cols { --shot-w: calc(min(var(--page-max), 100vw - 2 * var(--gutter)) - var(--s7) - 400px); }

}

/* ---------- Try on with a product, from 900 px (mockup D2): thumbnails | photo fitted to the viewport | the words and
   the actions in one column, so brand, price, category and Try on are all on screen; the photo column narrows first. */
@media (min-width: 900px) {
  [data-view="tryon"].has-product .cols { display: flex; flex-direction: column; }
  [data-view="tryon"].has-product .col-side { position: static; }
  .has-product #product-box {
    --ph: max(360px, calc(100dvh - var(--bar-h) - 2 * var(--page-top)));
    display: grid; column-gap: var(--s4); align-items: start;
    grid-template-columns: 64px minmax(0, calc(var(--ph) * 3 / 4)) minmax(260px, 1fr); /* the photo takes its fit first */
    grid-template-rows: repeat(5, auto) 1fr;
  }
  .has-product .product-card { display: contents; }
  .has-product #product-box > * { grid-column: 3; max-width: 400px; }

  .has-product .product-photo { grid-column: 2; grid-row: 1 / -1; width: 100%; max-width: none; max-height: var(--ph); margin-right: var(--s5); }
  .has-product .picker-photos { grid-column: 1; grid-row: 1 / -1; margin-top: 0; }
  .has-product .picker-photos .thumbs { flex-direction: column; overflow: visible; }
  .has-product .picker-photos .thumb { flex: none; width: 64px; }
  .has-product .product-text { grid-column: 3; grid-row: 1; margin-top: 0; }
  .has-product #category-line { grid-row: 2; }
  .has-product #category-chips { grid-row: 3; }
  .has-product .tryon-bar { grid-row: 4; }
  .has-product #to-styling { grid-row: 5; justify-self: start; }
}

/* Pricing: three plans can be narrow; the plan's tag wraps under its name instead of spilling out. */
.plan .between { flex-wrap: wrap; gap: var(--s1) var(--s2); }

/* Connecting an outside app (#/connect): one hairline card, no tabs or paste field around it. */
#shell[data-focus-flow] #tabbar, #shell[data-focus-flow] .header-paste, #shell[data-focus-flow] .task-strip, #shell[data-focus-flow] #credits, #shell[data-focus-flow] .ext-btn, #shell[data-focus-flow] .phone-paste { display: none !important; }
.connect-box { border: var(--hair); padding: var(--s5) var(--s4); margin-top: var(--s5); }
.connect-box .h1 { overflow-wrap: anywhere; }
.connect-allows { margin: var(--s2) 0 var(--s4); padding-left: 1.2em; }
.connect-allows li + li { margin-top: var(--s2); }
.connect-dest { overflow-wrap: anywhere; margin: 0 0 var(--s3); }
.connect-warn { margin-top: var(--s3); }
.connect-actions { display: flex; flex-direction: column; gap: var(--s2); margin-top: var(--s4); }
@media (min-width: 900px) { .connect-box { padding: var(--s6); } }
.apps-row { display: flex; justify-content: space-between; align-items: center; gap: var(--s3); flex-wrap: wrap; }
.apps-row .row { display: flex; gap: var(--s2); }

/* ---------- special collection bar (special-collection.js): in flow above every view ---------- */
.collection-bar {
  display: flex; align-items: center; gap: var(--s3); flex-wrap: wrap;
  padding: var(--s2) var(--edge); border-bottom: var(--hair); background: var(--white); color: var(--ink);
}
.collection-bar[hidden] { display: none; }
.collection-bar-kicker { color: var(--muted); }
.collection-bar-name { flex: 1 1 auto; min-width: 0; font-weight: 600; overflow-wrap: anywhere; }
.collection-bar-logo { display: block; max-height: 28px; max-width: 160px; width: auto; }
