/* Company Watch API — shared stylesheet
   Plain CSS, no build step. Design intent: informative, brief, functional —
   a developer tool for finance/compliance teams, not a consumer brand. */

/* ---------- Design tokens ---------- */
/* Palette carried over from the Website2 concept (paper/ink/teal) — fonts
   are unchanged from this site's own Inter / JetBrains Mono pairing. */
:root {
  --color-bg: #E9EAE3;
  --color-bg-subtle: #DEE0D6;
  --color-surface: #F4F4EF;
  --color-border: #BFC5B7;
  --color-border-strong: #9DA595;
  --color-text: #16232D;
  --color-text-muted: #48575F;
  --color-text-faint: #7C8A88;

  --color-primary: #24594C;
  --color-primary-hover: #16332B;
  --color-primary-contrast: #E9EAE3;
  --color-accent-bg: #DEE8E3;
  --color-accent-border: #A4B7AE;

  --color-danger: #A03A29;
  --color-danger-bg: rgba(160, 58, 41, 0.1);
  --color-warning-bg: rgba(169, 114, 29, 0.12);
  --color-warning-border: rgba(169, 114, 29, 0.32);

  --color-code-bg: #16332B;
  --color-code-text: #DCE4DE;
  --color-code-border: #234A3D;

  --font-sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  --radius-sm: 4px;
  --radius: 8px;
  --radius-lg: 12px;
  --shadow-sm: 0 1px 2px rgba(22, 35, 45, 0.08);
  --shadow-md: 0 4px 16px rgba(22, 35, 45, 0.1);

  --container-width: 1120px;
}

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.55;
  color: var(--color-text);
  background: var(--color-bg);
}
img, svg { max-width: 100%; display: block; }
a { color: var(--color-primary); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { line-height: 1.2; margin: 0 0 0.5em; font-weight: 650; letter-spacing: -0.01em; }
p { margin: 0 0 1em; }
ul, ol { margin: 0 0 1em; padding-left: 1.3em; }
code, pre, kbd { font-family: var(--font-mono); }
code {
  background: var(--color-accent-bg);
  border: 1px solid var(--color-accent-border);
  padding: 0.1em 0.4em;
  border-radius: var(--radius-sm);
  font-size: 0.88em;
}
pre {
  background: var(--color-code-bg);
  color: var(--color-code-text);
  border: 1px solid var(--color-code-border);
  border-radius: var(--radius);
  padding: 1rem 1.1rem;
  overflow-x: auto;
  font-size: 0.86rem;
  line-height: 1.6;
}
pre code { background: none; border: none; padding: 0; color: inherit; font-size: inherit; }
table { border-collapse: collapse; width: 100%; }
hr { border: none; border-top: 1px solid var(--color-border); margin: 2.5rem 0; }

/* ---------- Layout ---------- */
.container {
  max-width: var(--container-width);
  margin: 0 auto;
  padding: 0 24px;
}
.section { padding: 64px 0; }
.section-tight { padding: 40px 0; }
.section-alt { background: var(--color-bg-subtle); }

/* ---------- Nav ---------- */
.site-header {
  border-bottom: 1px solid var(--color-border);
  position: sticky;
  top: 0;
  background: var(--color-bg);
  z-index: 20;
}
.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}
.nav-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--color-text);
}
.nav-brand:hover { text-decoration: none; }
.nav-brand .mark { display: flex; width: 24px; height: 24px; flex: none; }
.nav-brand .mark svg { width: 100%; height: 100%; display: block; }
.nav-brand .mark .icon-badge { fill: var(--color-primary); }
.nav-brand .mark .icon-glyph { fill: var(--color-primary-contrast); stroke: var(--color-primary-contrast); }
.nav-links {
  display: flex;
  align-items: center;
  gap: 28px;
  list-style: none;
  margin: 0; padding: 0;
}
.nav-links a {
  color: var(--color-text-muted);
  font-size: 0.94rem;
  font-weight: 500;
}
.nav-links a:hover, .nav-links a[aria-current="page"] {
  color: var(--color-text);
  text-decoration: none;
}
.nav-cta { display: flex; align-items: center; gap: 12px; }
.nav-toggle { display: none; }

