/* Masterbook do Frete Lucrativo — folha de estilo editorial */

@import url('https://fonts.googleapis.com/css2?family=Anton&family=Fraunces:opsz,wght,SOFT@9..144,300..900,30..100&family=Inter:wght@400;500;600;700&display=swap');

:root {
  --paper: #FAFAF7;
  --ink: #0A0A0A;
  --ink-soft: #1F1F1D;
  --muted: #6B6B66;
  --rule: #D9D5C9;
  --watermark: #ECECEC;
  --accent: #8B6F2A;
  --accent-soft: #F5EFE0;
  --accent-deep: #2D2308;
  --gold: #C9A961;
  --critical: #B71C1C;
  --critical-soft: #FBEAEA;
  --max: 1240px;
  --col: 720px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  background: var(--paper);
  color: var(--ink);
  font-family: 'Fraunces', Georgia, serif;
  font-size: 18px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

.display, .num-display {
  font-family: 'Anton', 'Bebas Neue', sans-serif;
  letter-spacing: 0.01em;
  font-weight: 400;
}

.sans { font-family: 'Inter', sans-serif; }

/* ===== HEADER ===== */
header.book-header {
  border-bottom: 1px solid var(--rule);
  background: var(--paper);
  position: sticky;
  top: 0;
  z-index: 50;
  backdrop-filter: blur(8px);
  background-color: rgba(250, 250, 247, 0.92);
}
.book-header__inner {
  max-width: var(--max);
  margin: 0 auto;
  padding: 14px 32px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-family: 'Inter', sans-serif;
  font-size: 12px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}
.book-header__brand { color: var(--ink); font-weight: 600; }
.book-header__crumb { color: var(--muted); }
.book-header__crumb a { color: var(--muted); text-decoration: none; }
.book-header__crumb a:hover { color: var(--ink); }

/* ===== HERO CAPÍTULO ===== */
.chapter-hero {
  max-width: var(--max);
  margin: 0 auto;
  padding: 96px 32px 64px;
  position: relative;
}
.chapter-hero::before {
  content: 'FRETE LUCRATIVO';
  font-family: 'Anton', sans-serif;
  font-size: clamp(120px, 18vw, 280px);
  color: var(--watermark);
  position: absolute;
  top: 40px;
  right: 32px;
  line-height: 0.85;
  white-space: nowrap;
  pointer-events: none;
  z-index: 0;
}
.chapter-hero__inner { position: relative; z-index: 1; }

.chapter-eyebrow {
  font-family: 'Inter', sans-serif;
  font-size: 13px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--gold);
  margin-bottom: 16px;
}

.chapter-num {
  font-family: 'Anton', sans-serif;
  font-size: clamp(80px, 12vw, 160px);
  line-height: 0.9;
  color: var(--accent);
  margin-bottom: 8px;
}

.chapter-title {
  font-family: 'Fraunces', serif;
  font-weight: 400;
  font-size: clamp(36px, 5vw, 56px);
  line-height: 1.05;
  letter-spacing: -0.02em;
  margin-bottom: 32px;
  max-width: 900px;
}
.chapter-title em {
  font-style: italic;
  font-feature-settings: 'opsz' 144;
  color: var(--accent);
}

.chapter-meta {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 24px;
  padding-top: 24px;
  border-top: 1px solid var(--rule);
  max-width: 900px;
}
.chapter-meta__item {
  font-family: 'Inter', sans-serif;
}
.chapter-meta__label {
  font-size: 11px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 6px;
}
.chapter-meta__value {
  font-size: 15px;
  color: var(--ink);
  line-height: 1.4;
}
.chapter-meta__value strong { font-weight: 600; }

/* ===== LEAD ===== */
.lead {
  max-width: var(--col);
  margin: 0 auto;
  padding: 56px 32px;
}
.lead p {
  font-family: 'Fraunces', serif;
  font-size: 22px;
  line-height: 1.55;
  letter-spacing: -0.005em;
  color: var(--ink-soft);
  margin-bottom: 24px;
}
.lead p:first-child::first-letter {
  font-family: 'Anton', sans-serif;
  font-size: 78px;
  float: left;
  line-height: 0.85;
  padding: 10px 12px 0 0;
  color: var(--accent);
}

/* ===== NÚMEROS CHAVE ===== */
.numbers-strip {
  background: var(--ink);
  color: var(--paper);
  padding: 56px 32px;
  margin: 24px 0;
}
.numbers-strip__inner {
  max-width: var(--max);
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 28px 36px;
}
.num-card {
  border-left: 2px solid var(--gold);
  padding-left: 16px;
  padding-right: 14px;
  min-width: 0;
  overflow: hidden;
}
.num-card__value {
  font-family: 'Anton', sans-serif;
  font-size: clamp(26px, 2.8vw, 38px);
  line-height: 1.05;
  letter-spacing: 0.005em;
  color: var(--paper);
  margin-bottom: 10px;
  overflow-wrap: break-word;
  word-break: break-word;
  hyphens: none;
}
.num-card__label {
  font-family: 'Inter', sans-serif;
  font-size: 11.5px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--watermark);
  line-height: 1.45;
  overflow-wrap: break-word;
  word-break: normal;
}

