/* Tooler — Recorte de Cooktop */

:root {
  --bg: #f6f5f1;
  --surface: #ffffff;
  --text: #1d2421;
  --muted: #535e59;
  --border: #d6d9d3;
  --accent: #0f5c4d;
  --accent-hover: #0a4639;
  --accent-soft: #e4f0ec;
  --focus: #1a56c4;
  --error: #a32020;
  --error-bg: #fbeaea;

  --igual-bg: #e1f2e9;
  --igual-text: #0c5235;
  --igual-border: #86c3a4;
  --menor-bg: #fdefe2;
  --menor-text: #823500;
  --menor-border: #e2aa77;
  --maior-bg: #e7eefa;
  --maior-text: #1b4a8a;
  --maior-border: #98b6df;
  --insuf-bg: #eeeeec;
  --insuf-text: #3f4441;
  --insuf-border: #b9bcb7;

  --radius: 10px;
  --gutter: 16px;
  color-scheme: light;
}

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

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 1rem;
  line-height: 1.55;
  overflow-wrap: break-word;
}

h1,
h2,
h3,
h4 {
  line-height: 1.25;
  margin: 0 0 0.5em;
}

h1 {
  font-size: clamp(1.6rem, 4.5vw, 2.2rem);
  letter-spacing: -0.01em;
}

h2 {
  font-size: 1.3rem;
}

h3 {
  font-size: 1.1rem;
}

p {
  margin: 0 0 0.75em;
}

a {
  color: var(--accent);
}

a:hover {
  color: var(--accent-hover);
}

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

.wrap {
  max-width: 760px;
  margin: 0 auto;
  padding: 0 var(--gutter);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: absolute;
  left: var(--gutter);
  top: -100px;
  background: var(--surface);
  color: var(--accent);
  padding: 8px 12px;
  border-radius: 6px;
  z-index: 10;
}

.skip-link:focus {
  top: 8px;
}

/* Cabeçalho */

.site-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 12px 0;
}

.brand {
  font-weight: 700;
  color: var(--accent);
  font-size: 1.05rem;
}

.brand-sub {
  font-weight: 500;
  color: var(--muted);
}

/* Introdução */

.intro {
  padding-top: 28px;
  padding-bottom: 8px;
}

.lead {
  font-size: 1.1rem;
  color: var(--muted);
}

.notice {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  background: var(--accent-soft);
  border-left: 4px solid var(--accent);
  border-radius: 6px;
  padding: 10px 12px;
  font-weight: 500;
}

.notice-icon {
  flex: none;
  width: 20px;
  height: 20px;
  margin-top: 2px;
  color: var(--accent);
}

/* Cartões e formulário */

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
}

.form-card {
  margin: 16px 0 8px;
}

.form-layout {
  display: grid;
  gap: 20px;
}

@media (min-width: 680px) {
  .form-layout {
    grid-template-columns: 1fr 1fr;
    align-items: start;
  }
}

.diagram {
  margin: 0;
  color: var(--text);
}

.diagram svg {
  display: block;
  width: 100%;
  height: auto;
}

.diagram figcaption {
  font-size: 0.9rem;
  color: var(--muted);
  text-align: center;
  margin-top: 4px;
}

.d-counter {
  fill: #ebe7de;
  stroke: #b8b2a5;
  stroke-width: 1.5;
}

.d-front {
  stroke: #7d776b;
  stroke-width: 4;
}

.d-cutout {
  fill: #ffffff;
  stroke: var(--text);
  stroke-width: 2;
  stroke-dasharray: 6 4;
}

.d-arrow {
  stroke: var(--accent);
  color: var(--accent);
  stroke-width: 2;
}

.d-label {
  font: 600 13px system-ui, sans-serif;
  fill: var(--accent);
}

.d-label-muted {
  font: 12px system-ui, sans-serif;
  fill: var(--muted);
}

fieldset {
  border: 0;
  margin: 0 0 16px;
  padding: 0;
  min-width: 0;
}

legend,
.field > label {
  display: block;
  font-weight: 600;
  margin-bottom: 4px;
  padding: 0;
}

.segmented {
  display: flex;
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
}

.segmented input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
}

.segmented label {
  flex: 1;
  text-align: center;
  padding: 10px 8px;
  cursor: pointer;
  font-size: 0.95rem;
  background: var(--surface);
  color: var(--text);
}

.segmented label + input + label {
  border-left: 1px solid var(--border);
}

.segmented input:checked + label {
  background: var(--accent);
  color: #fff;
  font-weight: 600;
}

.segmented input:focus-visible + label {
  outline: 3px solid var(--focus);
  outline-offset: -3px;
}

.field {
  margin-bottom: 16px;
}

.hint {
  font-size: 0.9rem;
  color: var(--muted);
  margin: 0 0 6px;
}

.input-unit {
  display: flex;
  align-items: stretch;
}

