/* ============================================================
   Freedmen's Bureau Contracts — Website Styles
   ============================================================ */

/* --- Reset & Base --- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --navy:   #1a1a2e;
  --navy-light: #2d2d44;
  --cream:  #faf8f0;
  --cream-dark: #f0ece0;
  --gold:   #c9a84c;
  --gold-dark: #a88a35;
  --text:   #2c2c2c;
  --text-light: #5a5a5a;
  --blue:   #4a90d9;
  --green:  #27ae60;
  --orange: #e67e22;
  --purple: #8e44ad;
  --red:    #c0392b;
  --border: #d5d0c4;
}

html { scroll-behavior: smooth; }

body {
  font-family: 'Source Sans 3', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-weight: 400;
  font-size: 17px;
  line-height: 1.7;
  color: var(--text);
  background: var(--cream);
}

h1, h2, h3, h4 {
  font-family: 'Playfair Display', Georgia, 'Times New Roman', serif;
  font-weight: 600;
  line-height: 1.25;
}

a { color: var(--gold-dark); text-decoration: underline; }
a:hover { color: var(--navy); }

img { max-width: 100%; }

.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 24px;
}

/* --- Navigation --- */
.nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  background: var(--navy);
  z-index: 100;
  border-bottom: 2px solid var(--gold);
}

.nav-inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 56px;
}

.nav-brand {
  font-family: 'Playfair Display', Georgia, serif;
  color: var(--gold);
  font-size: 1.05rem;
  font-weight: 600;
  letter-spacing: 0.3px;
}

.nav-links { display: flex; gap: 28px; }

.nav-links a {
  color: rgba(255,255,255,0.8);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 500;
  letter-spacing: 0.3px;
  transition: color 0.2s;
}
.nav-links a:hover { color: var(--gold); }

/* --- Hero --- */
.hero {
  background: var(--navy);
  color: white;
  padding: 120px 24px 80px;
  text-align: center;
}

.hero-inner { max-width: 800px; margin: 0 auto; }

.hero h1 {
  font-size: 3.2rem;
  font-weight: 700;
  color: var(--gold);
  margin-bottom: 20px;
  letter-spacing: -0.5px;
}

.hero-subtitle {
  font-size: 1.15rem;
  line-height: 1.8;
  color: rgba(255,255,255,0.8);
  max-width: 640px;
  margin: 0 auto 48px;
}

.stat-cards {
  display: flex;
  gap: 24px;
  justify-content: center;
  flex-wrap: wrap;
}

.stat-card {
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(201,168,76,0.3);
  border-radius: 8px;
  padding: 24px 32px;
  min-width: 140px;
  text-align: center;
}

.stat-number {
  display: block;
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 2rem;
  font-weight: 700;
  color: var(--gold);
  margin-bottom: 4px;
}

.stat-label {
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: rgba(255,255,255,0.6);
}

/* --- Sections --- */
.section { padding: 80px 0; scroll-margin-top: 56px; }
.section-alt { background: white; }

.section-title {
  font-size: 2.2rem;
  color: var(--navy);
  margin-bottom: 16px;
  position: relative;
}
.section-title::after {
  content: '';
  display: block;
  width: 60px;
  height: 3px;
  background: var(--gold);
  margin-top: 12px;
}

.section-intro {
  font-size: 1.05rem;
  color: var(--text-light);
  max-width: 720px;
  margin-bottom: 40px;
}

/* --- Two-column layout --- */
.two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 48px;
  margin-top: 32px;
}

.col-text p { margin-bottom: 16px; }

/* --- Data tables --- */
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
}

.data-table th {
  background: var(--navy);
  color: white;
  padding: 10px 14px;
  text-align: left;
  font-weight: 500;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.data-table td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
}

.data-table tr:hover td { background: rgba(201,168,76,0.06); }

.data-table td:nth-child(n+3) { text-align: right; }
.data-table th:nth-child(n+3) { text-align: right; }

.table-note {
  margin-top: 16px;
  font-size: 0.88rem;
  color: var(--text-light);
  padding: 12px 16px;
  background: rgba(201,168,76,0.08);
  border-left: 3px solid var(--gold);
  border-radius: 0 4px 4px 0;
}

/* --- Pipeline diagram --- */
.pipeline {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  gap: 8px;
  margin: 40px 0;
  flex-wrap: wrap;
}

