:root {
  /* Tokens aligned with the main approved design (theme.css) */
  --ink-900: #061a28;
  --ink-800: #0a2538;
  --ink-700: #0f3551;
  --ink-600: #1c4f72;
  --gold-700: #8a6a3a;
  --gold-600: #a98552;
  --gold-500: #c9a66b;
  --gold-400: #ddbe89;
  --gold-300: #ecd9b3;
  --paper-50: #fbf8f2;
  --paper-100: #f6f0e6;
  --paper-200: #ede4d4;
  --sage-700: #52685c;
  --sage-100: #dfe7df;
  --text: #182733;
  --text-soft: #43586a;
  --text-faint: #7c8a96;
  --text-on-dark: #f3ece0;
  --text-on-dark-soft: rgba(243, 236, 224, 0.72);
  --rule: rgba(15, 53, 81, 0.14);
  --rule-strong: rgba(15, 53, 81, 0.28);
  --rule-on-dark: rgba(243, 236, 224, 0.14);
  --rule-on-dark-strong: rgba(243, 236, 224, 0.32);
  --shadow-1: 0 1px 2px rgba(6, 26, 40, 0.06), 0 6px 18px rgba(6, 26, 40, 0.06);
  --shadow-2: 0 18px 40px rgba(6, 26, 40, 0.14), 0 6px 14px rgba(6, 26, 40, 0.08);
  --font-serif: "Fraunces", "Cormorant Garamond", Georgia, serif;
  --font-sans: "Inter Tight", "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-mono: "JetBrains Mono", "SF Mono", Consolas, monospace;
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
  --header-h: 84px;
  --container-w: 1280px;
  --gutter: clamp(20px, 3vw, 48px);
  --tracking-display: -0.018em;
  --tracking-eyebrow: 0.18em;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  scroll-behavior: smooth;
  background: var(--paper-50);
}

