/* ==== Tokens: "folha de etiquetas" — liner, etiqueta, tinta e ciano de processo ==== */
:root {
  color-scheme: light;
  --liner: #E6EBEA;      /* fundo: papel de proteção */
  --label: #FFFFFF;      /* etiqueta / superfícies */
  --label-2: #F3F6F5;
  --ink: #1A2226;        /* texto */
  --ink-2: #4A5A60;      /* texto secundário */
  --rule: #C9D2D1;       /* linhas e bordas */
  --cyan: #006894;       /* destaque (C do CMYK) */
  --on-cyan: #FFFFFF;
  --focus: #C0136F;      /* magenta de registro */
  --laser: #E3262E;
  --mark: #1A2226;
  --warn: #B45309;
  --danger: #B91C1C;
  --shadow: 0 1px 0 rgba(26,34,38,.06), 0 8px 24px -12px rgba(26,34,38,.25);
  --moon: block; --sun: none;
  --font: "Archivo", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, "Cascadia Mono", Consolas, monospace;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --liner: #142026; --label: #1C2B33; --label-2: #22333C; --ink: #E4ECEE; --ink-2: #9FB0B8;
    --rule: #33474F; --cyan: #47BDEB; --on-cyan: #032433; --focus: #FF5CB0; --mark: #9FB0B8;
    --warn: #F59E0B; --danger: #FCA5A5; --shadow: 0 8px 24px -12px rgba(0,0,0,.6); --moon: none; --sun: block;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --liner: #142026; --label: #1C2B33; --label-2: #22333C; --ink: #E4ECEE; --ink-2: #9FB0B8;
  --rule: #33474F; --cyan: #47BDEB; --on-cyan: #032433; --focus: #FF5CB0; --mark: #9FB0B8;
  --warn: #F59E0B; --danger: #FCA5A5; --shadow: 0 8px 24px -12px rgba(0,0,0,.6); --moon: none; --sun: block;
}

