:root {
  /* Editorial palette — dark (default) */
  --bg: #121518;
  --surface: #181b1f;
  --surface-hover: #1e2227;
  --border: #2a2f35;
  --text: #dce0e5;
  --text-muted: #7a818a;
  --accent: #bfa889;
  --accent-soft: rgba(191,168,137,0.10);
  --highlight: rgba(191,168,137,0.25);
  --inner-light: rgba(255,255,255,0.045);             /* brilho concêntrico do núcleo */
  --shadow-soft: 0 18px 40px -24px rgba(0,0,0,0.60);  /* sombra ambiente difusa (no hover) */
  --font-display: 'Cormorant Garamond', Georgia, serif;
  --font-quote: 'Crimson Pro', Georgia, serif;
  --font-ui: 'Hanken Grotesk', system-ui, sans-serif;
  --radius: 0px;
  --shadow: none;
  --ease: cubic-bezier(.32,.72,0,1);                  /* easing premium com mola */
  --max-width: 1100px;
}

/* tema claro = paleta do site anavanzin.com (papel quente · ouro · tinta) */
[data-theme="light"] {
  --bg: #EFE5CF;            /* paper */
  --surface: #F4ECD8;       /* paper-card */
  --surface-hover: #ece1c6;
  --border: #d8ccab;
  --text: #211B16;          /* ink */
  --text-muted: #8a7f63;
  --accent: #B08D3C;        /* gold */
  --accent-soft: rgba(176,141,60,0.10);
  --highlight: rgba(176,141,60,0.26);
  --inner-light: rgba(255,255,255,0.55);
  --shadow-soft: 0 18px 40px -24px rgba(33,27,22,0.22);
  --shadow: none;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  font-family: var(--font-ui);
  background: var(--bg);
  color: var(--text);
  line-height: 1.65;
  min-height: 100vh;
  min-height: 100dvh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* textura de papel (pontilhado) — igual à home, só no tema claro */
[data-theme="light"] body {
  background-image: radial-gradient(rgba(33,27,22,0.045) .5px, transparent .5px);
  background-size: 4px 4px;
}

/* ── Typography imports helper (loaded via Google Fonts in HTML) ── */

/* ── Header ── */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(18,21,24,0.92);
  backdrop-filter: blur(16px) saturate(1.2);
  border-bottom: 1px solid var(--border);
  padding: 1.1rem 2rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

[data-theme="light"] .site-header {
  background: rgba(239,229,207,0.90);
}

.brand {
  display: flex;
  align-items: baseline;
  gap: 0.55rem;
}

.brand-mark {
  font-family: var(--font-display);
  font-size: 1.8rem;
  color: var(--accent);
  line-height: 1;
  opacity: 0.7;
}

.brand h1 {
  font-family: var(--font-display);
  font-weight: 300;
  font-size: 1.35rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.brand-count {
  font-size: 0.7rem;
  color: var(--text-muted);
  font-weight: 400;
  margin-left: 0.4rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.toolbar {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.search-box {
  position: relative;
  display: flex;
  align-items: center;
}

.search-box input {
  width: 260px;
  padding: 0.45rem 2.4rem 0.45rem 0.85rem;
  border-radius: 2px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-family: var(--font-ui);
  font-size: 0.8rem;
  outline: none;
  transition: border-color 0.25s, box-shadow 0.25s;
  letter-spacing: 0.01em;
}

.search-box input:focus-visible {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--highlight);
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}
.search-box input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-soft);
}

.search-box kbd {
  position: absolute;
  right: 6px;
  font-size: 0.58rem;
  padding: 1px 4px;
  border-radius: 2px;
  border: 1px solid var(--border);
  color: var(--text-muted);
  background: transparent;
  pointer-events: none;
  font-family: var(--font-ui);
}

.toolbar button {
  width: 34px;
  height: 34px;
  border-radius: 2px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: 0.95rem;
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: background .25s var(--ease), border-color .25s var(--ease), transform .25s var(--ease);
}

.toolbar button:hover {
  background: var(--surface-hover);
  border-color: var(--accent);
  transform: translateY(-1px);
}

.toolbar button:active {
  transform: scale(0.96);
}

.toolbar button svg { display: block; }

/* ── Author Tags ── */
.author-tags {
  min-height: 72px;
  max-height: 72px;
  overflow: auto;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0.7rem 2rem 0.2rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  align-items: center;
}

.tag-label {
  font-size: 0.62rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  margin-right: 0.4rem;
  font-weight: 500;
}

.tag {
  font-size: 0.72rem;
  padding: 0.22rem 0.6rem;
  border-radius: 2px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  font-family: var(--font-ui);
  transition: color .25s var(--ease), border-color .25s var(--ease), background .25s var(--ease), transform .25s var(--ease);
  white-space: nowrap;
  letter-spacing: 0.04em;
}

.tag:hover {
  border-color: var(--accent);
  color: var(--accent);
  transform: translateY(-1px);
}

.tag.active {
  background: var(--accent);
  color: var(--bg);
  border-color: var(--accent);
}

.tag small {
  opacity: 0.6;
  margin-left: 0.2rem;
  font-size: 0.65rem;
  font-weight: 500;
}

/* ── Hero — citação em destaque, cinematográfica ── */
.hero-section {
  border-bottom: 1px solid var(--border);
  padding: clamp(4rem, 12vh, 9rem) 2rem;
  min-height: min(82vh, 760px);
  display: grid;
  place-items: center;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  text-align: center;
}

/* ambiente: brilho radial superior + vinheta inferior suave */
.hero-section::after {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(120% 80% at 50% 16%, var(--accent-soft), transparent 55%),
    radial-gradient(90% 60% at 50% 122%, rgba(0,0,0,0.28), transparent 60%);
  opacity: 0.9;
  pointer-events: none;
}
[data-theme="light"] .hero-section::after {
  background: radial-gradient(120% 80% at 50% 16%, var(--accent-soft), transparent 58%);
}

.hero-inner {
  max-width: 920px;
  margin: 0 auto;
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.4rem;
}

/* overline centralizado: label · Nº, com filetes dourados */
.hero-meta {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  font-family: var(--font-ui);
  font-size: 0.62rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--text-muted);
}
.hero-meta::before, .hero-meta::after {
  content: '';
  width: clamp(24px, 6vw, 56px);
  height: 1px;
  background: linear-gradient(90deg, transparent, color-mix(in srgb, var(--accent) 60%, transparent));
}
.hero-meta::after { transform: scaleX(-1); }
.hero-label { color: var(--text-muted); }
.hero-num { color: var(--accent); opacity: 0.9; }