/* ===== SUBSEÇÕES ===== */
.section {
  max-width: var(--col);
  margin: 0 auto;
  padding: 64px 32px 24px;
}
.section--wide {
  max-width: var(--max);
}

.section__num {
  font-family: 'Anton', sans-serif;
  font-size: 20px;
  color: var(--gold);
  letter-spacing: 0.12em;
  margin-bottom: 12px;
}
.section h2 {
  font-family: 'Fraunces', serif;
  font-weight: 500;
  font-size: clamp(28px, 3.5vw, 40px);
  line-height: 1.15;
  letter-spacing: -0.02em;
  margin-bottom: 32px;
  max-width: 600px;
}
.section h3 {
  font-family: 'Fraunces', serif;
  font-weight: 500;
  font-size: 24px;
  line-height: 1.3;
  margin: 40px 0 16px;
  color: var(--accent);
}
.section p {
  font-family: 'Fraunces', serif;
  font-size: 18px;
  line-height: 1.7;
  margin-bottom: 20px;
  color: var(--ink-soft);
}
.section strong { font-weight: 600; color: var(--ink); }

/* ===== PULL QUOTE ===== */
.pullquote {
  margin: 48px -24px;
  padding: 40px 32px;
  background: var(--paper);
  border-left: 4px solid var(--gold);
  position: relative;
}
.pullquote::before {
  content: '“';
  font-family: 'Fraunces', serif;
  font-size: 120px;
  line-height: 0.5;
  color: var(--gold);
  position: absolute;
  top: 40px;
  left: 24px;
  opacity: 0.25;
}
.pullquote__text {
  font-family: 'Fraunces', serif;
  font-style: italic;
  font-size: clamp(22px, 2.5vw, 28px);
  line-height: 1.4;
  letter-spacing: -0.01em;
  color: var(--ink);
  margin-bottom: 16px;
  padding-left: 8px;
}
.pullquote__cite {
  font-family: 'Inter', sans-serif;
  font-size: 13px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--muted);
  padding-left: 8px;
}
.pullquote__cite strong { color: var(--ink); font-weight: 600; }

/* ===== ALERT BOX (crítico) ===== */
.alert {
  background: var(--critical-soft);
  border: 1px solid var(--critical);
  padding: 28px 32px;
  margin: 32px 0;
  border-left-width: 4px;
}
.alert__label {
  font-family: 'Inter', sans-serif;
  font-size: 11px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--critical);
  font-weight: 600;
  margin-bottom: 8px;
}
.alert__text {
  font-family: 'Fraunces', serif;
  font-size: 18px;
  line-height: 1.55;
  color: var(--ink);
}

/* ===== ACTION CARD ===== */
.actions {
  background: var(--accent-deep);
  color: var(--paper);
  padding: 64px 32px;
  margin: 64px 0 0;
}
.actions__inner {
  max-width: var(--col);
  margin: 0 auto;
}
.actions__eyebrow {
  font-family: 'Inter', sans-serif;
  font-size: 12px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--gold);
  margin-bottom: 12px;
}
.actions h2 {
  font-family: 'Fraunces', serif;
  font-weight: 500;
  font-size: clamp(28px, 3vw, 36px);
  line-height: 1.2;
  color: var(--paper);
  margin-bottom: 32px;
}
.actions ol {
  list-style: none;
  counter-reset: act;
}
.actions ol li {
  counter-increment: act;
  padding: 20px 0;
  border-bottom: 1px solid rgba(250, 250, 247, 0.18);
  display: flex;
  gap: 24px;
  font-family: 'Fraunces', serif;
  font-size: 19px;
  line-height: 1.5;
}
.actions ol li::before {
  content: counter(act, decimal-leading-zero);
  font-family: 'Anton', sans-serif;
  font-size: 28px;
  color: var(--gold);
  min-width: 48px;
}

/* ===== FOOTER CAPÍTULO ===== */
footer.chapter-footer {
  max-width: var(--max);
  margin: 0 auto;
  padding: 48px 32px;
  border-top: 1px solid var(--rule);
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  font-family: 'Inter', sans-serif;
  font-size: 13px;
  color: var(--muted);
  gap: 16px;
}
.chapter-footer a {
  color: var(--ink);
  text-decoration: none;
  border-bottom: 1px solid var(--rule);
  padding-bottom: 2px;
}
.chapter-footer a:hover { border-color: var(--ink); }

