/*
 * Cover canvas page. Loads after the Last Table tokens and components and uses only their variables.
 * The one primary action of each step is its first button: lay out, then export.
 */

.lt-page .cv-faqs h2 {
  margin: 0;
  font: 560 var(--lt-step-3) / var(--lt-leading-tight) var(--lt-font-display);
  color: var(--lt-text-1);
}
.lt-page .lt-section:last-child { padding-bottom: var(--lt-space-8); }

.cv-facts { display: flex; flex-wrap: wrap; gap: var(--lt-space-2) var(--lt-space-5); margin: var(--lt-space-5) 0 0; font-size: var(--lt-step--1); color: var(--lt-text-2); }

/* The sticky site header must never cover a focused control or the editor scrolled into view (WCAG 2.4.11). */
html:has(.cv-app) { scroll-padding-top: var(--lt-space-9); }
.cv-app { display: grid; gap: var(--lt-space-5); }
.cv-setup { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); gap: var(--lt-space-5); align-items: start; }
.cv-form, .cv-pictures { display: grid; gap: var(--lt-space-4); min-width: 0; }
.cv-form h2, .cv-pictures h2, .cv-editor h2 { margin: 0; }
.cv-field { display: grid; gap: var(--lt-space-2); min-width: 0; }
.cv-field[hidden] { display: none; }
.cv-field .lt-prompt-hint { margin: 0; }
.cv-field .lt-input { width: 100%; min-width: 0; }
.cv-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--lt-space-4); align-items: end; }

fieldset.cv-formats, fieldset.cv-layers, fieldset.cv-tabs { margin: 0; padding: 0; border: 0; min-width: 0; }
.cv-formats { display: flex; flex-wrap: wrap; gap: var(--lt-space-2) var(--lt-space-4); }
.cv-formats legend { margin-bottom: var(--lt-space-2); }
/* Every check and radio row is at least 24 px tall (WCAG 2.5.8) and the whole label is the target. */
.cv-check { display: inline-flex; align-items: center; gap: var(--lt-space-2); min-height: 32px; cursor: pointer; color: var(--lt-text-1); font-size: var(--lt-step--1); }
.cv-check input { width: 18px; height: 18px; margin: 0; accent-color: var(--lt-text-1); }

.cv-actions { display: flex; flex-wrap: wrap; align-items: center; gap: var(--lt-space-3); }
.cv-app .lt-btn:disabled { opacity: 0.55; cursor: not-allowed; }
#cv-status, #cv-announce { margin: 0; min-height: 1.6em; }
#cv-status[data-tone="error"] { color: var(--lt-danger); }

.cv-more { display: grid; gap: var(--lt-space-3); }
.cv-more summary { cursor: pointer; color: var(--lt-text-2); font-size: var(--lt-step--1); font-weight: 600; min-height: 44px; display: flex; align-items: center; gap: var(--lt-space-2); list-style: none; }
.cv-more summary::-webkit-details-marker { display: none; }
.cv-more summary::before { content: "+"; width: 1ch; font-family: var(--lt-font-mono); }
.cv-more[open] summary::before { content: "\2212"; }
.cv-prompts { display: grid; gap: var(--lt-space-3); }
.cv-prompts h3 { margin: 0; }
.cv-prompt { margin: 0; max-height: 14rem; overflow: auto; padding: var(--lt-space-3); border: 1px solid var(--lt-line); border-radius: var(--lt-radius-control); background: var(--lt-surface-1); font: var(--lt-step--1) / 1.5 var(--lt-font-mono); white-space: pre; }

/* The editor: the canvas on the left, the controls on the right; stacked on a phone. */
.cv-editor { display: grid; gap: var(--lt-space-4); }
.cv-editor[hidden] { display: none; }
.cv-editor-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--lt-space-3); }
.cv-tabs { display: flex; flex-wrap: wrap; gap: var(--lt-space-2); }
.cv-tab { display: inline-flex; align-items: center; gap: var(--lt-space-2); min-height: 36px; padding: 0 var(--lt-space-3); border: 1px solid var(--lt-line-strong); border-radius: var(--lt-radius-pill); cursor: pointer; font-size: var(--lt-step--1); color: var(--lt-text-1); }
.cv-tab:has(input:checked) { background: var(--lt-surface-3); border-color: var(--lt-text-1); font-weight: 600; }
.cv-tab:has(input:focus-visible) { outline: 2px solid var(--lt-text-1); outline-offset: 2px; }
.cv-tab input { margin: 0; accent-color: var(--lt-text-1); }

.cv-workspace { display: grid; grid-template-columns: minmax(0, 1fr) minmax(16rem, 20rem); gap: var(--lt-space-5); align-items: start; }
.cv-stage-wrap { display: grid; gap: var(--lt-space-2); min-width: 0; }
.cv-stage-wrap p { margin: 0; }
/* The canvas keeps its export pixels and is scaled down by CSS; a tall size is capped to the window height. */
.cv-stage { display: block; width: 100%; height: auto; max-height: 78vh; object-fit: contain; border: 1px solid var(--lt-line); border-radius: var(--lt-radius-control); background: var(--lt-surface-1); touch-action: none; cursor: grab; }
.cv-stage:active { cursor: grabbing; }
.cv-stage:focus-visible { outline: 3px solid var(--lt-text-1); outline-offset: 3px; }

.cv-controls { display: grid; gap: var(--lt-space-4); min-width: 0; }
.cv-layers > div { display: flex; flex-wrap: wrap; gap: var(--lt-space-1) var(--lt-space-4); }
.cv-layers legend { margin-bottom: var(--lt-space-2); }
.cv-move { display: grid; grid-template-columns: repeat(4, 44px); gap: var(--lt-space-2); }
.cv-icon { min-width: 44px; min-height: 44px; padding: 0; justify-content: center; font-size: var(--lt-step-1); }
#cv-size { width: 100%; min-height: 32px; accent-color: var(--lt-text-1); }
.cv-size-head { display: flex; align-items: baseline; gap: var(--lt-space-2); }
#cv-size-out { font-family: var(--lt-font-mono); color: var(--lt-text-2); text-transform: none; }

@media (max-width: 900px) {
  .cv-setup, .cv-workspace { grid-template-columns: minmax(0, 1fr); }
}

/* At 320 CSS px (WCAG 1.4.10 reflow) two fields side by side leave labels too narrow to read. */
@media (max-width: 420px) {
  .cv-grid { grid-template-columns: minmax(0, 1fr); }
}
