/* Frame — generator UX layer (studio-ux.css)
   Loaded after frame.css. Purely presentational: it re-lays-out the existing
   generator markup, it does not add or remove a single control.

   Layout contract
   ---------------
   DOM order is .controls -> .preview -> .customize, which is exactly the
   required mobile sequence, so no CSS `order` is used and keyboard order
   always matches what is on screen. Desktop pins the preview with grid areas. */

/* ---------- desktop workspace ---------- */
@media (min-width:901px){
  .studio{
    grid-template-columns:minmax(0,1fr) 372px;
    grid-template-areas:"controls preview" "customize preview";
    align-items:start;
  }
  .controls{grid-area:controls;padding:28px 30px 18px;border-right:1px solid var(--border-soft);border-bottom:0;}
  .customize{grid-area:customize;padding:0 30px 28px;border-right:1px solid var(--border-soft);}
  .preview{
    grid-area:preview;
    position:sticky;top:96px;               /* clears the fixed header */
    align-self:start;
    padding:26px 24px;gap:16px;
    max-height:calc(100vh - 120px);
    overflow-y:auto;overscroll-behavior:contain;
  }
  .preview::-webkit-scrollbar{width:6px}
  .preview::-webkit-scrollbar-thumb{background:var(--border);border-radius:3px}
}

/* short viewports: sticky would trap the download button off-screen */
@media (min-width:901px) and (max-height:760px){
  .preview{position:static;max-height:none;}
}

/* ---------- compact control spacing ---------- */
.controls .field{margin-bottom:16px;}
.controls .field:last-child{margin-bottom:0;}
.controls .field > label{
  font-size:11px;letter-spacing:.06em;margin-bottom:7px;
}
.now-creating{font-size:12.5px;margin-bottom:14px;}
.field-row{gap:12px;}
.controls input[type="text"],.controls input[type="url"],.controls input[type="email"],
.controls input[type="tel"],.controls textarea,.controls select,
.cz-body input[type="text"],.cz-body input[type="url"],.cz-body select{
  padding:11px 13px;font-size:14px;
}

/* ---------- type selector ---------- */
.type-tabs{gap:7px;margin-bottom:16px;}
.type-tab{padding:9px 14px;font-size:12.5px;}
@media (max-width:900px){
  /* one scrollable row instead of several stacked rows */
  .type-tabs{
    display:flex;flex-wrap:nowrap;overflow-x:auto;overscroll-behavior-x:contain;
    -webkit-overflow-scrolling:touch;scrollbar-width:none;
    padding-bottom:6px;margin-left:-20px;margin-right:-20px;
    padding-left:20px;padding-right:20px;
    scroll-snap-type:x proximity;
  }
  .type-tabs::-webkit-scrollbar{display:none}
  .type-tab{flex:0 0 auto;scroll-snap-align:start;min-height:38px;}
}

/* ---------- customise accordions ---------- */
.customize{min-width:0;}
.cz-head{
  display:flex;align-items:baseline;justify-content:space-between;gap:12px;
  font-family:'Archivo',sans-serif;font-size:14px;font-weight:700;
  color:var(--ink);padding:12px 0 8px;border-top:1px solid var(--border-soft);
}
.cz-head-note{font-family:'IBM Plex Mono',monospace;font-size:10.5px;color:var(--ink-dim);font-weight:400;}

