/* Fiscalidade — livros de IRS e IRC (Luís Miranda da Rocha)
   Identidade visual: encadernação académica. Papel creme, tinta escura,
   acento em bordô (a cor de uma lombada de código anotado), regras finas
   a ouro-velho. Distinta do AL (quente, fotográfico), do FinLab (papel/azul,
   livro de lançamentos) e do site pessoal. */

@import url('https://fonts.googleapis.com/css2?family=Lora:ital,wght@0,500;0,600;0,700;1,500&family=Source+Serif+4:ital,opsz,wght@0,8..60,400;0,8..60,600;1,8..60,400&family=Inter:wght@400;500;600&display=swap');

:root {
  --bg: #f6f1e6;
  --surface: #eee6d4;
  --surface-2: #e7dcc3;
  --ink: #251f18;
  --ink-soft: #52493c;
  --muted: #8a7d68;
  --accent: #7a2331;
  --accent-2: #591620;
  --accent-tint: #f1dde0;
  --rule: #cdbb95;
  --rule-soft: #e2d6b8;
  --serif: 'Source Serif 4', Georgia, 'Times New Roman', serif;
  --display: 'Lora', var(--serif);
  --sans: 'Inter', -apple-system, Segoe UI, sans-serif;
  --max: 42rem;
}

* { box-sizing: border-box; }

html { background: var(--bg); }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--serif);
  font-size: 1.09rem;
  line-height: 1.68;
  -webkit-font-smoothing: antialiased;
}

body::before {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background-image: repeating-linear-gradient(
    to bottom,
    rgba(122, 35, 49, 0.025),
    rgba(122, 35, 49, 0.025) 1px,
    transparent 1px,
    transparent 34px
  );
}

a { color: var(--accent-2); text-decoration-color: var(--rule); text-underline-offset: 3px; }
a:hover { color: var(--accent); }

/* ---------- masthead ---------- */

.masthead {
  position: relative;
  z-index: 1;
  border-bottom: 1px solid var(--rule);
  background: var(--surface);
}

.masthead-inner {
  max-width: 64rem;
  margin: 0 auto;
  padding: 0.9rem 1.5rem;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.masthead-crumbs {
  font-family: var(--sans);
  font-size: 0.82rem;
  letter-spacing: 0.02em;
  color: var(--ink-soft);
}

.masthead-crumbs a { color: var(--ink-soft); text-decoration: none; }
.masthead-crumbs a:hover { color: var(--accent); }
.masthead-crumbs .sep { color: var(--muted); margin: 0 0.4em; }
.masthead-crumbs .here { color: var(--accent-2); font-weight: 600; }

.masthead-mark {
  font-family: var(--display);
  font-weight: 600;
  font-size: 0.95rem;
  letter-spacing: 0.03em;
  color: var(--accent-2);
  text-decoration: none;
  white-space: nowrap;
}

/* ---------- page / article shell ---------- */

main {
  position: relative;
  z-index: 1;
  max-width: var(--max);
  margin: 0 auto;
  padding: 3rem 1.5rem 5rem;
}

.eyebrow {
  font-family: var(--sans);
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
  margin: 0 0 0.6rem;
}

h1.chapter-title {
  font-family: var(--display);
  font-weight: 600;
  font-size: 2.1rem;
  line-height: 1.22;
  margin: 0 0 2.2rem;
  color: var(--ink);
}

h1.chapter-title .num {
  display: block;
  font-size: 0.95rem;
  font-weight: 500;
  font-style: italic;
  color: var(--muted);
  margin-bottom: 0.35rem;
}

article h2 {
  font-family: var(--display);
  font-size: 1.32rem;
  font-weight: 600;
  color: var(--accent-2);
  margin: 2.6rem 0 1rem;
  padding-bottom: 0.4rem;
  border-bottom: 1px solid var(--rule-soft);
}

article h3 {
  font-family: var(--display);
  font-size: 1.08rem;
  font-weight: 600;
  font-style: italic;
  color: var(--ink);
  margin: 1.9rem 0 0.8rem;
}

article p { margin: 0 0 1.15rem; }
article p:first-of-type { margin-top: 0; }

article ul, article ol {
  margin: 0 0 1.15rem;
  padding-left: 1.4rem;
}
article li { margin-bottom: 0.45rem; }

.dropcap:first-letter {
  font-family: var(--display);
  font-weight: 700;
  font-size: 3.4rem;
  line-height: 0.78;
  float: left;
  padding: 0.05em 0.1em 0 0;
  color: var(--accent);
}

/* ---------- callouts ---------- */

.nota {
  background: var(--accent-tint);
  border-left: 3px solid var(--accent);
  padding: 0.9rem 1.2rem;
  margin: 1.6rem 0;
  font-size: 0.98rem;
  border-radius: 0 3px 3px 0;
}
.nota p:last-child { margin-bottom: 0; }
.nota .label {
  font-family: var(--sans);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--accent-2);
  display: block;
  margin-bottom: 0.35rem;
}

.exemplo {
  background: var(--surface);
  border: 1px solid var(--rule-soft);
  padding: 1.1rem 1.3rem;
  margin: 1.6rem 0;
  border-radius: 3px;
}
.exemplo .label {
  font-family: var(--sans);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  display: block;
  margin-bottom: 0.5rem;
}
.exemplo p:last-child { margin-bottom: 0; }

