/* CorpLens — brand sheet. Colours measured on the logo (docs/brand/README.md).
   One memorable element: the evidence slip (a claim, its original sentence, its page).
   Document text is set in a serif so readers always see what comes from the source. */

:root {
  --lens: #002e1a;      /* "Lens" in the wordmark */
  --forest: #043621;    /* body of the C */
  --shadow: #00150b;    /* deepest green of the C */
  --sage: #619e7d;      /* lit edge of the C and the lens reflection */
  --ink: #000000;       /* "Corp" in the wordmark */
  --paper: #ffffff;
  --mist: #eef3ef;      /* behind source excerpts */
  --rule: #d6e2da;
  --muted: #45564c;
  --sans: "Schibsted Grotesk", system-ui, -apple-system, "Segoe UI", sans-serif;
  --serif: "Source Serif 4", Georgia, "Times New Roman", serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --radius-slip: 14px;
  --radius-control: 8px;
  --gutter: clamp(16px, 4vw, 48px);
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 1.0625rem;
  line-height: 1.55;
}

a { color: var(--forest); text-underline-offset: 3px; }
a:hover { color: var(--lens); }

:focus-visible {
  outline: 3px solid var(--sage);
  outline-offset: 3px;
  border-radius: 4px;
}

.wrap { max-width: 1160px; margin: 0 auto; padding: 0 var(--gutter); }

/* Header */
.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 22px 0;
}
.brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; }
.brand img { width: 34px; height: auto; }
.wordmark { font-weight: 800; font-size: 1.35rem; letter-spacing: -0.02em; color: var(--ink); }
.wordmark span { color: var(--lens); }

/* Buttons */
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0 20px;
  border-radius: var(--radius-control);
  border: 1.5px solid var(--lens);
  font: 600 1rem/1 var(--sans);
  text-decoration: none;
  cursor: pointer;
}
.button-primary { background: var(--lens); color: var(--paper); }
.button-primary:hover { background: var(--shadow); color: var(--paper); }
.button-quiet { background: transparent; color: var(--lens); }
.button-quiet:hover { background: var(--mist); color: var(--lens); }

/* Hero */
.hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr);
  gap: clamp(32px, 6vw, 88px);
  align-items: center;
  padding: clamp(32px, 7vw, 96px) 0 clamp(48px, 8vw, 112px);
}
.hero h1 {
  font-size: clamp(2.4rem, 5.2vw, 4.1rem);
  line-height: 1.02;
  letter-spacing: -0.035em;
  font-weight: 800;
  color: var(--lens);
  margin: 0 0 22px;
  max-width: 13ch;
}
.hero .lede { font-size: 1.2rem; color: var(--muted); max-width: 34rem; margin: 0 0 30px; }
.actions { display: flex; flex-wrap: wrap; gap: 12px; }

/* The evidence slip */
.slip {
  border: 1.5px solid var(--rule);
  border-radius: var(--radius-slip);
  background: var(--paper);
  box-shadow: 0 30px 60px -38px rgba(0, 46, 26, 0.45);
  overflow: hidden;
}
.slip-claim { padding: 26px 28px 22px; }
.slip-claim .label { color: var(--muted); font-size: 0.85rem; margin: 0 0 8px; }
.slip-claim p.claim { margin: 0; font-size: 1.18rem; line-height: 1.4; font-weight: 600; }
.slip-source {
  position: relative;
  background: var(--mist);
  padding: 22px 28px 22px 44px;
  border-top: 1.5px solid var(--rule);
}
.slip-source::before {            /* the lens: the claim is focused on its sentence */
  content: "";
  position: absolute;
  left: 26px; top: 22px; bottom: 22px;
  width: 4px;
  border-radius: 2px;
  background: var(--sage);
}
.slip-source blockquote {
  margin: 0;
  font-family: var(--serif);
  font-size: 1.04rem;
  line-height: 1.6;
  color: var(--shadow);
}
.slip-source mark { background: rgba(97, 158, 125, 0.32); color: inherit; padding: 0 2px; border-radius: 3px; }
.slip-ref {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 4px 16px;
  margin: 16px 0 0;
  font-size: 0.88rem;
  color: var(--muted);
}
.slip-ref dt { color: var(--forest); font-weight: 600; }
.slip-ref dd { margin: 0; overflow-wrap: anywhere; }

/* Sections */
.section { padding: clamp(48px, 7vw, 88px) 0; border-top: 1.5px solid var(--rule); }
.section h2 {
  font-size: clamp(1.7rem, 3vw, 2.3rem);
  letter-spacing: -0.025em;
  line-height: 1.1;
  margin: 0 0 14px;
  color: var(--lens);
  max-width: 22ch;
}
.section .intro { color: var(--muted); max-width: 40rem; margin: 0 0 36px; }

.chain { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: 28px; }
.chain li { counter-increment: step; }
.chain li::before {
  content: counter(step);
  display: inline-grid; place-items: center;
  width: 34px; height: 34px; margin-bottom: 14px;
  border-radius: 50%;
  background: var(--lens); color: var(--paper);
  font-weight: 700;
}
.chain h3 { margin: 0 0 6px; font-size: 1.15rem; }
.chain p { margin: 0; color: var(--muted); max-width: 32ch; }

