/* ==========================================================================
   The MBR Acres Files — shared design system
   Investigative-dossier palette: deep ink header/hero, warm paper content,
   an alert red for calls-to-action and urgent status, muted amber/green
   for secondary status states.
   ========================================================================== */

:root {
  --ink: #14171c;
  --ink-soft: #1f242c;
  --paper: #f7f3ea;
  --paper-dim: #ece5d5;
  --paper-line: rgba(20, 23, 28, 0.14);
  --text-on-ink: #f3efe4;
  --text-on-ink-muted: #b9b2a0;
  --text-main: #201d17;
  --text-muted: #6b6558;

  --red: #b3202f;
  --red-dark: #8a1724;
  --amber: #b9832a;
  --green: #3f6f4e;
  --slate: #55606b;

  --serif: Georgia, "Iowan Old Style", "Times New Roman", serif;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  --mono: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;

  --radius: 3px;
  --shadow: 0 1px 3px rgba(20, 23, 28, 0.12), 0 1px 2px rgba(20, 23, 28, 0.08);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--sans);
  background: var(--paper);
  color: var(--text-main);
  line-height: 1.55;
  min-height: 100vh;
}

a {
  color: var(--red-dark);
  text-decoration: none;
}
a:hover {
  text-decoration: underline;
}

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

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* ---------------- layout shells ---------------- */

.page-wrap {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.container {
  width: 100%;
  max-width: 960px;
  margin: 0 auto;
  padding: 0 24px;
}

main {
  flex: 1;
}

/* ---------------- masthead / nav ---------------- */

.masthead {
  background: var(--ink);
  color: var(--text-on-ink);
  border-bottom: 3px solid var(--red);
}

.masthead-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 24px;
  max-width: 960px;
  margin: 0 auto;
}

.masthead-title {
  font-family: var(--serif);
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  color: var(--text-on-ink);
  margin: 0;
}

.masthead-title small {
  display: block;
  font-family: var(--sans);
  font-size: 0.62rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--text-on-ink-muted);
  font-weight: 600;
  margin-top: 2px;
}

.masthead-nav {
  display: flex;
  align-items: center;
  gap: 20px;
  font-size: 0.88rem;
}

.masthead-nav a {
  color: var(--text-on-ink);
  opacity: 0.85;
}
.masthead-nav a:hover {
  opacity: 1;
}

.masthead-nav .role-pill {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  border: 1px solid rgba(243, 239, 228, 0.35);
  padding: 3px 8px;
  border-radius: 999px;
  color: var(--text-on-ink-muted);
}

.masthead-nav button.link-btn {
  background: none;
  border: none;
  color: var(--text-on-ink);
  opacity: 0.85;
  font: inherit;
  cursor: pointer;
  padding: 0;
}
.masthead-nav button.link-btn:hover {
  opacity: 1;
  text-decoration: underline;
}

/* ---------------- hero / mission strip ---------------- */

.hero {
  background: var(--ink-soft);
  color: var(--text-on-ink);
  padding: 48px 0 40px;
}

.hero h1 {
  font-family: var(--serif);
  font-size: 2rem;
  max-width: 640px;
  margin: 0 0 12px;
}

.hero p {
  max-width: 620px;
  color: var(--text-on-ink-muted);
  font-size: 1.02rem;
}

.hero-tools {
  margin-top: 20px;
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

/* ---------------- buttons ---------------- */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--sans);
  font-size: 0.85rem;
  font-weight: 600;
  padding: 9px 16px;
  border-radius: var(--radius);
  border: 1px solid transparent;
  cursor: pointer;
  text-decoration: none;
  line-height: 1;
}
.btn:hover {
  text-decoration: none;
}

.btn-primary {
  background: var(--red);
  color: #fff;
}
.btn-primary:hover {
  background: var(--red-dark);
}

.btn-outline {
  background: transparent;
  border-color: var(--paper-line);
  color: var(--text-main);
}
.btn-outline:hover {
  border-color: var(--text-main);
}

.btn-ghost-on-ink {
  background: transparent;
  border-color: rgba(243, 239, 228, 0.35);
  color: var(--text-on-ink);
}
.btn-ghost-on-ink:hover {
  border-color: var(--text-on-ink);
}

.btn-sm {
  font-size: 0.78rem;
  padding: 6px 12px;
}

.btn-danger {
  background: transparent;
  border-color: var(--red);
  color: var(--red-dark);
}
.btn-danger:hover {
  background: var(--red);
  color: #fff;
}

/* ---------------- status badges ---------------- */
/* Evidentiary-weight / regulatory-process badges. Colors are the pastel
   Tailwind 100/800/300 triads (bg/text/border) the campaign specified,
   translated to plain hex since this site has no Tailwind build step. */

.badge {
  display: inline-block;
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid transparent;
  white-space: nowrap;
}