.atualizado {
  font-family: var(--sans);
  font-size: 0.74rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  color: var(--accent-2);
  background: var(--accent-tint);
  padding: 0.1em 0.5em;
  border-radius: 2px;
  white-space: nowrap;
}

/* ---------- tables ---------- */

table.tabela {
  width: 100%;
  border-collapse: collapse;
  margin: 1.6rem 0 2rem;
  font-size: 0.97rem;
  font-family: var(--sans);
}
table.tabela caption {
  text-align: left;
  font-family: var(--sans);
  font-size: 0.78rem;
  letter-spacing: 0.03em;
  color: var(--muted);
  margin-bottom: 0.5rem;
  caption-side: top;
}
table.tabela th, table.tabela td {
  border: 1px solid var(--rule);
  padding: 0.5rem 0.7rem;
  text-align: left;
}
table.tabela th {
  background: var(--surface-2);
  font-weight: 600;
  color: var(--accent-2);
}
table.tabela td.num, table.tabela th.num { text-align: right; font-variant-numeric: tabular-nums; }

/* ---------- diagram (esquema de tributação) ---------- */

.esquema {
  margin: 1.8rem 0 2.2rem;
  font-family: var(--sans);
  font-size: 0.86rem;
}
.esquema .linha {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}
.esquema .caixa {
  flex: 1;
  border: 1px solid var(--rule);
  background: var(--surface);
  padding: 0.55rem 0.7rem;
  border-radius: 3px;
  line-height: 1.4;
}
.esquema .caixa.full {
  background: var(--surface-2);
  font-weight: 600;
  color: var(--accent-2);
  text-align: center;
}
.esquema .caixa small { display: block; color: var(--muted); font-size: 0.82em; margin-top: 0.15em; }
.esquema .seta {
  text-align: center;
  color: var(--muted);
  margin: 0.15rem 0;
  font-size: 0.9rem;
}

/* ---------- chapter nav ---------- */

.chapter-nav {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  margin-top: 3.5rem;
  padding-top: 1.4rem;
  border-top: 1px solid var(--rule);
  font-family: var(--sans);
  font-size: 0.88rem;
}
.chapter-nav a {
  text-decoration: none;
  color: var(--ink-soft);
  max-width: 45%;
}
.chapter-nav a:hover { color: var(--accent); }
.chapter-nav .dir {
  display: block;
  font-size: 0.72rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 0.2rem;
}
.chapter-nav .next { text-align: right; margin-left: auto; }

/* ---------- index pages ---------- */

.livro-header {
  text-align: left;
  margin-bottom: 2.5rem;
}
.livro-header h1 {
  font-family: var(--display);
  font-size: 2.4rem;
  margin: 0.2rem 0 0.6rem;
  color: var(--ink);
}
.livro-header p.tagline {
  color: var(--ink-soft);
  font-size: 1.05rem;
  max-width: 38rem;
  margin: 0;
}

ol.indice {
  list-style: none;
  margin: 0;
  padding: 0;
  border-top: 1px solid var(--rule);
}
ol.indice li {
  border-bottom: 1px solid var(--rule-soft);
}
ol.indice a {
  display: flex;
  align-items: baseline;
  gap: 0.8rem;
  padding: 0.85rem 0.2rem;
  text-decoration: none;
  color: var(--ink);
}
ol.indice a:hover { color: var(--accent); background: var(--surface); }
ol.indice .n {
  font-family: var(--display);
  font-style: italic;
  color: var(--muted);
  min-width: 1.6rem;
}
ol.indice .t { flex: 1; }
ol.indice .brevemente {
  color: var(--muted);
  pointer-events: none;
}
ol.indice .brevemente:hover { background: none; color: var(--muted); }
ol.indice .tag {
  font-family: var(--sans);
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}

.livros-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.4rem;
  margin-top: 2rem;
}
@media (max-width: 640px) { .livros-grid { grid-template-columns: 1fr; } }
.livro-card {
  border: 1px solid var(--rule);
  background: var(--surface);
  border-radius: 4px;
  padding: 1.6rem;
  text-decoration: none;
  color: var(--ink);
  display: block;
}
.livro-card:hover { border-color: var(--accent); background: var(--accent-tint); }
.livro-card h2 {
  font-family: var(--display);
  font-size: 1.4rem;
  margin: 0 0 0.4rem;
  color: var(--accent-2);
  border: none;
  padding: 0;
}
.livro-card p { margin: 0; color: var(--ink-soft); font-family: var(--sans); font-size: 0.92rem; }

.colofao {
  margin-top: 3rem;
  padding-top: 1.6rem;
  border-top: 1px solid var(--rule);
  font-family: var(--sans);
  font-size: 0.86rem;
  color: var(--ink-soft);
  line-height: 1.6;
}
.colofao h2 {
  font-family: var(--sans);
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  border: none;
  margin: 0 0 0.7rem;
  padding: 0;
}

footer.site-footer {
  position: relative;
  z-index: 1;
  text-align: center;
  font-family: var(--sans);
  font-size: 0.78rem;
  color: var(--muted);
  padding: 2rem 1.5rem 3rem;
}