body {
  margin: 0;
  min-height: 100%;
  font-family: var(--font-sans);
  color: var(--text);
  background:
    linear-gradient(180deg, rgba(237, 228, 212, 0.65), transparent 360px),
    var(--paper-50);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  opacity: 0.28;
  background-image:
    linear-gradient(rgba(6, 26, 40, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(6, 26, 40, 0.035) 1px, transparent 1px);
  background-size: 48px 48px;
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

a {
  color: inherit;
  text-decoration: none;
}

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

::selection {
  background: rgba(201, 166, 107, 0.35);
}

:focus-visible {
  outline: 2px solid var(--gold-600);
  outline-offset: 3px;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  height: var(--header-h);
  color: var(--text-on-dark);
  background: rgba(6, 26, 40, 0.94);
  border-bottom: 1px solid var(--rule-on-dark);
  backdrop-filter: saturate(140%) blur(14px);
  -webkit-backdrop-filter: saturate(140%) blur(14px);
}

.header-shell {
  width: min(100% - calc(var(--gutter) * 2), var(--container-w));
  height: 100%;
  margin-inline: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.brand-mark {
  display: inline-flex;
  align-items: center;
  height: 56px;
}
.brand-mark img {
  height: 100%;
  width: auto;
  display: block;
}

.site-nav {
  display: flex;
  gap: 4px;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.site-nav a {
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  padding: 0 14px;
  font-size: 0.92rem;
  font-weight: 500;
  letter-spacing: 0.01em;
  color: rgba(243, 236, 224, 0.78);
  border-radius: 999px;
  transition: color 180ms var(--ease), background 180ms var(--ease);
}

.site-nav a:hover {
  color: var(--text-on-dark);
  background: rgba(243, 236, 224, 0.08);
}

.site-nav .back-link {
  margin-left: 8px;
  height: 40px;
  padding: 0 16px;
  color: var(--gold-300);
  border: 1px solid var(--rule-on-dark-strong);
  font-weight: 500;
}
.site-nav .back-link:hover {
  color: var(--ink-900);
  background: var(--gold-500);
  border-color: var(--gold-500);
}
.site-nav .back-link span {
  margin-right: 6px;
  transition: transform 180ms var(--ease);
}
.site-nav .back-link:hover span {
  transform: translateX(-3px);
}

@media (max-width: 720px) {
  .site-nav .back-link { display: none; }
  .brand-mark { height: 44px; }
}

.hero {
  position: relative;
  min-height: 640px;
  display: grid;
  align-items: center;
  overflow: hidden;
  isolation: isolate;
  color: var(--text-on-dark);
  background: var(--ink-900);
}

.hero-media {
  position: absolute;
  inset: 0;
  z-index: 0;
  background:
    linear-gradient(105deg, rgba(6, 26, 40, 0.92) 0%, rgba(6, 26, 40, 0.62) 48%, rgba(6, 26, 40, 0.18) 100%),
    linear-gradient(180deg, rgba(6, 26, 40, 0.0) 40%, rgba(6, 26, 40, 0.78) 100%),
    image-set(
      url("./assets/rodovalho-hero.webp") type("image/webp"),
      url("./assets/rodovalho-hero.png") type("image/png")
    ) center 30% / cover no-repeat;
  transform: scale(1.04);
  animation: hero-zoom 18s var(--ease) forwards;
}
@keyframes hero-zoom {
  to { transform: scale(1); }
}

.hero::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background-image: linear-gradient(to right, rgba(243, 236, 224, 0.04) 1px, transparent 1px);
  background-size: calc(100% / 12) 100%;
}

.hero-shell {
  position: relative;
  z-index: 2;
  width: min(var(--container-w), calc(100% - calc(var(--gutter) * 2)));
  margin: 0 auto;
  padding: 96px 0 84px;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  margin: 0;
  font-family: var(--font-sans);
  font-size: 0.78rem;
  font-weight: 500;
  letter-spacing: var(--tracking-eyebrow);
  text-transform: uppercase;
  color: var(--gold-700);
}

.eyebrow::before {
  content: "";
  width: 32px;
  height: 1px;
  background: currentColor;
  opacity: 0.7;
}

.eyebrow-mark::before {
  display: none;
}

/* On dark sections */
.hero .eyebrow,
.cta-section .eyebrow {
  color: var(--gold-400);
}

.hero h1,
.cta-section h2,
.reader-panel h2,
.results-head h2 {
  font-family: var(--font-serif);
  font-weight: 300;
  line-height: 1.02;
  letter-spacing: var(--tracking-display);
}

.hero h1 {
  max-width: 980px;
  margin: 28px 0 0;
  font-size: clamp(2.8rem, 1.8rem + 4vw, 5.2rem);
  text-wrap: balance;
}
.hero h1 em {
  font-style: italic;
  font-weight: 300;
  color: var(--gold-400);
}

.hero-copy {
  max-width: 62ch;
  margin: 28px 0 0;
  color: var(--text-on-dark-soft);
  font-size: 1.12rem;
  line-height: 1.72;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 34px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 46px;
  padding: 0 18px;
  border: 1px solid transparent;
  border-radius: 999px;
  font-weight: 600;
  transition: transform 180ms var(--ease), background 180ms var(--ease), color 180ms var(--ease), border-color 180ms var(--ease);
}

.btn:hover {
  transform: translateY(-1px);
}

.btn-primary {
  color: var(--ink-900);
  background: var(--gold-600);
}

.btn-primary:hover {
  background: var(--gold-500);
}

.btn-ghost {
  color: var(--text-on-dark);
  border-color: rgba(245, 239, 229, 0.28);
}

.btn-ghost:hover {
  border-color: var(--gold-300);
}

.btn-soft {
  width: 100%;
  color: var(--ink-800);
  background: var(--paper-200);
  border-color: var(--rule);
}

.stats-band {
  width: min(1180px, calc(100% - 48px));
  margin: -32px auto 0;
  position: relative;
  z-index: 2;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  background: var(--paper-50);
  border: 1px solid var(--rule);
  box-shadow: var(--shadow-2);
}

.stat {
  padding: 24px;
  border-right: 1px solid var(--rule);
}

.stat:last-child {
  border-right: 0;
}

.stat span {
  display: block;
  font-family: var(--font-serif);
  font-size: 2.05rem;
  color: var(--ink-800);
  line-height: 1;
}

.stat strong {
  display: block;
  margin-top: 10px;
  color: var(--text-soft);
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.11em;
}

.notice {
  width: min(1180px, calc(100% - 48px));
  margin: 28px auto 0;
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 14px 18px;
  color: var(--ink-800);
  background: var(--sage-100);
  border: 1px solid rgba(82, 104, 92, 0.28);
}

.notice span {
  color: var(--text-soft);
}

.workspace {
  width: min(1400px, calc(100% - 48px));
  margin: 34px auto 90px;
  display: grid;
  grid-template-columns: 300px minmax(360px, 0.95fr) minmax(460px, 1.4fr);
  gap: 18px;
  align-items: start;
  scroll-margin-top: 94px;
}

.control-panel,
.results-panel,
.reader-panel {
  background: rgba(251, 248, 242, 0.94);
  border: 1px solid var(--rule);
  box-shadow: var(--shadow-1);
}

.control-panel {
  position: sticky;
  top: 96px;
  padding: 18px;
}

.search-box,
.filters {
  display: grid;
  gap: 14px;
}

.search-box label,
.filters label {
  display: grid;
  gap: 7px;
  color: var(--text-soft);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

input,
select {
  width: 100%;
  min-height: 44px;
  padding: 0 12px;
  color: var(--text);
  background: #fffdf8;
  border: 1px solid var(--rule-strong);
  border-radius: 6px;
}

input:focus,
select:focus {
  border-color: var(--gold-600);
  outline: none;
  box-shadow: 0 0 0 3px rgba(169, 133, 82, 0.14);
}

.filters {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--rule);
}

.tab-list {
  display: grid;
  gap: 6px;
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px solid var(--rule);
}

.tab-button {
  width: 100%;
  min-height: 40px;
  padding: 0 12px;
  text-align: left;
  color: var(--ink-800);
  background: transparent;
  border: 1px solid transparent;
  border-radius: 6px;
}

.tab-button:hover,
.tab-button.is-active {
  color: var(--text-on-dark);
  background: var(--ink-800);
  border-color: var(--ink-800);
}

.results-panel {
  min-height: 720px;
  padding: 20px;
}

.results-head {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 18px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--rule);
}

.results-head h2 {
  margin: 8px 0 0;
  font-size: 2rem;
  color: var(--ink-800);
}

#results-count {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 0 10px;
  color: var(--ink-700);
  background: var(--paper-100);
  border: 1px solid var(--rule);
  border-radius: 999px;
  font-size: 0.82rem;
  white-space: nowrap;
}

.overview-panel {
  display: grid;
  gap: 14px;
  margin-top: 18px;
}

.overview-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.overview-tile {
  padding: 16px;
  background: var(--paper-100);
  border: 1px solid var(--rule);
  border-radius: 8px;
}

.overview-tile strong {
  display: block;
  color: var(--ink-800);
  font-family: var(--font-serif);
  font-size: 1.25rem;
  font-weight: 420;
}

.overview-tile span {
  display: block;
  margin-top: 8px;
  color: var(--text-soft);
  line-height: 1.55;
}

.quick-themes {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.theme-chip {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 0 12px;
  color: var(--ink-800);
  background: #fffdf8;
  border: 1px solid var(--rule);
  border-radius: 999px;
  font-size: 0.88rem;
}

.theme-chip:hover {
  border-color: var(--gold-600);
}

.results-list {
  display: grid;
  gap: 10px;
  margin-top: 18px;
  max-height: 760px;
  overflow: auto;
  padding-right: 4px;
}

.result-item {
  width: 100%;
  display: grid;
  gap: 8px;
  padding: 14px;
  text-align: left;
  color: var(--text);
  background: #fffdf8;
  border: 1px solid var(--rule);
  border-radius: 8px;
  transition: border-color 180ms var(--ease), transform 180ms var(--ease), box-shadow 180ms var(--ease);
}

.result-item:hover,
.result-item.is-active {
  border-color: var(--gold-600);
  transform: translateY(-1px);
  box-shadow: 0 10px 22px rgba(6, 26, 40, 0.08);
}

.result-meta,
.reader-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  color: var(--gold-700);
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.result-item h3 {
  margin: 0;
  color: var(--ink-800);
  font-family: var(--font-serif);
  font-size: 1.15rem;
  font-weight: 430;
  line-height: 1.18;
}

.result-item p {
  margin: 0;
  color: var(--text-soft);
  line-height: 1.48;
}

.tag-list,
.ref-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.tag,
.ref-link {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 0 8px;
  color: var(--ink-700);
  background: var(--paper-100);
  border: 1px solid var(--rule);
  border-radius: 999px;
  font-size: 0.75rem;
}

.ref-link {
  color: var(--text-on-dark);
  background: var(--ink-700);
  border-color: var(--ink-700);
}

.reader-panel {
  min-height: 720px;
  position: sticky;
  top: 96px;
  max-height: calc(100dvh - 118px);
  overflow: auto;
}

.reader-empty {
  min-height: 520px;
  display: grid;
  align-content: center;
  padding: 42px;
  color: var(--text-soft);
}

.reader-empty h2 {
  margin: 12px 0 0;
  color: var(--ink-800);
  font-size: 2.3rem;
}

.reader-empty p:last-child {
  margin-top: 14px;
  max-width: 48ch;
  line-height: 1.65;
}

.reader-hero {
  padding: 28px;
  color: var(--text-on-dark);
  background:
    linear-gradient(135deg, rgba(6, 26, 40, 0.96), rgba(15, 53, 81, 0.92)),
    var(--ink-900);
}

.reader-hero h2 {
  margin: 14px 0 0;
  color: var(--text-on-dark);
  font-size: 2.2rem;
}

.reader-hero p {
  margin: 14px 0 0;
  color: rgba(245, 239, 229, 0.78);
  line-height: 1.62;
}

.reader-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 18px;
}

.reader-action {
  min-height: 36px;
  padding: 0 12px;
  color: var(--text-on-dark);
  background: rgba(245, 239, 229, 0.08);
  border: 1px solid rgba(245, 239, 229, 0.2);
  border-radius: 999px;
}

.reader-action:hover {
  border-color: var(--gold-300);
}

.reader-body {
  padding: 26px 28px 34px;
}

.detail-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 20px;
}

