/* portfoliopt.com: Editor de Colagens e Moodboards. Usa só os tokens de site.css. */

.ed-sr { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.ed-app [hidden], .ed-shell [hidden] { display: none !important; }

/* Cabeçalho da página */
.ed-head-wrap .breadcrumbs { padding-top: 0.9rem; }
.ed-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-end; gap: 0.6rem 2rem; padding-block: 0.4rem 0.9rem; }
.ed-head-copy { flex: 1 1 32rem; }
.ed-head h1 { font-size: clamp(1.8rem, 2.4vw + 0.8rem, 2.5rem); margin-bottom: 0.2em; }
.ed-lead { margin: 0; color: var(--ink-2); font-size: 1.05rem; line-height: 1.5; max-width: 62ch; }
.ed-privacy { display: inline-flex; align-items: center; gap: 0.6rem; margin: 0; max-width: 28rem; padding: 0.55rem 0.95rem; line-height: 1.4; background: var(--accent-soft); border: 1px solid var(--accent); border-radius: var(--radius); font-weight: 700; color: var(--ink); }
.ed-privacy .ed-ico { flex: none; color: var(--accent); }

.ed-shell { width: 100%; max-width: 1560px; margin-inline: auto; padding-inline: var(--gutter); }
.ed-ico { flex: none; display: block; }

/* App */
.ed-app { display: flex; flex-direction: column; gap: 0.75rem; padding-bottom: 1.5rem; }
.ed-app[hidden] { display: none; }

.ed-bar { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 0.75rem 1rem; }
.ed-field { display: grid; gap: 0.3rem; min-width: 0; }
.ed-field label, .ed-fs legend { font-weight: 700; font-size: 0.95rem; }
.ed-field-name { flex: 1 1 16rem; max-width: 26rem; }
.ed-field-format { flex: 0 1 14rem; }
.ed-save { margin: 0 0 0.55rem auto; font-weight: 700; color: var(--ink-2); display: inline-flex; align-items: center; gap: 0.5rem; }
.ed-save::before { content: ""; width: 0.7rem; height: 0.7rem; border-radius: 50%; background: currentColor; flex: none; }
.ed-save[data-state="saved"] { color: var(--ok); }
.ed-save[data-state="error"], .ed-save[data-state="memory"] { color: var(--danger); }

/* Campos */
.ed-app input[type="text"], .ed-app input[type="number"], .ed-app select, .ed-app textarea {
  width: 100%; min-height: 44px; font: inherit; color: var(--ink); background: #fff; border: 2px solid var(--ink-2); border-radius: var(--radius); padding: 0.45em 0.65em; line-height: 1.35;
}
.ed-app textarea { min-height: 5.5rem; resize: vertical; }
.ed-app input[type="color"] { width: 100%; min-height: 44px; padding: 3px; background: #fff; border: 2px solid var(--ink-2); border-radius: var(--radius); cursor: pointer; }
.ed-app input[type="range"] { width: 100%; min-height: 44px; accent-color: var(--accent); margin: 0; }
.ed-app input:focus-visible, .ed-app select:focus-visible, .ed-app textarea:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; border-color: var(--accent); }
.ed-range { margin-top: 0.2rem; }