.badge-group {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.badge-verified-contradiction {
  background: #fee2e2;
  color: #991b1b;
  border-color: #fca5a5;
}
.badge-statutory-data-logged {
  background: #dbeafe;
  color: #1e40af;
  border-color: #93c5fd;
}
.badge-corroborated-testimony {
  background: #dcfce7;
  color: #166534;
  border-color: #86efac;
}
.badge-awaiting-ministerial-response {
  background: #fef9c3;
  color: #854d0e;
  border-color: #fde047;
}
.badge-regulatory-obstruction {
  background: #f3e8ff;
  color: #6b21a8;
  border-color: #d8b4fe;
}
.badge-ico-appeal-active {
  background: #e0e7ff;
  color: #3730a3;
  border-color: #a5b4fc;
}
.badge-default {
  background: rgba(85, 96, 107, 0.14);
  color: var(--slate);
  border-color: rgba(85, 96, 107, 0.4);
}

/* ---------------- hover/focus tooltips (badges + admin checkboxes) ---------------- */

.tooltip {
  position: relative;
  cursor: help;
}

.tooltip::after,
.tooltip::before {
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.12s ease;
  position: absolute;
  z-index: 60;
  pointer-events: none;
}

/* Left-aligned to the trigger (not centered) so tooltips on badges near
   the left edge of a card/hero — the common case — never overflow off
   the left of the viewport and get clipped. */
.tooltip::after {
  content: attr(data-tooltip);
  bottom: calc(100% + 8px);
  left: 0;
  background: var(--ink);
  color: var(--text-on-ink);
  font-family: var(--sans);
  font-size: 0.74rem;
  font-weight: 400;
  text-transform: none;
  letter-spacing: normal;
  line-height: 1.45;
  padding: 9px 11px;
  border-radius: 4px;
  width: max-content;
  max-width: min(260px, 80vw);
  white-space: normal;
  text-align: left;
  box-shadow: var(--shadow);
}

.tooltip::before {
  content: "";
  bottom: calc(100% + 3px);
  left: 14px;
  border: 5px solid transparent;
  border-top-color: var(--ink);
}

.tooltip:hover::after,
.tooltip:hover::before,
.tooltip:focus-visible::after,
.tooltip:focus-visible::before {
  opacity: 1;
  visibility: visible;
}

/* ---------------- dossier grid (homepage) ---------------- */

.section {
  padding: 40px 0;
}

.section-label {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-weight: 700;
  color: var(--text-muted);
  margin: 0 0 16px;
}

.dossier-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 18px;
}

.dossier-card {
  background: #fff;
  border: 1px solid var(--paper-line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  border-top: 3px solid var(--red);
}

.dossier-card h3 {
  font-family: var(--serif);
  font-size: 1.2rem;
  margin: 0;
}

.dossier-card h3 a {
  color: var(--text-main);
}

.dossier-card p {
  color: var(--text-muted);
  font-size: 0.92rem;
  margin: 0;
  flex: 1;
}

.dossier-card .card-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 4px;
}

.empty-state {
  color: var(--text-muted);
  font-style: italic;
  padding: 24px 0;
}

/* ---------------- dossier detail ---------------- */

.dossier-hero {
  background: var(--ink);
  color: var(--text-on-ink);
  padding: 40px 0;
}

.dossier-hero .badge-group {
  margin-bottom: 14px;
}

.dossier-hero .tooltip::after {
  border: 1px solid rgba(243, 239, 228, 0.25);
}

.dossier-hero h1 {
  font-family: var(--serif);
  font-size: 2.1rem;
  margin: 0 0 16px;
}

.hook {
  font-family: var(--serif);
  font-size: 1.25rem;
  line-height: 1.5;
  color: var(--text-on-ink);
  border-left: 3px solid var(--red);
  padding-left: 16px;
  max-width: 680px;
}

.dossier-tools {
  margin-top: 22px;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.dossier-body {
  padding: 36px 0 60px;
}

.dossier-section {
  max-width: 720px;
  margin: 0 0 36px;
}

.dossier-section h2 {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--red-dark);
  font-weight: 700;
  margin: 0 0 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--paper-line);
}

.dossier-section p {
  margin: 0 0 12px;
}

.dossier-section ul {
  margin: 0;
  padding-left: 20px;
}
.dossier-section li {
  margin-bottom: 8px;
}

/* evidence vault */

.evidence-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.evidence-item {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  background: #fff;
  border: 1px solid var(--paper-line);
  border-radius: var(--radius);
  padding: 14px 16px;
}

.evidence-item .ev-meta {
  flex: 1;
}

.evidence-item .ev-title {
  font-weight: 700;
  margin: 0 0 2px;
}