@media (max-width: 760px) {
  .nav-links { display: none; }
  .nav-toggle { display: inline-flex; }
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 0.92rem;
  border: 1px solid transparent;
  cursor: pointer;
  transition: background-color 0.12s ease, border-color 0.12s ease, color 0.12s ease;
}
.btn:hover { text-decoration: none; }
.btn-primary {
  background: var(--color-primary);
  color: var(--color-primary-contrast);
}
.btn-primary:hover { background: var(--color-primary-hover); }
.btn-secondary {
  background: transparent;
  color: var(--color-text);
  border-color: var(--color-border-strong);
}
.btn-secondary:hover { border-color: var(--color-text-muted); background: var(--color-bg-subtle); }
.btn-block { width: 100%; }
.btn[disabled] { opacity: 0.6; cursor: not-allowed; }
.btn-sm { padding: 6px 12px; font-size: 0.82rem; }

/* ---------- Hero ---------- */
.hero { padding: 88px 0 64px; }
.hero .eyebrow {
  display: inline-block;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--color-primary);
  background: var(--color-accent-bg);
  border: 1px solid var(--color-accent-border);
  padding: 5px 10px;
  border-radius: 999px;
  margin-bottom: 20px;
}
.hero h1 {
  font-size: clamp(2rem, 4vw, 2.9rem);
  max-width: 20ch;
}
.hero .lede {
  font-size: 1.15rem;
  color: var(--color-text-muted);
  max-width: 62ch;
  margin-bottom: 28px;
}
.hero-actions { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.hero-note { font-size: 0.86rem; color: var(--color-text-faint); }

/* ---------- Grid / cards ---------- */
.grid { display: grid; gap: 24px; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 860px) {
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
}

.card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 24px;
}
.card h3 { font-size: 1.05rem; margin-bottom: 8px; }
.card p:last-child { margin-bottom: 0; }
.card .tag {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--color-text-faint);
  margin-bottom: 10px;
}

