/* Ajuda da MyDronePT: manual com índice lateral no ecrã e A4 limpo ao imprimir (Guardar como PDF). */

:root {
  --paper: #F7F5EF;
  --paper-2: #F1EEE4;
  --card: #FFFFFF;
  --ink: #1C1712;
  --ink-2: #5E5546;
  --ink-3: #8A8070;
  --rule: #E4DECD;
  --accent: #F15A29;
  --accent-soft: #FDE7DE;
  --s-valid: #1f8a4c;
  --s-capitania: #0e8f8a;
  --s-renew: #d98a00;
  --s-pending: #2f6fd6;
  --s-expired: #c23a2b;
  --s-refused: #7a1f16;
  --s-scheduled: #5a8f6c;
  --s-none: #8b949b;
  --font: 'Public Sans', system-ui, sans-serif;
  --font-display: 'Archivo', 'Public Sans', sans-serif;
  --mono: 'IBM Plex Mono', ui-monospace, monospace;
  --toc-w: 260px;
  --measure: 720px;
  --shadow: 0 1px 2px rgba(28, 23, 18, .06), 0 14px 36px -22px rgba(28, 23, 18, .35);
}
:root[data-theme="dark"] {
  --paper: #0f1a20;
  --paper-2: #15232b;
  --card: #1a2a33;
  --ink: #e9efe9;
  --ink-2: #b5c0bb;
  --ink-3: #8a9a96;
  --rule: #26363f;
  --accent-soft: #3a2219;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 14px 36px -22px rgba(0, 0, 0, .7);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 24px; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
body {
  margin: 0; background: var(--paper); color: var(--ink);
  font: 400 1rem/1.65 var(--font); -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-underline-offset: 3px; }
a:focus-visible, button:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 3px; }