/* Botões */
.ed-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.45rem; min-height: 44px; padding: 0.35em 0.85em; font: inherit; font-weight: 700; line-height: 1.2;
  color: var(--ink); background: var(--paper-hi); border: 2px solid var(--ink-2); border-radius: var(--radius); cursor: pointer; text-decoration: none; white-space: nowrap;
}
.ed-btn:hover { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.ed-btn[aria-pressed="true"] { background: var(--accent-soft); border-color: var(--accent); color: var(--ink); }
.ed-btn[aria-pressed="true"]:hover { background: var(--accent); color: var(--on-accent); }
.ed-btn-primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.ed-btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); color: var(--on-accent); }
.ed-btn-danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.ed-btn-danger:hover { background: #7d1f1f; border-color: #7d1f1f; color: #fff; }
.ed-btn-small { padding: 0.25em 0.7em; font-size: 0.95rem; }
.ed-btn-icon { min-width: 44px; padding-inline: 0.5em; }
.ed-btn[aria-disabled="true"] { opacity: 0.45; cursor: not-allowed; }
.ed-btn[aria-disabled="true"]:hover { background: var(--paper-hi); color: var(--ink); border-color: var(--ink-2); }
.ed-filebtn { position: relative; display: inline-flex; }
.ed-filebtn input:focus-visible + label { outline: 3px solid var(--accent); outline-offset: 3px; }

/* Barra de ferramentas */
.ed-toolbar { display: flex; flex-wrap: wrap; gap: 0.5rem 0.9rem; padding: 0.55rem; background: var(--paper-hi); border: 1px solid var(--line-2); border-radius: var(--radius); }
.ed-group { display: flex; flex-wrap: wrap; align-items: center; gap: 0.4rem; }
.ed-toolbar { column-gap: 1.4rem; }
.ed-count { font-size: 0.92rem; color: var(--ink-2); padding-inline: 0.3rem; white-space: nowrap; }
.ed-zoom { min-width: 3.6rem; text-align: center; font-weight: 700; font-variant-numeric: tabular-nums; }

/* Avisos */
.ed-notices { display: grid; gap: 0.5rem; }
.ed-notices:empty { display: none; }
.ed-notice { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; padding: 0.7rem 0.9rem; border: 2px solid; border-radius: var(--radius); }
.ed-notice-error { border-color: var(--danger); background: #F8EAEA; }
.ed-notice-ok { border-color: var(--ok); background: #E8F3EC; }
.ed-notice-info { border-color: var(--accent); background: var(--accent-soft); }
.ed-notice-text p, .ed-notice-text ul { margin: 0; }
.ed-notice-text ul { padding-left: 1.2em; margin-top: 0.3rem; }
.ed-notice-title { font-weight: 700; }
.ed-notice-close { flex: none; min-height: 44px; padding: 0 0.8rem; font: inherit; font-weight: 700; color: var(--ink); background: transparent; border: 2px solid var(--ink-2); border-radius: var(--radius); cursor: pointer; }
.ed-notice-close:hover { background: var(--ink); color: var(--paper); }

/* Atalho para quem usa só o teclado: pula as camadas do quadro */
.ed-skip { position: absolute; left: -9999px; top: auto; padding: 0.6rem 1rem; font-weight: 700; color: var(--paper); background: var(--ink); border-radius: var(--radius); z-index: 30; }
.ed-skip:focus { position: static; display: inline-block; justify-self: start; }
.ed-panel:focus { outline: none; }

/* Área de trabalho */
.ed-workspace { display: grid; grid-template-columns: minmax(0, 1fr) 24rem; gap: 1rem; align-items: start; }
.ed-stage {
  display: flex; overflow: auto; padding: 1.25rem; height: min(78vh, 900px); min-height: 26rem;
  background-color: var(--paper-lo); background-image: radial-gradient(var(--line-2) 1px, transparent 1px); background-size: 18px 18px;
  border: 1px solid var(--line-2); border-radius: var(--radius);
}
.ed-stage.is-drop { outline: 3px dashed var(--accent); outline-offset: -6px; }
.ed-board-wrap { position: relative; margin: auto; flex: none; outline: none; }
.ed-artboard { position: absolute; left: 0; top: 0; transform-origin: 0 0; overflow: hidden; background: #fff; box-shadow: 0 0 0 1px var(--line-2), 6px 6px 0 var(--line-2); user-select: none; -webkit-user-select: none; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
.ed-board-wrap.is-dragging, .ed-board-wrap.is-dragging * { cursor: grabbing; }

.ed-layer { position: absolute; left: 0; top: 0; transform-origin: 50% 50%; touch-action: none; cursor: move; outline: none; }
.ed-layer:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; border-radius: 2px; }
.ed-frame { position: absolute; inset: 0; box-sizing: border-box; overflow: hidden; }
.ed-type-text .ed-frame { overflow: visible; }
.ed-img { position: absolute; display: block; max-width: none; user-select: none; -webkit-user-drag: none; pointer-events: none; }
.ed-text { width: 100%; white-space: pre-wrap; overflow-wrap: break-word; user-select: none; -webkit-user-select: none; font-weight: 400; }
.is-missing .ed-frame { background: repeating-linear-gradient(45deg, var(--paper-lo), var(--paper-lo) 8px, var(--line) 8px, var(--line) 16px); }
.ed-artboard.is-crop .ed-layer.is-selected { cursor: grab; }

.ed-grid { position: absolute; inset: 0; pointer-events: none; background-image: linear-gradient(to right, rgba(42, 61, 184, 0.2) 1px, transparent 1px), linear-gradient(to bottom, rgba(42, 61, 184, 0.2) 1px, transparent 1px); }

/* Moldura de seleção e alças */
.ed-sel { position: absolute; box-sizing: border-box; border: 2px solid var(--accent); pointer-events: none; transform-origin: 50% 50%; }
.ed-sel.is-crop { border-style: dashed; border-width: 3px; }
.ed-h { position: absolute; width: 14px; height: 14px; margin: -7px 0 0 -7px; box-sizing: border-box; background: #fff; border: 2px solid var(--accent); border-radius: 2px; pointer-events: auto; touch-action: none; }
.ed-h::after { content: ""; position: absolute; inset: -15px; }
.ed-h[data-handle="nw"] { left: 0; top: 0; cursor: nwse-resize; }
.ed-h[data-handle="n"] { left: 50%; top: 0; cursor: ns-resize; }
.ed-h[data-handle="ne"] { left: 100%; top: 0; cursor: nesw-resize; }
.ed-h[data-handle="e"] { left: 100%; top: 50%; cursor: ew-resize; }
.ed-h[data-handle="se"] { left: 100%; top: 100%; cursor: nwse-resize; }
.ed-h[data-handle="s"] { left: 50%; top: 100%; cursor: ns-resize; }
.ed-h[data-handle="sw"] { left: 0; top: 100%; cursor: nesw-resize; }
.ed-h[data-handle="w"] { left: 0; top: 50%; cursor: ew-resize; }
.ed-h-rot { left: 50%; top: -38px; border-radius: 50%; width: 16px; height: 16px; margin: -8px 0 0 -8px; background: var(--accent); cursor: grab; }
.ed-h-rot::before { content: ""; position: absolute; left: 50%; top: 100%; width: 2px; height: 22px; background: var(--accent); transform: translateX(-50%); }
.ed-sel[data-kind="text"] [data-handle="n"], .ed-sel[data-kind="text"] [data-handle="s"] { display: none; }
.ed-sel.is-crop .ed-h { display: none; }
@media (pointer: coarse) {
  .ed-h { width: 22px; height: 22px; margin: -11px 0 0 -11px; }
  .ed-h::after { inset: -11px; }
  .ed-h-rot { width: 26px; height: 26px; margin: -13px 0 0 -13px; top: -44px; }
}

/* Estado vazio */
.ed-empty { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); width: min(88%, 22rem); display: grid; justify-items: center; gap: 0.6rem; padding: 1.25rem; text-align: center; background: var(--paper-hi); border: 2px dashed var(--ink-2); border-radius: var(--radius); }
.ed-empty p { margin: 0; color: var(--ink-2); }
.ed-empty .ed-empty-title { font-family: var(--font-display); font-size: 1.5rem; line-height: 1.2; color: var(--ink); }

/* Painel */
.ed-panel { display: flex; flex-direction: column; height: min(78vh, 900px); min-height: 26rem; background: var(--paper-hi); border: 1px solid var(--line-2); border-radius: var(--radius); }
.ed-panel-head { display: flex; border-bottom: 1px solid var(--line-2); }
.ed-tabs { display: flex; flex: 1; min-width: 0; }
.ed-tabs [role="tab"] { flex: 1 1 auto; min-width: 0; min-height: 48px; padding: 0 0.45rem; font: inherit; font-size: 0.92rem; font-weight: 700; color: var(--ink-2); background: var(--paper-lo); border: 0; border-bottom: 3px solid transparent; border-right: 1px solid var(--line-2); cursor: pointer; }
.ed-tabs [role="tab"]:last-child { border-right: 0; }
.ed-tabs [role="tab"][aria-selected="true"] { color: var(--ink); background: var(--paper-hi); border-bottom-color: var(--accent); }
.ed-tabs [role="tab"]:hover { color: var(--ink); }
.ed-tabs [role="tab"]:focus-visible { outline-offset: -3px; }
.ed-sheet-toggle { display: none; align-items: center; justify-content: center; width: 48px; min-height: 48px; color: var(--ink); background: var(--paper-hi); border: 0; border-left: 1px solid var(--line-2); cursor: pointer; }
.ed-panel-body { flex: 1; overflow: auto; padding: 1rem; }
.ed-panel-body h3 { font-size: 1.25rem; margin-bottom: 0.4em; }
.ed-gap { margin-top: 1.5rem; }
.ed-muted { font-family: var(--font-body); font-size: 0.9rem; color: var(--ink-2); }
.ed-hint { font-size: 0.93rem; color: var(--ink-2); margin: 0.2rem 0 0.8rem; }
.ed-fs { margin: 0 0 0.85rem; padding: 0.4rem 0.8rem 0.8rem; min-width: 0; border: 1px solid var(--line-2); border-radius: var(--radius); }
.ed-fs legend { padding-inline: 0.3rem; }
.ed-fs > .ed-field + .ed-field, .ed-fs > .ed-field + .ed-grid2, .ed-fs > .ed-grid2 + .ed-field { margin-top: 0.6rem; }
.ed-fs .ed-hint:last-child { margin-bottom: 0; }
.ed-grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0.6rem; }
.ed-row { display: grid; grid-template-columns: 1fr 1fr; gap: 0.6rem; margin-bottom: 0.6rem; }
.ed-row-actions { display: flex; flex-wrap: wrap; gap: 0.5rem; margin: 0.2rem 0 0.9rem; }
.ed-check { display: flex; align-items: center; gap: 0.6rem; min-height: 44px; font-weight: 700; cursor: pointer; }
.ed-check input { width: 22px; height: 22px; accent-color: var(--accent); margin: 0; }

/* Camadas */
.ed-layer-list, .ed-palette, .ed-proj-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.4rem; }
.ed-layer-row { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 0.35rem; }
.ed-layer-pick { display: flex; align-items: center; gap: 0.6rem; min-width: 0; min-height: 44px; padding: 0 0.7rem; font: inherit; text-align: left; color: var(--ink); background: var(--paper); border: 2px solid var(--line-2); border-radius: var(--radius); cursor: pointer; }
.ed-layer-pick:hover { border-color: var(--ink-2); }
.ed-layer-row.is-selected .ed-layer-pick { background: var(--accent-soft); border-color: var(--accent); font-weight: 700; }
.ed-layer-pos { flex: none; min-width: 1.6em; padding: 0.05em 0.35em; text-align: center; font-size: 0.85rem; font-weight: 700; color: var(--paper); background: var(--ink-2); border-radius: 999px; }
.ed-layer-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Paleta */
.ed-swatch { display: grid; grid-template-columns: 3.5rem minmax(0, 1fr) auto; align-items: center; gap: 0.7rem; }
.ed-swatch .ed-btn { min-width: 5.5rem; }
.ed-chip { display: block; height: 44px; border: 2px solid var(--ink); border-radius: var(--radius); }
.ed-hex { font-family: "Space Mono", ui-monospace, monospace; font-size: 1rem; background: transparent; color: var(--ink); user-select: all; -webkit-user-select: all; }
.ed-codes { overflow-wrap: anywhere; margin: 1rem 0 0.6rem; }
.ed-codes code { font-family: "Space Mono", ui-monospace, monospace; font-size: 0.92rem; user-select: all; -webkit-user-select: all; }

/* Projetos */
.ed-proj { display: grid; grid-template-columns: 56px minmax(0, 1fr); gap: 0.4rem 0.8rem; padding: 0.6rem; background: var(--paper); border: 1px solid var(--line-2); border-radius: var(--radius); }
.ed-proj.is-current { border: 2px solid var(--accent); background: var(--accent-soft); }
.ed-proj-thumb { width: 56px; height: 56px; object-fit: cover; background: var(--paper-lo); border: 1px solid var(--line-2); border-radius: var(--radius); }
.ed-proj-thumb-empty { display: block; background: repeating-linear-gradient(45deg, var(--paper-lo), var(--paper-lo) 6px, var(--line) 6px, var(--line) 12px); }
.ed-proj-info { min-width: 0; }
.ed-proj-name { margin: 0; font-weight: 700; overflow-wrap: anywhere; line-height: 1.3; }
.ed-proj-meta { margin: 0.1rem 0 0; font-size: 0.88rem; color: var(--ink-2); }
.ed-proj-actions { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 0.4rem; }

/* Barra de status */
.ed-statusbar { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 0.5rem 1rem; padding: 0.55rem 0.9rem; background: var(--paper-hi); border: 1px solid var(--line-2); border-radius: var(--radius); color: var(--ink-2); font-size: 0.97rem; }
.ed-statusbar p { margin: 0; }
.ed-status { min-height: 1.5em; color: var(--ink); }

/* Caixas de diálogo */
.ed-dialog { width: min(92vw, 30rem); padding: 0; color: var(--ink); background: var(--paper-hi); border: 2px solid var(--ink); border-radius: var(--radius); }
.ed-dialog::backdrop { background: rgba(27, 31, 42, 0.55); }
.ed-dialog-form { display: grid; gap: 1rem; padding: 1.25rem; margin: 0; }
.ed-dialog-form h2 { font-size: 1.4rem; margin: 0; }
.ed-dialog-form p { margin: 0; }
.ed-dialog-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 0.6rem; }