.pipe-step {
  background: white;
  border: 2px solid var(--border);
  border-radius: 8px;
  padding: 20px 16px;
  text-align: center;
  width: 150px;
  position: relative;
  transition: border-color 0.2s;
}
.pipe-step:hover { border-color: var(--gold); }

.pipe-number {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px; height: 28px;
  border-radius: 50%;
  background: var(--navy);
  color: var(--gold);
  font-weight: 700;
  font-size: 0.85rem;
  margin-bottom: 8px;
}

.pipe-label {
  font-family: 'Playfair Display', Georgia, serif;
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--navy);
  line-height: 1.3;
  margin-bottom: 6px;
}

.pipe-detail {
  font-size: 0.78rem;
  color: var(--text-light);
  line-height: 1.4;
}

.pipe-arrow {
  font-size: 1.6rem;
  color: var(--gold);
  align-self: center;
  margin-top: -10px;
  font-weight: 700;
}

/* --- Method blocks --- */
.method-block {
  margin-top: 48px;
}

.method-block h3 {
  font-size: 1.4rem;
  color: var(--navy);
  margin-bottom: 12px;
}

.method-block p { margin-bottom: 16px; }

.code-patterns {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 12px;
}

.code-patterns code {
  background: var(--cream);
  border: 1px solid var(--border);
  padding: 6px 14px;
  border-radius: 4px;
  font-family: 'SF Mono', 'Fira Code', Consolas, monospace;
  font-size: 0.85rem;
  color: var(--navy);
}

/* --- Example tabs --- */
.example-tabs {
  display: flex;
  gap: 0;
  margin-bottom: 0;
}

.tab-btn {
  padding: 10px 24px;
  border: 2px solid var(--border);
  border-bottom: none;
  background: var(--cream);
  cursor: pointer;
  font-family: 'Source Sans 3', sans-serif;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-light);
  border-radius: 6px 6px 0 0;
  transition: all 0.2s;
}
.tab-btn:hover { color: var(--navy); }
.tab-btn.active {
  background: white;
  color: var(--navy);
  border-color: var(--navy);
  font-weight: 600;
}

.example-panel {
  background: white;
  border: 2px solid var(--navy);
  border-radius: 0 6px 6px 6px;
  padding: 28px 32px;
  font-family: 'SF Mono', 'Fira Code', Consolas, monospace;
  font-size: 0.88rem;
  line-height: 1.9;
  color: var(--text);
  max-height: 500px;
  overflow-y: auto;
}

.example-panel .contract-text {
  white-space: pre-wrap;
  word-wrap: break-word;
}

.example-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
  font-family: 'Source Sans 3', sans-serif;
}

.meta-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.85rem;
  font-weight: 500;
}

.meta-dot {
  width: 10px; height: 10px;
  border-radius: 50%;
  display: inline-block;
}

/* Highlight spans */
.hl-date     { background: rgba(74,144,217,0.15); border-bottom: 2px solid var(--blue); padding: 1px 3px; }
.hl-location { background: rgba(39,174,96,0.15);  border-bottom: 2px solid var(--green); padding: 1px 3px; }
.hl-employer { background: rgba(230,126,34,0.15); border-bottom: 2px solid var(--orange); padding: 1px 3px; }
.hl-workers  { background: rgba(142,68,173,0.15); border-bottom: 2px solid var(--purple); padding: 1px 3px; }
.hl-agent    { background: rgba(192,57,43,0.15);  border-bottom: 2px solid var(--red); padding: 1px 3px; }

.legend {
  display: flex;
  gap: 24px;
  margin-top: 16px;
  flex-wrap: wrap;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.88rem;
  color: var(--text-light);
}

.legend-dot {
  width: 12px; height: 12px;
  border-radius: 3px;
  display: inline-block;
}

/* --- Charts --- */
.chart-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 32px;
  margin-top: 32px;
}

.chart-card {
  background: white;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 24px;
}

.chart-card h3 {
  font-size: 1.2rem;
  color: var(--navy);
  margin-bottom: 6px;
}

.chart-note {
  font-size: 0.88rem;
  color: var(--text-light);
  margin-bottom: 16px;
}

.chart-container { position: relative; width: 100%; min-height: 250px; }
.chart-container canvas { width: 100% !important; }
.chart-medium { max-width: 600px; }
.chart-tall { min-height: 420px; }

/* --- Full example contracts --- */
.example-contract {
  background: white;
  border: 1px solid var(--border);
  border-radius: 8px;
  margin-bottom: 20px;
  overflow: hidden;
}

