/* NWD para IFC
   A página é uma prancha: campo de desenho à esquerda, carimbo à direita.
   Uma tinta só (cópia heliográfica); a cor só aparece nas peças já convertidas. */

@font-face {
  font-family: "Miriam Libre";
  src: url("../assets/fonts/miriam-libre-regular.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Miriam Libre";
  src: url("../assets/fonts/miriam-libre-bold.woff2") format("woff2");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}
/* Só os algarismos, todos com o mesmo avanço, para números que mudam sem tremer. */
@font-face {
  font-family: "NWDIFC Figures";
  src: url("../assets/fonts/figures-regular.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
  unicode-range: U+30-39;
}
@font-face {
  font-family: "NWDIFC Figures";
  src: url("../assets/fonts/figures-bold.woff2") format("woff2");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
  unicode-range: U+30-39;
}

:root {
  --papel: #E6E8F0;      /* a mesa */
  --folha: #F9FAFD;      /* a prancha */
  --tinta: #1F2163;      /* traço, texto, ação */
  --tinta-viva: #2D3090; /* a tinta sob o cursor */
  --suave: #575B8F;      /* texto secundário */
  --linha: #C5C8DC;      /* traço fino */
  --revisao: #C2321C;    /* erro: caneta de revisão */

  /* uma cor por objeto: só nas peças convertidas */
  --est: #B9BED0;
  --ar: #5C86E6;
  --inc: #E2553D;
  --agu: #2FA58B;
  --ele: #EFB13B;
  --eqp: #8D74DA;

  --fonte: "Miriam Libre", Bahnschrift, "DIN Alternate", "Segoe UI", system-ui, sans-serif;
  --algarismos: "NWDIFC Figures", var(--fonte);

  --t-min: 0.8125rem;   /* 13 */
  --t-base: 1.0625rem;  /* 17 */
  --t-dado: 1.25rem;    /* 20 */
  --t-h2: 1.5rem;       /* 24 */

  --traco: 1.5px;
  --borda: clamp(10px, 2.2vw, 28px);
  --dentro: clamp(16px, 1.7vw, 24px);

  --sai: cubic-bezier(0.2, 0, 0, 1);

  color-scheme: light;
}

*,
*::before,
*::after { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  background: var(--papel);
}

body {
  margin: 0;
  background: var(--papel);
  color: var(--tinta);
  font-family: var(--fonte);
  font-size: var(--t-base);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

h1, h2, h3, p, ul, ol, dl, dd, figure { margin: 0; }
ul, ol { padding: 0; list-style: none; }
h1, h2, h3 { text-wrap: balance; }
p, li, dd { text-wrap: pretty; }
strong { font-weight: 700; }

[hidden] { display: none !important; }

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

.num {
  font-family: var(--algarismos);
  font-variant-numeric: tabular-nums;
  font-kerning: none;
}

:focus-visible {
  outline: 3px solid var(--tinta);
  outline-offset: 3px;
}

::selection { background: var(--tinta); color: var(--folha); }

/* ---------- topo: o nome do site e as ferramentas que ele tem ---------- */

.top {
  max-width: 1320px;
  margin-inline: auto;
  padding: calc(var(--borda) * 0.75) var(--borda) 0;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem 2rem;
  flex-wrap: wrap;
}
.top__name {
  font-size: var(--t-dado);
  font-weight: 700;
  line-height: 1.2;
  color: var(--tinta);
  text-decoration: none;
}
.top__nav { display: flex; gap: 1.5rem; font-size: var(--t-min); }
.top__nav a {
  color: var(--tinta);
  font-weight: 700;
  text-decoration: none;
  padding-block: 0.35rem;
  border-bottom: var(--traco) solid var(--tinta);
}
.top__name:hover, .top__nav a:hover { color: var(--tinta-viva); }

/* ---------- página ---------- */

.page {
  max-width: 1320px;
  margin-inline: auto;
  padding: var(--borda) var(--borda) 0;
}

/* ---------- a prancha ---------- */

.sheet {
  position: relative;
  background: var(--folha);
  padding: clamp(5px, 0.9vw, 11px);
  box-shadow:
    0 0 0 1px rgb(31 33 99 / 0.07),
    0 1px 2px rgb(31 33 99 / 0.06),
    0 18px 40px -22px rgb(31 33 99 / 0.28);
}

.sheet__frame {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-areas: "title" "field" "panels";
  border: var(--traco) solid var(--tinta);
}

.title { grid-area: title; padding: var(--dentro); }
.field { grid-area: field; }
.panels { grid-area: panels; }

/* tela estreita: parado, o botão vem antes do desenho; com um arquivo, o desenho sobe e encolhe */
@media (max-width: 59.99em) {
  .sheet[data-view="idle"] .sheet__frame { grid-template-areas: "title" "panels" "field"; }
  .sheet:not([data-view="idle"]) .figure { max-height: 24vh; }
  .sheet[data-view="error"] .field { display: none; }
  .panel[data-panel="ready"] .cell--actions { order: 1; }
  .panel[data-panel="ready"] .facts { order: 2; }
}

@media (min-width: 60em) {
  .sheet__frame {
    grid-template-columns: minmax(0, 1fr) clamp(22.5rem, 34%, 27rem);
    grid-template-rows: auto 1fr;
    grid-template-areas: "field title" "field panels";
    min-height: min(44rem, calc(100svh - 2 * var(--borda) - 4.5rem));
  }
  .title,
  .panels { border-left: var(--traco) solid var(--tinta); }
}

/* ---------- título no carimbo ---------- */

.brand {
  display: flex;
  align-items: center;
  gap: 0.5em;
  font-size: var(--t-base);
  font-weight: 700;
  line-height: 1.2;
}
.brand__mark { width: 1.1em; height: 1.1em; flex: none; }
.brand__frame { fill: none; stroke: currentColor; stroke-width: 2.5; }
.brand__block { fill: currentColor; }

.title h1 {
  margin-top: 0.7em;
  font-size: clamp(1.75rem, 0.9rem + 1.35vw, 2.125rem);
  font-weight: 700;
  line-height: 1.08;
  letter-spacing: -0.012em;
}

.lead {
  margin-top: 0.85em;
  color: var(--suave);
  max-width: 34em;
}
/* com um arquivo em mãos o carimbo vira instrumento: o título sai da vista, não da página */
.sheet:not([data-view="idle"]) .lead { display: none; }
.sheet:not([data-view="idle"]) .title h1 {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

/* ---------- campo de desenho ---------- */

.field {
  position: relative;
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  align-items: center;
  justify-items: center;
  padding: 1rem 1rem 0.75rem;
  border-top: 1px solid var(--tinta);
  background: var(--folha);
  transition: background-color 0.25s var(--sai);
}
@media (min-width: 60em) {
  .field { border-top: 0; padding: var(--dentro); min-height: 28rem; }
}

.figure {
  display: block;
  width: min(100%, 44rem);
  max-height: 38vh;
  height: auto;
  overflow: visible;
  transition: opacity 0.25s var(--sai);
}
@media (min-width: 60em) {
  .figure { max-height: min(34rem, 100%); }
}

.pc path {
  fill: var(--folha);
  stroke: var(--tinta);
  stroke-width: 1.1;
  stroke-linejoin: round;
  vector-effect: non-scaling-stroke;
  transition: fill 0.25s var(--sai), stroke 0.25s var(--sai);
}
.pc.est { --c: var(--est); }
.pc.ar { --c: var(--ar); }
.pc.inc { --c: var(--inc); }
.pc.agu { --c: var(--agu); }
.pc.ele { --c: var(--ele); }
.pc.eqp { --c: var(--eqp); }
.pc.is-on .l { fill: var(--c); }
.pc.is-on .t { fill: var(--c); fill: color-mix(in oklab, var(--c), #fff 34%); }
.pc.is-on .r { fill: var(--c); fill: color-mix(in oklab, var(--c), #1F2163 20%); }

.dim {
  fill: none;
  stroke: var(--tinta);
  stroke-width: 1;
  vector-effect: non-scaling-stroke;
  transition: stroke 0.25s var(--sai);
}
.dot { fill: var(--tinta); transition: fill 0.25s var(--sai); }
.dim__txt {
  fill: var(--tinta);
  font-family: var(--fonte);
  font-size: 12.5px;
  font-weight: 700;
  transition: fill 0.25s var(--sai);
}

.field__caption {
  justify-self: start;
  margin-top: 0.75rem;
  font-size: var(--t-min);
  color: var(--suave);
  transition: color 0.25s var(--sai);
}

.field__drop {
  position: absolute;
  inset: var(--dentro) auto auto var(--dentro);
  font-size: clamp(1.75rem, 1rem + 2vw, 2.75rem);
  font-weight: 700;
  line-height: 1.05;
  color: var(--folha);
  opacity: 0;
  transform: translateY(6px);
  transition: opacity 0.18s var(--sai), transform 0.18s var(--sai);
  pointer-events: none;
}

/* arrastando um arquivo: a folha vira o negativo */
.sheet[data-drop] .field { background: var(--tinta); }
.sheet[data-drop] .pc path { fill: var(--tinta); stroke: var(--folha); }
.sheet[data-drop] .dim { stroke: var(--folha); }
.sheet[data-drop] .dot,
.sheet[data-drop] .dim__txt { fill: var(--folha); }
.sheet[data-drop] .field__caption { color: transparent; }
.sheet[data-drop] .field__drop { opacity: 1; transform: none; }

/* erro: o desenho recua */
.sheet[data-view="error"] .figure { opacity: 0.4; }

/* ---------- o modelo convertido no campo de desenho ---------- */

.viewer {
  position: relative;
  place-self: stretch;
  min-width: 0;
  height: clamp(15rem, 40svh, 26rem);
  animation: surgir 0.3s ease-out;
}
@keyframes surgir { from { opacity: 0; } }
.sheet[data-viewer] .field { padding: 0; }
.sheet[data-viewer] .figure,
.sheet[data-viewer] .field__caption { display: none; }
.sheet[data-drop] .viewer { visibility: hidden; }
@media (min-width: 60em) {
  .viewer { height: auto; min-height: 20rem; }
  .sheet[data-viewer] .sheet__frame { min-height: min(52rem, calc(100svh - 2 * var(--borda))); }
}

.viewer canvas {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  cursor: grab;
  touch-action: none;
  outline-offset: -3px;
}
.viewer canvas[data-over] { cursor: pointer; }
.viewer canvas[data-dragging] { cursor: grabbing; }
/* no toque, arrastar para cima e para baixo continua rolando a página até a pessoa pedir "Explorar" */
@media (pointer: coarse) {
  .viewer canvas:not([data-explore]) { touch-action: pan-y; }
}

/* mira no centro: com o teclado, Enter escolhe a peça que está sob ela */
.viewer__mark {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 1.0625rem;
  height: 1.0625rem;
  translate: -50% -50%;
  /* tinta por cima de um fio de papel, para aparecer sobre qualquer cor do modelo */
  background:
    linear-gradient(var(--tinta), var(--tinta)) center / 100% 1.5px no-repeat,
    linear-gradient(var(--tinta), var(--tinta)) center / 1.5px 100% no-repeat,
    linear-gradient(var(--folha), var(--folha)) center / 100% 4.5px no-repeat,
    linear-gradient(var(--folha), var(--folha)) center / 4.5px 100% no-repeat;
  opacity: 0;
  pointer-events: none;
}
.viewer canvas:focus-visible ~ .viewer__mark { opacity: 1; }

.viewer__hint {
  position: absolute;
  left: 0.75rem;
  bottom: 0.75rem;
  max-width: min(24rem, calc(100% - 1.5rem));
  padding: 0.4rem 0.6rem;
  border: 1px solid var(--linha);
  background: var(--folha);
  font-size: var(--t-min);
  line-height: 1.4;
  color: var(--suave);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease-out;
}
.viewer[data-hint] .viewer__hint { opacity: 1; }

/* as ações da vista são células coladas, como as do carimbo */
.viewer__tools {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  display: flex;
  gap: 1px;
  border: 1px solid var(--tinta);
  background: var(--tinta);
}
.tool {
  position: relative;
  display: inline-flex;
  align-items: center;
  min-height: 2.5rem;
  padding: 0 0.8rem;
  border: 0;
  border-radius: 0;
  background: var(--folha);
  color: var(--tinta);
  font: inherit;
  font-size: var(--t-min);
  font-weight: 700;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  transition-property: background-color, color, scale;
  transition-duration: 0.15s;
  transition-timing-function: ease-out;
}
.tool:active { scale: 0.96; }
.tool:focus-visible { z-index: 1; }
.tool[aria-pressed="true"] { background: var(--tinta); color: var(--folha); }
/* duas células ligadas lado a lado continuam duas: um fio de papel entre elas */
.tool[aria-pressed="true"] + .tool[aria-pressed="true"] { box-shadow: -1px 0 0 var(--folha); }
@media (hover: hover) {
  .tool:hover { background: var(--tinta); color: var(--folha); }
  .tool[aria-pressed="true"]:hover { background: var(--tinta-viva); }
}
.tool--touch { display: none; }
@media (pointer: coarse) {
  .tool { min-height: 2.75rem; }
  .tool--touch { display: inline-flex; }
}
@media (max-width: 24em) {
  .tool { padding-inline: 0.6rem; }
}

/* caixa de corte: um <svg> sobre o modelo. Arestas em traço e ponto, como a linha de corte de um
   desenho; as do fundo, mais leves. Em cada face, uma alça quadrada sobre um trecho do seu eixo. */
.cut {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  overflow: hidden;
  pointer-events: none;
}
.cut__edges {
  fill: none;
  stroke: var(--tinta);
  stroke-width: 1.25;
  stroke-dasharray: 14 4 2 4;
}
.cut__edges--far { opacity: 0.38; }
.cut__face {
  fill: var(--tinta);
  fill-opacity: 0.08;
  stroke: var(--tinta);
  stroke-width: 1.5;
  stroke-linejoin: round;
}
.cut__grip {
  pointer-events: all;
  cursor: ns-resize;
  outline: none;
  touch-action: none;
}
.cut__grip[data-dir="ew"] { cursor: ew-resize; }
.cut__grip[data-dir="nwse"] { cursor: nwse-resize; }
.cut__grip[data-dir="nesw"] { cursor: nesw-resize; }
.cut__hit { fill: transparent; }
.cut__stem { stroke: var(--tinta); stroke-width: 1.5; }
.cut__halo { fill: var(--folha); }
.cut__knob {
  fill: var(--folha);
  stroke: var(--tinta);
  stroke-width: 1.5;
  transition: fill 0.12s ease-out;
}
.cut__ring { fill: none; stroke: var(--tinta); stroke-width: 3; opacity: 0; }
.cut__grip:focus-visible .cut__ring { opacity: 1; }
.cut__grip[data-active] .cut__knob,
.cut__grip:focus-visible .cut__knob { fill: var(--tinta); }
@media (hover: hover) {
  .cut__grip:hover .cut__knob { fill: var(--tinta); }
}
/* face voltada para o fundo: a alça continua lá, mais discreta */
.cut__grip[data-far]:not([data-active]):not(:focus-visible) { opacity: 0.5; }
/* eixo quase de frente para quem olha: sem arrasto; a alça só aparece com o foco do teclado */
.cut .cut__grip[data-grazing] { pointer-events: none; }
.cut .cut__grip[data-grazing]:not(:focus-visible) { opacity: 0; }
/* cota da face em movimento */
.cut__label {
  fill: var(--tinta);
  stroke: var(--folha);
  stroke-width: 4px;
  stroke-linejoin: round;
  paint-order: stroke;
  font-family: var(--algarismos);
  font-size: var(--t-min);
  font-weight: 700;
  font-kerning: none;
}
/* no toque, as alças só respondem depois de "Explorar", como o resto dos gestos */
@media (pointer: coarse) {
  .viewer canvas:not([data-explore]) ~ .cut .cut__grip { pointer-events: none; opacity: 0.45; }
}

/* legenda da vista, no lugar de "Figura ilustrativa" */
.strip {
  place-self: stretch;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 1px;
  background: var(--tinta);
  border-top: 1px solid var(--tinta);
}
.strip__cell {
  min-width: 0;
  padding: 0.6rem 1rem 0.65rem;
  background: var(--folha);
}
.strip dt { font-size: var(--t-min); line-height: 1.3; color: var(--suave); }
.strip dd { margin-top: 0.1rem; font-weight: 700; line-height: 1.3; }
/* "Restaurar caixa" mora junto do tamanho da caixa, sem aumentar a altura da célula */
.strip dd:has(.strip__action) { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0 0.9rem; }
.strip .strip__action {
  position: relative;
  min-height: 0;
  padding: 0;
  font-size: var(--t-min);
  line-height: inherit;
}
.strip .strip__action::after { content: ""; position: absolute; inset: -0.85rem -0.5rem; }
@media (min-width: 60em) {
  .strip__cell { padding-inline: var(--dentro); }
}
/* tela estreita: uma célula só. O nome do arquivo já está logo abaixo, em "IFC pronto". */
@media (max-width: 30em) {
  .strip { grid-template-columns: minmax(0, 1fr); gap: 0; background: var(--folha); }
  .strip__cell:first-child { padding-bottom: 0; }
  .strip__cell:first-child dd { display: none; }
  .strip__cell:last-child { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0 0.5rem; padding-top: 0.1rem; }
  .strip__cell:last-child dd { margin-top: 0; font-size: 0.9375rem; }
}

/* ---------- carimbo: painéis e células ---------- */

.panels { display: flex; flex-direction: column; min-width: 0; }
.panel { display: flex; flex-direction: column; flex: 1; min-width: 0; }

.cell {
  padding: 0.9rem var(--dentro);
  border-top: 1px solid var(--tinta);
  min-width: 0;
}
.cell--grow { flex: 1; }
.cell__k,
.facts dt {
  font-size: var(--t-min);
  line-height: 1.3;
  color: var(--suave);
}

.facts {
  display: grid;
  gap: 1px;
  background: var(--tinta);
  border-top: 1px solid var(--tinta);
}
.facts--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.facts--2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.facts > .cell {
  border: 0;
  background: var(--folha);
  padding: 0.7rem 0.75rem 0.75rem var(--dentro);
}
.facts dd {
  margin-top: 0.15rem;
  font-weight: 700;
  line-height: 1.25;
}
.facts--2 dd { font-size: var(--t-dado); line-height: 1.2; }
.facts[data-pending] dd small { visibility: hidden; }
.facts dd small {
  display: block;
  margin-top: 0.1rem;
  font-size: var(--t-min);
  font-weight: 400;
  line-height: 1.3;
  color: var(--suave);
}
@media (max-width: 26em) {
  .facts--3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* ---------- botões ---------- */

.btn {
  font: inherit;
  color: inherit;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

.btn--primary {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 3.5rem;
  padding: 0.75rem 1.25rem;
  border: 0;
  border-radius: 0;
  background: var(--tinta);
  color: var(--folha);
  font-weight: 700;
  text-align: center;
  user-select: none;
  transition-property: background-color, scale;
  transition-duration: 0.15s;
  transition-timing-function: ease-out;
}
.btn--primary:active:not([disabled]) { scale: 0.96; }
.btn--primary[disabled] { cursor: default; background: var(--suave); }
@media (hover: hover) {
  .btn--primary:hover:not([disabled]) { background: var(--tinta-viva); }
}

.btn--quiet {
  display: inline-flex;
  align-items: center;
  min-height: 2.75rem;
  padding: 0.25rem 0;
  border: 0;
  background: none;
  font-weight: 700;
  text-decoration: underline;
  text-decoration-thickness: 1.5px;
  text-underline-offset: 0.28em;
  text-decoration-color: var(--tinta);
  transition: color 0.15s ease-out, text-decoration-color 0.15s ease-out;
}
.btn--quiet[disabled] { color: var(--suave); cursor: default; text-decoration: none; }
@media (hover: hover) {
  .btn--quiet:hover:not([disabled]) { color: var(--tinta-viva); text-decoration-color: var(--linha); }
}

/* ---------- parado: escolher o arquivo ---------- */

.pick {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding-block: var(--dentro);
}
.pick__input {
  position: absolute;
  inset: var(--dentro) var(--dentro) auto;
  width: calc(100% - 2 * var(--dentro));
  height: 3.5rem;
  margin: 0;
  opacity: 0;
  pointer-events: none;
}
.pick__input:focus-visible + .btn--primary {
  outline: 3px solid var(--tinta);
  outline-offset: 3px;
}

.hint {
  margin-top: 0.8rem;
  font-size: var(--t-min);
  line-height: 1.45;
  color: var(--suave);
}
/* soltar um arquivo só faz sentido com mouse */
.hint--drop { display: none; }
@media (hover: hover) and (pointer: fine) {
  .hint--drop { display: block; }
  .hint--drop + .hint { margin-top: 0.25rem; }
}

.alert {
  font-size: 0.9375rem;
  line-height: 1.45;
}
.alert:not(:empty) {
  margin-top: 0.8rem;
  padding-left: 0.75rem;
  border-left: 3px solid var(--revisao);
}

/* ---------- em andamento ---------- */

.file {
  display: flex;
  align-items: baseline;
  gap: 0.75rem;
  margin-top: 0.15rem;
  font-weight: 700;
  line-height: 1.3;
}
.file__name { display: flex; min-width: 0; }
.file__stem {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.file__ext { flex: none; white-space: nowrap; }
.file__size { flex: none; margin-left: auto; font-weight: 400; color: var(--suave); }
.result__now:focus-visible,
.stage__now:focus-visible,
.error__title:focus-visible,
.confirm__q:focus-visible { outline-offset: 4px; }

.stage { display: flex; flex-direction: column; justify-content: center; padding-block: 1.1rem 1.25rem; }

.steps {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 0.9rem;
  font-size: var(--t-min);
  line-height: 1.3;
  color: var(--suave);
}
.steps li { display: flex; align-items: center; gap: 0.4em; }
.steps li::before {
  content: "";
  width: 0.5rem;
  height: 0.5rem;
  border: 1px solid currentColor;
  flex: none;
}
.steps li[data-done]::before { background: currentColor; }
.steps li[aria-current] { color: var(--tinta); font-weight: 700; }
.steps li[aria-current]::before { background: var(--tinta); }
@media (max-width: 26em) {
  .steps { gap: 0.25rem 0.6rem; font-size: 0.75rem; }
}

.stage__now {
  margin-top: 0.9rem;
  font-size: var(--t-h2);
  font-weight: 700;
  line-height: 1.15;
}
.stage__sub strong { color: var(--tinta); }
.stage__sub {
  margin-top: 0.3rem;
  min-height: 2.9em;
  font-size: 0.9375rem;
  line-height: 1.45;
  color: var(--suave);
}

/* a barra é uma linha de cota: traço fino entre dois limites, traço grosso no que já foi */
.cota {
  position: relative;
  height: 13px;
  margin-top: 0.85rem;
  overflow: hidden;
  background:
    linear-gradient(var(--tinta), var(--tinta)) left center / 1px 100% no-repeat,
    linear-gradient(var(--tinta), var(--tinta)) right center / 1px 100% no-repeat,
    linear-gradient(var(--tinta), var(--tinta)) center / 100% 1px no-repeat;
}
.cota progress {
  position: absolute;
  inset: 4px 0 auto;
  display: block;
  width: 100%;
  height: 5px;
  border: 0;
  background: transparent;
  color: var(--tinta);
  -webkit-appearance: none;
  appearance: none;
}
.cota progress::-webkit-progress-bar { background: transparent; }
.cota progress::-webkit-progress-value { background: var(--tinta); transition: width 0.2s linear; }
.cota progress::-moz-progress-bar { background: var(--tinta); }
.cota[data-mode="wait"] progress::-webkit-progress-value { background: transparent; }
.cota[data-mode="wait"] progress::-moz-progress-bar { background: transparent; }
.cota[data-mode="wait"]::after {
  content: "";
  position: absolute;
  inset: 4px auto auto 0;
  width: 24%;
  height: 5px;
  background: var(--tinta);
  animation: vaivem 1.5s ease-in-out infinite alternate;
}
@keyframes vaivem {
  from { transform: translateX(0); }
  to { transform: translateX(316.67%); }
}

.cell--actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.25rem 1.5rem;
  padding-block: 0.6rem;
}
.cell--actions .btn--primary { margin-block: 0.3rem; }

/* ---------- pronto ---------- */

.result { display: flex; flex-direction: column; justify-content: center; padding-block: 1.1rem 1.25rem; }
.result__now {
  font-size: clamp(1.75rem, 0.9rem + 1.35vw, 2.125rem);
  font-weight: 700;
  line-height: 1.08;
  letter-spacing: -0.012em;
}
.result .file { margin-top: 0.6rem; }
.result__counts {
  display: none;
  margin-top: 0.35rem;
  font-size: var(--t-min);
  line-height: 1.45;
  color: var(--suave);
}

/* com a pré-visualização, o carimbo abre espaço para os dados da peça */
.panel[data-preview] .result { flex: none; padding-block: 0.9rem 1rem; }
.panel[data-preview] .result__now { font-size: var(--t-h2); line-height: 1.15; letter-spacing: 0; }
.panel[data-preview] .result__counts { display: block; }
.panel[data-preview] .facts { display: none; }

/* ---------- peça selecionada ---------- */

.piece {
  display: flex;
  flex-direction: column;
  padding: 0;
}
.piece__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-height: 2.75rem;
  padding: 0.35rem var(--dentro) 0;
}
.piece__head h2 { font-weight: 400; }
.btn--small { min-height: 2.5rem; font-size: var(--t-min); }
@media (pointer: coarse) {
  .btn--small { min-height: 2.75rem; }
}
.piece__body {
  padding: 0 var(--dentro) 1rem;
  max-height: 65svh;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--linha) transparent;
}
.piece__body:focus-visible { outline-offset: -3px; }
.piece__empty { color: var(--suave); font-size: 0.9375rem; line-height: 1.45; }
.piece__name {
  font-size: var(--t-dado);
  font-weight: 700;
  line-height: 1.2;
  overflow-wrap: anywhere;
}
.piece__tools {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.25rem 1rem;
  margin-top: 0.35rem;
}
.piece__filter {
  flex: 1 1 11rem;
  min-width: 0;
  min-height: 2.5rem;
  padding: 0.3rem 0.6rem;
  border: 1px solid var(--tinta);
  border-radius: 0;
  background: var(--folha);
  color: var(--tinta);
  font: inherit;
  font-size: 0.9375rem;
  -webkit-appearance: none;
  appearance: none;
}
.piece__filter::placeholder { color: var(--suave); opacity: 1; }
.piece__count {
  margin-top: 0.5rem;
  font-size: var(--t-min);
  line-height: 1.4;
  color: var(--suave);
}
.piece__count:empty { display: none; }

/* um quadro por categoria: título, depois linhas de nome e valor */
.props { margin-top: 0.5rem; }
.props__group { margin-top: 0.9rem; }
.props__group .props { margin-top: 0; }
.props__title {
  position: sticky;
  top: 0;
  padding: 0.35rem 0 0.3rem;
  border-bottom: 1px solid var(--tinta);
  background: var(--folha);
  font-size: var(--t-min);
  font-weight: 700;
  line-height: 1.3;
}
.prop {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(0, 3fr);
  gap: 0.75rem;
  padding: 0.3rem 0;
  border-bottom: 1px solid var(--linha);
}
.prop dt {
  font-size: var(--t-min);
  line-height: 1.4;
  color: var(--suave);
  overflow-wrap: anywhere;
}
.prop dd {
  font-size: 0.9375rem;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

/* tela estreita: sem peça escolhida o painel fica depois de "Salvar IFC"; com uma, sobe para junto do modelo */
@media (max-width: 59.99em) {
  .panel[data-panel="ready"] .piece { order: 3; }
  .panel[data-panel="ready"][data-selected] .piece { order: -1; }
  .panel[data-selected] .piece__body { max-height: 46svh; }
}
@media (min-width: 60em) {
  /* no carimbo, o painel ocupa o que sobra e rola por dentro: a página não se mexe */
  .piece { flex: 1 1 0; min-height: 13rem; overflow: hidden; }
  .piece__body { flex: 1 1 0; max-height: none; overscroll-behavior: contain; }
}

.note {
  margin-top: 0.8rem;
  padding-left: 0.75rem;
  border-left: 3px solid var(--tinta);
  font-size: 0.9375rem;
  line-height: 1.45;
}

.save {
  flex-basis: 100%;
  font-size: 0.9375rem;
  line-height: 1.45;
}
.save:empty { display: none; }
.save[data-tone="erro"] { color: var(--revisao); font-weight: 700; }
.cota--save { flex-basis: 100%; margin-top: 0.4rem; }

.confirm {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0 1.5rem;
  flex-basis: 100%;
}
.confirm__q { flex-basis: 100%; margin-top: 0.4rem; font-size: 0.9375rem; line-height: 1.45; }

/* ---------- erro ---------- */

.error { display: flex; flex-direction: column; justify-content: center; padding-block: 1.25rem; }
.error__mark {
  width: 1.75rem;
  height: 1.75rem;
  fill: none;
  stroke: var(--revisao);
  stroke-width: 2;
  stroke-linejoin: round;
  stroke-linecap: round;
}
.error__title {
  margin-top: 0.6rem;
  font-size: var(--t-dado);
  font-weight: 700;
  line-height: 1.2;
}
.error__text { margin-top: 0.6rem; max-width: 34em; }

/* ---------- notas abaixo da prancha ---------- */

.notes { margin-top: clamp(2.5rem, 6vw, 5rem); }

.row {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 1.1rem;
  padding-block: clamp(1.75rem, 4vw, 2.75rem);
  border-top: 1px solid var(--tinta);
}
@media (min-width: 60em) {
  .row { grid-template-columns: minmax(0, 4fr) minmax(0, 8fr); gap: 2.5rem; }
}

.row h2 {
  font-size: var(--t-h2);
  font-weight: 700;
  line-height: 1.15;
  max-width: 16ch;
}

.row__body { max-width: 40rem; }
.row__body > p + p { margin-top: 0.9em; }

.list li {
  position: relative;
  padding-left: 1.6rem;
}
.list li + li { margin-top: 0.7em; }
.list li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.52em;
  width: 0.6rem;
  height: 0.6rem;
  border: 1.5px solid var(--tinta);
}
.list--in li::before { background: var(--tinta); }

.aside {
  margin-top: 1.4rem;
  padding-top: 1rem;
  border-top: 1px solid var(--linha);
  color: var(--suave);
  max-width: 40rem;
}

/* perguntas */
.faq { margin-top: -0.95rem; }
.faq details { border-top: 1px solid var(--linha); }
.faq details:first-child { border-top: 0; }
.faq summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding-block: 0.95rem;
  font-weight: 700;
  line-height: 1.3;
  cursor: pointer;
  list-style: none;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after {
  content: "";
  flex: none;
  width: 0.8125rem;
  height: 0.8125rem;
  background:
    linear-gradient(var(--tinta), var(--tinta)) center / 100% 2px no-repeat,
    linear-gradient(var(--tinta), var(--tinta)) center / 2px 100% no-repeat;
}
.faq details[open] summary::after {
  background: linear-gradient(var(--tinta), var(--tinta)) center / 100% 2px no-repeat;
}
@media (hover: hover) {
  .faq summary:hover { color: var(--tinta-viva); }
}
.faq details p { padding-bottom: 1.1rem; max-width: 36em; }

/* ---------- rodapé ---------- */

.foot {
  max-width: 1320px;
  margin-inline: auto;
  padding: 0 var(--borda) calc(var(--borda) + 0.75rem);
  font-size: var(--t-min);
  line-height: 1.5;
  color: var(--suave);
}
.foot p:first-child {
  padding-top: 1.25rem;
  border-top: 1px solid var(--tinta);
}

/* ---------- temas de alto contraste do sistema ---------- */

@media (forced-colors: active) {
  .btn--primary { border: 2px solid ButtonText; }
  .figure,
  .cota,
  .cut,
  .steps li::before,
  .list li::before,
  .faq summary::after { forced-color-adjust: none; }
}

/* ---------- movimento reduzido ---------- */

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
  .cota[data-mode="wait"]::after {
    animation: none;
    width: 100%;
    background: repeating-linear-gradient(90deg, var(--tinta) 0 6px, transparent 6px 12px);
  }
}
