/* "Sobre o projeto e metodologia" — reading page. Builds on styles.css tokens. */

body.page-sobre {
  display: block;
  height: auto;
  min-height: 100%;
  overflow: visible;
  overflow-x: clip;
  font-variant-numeric: tabular-nums;
}

html:has(body.page-sobre) {
  height: auto;
}

.page-sobre {
  --measure: 68ch;
  --flow: 1.05rem;
  --section-gap: clamp(3rem, 7vw, 4.75rem);
  --ink-link: #e8c48f;
}

/* ---------- Skip link ---------- */

.skip-link {
  position: absolute;
  left: 16px;
  top: -3rem;
  z-index: 1200;
  padding: 0.5rem 0.9rem;
  border-radius: var(--radius-sm);
  background: var(--surface);
  border: 1px solid var(--border);
  font-weight: 500;
}

.skip-link:focus {
  top: 0.6rem;
}

/* ---------- Top bar ---------- */

.page-sobre .topbar {
  position: sticky;
  top: 0;
}

.project .project-name {
  display: block;
  margin: 0;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.35rem;
  letter-spacing: -0.015em;
  color: var(--text);
  white-space: nowrap;
}

.back-link {
  margin-left: auto;
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.45rem 0.9rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  font-size: 0.85rem;
  font-weight: 500;
  text-decoration: none;
  white-space: nowrap;
}

.back-link:hover {
  border-color: var(--terra);
  background: var(--terra-tint);
}

/* ---------- Reading column ---------- */

.sobre {
  width: 100%;
  max-width: calc(var(--measure) + 2 * 16px);
  margin: 0 auto;
  padding: clamp(2.5rem, 6vw, 4.5rem) 16px 0;
}

.sobre > * + * {
  margin-top: var(--section-gap);
}

.sobre p,
.sobre ul,
.sobre table,
.sobre figure,
.sobre dl {
  margin: 0;
}

.sobre p + p,
.sobre * + p,
.sobre * + ul,
.sobre * + table,
.sobre * + figure {
  margin-top: var(--flow);
}

.sobre p {
  text-wrap: pretty;
}

.sobre h1 {
  font-size: clamp(2rem, 1.4rem + 2.6vw, 2.9rem);
  line-height: 1.1;
  letter-spacing: -0.025em;
}

.sobre h2 {
  font-size: clamp(1.5rem, 1.2rem + 1.2vw, 1.95rem);
  line-height: 1.18;
}

.sobre h2 + * {
  margin-top: 1.1rem;
}

.sobre h3 {
  margin-top: 2.4rem;
  font-size: 1.25rem;
  line-height: 1.25;
}

.sobre h3 + * {
  margin-top: 0.7rem;
}

.lead h1 + * {
  margin-top: 1.4rem;
}

.lead-text {
  font-size: 1.2rem;
  line-height: 1.55;
}

