/* ============================================================
   Project Pentecost — design tokens (v2, ecclesiastical refresh)
   Concept: an official register in the spirit of the Holy See's
   own site — deep cardinal maroon, gold leaf, warm parchment —
   built entirely from original marks; no borrowed Vatican heraldry
   or photography anywhere in this file.
   ============================================================ */
:root {
  /* Color */
  --ink: #3D1220;         /* deep cardinal maroon — primary dark surface */
  --ink-2: #4E1A2B;        /* raised surface on ink */
  --ember: #C4432E;        /* flame accent — primary CTA / signal */
  --gold: #C6A15B;         /* gold leaf — seals, rules, secondary accent */
  --paper: #FBF8F1;        /* parchment — primary light surface */
  --paper-2: #F1E9D8;       /* raised surface on paper */
  --mist: #9C8F7A;         /* warm taupe — secondary text on dark */
  --line: #E6DCC6;         /* hairline on paper */
  --line-dark: #5A2333;     /* hairline on ink */
  --ok: #3F6B4A;
  --warn: #B08A3E;
  --danger: #A33636;
  --text-ink: #2A1E1A;
  --text-mist: #7A6F5E;

  /* Type */
  --display: "Fraunces", "Source Serif 4", Georgia, serif;
  --body: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, monospace;
  --zh: "Noto Serif SC", "PingFang SC", "Microsoft YaHei", var(--body);

  --radius: 10px;
  --radius-lg: 18px;
}

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

body {
  background: var(--paper);
  color: var(--text-ink);
  font-family: var(--body);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; }

.container {
  max-width: 960px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

/* ---------------------------------------------------------- Header */
header.site {
  background: var(--ink);
  color: var(--paper);
  padding: 1.1rem 0;
  position: sticky;
  top: 0;
  z-index: 20;
  border-bottom: 2px solid var(--gold);
}
header.site .container { display: flex; align-items: center; justify-content: space-between; }
.brand {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  font-family: var(--display);
  font-weight: 600;
  font-size: 1.25rem;
  letter-spacing: 0.01em;
  text-decoration: none;
  color: inherit;
}
.brand .crest { width: 30px; height: 30px; flex-shrink: 0; }
.brand small {
  display: block;
  font-family: var(--body);
  font-weight: 500;
  font-size: 0.66rem;
  color: var(--gold);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  margin-top: 2px;
}
nav.tabs { display: flex; gap: 0.25rem; }
nav.tabs a {
  background: transparent;
  border: none;
  color: var(--mist);
  font-family: var(--body);
  font-size: 0.86rem;
  letter-spacing: 0.02em;
  padding: 0.5rem 0.85rem;
  border-radius: 999px;
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
  transition: color 0.15s, background 0.15s;
}
nav.tabs a:hover { color: var(--paper); background: var(--ink-2); }
nav.tabs a.active { color: var(--ink); background: var(--gold); font-weight: 600; }

/* ---------------------------------------------------------- Hero */
.hero {
  background: var(--ink);
  color: var(--paper);
  padding: 3.5rem 0 4rem;
  position: relative;
  overflow: hidden;
}
.hero .container {
  position: relative;
  z-index: 2;
  display: grid;
  grid-template-columns: 1.3fr 1fr;
  gap: 2rem;
  align-items: center;
}
.hero h1 {
  font-family: var(--display);
  font-weight: 600;
  font-size: clamp(2rem, 4.6vw, 3rem);
  line-height: 1.1;
  margin: 0 0 0.9rem;
}
.hero h1 em {
  font-style: normal;
  color: var(--gold);
}
.hero p.lede {
  color: var(--mist);
  font-size: 1.02rem;
  max-width: 46ch;
  margin: 0;
}
.hero-basilica {
  width: 100%;
  height: auto;
  opacity: 0.95;
}
.beta-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: rgba(198, 161, 91, 0.14);
  border: 1px solid var(--gold);
  color: var(--gold);
  font-size: 0.74rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 0.35rem 0.8rem;
  border-radius: 999px;
  margin-bottom: 1.1rem;
}
@media (max-width: 780px) {
  .hero .container { grid-template-columns: 1fr; }
  .hero-basilica { max-width: 280px; margin: 0 auto; }
}

/* ---------------------------------------------------------- Cards */
.card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 1.75rem;
  margin-bottom: 1.5rem;
}
.card h2 {
  font-family: var(--display);
  font-size: 1.3rem;
  margin: 0 0 0.3rem;
}
.card .subhead { color: var(--text-mist); font-size: 0.92rem; margin: 0 0 1.25rem; }

main { padding: 2.5rem 0 5rem; }

