:root {
  --ink: #1c241c;
  --ink-soft: #3a4036;
  --green-deep: #1b3329;
  --green-mid: #2f5343;
  --green-leaf: #4a6b54;
  --mint: #b7c9b4;
  --olive: #5b6840;
  --blue-ink: #2a4460;
  --blue-wash: #6d86a0;
  --beige: #e7dcc8;
  --paper: #f3eee4;
  --paper-2: #efe6d6;
  --cream: #faf6ee;
  --earth: #8a5a3a;
  --terra: #a35d3d;
  --line: rgba(36, 42, 34, 0.14);
  --shadow: 0 18px 40px rgba(28, 36, 28, 0.12);
  --serif: "Fraunces", "Source Serif 4", "Palatino Linotype", Palatino, serif;
  --body: "Source Serif 4", "Georgia", serif;
  --ui: "Source Sans 3", "Segoe UI", sans-serif;
  --max: 72rem;
  --gutter: clamp(1.1rem, 3vw, 2.2rem);
}

*,
*::before,
*::after { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(1200px 500px at 10% -10%, rgba(45, 83, 67, 0.16), transparent 50%),
    radial-gradient(900px 420px at 100% 0%, rgba(42, 68, 96, 0.12), transparent 46%),
    linear-gradient(180deg, #ece4d4 0%, var(--paper) 18%, #f6f1e8 100%);
  font-family: var(--body);
  font-size: 1.0625rem;
  line-height: 1.65;
  min-height: 100vh;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image: url("../img/papel.webp");
  background-size: 900px 600px;
  opacity: 0.18;
  mix-blend-mode: multiply;
  z-index: 0;
}

img { max-width: 100%; height: auto; }

a {
  color: var(--blue-ink);
  text-underline-offset: 0.16em;
}

a:hover { color: var(--green-mid); }

:focus-visible {
  outline: 3px solid var(--olive);
  outline-offset: 3px;
}

.skip {
  position: absolute;
  left: 0.8rem;
  top: -40rem;
  background: var(--green-deep);
  color: var(--cream);
  padding: 0.6rem 0.9rem;
  z-index: 20;
}

.skip:focus { top: 0.8rem; }

.site-header {
  position: relative;
  z-index: 5;
  background:
    linear-gradient(180deg, rgba(27, 51, 41, 0.97), rgba(24, 42, 36, 0.94));
  color: var(--cream);
  border-bottom: 1px solid rgba(231, 220, 200, 0.12);
}

.header-inner {
  width: min(var(--max), 100% - var(--gutter) * 2);
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.2rem;
  padding: 0.85rem 0;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  text-decoration: none;
  color: inherit;
  min-width: 0;
}

.brand img {
  width: min(13.5rem, 52vw);
  height: auto;
  display: block;
}

.brand-fallback {
  font-family: var(--ui);
  font-weight: 700;
  letter-spacing: 0.12em;
  font-size: 1.1rem;
}

.nav-toggle {
  display: none;
  border: 1px solid rgba(247, 242, 232, 0.28);
  background: transparent;
  color: var(--cream);
  font-family: var(--ui);
  padding: 0.45rem 0.7rem;
}

.site-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 1rem;
  justify-content: flex-end;
}

.site-nav a {
  color: #efe7d6;
  text-decoration: none;
  font-family: var(--ui);
  font-size: 0.92rem;
  letter-spacing: 0.01em;
}

.site-nav a[aria-current="page"],
.site-nav a:hover { color: var(--mint); }

.hero {
  position: relative;
  z-index: 1;
  overflow: hidden;
  padding: clamp(2.4rem, 6vw, 5.2rem) 0 clamp(2.8rem, 6vw, 4.5rem);
}

.hero-grid {
  width: min(var(--max), 100% - var(--gutter) * 2);
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: clamp(1.5rem, 4vw, 3.5rem);
  align-items: end;
}

.kicker {
  font-family: var(--ui);
  text-transform: uppercase;
  letter-spacing: 0.16em;
  font-size: 0.78rem;
  color: var(--olive);
  margin: 0 0 0.7rem;
}

.hero h1,
.page-head h1 {
  font-family: var(--serif);
  font-weight: 560;
  font-size: clamp(2.1rem, 5.4vw, 4.15rem);
  line-height: 1.05;
  letter-spacing: -0.03em;
  margin: 0 0 1rem;
}

.lede {
  font-size: 1.2rem;
  max-width: 38rem;
  color: var(--ink-soft);
}

.hero-visual {
  position: relative;
  min-height: 22rem;
}

.hero-visual .territorio {
  width: 100%;
  max-width: 34rem;
  margin-left: auto;
  display: block;
  filter: saturate(0.85);
}

