/* ===== Fontes locais (pasta assets/fonts) ===== */
@font-face {
  font-family: "Open Sans";
  src: url("assets/fonts/OpenSans-VariableFont_wdth,wght.ttf")
    format("truetype");
  font-weight: 300 800;
  font-stretch: 75% 100%;
  font-style: normal;
  font-display: block;
}
@font-face {
  font-family: "Abril Fatface";
  src: url("assets/fonts/AbrilFatface-Regular.ttf") format("truetype");
  font-weight: 400;
  font-style: normal;
  font-display: block;
}

/* ===== Página (mobile first: estilos base = celular; ajustes para telas maiores no fim) ===== */
:root {
  --azul: #1800ad;
  --cinza: #3d3b3a;
  --campo: #f4f4f4;
}
* {
  box-sizing: border-box;
}
html {
  -webkit-text-size-adjust: 100%;
}
body {
  margin: 0;
  padding: 12px 10px;
  font-family: "Open Sans", Arial, sans-serif;
  color: var(--cinza);
  background: #fff;
}

.moldura {
  max-width: 620px;
  margin: 0 auto;
  padding: 20px 16px 24px;
  border: 3px solid var(--azul);
  box-shadow:
    inset 0 0 0 5px #fff,
    inset 0 0 0 6px var(--azul);
}
header {
  text-align: center;
  margin-bottom: 8px;
}
.instituicao {
  margin: 0;
  font-family: "Abril Fatface", Georgia, serif;
  font-weight: 400;
  font-size: clamp(14pt, 5.6vw, 22pt);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  text-decoration: underline;
  color: #000;
}
.departamento {
  margin: 6px 0 0;
  font-family: "Abril Fatface", Georgia, serif;
  font-weight: 400;
  font-size: 7.5pt;
  letter-spacing: 0.14em;
  line-height: 1.9;
  text-transform: uppercase;
}
h1 {
  margin: 18px 0 8px;
  text-align: center;
  font-family: "Abril Fatface", Georgia, serif;
  font-weight: 400;
  font-size: clamp(26pt, 11vw, 42.5pt);
  letter-spacing: 0.03em;
  color: #000;
}

label,
.rotulo {
  display: block;
  margin-top: 16px;
  font-weight: 700;
  letter-spacing: 0.04em;
}
input,
select {
  width: 100%;
  min-width: 0;
  padding: 9px 10px;
  margin-top: 4px;
  border: 0;
  border-bottom: 1px solid var(--cinza);
  background: var(--campo);
  font: inherit;
  font-size: 16px;
  color: #000;
}
input:focus,
select:focus,
button:focus-visible {
  outline: 2px solid var(--azul);
  outline-offset: 1px;
}

button {
  margin-top: 12px;
  padding: 10px 18px;
  border: 1px solid var(--azul);
  background: #fff;
  color: var(--azul);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}
#adicionar,
.principal {
  width: 100%;
}
.principal {
  margin-top: 24px;
  background: var(--azul);
  color: #fff;
}

.linha-curso {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-top: 4px;
}
.linha-curso input {
  flex: 1;
  margin-top: 0;
}
.linha-curso button {
  margin: 0;
  padding: 9px 12px;
  white-space: nowrap;
}

.data-linha {
  display: flex;
  gap: 6px;
}
.data-linha label {
  flex: 1;
  min-width: 0;
  margin-top: 4px;
  font-weight: 400;
}
.data-linha label:nth-child(2) {
  flex: 2;
}

@media (min-width: 600px) {
  body {
    padding: 24px 16px;
  }
  .moldura {
    padding: 28px 32px 32px;
    border-width: 4px;
    box-shadow:
      inset 0 0 0 7px #fff,
      inset 0 0 0 8px var(--azul);
  }
  .departamento {
    font-size: 8.5pt;
    letter-spacing: 0.3em;
  }
  h1 {
    letter-spacing: 0.06em;
  }
  input,
  select {
    font-size: 14pt;
  }
  #adicionar,
  .principal {
    width: auto;
  }
  .data-linha label:nth-child(2) {
    flex: 1;
  }
}