/* ---------------------------------------------------------- Upload */
.dropzone {
  border: 2px dashed var(--line);
  border-radius: var(--radius);
  padding: 2.25rem 1.5rem;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
  background: var(--paper);
}
.dropzone.dragover { border-color: var(--ember); background: #FBF0EC; }
.dropzone svg { width: 32px; height: 32px; color: var(--gold); margin-bottom: 0.6rem; }
.dropzone .primary { font-weight: 600; color: var(--text-ink); }
.dropzone .secondary { font-size: 0.85rem; color: var(--text-mist); margin-top: 0.25rem; }
.dropzone input[type="file"] { display: none; }

.file-chip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--paper-2);
  border-radius: var(--radius);
  padding: 0.7rem 1rem;
  margin-top: 1rem;
  font-size: 0.9rem;
}
.file-chip button {
  background: none; border: none; color: var(--danger); cursor: pointer; font-size: 0.85rem;
}

.options-row { display: flex; gap: 1rem; margin-top: 1.25rem; flex-wrap: wrap; }
.field { flex: 1; min-width: 180px; }
.field label {
  display: block; font-size: 0.78rem; font-weight: 600; color: var(--text-mist);
  text-transform: uppercase; letter-spacing: 0.06em; margin-bottom: 0.4rem;
}
.field select {
  width: 100%; padding: 0.6rem 0.75rem; border-radius: var(--radius);
  border: 1px solid var(--line); background: #fff; font-family: var(--body); font-size: 0.92rem;
}
.checkbox-field { display: flex; flex-direction: column; gap: 0.4rem; }
.checkbox-field .checkbox-row { display: flex; align-items: center; gap: 0.5rem; }
.checkbox-hint { font-size: 0.78rem; color: var(--text-mist); line-height: 1.45; margin: 0; }

.btn {
  display: inline-flex; align-items: center; gap: 0.5rem;
  background: var(--ember); color: #fff; border: none;
  padding: 0.75rem 1.4rem; border-radius: 999px;
  font-family: var(--body); font-weight: 600; font-size: 0.94rem;
  cursor: pointer; transition: transform 0.1s, box-shadow 0.15s;
}
.btn:hover { box-shadow: 0 6px 18px rgba(196, 67, 46, 0.28); transform: translateY(-1px); }
.btn:disabled { background: var(--line); color: var(--text-mist); cursor: not-allowed; box-shadow: none; transform: none; }
.btn.ghost { background: transparent; color: var(--text-ink); border: 1px solid var(--line); }
.btn.ghost:hover { box-shadow: none; border-color: var(--ember); color: var(--ember); }
.btn.small { padding: 0.5rem 1rem; font-size: 0.85rem; }

/* ---------------------------------------------------------- Jobs list */
.job-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 1rem 0; border-bottom: 1px solid var(--line);
  cursor: pointer;
}
.job-row:last-child { border-bottom: none; }
.job-row:hover .job-title { color: var(--ember); }
.job-title { font-weight: 600; transition: color 0.15s; }
.job-meta { font-size: 0.82rem; color: var(--text-mist); margin-top: 0.15rem; }

.status-chip {
  display: inline-flex; align-items: center; gap: 0.35rem;
  font-size: 0.76rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em;
  padding: 0.28rem 0.65rem; border-radius: 999px;
}
.status-chip .dot { width: 6px; height: 6px; border-radius: 50%; }
.status-chip.queued, .status-chip.extracting, .status-chip.chunking, .status-chip.translating, .status-chip.verifying {
  background: #FBEFEA; color: var(--ember);
}
.status-chip.queued .dot, .status-chip.extracting .dot, .status-chip.chunking .dot,
.status-chip.translating .dot, .status-chip.verifying .dot { background: var(--ember); animation: pulse 1.4s infinite; }
.status-chip.review { background: #F3EAD3; color: var(--warn); }
.status-chip.review .dot { background: var(--warn); }
.status-chip.approved, .status-chip.published { background: #E7EFE9; color: var(--ok); }
.status-chip.approved .dot, .status-chip.published .dot { background: var(--ok); }
.status-chip.failed { background: #F6E7E7; color: var(--danger); }
.status-chip.failed .dot { background: var(--danger); }

@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.3; } }

.empty-state { text-align: center; padding: 2.5rem 1rem; color: var(--text-mist); }
.empty-state svg { width: 40px; height: 40px; color: var(--line); margin-bottom: 0.75rem; }

/* ---------------------------------------------------------- Review view */
.review-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 1.5rem; flex-wrap: wrap; gap: 1rem;
}
.review-header h1 { font-family: var(--display); font-size: 1.5rem; margin: 0; }
.review-header .filename { color: var(--text-mist); font-size: 0.9rem; }
.review-timer { color: var(--gold); font-size: 0.85rem; font-weight: 600; margin-top: 0.2rem; }

.flag-banner {
  background: #F3EAD3; border: 1px solid #DFC48C; color: #7A5A17;
  border-radius: var(--radius); padding: 0.9rem 1.1rem; margin-bottom: 1.5rem; font-size: 0.9rem;
}