.evidence-item .ev-desc {
  color: var(--text-muted);
  font-size: 0.88rem;
  margin: 0;
}

.evidence-item .ev-date {
  color: var(--text-muted);
  font-size: 0.76rem;
  margin-top: 4px;
}

/* citation box */

.citation-box {
  background: var(--paper-dim);
  border: 1px dashed var(--amber);
  border-radius: var(--radius);
  padding: 16px;
  max-width: 720px;
}

.citation-box .citation-text {
  font-family: var(--mono);
  font-size: 0.86rem;
  white-space: pre-wrap;
  color: var(--text-main);
  margin: 0 0 12px;
}

.copy-feedback {
  font-size: 0.8rem;
  color: var(--green);
  margin-left: 10px;
}

/* ---------------- forms (login + admin) ---------------- */

.form-card {
  background: #fff;
  border: 1px solid var(--paper-line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 28px;
  max-width: 420px;
  margin: 60px auto;
}

.form-card h1 {
  font-family: var(--serif);
  font-size: 1.4rem;
  margin: 0 0 20px;
}

.field {
  margin-bottom: 16px;
}

.field label {
  display: block;
  font-size: 0.8rem;
  font-weight: 700;
  margin-bottom: 6px;
}

.field input,
.field textarea,
.field select {
  width: 100%;
  font: inherit;
  padding: 9px 10px;
  border: 1px solid var(--paper-line);
  border-radius: var(--radius);
  background: var(--paper);
}

.field textarea {
  min-height: 90px;
  resize: vertical;
}

.field .hint {
  font-size: 0.76rem;
  color: var(--text-muted);
  margin-top: 4px;
}

.form-error {
  background: rgba(179, 32, 47, 0.1);
  border: 1px solid rgba(179, 32, 47, 0.3);
  color: var(--red-dark);
  padding: 10px 12px;
  border-radius: var(--radius);
  font-size: 0.86rem;
  margin-bottom: 16px;
}

.form-success {
  background: rgba(63, 111, 78, 0.1);
  border: 1px solid rgba(63, 111, 78, 0.3);
  color: var(--green);
  padding: 10px 12px;
  border-radius: var(--radius);
  font-size: 0.86rem;
  margin-bottom: 16px;
}

/* ---------------- admin ---------------- */

.admin-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
  border: 1px solid var(--paper-line);
}

.admin-table th,
.admin-table td {
  text-align: left;
  padding: 10px 12px;
  border-bottom: 1px solid var(--paper-line);
  font-size: 0.9rem;
}

.admin-table th {
  background: var(--paper-dim);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.admin-table .row-actions {
  display: flex;
  gap: 8px;
}

/* status badge checkboxes (admin dossier form) */

.status-group {
  margin-bottom: 16px;
}

.status-group-label {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  font-weight: 700;
  margin: 0 0 8px;
}

.status-checkbox-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.status-checkbox-item {
  display: flex;
  align-items: center;
  gap: 8px;
}

.status-checkbox-item input[type="checkbox"] {
  width: auto;
  margin: 0;
}

.status-checkbox-item .tooltip-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  border-radius: 999px;
  border: 1px solid var(--text-muted);
  color: var(--text-muted);
  font-size: 0.68rem;
  font-weight: 700;
  font-style: normal;
  cursor: help;
}

.admin-panel {
  background: #fff;
  border: 1px solid var(--paper-line);
  border-radius: var(--radius);
  padding: 24px;
  margin-top: 20px;
}

.admin-panel h2 {
  font-family: var(--serif);
  font-size: 1.3rem;
  margin: 0 0 18px;
}

.evidence-editor-row {
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  gap: 10px;
  align-items: start;
  border: 1px solid var(--paper-line);
  border-radius: var(--radius);
  padding: 12px;
  margin-bottom: 10px;
  background: var(--paper);
}

.evidence-editor-row .field {
  margin-bottom: 8px;
}

.form-actions {
  display: flex;
  gap: 10px;
  margin-top: 20px;
}

/* ---------------- footer ---------------- */

.site-footer {
  background: var(--ink);
  color: var(--text-on-ink-muted);
  font-size: 0.82rem;
  padding: 24px 0;
  text-align: center;
}

/* ---------------- print (used for "download as PDF") ---------------- */

@media print {
  .masthead,
  .site-footer,
  .dossier-tools,
  .hero-tools,
  .no-print {
    display: none !important;
  }

  body {
    background: #fff;
  }

  .dossier-hero {
    background: #fff !important;
    color: #000 !important;
    padding: 0 0 16px;
  }

  .dossier-hero .hook {
    color: #000;
  }

  .dossier-body {
    padding: 0;
  }

  a {
    color: #000;
  }
}

@media (max-width: 640px) {
  .masthead-bar {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }

  .evidence-editor-row {
    grid-template-columns: 1fr;
  }
}
