/* Maker, site editor and reusable audit dialog. */
:is(.maker-sheet, .editor-sheet, #audit-dialog) [hidden] { display: none !important; }
.maker-sheet { max-width: 690px; }
.editor-sheet { max-width: 1100px; }
.sheet-fields, .sheet-result, .editor-fields { display: grid; gap: var(--gap-3); min-width: 0; }
.sheet-fields :is(.field, .input, .select, .textarea) { min-width: 0; }
.sheet-section-title { margin: 0; font-size: var(--type-control); font-weight: 600; color: var(--label); line-height: 1.2; }
.maker-fields { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.maker-url { grid-column: 1 / -1; }

/* The artwork uses template colors and a small layout sketch. The select supplies every label and value. */
.maker-design { margin: 0; padding: 0; min-width: 0; border: 0; }
.maker-design legend { font-size: var(--type-control); font-weight: 600; margin-bottom: var(--gap-2); }
.maker-design-groups { display: grid; gap: var(--gap-3); }
.maker-group-title {
  margin: 0 0 var(--gap-2); padding-left: 2px; color: var(--label-2);
  font-size: var(--type-meta); font-weight: 600;
}
.maker-design-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--gap-2); }
.maker-design-group[data-columns="three"] .maker-design-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.maker-option {
  position: relative; min-width: 0; cursor: pointer;
  --tile-paper: #e9e1d2; --tile-ink: #3c3227; --tile-accent: #988067;
}
.maker-option[data-design="custom"] { --tile-paper: #ddd1be; --tile-ink: #2c2623; --tile-accent: #897253; }
.maker-option[data-design="custom-gemini"] { --tile-paper: #e9e9df; --tile-ink: #253a35; --tile-accent: #76918b; }
.maker-option[data-design="auto"] { --tile-paper: #ece9ee; --tile-ink: #3b3449; --tile-accent: #9d89ad; }
.maker-option[data-design="med-spas"] { --tile-paper: #f5ede6; --tile-ink: #2b211c; --tile-accent: #b88c81; }
.maker-option[data-design="dental"] { --tile-paper: #e6f1ef; --tile-ink: #12302d; --tile-accent: #6aaca5; }
.maker-option[data-design="law-firms"] { --tile-paper: #fbf8f0; --tile-ink: #14213d; --tile-accent: #8c6a2a; }
.maker-option[data-design="hvac-roofing"] { --tile-paper: #f6f7f9; --tile-ink: #0b1f3a; --tile-accent: #d9500a; }
.maker-option[data-design="real-estate"] { --tile-paper: #f6f6f3; --tile-ink: #20201f; --tile-accent: #a39b8b; }
.maker-option[data-design="clinics"] { --tile-paper: #fafaf6; --tile-ink: #1f2a2e; --tile-accent: #55745f; }
.maker-option[data-design="restaurants"] { --tile-paper: #e9d7ba; --tile-ink: #1c1917; --tile-accent: #9f5033; }
.maker-option[data-design="remodeling"] { --tile-paper: #f4eee6; --tile-ink: #2e2620; --tile-accent: #9a7458; }
.maker-option[data-design="classic"] { --tile-paper: #f8fafc; --tile-ink: #091322; --tile-accent: #0284c7; }
.maker-radio { position: absolute; inset: 0 auto auto 0; width: 1px; height: 1px; opacity: 0; margin: 0; }
.maker-tile {
  display: grid; grid-template-columns: 52px minmax(0, 1fr) 16px; align-items: center; gap: var(--gap-2);
  height: 100%; min-height: 54px; padding: 6px 7px;
  border: 1px solid var(--hair-strong); border-radius: var(--r-group); background: var(--well-bg);
  transition: border-color var(--motion-press) var(--ease), background var(--motion-press) var(--ease);
}
.maker-option:hover .maker-tile { background: var(--fill-hover); }
.maker-radio:checked + .maker-tile { background: var(--accent-wash); border-color: var(--accent-text); }
.maker-radio:focus-visible + .maker-tile { outline: 3.5px solid var(--focus); outline-offset: 2px; }
.maker-radio:disabled + .maker-tile { opacity: .55; cursor: default; }
.maker-thumbnail {
  position: relative; display: block; height: 34px; overflow: hidden; border-radius: 5px;
  isolation: isolate; background: var(--tile-paper); box-shadow: inset 0 0 0 1px rgb(0 0 0 / .12);
}
.maker-thumbnail-page {
  position: absolute; inset: 5px 5px 4px; border-top: 3px solid var(--tile-ink);
  background: linear-gradient(var(--tile-ink), var(--tile-ink)) 2px 7px / 44% 2px no-repeat,
    linear-gradient(var(--tile-ink), var(--tile-ink)) 2px 11px / 35% 2px no-repeat,
    linear-gradient(var(--tile-accent), var(--tile-accent)) 2px 16px / 24% 4px no-repeat;
}
.maker-thumbnail-shape {
  position: absolute; inset: 11px 5px 5px auto; width: 34%; border-radius: 2px;
  background: linear-gradient(140deg, var(--tile-accent), var(--tile-ink));
}
.maker-option:is([data-design="custom"], [data-design="med-spas"], [data-design="clinics"]) .maker-thumbnail-shape { border-radius: 12px 12px 2px 2px; }
.maker-option:is([data-design="auto"], [data-design="real-estate"], [data-design="restaurants"]) .maker-thumbnail-shape { border-radius: 50%; }
.maker-tile-caption { display: grid; gap: 2px; min-width: 0; }
.maker-tile-name { color: var(--label); font-weight: 550; font-size: var(--type-meta); line-height: 1.25; overflow-wrap: anywhere; }
.maker-tile-duration { color: var(--label-2); font-size: var(--type-caption); line-height: 1.25; }
.maker-tile-check {
  width: 16px; height: 16px; display: grid; place-items: center; border-radius: 50%;
  color: var(--accent-ink); background: var(--accent); visibility: hidden;
}
.maker-tile-check .ico { width: 11px; height: 11px; }
.maker-radio:checked + .maker-tile .maker-tile-check { visibility: visible; }

.maker-progress { display: grid; gap: var(--gap-2); }
.maker-progress-head { display: flex; align-items: baseline; justify-content: space-between; flex-wrap: wrap; gap: var(--gap-1) var(--gap-3); }
.maker-progress-head p { margin: 0; font-size: var(--type-control); font-weight: 600; }
.maker-elapsed { color: var(--label-2); font-size: var(--type-meta); }
.maker-steps { display: grid; gap: 4px; list-style: none; margin: 0; padding: 0; }
.maker-step { display: flex; align-items: center; gap: var(--gap-2); color: var(--label-2); }
.maker-step-indicator {
  width: 16px; height: 16px; display: grid; place-items: center; border: 1px solid currentColor;
  border-radius: 50%; flex: none; transition: color var(--motion-state) var(--ease);
}
.maker-step-indicator .ico { width: 11px; height: 11px; opacity: 0; transition: opacity var(--motion-state) var(--ease); }
.maker-step[data-state="complete"] .maker-step-indicator { color: var(--green-ink); }
.maker-step[data-state="complete"] .ico { opacity: 1; }
.maker-step[data-state="current"] { color: var(--accent-text); }
.maker-step[data-state="current"] .maker-step-indicator { box-shadow: inset 0 0 0 4px var(--well-bg); background: currentColor; }
.maker-progress[data-state="error"] #site-maker-status-text, .maker-step[data-state="stopped"] { color: var(--red-ink); }
.maker-progress[data-state="success"] #site-maker-status-text { color: var(--green-ink); }
.maker-result-link { justify-self: start; }

.editor-title-line { display: flex; align-items: center; gap: var(--gap-2); }
.editor-title-line .sheet-title { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.editor-body {
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: start; gap: var(--gap-4);
}
.editor-field-pair, .editor-colors { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--gap-2); }
.editor-colors { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.editor-color, .editor-instructions { display: flex; align-items: center; gap: var(--gap-2); min-width: 0; }
.editor-swatch {
  width: 24px; height: 24px; border-radius: 6px; border: 1px solid var(--hair-strong); flex: none;
  box-shadow: inset 0 0 0 1px rgb(255 255 255 / .15);
}
.editor-swatch.is-invalid { background: linear-gradient(135deg, transparent 46%, var(--red-ink) 47% 53%, transparent 54%); }
.editor-preview { position: sticky; top: 0; min-width: 0; display: grid; gap: var(--gap-3); }
.editor-preview-frame {
  display: block; width: 100%; height: min(59vh, 620px); height: min(59dvh, 620px); min-height: 260px;
  border: 1px solid var(--hair-strong); border-radius: var(--r-group); background: var(--input-bg); pointer-events: none;
}
.editor-preview-empty { margin: 0; padding: var(--gap-4) 0; }
.editor-body .disclosure { min-width: 0; padding-block: var(--gap-2); }
.editor-body .disclosure .code { overflow-wrap: anywhere; }
.editor-save-note { font-size: var(--type-meta); }

#audit-dialog { max-width: 590px; width: min(92vw, 590px); }
#audit-result { overflow-wrap: anywhere; }
#audit-result .ico, #audit-result .audit-score svg { background: none; border-radius: 0; padding: 0; }
#audit-result a.btn { color: var(--label); text-decoration: none; }
#audit-result a.btn:hover { text-decoration: none; }
.sheet-result-loading { display: flex; align-items: center; gap: var(--gap-2); min-height: 46px; color: var(--label-2); }
.sheet-result-error { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: var(--gap-2); color: var(--red-ink); }
.sheet-result-error p, .deposit-link-error { margin: 0; }
.sheet-result-actions { display: flex; justify-content: end; }
.deposit-link-error { color: var(--red-ink); }
#audit-result .deposit-care-row { justify-content: space-between; min-height: 44px; font-size: var(--type-body); cursor: pointer; }
.audit-overview {
  display: grid; grid-template-columns: 96px minmax(0, 1fr); align-items: center; gap: var(--gap-3);
}
.audit-overview-copy, .audit-findings, .sheet-share-content { display: grid; gap: var(--gap-2); min-width: 0; }
.audit-overview-copy p, .audit-finding p, .sheet-share-content p { margin: 0; }
.audit-caption { color: var(--label-2); font-weight: 600; font-size: var(--type-meta); }
.audit-score { display: grid; place-items: center; position: relative; width: 96px; aspect-ratio: 1; color: var(--accent-text); }
.audit-score svg { position: absolute; inset: 0; width: 100%; height: 100%; transform: rotate(-90deg); }
.audit-score circle { fill: none; stroke-width: 7; }
.audit-score-track { stroke: var(--hair-strong); }
.audit-score-value { stroke: currentColor; stroke-linecap: round; }
.audit-score-caption { display: grid; text-align: center; font-size: var(--type-caption); color: var(--label-2); line-height: 1.2; }
.audit-score-caption strong { color: var(--accent-text); font-size: var(--type-display); font-weight: 650; letter-spacing: -.03em; }
.audit-finding-list { margin: 0; padding: 0; list-style: none; }
.audit-finding { display: grid; gap: var(--gap-1); padding: var(--gap-3); }
.audit-finding + .audit-finding { border-top: 1px solid var(--hair); }
.audit-finding-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: var(--gap-1) var(--gap-3); }
.audit-finding-head strong { font-weight: 600; }
.audit-severity { display: inline-flex; align-items: center; gap: 5px; font-size: var(--type-meta); font-weight: 550; }
.audit-severity[data-severity="high"] { color: var(--red-ink); }
.audit-severity[data-severity="med"] { color: var(--orange-ink); }
.audit-severity[data-severity="low"] { color: var(--blue-ink); }
.audit-severity-dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; flex: none; }
.audit-comparison { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--gap-3); }
.audit-comparison .well { display: grid; justify-items: center; gap: var(--gap-2); }
.sheet-share-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--gap-3); }
.sheet-share-content { flex: 1 1 210px; }
.sheet-share-actions { display: flex; flex-wrap: wrap; gap: var(--gap-2); }
.sheet-share-qr { width: 110px; height: 110px; flex: none; padding: 6px; border-radius: var(--r-group); background: white; }

@media (max-width: 860px) {
  :is(.maker-sheet, .editor-sheet, #audit-dialog) { max-width: none; }
  #audit-dialog { width: 100%; }
  .maker-design-group[data-columns="three"] .maker-design-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .editor-body { grid-template-columns: minmax(0, 1fr); }
  .editor-preview { position: static; }
  .editor-preview-frame { min-height: 220px; height: 40vh; height: 40dvh; }
  .editor-open { min-width: 44px; padding-inline: 0; }
  .editor-open span { display: none; }
}
@media (max-width: 520px) {
  .maker-fields { grid-template-columns: minmax(0, 1fr); }
  .maker-tile { grid-template-columns: 38px minmax(0, 1fr); padding: 6px; }
  .maker-tile-check { position: absolute; top: 2px; left: 2px; width: 13px; height: 13px; }
  .maker-sheet .sheet-foot .left { flex-basis: auto; }
  .editor-title-line { display: grid; gap: 3px; }
  .editor-title-line .chip { justify-self: start; }
  .editor-color { flex-direction: column; align-items: stretch; gap: 4px; }
  .editor-swatch { width: 100%; height: 19px; }
  .editor-save-note { display: none; }
}
@media (max-width: 520px) and (pointer: coarse) {
  #audit-result :is(input:not([type="checkbox"]), select), .editor-color .mono { min-height: 44px; font-size: var(--type-lead); }
}
@media (max-height: 450px) {
  :is(.maker-sheet, .editor-sheet) .sheet-head, #audit-dialog .sheet-head { padding-block: var(--gap-2); }
  :is(.maker-sheet, .editor-sheet) .sheet-foot { padding-block: var(--gap-2); }
}

/* Mobile sheets can be dragged by their handle or from unscrolled content. */
.hub-sheet-grabber { display: none; }
@media (max-width: 860px) {
  :is(.sheet, .hub-palette):has(> .hub-sheet-grabber) {
    translate: 0 var(--sheet-swipe, 0px);
    transition: translate var(--motion-state) var(--ease);
  }
  :is(.sheet, .hub-palette).hub-sheet-dragging { transition: none; }
  .hub-sheet-grabber {
    display: grid;
    flex: none;
    height: 24px;
    place-items: center;
    touch-action: none;
    cursor: grab;
  }
  .hub-sheet-grabber::before {
    content: "";
    width: 34px;
    height: 4px;
    border-radius: var(--r-pill);
    background: color-mix(in srgb, var(--label-3) 62%, transparent);
  }
  .hub-sheet-grabber + :is(.sheet-head, .hub-palette-head) { padding-block-start: var(--gap-1); }
  .hub-sheet-dragging .hub-sheet-grabber { cursor: grabbing; }
}