.hero-body {
  position: relative;
  max-width: 820px;
}

/* marca tipográfica gigante — fantasma atrás da citação */
.hero-mark {
  position: absolute;
  left: 50%;
  top: clamp(-2.6rem, -6vw, -1.4rem);
  transform: translateX(-50%);
  font-size: clamp(7rem, 18vw, 14rem);
  line-height: 1;
  color: var(--accent);
  opacity: 0.10;
  font-family: var(--font-display);
  user-select: none;
  pointer-events: none;
  z-index: -1;
}

.hero-text {
  font-family: var(--font-display);
  font-size: clamp(1.9rem, 4.4vw, 3.8rem);
  line-height: 1.18;
  color: var(--text);
  font-weight: 300;
  white-space: pre-wrap;
  letter-spacing: -0.015em;
  text-wrap: balance;
  /* rede de segurança p/ citação longa que escape da curadoria do herói */
  display: -webkit-box;
  -webkit-line-clamp: 6;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.hero-attr {
  display: block;
  margin-top: 1.4rem;
  font-style: italic;
  font-size: clamp(0.95rem, 1.4vw, 1.15rem);
  color: var(--accent);
  font-family: var(--font-quote);
  letter-spacing: 0.01em;
}

.hero-date {
  margin-top: 0.5rem;
  font-size: 0.66rem;
  color: var(--text-muted);
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

/* entrada cinematográfica no load — stagger por elemento */
@media (prefers-reduced-motion: no-preference) {
  .hero-meta { animation: heroRise .9s var(--ease) both; }
  .hero-body { animation: heroRise 1s var(--ease) .12s both; }
  .hero-attr { animation: heroRise 1s var(--ease) .22s both; }
  .hero-date { animation: heroRise 1s var(--ease) .30s both; }
  @keyframes heroRise {
    from { opacity: 0; transform: translateY(26px); filter: blur(8px); }
    to   { opacity: 1; transform: none; filter: blur(0); }
  }
}

/* scroll-cinema: ao rolar para fora, a citação encolhe/some e a marca faz
   parallax. Progressive enhancement — só onde há animation-timeline. */
@supports (animation-timeline: view()) {
  @media (prefers-reduced-motion: no-preference) {
    .hero-inner {
      animation: heroExit linear both;
      animation-timeline: view();
      animation-range: exit 0% exit 92%;
    }
    @keyframes heroExit {
      to { opacity: 0.12; transform: translateY(-28px) scale(0.965); filter: blur(2px); }
    }
    .hero-mark {
      animation: heroDrift linear both;
      animation-timeline: view();
      animation-range: cover 0% cover 100%;
    }
    @keyframes heroDrift {
      from { transform: translate(-50%, 7%); }
      to   { transform: translate(-50%, -16%); }
    }
  }
}

/* ── Masonry Grid ── */
.quotes-grid {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 3.5rem 2rem 1.5rem;
  columns: 2;
  column-gap: 2rem;
}

.quote-card {
  display: inline-block;
  width: 100%;
  break-inside: avoid;
  margin-bottom: 2rem;
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 1.8rem 2rem;
  cursor: pointer;
  transition: transform .45s var(--ease),
              border-color .35s ease,
              background .35s ease,
              box-shadow .45s var(--ease);
  position: relative;
}

/* núcleo: brilho concêntrico interno — "vidro assentado na bandeja" */
.quote-card::after {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  box-shadow: inset 0 1px 0 var(--inner-light);
}

/* entrada escalonada (fade-up + blur) — só com IntersectionObserver e sem
   reduced-motion (classe .stagger-on setada no <head>). Sem ela, os cards
   nascem visíveis: nenhum caminho deixa o conteúdo invisível. */
.stagger-on .quote-card {
  opacity: 0;
  transform: translateY(24px);
  filter: blur(4px);
}
.stagger-on .quote-card.visible {
  opacity: 1;
  transform: translateY(0);
  filter: blur(0);
}

.quote-card:hover,
.stagger-on .quote-card.visible:hover {
  border-color: var(--accent);
  background: var(--surface-hover);
  transform: translateY(-3px);
  box-shadow: var(--shadow-soft);
}

/* Editorial catalog number */
.card-catalog {
  position: absolute;
  top: 0.6rem;
  right: 0.8rem;
  font-family: var(--font-ui);
  font-size: 0.6rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-muted);
  opacity: 0.5;
  transition: opacity 0.2s;
}

.quote-card:hover .card-catalog {
  opacity: 1;
  color: var(--accent);
}

/* Thin accent line at top-left */
.quote-card::before {
  content: '';
  position: absolute;
  top: -1px;
  left: 0;
  width: 2.5rem;
  height: 1px;
  background: var(--accent);
  opacity: 0;
  transition: opacity 0.3s, width 0.4s cubic-bezier(0.22,1,0.36,1);
}

.quote-card:hover::before {
  opacity: 1;
  width: 4rem;
}

.quote-text {
  font-family: var(--font-quote);
  font-size: 1.05rem;
  line-height: 1.6;
  color: var(--text);
  white-space: pre-wrap;
}

.quote-text mark {
  background: var(--highlight);
  color: inherit;
  padding: 0 0.1em;
  border-radius: 1px;
}

.quote-attr {
  margin-top: 0.8rem;
  font-family: var(--font-quote);
  font-style: italic;
  font-size: 0.88rem;
  color: var(--accent);
  line-height: 1.4;
}

.quote-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  font-size: 0.68rem;
  color: var(--text-muted);
  border-top: 1px solid var(--border);
  padding-top: 0.7rem;
  margin-top: 1.2rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

/* Size variants based on quote length (applied via JS) */
.quote-card.size-lg .quote-text { font-size: 1.25rem; line-height: 1.5; }
.quote-card.size-sm .quote-text { font-size: 0.92rem; line-height: 1.55; }

/* ── Load More ── */
.load-more {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.6rem;
  padding: 2.5rem 1rem 4rem;
}

.load-more button {
  padding: 0.5rem 2.2rem;
  border-radius: 2px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-muted);
  font-family: var(--font-ui);
  font-size: 0.78rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  cursor: pointer;
  transition: background .25s var(--ease), border-color .25s var(--ease), color .25s var(--ease), transform .25s var(--ease);
}