/* Texto abaixo do app */
.ed-doc { padding-bottom: 4rem; }
.ed-sec { margin-block: 2.5rem 0; }
.ed-sec > p, .ed-steps, .ed-limits, .ed-sec .prose { max-width: 72ch; }
.ed-steps, .ed-limits { padding-left: 1.4em; }
.ed-steps li, .ed-limits li { margin-bottom: 0.8em; }
.ed-sec .card-grid { margin-top: 1rem; }
.ed-sec .table-wrap { max-width: 60rem; }
.ed-doc code { font-family: "Space Mono", ui-monospace, monospace; font-size: 0.92em; background: var(--paper-lo); padding: 0.1em 0.35em; border-radius: 2px; }

/* Celular e telas estreitas: o painel vira uma gaveta embaixo */
@media (max-width: 899px) {
  .ed-workspace { grid-template-columns: minmax(0, 1fr); }
  .ed-stage { height: auto; min-height: 0; padding: 0.7rem; }
  .ed-head { padding-block: 0.2rem 0.7rem; }
  .ed-head h1 { font-size: 1.7rem; }
  .ed-lead { font-size: 0.97rem; }
  .ed-privacy { padding: 0.45rem 0.75rem; font-size: 0.95rem; max-width: none; }
  .ed-field-name { flex-basis: 100%; max-width: none; }
  .ed-field-format { flex: 0 0 10.5rem; }
  .ed-save { flex: 1 1 7rem; margin: 0 0 0.5rem 0; font-size: 0.95rem; line-height: 1.3; }
  .ed-toolbar { flex-wrap: nowrap; overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: thin; }
  .ed-group { flex: none; flex-wrap: nowrap; }
  .ed-panel { position: sticky; bottom: 0; z-index: 20; height: auto; min-height: 0; box-shadow: 0 -3px 0 var(--line-2); }
  .ed-panel-body { display: none; max-height: 52vh; }
  .ed-panel[data-open="true"] .ed-panel-body { display: block; }
  .ed-sheet-toggle { display: inline-flex; }
  .ed-sheet-toggle .ed-ico { transition: transform 0.15s; }
  .ed-panel[data-open="true"] .ed-sheet-toggle .ed-ico { transform: rotate(180deg); }
  .ed-tabs [role="tab"] { font-size: 0.85rem; }
}