/* ---------- Live feed console (mirrors the Website2 concept mock) ---------- */
.console {
  background: var(--color-code-bg);
  border: 1px solid var(--color-code-border);
  border-radius: var(--radius-lg);
  padding: 22px 22px 18px;
  box-shadow: var(--shadow-md);
}
.console-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 14px;
  border-bottom: 1px solid rgba(220, 228, 222, 0.16);
  margin-bottom: 4px;
}
.console-title {
  font-family: var(--font-mono);
  font-size: 0.82rem;
  color: rgba(220, 228, 222, 0.65);
}
.live-dot {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-family: var(--font-mono);
  font-size: 0.76rem;
  color: #E8B15A;
}
.live-dot::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #E8B15A;
  animation: feed-pulse 1.8s ease-in-out infinite;
}
@keyframes feed-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.35; }
}
.feed { list-style: none; margin: 0; padding: 0; min-height: 204px; }
.feed li {
  padding: 13px 0;
  border-bottom: 1px solid rgba(220, 228, 222, 0.1);
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 14px;
  align-items: start;
  animation: feed-enter 0.5s ease both;
}
.feed li:last-child { border-bottom: none; }
@keyframes feed-enter {
  from { opacity: 0; transform: translateY(-6px); }
  to { opacity: 1; transform: translateY(0); }
}
.feed .tag {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  padding: 3px 7px;
  border-radius: var(--radius-sm);
  white-space: nowrap;
  margin-top: 2px;
}
.feed .tag-routine { background: rgba(220, 228, 222, 0.14); color: rgba(220, 228, 222, 0.75); }
.feed .tag-notable { background: rgba(232, 177, 90, 0.18); color: #E8B15A; }
.feed .tag-urgent { background: rgba(214, 105, 84, 0.2); color: #D66954; }
.feed-body { color: rgba(220, 228, 222, 0.9); font-size: 0.9rem; }
.feed-company {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: rgba(220, 228, 222, 0.5);
  margin-top: 3px;
}
@media (prefers-reduced-motion: reduce) {
  .feed li { animation: none; }
  .live-dot::before { animation: none; }
}

/* ---------- Section headings ---------- */
.section-head { max-width: 640px; margin: 0 0 40px; }
.section-head .kicker {
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--color-primary);
  margin-bottom: 8px;
  display: block;
}
.section-head h2 { font-size: clamp(1.5rem, 2.6vw, 2rem); }
.section-head p { color: var(--color-text-muted); font-size: 1.03rem; }
.section-head.center { margin-left: auto; margin-right: auto; text-align: center; }

/* ---------- Steps ---------- */
.steps { counter-reset: step; }
.step {
  display: flex;
  gap: 18px;
  padding: 20px 0;
  border-top: 1px solid var(--color-border);
}
.step:first-child { border-top: none; }
.step-num {
  flex: none;
  width: 32px; height: 32px;
  border-radius: 50%;
  background: var(--color-accent-bg);
  color: var(--color-primary);
  border: 1px solid var(--color-accent-border);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 0.9rem;
}
.step h3 { margin-bottom: 4px; font-size: 1rem; }
.step p { color: var(--color-text-muted); margin-bottom: 0; }

/* ---------- Use cases ---------- */
.cases {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
}
.case {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 24px;
}
.case-buyer {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--color-text-faint);
  margin-bottom: 10px;
}
.case h3 { font-size: 1.02rem; margin-bottom: 8px; }
.case p { font-size: 0.9rem; color: var(--color-text-muted); margin-bottom: 0; }
@media (max-width: 860px) {
  .cases { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 560px) {
  .cases { grid-template-columns: 1fr; }
}

/* ---------- Pricing ---------- */
.pricing-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 28px;
  display: flex;
  flex-direction: column;
}
.pricing-card.is-featured {
  border-color: var(--color-primary);
  box-shadow: var(--shadow-md);
  position: relative;
}
.pricing-card .badge {
  position: absolute;
  top: -12px; left: 24px;
  background: var(--color-primary);
  color: var(--color-primary-contrast);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  padding: 4px 10px;
  border-radius: 999px;
}
.pricing-card .tier-name { font-size: 0.95rem; font-weight: 700; color: var(--color-text-muted); margin-bottom: 6px; }
.pricing-card .price { font-size: 2.1rem; font-weight: 750; margin-bottom: 2px; }
.pricing-card .price small { font-size: 0.95rem; font-weight: 500; color: var(--color-text-muted); }
.pricing-card .price-note { font-size: 0.84rem; color: var(--color-text-faint); margin-bottom: 20px; }
.pricing-card ul { list-style: none; padding: 0; margin: 0 0 24px; flex: 1; }
.pricing-card li {
  display: flex;
  gap: 10px;
  padding: 7px 0;
  font-size: 0.92rem;
  color: var(--color-text);
  border-top: 1px solid var(--color-border);
}
.pricing-card li:first-child { border-top: none; }
.pricing-card li .check { color: var(--color-primary); flex: none; }

.compare-table { font-size: 0.92rem; }
.compare-table th, .compare-table td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--color-border);
  text-align: left;
}
.compare-table th { color: var(--color-text-muted); font-weight: 600; }
.compare-table td.center, .compare-table th.center { text-align: center; }

/* ---------- Forms ---------- */
.field { margin-bottom: 18px; }
.field label {
  display: block;
  font-size: 0.86rem;
  font-weight: 600;
  margin-bottom: 6px;
}
.field input[type="email"],
.field input[type="text"] {
  width: 100%;
  padding: 10px 12px;
  font-size: 0.95rem;
  font-family: inherit;
  color: var(--color-text);
  background: var(--color-surface);
  border: 1px solid var(--color-border-strong);
  border-radius: var(--radius-sm);
}
.field input:focus { outline: 2px solid var(--color-primary); outline-offset: 1px; }
.field-hint { font-size: 0.82rem; color: var(--color-text-faint); margin-top: 6px; }