.load-more button:hover {
  background: var(--surface-hover);
  border-color: var(--accent);
  color: var(--accent);
  transform: translateY(-1px);
}

.load-more button:disabled {
  opacity: 0.3;
  cursor: default;
  border-color: var(--border);
  color: var(--text-muted);
}

#progressText {
  font-size: 0.7rem;
  color: var(--text-muted);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

/* ── Empty state ── */
.empty-state {
  grid-column: 1 / -1;
  text-align: center;
  padding: 4rem 2rem;
  color: var(--text-muted);
  font-size: 0.9rem;
}

/* ── Overlay ── */
.overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  opacity: 0;
  transition: opacity 0.35s ease;
}

.overlay.active {
  display: flex;
  opacity: 1;
}

.overlay-bg {
  position: absolute;
  inset: 0;
  background: rgba(12,14,16,0.85);
  backdrop-filter: blur(20px) saturate(1.1);
}

[data-theme="light"] .overlay-bg {
  background: rgba(239,229,207,0.88);
}

.overlay-card {
  position: relative;
  max-width: 720px;
  width: 100%;
  max-height: 88vh;
  overflow-y: auto;
  padding: 3.5rem 3rem;
  z-index: 1;
  transform: translateY(20px) scale(0.98);
  transition: transform 0.4s cubic-bezier(0.22,1,0.36,1), opacity 0.35s ease;
  opacity: 0;
}

