/* GrokLens — "Intelligence Dossier" design system
   Print-editorial light theme: warm paper, ink, signal red.
   No gradients, no pills, no blur, no rounded card grid. */

:root {
  --paper: #f5f0e6;
  --paper-raised: #fdfaf3;
  --paper-dim: #ece5d3;
  --ink: #1a1611;
  --ink-soft: #4c463c;
  --ink-faint: #8a8172;
  --rule: #d9d0ba;
  --rule-dark: #1a1611;
  --accent: #bc3f12;
  --accent-ink: #93300d;
  --pos: #2e6b34;
  --neg: #bc3f12;
  --mixed: #9a6a00;
  --neutral: #6d675c;
  --font-serif: "Newsreader", "Noto Serif SC", "Songti SC", Georgia, serif;
  --font-sans: "Archivo", "Noto Sans SC", "PingFang SC", "Microsoft YaHei", sans-serif;
  --font-mono: "IBM Plex Mono", "Noto Sans Mono", ui-monospace, Menlo, Consolas, monospace;
  --dur: 160ms;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

::selection { background: var(--accent); color: var(--paper-raised); }

a { color: var(--accent-ink); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }

code {
  font-family: var(--font-mono);
  font-size: 0.86em;
  background: var(--paper-dim);
  padding: 0.1rem 0.34rem;
  border: 1px solid var(--rule);
}

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

.hidden { display: none !important; }
.muted { color: var(--ink-faint); }
.small { font-size: 0.84rem; }

/* ---------- Masthead ---------- */

.masthead-top {
  border-bottom: 1px solid var(--rule-dark);
}
.masthead-top-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 0.45rem;
  padding-bottom: 0.45rem;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-soft);
}
.masthead-top-inner .mt-right { color: var(--accent-ink); }

.site-header {
  border-bottom: 3px double var(--rule-dark);
  background: var(--paper);
}
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding-top: 1rem;
  padding-bottom: 1rem;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.8rem;
  color: var(--ink);
}
.brand:hover { text-decoration: none; }

.brand-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  background: var(--ink);
  color: var(--paper);
  font-family: var(--font-mono);
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: 0.04em;
}
.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-name {
  font-family: var(--font-serif);
  font-size: 1.55rem;
  font-weight: 600;
  letter-spacing: -0.01em;
}
.brand-name em { font-style: italic; color: var(--accent); }
.brand-tag {
  font-family: var(--font-mono);
  font-size: 0.64rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--ink-faint);
}

.nav-links { display: flex; align-items: center; gap: 1.6rem; }
.nav-link {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-soft);
  padding-bottom: 2px;
  border-bottom: 2px solid transparent;
  transition: color var(--dur) ease, border-color var(--dur) ease;
}
.nav-link.active { color: var(--ink); border-bottom-color: var(--accent); }
.nav-link:hover { color: var(--ink); text-decoration: none; }

.lang-btn {
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--rule-dark);
  padding: 0.34rem 0.7rem;
  font-family: var(--font-mono);
  font-size: 0.74rem;
  letter-spacing: 0.08em;
  cursor: pointer;
  transition: background-color var(--dur) ease, color var(--dur) ease;
}
.lang-btn:hover { background: var(--ink); color: var(--paper); }

/* ---------- Main ---------- */

.main-content { padding-top: 2.6rem; padding-bottom: 4.5rem; }

/* ---------- Hero ---------- */

.hero { margin-bottom: 2.4rem; }
.hero-fileline {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-faint);
  border-top: 1px solid var(--rule-dark);
  border-bottom: 1px solid var(--rule);
  padding: 0.5rem 0;
  margin-bottom: 2rem;
}
.hero-title {
  font-family: var(--font-serif);
  font-weight: 500;
  font-size: clamp(2.3rem, 5.2vw, 3.9rem);
  line-height: 1.06;
  letter-spacing: -0.015em;
  margin: 0 0 1.1rem;
  max-width: 20ch;
}
.hero-title em { font-style: italic; color: var(--accent); }
.hero-sub {
  color: var(--ink-soft);
  max-width: 62ch;
  margin: 0;
  font-size: 1.05rem;
  line-height: 1.65;
}
.hero-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 2rem;
}