.input-unit input,
select {
  width: 100%;
  font: inherit;
  font-size: 1.05rem;
  color: var(--text);
  background: var(--surface);
  border: 1px solid #8f9792;
  border-radius: 8px;
  padding: 10px 12px;
  min-height: 46px;
}

.input-unit input {
  border-top-right-radius: 0;
  border-bottom-right-radius: 0;
  min-width: 0;
}

.unit-label {
  display: flex;
  align-items: center;
  padding: 0 14px;
  background: #f0f0ec;
  border: 1px solid #8f9792;
  border-left: 0;
  border-radius: 0 8px 8px 0;
  color: var(--muted);
  font-weight: 600;
}

.input-unit input[aria-invalid="true"] {
  border-color: var(--error);
  box-shadow: inset 0 0 0 1px var(--error);
}

.error {
  color: var(--error);
  background: var(--error-bg);
  border-radius: 6px;
  padding: 6px 10px;
  margin: 6px 0 0;
  font-size: 0.93rem;
  font-weight: 500;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font: inherit;
  font-weight: 600;
  border-radius: 8px;
  padding: 10px 18px;
  min-height: 46px;
  cursor: pointer;
  text-decoration: none;
  border: 1px solid transparent;
}

.btn-primary {
  width: 100%;
  background: var(--accent);
  color: #fff;
  font-size: 1.05rem;
}

.btn-primary:hover {
  background: var(--accent-hover);
}

.btn-secondary {
  background: var(--surface);
  color: var(--accent);
  border-color: var(--accent);
}

.btn-secondary:hover {
  background: var(--accent-soft);
  color: var(--accent-hover);
}

.btn-sponsored {
  background: var(--surface);
  color: var(--text);
  border-color: var(--border);
}

.btn-link {
  background: none;
  border: 0;
  padding: 0;
  font: inherit;
  color: var(--accent);
  text-decoration: underline;
  cursor: pointer;
}

.form-note {
  font-size: 0.88rem;
  color: var(--muted);
  margin: 8px 0 0;
  text-align: center;
}

/* Resultados */

.results {
  padding-top: 24px;
  padding-bottom: 8px;
}

.results h2:focus {
  outline: none;
}

.results h2:focus-visible {
  outline: 3px solid var(--focus);
}

.empty-state {
  color: var(--muted);
  background: var(--surface);
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  padding: 16px;
}

.summary {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  margin-bottom: 16px;
}

.summary-line {
  font-weight: 600;
  margin-bottom: 4px;
}

.limits {
  font-size: 0.93rem;
  color: var(--muted);
  margin: 0;
}

.no-match {
  background: var(--insuf-bg);
  border-left: 4px solid var(--insuf-border);
  border-radius: 6px;
  padding: 12px 14px;
  margin-bottom: 16px;
}

.no-match p:last-child {
  margin-bottom: 0;
}

.group {
  margin-bottom: 24px;
}

.group-title {
  display: flex;
  align-items: baseline;
  gap: 8px;
  flex-wrap: wrap;
}

.group-count {
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--muted);
}

.result-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 14px;
}

.result-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-top: 5px solid var(--insuf-border);
  border-radius: var(--radius);
  padding: 16px;
}

.result-card.state-igual {
  border-top-color: var(--igual-border);
}

.result-card.state-menor {
  border-top-color: var(--menor-border);
}

.result-card.state-maior {
  border-top-color: var(--maior-border);
}

.card-head {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 8px 12px;
  margin-bottom: 10px;
}

.card-brand {
  font-size: 0.85rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  margin: 0;
}

.card-title {
  font-size: 1.15rem;
  margin: 0;
}

.code-note {
  display: block;
  font-size: 0.88rem;
  font-weight: 400;
  color: var(--muted);
}

.card-meta {
  font-size: 0.92rem;
  color: var(--muted);
  margin: 2px 0 0;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.9rem;
  font-weight: 600;
  border: 1px solid;
  border-radius: 999px;
  padding: 4px 12px 4px 4px;
  align-self: flex-start;
  line-height: 1.3;
}

.badge-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  font-weight: 700;
  font-size: 0.95rem;
  color: #fff;
  flex: none;
}

.badge-igual {
  background: var(--igual-bg);
  color: var(--igual-text);
  border-color: var(--igual-border);
}

.badge-igual .badge-icon {
  background: var(--igual-text);
}

.badge-menor {
  background: var(--menor-bg);
  color: var(--menor-text);
  border-color: var(--menor-border);
}

.badge-menor .badge-icon {
  background: var(--menor-text);
}

.badge-maior {
  background: var(--maior-bg);
  color: var(--maior-text);
  border-color: var(--maior-border);
}

.badge-maior .badge-icon {
  background: var(--maior-text);
}

.badge-insuficiente {
  background: var(--insuf-bg);
  color: var(--insuf-text);
  border-color: var(--insuf-border);
}

.badge-insuficiente .badge-icon {
  background: var(--insuf-text);
}

.caveat {
  background: #fff8db;
  border-left: 4px solid #b58a00;
  border-radius: 6px;
  padding: 8px 12px;
  font-size: 0.93rem;
}