/* Impressão e PDF: só o quadro, na proporção do formato (@page é definido pelo editor) */
@media print {
  html, body { background: #fff !important; height: auto !important; }
  .page-editor main > * { display: none !important; }
  .page-editor main > .ed-shell { display: block !important; padding: 0 !important; max-width: none !important; }
  .page-editor .ed-shell > * { display: none !important; }
  .page-editor .ed-shell > .ed-app { display: block !important; padding: 0 !important; }
  .page-editor .ed-app > * { display: none !important; }
  .page-editor .ed-app > .ed-workspace { display: block !important; }
  .page-editor .ed-workspace > * { display: none !important; }
  .page-editor .ed-workspace > .ed-stage { display: block !important; height: auto !important; min-height: 0 !important; overflow: visible !important; padding: 0 !important; border: 0 !important; background: none !important; }
  .page-editor .ed-board-wrap { position: relative !important; width: calc(var(--ed-print-w, 700) * 1px) !important; height: calc(var(--ed-print-h, 700) * 1px) !important; margin: 0 !important; }
  .page-editor .ed-artboard { position: absolute !important; left: 0 !important; top: 0 !important; transform: none !important; zoom: var(--ed-print-scale, 0.7) !important; break-inside: avoid; box-shadow: none !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .page-editor .ed-grid, .page-editor .ed-sel, .page-editor .ed-empty { display: none !important; }
}