/* ===== Certificado (A4 paisagem; medidas em cm, conforme o modelo do Centro) ===== */
#area-pdf {
  position: fixed;
  left: -20000px;
  top: 0;
  width: 29.7cm;
  height: 21cm;
  pointer-events: none;
}
.certificado {
  --azul: #1800ad;
  position: relative;
  width: 29.7cm;
  height: 21cm;
  overflow: hidden;
  background: #fff;
  font-family: "Open Sans", Arial, sans-serif;
  color: #3d3b3a;
}
.certificado p {
  margin: 0;
}

/* Moldura (27,14 x 18,52 cm): linha grossa + linha fina, com os cantos recortados em arco */
.cert-moldura {
  position: absolute;
  left: 1.28cm;
  top: 1.24cm;
  width: 27.14cm;
  height: 18.52cm;
  overflow: hidden;
  background: var(--azul);
}
.cert-painel {
  position: absolute;
  inset: 4pt;
  background: #fff;
}
.cert-fino {
  position: absolute;
  inset: 5pt;
  overflow: hidden;
  background: #fff;
  border: 1pt solid var(--azul);
}
.cert-c,
.cert-g {
  position: absolute;
  border-radius: 50%;
  background: #fff;
  border: 1pt solid var(--azul);
}
.cert-c {
  --o: -41pt;
  width: 62pt;
  height: 62pt;
}
.cert-g {
  --o: -25pt;
  width: 50pt;
  height: 50pt;
  border-width: 4pt;
}
.tl {
  left: var(--o);
  top: var(--o);
}
.tr {
  right: var(--o);
  top: var(--o);
}
.bl {
  left: var(--o);
  bottom: var(--o);
}
.br {
  right: var(--o);
  bottom: var(--o);
}

/* Cabeçalho */
.cert-logo {
  position: absolute;
  left: 4.73cm;
  top: 2.1cm;
  width: 3.81cm;
}
.cert-inst {
  position: absolute;
  left: 10.67cm;
  top: 2.1cm;
  width: 14.3cm;
  text-align: center;
  white-space: nowrap;
  font:
    400 22pt/0.94cm "Abril Fatface",
    Georgia,
    serif;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  text-decoration: underline;
  color: #000;
}
.cert-dept {
  position: absolute;
  left: 10.67cm;
  top: 3.08cm;
  width: 14.3cm;
  text-align: center;
  white-space: nowrap;
  font:
    400 8.5pt/0.52cm "Abril Fatface",
    Georgia,
    serif;
  letter-spacing: 0.45em;
  padding-left: 0.45em;
  text-transform: uppercase;
  color: #000;
}
.cert-orn {
  position: absolute;
  left: 12.21cm;
  top: 5.25cm;
  width: 4.94cm;
}
.cert-titulo {
  position: absolute;
  left: 8.92cm;
  top: 6.76cm;
  width: 11.86cm;
  text-align: center;
  font:
    400 42.5pt/1.78cm "Abril Fatface",
    Georgia,
    serif;
  letter-spacing: 0.04em;
  color: #000;
}

/* Texto do aluno e data (Open Sans 14): texto corrido, centralizado; 0,7 cm entre as linhas */
.cert-texto,
.cert-data {
  font-size: 14pt;
  font-weight: 700;
  letter-spacing: 0.04em;
}
.cert-texto {
  position: absolute;
  left: 6.55cm;
  top: 9.71cm;
  width: 16.61cm;
  height: 3.14cm;
  padding-top: 0.5cm;
  text-align: center;
  line-height: 2.417;
  overflow-wrap: anywhere;
}
.cert-data {
  position: absolute;
  left: 9.17cm;
  top: 14.9cm;
  width: 11.36cm;
  height: 0.59cm;
  line-height: 0.59cm;
  text-align: center;
  white-space: nowrap;
}

/* Assinaturas (Open Sans 10): três colunas de 5,54 cm, separadas por 1,8 cm; o nome pode quebrar em duas linhas */
.cert-assinaturas {
  position: absolute;
  left: 4.73cm;
  top: 17.1cm;
  width: 20.22cm;
  display: grid;
  grid-template-columns: repeat(3, 5.54cm);
  column-gap: 1.8cm;
  text-align: center;
}
.cert-nome {
  border-top: 1pt solid #000;
  padding: 0.29cm 0 0 0.15em;
  font-size: 10pt;
  line-height: 0.5cm;
  letter-spacing: 0.15em;
  overflow-wrap: anywhere;
}
.cert-cargo {
  padding-left: 0.22em;
  font-size: 10pt;
  line-height: 0.5cm;
  letter-spacing: 0.22em;
}
