:root {
  --ink: #1c1b19;
  --paper: #faf8f3;
  --paper-dim: #f1ede3;
  --rule: #d9d3c3;
  --press-red: #a3352b;
  --wire-blue: #2c4a6e;
  --muted: #6b6559;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: 'Source Serif 4', Georgia, serif;
}

/* ---------- Masthead ---------- */

.masthead {
  border-bottom: 3px solid var(--ink);
  padding: 2.5rem 1.5rem 1.5rem;
  text-align: center;
  background: var(--paper);
}

.masthead-inner {
  max-width: 900px;
  margin: 0 auto;
}

.eyebrow {
  font-family: 'Inter', sans-serif;
  font-size: 0.72rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--press-red);
  margin: 0 0 0.5rem;
  font-weight: 600;
}

.nameplate {
  font-family: 'Playfair Display', serif;
  font-weight: 900;
  font-size: clamp(2.5rem, 6vw, 4.2rem);
  margin: 0;
  letter-spacing: -0.01em;
}

.tagline {
  font-style: italic;
  color: var(--muted);
  margin: 0.6rem 0 0;
  font-size: 1rem;
}

/* ---------- Layout ---------- */

.layout {
  max-width: 1100px;
  margin: 2.5rem auto;
  padding: 0 1.5rem 3rem;
  display: grid;
  grid-template-columns: 1fr 1.3fr;
  gap: 2.5rem;
  align-items: start;
}

@media (max-width: 800px) {
  .layout {
    grid-template-columns: 1fr;
  }
}

.section-label {
  font-family: 'Inter', sans-serif;
  font-size: 0.75rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--wire-blue);
  font-weight: 700;
  border-bottom: 1px solid var(--rule);
  padding-bottom: 0.5rem;
  margin: 0 0 1rem;
}

/* ---------- Input column ---------- */

.input-column {
  border-right: 1px solid var(--rule);
  padding-right: 2rem;
}

@media (max-width: 800px) {
  .input-column {
    border-right: none;
    padding-right: 0;
  }
}

textarea, input[type="text"] {
  width: 100%;
  font-family: 'Source Serif 4', Georgia, serif;
  font-size: 1rem;
  padding: 0.9rem;
  border: 1px solid var(--rule);
  background: white;
  color: var(--ink);
  border-radius: 2px;
}

textarea {
  min-height: 220px;
  resize: vertical;
  line-height: 1.5;
}

textarea:focus, input[type="text"]:focus {
  outline: 2px solid var(--wire-blue);
  outline-offset: 1px;
}

.btn-primary, .btn-secondary {
  font-family: 'Inter', sans-serif;
  font-weight: 600;
  font-size: 0.85rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 0.8rem 1.4rem;
  border: none;
  border-radius: 2px;
  cursor: pointer;
  margin-top: 0.8rem;
  width: 100%;
}

.btn-primary {
  background: var(--press-red);
  color: white;
}

.btn-primary:hover {
  background: #8a2b22;
}

.btn-secondary {
  background: var(--wire-blue);
  color: white;
}

.btn-secondary:hover {
  background: #223a56;
}

.btn-primary:disabled, .btn-secondary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.hint {
  font-family: 'Inter', sans-serif;
  font-size: 0.8rem;
  color: var(--muted);
  margin-top: 0.6rem;
  line-height: 1.4;
}

.qa-box {
  margin-top: 2.5rem;
}

.answer-output {
  margin-top: 1rem;
  font-size: 0.95rem;
  line-height: 1.6;
}

.answer-output .answer-card {
  background: var(--paper-dim);
  border-left: 3px solid var(--press-red);
  padding: 0.9rem 1rem;
}

/* ---------- Output column ---------- */

.tabs {
  display: flex;
  border-bottom: 2px solid var(--ink);
  gap: 0.2rem;
}

.tab-btn {
  font-family: 'Inter', sans-serif;
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  background: none;
  border: none;
  padding: 0.8rem 1rem;
  cursor: pointer;
  color: var(--muted);
  border-bottom: 3px solid transparent;
  margin-bottom: -2px;
}

.tab-btn.active {
  color: var(--ink);
  border-bottom: 3px solid var(--press-red);
}

.tab-panel {
  display: none;
  padding: 1.5rem 0;
  animation: fadeIn 0.2s ease;
}

.tab-panel.active {
  display: block;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.tab-panel h3 {
  font-family: 'Playfair Display', serif;
  font-size: 1.4rem;
  margin: 0 0 1rem;
}

.placeholder {
  color: var(--muted);
  font-style: italic;
}

/* Sentiment display */

.sentiment-label {
  display: inline-block;
  font-family: 'Inter', sans-serif;
  font-weight: 700;
  font-size: 0.85rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  padding: 0.3rem 0.8rem;
  border-radius: 2px;
  margin-bottom: 0.8rem;
}

.sentiment-label.positive {
  background: #e4efe0;
  color: #2f6b2f;
}

.sentiment-label.negative {
  background: #f3e0dd;
  color: var(--press-red);
}

/* Keywords */

.keyword-chip {
  display: inline-block;
  font-family: 'Inter', sans-serif;
  font-size: 0.85rem;
  background: var(--paper-dim);
  border: 1px solid var(--rule);
  padding: 0.35rem 0.8rem;
  border-radius: 100px;
  margin: 0 0.4rem 0.4rem 0;
}

/* Entities */

.entity-group {
  margin-bottom: 1rem;
}

.entity-group-title {
  font-family: 'Inter', sans-serif;
  font-weight: 700;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--wire-blue);
  margin-bottom: 0.4rem;
}

/* ---------- Footer ---------- */

.footer {
  text-align: center;
  padding: 1.5rem;
  font-family: 'Inter', sans-serif;
  font-size: 0.75rem;
  color: var(--muted);
  border-top: 1px solid var(--rule);
}