.example-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 24px;
  cursor: pointer;
  transition: background 0.2s;
  user-select: none;
}
.example-header:hover { background: rgba(201,168,76,0.06); }

.example-header h4 {
  font-size: 1.1rem;
  color: var(--navy);
}

.example-header .meta-badges {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 0.78rem;
  font-weight: 600;
  font-family: 'Source Sans 3', sans-serif;
}

.badge-state { background: var(--navy); color: var(--gold); }
.badge-date  { background: rgba(74,144,217,0.12); color: var(--blue); }
.badge-county { background: rgba(39,174,96,0.12); color: var(--green); }

.expand-icon {
  font-size: 1.4rem;
  color: var(--text-light);
  transition: transform 0.3s;
}

.example-contract.open .expand-icon { transform: rotate(180deg); }

.example-body {
  display: none;
  padding: 0 24px 24px;
}
.example-contract.open .example-body { display: block; }

.example-body-grid {
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: 24px;
}

.example-sidebar {
  font-size: 0.9rem;
}

.sidebar-field {
  margin-bottom: 12px;
}

.sidebar-field .field-label {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-light);
  font-weight: 600;
}

.sidebar-field .field-value {
  color: var(--navy);
  font-weight: 500;
}

.example-fulltext {
  background: var(--cream);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 20px 24px;
  font-family: 'SF Mono', 'Fira Code', Consolas, monospace;
  font-size: 0.82rem;
  line-height: 1.8;
  white-space: pre-wrap;
  word-wrap: break-word;
  max-height: 500px;
  overflow-y: auto;
  color: var(--text);
}

.tc-link {
  display: inline-block;
  margin-top: 12px;
  font-size: 0.85rem;
}

/* --- OCR Expansion section --- */
.ocr-callout {
  background: rgba(201,168,76,0.1);
  border-left: 3px solid var(--gold);
  padding: 14px 18px;
  border-radius: 0 6px 6px 0;
  font-weight: 500;
}

.ocr-gauge { margin-bottom: 8px; }

.gauge-bar {
  width: 100%;
  height: 32px;
  background: var(--cream-dark);
  border-radius: 6px;
  overflow: hidden;
  border: 1px solid var(--border);
}

.gauge-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--green), var(--gold));
  border-radius: 6px 0 0 6px;
  width: 8%;
  transition: width 1s ease;
  position: relative;
}

.gauge-fill::after {
  content: '~15%';
  position: absolute;
  right: -36px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--navy);
}

.gauge-labels {
  display: flex;
  justify-content: space-between;
  font-size: 0.85rem;
  color: var(--text-light);
  margin-top: 6px;
}

.image-gallery {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  margin-top: 20px;
}

.gallery-item {
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  background: white;
}

.gallery-item img {
  width: 100%;
  height: 280px;
  object-fit: cover;
  object-position: top;
  display: block;
}

.gallery-item .gallery-caption {
  padding: 10px 14px;
  font-size: 0.82rem;
  color: var(--text-light);
  line-height: 1.4;
}

.gallery-item .gallery-caption a {
  font-size: 0.78rem;
  display: block;
  margin-top: 4px;
}

/* --- Footer --- */
.footer {
  background: var(--navy);
  color: rgba(255,255,255,0.75);
  padding: 60px 0 30px;
}

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

.footer-content {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 48px;
  margin-bottom: 40px;
}

.footer h4 {
  color: var(--gold);
  font-size: 1.1rem;
  margin-bottom: 12px;
}

.footer p {
  font-size: 0.92rem;
  line-height: 1.7;
  margin-bottom: 12px;
}

.footer-bottom {
  text-align: center;
  font-size: 0.82rem;
  color: rgba(255,255,255,0.4);
  border-top: 1px solid rgba(255,255,255,0.1);
  padding-top: 20px;
}

/* --- Responsive --- */
@media (max-width: 768px) {
  .hero h1 { font-size: 2.2rem; }
  .stat-cards { gap: 12px; }
  .stat-card { padding: 16px 20px; min-width: 120px; }
  .stat-number { font-size: 1.5rem; }
  .two-col { grid-template-columns: 1fr; gap: 32px; }
  .chart-grid { grid-template-columns: 1fr; }
  .pipeline { flex-direction: column; align-items: center; }
  .pipe-arrow { transform: rotate(90deg); }
  .footer-content { grid-template-columns: 1fr; }
  .example-body-grid { grid-template-columns: 1fr; }
  .nav-links { gap: 16px; }
  .nav-links a { font-size: 0.8rem; }
}