/* Rubber stamp mode indicator */
.mode-banner {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 0.55rem 0.85rem;
  border: 2px solid currentColor;
  transform: rotate(-1.6deg);
  margin-top: 0.6rem;
  max-width: 340px;
  line-height: 1.45;
}
.mode-banner .dot { width: 8px; height: 8px; background: currentColor; flex-shrink: 0; }
.mode-offline { color: var(--accent-ink); }
.mode-grok { color: var(--pos); }

/* ---------- Analyzer (request form) ---------- */

.card {
  background: var(--paper-raised);
  border: 1px solid var(--rule-dark);
  padding: 1.6rem;
}
.analyzer-card {
  box-shadow: 6px 6px 0 var(--paper-dim);
  margin-bottom: 3rem;
}
.form-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  border-bottom: 1px solid var(--rule-dark);
  padding-bottom: 0.7rem;
  margin-bottom: 1.2rem;
}
.form-head .form-title {
  font-family: var(--font-mono);
  font-size: 0.74rem;
  font-weight: 600;
  letter-spacing: 0.2em;
  text-transform: uppercase;
}
.form-head .form-no { font-family: var(--font-mono); font-size: 0.74rem; color: var(--ink-faint); }

.tabs { display: flex; gap: 0; margin-bottom: 1.3rem; border: 1px solid var(--rule-dark); width: fit-content; }
.tab-btn {
  background: transparent;
  color: var(--ink-soft);
  border: none;
  border-right: 1px solid var(--rule-dark);
  padding: 0.5rem 1rem;
  cursor: pointer;
  font-family: var(--font-mono);
  font-size: 0.76rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  transition: background-color var(--dur) ease, color var(--dur) ease;
}
.tab-btn:last-child { border-right: none; }
.tab-btn.active { background: var(--ink); color: var(--paper); }

.tab-panel { display: none; }
.tab-panel.active { display: block; }

.field-label {
  display: block;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-soft);
  margin-bottom: 0.5rem;
}

.input-row { display: flex; gap: 0.8rem; }

input[type="text"], textarea {
  width: 100%;
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--rule-dark);
  padding: 0.8rem 0.95rem;
  font-size: 1rem;
  font-family: var(--font-mono);
  transition: border-color var(--dur) ease, background-color var(--dur) ease;
}
textarea { font-family: var(--font-sans); line-height: 1.6; resize: vertical; }
input[type="text"]::placeholder, textarea::placeholder { color: var(--ink-faint); }
input[type="text"]:focus, textarea:focus {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
  background: var(--paper-raised);
}

.input-actions { margin-top: 0.9rem; display: flex; justify-content: flex-end; }

.btn-primary {
  background: var(--accent);
  color: var(--paper-raised);
  border: 1px solid var(--accent-ink);
  padding: 0.8rem 1.5rem;
  font-family: var(--font-mono);
  font-weight: 600;
  font-size: 0.84rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  cursor: pointer;
  white-space: nowrap;
  transition: background-color var(--dur) ease, transform var(--dur) ease;
}
.btn-primary:hover { background: var(--accent-ink); }
.btn-primary:active { transform: translateY(1px); }
.btn-primary:disabled { opacity: 0.55; cursor: wait; }

.btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--rule-dark);
  padding: 0.5rem 0.95rem;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  letter-spacing: 0.06em;
  cursor: pointer;
  transition: background-color var(--dur) ease, color var(--dur) ease;
}
.btn-secondary:hover { background: var(--ink); color: var(--paper); text-decoration: none; }

