/* ============================================================
   Loja do Autor — sistema de design
   Paleta extraída da capa real do livro: brasa e ouro sobre
   marrom profundo, com o âmbar do coração da capa como acento.
   O painel "causa social" reaproveita a faixa marrom-escura da
   capa (o mesmo tom por trás do subtítulo na arte), fixa em
   ambos os temas — como uma marca, não uma cor de conteúdo.
   ============================================================ */

:root {
  --paper: #fbf2de;
  --paper-raised: #fffdf7;
  --paper-sunken: #f3e4c0;
  --ink: #3b1c0e;
  --ink-muted: #7a5237;
  --ink-faint: #a8815f;
  --line: #e8d3a6;

  --accent-solid: #d9812f;
  --accent-solid-text: #2b1206;
  --accent-text: #a8471a;
  --accent-soft: #f6dfae;

  --ember-deep: #622411;
  --ember-text: #f9d28a;
  --ember-text-muted: #d9b27c;

  --radius: 14px;
  --radius-sm: 8px;
  --shadow-sm: 0 1px 2px rgba(59, 28, 14, 0.08), 0 1px 1px rgba(59, 28, 14, 0.05);
  --shadow-md: 0 12px 28px rgba(59, 28, 14, 0.22);
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #1c0f08;
    --paper-raised: #2b1810;
    --paper-sunken: #150b05;
    --ink: #f6e7c8;
    --ink-muted: #c7a57c;
    --ink-faint: #9c7b54;
    --line: #4a2c18;

    --accent-solid: #e69555;
    --accent-solid-text: #2b1206;
    --accent-text: #f2b067;
    --accent-soft: #3a2110;

    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.35);
    --shadow-md: 0 16px 32px rgba(0, 0, 0, 0.45);
  }
}

/* ---------- Reset & base ---------- */

* {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: "Source Sans 3", -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  font-size: 17px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

img {
  max-width: 100%;
  display: block;
}

a {
  color: var(--accent-text);
}

::selection {
  background: var(--accent-soft);
  color: var(--ink);
}

:focus-visible {
  outline: 2px solid var(--accent-text);
  outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}

/* ---------- Typography ---------- */

h1,
h2,
h3 {
  font-family: "Spectral", Georgia, serif;
  font-weight: 500;
  color: var(--ink);
  margin: 0 0 0.4em;
  text-wrap: balance;
}

h1 {
  font-size: clamp(2rem, 4.6vw, 2.9rem);
  line-height: 1.12;
}

h2 {
  font-size: clamp(1.4rem, 3vw, 1.7rem);
  line-height: 1.2;
}

h3 {
  font-size: 1.15rem;
  line-height: 1.3;
}

p {
  margin: 0 0 1.1em;
}

.eyebrow {
  font-family: "Source Sans 3", sans-serif;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--accent-text);
}

/* ---------- Layout ---------- */

.container {
  max-width: 700px;
  margin: 0 auto;
  padding: 0 22px;
}

.container-wide {
  max-width: 980px;
}

.prose {
  max-width: 38rem;
}

section {
  padding: 44px 0;
}

section + section {
  border-top: 1px solid var(--line);
}

/* ---------- Buttons ---------- */

a.button,
button.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5em;
  text-decoration: none;
  background: var(--accent-solid);
  color: var(--accent-solid-text);
  padding: 14px 26px;
  border: none;
  border-radius: var(--radius-sm);
  font-family: "Source Sans 3", sans-serif;
  font-weight: 600;
  font-size: 1rem;
  text-align: center;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

a.button:hover,
button.button:hover {
  box-shadow: var(--shadow-sm);
}

a.button:active,
button.button:active {
  transform: translateY(1px);
}