.auth-panel {
  max-width: 580px;
  margin: 0 auto;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 32px;
  box-shadow: var(--shadow-sm);
}
.auth-panel h1 { font-size: 1.4rem; margin-bottom: 8px; }
.auth-panel .lede { color: var(--color-text-muted); margin-bottom: 24px; font-size: 0.95rem; }

.state-block { display: none; }
.state-block.is-active { display: block; }

.notice {
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  font-size: 0.88rem;
  margin-bottom: 18px;
  border: 1px solid transparent;
}
.notice-error { background: var(--color-danger-bg); border-color: rgba(179,38,30,0.25); color: var(--color-danger); }
.notice-warning { background: var(--color-warning-bg); border-color: var(--color-warning-border); color: #7a5c00; }
.notice-success { background: var(--color-accent-bg); border-color: var(--color-accent-border); color: var(--color-primary); }

/* The `hidden` attribute is only `display: none` in the UA stylesheet, so any
   author rule that sets `display` — .plan-summary below is flex, .plan-choice is
   grid — silently beats it and the element shows anyway. The billing pages
   toggle those two with el.hidden, so this has to win. */
[hidden] { display: none !important; }

/* The chosen-plan strip on the sign-up page, and the current-plan strip on the
   upgrade page. Same component both times: it answers "what am I about to be
   charged for?" at the moment somebody is deciding whether to hand over a
   card, which is the one place on this site where being vague costs money. */
.plan-summary {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  background: var(--color-accent-bg);
  border: 1px solid var(--color-accent-border);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  margin-bottom: 22px;
}
.plan-summary .plan-name { font-weight: 700; color: var(--color-primary); }
.plan-summary .plan-price { font-weight: 600; }
.plan-summary .plan-meta { font-size: 0.84rem; color: var(--color-text-muted); width: 100%; }

/* Radio-card plan chooser on the upgrade page. */
.plan-choice { display: grid; gap: 10px; margin-bottom: 20px; }
.plan-choice label {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  border: 1px solid var(--color-border-strong);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  cursor: pointer;
  font-size: 0.92rem;
}
.plan-choice label:hover { border-color: var(--color-primary); }
.plan-choice input { margin-top: 3px; }
.plan-choice .plan-choice-name { font-weight: 600; display: block; }
.plan-choice .plan-choice-note { color: var(--color-text-muted); font-size: 0.85rem; }
.plan-choice label.is-current { opacity: 0.55; cursor: not-allowed; }

.key-box {
  font-family: var(--font-mono);
  font-size: 0.92rem;
  background: var(--color-code-bg);
  color: var(--color-code-text);
  border: 1px solid var(--color-code-border);
  border-radius: var(--radius);
  padding: 14px 16px;
  margin: 16px 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
/* Scrollable single line rather than wrapped: a credential reads better as
   one unbroken line (and copies cleanly) than split mid-character across
   two, and — the actual bug this fixes — letting it wrap was what starved
   the Copy button of width and wrapped its own label to "Co"/"py". Sized in
   ch (monospace character width) to fit the API key's fixed length with no
   scrollbar, given .auth-panel's width above. */
.key-box .key-value {
  flex: 0 1 auto;
  min-width: 0;
  width: 56ch;
  font-size: 0.8rem;
  white-space: nowrap;
}
.key-box .btn {
  flex-shrink: 0;
  /* .btn-secondary's default dark text is unreadable on this dark-green box. */
  color: var(--color-code-text);
  border-color: var(--color-code-border);
}
.key-box .btn:hover {
  background: var(--color-code-border);
  border-color: var(--color-code-text);
}

.spinner {
  width: 20px; height: 20px;
  border-radius: 50%;
  border: 2px solid var(--color-border-strong);
  border-top-color: var(--color-primary);
  animation: spin 0.7s linear infinite;
  margin: 0 auto;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Checkbox field ---------- */
.field-checkbox {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 0.86rem;
  color: var(--color-text-muted);
  margin-top: 16px;
}
.field-checkbox input[type="checkbox"] {
  margin-top: 3px;
  flex: none;
  width: 16px;
  height: 16px;
}
.link-btn {
  background: none;
  border: none;
  padding: 0;
  font: inherit;
  color: var(--color-primary);
  cursor: pointer;
}
.link-btn:hover { text-decoration: underline; }

/* ---------- Terms modal ---------- */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(10, 14, 20, 0.55);
  align-items: center;
  justify-content: center;
  padding: 24px;
  z-index: 100;
}
.modal-overlay.is-open { display: flex; }
.modal {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  width: 100%;
  max-width: 640px;
  max-height: 82vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 24px;
  border-bottom: 1px solid var(--color-border);
  flex: none;
}
.modal-header h2 { margin: 0; font-size: 1.1rem; }
.modal-close {
  background: none;
  border: none;
  font-size: 1.5rem;
  line-height: 1;
  color: var(--color-text-faint);
  cursor: pointer;
  padding: 2px 6px;
  flex: none;
}
.modal-close:hover { color: var(--color-text); }
.modal-body {
  padding: 4px 24px 28px;
  overflow-y: auto;
  font-size: 0.9rem;
}
.modal-body h2 { font-size: 0.98rem; margin-top: 1.7em; }
.modal-body h2:first-of-type { margin-top: 1.2em; }
.modal-body p, .modal-body ul { margin-bottom: 1em; }
.modal-body hr { margin: 1.8rem 0; }

/* ---------- Footer ---------- */
.site-footer {
  border-top: 1px solid var(--color-border);
  padding: 48px 0 32px;
  background: var(--color-bg-subtle);
  margin-top: 80px;
}
.footer-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: 32px;
  margin-bottom: 32px;
}
@media (max-width: 760px) {
  .footer-grid { grid-template-columns: 1fr 1fr; }
}
.footer-grid h4 {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-text-faint);
  margin-bottom: 12px;
}
.footer-grid ul { list-style: none; padding: 0; margin: 0; }
.footer-grid li { margin-bottom: 8px; }
.footer-grid a { color: var(--color-text-muted); font-size: 0.9rem; }
.footer-bottom {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  padding-top: 24px;
  border-top: 1px solid var(--color-border);
  font-size: 0.84rem;
  color: var(--color-text-faint);
}