.hero-visual .seta {
  position: absolute;
  left: -6%;
  bottom: -8%;
  width: min(11rem, 38vw);
  transform: rotate(-8deg);
  filter: drop-shadow(0 16px 18px rgba(28, 36, 28, 0.22));
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  font-family: var(--ui);
  text-decoration: none;
  border: 0;
  cursor: pointer;
  padding: 0.78rem 1.15rem;
  background: var(--green-deep);
  color: var(--cream);
  box-shadow: 0 0 0 1px rgba(255,255,255,0.06) inset;
}

.btn:hover { background: var(--green-mid); color: #fff; }

.btn-ghost {
  background: transparent;
  color: var(--green-deep);
  box-shadow: inset 0 0 0 1px var(--green-mid);
}

.actions { display: flex; flex-wrap: wrap; gap: 0.7rem; margin-top: 1.4rem; }

.wrap {
  width: min(var(--max), 100% - var(--gutter) * 2);
  margin: 0 auto;
  position: relative;
  z-index: 1;
}

.page-head { padding: 2.2rem 0 1.4rem; }

.breadcrumbs {
  font-family: var(--ui);
  font-size: 0.86rem;
  color: var(--ink-soft);
  margin: 0;
  padding: 1rem 0 0;
}

.breadcrumbs ol {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  padding: 0;
  margin: 0;
}

.breadcrumbs li:not(:last-child)::after {
  content: "/";
  margin-left: 0.35rem;
  opacity: 0.55;
}

.period-strip {
  display: flex;
  gap: 0.55rem;
  overflow-x: auto;
  padding: 0.2rem 0 1rem;
  scrollbar-width: thin;
}

.period-strip a {
  flex: 0 0 auto;
  font-family: var(--ui);
  font-size: 0.84rem;
  text-decoration: none;
  color: var(--ink);
  background: rgba(255,255,255,0.38);
  border: 1px solid var(--line);
  padding: 0.45rem 0.7rem;
}

.period-strip a[aria-current="page"] {
  background: var(--green-deep);
  color: var(--cream);
  border-color: var(--green-deep);
}

.toolbar {
  position: sticky;
  top: 0;
  z-index: 4;
  background: rgba(243, 238, 228, 0.92);
  backdrop-filter: blur(10px);
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  padding: 0.75rem 0;
}

.toolbar-grid {
  display: grid;
  grid-template-columns: 1.2fr repeat(3, 0.8fr) auto;
  gap: 0.55rem;
  align-items: end;
}

.field { display: flex; flex-direction: column; gap: 0.25rem; }

.field label,
.meta-label {
  font-family: var(--ui);
  font-size: 0.74rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--olive);
}

.field input,
.field select {
  font: inherit;
  font-family: var(--ui);
  padding: 0.55rem 0.6rem;
  border: 1px solid rgba(36, 42, 34, 0.2);
  background: #fffdf8;
  color: var(--ink);
  width: 100%;
}

.period-indicator {
  font-family: var(--ui);
  font-size: 0.92rem;
  margin: 0.85rem 0 0;
  color: var(--blue-ink);
}

.timeline {
  position: relative;
  padding: 1.6rem 0 4rem;
}

.timeline::before {
  content: "";
  position: absolute;
  left: 7.2rem;
  top: 0;
  bottom: 0;
  width: 2px;
  background: linear-gradient(180deg, transparent, var(--green-mid), var(--earth), transparent);
}

.event {
  position: relative;
  display: grid;
  grid-template-columns: 6.4rem 1fr;
  gap: 1.5rem;
  margin: 0 0 1.15rem;
  scroll-margin-top: 6.5rem;
}

.event::before {
  content: "";
  position: absolute;
  left: 6.75rem;
  top: 1.15rem;
  width: 0.85rem;
  height: 0.85rem;
  border-radius: 50%;
  background: var(--paper);
  box-shadow: 0 0 0 3px var(--green-mid);
  z-index: 1;
}

.event-date {
  font-family: var(--ui);
  font-size: 0.86rem;
  color: var(--earth);
  padding-top: 0.85rem;
  text-align: right;
}

.ficha {
  background:
    linear-gradient(180deg, rgba(255,253,248,0.92), rgba(247,240,226,0.9));
  border: 1px solid rgba(90, 72, 48, 0.14);
  box-shadow: var(--shadow);
  padding: 1.05rem 1.15rem 1.15rem;
  clip-path: polygon(0 0, calc(100% - 1.1rem) 0, 100% 1.1rem, 100% 100%, 0 100%);
}