.overlay.active .overlay-card {
  transform: translateY(0) scale(1);
  opacity: 1;
}

/* Elegant frame around overlay content */
.overlay-card::before {
  content: '';
  position: absolute;
  inset: 1.5rem;
  border: 1px solid color-mix(in srgb, var(--accent) 42%, transparent);
  pointer-events: none;
  opacity: 0.8;
}

.close-overlay {
  position: absolute;
  top: 2rem;
  right: 2.2rem;
  width: 28px;
  height: 28px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 1.4rem;
  cursor: pointer;
  display: grid;
  place-items: center;
  z-index: 2;
  transition: color 0.2s;
  line-height: 1;
}

.close-overlay:hover {
  color: var(--text);
}

.overlay-num {
  font-family: var(--font-ui);
  font-size: 0.62rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 1rem;
  display: block;
}

.overlay-text {
  font-family: var(--font-display);
  font-size: clamp(1.5rem, 2.5vw, 2.2rem);
  line-height: 1.4;
  margin-bottom: 0.8rem;
  white-space: pre-wrap;
  font-weight: 300;
  letter-spacing: -0.01em;
}

.overlay-attr {
  font-family: var(--font-quote);
  font-style: italic;
  font-size: 1.05rem;
  color: var(--accent);
  margin-bottom: 1.8rem;
  letter-spacing: 0.01em;
}

.overlay-meta {
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-bottom: 2rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.overlay-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.overlay-actions button {
  padding: 0.4rem 1rem;
  border-radius: 2px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-muted);
  font-family: var(--font-ui);
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  cursor: pointer;
  transition: border-color .25s var(--ease), color .25s var(--ease), background .25s var(--ease), transform .25s var(--ease);
}

.overlay-actions button:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-soft);
  transform: translateY(-1px);
}

/* ── Scrollbar ── */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ── Footer ── */
.site-footer {
  border-top: 1px solid var(--border);
  padding: 2.5rem 2rem 3rem;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

/* ── Reduced motion: sem entrada animada nem transições de mola ── */
@media (prefers-reduced-motion: reduce) {
  .quote-card, .quote-card:hover,
  .overlay-card, .toolbar button, .tag,
  .load-more button, .overlay-actions button { transition: none !important; }
  .stagger-on .quote-card { opacity: 1; transform: none; filter: none; }
  html { scroll-behavior: auto; }
}

/* ── Mobile ── */
@media (max-width: 768px) {
  .site-header { padding: 0.9rem 1.2rem; }
  .search-box input { width: 160px; font-size: 0.78rem; }
  .brand h1 { font-size: 1.15rem; }
  .hero-section { padding: clamp(3rem, 9vh, 5rem) 1.2rem; min-height: auto; }
  .hero-mark { font-size: clamp(5rem, 26vw, 8rem); top: clamp(-1.8rem, -7vw, -1rem); }
  .quotes-grid { columns: 1; padding: 1.5rem 1.2rem; column-gap: 0; }
  .quote-card { padding: 1.4rem 1.5rem; margin-bottom: 1.2rem; }
  .quote-text { font-size: 1rem; }
  .quote-card.size-lg .quote-text { font-size: 1.15rem; }
  .overlay-card { padding: 2rem 1.5rem; }
  .overlay-text { font-size: 1.35rem; }
  .overlay-card::before { inset: 0.8rem; }
}

@media (max-width: 480px) {
  .brand { width: 100%; justify-content: space-between; }
  .toolbar { width: 100%; justify-content: flex-end; }
  .search-box input { width: 100%; flex: 1; }
  .hero-text { font-size: clamp(1.7rem, 8vw, 2.3rem); }
}