.link-btn {
  background: none;
  border: none;
  color: var(--accent-ink);
  font-family: var(--font-mono);
  font-size: 0.78rem;
  cursor: pointer;
  padding: 0;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.helper-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  margin-top: 0.65rem;
  font-size: 0.82rem;
  color: var(--ink-faint);
}

.options-row {
  margin-top: 1.1rem;
  padding-top: 0.95rem;
  border-top: 1px dashed var(--rule);
}
.checkbox-label {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  font-size: 0.86rem;
  color: var(--ink-soft);
  cursor: pointer;
}
.checkbox-label input { accent-color: var(--accent); width: 15px; height: 15px; }

.status-box {
  margin-top: 1.1rem;
  padding: 0.85rem 1rem;
  border: 1px solid var(--rule-dark);
  font-family: var(--font-mono);
  font-size: 0.85rem;
}
.status-box.error { border-color: var(--accent); color: var(--accent-ink); background: #f9e9e2; }
.status-box.info { color: var(--ink-soft); background: var(--paper); }

/* ---------- Section heads ---------- */

.section { margin-top: 3rem; }
.section-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  border-bottom: 2px solid var(--rule-dark);
  padding-bottom: 0.55rem;
  margin-bottom: 0;
}
.section-head h1, .section-head h2 {
  margin: 0;
  font-family: var(--font-serif);
  font-weight: 600;
  font-size: 1.45rem;
  letter-spacing: -0.01em;
}
.section-head .view-all {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

/* ---------- Report register (home + history lists) ---------- */

.report-list { border-bottom: 1px solid var(--rule); }
.report-row {
  display: grid;
  grid-template-columns: 176px 1fr auto;
  gap: 1.4rem;
  padding: 1.15rem 0.2rem;
  border-top: 1px solid var(--rule);
  color: var(--ink);
  align-items: start;
  transition: background-color var(--dur) ease;
}
.report-row:first-child { border-top: none; }
.report-row:hover { background: var(--paper-raised); text-decoration: none; }
.report-row-id {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  color: var(--ink-faint);
  padding-top: 0.3rem;
  word-break: break-all;
}
.report-row-main { min-width: 0; }
.report-row-author {
  font-family: var(--font-serif);
  font-weight: 600;
  font-size: 1.12rem;
  margin-bottom: 0.2rem;
}
.report-row-tldr {
  margin: 0;
  color: var(--ink-soft);
  font-size: 0.94rem;
  line-height: 1.55;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.report-row-side {
  text-align: right;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.05em;
  color: var(--ink-faint);
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  align-items: flex-end;
  padding-top: 0.25rem;
}

/* Verdict labels (replaces pill badges) */
.badge {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  padding: 0.14rem 0.45rem;
  border: 1px solid currentColor;
}
.badge-positive { color: var(--pos); }
.badge-negative { color: var(--neg); }
.badge-mixed { color: var(--mixed); }
.badge-neutral { color: var(--neutral); }
.badge-mode { color: var(--ink-soft); border-style: dashed; }
.badge-stance { color: var(--accent-ink); }

.empty-state {
  border: 1px dashed var(--ink-faint);
  padding: 2.2rem;
  text-align: center;
  color: var(--ink-faint);
  font-family: var(--font-serif);
  font-style: italic;
  font-size: 1.05rem;
  margin-top: 1.2rem;
}

/* ---------- About ---------- */

.about-card { box-shadow: 6px 6px 0 var(--paper-dim); }
.about-card h2 {
  margin: 0 0 0.9rem;
  font-family: var(--font-serif);
  font-size: 1.4rem;
  font-weight: 600;
}
.about-card p { color: var(--ink-soft); margin: 0 0 0.8rem; }
.about-card p:last-child { margin-bottom: 0; }

/* ---------- Report page (the document) ---------- */

.breadcrumb {
  display: flex;
  gap: 0.6rem;
  margin-bottom: 1.4rem;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.report-header {
  background: transparent;
  border: none;
  border-top: 3px double var(--rule-dark);
  border-bottom: 1px solid var(--rule-dark);
  padding: 1.3rem 0 1.4rem;
  margin-bottom: 2.2rem;
}
.report-doc-line {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1.5rem;
}
.report-title {
  margin: 0.7rem 0 0.4rem;
  font-family: var(--font-serif);
  font-weight: 600;
  font-size: clamp(1.7rem, 3.4vw, 2.4rem);
  letter-spacing: -0.01em;
  line-height: 1.15;
}
.report-title .muted { font-weight: 400; font-size: 0.62em; }
.report-meta-line {
  font-family: var(--font-mono);
  font-size: 0.76rem;
  color: var(--ink-soft);
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 1.2rem;
}
.report-meta-line code { background: transparent; border: none; padding: 0; font-size: 1em; }
.source-link-row { margin-top: 0.45rem; font-family: var(--font-mono); font-size: 0.8rem; word-break: break-all; }
.report-actions { display: flex; gap: 0.55rem; flex-shrink: 0; padding-top: 0.7rem; }

.report-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: 3rem;
  align-items: start;
}
.report-main { display: flex; flex-direction: column; }
.report-sidebar {
  display: flex;
  flex-direction: column;
  gap: 2rem;
  border-left: 1px solid var(--rule);
  padding-left: 1.6rem;
}

.doc-section { padding: 1.5rem 0 1.7rem; border-top: 1px solid var(--rule); }
.doc-section:first-child { border-top: none; padding-top: 0; }
.section-card { background: transparent; border: none; padding: 0; }
.doc-section h2, .section-card h2 {
  display: flex;
  align-items: baseline;
  gap: 0.7rem;
  margin: 0 0 1rem;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink);
}
.sec-no { color: var(--accent); font-weight: 600; }
.sidebar .doc-section, .report-sidebar .section-card { padding: 0; border-top: none; }

.tldr-text {
  font-family: var(--font-serif);
  font-size: 1.42rem;
  font-weight: 500;
  line-height: 1.45;
  margin: 0;
  letter-spacing: -0.005em;
}

.editorial-list { margin: 0; padding: 0; list-style: none; counter-reset: item; }
.editorial-list li {
  position: relative;
  padding: 0.55rem 0 0.55rem 2.2rem;
  border-top: 1px dotted var(--rule);
  line-height: 1.6;
}
.editorial-list li:first-child { border-top: none; }
.editorial-list li::before {
  counter-increment: item;
  content: counter(item, decimal-leading-zero);
  position: absolute;
  left: 0;
  top: 0.72rem;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--accent);
}