.abstain {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: clamp(28px, 5vw, 64px);
  align-items: start;
}
.verdict {
  border-left: 4px solid var(--sage);
  padding: 4px 0 4px 20px;
}
.verdict .question { margin: 0 0 10px; font-weight: 600; }
.verdict .answer { margin: 0; font-family: var(--serif); color: var(--shadow); }

pre.api {
  margin: 0;
  background: var(--shadow);
  color: #d7e8de;
  border-radius: var(--radius-slip);
  padding: 22px 24px;
  font: 0.86rem/1.6 var(--mono);
  overflow-x: auto;
}
pre.api .key { color: #9fd3b5; }

.site-footer { padding: 32px 0 48px; color: var(--muted); font-size: 0.9rem; border-top: 1.5px solid var(--rule); }

/* Sign-in */
.auth {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 32px var(--gutter);
  background: linear-gradient(180deg, var(--mist) 0%, var(--paper) 55%);
}
.auth-panel { width: 100%; max-width: 400px; }
.auth-panel .brand { margin-bottom: 28px; }
.auth-panel h1 { font-size: 1.7rem; letter-spacing: -0.02em; margin: 0 0 6px; color: var(--lens); }
.auth-panel .intro { color: var(--muted); margin: 0 0 24px; }
.field { margin-bottom: 16px; }
.field label { display: block; font-weight: 600; font-size: 0.95rem; margin-bottom: 6px; }
.field input {
  width: 100%;
  min-height: 46px;
  padding: 0 14px;
  border: 1.5px solid var(--rule);
  border-radius: var(--radius-control);
  font: 1rem var(--sans);
  background: var(--paper);
}
.field input:focus { border-color: var(--sage); outline: none; box-shadow: 0 0 0 3px rgba(97, 158, 125, 0.28); }
.form-error {
  background: #fbeceb; color: #7a1f17;
  border-radius: var(--radius-control);
  padding: 12px 14px; margin-bottom: 18px; font-size: 0.95rem;
}
.auth-panel .button { width: 100%; margin-top: 6px; }
.auth-back { display: inline-block; margin-top: 20px; font-size: 0.95rem; }

@media (max-width: 860px) {
  .hero, .abstain { grid-template-columns: 1fr; }
  .chain { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: no-preference) {
  .slip-source::before { animation: focus-in 900ms cubic-bezier(.2,.7,.2,1) 250ms both; transform-origin: top; }
  @keyframes focus-in { from { transform: scaleY(0); } to { transform: scaleY(1); } }
}

/* Private app */
.app { min-height: 100vh; background: #f7faf8; }
.app-bar { background: var(--paper); border-bottom: 1.5px solid var(--rule); }
.app-bar-inner { display: flex; align-items: center; gap: 28px; min-height: 64px; }
.app-nav { display: flex; gap: 18px; flex: 1; }
.app-nav a { text-decoration: none; color: var(--muted); font-weight: 600; padding: 6px 0; border-bottom: 2px solid transparent; }
.app-nav a[aria-current="page"], .app-nav a:hover { color: var(--lens); border-bottom-color: var(--sage); }
.app-user { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: 0.92rem; margin: 0; }
.link-button { background: none; border: 0; padding: 0; font: 600 0.92rem var(--sans); color: var(--forest); cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
.app-main { padding-top: 32px; padding-bottom: 64px; }
.page-title { font-size: clamp(1.8rem, 3vw, 2.4rem); letter-spacing: -0.03em; color: var(--lens); margin: 0 0 6px; }
.crumb { margin: 0 0 6px; font-size: 0.92rem; color: var(--muted); }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.search { display: flex; gap: 10px; margin: 20px 0 24px; max-width: 640px; }
.search input, .ask-form textarea {
  flex: 1; min-height: 46px; padding: 10px 14px; border: 1.5px solid var(--rule);
  border-radius: var(--radius-control); font: 1rem var(--sans); background: var(--paper); width: 100%;
}
.search input:focus, .ask-form textarea:focus { border-color: var(--sage); outline: none; box-shadow: 0 0 0 3px rgba(97,158,125,.28); }
.company-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; max-width: 760px; }
.company-list a { display: flex; justify-content: space-between; align-items: baseline; gap: 16px; padding: 18px 20px; background: var(--paper); border: 1.5px solid var(--rule); border-radius: 10px; text-decoration: none; color: var(--ink); }
.company-list a:hover { border-color: var(--sage); }
.company-name { font-weight: 700; font-size: 1.1rem; }
.company-meta, .doc-meta, .coverage, .figure-ref, .evidence-ref, .hint { color: var(--muted); font-size: 0.9rem; }
.empty { color: var(--muted); }
.company-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 20px; flex-wrap: wrap; margin-bottom: 24px; }
.panel { background: var(--paper); border: 1.5px solid var(--rule); border-radius: 12px; padding: 24px 26px; margin-bottom: 20px; }
.panel h2 { font-size: 1.25rem; margin: 0 0 14px; color: var(--lens); letter-spacing: -0.01em; }
.panel-head { display: flex; justify-content: space-between; align-items: baseline; gap: 16px; flex-wrap: wrap; }
.figures { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 18px 24px; margin: 0; }
.figure dt { color: var(--muted); font-size: 0.9rem; }
.figure dd { margin: 2px 0 0; }
.figure strong { font-size: 1.35rem; color: var(--lens); }
.profile-section { border-top: 1.5px solid var(--rule); }
.profile-section > summary { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 0; cursor: pointer; list-style: none; }
.profile-section > summary::-webkit-details-marker { display: none; }
.section-title { font-weight: 700; font-size: 1.05rem; }
.badge { font-size: 0.82rem; padding: 3px 10px; border-radius: 999px; background: #f1f2f1; color: var(--muted); white-space: nowrap; }
.badge-ok { background: var(--mist); color: var(--forest); }
.claims { list-style: none; margin: 0 0 16px; padding: 0; display: grid; gap: 14px; }
.claim-text { margin: 0 0 6px; font-weight: 600; }
.evidence > summary { cursor: pointer; color: var(--forest); font-size: 0.9rem; }
.evidence blockquote { margin: 10px 0 6px; padding: 12px 16px; background: var(--mist); border-left: 4px solid var(--sage); border-radius: 6px; font-family: var(--serif); color: var(--shadow); }
.abstain-note { margin: 0 0 16px; font-family: var(--serif); color: var(--shadow); }
.documents { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.documents li { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.ask-form { max-width: 760px; display: grid; gap: 10px; margin: 20px 0 24px; }
.ask-form label { font-weight: 600; }
.ask-form .button { justify-self: start; }
.answer { max-width: 900px; }
@media (max-width: 640px) {
  .app-user span { display: none; }
  .search { flex-direction: column; }
}
.evidence-label { margin: 10px 0 0; font-size: 0.82rem; color: var(--muted); }
.evidence-label + blockquote { margin-top: 4px; }

/* Legal pages */
.legal { max-width: 720px; padding: 24px 0 56px; }
.legal h1 { font-size: clamp(2rem, 4vw, 2.8rem); letter-spacing: -0.03em; color: var(--lens); margin: 0 0 8px; }
.legal h2 { font-size: 1.15rem; margin: 28px 0 6px; color: var(--lens); }
.legal p { margin: 0 0 12px; }
.legal-meta { color: var(--muted); font-size: 0.92rem; }
.legal-links { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.legal-links nav, .auth-legal { display: flex; gap: 18px; }
.auth-legal { margin-top: 16px; font-size: 0.88rem; }

/* Console */
.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin: 14px 0 22px; border-bottom: 1.5px solid var(--rule); }
.tabs a { padding: 10px 14px; text-decoration: none; color: var(--muted); font-weight: 600; border-bottom: 2px solid transparent; margin-bottom: -1.5px; }
.tabs a[aria-current="page"], .tabs a:hover { color: var(--lens); border-bottom-color: var(--sage); }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 10px 24px; margin: 0; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; }
.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 8px; vertical-align: middle; }
.dot-ok { background: var(--sage); }
.dot-warn { background: #d9a441; }
.dot-bad { background: #c0392b; }
.table { width: 100%; border-collapse: collapse; font-size: 0.94rem; }
.table th { text-align: left; color: var(--muted); font-weight: 600; padding: 8px 10px; border-bottom: 1.5px solid var(--rule); }
.table td { padding: 10px; border-bottom: 1px solid var(--rule); vertical-align: top; }
.mono-cell { font-family: var(--mono); font-size: 0.85rem; overflow-wrap: anywhere; }
.badge-bad { background: #fbeceb; color: #7a1f17; }
.inline-form { display: flex; gap: 14px; align-items: flex-end; flex-wrap: wrap; }
.inline-form label { display: grid; gap: 6px; font-weight: 600; font-size: 0.92rem; }
.inline-form input[type=email], .inline-form input[type=password], .inline-form input[type=text], .inline-form select {
  min-height: 42px; padding: 0 12px; border: 1.5px solid var(--rule); border-radius: var(--radius-control); font: 0.95rem var(--sans); background: var(--paper);
}
.inline-form .check { display: flex; align-items: center; gap: 8px; min-height: 42px; }
.row-actions { display: flex; gap: 14px; align-items: flex-start; flex-wrap: wrap; }
.row-actions form { margin: 0; }
.mini > summary { cursor: pointer; color: var(--forest); font-weight: 600; font-size: 0.92rem; }
.mini form { display: flex; gap: 8px; margin-top: 8px; }
.mini input { min-height: 36px; padding: 0 10px; border: 1.5px solid var(--rule); border-radius: var(--radius-control); }
.key-once { border-color: var(--sage); }
.flash { list-style: none; margin: 0 0 18px; padding: 0; display: grid; gap: 8px; }
.flash li { padding: 12px 14px; border-radius: var(--radius-control); background: var(--mist); color: var(--forest); }
.flash .flash-error { background: #fbeceb; color: #7a1f17; }
@media (max-width: 760px) { .table { display: block; overflow-x: auto; } }