.cz{border:1px solid var(--border-soft);border-radius:11px;margin-bottom:6px;background:rgba(255,255,255,.015);}
.cz[open]{border-color:var(--border);}
.cz > summary{
  list-style:none;cursor:pointer;user-select:none;
  display:flex;align-items:center;gap:10px;
  padding:9px 14px;min-height:38px;
}
.cz > summary::-webkit-details-marker{display:none}
.cz > summary:focus-visible{outline:2px solid var(--gold);outline-offset:-2px;border-radius:11px;}
.cz-title{font-family:'Archivo',sans-serif;font-size:13.5px;font-weight:700;color:var(--ink);}
.cz-hint{
  flex:1;font-size:11.5px;color:var(--ink-dim);
  white-space:nowrap;overflow:hidden;text-overflow:ellipsis;
}
.cz-chev{color:var(--gold);font-size:11px;transition:transform .22s ease;flex-shrink:0;}
.cz[open] > summary .cz-chev{transform:rotate(180deg);}
.cz-body{padding:0 14px 12px;}
.cz-body > *:first-child{margin-top:0}
.cz-body .shape-group{margin-bottom:12px;}
.cz-body .shape-group:last-child{margin-bottom:0;}
.cz-body .transparent-toggle{margin-top:0;}
.cz[data-cz="advanced"] .transparent-toggle + .transparent-toggle{margin-top:12px;}

/* ---------- preview panel ---------- */
.preview .frame{max-width:270px;width:100%;}
.res-row{width:100%;}
.preview-note{font-size:11.5px;line-height:1.5;}

/* ---------- mobile ---------- */
@media (max-width:900px){
  .cz > summary{min-height:46px;padding:12px 14px;}   /* comfortable touch target */
  .controls{padding:20px 20px 14px;border-bottom:0;}
  .preview{
    padding:18px 20px 22px;gap:12px;
    border-top:1px solid var(--border-soft);
    border-bottom:1px solid var(--border-soft);
  }
  .preview .frame{max-width:210px;}          /* confirmation, not viewport hog */
  .customize{padding:4px 20px 20px;}
  .cz-head{padding:14px 0 10px;}
  .cz-hint{display:none;}                    /* keeps each row to one line */
  .quick-style{width:100%;}
}
@media (max-width:430px){
  .preview .frame{max-width:190px;}
  .controls{padding:16px 16px 12px;}
  .preview{padding:16px 16px 20px;}
  .customize{padding:4px 16px 18px;}
  .type-tabs{margin-left:-16px;margin-right:-16px;padding-left:16px;padding-right:16px;}
}

/* ============================================================
   Final mobile priority pass
   ============================================================ */

/* Quick Styles sit last in the DOM so the mobile column reads
   QR -> status -> download -> styles with no reordering.
   Desktop hoists them back above the preview. */
@media (min-width:901px){
  .preview .quick-style{order:-1;}
  .preview{display:flex;flex-direction:column;}
}
@media (max-width:900px){
  .preview .quick-style{
    margin-top:4px;padding-top:14px;
    border-top:1px solid var(--border-soft);width:100%;
  }
}

/* ---------- compact mobile hero: get to the generator sooner ----------
   Desktop hero is untouched. H1 and eyebrow stay exactly as they are. */
@media (max-width:900px){
  .hero{padding:34px 0 18px;}
  .hero-head .eyebrow{font-size:10.5px;letter-spacing:.13em;}
  .hero-head .hero-tagline{font-size:16px;line-height:1.3;margin:2px 0 10px;max-width:none;}
  .hero-head > p{font-size:14px;line-height:1.55;margin-bottom:0;max-width:none;}

  /* badges: one condensed scrollable row instead of a wrapped stack */
  .hero-badges{
    display:flex;flex-wrap:nowrap;gap:8px;margin:14px 0 18px;
    overflow-x:auto;overscroll-behavior-x:contain;-webkit-overflow-scrolling:touch;
    scrollbar-width:none;scroll-snap-type:x proximity;
    margin-left:-20px;margin-right:-20px;padding:2px 20px;
  }
  .hero-badges::-webkit-scrollbar{display:none}
  .hero-badge{
    flex:0 0 auto;scroll-snap-align:start;
    padding:8px 13px;font-size:11.5px;white-space:nowrap;animation:none;
  }
}
@media (max-width:430px){
  .hero{padding:26px 0 14px;}
  .hero-head .hero-tagline{font-size:15px;}
  .hero-head > p{font-size:13.5px;}
  .hero-badges{margin-left:-16px;margin-right:-16px;padding-left:16px;padding-right:16px;}
}
