/* ===========================================================
   Eliézer Magalhães — elimaga.com
   Design system & styles
   =========================================================== */
:root {
  --paper:      #FAF7F2;
  --paper-2:    #F3EDE2;
  --card:       #FFFFFF;
  --ink:        #1C1B19;
  --ink-soft:   #423D37;
  --muted:      #7C756C;
  --line:       #E5DCCD;
  --accent:     #C0562F;   /* terracotta */
  --accent-dk:  #9E4322;
  --teal:       #12433E;   /* deep teal */
  --gold:       #B0812F;
  --radius:     16px;
  --radius-sm:  10px;
  --shadow:     0 1px 2px rgba(28,27,25,.04), 0 12px 34px -12px rgba(28,27,25,.18);
  --shadow-sm:  0 1px 2px rgba(28,27,25,.05), 0 6px 18px -10px rgba(28,27,25,.16);
  --maxw:       1160px;
  --serif: "Fraunces", Georgia, "Times New Roman", serif;
  --sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 84px; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--sans);
  color: var(--ink);
  background: var(--paper);
  line-height: 1.65;
  font-size: 17px;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
img { max-width: 100%; display: block; }
a { color: var(--accent-dk); text-decoration: none; }
a:hover { color: var(--accent); }

h1, h2, h3, h4 { font-family: var(--serif); font-weight: 600; line-height: 1.12; color: var(--ink); margin: 0 0 .5em; letter-spacing: -.01em; }
h2 { font-size: clamp(1.9rem, 4vw, 2.8rem); }
h3 { font-size: 1.35rem; }
p { margin: 0 0 1.1em; }