.chunk-pair {
  display: grid; grid-template-columns: 1fr 1fr; gap: 0;
  border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 1rem; overflow: hidden;
}
.chunk-pair.red { border-color: #DDACAC; }
.chunk-pair.yellow { border-color: #DFC48C; }
.chunk-source, .chunk-target { padding: 1.1rem 1.25rem; font-size: 0.95rem; }
.chunk-source { background: var(--paper); border-right: 1px solid var(--line); }
.chunk-target { background: #fff; font-family: var(--zh); font-size: 1.02rem; line-height: 1.9; }
.chunk-label {
  font-size: 0.68rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--text-mist); margin-bottom: 0.5rem; display: flex; align-items: center; gap: 0.4rem;
}
.chunk-citations { margin-top: 0.6rem; font-size: 0.78rem; color: var(--text-mist); }
.chunk-citations a { color: var(--ember); text-decoration: none; }
.citations-toggle {
  display: block; margin-top: 0.5rem; background: none; border: none; padding: 0;
  font-size: 0.76rem; color: var(--gold); text-decoration: underline; cursor: pointer;
}
.related-citations { display: none; margin-top: 0.4rem; opacity: 0.85; }
.related-citations.show { display: block; }
.no-primary-note { font-style: italic; }
.flag-note {
  background: #F6E7E7; color: #6E2323; font-size: 0.82rem; padding: 0.6rem 0.8rem;
  border-radius: 8px; margin-top: 0.6rem;
}
@media (max-width: 720px) {
  .chunk-pair { grid-template-columns: 1fr; }
  .chunk-source { border-right: none; border-bottom: 1px solid var(--line); }
}

.download-row { display: flex; gap: 0.75rem; margin-top: 2rem; }

/* ---------------------------------------------------------- Feedback */
.rating-card {
  margin-top: 2rem;
  padding: 1.25rem 1.5rem;
  background: var(--paper-2);
  border-radius: var(--radius);
  text-align: center;
}
.rating-card .prompt { font-weight: 600; margin-bottom: 0.75rem; }
.rating-buttons { display: flex; gap: 0.75rem; justify-content: center; }
.rating-buttons button {
  background: #fff; border: 1px solid var(--line); border-radius: 999px;
  padding: 0.5rem 1.1rem; font-size: 1.1rem; cursor: pointer; transition: border-color 0.15s, transform 0.1s;
}
.rating-buttons button:hover { border-color: var(--ember); transform: translateY(-1px); }
.rating-buttons button.selected { border-color: var(--ember); background: #FBF0EC; }
.rating-comment { margin-top: 0.9rem; display: none; }
.rating-comment.show { display: block; }
.rating-comment textarea {
  width: 100%; max-width: 420px; min-height: 70px; padding: 0.6rem 0.75rem;
  border-radius: var(--radius); border: 1px solid var(--line); font-family: var(--body); font-size: 0.88rem; resize: vertical;
}
.rating-thanks { color: var(--ok); font-weight: 600; font-size: 0.9rem; }

#feedbackLink {
  background: none; border: none; color: var(--text-mist); font-size: 0.8rem;
  text-decoration: underline; cursor: pointer; margin-top: 0.6rem; display: block; margin-left: auto; margin-right: auto;
}
#feedbackPanel {
  display: none;
  max-width: 420px; margin: 1rem auto 0; text-align: left;
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 1.25rem;
}
#feedbackPanel.show { display: block; }
#feedbackPanel select, #feedbackPanel textarea {
  width: 100%; padding: 0.6rem 0.75rem; border-radius: var(--radius); border: 1px solid var(--line);
  font-family: var(--body); font-size: 0.88rem; margin-top: 0.5rem;
}
#feedbackPanel textarea { min-height: 80px; resize: vertical; }
#feedbackPanel .panel-actions { display: flex; gap: 0.6rem; margin-top: 0.8rem; }

/* ---------------------------------------------------------- FAQ */
.faq-item {
  border-bottom: 1px solid var(--line);
  padding: 1.4rem 0;
}
.faq-item:last-child { border-bottom: none; }
.faq-item h3 {
  font-family: var(--display);
  font-weight: 600;
  font-size: 1.08rem;
  margin: 0 0 0.5rem;
  color: var(--ink);
}
.faq-item p {
  color: var(--text-mist);
  font-size: 0.94rem;
  margin: 0 0 0.6rem;
  line-height: 1.7;
}
.faq-item p:last-child { margin-bottom: 0; }
.faq-section-title {
  font-family: var(--display);
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--gold);
  margin: 2rem 0 0.25rem;
}
.faq-section-title:first-child { margin-top: 0; }

/* ---------------------------------------------------------- Toast */
#toast {
  position: fixed; bottom: 1.5rem; left: 50%; transform: translateX(-50%) translateY(20px);
  background: var(--ink); color: var(--paper); padding: 0.8rem 1.3rem; border-radius: 999px;
  font-size: 0.88rem; opacity: 0; pointer-events: none; transition: opacity 0.2s, transform 0.2s; z-index: 50;
}
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

footer.site {
  text-align: center;
  padding: 1.75rem 0;
  color: var(--text-mist);
  font-size: 0.8rem;
  border-top: 1px solid var(--line);
}
footer.site .beta-note {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  font-size: 0.72rem;
  color: var(--gold);
  background: var(--ink);
  padding: 0.4rem 0.9rem;
  border-radius: 999px;
}