a.button-quiet {
  display: inline-block;
  color: var(--accent-text);
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* ---------- Hero ---------- */

.hero {
  padding-top: 48px;
  display: grid;
  gap: 32px;
  text-align: center;
  justify-items: center;
}

.hero .cover {
  width: 270px;
  max-width: 72%;
  border-radius: 6px;
  box-shadow: var(--shadow-md);
}

.hero .cover-art {
  width: 270px;
  max-width: 72%;
  aspect-ratio: 3 / 4.3;
  border-radius: 6px;
  box-shadow: var(--shadow-md);
  background: radial-gradient(90% 70% at 50% 62%, #f9d28a 0%, #db7b3c 32%, #a3421a 58%, #622411 82%);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 28px 20px;
  color: #fcefc5;
  text-align: center;
}

.hero .cover-art .cover-title {
  font-family: "Spectral", serif;
  font-weight: 600;
  font-size: 1.35rem;
  line-height: 1.2;
  text-wrap: balance;
}

.hero .cover-art .cover-rule {
  width: 28px;
  height: 1px;
  background: #f3e6c880;
}

.hero .cover-art .cover-author {
  font-family: "Source Sans 3", sans-serif;
  font-size: 0.72rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #f3e6c8cc;
}

.hero-text {
  max-width: 34rem;
}

.hero h1 {
  margin-bottom: 0.15em;
}

.hero .author {
  font-family: "Source Sans 3", sans-serif;
  color: var(--ink-muted);
  margin: 0 0 20px;
  font-size: 0.95rem;
}

.hero .headline {
  font-family: "Spectral", serif;
  font-style: italic;
  font-weight: 500;
  font-size: 1.2rem;
  line-height: 1.45;
  color: var(--ink);
  margin: 0 0 26px;
}

/* ---------- Lede / long description ---------- */

.lede {
  font-family: "Spectral", serif;
  font-size: 1.2rem;
  line-height: 1.55;
  color: var(--ink);
}

.long-description p {
  color: var(--ink);
}

/* ---------- Target readers ---------- */

.target-readers ul {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 14px;
}

.target-readers li {
  padding-left: 1.4em;
  position: relative;
  color: var(--ink);
}

.target-readers li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.6em;
  width: 10px;
  height: 1px;
  background: var(--accent-text);
}

/* ---------- Product triptych ---------- */

.products {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
}

.product-card {
  position: relative;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 24px 22px;
  background: var(--paper-raised);
  display: flex;
  flex-direction: column;
  transition: box-shadow 0.15s ease, transform 0.15s ease;
}

.product-card:hover {
  box-shadow: var(--shadow-sm);
  transform: translateY(-2px);
}

.product-card.is-recommended {
  border-color: var(--accent-solid);
}

.product-card .tag {
  align-self: flex-start;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent-solid-text);
  background: var(--accent-solid);
  padding: 3px 9px;
  border-radius: 999px;
  margin-bottom: 12px;
}

.product-card h3 {
  margin: 0 0 4px;
}

.product-card .price {
  font-family: "Spectral", serif;
  font-size: 1.7rem;
  font-weight: 600;
  color: var(--accent-text);
  margin: 4px 0 10px;
}

.product-card p.description {
  color: var(--ink-muted);
  margin: 0 0 20px;
  flex-grow: 1;
}

/* ---------- Social cause ---------- */

.social-cause {
  background: var(--ember-deep);
  border-radius: var(--radius);
  padding: 28px 26px;
}

.social-cause .eyebrow {
  color: var(--ember-text-muted);
}

.social-cause blockquote {
  margin: 10px 0 14px;
  padding: 0;
  border: none;
  font-family: "Spectral", serif;
  font-style: italic;
  font-size: 1.15rem;
  line-height: 1.5;
  color: var(--ember-text);
}

.social-cause .note {
  color: var(--ember-text-muted);
  font-size: 0.88rem;
  margin: 0;
}

/* ---------- FAQ ---------- */

.faq-item {
  padding: 20px 0;
}

.faq-item + .faq-item {
  border-top: 1px solid var(--line);
}

.faq-item h3 {
  margin: 0 0 8px;
  font-size: 1.05rem;
}

.faq-item p {
  margin: 0;
  color: var(--ink-muted);
}

/* ---------- Final CTA ---------- */

.final-cta {
  text-align: center;
  padding-bottom: 64px;
}

.final-cta .lede {
  margin-bottom: 22px;
}

.final-cta a.button {
  font-size: 1.05rem;
  padding: 16px 34px;
}

/* ---------- WhatsApp contact ---------- */

.whatsapp-fab {
  position: fixed;
  right: 20px;
  bottom: 20px;
  width: 54px;
  height: 54px;
  border-radius: 50%;
  background: var(--accent-solid);
  color: var(--accent-solid-text);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-md);
  z-index: 20;
  transition: transform 0.15s ease;
}

.whatsapp-fab:hover {
  transform: scale(1.06);
}

/* ---------- Forms ---------- */

.form-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0 16px;
}

.form-field {
  margin-bottom: 18px;
}

.form-field label {
  display: block;
  font-weight: 600;
  margin-bottom: 6px;
  font-size: 0.92rem;
}

.form-field input[type="text"],
.form-field input[type="email"],
.form-field input[type="tel"],
.form-field input[type="password"],
.form-field select {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  font-size: 1rem;
  font-family: inherit;
  background: var(--paper-raised);
  color: var(--ink);
}

.form-field input:focus,
.form-field select:focus {
  outline: 2px solid var(--accent-text);
  outline-offset: 1px;
}

.form-field select:invalid {
  color: var(--ink-faint);
}

button.button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.checkbox-field label {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-weight: 400;
}

.checkbox-field input {
  margin-top: 4px;
}

.field-error {
  color: #b3261e;
  font-size: 0.85rem;
  margin: 6px 0 0;
}

.field-hint {
  color: var(--ink-muted);
  font-size: 0.85rem;
  margin: 6px 0 0;
}

.field-hint:empty {
  display: none;
}

form button.button {
  width: 100%;
  margin-top: 8px;
}

.pix-box {
  background: var(--paper-sunken);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 22px;
}

.pix-box .pix-key {
  font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  font-size: 0.95rem;
  background: var(--paper-raised);
  border: 1px dashed var(--accent-text);
  border-radius: var(--radius-sm);
  padding: 12px;
  word-break: break-all;
  margin: 8px 0;
}

.pix-qr {
  display: block;
  margin: 0 auto 18px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: #fff;
  padding: 10px;
}