/* =====================================================
   NOTEBOOK — caderno do leitor (fim de cada capítulo)
   ===================================================== */
.notebook {
  max-width: var(--col);
  margin: 0 auto;
  padding: clamp(64px, 8vh, 112px) clamp(24px, 4vw, 48px) clamp(48px, 6vh, 80px);
  border-top: 1px solid var(--rule);
}
.notebook__eyebrow {
  font-family: 'Inter', sans-serif;
  font-size: 11px;
  letter-spacing: 0.32em;
  text-transform: uppercase;
  color: var(--gold);
  margin-bottom: 14px;
}
.notebook__title {
  font-family: 'Fraunces', serif;
  font-weight: 500;
  font-size: clamp(26px, 3.2vw, 36px);
  line-height: 1.15;
  letter-spacing: -0.02em;
  color: var(--ink);
  margin-bottom: 10px;
}
.notebook__hint {
  font-family: 'Inter', sans-serif;
  font-size: 13px;
  letter-spacing: 0.04em;
  color: var(--muted);
  margin-bottom: 40px;
  max-width: 580px;
}
.notebook__field {
  display: flex;
  flex-direction: column;
  margin-bottom: 24px;
}
.notebook__field label {
  font-family: 'Inter', sans-serif;
  font-size: 11px;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 10px;
}
.notebook__field textarea,
.notebook__field input[type="text"],
.notebook__field input[type="date"] {
  font-family: 'Fraunces', serif;
  font-size: 18px;
  line-height: 1.5;
  color: var(--ink);
  background: transparent;
  border: 0;
  border-bottom: 1px solid var(--rule);
  padding: 10px 4px;
  outline: none;
  width: 100%;
  resize: vertical;
  transition: border-color 220ms cubic-bezier(0.16, 1, 0.3, 1);
}
.notebook__field textarea {
  min-height: 180px;
  line-height: 28px;
  background-image: repeating-linear-gradient(
    to bottom,
    transparent 0,
    transparent 27px,
    var(--rule) 27px,
    var(--rule) 28px
  );
  background-attachment: local;
  padding-top: 4px;
}
.notebook__field input[type="date"] {
  font-family: 'Inter', sans-serif;
  font-size: 15px;
  color: var(--ink);
  letter-spacing: 0.04em;
}
.notebook__field textarea:focus,
.notebook__field input:focus {
  border-bottom-color: var(--accent);
}
.notebook__field--notes { margin-bottom: 40px; }
.notebook__grid {
  display: grid;
  grid-template-columns: minmax(0, 2.2fr) minmax(0, 1fr);
  gap: 24px 40px;
  margin-bottom: 32px;
}
.notebook__grid .notebook__field { margin-bottom: 0; }
.notebook__actions {
  display: flex;
  gap: 14px;
  align-items: center;
  margin-top: 40px;
  flex-wrap: wrap;
}
.notebook__btn {
  font-family: 'Inter', sans-serif;
  font-size: 11px;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  padding: 14px 22px;
  background: var(--accent-deep);
  color: var(--paper);
  border: 0;
  cursor: pointer;
  transition: background 200ms ease, transform 220ms cubic-bezier(0.16, 1, 0.3, 1);
}
.notebook__btn:hover { background: var(--ink); }
.notebook__btn:active { transform: translateY(1px); }
.notebook__btn--ghost {
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--rule);
}
.notebook__btn--ghost:hover {
  color: var(--ink);
  border-color: var(--ink);
  background: transparent;
}
.notebook__saved {
  font-family: 'Inter', sans-serif;
  font-size: 10px;
  letter-spacing: 0.32em;
  text-transform: uppercase;
  color: var(--muted);
  margin-left: auto;
  opacity: 0;
  transition: opacity 320ms ease;
}
.notebook__saved.is-on { opacity: 1; }
.notebook__saved::before {
  content: '●';
  margin-right: 6px;
  color: var(--accent);
}
@media (max-width: 640px) {
  .notebook__grid { grid-template-columns: 1fr; gap: 24px; }
  .notebook__actions { gap: 10px; }
  .notebook__btn { padding: 12px 18px; font-size: 10px; }
  .notebook__saved { margin-left: 0; width: 100%; text-align: left; }
}
@media print {
  .notebook { page-break-before: always; }
  .notebook__actions { display: none !important; }
  .notebook__saved { display: none !important; }
  .notebook__field textarea,
  .notebook__field input[type="text"],
  .notebook__field input[type="date"] {
    border-bottom: 1px solid var(--ink) !important;
    background-image: none !important;
    color: var(--ink) !important;
  }
}

/* ===== UTILS ===== */
.rule { height: 1px; background: var(--rule); margin: 32px 0; max-width: var(--col); margin-left: auto; margin-right: auto; }