.wrap { max-width: var(--maxw); margin-inline: auto; padding-inline: 24px; }
.section { padding: clamp(64px, 9vw, 120px) 0; }
.section--alt { background: var(--paper-2); }
.section--ink { background: var(--teal); color: #F3ECE0; }
.section--ink h2, .section--ink h3 { color: #FBF6EC; }

.eyebrow {
  font-family: var(--sans); font-weight: 600; font-size: .78rem;
  letter-spacing: .18em; text-transform: uppercase; color: var(--accent);
  margin: 0 0 14px; display: flex; align-items: center; gap: 12px;
}
.eyebrow::before { content: ""; width: 34px; height: 2px; background: var(--accent); display: inline-block; }
.section--ink .eyebrow { color: var(--gold); }
.section--ink .eyebrow::before { background: var(--gold); }
.section-head { max-width: 720px; margin-bottom: 52px; }
.section-head p { color: var(--muted); font-size: 1.08rem; margin-bottom: 0; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 9px;
  font-family: var(--sans); font-weight: 600; font-size: .96rem;
  padding: 13px 24px; border-radius: 999px; cursor: pointer;
  border: 1.5px solid transparent; transition: .2s ease; white-space: nowrap;
}
.btn--primary { background: var(--accent); color: #fff; }
.btn--primary:hover { background: var(--accent-dk); color: #fff; transform: translateY(-2px); }
.btn--ghost { background: transparent; color: var(--ink); border-color: var(--line); }
.btn--ghost:hover { border-color: var(--ink); color: var(--ink); transform: translateY(-2px); }
.btn--light { background: #F3ECE0; color: var(--teal); }
.btn--light:hover { background: #fff; color: var(--teal); }
.btn--sm { padding: 9px 18px; font-size: .86rem; }

/* ---------- Header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: rgba(250,247,242,.82); backdrop-filter: saturate(160%) blur(12px);
  border-bottom: 1px solid transparent; transition: border-color .3s, box-shadow .3s;
}
.site-header.scrolled { border-color: var(--line); box-shadow: 0 6px 24px -18px rgba(0,0,0,.4); }
.nav { display: flex; align-items: center; justify-content: space-between; height: 72px; }
.brand { display: flex; align-items: center; gap: 12px; font-family: var(--serif); font-weight: 600; font-size: 1.18rem; color: var(--ink); letter-spacing: -.01em; }
.brand:hover { color: var(--ink); }
.brand .mono {
  width: 40px; height: 40px; border-radius: 10px; background: var(--ink); color: var(--gold);
  display: grid; place-items: center; font-size: .95rem; font-weight: 600; letter-spacing: .02em;
}
.brand small { display: block; font-family: var(--sans); font-weight: 500; font-size: .66rem; letter-spacing: .16em; text-transform: uppercase; color: var(--muted); margin-top: 2px; }
.nav-links { display: flex; align-items: center; gap: 30px; list-style: none; margin: 0; padding: 0; }
.nav-links a { font-family: var(--sans); font-weight: 500; font-size: .95rem; color: var(--ink-soft); }
.nav-links a:hover { color: var(--accent); }
.nav-cta { margin-left: 6px; }
.nav-toggle { display: none; background: none; border: 0; cursor: pointer; padding: 8px; }
.nav-toggle span { display: block; width: 24px; height: 2px; background: var(--ink); margin: 5px 0; transition: .25s; }

/* ---------- Hero ---------- */
.hero { position: relative; overflow: hidden; padding: clamp(48px, 7vw, 96px) 0 clamp(56px, 8vw, 104px); }
.hero::before {
  content: ""; position: absolute; inset: 0; z-index: 0; pointer-events: none;
  background:
    radial-gradient(60% 55% at 82% 12%, rgba(192,86,47,.10), transparent 60%),
    radial-gradient(50% 50% at 8% 90%, rgba(18,67,62,.08), transparent 60%);
}
.hero-grid { position: relative; z-index: 1; display: grid; grid-template-columns: 1.05fr .95fr; gap: clamp(32px, 5vw, 72px); align-items: center; }
.hero-kicker { font-family: var(--sans); font-weight: 600; letter-spacing: .16em; text-transform: uppercase; font-size: .8rem; color: var(--accent); margin-bottom: 20px; }
.hero h1 { font-size: clamp(2.6rem, 6.2vw, 4.5rem); line-height: 1.02; margin-bottom: .32em; }
.hero h1 em { font-style: italic; color: var(--accent); }
.hero .lead { font-size: 1.16rem; color: var(--ink-soft); max-width: 40ch; }
.hero-roles { display: flex; flex-wrap: wrap; gap: 10px 8px; margin: 0 0 30px; padding: 0; list-style: none; }
.hero-roles li { font-size: .82rem; font-weight: 600; color: var(--teal); background: rgba(18,67,62,.08); border: 1px solid rgba(18,67,62,.14); padding: 6px 14px; border-radius: 999px; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 14px; }

.hero-photo { position: relative; }
.hero-photo .frame {
  position: relative; border-radius: 20px; overflow: hidden; box-shadow: var(--shadow);
  border: 6px solid #fff; rotate: 1.4deg; transition: rotate .4s ease;
}
.hero-photo .frame:hover { rotate: 0deg; }
.hero-photo img { width: 100%; aspect-ratio: 4/5; object-fit: cover; }
.hero-photo .badge {
  position: absolute; left: -18px; bottom: 26px; z-index: 2; background: var(--ink); color: #fff;
  padding: 14px 20px; border-radius: 14px; box-shadow: var(--shadow); rotate: -3deg;
}
.hero-photo .badge b { font-family: var(--serif); font-size: 1.5rem; color: var(--gold); display: block; line-height: 1; }
.hero-photo .badge span { font-size: .72rem; letter-spacing: .1em; text-transform: uppercase; color: #d8d2c8; }

/* ---------- Stats ---------- */
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 24px; margin-top: 8px; }
.stat { text-align: center; padding: 8px; }
.stat b { font-family: var(--serif); font-size: clamp(2rem, 4vw, 2.9rem); color: var(--accent); display: block; line-height: 1; }
.stat span { font-size: .86rem; color: var(--muted); display: block; margin-top: 8px; }

/* ---------- About ---------- */
.about-grid { display: grid; grid-template-columns: 1.4fr 1fr; gap: clamp(32px, 5vw, 64px); align-items: start; }
.about-body p { font-size: 1.08rem; color: var(--ink-soft); }
.tag-cloud { display: flex; flex-wrap: wrap; gap: 9px; margin-top: 8px; }
.tag { font-size: .84rem; font-weight: 500; color: var(--ink-soft); background: var(--card); border: 1px solid var(--line); padding: 7px 14px; border-radius: 999px; }
.about-card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 30px; box-shadow: var(--shadow-sm); }
.about-card h3 { color: var(--accent); font-size: 1.05rem; letter-spacing: .04em; text-transform: uppercase; font-family: var(--sans); font-weight: 700; margin-bottom: 18px; }
.about-card ul { list-style: none; margin: 0; padding: 0; }
.about-card li { display: flex; gap: 12px; padding: 11px 0; border-bottom: 1px solid var(--line); font-size: .96rem; }
.about-card li:last-child { border-bottom: 0; }
.about-card li .yr { color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; font-size: .86rem; padding-top: 2px; }

/* ---------- Books ---------- */
.books-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 34px; }
.book-card { display: flex; flex-direction: column; }
.book-card .cover {
  position: relative; border-radius: 10px; overflow: hidden; box-shadow: var(--shadow);
  transition: transform .3s ease, box-shadow .3s ease; background: var(--paper-2);
  aspect-ratio: 2/3;
}
.book-card:hover .cover { transform: translateY(-6px); box-shadow: 0 20px 40px -16px rgba(28,27,25,.4); }
.book-card .cover img { width: 100%; height: 100%; object-fit: cover; }
.book-card .cover .ed { position: absolute; top: 10px; right: 10px; background: rgba(28,27,25,.86); color: #fff; font-size: .68rem; font-weight: 600; letter-spacing: .04em; padding: 4px 10px; border-radius: 999px; }
.book-card h3 { margin: 18px 0 4px; font-size: 1.22rem; }
.book-card .meta { font-size: .82rem; color: var(--muted); margin-bottom: 10px; }
.book-card p { font-size: .95rem; color: var(--ink-soft); margin-bottom: 16px; }
.book-card .card-actions { margin-top: auto; display: flex; gap: 10px; flex-wrap: wrap; }

/* ---------- Books detail page ---------- */
.book-detail { display: grid; grid-template-columns: 300px 1fr; gap: 48px; align-items: start; padding: clamp(40px,6vw,64px) 0; border-bottom: 1px solid var(--line); }
.book-detail:last-of-type { border-bottom: 0; }
.book-detail .cover { border-radius: 10px; overflow: hidden; box-shadow: var(--shadow); position: sticky; top: 96px; }
.book-detail .cover img { width: 100%; aspect-ratio: 2/3; object-fit: cover; }
.book-detail .bd-meta { display: flex; flex-wrap: wrap; gap: 8px; margin: 4px 0 20px; }
.book-detail .bd-meta span { font-size: .8rem; color: var(--ink-soft); background: var(--paper-2); border: 1px solid var(--line); padding: 5px 12px; border-radius: 999px; }
.book-detail h2 { margin-bottom: 6px; }
.book-detail .themes { list-style: none; padding: 0; margin: 20px 0 26px; display: grid; grid-template-columns: repeat(2,1fr); gap: 8px 22px; }
.book-detail .themes li { position: relative; padding-left: 22px; font-size: .95rem; color: var(--ink-soft); }
.book-detail .themes li::before { content: ""; position: absolute; left: 0; top: .62em; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); }

/* ---------- Timeline / Trajetória ---------- */
.tl-cols { display: grid; grid-template-columns: repeat(2,1fr); gap: 48px 56px; }
.tl h3 { font-family: var(--sans); font-weight: 700; font-size: .95rem; letter-spacing: .08em; text-transform: uppercase; color: var(--accent); margin-bottom: 22px; padding-bottom: 12px; border-bottom: 2px solid var(--line); }
.section--ink .tl h3 { color: var(--gold); border-color: rgba(255,255,255,.15); }
.tl ul { list-style: none; margin: 0; padding: 0; }
.tl li { position: relative; padding: 0 0 22px 26px; }
.tl li::before { content: ""; position: absolute; left: 3px; top: 7px; width: 9px; height: 9px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 4px rgba(192,86,47,.14); }
.tl li::after { content: ""; position: absolute; left: 7px; top: 20px; bottom: -2px; width: 2px; background: var(--line); }
.section--ink .tl li::after { background: rgba(255,255,255,.14); }
.tl li:last-child::after { display: none; }
.tl li b { display: block; font-weight: 600; font-size: 1rem; }
.tl li .org { font-size: .92rem; color: var(--muted); }
.section--ink .tl li .org { color: #cdbfae; }
.tl li .yr { font-size: .78rem; font-weight: 600; letter-spacing: .04em; color: var(--teal); background: rgba(18,67,62,.09); padding: 2px 9px; border-radius: 999px; display: inline-block; margin-bottom: 4px; }
.section--ink .tl li .yr { color: var(--gold); background: rgba(176,129,47,.18); }

/* ---------- Publications ---------- */
.pub-grid { display: grid; grid-template-columns: repeat(2,1fr); gap: 30px; }
.pub-card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 30px; box-shadow: var(--shadow-sm); }
.pub-card h3 { font-family: var(--sans); font-weight: 700; font-size: .92rem; letter-spacing: .06em; text-transform: uppercase; color: var(--accent); margin-bottom: 18px; }
.pub-card ul { list-style: none; margin: 0; padding: 0; }
.pub-card li { padding: 12px 0; border-bottom: 1px solid var(--line); font-size: .95rem; color: var(--ink-soft); }
.pub-card li:last-child { border-bottom: 0; }
.pub-card li i { color: var(--ink); font-style: italic; }
.pub-card li .src { display: block; color: var(--muted); font-size: .84rem; margin-top: 2px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chips span { font-size: .86rem; background: var(--paper-2); border: 1px solid var(--line); padding: 6px 14px; border-radius: 999px; }

/* ---------- Contact ---------- */
.contact-grid { display: grid; grid-template-columns: 1fr 1.1fr; gap: clamp(32px,5vw,64px); align-items: start; }
.contact-info p { color: #E3D9C9; font-size: 1.06rem; max-width: 42ch; }
.contact-list { list-style: none; padding: 0; margin: 28px 0 0; }
.contact-list li { display: flex; align-items: center; gap: 14px; padding: 14px 0; border-bottom: 1px solid rgba(255,255,255,.12); }
.contact-list a { color: #FBF6EC; font-weight: 500; }
.contact-list a:hover { color: var(--gold); }
.contact-list .ic { width: 42px; height: 42px; border-radius: 11px; background: rgba(255,255,255,.08); display: grid; place-items: center; flex-shrink: 0; }
.contact-list .ic svg { width: 20px; height: 20px; stroke: var(--gold); }
.contact-list small { display: block; color: #b9ad9c; font-size: .78rem; letter-spacing: .06em; text-transform: uppercase; }
.socials { display: flex; gap: 12px; margin-top: 26px; }
.socials a { width: 46px; height: 46px; border-radius: 12px; background: rgba(255,255,255,.08); display: grid; place-items: center; transition: .2s; }
.socials a:hover { background: var(--gold); transform: translateY(-3px); }
.socials svg { width: 22px; height: 22px; fill: #FBF6EC; }
.socials a:hover svg { fill: var(--teal); }

.form-card { background: #fff; border-radius: var(--radius); padding: 32px; box-shadow: var(--shadow); }
.form-card h3 { color: var(--ink); margin-bottom: 6px; }
.form-card .sub { color: var(--muted); font-size: .94rem; margin-bottom: 22px; }
.field { margin-bottom: 18px; }
.field label { display: block; font-size: .82rem; font-weight: 600; color: var(--ink-soft); margin-bottom: 7px; letter-spacing: .02em; }
.field input, .field textarea {
  width: 100%; font-family: var(--sans); font-size: 1rem; color: var(--ink);
  padding: 13px 15px; border: 1.5px solid var(--line); border-radius: var(--radius-sm);
  background: var(--paper); transition: border-color .2s, box-shadow .2s;
}
.field input:focus, .field textarea:focus { outline: 0; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(192,86,47,.12); background: #fff; }
.field textarea { resize: vertical; min-height: 130px; }
.form-note { font-size: .82rem; color: var(--muted); margin-top: 14px; }
.form-msg { padding: 13px 16px; border-radius: var(--radius-sm); font-size: .92rem; margin-bottom: 18px; display: none; }
.form-msg.ok { display: block; background: #e8f3ec; color: #1f6b3f; border: 1px solid #bfe0cd; }
.form-msg.err { display: block; background: #fbeae6; color: #a5391f; border: 1px solid #f0c9bf; }

/* ---------- Footer ---------- */
.site-footer { background: var(--ink); color: #cfc8bd; padding: 56px 0 30px; }
.footer-top { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 30px; align-items: flex-start; padding-bottom: 34px; border-bottom: 1px solid rgba(255,255,255,.1); }
.footer-brand { font-family: var(--serif); font-size: 1.4rem; color: #fff; margin-bottom: 8px; }
.footer-brand + p { font-size: .92rem; max-width: 34ch; color: #a79f93; }
.footer-nav { display: flex; flex-wrap: wrap; gap: 10px 26px; list-style: none; padding: 0; margin: 0; }
.footer-nav a { color: #cfc8bd; font-size: .92rem; }
.footer-nav a:hover { color: var(--gold); }
.footer-bottom { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 12px; padding-top: 24px; font-size: .82rem; color: #8c8478; }

/* ---------- Reveal on scroll ---------- */
.reveal { opacity: 0; transform: translateY(24px); transition: opacity .7s cubic-bezier(.2,.7,.2,1), transform .7s cubic-bezier(.2,.7,.2,1); }
.reveal.in { opacity: 1; transform: none; }

/* ---------- Page hero (secondary pages) ---------- */
.page-hero { padding: clamp(56px,8vw,104px) 0 clamp(32px,5vw,56px); background: var(--paper-2); border-bottom: 1px solid var(--line); }
.page-hero h1 { font-size: clamp(2.2rem, 5vw, 3.6rem); }
.page-hero p { color: var(--muted); font-size: 1.1rem; max-width: 60ch; margin-bottom: 0; }
.breadcrumb { font-size: .84rem; color: var(--muted); margin-bottom: 18px; }
.breadcrumb a { color: var(--accent-dk); }

/* ---------- Responsive ---------- */
@media (max-width: 940px) {
  .hero-grid, .about-grid, .contact-grid { grid-template-columns: 1fr; }
  .hero-photo { max-width: 380px; margin-inline: auto; order: -1; }
  .books-grid { grid-template-columns: repeat(2,1fr); }
  .pub-grid, .tl-cols { grid-template-columns: 1fr; gap: 34px; }
  .book-detail { grid-template-columns: 200px 1fr; gap: 30px; }
  .book-detail .cover { position: static; }
}
@media (max-width: 760px) {
  .nav-links { position: fixed; inset: 72px 0 auto; flex-direction: column; background: var(--paper); border-bottom: 1px solid var(--line); padding: 16px 24px 24px; gap: 4px; align-items: stretch; transform: translateY(-140%); transition: transform .32s ease; box-shadow: var(--shadow); }
  .nav-links.open { transform: translateY(0); }
  .nav-links a { padding: 12px 4px; border-bottom: 1px solid var(--line); }
  .nav-links .nav-cta { margin: 12px 0 0; }
  .nav-toggle { display: block; }
  .nav-toggle.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
  .nav-toggle.open span:nth-child(2) { opacity: 0; }
  .nav-toggle.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }
  .stats { grid-template-columns: repeat(2,1fr); gap: 30px 16px; }
  .book-detail { grid-template-columns: 1fr; }
  .book-detail .cover { max-width: 220px; }
  .book-detail .themes { grid-template-columns: 1fr; }
}
@media (max-width: 460px) {
  .books-grid { grid-template-columns: 1fr; max-width: 300px; margin-inline: auto; }
  body { font-size: 16px; }
}
@media (prefers-reduced-motion: reduce) {
  * { scroll-behavior: auto !important; }
  .reveal { opacity: 1; transform: none; transition: none; }
}