.ficha-top {
  display: flex;
  justify-content: space-between;
  gap: 0.8rem;
  align-items: baseline;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.chip {
  font-family: var(--ui);
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 0.18rem 0.4rem;
  background: rgba(45, 83, 67, 0.1);
  color: var(--green-deep);
}

.ficha h2,
.prose h2 {
  font-family: var(--serif);
  font-size: clamp(1.25rem, 2vw, 1.65rem);
  line-height: 1.2;
  margin: 0.35rem 0 0.55rem;
}

.ficha h2 a { color: inherit; text-decoration: none; }
.ficha h2 a:hover { color: var(--blue-ink); }

.event-nav {
  display: flex;
  justify-content: space-between;
  gap: 0.7rem;
  margin: 0 0 1.2rem;
}

details.detalhe {
  margin-top: 0.7rem;
  border-top: 1px dashed rgba(90, 72, 48, 0.22);
  padding-top: 0.55rem;
}

details.detalhe summary {
  cursor: pointer;
  font-family: var(--ui);
  color: var(--green-deep);
  font-weight: 600;
}

.detalhe-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.85rem 1.2rem;
  margin-top: 0.8rem;
}

.detalhe-grid p { margin: 0.2rem 0 0; }

.empty-state {
  display: none;
  padding: 2rem 0 4rem;
  text-align: center;
}

.timeline.is-empty .empty-state { display: block; }

.prose { max-width: 44rem; }

.prose h2, .prose h3 { font-family: var(--serif); }

.prose + .prose, .stack > * + * { margin-top: 1rem; }

.columns-2 {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: 2rem;
}

.note {
  background: rgba(42, 68, 96, 0.07);
  border-left: 4px solid var(--blue-ink);
  padding: 0.85rem 1rem;
}

.source-list { padding-left: 1.1rem; }

.person-grid,
.glossary-grid,
.home-periods {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
}

.tile {
  background: rgba(255,253,248,0.72);
  border: 1px solid var(--line);
  padding: 1rem 1.05rem 1.15rem;
  text-decoration: none;
  color: inherit;
  display: block;
}

.tile h2, .tile h3 {
  font-family: var(--serif);
  margin: 0.2rem 0 0.4rem;
  font-size: 1.35rem;
}

.tile:hover { border-color: var(--green-mid); }

.site-footer {
  position: relative;
  z-index: 1;
  margin-top: 2rem;
  background: var(--green-deep);
  color: #e8e0d0;
  padding: 2.4rem 0 1.6rem;
}

.footer-grid {
  display: grid;
  grid-template-columns: 1.2fr 1fr 1fr;
  gap: 1.5rem;
}

.site-footer a { color: var(--mint); }

.site-footer h2 {
  font-family: var(--ui);
  font-size: 0.8rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  margin: 0 0 0.6rem;
}

.mini-list { list-style: none; padding: 0; margin: 0; }
.mini-list li { margin: 0.28rem 0; }

.legal { margin-top: 1.6rem; font-size: 0.88rem; opacity: 0.8; }

.is-hidden { display: none !important; }

.contact-box {
  background: #fffdf8;
  border: 1px solid var(--line);
  padding: 1.1rem 1.2rem;
  max-width: 30rem;
}

.ficha-catalogo {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(16.5rem, 1fr));
  gap: 1.4rem 1.6rem;
  padding: 0 0 3.2rem;
}

.ficha-catalogo h2 {
  font-family: var(--serif);
  font-size: 1.25rem;
  margin: 0 0 0.55rem;
}

.ficha-catalogo ol {
  list-style: none;
  margin: 0;
  padding: 0;
}

.ficha-catalogo li { margin: 0 0 0.7rem; }

.ficha-catalogo a {
  text-decoration: none;
  color: inherit;
  display: block;
}

.ficha-catalogo a:hover { color: var(--blue-ink); }

.ficha-catalogo time {
  display: block;
  font-family: var(--ui);
  font-size: 0.75rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--earth);
}

@media (max-width: 980px) {
  .hero-grid,
  .columns-2,
  .toolbar-grid,
  .detalhe-grid,
  .footer-grid,
  .person-grid,
  .glossary-grid,
  .home-periods {
    grid-template-columns: 1fr;
  }

  .timeline::before { left: 0.55rem; }
  .event { grid-template-columns: 1fr; padding-left: 1.5rem; }
  .event::before { left: 0.28rem; }
  .event-date { text-align: left; padding-top: 0; }
  .hero-visual { min-height: 14rem; }
  .nav-toggle { display: inline-flex; }
  .site-nav {
    display: none;
    position: absolute;
    right: var(--gutter);
    top: 100%;
    background: #1b3329;
    padding: 0.8rem 1rem 1rem;
    flex-direction: column;
    min-width: 14rem;
    box-shadow: var(--shadow);
  }
  .site-nav.is-open { display: flex; }
  .header-inner { position: relative; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}