@media print {
  header.book-header, .chapter-footer { display: none; }
  .numbers-strip, .actions { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}

@media (max-width: 720px) {
  .chapter-hero { padding: 64px 24px 48px; }
  .chapter-hero::before { font-size: clamp(80px, 25vw, 140px); top: 60px; }
  .lead { padding: 32px 24px; }
  .section { padding: 48px 24px 16px; }
  .pullquote { margin: 32px -8px; padding: 28px 24px; }
  .numbers-strip { padding: 40px 24px; }
  .actions { padding: 48px 24px; }
}

/* =====================================================
   MOTION (Jakub primary + Emil secondary)
   Reveal recipe: opacity + translateY 8 + blur 4 → 0
   Spring-flavored ease, ~560ms, stagger sutil, 1x only
   ===================================================== */
.reveal {
  opacity: 0;
  transform: translateY(8px);
  filter: blur(4px);
  will-change: opacity, transform, filter;
  transition:
    opacity 560ms cubic-bezier(0.16, 1, 0.3, 1),
    transform 560ms cubic-bezier(0.16, 1, 0.3, 1),
    filter 560ms cubic-bezier(0.16, 1, 0.3, 1);
  transition-delay: var(--rev-delay, 0ms);
}
.reveal.is-in {
  opacity: 1;
  transform: translateY(0);
  filter: blur(0);
}
/* Numbers strip dark bg overrides: keep blur subtler */
.numbers-strip .reveal { filter: blur(3px); }
.numbers-strip .reveal.is-in { filter: blur(0); }

/* Reading progress (chapter pages only) */
.reading-progress {
  position: fixed;
  top: 0;
  left: 0;
  height: 2px;
  width: var(--progress, 0%);
  background: var(--accent);
  z-index: 100;
  transition: width 140ms linear;
  pointer-events: none;
}

/* ===== HOVER REFINEMENTS (Jakub polish, Emil restraint sub-200ms) ===== */
.toc__item {
  transition: background 220ms cubic-bezier(0.16, 1, 0.3, 1);
  position: relative;
}
.toc__item::after {
  content: '→';
  position: absolute;
  right: 4px;
  top: 50%;
  transform: translateY(-50%) translateX(-10px);
  opacity: 0;
  font-family: 'Inter', sans-serif;
  font-size: 18px;
  color: var(--accent);
  pointer-events: none;
  transition:
    opacity 200ms cubic-bezier(0.16, 1, 0.3, 1),
    transform 360ms cubic-bezier(0.16, 1, 0.3, 1);
}
.toc__item:hover::after,
.toc__item:focus-visible::after {
  opacity: 1;
  transform: translateY(-50%) translateX(0);
}
.toc__num {
  transition: color 260ms cubic-bezier(0.16, 1, 0.3, 1), transform 320ms cubic-bezier(0.16, 1, 0.3, 1);
}
.toc__item:hover .toc__num {
  color: var(--ink);
  transform: translateX(4px);
}
.toc__item--pending:hover .toc__num,
.toc__item--pending::after { display: none; }

.chapter-footer a {
  background-image: linear-gradient(currentColor, currentColor);
  background-size: 0% 1px;
  background-repeat: no-repeat;
  background-position: 0 100%;
  border-bottom: 0;
  transition: background-size 320ms cubic-bezier(0.16, 1, 0.3, 1), color 200ms ease;
}
.chapter-footer a:hover {
  background-size: 100% 1px;
}

.hero__attribution-link {
  transition: color 200ms ease, letter-spacing 280ms cubic-bezier(0.16, 1, 0.3, 1);
}
.hero__attribution-link:hover {
  letter-spacing: 0.26em;
}

.pullquote {
  transition: transform 480ms cubic-bezier(0.16, 1, 0.3, 1);
}
.pullquote::before {
  transition: opacity 360ms cubic-bezier(0.16, 1, 0.3, 1), transform 600ms cubic-bezier(0.16, 1, 0.3, 1);
}
.pullquote:hover::before {
  opacity: 0.4;
  transform: translateX(-50%) translateY(-4px);
}

/* ===== REDUCED MOTION (mandatory) ===== */
@media (prefers-reduced-motion: reduce) {
  .reveal,
  .reveal.is-in {
    opacity: 1 !important;
    transform: none !important;
    filter: none !important;
    transition: none !important;
  }
  .reading-progress { transition: none; }
  .toc__item::after { transition: none; }
  .pullquote, .pullquote::before { transition: none; }
  html { scroll-behavior: auto; }
}

/* ===== PRINT (motion off + progress hidden) ===== */
@media print {
  .reveal, .reveal.is-in {
    opacity: 1 !important;
    transform: none !important;
    filter: none !important;
  }
  .reading-progress { display: none !important; }
}