/* ---------- Docs layout ---------- */
.docs-layout {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 48px;
}
@media (max-width: 860px) {
  .docs-layout { grid-template-columns: 1fr; }
}
.docs-nav { font-size: 0.9rem; }
/* Grid items default to min-width:auto, so a long <pre> line (curl examples etc.)
   forces this column — and the whole page — wider than the viewport on mobile. */
.docs-content { min-width: 0; }
.docs-nav h4 {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-text-faint);
  margin: 20px 0 8px;
}
.docs-nav h4:first-child { margin-top: 0; }
.docs-nav ul { list-style: none; padding: 0; margin: 0 0 8px; }
.docs-nav a { color: var(--color-text-muted); display: block; padding: 4px 0; }
.docs-nav a[aria-current="page"] { color: var(--color-primary); font-weight: 600; }

.docs-content h2 { margin-top: 2.2em; font-size: 1.35rem; }
.docs-content h2:first-child { margin-top: 0; }
.docs-content h3 { font-size: 1.05rem; margin-top: 1.6em; }

/* ---------- Standalone API reference page (no site header/footer/docs-nav — Scalar has its own) ---------- */
body.reference-page { margin: 0; }
.reference-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 20px;
  border-bottom: 1px solid var(--color-border);
  background: var(--color-bg);
  position: sticky;
  top: 0;
  z-index: 20;
}
.reference-back { font-size: 0.86rem; color: var(--color-text-muted); }
.reference-back:hover { color: var(--color-text); }
/* Match the page background before/behind Scalar's mount to avoid a white flash on load. */
#cw-api-reference { background: var(--color-bg); min-height: calc(100vh - 45px); }

/* ---------- Utility ---------- */
.text-muted { color: var(--color-text-muted); }
.text-center { text-align: center; }
.mt-0 { margin-top: 0; }
.small { font-size: 0.86rem; }