/* ==== Base ==== */
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 400 1.0625rem/1.55 var(--font); font-variation-settings: "wdth" 100; background: var(--liner); color: var(--ink); }
a { color: var(--cyan); text-underline-offset: 2px; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 2px; }
.wrap { max-width: 1360px; margin: 0 auto; padding: 0 16px; }
@media (min-width: 768px) { .wrap { padding: 0 32px; } }
.skip { position: absolute; left: -999px; }
.skip:focus { left: 16px; top: 8px; background: var(--label); padding: 8px 12px; z-index: 100; }
.sr { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

h1, h2, h3 { font-stretch: 72%; font-variation-settings: "wdth" 72; line-height: 1.05; letter-spacing: -.01em; text-wrap: balance; }
h1 { font-size: clamp(2.25rem, 5.2vw, 3.75rem); font-weight: 800; margin: 0 0 12px; }
h2 { font-size: clamp(1.5rem, 2.6vw, 1.875rem); font-weight: 750; margin: 0 0 12px; }
h3 { font-size: 1.125rem; font-weight: 700; margin: 0 0 8px; }
.lead { font-size: 1.1875rem; color: var(--ink-2); margin: 0; max-width: 62ch; }

/* ==== Cabeçalho ==== */
.top { background: var(--liner); border-bottom: 1px solid var(--rule); position: sticky; top: 0; z-index: 40; }
.top-inner { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 64px; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; font-weight: 800;
  font-variation-settings: "wdth" 80; font-size: 1.125rem; line-height: 1.1; }
.logo { width: 30px; height: 22px; flex: none; }
.top-nav { display: flex; align-items: center; gap: 4px; }
.top-link, .menu summary { display: flex; align-items: center; min-height: 44px; padding: 8px 12px; border-radius: 6px; color: var(--ink); text-decoration: none; font-weight: 600; cursor: pointer; }
.top-link:hover, .menu summary:hover { background: var(--label-2); }
.top-link { white-space: nowrap; }
@media (max-width: 640px) { .top-link { display: none; } }
@media (max-width: 520px) { .brand span { max-width: 9.5em; } }
.menu summary { list-style: none; }
.menu summary::-webkit-details-marker { display: none; }
.menu summary::after { content: ""; width: 7px; height: 7px; border: solid currentColor; border-width: 0 2px 2px 0; transform: translateY(-2px) rotate(45deg); margin-left: 10px; transition: transform .2s; }
.menu[open] summary::after { transform: translateY(2px) rotate(-135deg); }
.menu-panel { position: absolute; left: 0; right: 0; top: 100%; background: var(--label); border-bottom: 1px solid var(--rule); box-shadow: var(--shadow);
  padding: 24px max(16px, calc((100vw - 1296px) / 2)); display: grid; gap: 24px; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  max-height: calc(100dvh - 64px); overflow: auto; }
.menu-group h3 { font-size: 1rem; color: var(--ink-2); padding-bottom: 6px; border-bottom: 2px solid var(--cyan); margin-bottom: 6px; }
.menu-group ul { list-style: none; margin: 0; padding: 0; }
.menu-group a { display: block; padding: 6px 8px; margin: 0 -8px; border-radius: 4px; text-decoration: none; color: var(--ink); }
.menu-group a:hover { background: var(--label-2); }
.menu-group a[aria-current] { color: var(--cyan); font-weight: 700; }
/* Seletor de idioma */
.lang { position: relative; }
.lang summary { display: flex; align-items: center; gap: 6px; min-height: 44px; padding: 8px 10px; border-radius: 6px; cursor: pointer; list-style: none; font-weight: 600; color: var(--ink); }
.lang summary::-webkit-details-marker { display: none; }
.lang summary:hover { background: var(--label-2); }
.i-globe { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; }
.lang-panel { position: absolute; right: 0; top: calc(100% + 4px); z-index: 45; list-style: none; margin: 0; padding: 6px; min-width: 170px;
  background: var(--label); border: 1px solid var(--rule); border-radius: 8px; box-shadow: var(--shadow); }
.lang-panel a { display: block; padding: 8px 12px; border-radius: 4px; color: var(--ink); text-decoration: none; }
.lang-panel a:hover { background: var(--label-2); }
.lang-panel a[aria-current] { color: var(--cyan); font-weight: 700; }
.theme-btn { display: grid; place-items: center; width: 44px; height: 44px; border: 1px solid var(--rule); border-radius: 50%; background: var(--label); color: var(--ink); cursor: pointer; margin-left: 4px; }
.theme-btn:hover { border-color: var(--ink-2); }
.theme-btn svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.i-moon { display: var(--moon); fill: currentColor !important; stroke: none !important; }
.i-sun { display: var(--sun); }

/* ==== Botões e campos ==== */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; padding: 10px 22px; border: 2px solid var(--cyan); border-radius: 6px;
  background: var(--cyan); color: var(--on-cyan); font: inherit; font-weight: 700; text-decoration: none; cursor: pointer; transition: filter .15s, background-color .15s; }
.btn:hover { filter: brightness(1.12); }
.btn:active { filter: brightness(.95); }
.btn:disabled { opacity: .5; cursor: progress; }
.btn--ghost { background: transparent; color: var(--ink); border-color: var(--rule); }
.btn--ghost:hover { border-color: var(--ink-2); filter: none; }
.btn--block { width: 100%; }
select, input:not([type=checkbox]), textarea { font: inherit; color: var(--ink); background: var(--label); border: 1px solid var(--rule); border-radius: 4px; padding: 8px 10px; min-height: 44px; width: 100%; }
select:hover, input:hover, textarea:hover { border-color: var(--ink-2); }
input[type=color] { padding: 4px; cursor: pointer; }

/* ==== Anúncios: espaço reservado evita saltos ==== */
.ad { margin: 16px auto; text-align: center; min-height: 100px; }
.ad--content { min-height: 280px; margin: 32px auto; }
.ad--side { min-height: 600px; margin: 0; }
.ad--feed, .ad--article { min-height: 250px; margin: 32px auto; }
.ad-label { display: block; font-size: .75rem; color: var(--ink-2); margin-bottom: 4px; }
.ad--demo { display: flex; align-items: center; justify-content: center; border: 1px dashed var(--rule); border-radius: 6px; color: var(--ink-2); font-size: .875rem; }

/* ==== Página do gerador ==== */
.gen-page { padding-bottom: 16px; }
.crumbs { display: flex; flex-wrap: wrap; gap: 8px; font-size: .9375rem; color: var(--ink-2); margin: 8px 0 12px; }
.crumbs a { color: var(--ink-2); }
.crumbs [aria-current] { color: var(--ink); font-weight: 600; }
.page-head { margin-bottom: 24px; }