.claims-list { display: flex; flex-direction: column; }
.claim-item { border-top: 1px dotted var(--rule); padding: 0.85rem 0 0.85rem 1rem; border-left: 3px solid var(--accent); margin-left: 0; }
.claim-item:first-child { border-top: none; }
.claim-item p { margin: 0.4rem 0 0; line-height: 1.6; }
.claim-head { display: flex; align-items: center; gap: 0.6rem; flex-wrap: wrap; }

/* Sentiment scale */
.sentiment-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 0.4rem;
}
.sentiment-score {
  font-family: var(--font-mono);
  font-size: 1.3rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.sentiment-scale {
  position: relative;
  height: 2px;
  background: var(--rule-dark);
  margin: 1rem 0 0.4rem;
}
.sentiment-scale::before {
  content: "";
  position: absolute;
  left: 50%;
  top: -4px;
  width: 1px;
  height: 10px;
  background: var(--ink-faint);
}
.sentiment-marker {
  position: absolute;
  top: -5px;
  width: 12px;
  height: 12px;
  background: var(--accent);
  transform: translateX(-50%) rotate(45deg);
}
.sentiment-scale-labels {
  display: flex;
  justify-content: space-between;
  font-family: var(--font-mono);
  font-size: 0.64rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-faint);
  margin-bottom: 0.8rem;
}