.detail {
  padding: 12px;
  background: var(--paper-100);
  border: 1px solid var(--rule);
  border-radius: 8px;
}

.detail span {
  display: block;
  color: var(--text-faint);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.detail strong {
  display: block;
  margin-top: 4px;
  color: var(--ink-800);
  font-size: 0.94rem;
  line-height: 1.35;
}

.section-title {
  margin: 24px 0 12px;
  color: var(--ink-800);
  font-family: var(--font-serif);
  font-size: 1.35rem;
  font-weight: 430;
}

.legal-text {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  margin: 0;
  padding: 18px;
  color: #1c2d38;
  background: #fffdf8;
  border: 1px solid var(--rule);
  border-radius: 8px;
  font-family: var(--font-serif);
  font-size: 1.02rem;
  line-height: 1.72;
}

.source-link {
  color: var(--ink-700);
  border-bottom: 1px solid var(--gold-600);
}

.empty-state {
  padding: 26px;
  color: var(--text-soft);
  background: var(--paper-100);
  border: 1px dashed var(--rule-strong);
  border-radius: 8px;
}

.cta-section {
  width: min(1180px, calc(100% - 48px));
  margin: 0 auto 80px;
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 28px;
  padding: 34px;
  color: var(--text-on-dark);
  background: var(--ink-900);
  border: 1px solid var(--rule-on-dark);
}

.cta-section h2 {
  max-width: 780px;
  margin: 14px 0 0;
  color: var(--text-on-dark);
  font-size: 2.4rem;
}

.site-footer {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  padding: 26px 32px;
  color: rgba(245, 239, 229, 0.72);
  background: var(--ink-900);
  border-top: 1px solid var(--rule-on-dark);
}

.site-footer div {
  display: grid;
  gap: 4px;
}

.site-footer strong {
  color: var(--text-on-dark);
  font-family: var(--font-serif);
  font-weight: 430;
}

.site-footer a {
  color: var(--gold-300);
}

@media (max-width: 1180px) {
  .workspace {
    grid-template-columns: 290px minmax(0, 1fr);
  }

  .reader-panel {
    grid-column: 1 / -1;
    position: static;
    max-height: none;
  }
}

@media (max-width: 900px) {
  .site-header {
    position: relative;
    align-items: start;
    flex-direction: column;
    padding: 16px 20px;
  }

  .brand-mark {
    min-width: 0;
  }

  .site-nav {
    width: 100%;
    justify-content: flex-start;
  }

  .hero {
    min-height: 560px;
  }

  .hero h1 {
    font-size: 2.75rem;
  }

  .hero-shell,
  .stats-band,
  .notice,
  .workspace,
  .cta-section {
    width: min(100% - 32px, 1180px);
  }

  .stats-band {
    grid-template-columns: 1fr 1fr;
  }

  .stat:nth-child(2) {
    border-right: 0;
  }

  .stat:nth-child(-n + 2) {
    border-bottom: 1px solid var(--rule);
  }

  .notice {
    align-items: start;
    flex-direction: column;
  }

  .workspace {
    grid-template-columns: 1fr;
  }

  .control-panel {
    position: static;
  }

  .overview-grid,
  .detail-grid {
    grid-template-columns: 1fr;
  }

  .results-list {
    max-height: 560px;
  }

  .cta-section,
  .site-footer {
    align-items: start;
    flex-direction: column;
  }

  .cta-section h2 {
    font-size: 2rem;
  }
}

@media (max-width: 560px) {
  .hero h1 {
    font-size: 2.25rem;
  }

  .hero-copy {
    font-size: 1rem;
  }

  .stats-band {
    grid-template-columns: 1fr;
  }

  .stat,
  .stat:nth-child(2) {
    border-right: 0;
    border-bottom: 1px solid var(--rule);
  }

  .stat:last-child {
    border-bottom: 0;
  }

  .reader-hero,
  .reader-body,
  .reader-empty {
    padding: 22px;
  }
}