.work { display: grid; gap: 24px; grid-template-columns: minmax(0, 1fr); align-items: start; }
.side-ad { display: none; }
@media (min-width: 960px) { .work { grid-template-columns: minmax(300px, 370px) minmax(0, 1fr); } }
@media (min-width: 1360px) {
  .work { grid-template-columns: 370px minmax(0, 1fr) 300px; }
  .side-ad { display: block; position: sticky; top: 88px; }
}

.controls { background: var(--label); border: 1px solid var(--rule); border-radius: 8px; padding: 20px; display: grid; gap: 20px; }
.controls label, .controls legend { font-weight: 600; font-size: .9375rem; }
.field label { display: block; margin-bottom: 6px; }
.controls textarea { font-family: var(--mono); font-size: 1rem; resize: vertical; }
.help { margin: 6px 0 0; font-size: .875rem; color: var(--ink-2); }
fieldset { border: 0; border-top: 1px solid var(--rule); margin: 0; padding: 16px 0 0; min-width: 0; }
legend { padding: 0 8px 0 0; font-variation-settings: "wdth" 80; font-size: 1rem !important; }
.grid { display: grid; gap: 12px; grid-template-columns: repeat(2, minmax(0, 1fr)); margin-top: 8px; }
.grid label { display: flex; flex-direction: column; gap: 4px; font-weight: 500; font-size: .875rem; color: var(--ink-2); }
.checks { display: grid; gap: 4px; margin-top: 8px; }
.controls label.check { display: flex; align-items: center; gap: 10px; font-weight: 400; min-height: 40px; cursor: pointer; }
.check input { width: 20px; height: 20px; accent-color: var(--cyan); }

/* Folha de prévia com marcas de corte nos cantos */
.sheet { --c: var(--mark); position: relative; padding: 28px; min-height: 320px;
  background:
    linear-gradient(var(--c), var(--c)) 0 12px / 18px 1px, linear-gradient(var(--c), var(--c)) 12px 0 / 1px 18px,
    linear-gradient(var(--c), var(--c)) 100% 12px / 18px 1px, linear-gradient(var(--c), var(--c)) calc(100% - 12px) 0 / 1px 18px,
    linear-gradient(var(--c), var(--c)) 0 calc(100% - 12px) / 18px 1px, linear-gradient(var(--c), var(--c)) 12px 100% / 1px 18px,
    linear-gradient(var(--c), var(--c)) 100% calc(100% - 12px) / 18px 1px, linear-gradient(var(--c), var(--c)) calc(100% - 12px) 100% / 1px 18px;
  background-repeat: no-repeat; }