/* Capa */
.cover {
  position: relative; overflow: hidden; padding: 56px 24px 48px;
  background: #1C1712; color: #F7F5EF;
}
.cover::after { /* mira do drone, a marca da app, em grande e esbatida */
  content: ''; position: absolute; right: -80px; top: -60px; width: 420px; height: 420px; border-radius: 50%;
  border: 2px dashed rgba(241, 90, 41, .35); pointer-events: none;
}
.cover-inner { position: relative; z-index: 1; max-width: calc(var(--toc-w) + var(--measure) + 64px); margin: 0 auto; }
.brand { display: flex; align-items: center; gap: 12px; color: var(--accent); font: 600 .78rem/1 var(--mono); letter-spacing: .14em; text-transform: uppercase; }
.cover h1 { margin: 18px 0 10px; font: 900 clamp(2.4rem, 1.4rem + 4vw, 4.4rem)/1 var(--font-display); letter-spacing: -.02em; }
.cover h1 span { color: var(--accent); }
.cover p { margin: 0; max-width: 60ch; color: #CFC7B8; font-size: 1.08rem; }
.cover-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 28px; }
.btn {
  display: inline-flex; align-items: center; gap: 8px; padding: 10px 16px; border-radius: 3px; cursor: pointer;
  font: 600 .74rem/1 var(--mono); letter-spacing: .06em; text-transform: uppercase; text-decoration: none;
  border: 1px solid rgba(247, 245, 239, .35); background: transparent; color: #F7F5EF;
  transition: background-color .15s, border-color .15s, transform .15s;
}
.btn:hover { border-color: #F7F5EF; transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { background: #d94c1e; border-color: #d94c1e; }
.rule-strip { display: flex; flex-wrap: wrap; gap: 8px 22px; margin-top: 32px; color: #CFC7B8; font: 500 .8rem/1.4 var(--mono); }
.rule-strip b { color: #F7F5EF; font-weight: 600; }

/* Índice + conteúdo */
.layout {
  display: grid; grid-template-columns: var(--toc-w) minmax(0, var(--measure)); gap: 64px;
  max-width: calc(var(--toc-w) + var(--measure) + 64px); margin: 0 auto; padding: 48px 24px 96px;
}
.toc { position: sticky; top: 24px; align-self: start; max-height: calc(100vh - 48px); overflow: auto; }
.toc h2 { margin: 0 0 12px; font: 600 .72rem/1 var(--mono); letter-spacing: .14em; text-transform: uppercase; color: var(--ink-3); }
.toc ol { list-style: none; margin: 0; padding: 0; counter-reset: toc; }
.toc li { counter-increment: toc; }
.toc a {
  display: grid; grid-template-columns: 28px 1fr; padding: 6px 8px; border-radius: 3px;
  color: var(--ink-2); text-decoration: none; font-size: .9rem; line-height: 1.35;
  border-left: 2px solid transparent; transition: background-color .15s, color .15s;
}
.toc a::before { content: counter(toc, decimal-leading-zero); font: 500 .74rem/1.6 var(--mono); color: var(--ink-3); }
.toc a:hover { background: var(--paper-2); color: var(--ink); }
.toc a.is-current { color: var(--ink); border-left-color: var(--accent); background: var(--paper-2); font-weight: 600; }

main { min-width: 0; counter-reset: chapter; }
.chapter { counter-increment: chapter; padding-top: 8px; margin-bottom: 72px; }
.chapter > h2 {
  display: flex; align-items: baseline; gap: 14px; margin: 0 0 18px;
  font: 800 clamp(1.6rem, 1.2rem + 1.4vw, 2.2rem)/1.1 var(--font-display); letter-spacing: -.01em;
}
.chapter > h2::before { content: counter(chapter, decimal-leading-zero); font: 600 .9rem/1 var(--mono); color: var(--accent); letter-spacing: .04em; }
.lead { font-size: 1.12rem; color: var(--ink-2); margin: 0 0 22px; }
h3 { margin: 36px 0 10px; font: 700 1.15rem/1.3 var(--font-display); }
p { margin: 0 0 14px; }
ul, ol { margin: 0 0 16px; padding-left: 22px; }
li { margin-bottom: 6px; }
li::marker { color: var(--ink-3); }
strong { font-weight: 650; }
.ui { /* nomes de botões e campos, como aparecem na app */
  font: 600 .78em/1 var(--mono); letter-spacing: .03em; text-transform: uppercase;
  padding: 2px 6px; border: 1px solid var(--rule); border-radius: 3px; background: var(--card); white-space: nowrap;
}
kbd { font: 500 .85em var(--mono); padding: 1px 6px; border: 1px solid var(--rule); border-bottom-width: 2px; border-radius: 3px; background: var(--card); }

/* Imagens */
.shot { margin: 22px 0 30px; }
.shot img {
  display: block; width: 100%; height: auto; border-radius: 4px; background: var(--card);
  border: 1px solid var(--rule); box-shadow: var(--shadow);
}
.shot--narrow img { max-width: 480px; }
.shot--card img { max-width: 363px; }
.shot--bar img { max-width: 607px; }
.shot figcaption { margin-top: 10px; font-size: .86rem; color: var(--ink-3); line-height: 1.45; }
.shot figcaption b { color: var(--ink-2); font-weight: 600; }
.wide { margin-left: 0; margin-right: 0; }
@media (min-width: 1300px) {
  .wide { margin-right: -180px; } /* as imagens do ecrã inteiro respiram para fora da coluna de texto */
}

/* Lado a lado: imagem + explicação */
.pair { display: grid; grid-template-columns: minmax(0, 363px) minmax(0, 1fr); gap: 24px; align-items: start; margin: 18px 0 26px; }
.pair .shot { margin: 0; }
.pair p:last-child, .pair ul:last-child { margin-bottom: 0; }
.pair h4 { margin: 2px 0 6px; font: 700 1rem/1.3 var(--font-display); }

.state { display: inline-flex; align-items: center; gap: 8px; font-weight: 650; }
.state::before { flex: none; content: ''; width: 11px; height: 11px; border-radius: 50%; background: var(--dot); }

/* Notas */
.note, .warn, .tip {
  margin: 20px 0; padding: 14px 16px 14px 18px; border-left: 3px solid; border-radius: 3px; font-size: .95rem;
}
.note { border-color: var(--s-pending); background: color-mix(in srgb, var(--s-pending) 8%, var(--paper)); }
.warn { border-color: var(--s-expired); background: color-mix(in srgb, var(--s-expired) 8%, var(--paper)); }
.tip { border-color: var(--s-valid); background: color-mix(in srgb, var(--s-valid) 8%, var(--paper)); }
.note > :last-child, .warn > :last-child, .tip > :last-child { margin-bottom: 0; }
.note b:first-child, .warn b:first-child, .tip b:first-child { font: 600 .72rem/1 var(--mono); letter-spacing: .1em; text-transform: uppercase; display: block; margin-bottom: 6px; }

/* Passos numerados */
.steps { list-style: none; padding: 0; counter-reset: step; }
.steps > li { position: relative; padding-left: 44px; margin-bottom: 14px; counter-increment: step; }
.steps > li::before {
  content: counter(step); position: absolute; left: 0; top: 0; width: 28px; height: 28px; border-radius: 50%;
  display: grid; place-items: center; background: var(--accent); color: #fff; font: 600 .8rem/1 var(--mono);
}

/* Tabela de estados */
.table { width: 100%; border-collapse: collapse; margin: 16px 0 24px; font-size: .94rem; }
.table th, .table td { text-align: left; vertical-align: top; padding: 10px 12px; border-bottom: 1px solid var(--rule); }
.table th { font: 600 .7rem/1.2 var(--mono); letter-spacing: .1em; text-transform: uppercase; color: var(--ink-3); }
.table td:first-child { white-space: nowrap; }

.foot { border-top: 1px solid var(--rule); padding-top: 20px; color: var(--ink-3); font-size: .85rem; }

@media (max-width: 900px) {
  .layout { grid-template-columns: minmax(0, 1fr); gap: 32px; padding: 32px 16px 72px; }
  .toc { position: static; max-height: none; padding: 16px; border: 1px solid var(--rule); border-radius: 4px; background: var(--card); }
  .pair { grid-template-columns: minmax(0, 1fr); }
  .cover { padding: 40px 16px 36px; }
  .table td:first-child { white-space: normal; }
}

/* Impressão / Guardar como PDF: A4, índice no início, cada capítulo numa página nova. */
@page { size: A4; margin: 16mm 15mm 18mm; }
@media print {
  :root { --paper: #fff; --card: #fff; --shadow: none; }
  html { scroll-behavior: auto; }
  body { font-size: 10.5pt; line-height: 1.5; background: #fff; color: #1C1712; }
  .no-print { display: none !important; }
  .cover { padding: 0 0 12mm; background: none; color: #1C1712; border-bottom: 2px solid var(--accent); }
  .cover::after { display: none; }
  .cover p, .rule-strip { color: #5E5546; }
  .rule-strip b { color: #1C1712; }
  .layout { display: block; padding: 0; max-width: none; }
  .toc { position: static; max-height: none; overflow: visible; margin: 8mm 0 0; break-after: page; }
  .toc a { padding: 3px 0; }
  .toc a.is-current { background: none; border-left-color: transparent; font-weight: 400; color: var(--ink-2); }
  .chapter { break-before: page; margin-bottom: 0; }
  .chapter > h2 { break-after: avoid; }
  h3, h4 { break-after: avoid; }
  .shot, .pair, .note, .warn, .tip, .table tr { break-inside: avoid; }
  .shot img { max-height: 225mm; width: auto; max-width: 100%; box-shadow: none; }
  .wide { margin-right: 0; }
  /* A coluna do A4 é estreita como um telemóvel: mantém os tamanhos e o lado a lado do ecrã. */
  .shot--card img { max-width: 70mm; }
  .shot--narrow img { max-width: 120mm; }
  .shot--bar img { max-width: 150mm; }
  .pair { grid-template-columns: 70mm minmax(0, 1fr); }
  .table td:first-child { white-space: nowrap; }
  a { color: inherit; text-decoration: none; }
  .note, .warn, .tip { background: none; }
}