.notice {
  background: var(--accent-soft);
  border: 1px solid var(--accent-solid);
  border-radius: var(--radius-sm);
  padding: 16px;
  font-size: 0.92rem;
  color: var(--ink);
}

.price {
  font-family: "Spectral", serif;
  font-size: 1.4rem;
  font-weight: 600;
  color: var(--accent-text);
  margin: 8px 0;
  font-variant-numeric: tabular-nums;
}

@media (min-width: 480px) {
  .form-row {
    grid-template-columns: 1fr 1fr;
  }
}

@media (min-width: 700px) {
  .products {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (min-width: 780px) {
  .hero {
    grid-template-columns: 270px 1fr;
    text-align: left;
    justify-items: start;
    align-items: center;
    gap: 44px;
  }

  .hero-text {
    max-width: none;
  }
}

/* ============================================================
   Leitor embutido — lê o e-book direto no navegador, sem
   download nem app. Conteúdo vem do próprio arquivo .epub.
   ============================================================ */

.reader-body {
  margin: 0;
}

.reader-topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--paper-raised);
  border-bottom: 1px solid var(--line);
  padding: 10px 16px;
  display: flex;
  gap: 6px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.reader-nav-link {
  font-family: "Source Sans 3", sans-serif;
  font-size: 0.78rem;
  color: var(--ink-muted);
  text-decoration: none;
  padding: 6px 10px;
  border-radius: 999px;
  white-space: nowrap;
  flex-shrink: 0;
}

.reader-nav-link:hover {
  background: var(--accent-soft);
  color: var(--ink);
}

.reader-wrap {
  max-width: 640px;
  margin: 0 auto;
  padding: 20px 22px 100px;
}

.reader-chapter {
  padding: 40px 0;
  border-bottom: 1px solid var(--line);
}

.reader-chapter:last-child {
  border-bottom: none;
}

.reader-chapter h1.chap-num {
  font-family: "Source Sans 3", sans-serif;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--accent-text);
  margin: 0 0 0.2em;
}

.reader-chapter h1.chap-title,
.reader-chapter h1.section-title {
  font-family: "Spectral", serif;
  font-size: 1.5em;
  margin-top: 0;
  color: var(--ink);
}

.reader-chapter blockquote.epigraph {
  font-style: italic;
  margin: 1.2em 0;
  padding-left: 1em;
  border-left: 3px solid var(--accent-solid);
  color: var(--ink-muted);
}

.reader-chapter p.reference {
  text-align: right;
  font-style: italic;
  color: var(--accent-text);
  margin-top: -0.8em;
}

.reader-chapter p {
  margin: 0 0 1em;
}

.reader-chapter p.signature {
  font-style: italic;
  text-align: center;
}

.reader-chapter div.titlepage {
  text-align: center;
  padding: 60px 0;
}

/* ============================================================
   Admin — tratamento utilitário (mesma paleta, mais funcional)
   ============================================================ */

.container-wide {
  max-width: 980px;
}

.admin-login {
  max-width: 380px;
}

.admin-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 18px 0;
  border-bottom: 1px solid var(--line);
}

.admin-nav a {
  color: var(--ink);
  text-decoration: none;
  font-weight: 600;
}

.link-button {
  background: none;
  border: none;
  color: var(--accent-text);
  text-decoration: underline;
  cursor: pointer;
  font-size: 1rem;
  padding: 0;
  font-family: inherit;
}

.admin-counts {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

.count-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  background: var(--paper-raised);
  text-decoration: none;
  color: var(--ink);
  transition: border-color 0.15s ease;
}

.count-card:hover {
  border-color: var(--accent-solid);
}

.count-card strong {
  font-family: "Spectral", serif;
  font-size: 1.6rem;
  color: var(--accent-text);
  font-variant-numeric: tabular-nums;
}

.admin-quick-links {
  padding-left: 20px;
}

.admin-quick-links li {
  margin-bottom: 8px;
}

.admin-quick-links a {
  color: var(--accent-text);
}

.filter-form {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: flex-end;
  margin-bottom: 24px;
}

.filter-form .form-field {
  margin-bottom: 0;
  min-width: 160px;
}

.filter-form button.button {
  width: auto;
  padding: 12px 20px;
}

.table-scroll {
  overflow-x: auto;
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--paper-raised);
}

.admin-table th,
.admin-table td {
  text-align: left;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
  font-size: 0.92rem;
  font-variant-numeric: tabular-nums;
}

.admin-table a {
  color: var(--accent-text);
}

.status-badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 600;
}

.status-pending {
  background: #fff2cc;
  color: #8a6d1a;
}

.status-paid {
  background: #dcefe1;
  color: #1f6b3d;
}

.status-delivered {
  background: #d9e8f7;
  color: #1c4a75;
}

.status-cancelled {
  background: #f8d7da;
  color: #7a2530;
}

.admin-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.admin-actions form {
  flex: 1 1 auto;
  min-width: 180px;
}

.button-danger {
  background: #b3261e;
  color: #fff;
}

@media (min-width: 640px) {
  .admin-counts {
    grid-template-columns: repeat(5, 1fr);
  }
}