/* Entities */
.entity-block { margin-bottom: 1.1rem; }
.entity-block:last-child { margin-bottom: 0; }
.entity-label {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-faint);
  margin-bottom: 0.45rem;
}
.chip-list { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.chip {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  border: 1px solid var(--rule-dark);
  padding: 0.14rem 0.5rem;
  background: var(--paper-raised);
}

/* Stats ledger */
.stats-grid { margin: 0; }
.stats-grid div {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 0.42rem 0;
  border-bottom: 1px dotted var(--rule);
}
.stats-grid div:last-child { border-bottom: none; }
.stats-grid dt {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-faint);
}
.stats-grid dd {
  margin: 0;
  font-family: var(--font-mono);
  font-weight: 600;
  font-size: 0.98rem;
  font-variant-numeric: tabular-nums;
}

.link-list { margin: 0; padding-left: 1rem; font-size: 0.8rem; word-break: break-all; font-family: var(--font-mono); }

/* Thread reconstruction */
.thread-group { margin-bottom: 1.4rem; }
.thread-subhead {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-faint);
  margin: 0 0 0.6rem;
}
.tweet-box {
  border: 1px solid var(--rule);
  background: var(--paper-raised);
  padding: 0.95rem 1.1rem;
  margin-bottom: 0.6rem;
}
.tweet-focal { border: 1px solid var(--rule-dark); border-left: 4px solid var(--accent); }
.tweet-quoted { border-left: 4px solid var(--ink-faint); }
.tweet-head { display: flex; flex-wrap: wrap; gap: 0.45rem; align-items: baseline; margin-bottom: 0.35rem; font-size: 0.92rem; }
.tweet-head strong { font-family: var(--font-serif); font-size: 1rem; }
.tweet-text { margin: 0; white-space: pre-wrap; word-break: break-word; line-height: 1.65; }
.tweet-metrics {
  display: flex;
  gap: 1.3rem;
  margin-top: 0.7rem;
  padding-top: 0.6rem;
  border-top: 1px dotted var(--rule);
  font-family: var(--font-mono);
  font-size: 0.74rem;
  letter-spacing: 0.04em;
  color: var(--ink-soft);
  font-variant-numeric: tabular-nums;
}
.tweet-metrics b { color: var(--ink); font-weight: 600; }

/* ---------- History ---------- */

.history-list { display: flex; flex-direction: column; }
.history-row { display: block; color: var(--ink); }
.history-tldr { margin: 0; color: var(--ink-soft); }
.pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 1.2rem;
  margin-top: 1.8rem;
  font-family: var(--font-mono);
  font-size: 0.8rem;
}

/* ---------- Footer ---------- */

.site-footer {
  border-top: 3px double var(--rule-dark);
  padding: 1.6rem 0 2.2rem;
  color: var(--ink-soft);
  font-size: 0.85rem;
  overflow: hidden;
}
.footer-inner {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem;
  font-family: var(--font-mono);
  font-size: 0.74rem;
  letter-spacing: 0.05em;
}
.footer-word {
  font-family: var(--font-serif);
  font-weight: 700;
  font-size: clamp(3rem, 10vw, 6.5rem);
  line-height: 1;
  letter-spacing: 0.02em;
  color: transparent;
  -webkit-text-stroke: 1px var(--ink-faint);
  text-align: center;
  margin-top: 1.6rem;
  user-select: none;
}

/* ---------- Responsive ---------- */

@media (max-width: 900px) {
  .report-layout { grid-template-columns: 1fr; gap: 1rem; }
  .report-sidebar { border-left: none; padding-left: 0; border-top: 1px solid var(--rule); padding-top: 1.6rem; }
  .hero-row { flex-direction: column; }
  .mode-banner { transform: rotate(-1.6deg); }
}
@media (max-width: 640px) {
  .input-row { flex-direction: column; }
  .report-row { grid-template-columns: 1fr; gap: 0.4rem; }
  .report-row-side { flex-direction: row; align-items: center; }
  .header-inner { flex-wrap: wrap; }
  .masthead-top-inner .mt-mid { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}