.measures {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin: 0 0 10px;
}

.measures div {
  background: #f7f7f4;
  border-radius: 8px;
  padding: 8px 10px;
}

.measures dt {
  font-size: 0.82rem;
  color: var(--muted);
}

.measures dd {
  margin: 0;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.measures .alt-unit {
  display: block;
  font-weight: 400;
  font-size: 0.85rem;
  color: var(--muted);
}

.axes {
  list-style: none;
  margin: 0 0 10px;
  padding: 0;
  display: grid;
  gap: 4px;
}

.axes li {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 8px;
  align-items: baseline;
}

.axis-name {
  font-weight: 600;
  min-width: 7.5em;
}

.axis-rel {
  font-variant-numeric: tabular-nums;
}

.axis-rel-icon {
  display: inline-block;
  width: 1.2em;
  text-align: center;
  font-weight: 700;
}

.rel-menor {
  color: var(--menor-text);
}

.rel-maior {
  color: var(--maior-text);
}

.rel-igual {
  color: var(--igual-text);
}

.explain {
  font-size: 0.95rem;
}

.issues {
  margin: 0 0 10px;
  padding-left: 1.2em;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 12px 0;
}

.actions .btn {
  flex: 1 1 180px;
}

.sponsored-note {
  flex-basis: 100%;
  font-size: 0.82rem;
  color: var(--muted);
  margin: 0;
}

details {
  border-top: 1px solid var(--border);
  padding-top: 8px;
}

summary {
  cursor: pointer;
  font-weight: 600;
  color: var(--accent);
  padding: 6px 0;
  min-height: 44px;
  display: flex;
  align-items: center;
}

summary::-webkit-details-marker {
  display: none;
}

summary::before {
  content: "▸";
  display: inline-block;
  width: 1.2em;
}

details[open] > summary::before {
  content: "▾";
}

.details-body {
  font-size: 0.93rem;
}

.details-body h5 {
  font-size: 0.95rem;
  margin: 14px 0 6px;
}

.details-body ul {
  margin: 0;
  padding-left: 1.1em;
}

.details-body li {
  margin-bottom: 6px;
}

.details-body q {
  color: var(--muted);
  font-style: italic;
}

.status-tag {
  display: inline-block;
  font-size: 0.78rem;
  font-weight: 600;
  border-radius: 4px;
  padding: 0 6px;
  margin-right: 4px;
  border: 1px solid var(--border);
  background: #f7f7f4;
  color: var(--text);
  white-space: nowrap;
}

.status-publicado {
  border-color: var(--igual-border);
  color: var(--igual-text);
  background: var(--igual-bg);
}

.status-ambiguo {
  border-color: var(--menor-border);
  color: var(--menor-text);
  background: var(--menor-bg);
}

.source-meta {
  margin: 0;
}

.source-meta div {
  display: grid;
  grid-template-columns: minmax(0, 9em) minmax(0, 1fr);
  gap: 8px;
  padding: 3px 0;
}

.source-meta dt {
  color: var(--muted);
}

.source-meta dd {
  margin: 0;
}

/* Seções informativas */

.info {
  padding-top: 20px;
  padding-bottom: 4px;
}

.info ol,
.info ul {
  padding-left: 1.25em;
}

.info li {
  margin-bottom: 6px;
}

.legend {
  list-style: none;
  padding: 0 !important;
}

.legend li {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 12px;
}

.legend .badge {
  align-self: flex-start;
}

.source-details {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 4px 14px 8px;
}

.source-details summary .group-count {
  margin-left: 6px;
}

.source-body > label {
  display: block;
  font-weight: 600;
  margin: 4px 0;
}

.source-body input[type="search"] {
  width: 100%;
  font: inherit;
  color: var(--text);
  background: var(--surface);
  border: 1px solid #8f9792;
  border-radius: 8px;
  padding: 8px 12px;
  min-height: 44px;
}

.source-body .hint {
  margin: 6px 0 0;
  min-height: 1.4em;
}

.source-list {
  list-style: none;
  padding: 0 !important;
  margin: 4px 0 0;
}

.source-list li {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 2px 12px;
  padding: 8px 0;
  margin: 0;
  border-top: 1px solid var(--border);
}

.source-list li[hidden] {
  display: none;
}

.source-list .src-title {
  font-weight: 600;
  margin-right: 8px;
}

.source-list .src-meta {
  font-size: 0.9rem;
  color: var(--muted);
}

.source-list .src-link {
  white-space: nowrap;
  font-size: 0.95rem;
  padding: 6px 0;
}

/* Rodapé */

.site-footer {
  margin-top: 32px;
  padding: 20px 0 28px;
  border-top: 1px solid var(--border);
  font-size: 0.9rem;
  color: var(--muted);
}

@media (max-width: 380px) {
  .measures {
    grid-template-columns: 1fr;
  }
}

@media (prefers-reduced-motion: reduce) {
  * {
    transition: none !important;
    scroll-behavior: auto !important;
  }
}