.sheet-head { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.sheet-head h2 { margin: 0; font-size: 1.5rem; }
.zip { display: flex; gap: 8px; flex-wrap: wrap; }
.zip select { width: auto; }
.hint { font-size: .875rem; color: var(--ink-2); margin: 16px 0 0; max-width: 70ch; }

.results { display: grid; gap: 20px; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
/* Cada resultado é uma etiqueta: sempre papel branco, nos dois temas */
.result { margin: 0; background: #fff; color: #1A2226; border-radius: 10px; padding: 20px 16px 16px; display: flex; flex-direction: column; align-items: center; gap: 10px; box-shadow: var(--shadow); }
.result canvas { max-width: 100%; height: auto; background: repeating-conic-gradient(#E5E9E8 0 25%, #fff 0 50%) 0 0 / 12px 12px; }
.result figcaption { display: grid; gap: 2px; text-align: center; color: #4A5A60; max-width: 100%; }
.cap-text { font-family: var(--mono); font-size: .875rem; overflow-wrap: anywhere; white-space: pre-wrap; max-height: 8.5em; overflow: auto; }
.cap-dim { font-size: .8125rem; font-variant-numeric: tabular-nums; }
.grid .wide { grid-column: 1 / -1; }
.cfields { display: grid; gap: 12px; }
.cfields input, .cfields textarea, .cfields select { margin-top: 4px; }
.cfields .field label { font-weight: 500; font-size: .875rem; color: var(--ink-2); }
.check-field label.check { color: var(--ink); }
.dl { display: inline-flex; flex-wrap: wrap; justify-content: center; border: 1px solid #C9D2D1; border-radius: 6px; overflow: hidden; }
.dl button { min-height: 40px; min-width: 48px; padding: 6px 10px; border: 0; border-right: 1px solid #C9D2D1; background: #fff; color: #1A2226;
  font: 600 .8125rem var(--font); cursor: pointer; }
.dl button:last-child { border-right: 0; }
.dl button:hover { background: #006894; color: #fff; }
.dl button:focus-visible { outline-offset: -3px; }
.result.err { background: var(--label); color: var(--danger); align-items: stretch; box-shadow: none; border: 1px solid var(--danger); }
.result.err p { margin: 0; overflow-wrap: anywhere; }
.empty { color: var(--ink-2); }

/* Especificação e como usar */
.doc { display: grid; gap: 40px; grid-template-columns: minmax(0, 1fr); padding: 8px 0 16px; }
@media (min-width: 960px) { .doc { grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); gap: 56px; } }
.doc p, .doc li { max-width: 72ch; }
.spec ul, .howto ol { padding-left: 1.25em; margin: 0; }
.spec li + li, .howto li + li { margin-top: 8px; }
.spec li::marker { color: var(--cyan); }
.howto ol li::marker { font-weight: 700; color: var(--cyan); }
code { font-family: var(--mono); font-size: .9em; background: var(--label); border: 1px solid var(--rule); padding: 0 5px; border-radius: 3px; overflow-wrap: anywhere; }
.hint--warn { color: var(--ink); font-weight: 600; border-left: 3px solid var(--warn); padding-left: 10px; }
.usage { font-size: .875rem; color: var(--ink-2); max-width: 90ch; margin: -8px 0 24px; border-left: 3px solid var(--warn); padding-left: 12px; }
.usage strong { color: var(--ink); }
.result-warn { margin: 0; font-size: .8125rem; color: #7A4300; text-align: center; overflow-wrap: anywhere; }
.faq { border-top: 1px solid var(--rule); padding: 24px 0 8px; max-width: 80ch; }
.faq h3 { font-size: 1.125rem; margin: 20px 0 6px; }
.faq p { margin: 0; }
.updated { margin-top: 12px; font-size: .875rem; }
/* Chinês: a Archivo não tem glifos CJK; usa fontes do sistema e sem condensação */
:lang(zh-Hans) body { font-family: "Archivo", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", sans-serif; }
:lang(zh-Hans) h1, :lang(zh-Hans) h2, :lang(zh-Hans) h3 { letter-spacing: 0; line-height: 1.25; }
.related { border-top: 1px solid var(--rule); padding-top: 24px; margin-top: 16px; }
.related h2 { font-size: 1.25rem; }
.related ul { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.related a { display: inline-flex; align-items: center; min-height: 40px; padding: 6px 14px; border: 1px solid var(--rule); border-radius: 999px; color: var(--ink); text-decoration: none; background: var(--label); }
.related a:hover { border-color: var(--cyan); color: var(--cyan); }

/* ==== Início ==== */
.hero { display: grid; gap: 40px; align-items: center; padding-top: 40px; padding-bottom: 48px; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 960px) { .hero { grid-template-columns: minmax(0, 1.1fr) minmax(0, .9fr); padding-top: 64px; padding-bottom: 72px; } }
.hero h1 { font-size: clamp(2.6rem, 6.4vw, 5rem); line-height: .98; font-variation-settings: "wdth" 66; font-stretch: 66%; }
.hero .lead { margin-top: 20px; }
.hero-cta { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 28px; }
.hero-fig { margin: 0; display: flex; justify-content: center; }
/* Etiqueta com cotas de medida, como num desenho técnico */
.dim-wrap { position: relative; padding: 0 44px 44px 0; width: min(100%, 340px); }
@media (min-width: 960px) { .dim-wrap { width: min(100%, 440px); } }
.label { position: relative; background: #fff; border-radius: 14px; padding: 28px 30px 22px; box-shadow: var(--shadow); overflow: hidden; }
.hero-code { display: block; width: 100%; height: auto; }
.laser { position: absolute; top: 0; bottom: 0; left: 0; width: 2px; background: var(--laser); box-shadow: 0 0 12px 3px rgba(227,38,46,.55); opacity: 0;
  animation: scan 1.6s cubic-bezier(.45,0,.25,1) .5s 1 both; }
@keyframes scan { 0% { left: 4%; opacity: 0; } 12% { opacity: 1; } 88% { opacity: 1; } 100% { left: 96%; opacity: 0; } }
.dim { position: absolute; font-size: .875rem; font-weight: 600; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.dim--x { left: 0; right: 44px; bottom: 6px; text-align: center; border-top: 1px solid var(--ink-2); padding-top: 6px; }
.dim--x::before, .dim--x::after, .dim--y::before, .dim--y::after { content: ""; position: absolute; background: var(--ink-2); }
.dim--x::before, .dim--x::after { top: -6px; width: 1px; height: 11px; }
.dim--x::before { left: 0; } .dim--x::after { right: 0; }
.dim--y { top: 0; bottom: 44px; right: 6px; width: 30px; border-left: 1px solid var(--ink-2); writing-mode: vertical-rl; display: flex; align-items: center; justify-content: center; padding-left: 4px; }
.dim--y::before, .dim--y::after { left: -6px; height: 1px; width: 11px; }
.dim--y::before { top: 0; } .dim--y::after { bottom: 0; }

.specimens { padding-bottom: 32px; }
.spec-group { padding: 32px 0; border-top: 1px solid var(--rule); scroll-margin-top: 80px; }
.specimen-grid { list-style: none; margin: 0; padding: 0; display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
.specimen { display: flex; flex-direction: column; gap: 4px; height: 100%; color: var(--ink); text-decoration: none; padding: 12px; margin: -12px; border-radius: 10px; transition: background-color .15s; }
.specimen:hover { background: var(--label-2); }
.specimen-img { display: flex; align-items: center; justify-content: center; height: 132px; background: #fff; border-radius: 8px; padding: 16px; margin-bottom: 8px; box-shadow: var(--shadow); }
.specimen-img img { display: block; max-width: 100%; max-height: 100px; width: auto; height: auto; }
.specimen strong { font-size: 1.0625rem; }
.specimen:hover strong { color: var(--cyan); }
.specimen-desc { font-size: .9375rem; color: var(--ink-2); }

/* ==== Compartilhar / doar ==== */
.share-bar { display: grid; gap: 24px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 340px), 1fr)); margin-top: 24px; padding-top: 32px; padding-bottom: 8px; }
.share-bar .card { background: var(--label); border: 1px solid var(--rule); border-radius: 8px; padding: 20px; }
.share-bar h2 { font-size: 1.375rem; }
.share-bar p { margin: 0 0 12px; color: var(--ink-2); }
.share-links { display: flex; flex-wrap: wrap; gap: 8px; }
.sh { display: inline-flex; align-items: center; min-height: 44px; padding: 8px 16px; border-radius: 999px; border: 0; font: inherit; font-weight: 600;
  color: #fff; text-decoration: none; cursor: pointer; transition: filter .15s; }
.sh:hover { filter: brightness(1.12); }
.sh--wa { background: #0E7A40; } .sh--tg { background: #1E7DB8; } .sh--fb { background: #1565D8; }
.sh--x { background: #000; } .sh--mail { background: #4A5A60; }
.sh--copy { background: transparent; color: var(--ink); border: 1px solid var(--rule); }
:root[data-theme="dark"] .sh--x { background: #fff; color: #000; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .sh--x { background: #fff; color: #000; } }

/* ==== Avisos (cookies / bloqueador) ==== */
.notice { background: var(--label); border-top: 1px solid var(--rule); }
.notice[hidden] { display: none; }
.notice--cookie { position: fixed; left: 0; right: 0; bottom: 0; z-index: 50; box-shadow: 0 -8px 24px -12px rgba(0,0,0,.35); }
.notice--adblock { border-top: 0; border-bottom: 1px solid var(--rule); box-shadow: inset 4px 0 0 var(--warn); }
.notice-inner { display: flex; flex-wrap: wrap; gap: 12px 24px; align-items: center; justify-content: space-between; padding-top: 12px; padding-bottom: 12px; }
.notice-inner p { margin: 0; flex: 1 1 400px; font-size: .9375rem; }
.notice-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ==== Páginas de texto e rodapé ==== */
.prose { max-width: 72ch; padding-top: 24px; padding-bottom: 40px; }
.prose h2 { margin-top: 32px; font-size: 1.5rem; }
.foot { border-top: 1px solid var(--rule); margin-top: 24px; padding: 16px 0 112px; font-size: .9375rem; color: var(--ink-2); }
.foot .wrap { display: grid; gap: 0; }
.foot section { padding: 16px 0; border-bottom: 1px solid var(--rule); max-width: 110ch; }
.foot h2 { font-size: 1.125rem; color: var(--ink); }
.foot p { margin: 0 0 6px; }
.foot strong { color: var(--ink); }
.foot-nav { list-style: none; display: flex; flex-wrap: wrap; gap: 8px 24px; padding: 16px 0 0; margin: 0; }
.foot-nav a { color: var(--ink); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}