.num {
  font-family: var(--font-mono);
  font-size: 0.92em;
  font-weight: 500;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.sobre code {
  padding: 0.1em 0.35em;
  border-radius: 6px;
  background: var(--surface-alt);
  overflow-wrap: anywhere;
}

.sobre cite {
  font-style: italic;
}

.sobre ul.rules {
  padding-left: 1.2rem;
}

.rules li + li {
  margin-top: 0.5rem;
}

.rules li::marker {
  color: var(--terra);
}

/* ---------- Thermal scale ---------- */

.scale {
  margin-top: 1.5rem;
  padding: 1.25rem;
  border-radius: var(--radius-lg);
  background: var(--surface);
  border: 1px solid var(--border);
}

.scale-bands {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 3px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.scale-bands li {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  min-width: 0;
}

.scale-bands li::before {
  content: "";
  display: block;
  height: 0.9rem;
  margin-bottom: 0.45rem;
  background: var(--band);
}

.scale-bands li:first-child::before {
  border-radius: 999px 0 0 999px;
}

.scale-bands li:last-child::before {
  border-radius: 0 999px 999px 0;
}

.band-label {
  font-size: 0.85rem;
  font-weight: 600;
  line-height: 1.25;
}

.band-range {
  font-size: 0.78rem;
  color: var(--text-muted);
}

.scale figcaption {
  margin-top: 1rem;
  font-size: 0.875rem;
  color: var(--text-muted);
}

/* ---------- Tables ---------- */

.data-table {
  width: 100%;
  max-width: 26rem;
  border-collapse: collapse;
  font-size: 0.95rem;
}

.data-table caption {
  caption-side: top;
  text-align: left;
  font-size: 0.85rem;
  color: var(--text-muted);
  padding-bottom: 0.5rem;
}

.data-table th,
.data-table td {
  padding: 0.5rem 0.75rem 0.5rem 0;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

.data-table thead th {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
}

/* ---------- IQAr swatches ---------- */

.swatches {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.1rem;
  padding: 0;
  list-style: none;
  font-size: 0.9rem;
  font-weight: 500;
}

.swatches li {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
}

.swatches i {
  width: 0.8rem;
  height: 0.8rem;
  border-radius: 50%;
  flex: none;
}

/* ---------- Sensor (dark data block) ---------- */

.sensor {
  width: 100vw;
  max-width: none;
  margin-left: calc(50% - 50vw);
  background: var(--ink);
  color: var(--ink-text);
}

.sensor-inner {
  max-width: calc(var(--measure) + 2 * 16px);
  margin: 0 auto;
  padding: clamp(2.75rem, 7vw, 4.25rem) 16px;
}

.sensor ::selection {
  background: var(--ink-border);
  color: var(--ink-text);
}

.sensor a {
  color: var(--ink-link);
}

.sensor :focus-visible {
  outline-color: var(--ink-link);
}

.sensor-muted {
  color: var(--ink-text-muted);
  font-size: 0.9rem;
}

.spec {
  margin-top: 1.75rem !important;
  border-top: 1px solid var(--ink-border);
}

.spec > div {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 1rem;
  padding: 0.85rem 0;
  border-bottom: 1px solid var(--ink-border);
}

.spec dt {
  color: var(--ink-text-muted);
  font-size: 0.92rem;
}

.spec dd {
  margin: 0;
  font-family: var(--font-mono);
  font-weight: 500;
  font-size: 0.95rem;
}

.spec-note {
  display: block;
  margin-top: 0.15rem;
  font-family: var(--font-body);
  font-weight: 400;
  font-size: 0.82rem;
  color: var(--ink-text-muted);
}

.cost {
  width: 100%;
  max-width: 26rem;
  border-collapse: collapse;
  font-size: 0.95rem;
}

.cost th,
.cost td {
  padding: 0.55rem 0;
  border-bottom: 1px solid var(--ink-border);
  text-align: left;
}

.cost th {
  font-weight: 400;
  color: var(--ink-text-muted);
}

.cost td {
  text-align: right;
}

.cost tfoot th,
.cost tfoot td {
  border-bottom: 0;
  padding-top: 0.8rem;
  font-weight: 600;
  color: var(--ink-text);
}

/* ---------- Naves ---------- */

.naves {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0 1.5rem;
  padding: 0;
  list-style: none;
  border-top: 1px solid var(--border);
}

.naves li {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  padding: 0.8rem 0;
  border-bottom: 1px solid var(--border);
}

.nave-name {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.25rem 0.5rem;
  font-weight: 600;
}

.nave-addr {
  font-size: 0.875rem;
  color: var(--text-muted);
}

.tag {
  padding: 0.05rem 0.5rem;
  border-radius: 999px;
  background: var(--terra-tint);
  color: var(--terra-hover);
  font-size: 0.72rem;
  font-weight: 600;
  white-space: nowrap;
}

.note {
  font-size: 0.875rem;
  color: var(--text-muted);
}

/* ---------- Open code ---------- */

.endpoint code {
  display: inline-block;
  padding: 0.5rem 0.8rem;
  border-radius: var(--radius-md);
  background: var(--ink);
  color: var(--ink-text);
  font-size: 0.9rem;
}

/* ---------- Footer ---------- */

.site-footer {
  max-width: calc(var(--measure) + 2 * 16px);
  margin: var(--section-gap) auto 0;
  padding: 1.5rem 16px 2.5rem;
  border-top: 1px solid var(--border);
}

.site-footer p {
  margin: 0;
  font-size: 0.85rem;
  color: var(--text-muted);
}

/* ---------- Narrow screens ---------- */

@media (max-width: 760px) {
  .project .project-name {
    font-size: 1.15rem;
  }

  .back-link {
    padding: 0.35rem 0.7rem;
    font-size: 0.8rem;
  }

  .lead-text {
    font-size: 1.1rem;
  }
}

@media (max-width: 560px) {
  .page-sobre .project p:not(.project-name) {
    display: none;
  }

  .naves {
    grid-template-columns: minmax(0, 1fr);
  }

  .scale {
    padding: 1rem;
  }

  .scale-bands {
    grid-template-columns: minmax(0, 1fr);
    gap: 0;
  }

  .scale-bands li {
    display: grid;
    grid-template-columns: 0.9rem minmax(0, 1fr) auto;
    align-items: center;
    column-gap: 0.75rem;
    padding: 0.45rem 0;
  }

  .scale-bands li::before,
  .scale-bands li:first-child::before,
  .scale-bands li:last-child::before {
    width: 0.9rem;
    height: 0.9rem;
    margin: 0;
    border-radius: 3px;
  }

  .spec > div {
    grid-template-columns: minmax(0, 1fr);
    gap: 0.2rem;
  }
}
