/*
 * Base + chrome. Tokens live in 00-tokens.css; components that carry a measurement live in
 * 40-primitives.css onward.
 *
 * This file is the kit's Terminal sheet, RETINTED rather than rewritten: the shapes (.container,
 * .section, .card, .btn, .field, .nav, .flash) are sound and the auth and research pages already
 * use them. What changed is the ground. The kit was warm-dark with an amber accent; Stalewatch is
 * a light page with dark data panels and a cyan accent, so every var() was remapped onto the new
 * token set and the radii collapsed to --r: 0.
 *
 * Rules whose job is to display a NUMBER do not belong here. They belong in the numbered files
 * above, written against the semantic aliases so they are correct on both grounds.
 */

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

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

body {
  margin: 0;
  background: var(--page);
  color: var(--fg-2);
  font-family: var(--font-sans);
  font-size: 17px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

::selection { background: var(--accent-ink); color: var(--page); }

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

img, svg { max-width: 100%; display: block; }

/* ------------------------------------------------------------ Typography --- */
h1, h2, h3, h4 {
  color: var(--fg);
  font-weight: 600;
  margin: 0 0 0.5em;
  letter-spacing: -0.025em;
  line-height: 1.1;
}

h1 { font-size: clamp(40px, 6vw, 66px); line-height: 1.0; letter-spacing: -0.035em; }
h2 { font-size: clamp(30px, 4vw, 40px); }
h3 { font-size: 20px; letter-spacing: -0.02em; }
h4 { font-size: 16px; letter-spacing: normal; }

p { margin: 0 0 1em; max-width: var(--measure); }

.eyebrow {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--accent-ink);
  margin: 0 0 16px;
}

.lede { font-size: 19px; color: var(--fg-3); }
.muted { color: var(--fg-3); }
.mono { font-family: var(--font-mono); }
.center { text-align: center; }

/* ------------------------------------------------------------- Layout ------ */
.container {
  width: 100%;
  max-width: var(--max);
  margin-inline: auto;
  padding-inline: var(--margin);
}

.section { padding-block: var(--s6); }
.section--surface { background: var(--card); }
.section--well { background: var(--panel-deep); }
.section--bordered { border-top: 1px solid var(--rule); border-bottom: 1px solid var(--rule); }

.grid { display: grid; gap: 24px; }
@media (min-width: 860px) {
  .grid--2 { grid-template-columns: repeat(2, 1fr); }
  .grid--3 { grid-template-columns: repeat(3, 1fr); }
  .grid--hero { grid-template-columns: 1.12fr 0.88fr; align-items: center; gap: 48px; }
}

/* ------------------------------------------------------------- Buttons ----- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-sans);
  font-size: 15px;
  font-weight: 600;
  padding: 14px 24px;
  border-radius: var(--r);
  border: 1px solid transparent;
  cursor: pointer;
  transition: background 120ms ease, border-color 120ms ease, color 120ms ease;
  white-space: nowrap;
}

.btn--primary { background: var(--accent-ink); color: var(--page); }
.btn--primary:hover { background: var(--accent-ink); color: var(--page); }

.btn--secondary { background: transparent; color: var(--fg-2); border-color: var(--rule); }
.btn--secondary:hover { border-color: var(--accent-ink); color: var(--fg); }

.btn--ghost {
  font-family: var(--font-mono);
  font-size: 14px;
  font-weight: 500;
  padding: 12px 0;
  color: oklch(0.84 0.008 80);
  background: transparent;
}
.btn--ghost:hover { color: var(--fg); }
.btn--block { width: 100%; justify-content: center; }
.btn--sm { padding: 9px 16px; font-size: 14px; }

/* Social sign-in buttons — branded per Google & Apple guidelines (4-color "G" on a light
   button, Apple mark on a black button). Fill colors are brand-mandated, not theme tokens. */
.provider-btns { display: flex; flex-direction: column; gap: 12px; margin-top: 16px; }
.provider-btns form.button_to { margin: 0; width: 100%; }
.provider-btn { display: flex; align-items: center; justify-content: center; gap: 11px; width: 100%; padding: 13px; border-radius: var(--r); border: 1px solid var(--rule); background: #fff; color: #1f1f1f; font-weight: 600; font-size: 15px; cursor: pointer; font-family: inherit; transition: filter 120ms ease; }
.provider-btn:hover { filter: brightness(0.96); }
.provider-btn--apple { border-color: #000; background: #000; color: #fff; }
.provider-btn--apple:hover { filter: brightness(1.4); }
.provider-btn__logo { flex: 0 0 auto; display: block; }
.provider-caption { text-align: center; color: var(--fg-3); font-size: 13px; margin: 4px 0 0; }

/* Pills & chips */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--accent-ink);
  border: 1px solid var(--rule);
  border-radius: var(--r);
  padding: 7px 14px;
}

.chip {
  display: inline-flex;
  align-items: center;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--fg-3);
  background: var(--panel-deep);
  border: 1px solid var(--rule);
  border-radius: var(--r);
  padding: 5px 10px;
}

/* --------------------------------------------------------------- Forms ----- */
label { display: block; font-size: 13.5px; color: var(--fg-3); margin-bottom: 6px; }

input[type="text"], input[type="email"], input[type="number"], input[type="password"],
textarea, select {
  width: 100%;
  font-family: var(--font-sans);
  font-size: 16px;
  color: var(--fg-2);
  background: var(--panel-deep);
  border: 1px solid var(--rule);
  border-radius: var(--r);
  padding: 12px 15px;
  outline: none;
  transition: border-color 120ms ease;
}
input:focus, textarea:focus, select:focus { border-color: var(--accent-ink); }
input::placeholder, textarea::placeholder { color: var(--fg-3); }

.field { margin-bottom: 16px; }
.field-hint { font-size: 13px; color: var(--fg-3); margin-top: 6px; }
.field-error { font-size: 13px; color: var(--breach-ink); margin-top: 6px; }

/* --------------------------------------------------------------- Cards ----- */
.card {
  background: var(--card);
  border: 1px solid var(--rule);
  border-radius: var(--r);
  padding: 24px;
}
.card__kicker {
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.04em;
  color: var(--accent-ink);
  margin-bottom: 10px;
}
.card__title { font-size: 16px; color: var(--fg); margin: 0 0 8px; }
.card__body { font-size: 13.5px; color: var(--fg-3); margin: 0; }

/* Green-check list */
.checks { list-style: none; margin: 0; padding: 0; }
.checks li { position: relative; padding-left: 26px; margin-bottom: 8px; font-size: 14px; color: var(--fg-3); }
.checks li::before { content: "✓"; position: absolute; left: 0; color: var(--inband-ink); font-weight: 600; }
/* ...and its inverse, for "what you can't do" lists. Same shape so the two read as a pair. */
.checks--x li::before { content: "✕"; color: var(--breach-ink); }

/* ---------------------------------------------------------- Code well ------ */

/* --------------------------------------------------------- Disclosure ------ */
/* Collapsed help: troubleshooting most readers never need to open. A native <details>,
   so it toggles with no JS — which is what we want under the enforced CSP, where an
   inline <script> would be blocked silently. */
.disclosure {
  background: var(--panel-deep);
  border: 1px solid var(--rule-soft);
  border-radius: var(--r);
}
.disclosure > summary {
  padding: 13px 16px;
  color: var(--fg-3);
  font-size: 14px;
  cursor: pointer;
  list-style: none;
}
.disclosure > summary::-webkit-details-marker { display: none; }
.disclosure > summary::before { content: "▸ "; color: var(--accent-ink); }
.disclosure[open] > summary { color: var(--fg-2); border-bottom: 1px solid var(--rule-soft); }
.disclosure[open] > summary::before { content: "▾ "; }
.disclosure__body { padding: 6px 16px 16px; color: var(--fg-3); font-size: 14px; line-height: 1.7; }
.disclosure__body ol { margin: 0; padding-left: 20px; }
.disclosure__body li { margin: 12px 0; }
.disclosure__body code {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--fg);
  overflow-wrap: anywhere;
}

/* ------------------------------------------------------ Warning callout ---- */
.callout {
  background: var(--card);
  border: 1px solid var(--breach);
  border-radius: var(--r);
  padding: 18px 20px;
  color: var(--breach-ink);
  font-size: 14px;
}
.callout__label { font-family: var(--font-mono); font-size: 12px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; }

/* --------------------------------------------------------------- Nav -------- */
/*
 * THE NAV IS THE DARK PANEL, in every variant of the design — wide and narrow alike. It carries
 * `.panel`, which rebinds the semantic aliases (20-ground.css), so everything inside is written
 * once against --fg / --rule and needs no `.panel .thing` override.
 *
 * No blur and no translucency. The earlier version was a frosted light bar, which is a marketing
 * chrome: it says the content behind it is the subject and the bar is furniture. Here the bar
 * carries the market session and the clock, which are readings, and it should read as part of the
 * instrument rather than as a scrim over it.
 */
.nav {
  position: sticky;
  top: 0;
  z-index: 50;
  border: 0;
  border-bottom: 1px solid var(--rule);
}
.nav__inner { display: flex; align-items: center; gap: 28px; height: 52px; }
.nav__links { display: none; gap: 2px; }
@media (min-width: 860px) { .nav__links { display: flex; } }

/* Sans, not mono: these are words to click, and the mono is reserved for values. The current
   section is the only one carrying full-strength ink, on a raised block. */
.nav__link {
  font: 400 12.5px/1 var(--font-sans);
  color: var(--fg-3);
  padding: 7px 11px;
  text-decoration: none;
}
.nav__link:hover { color: var(--fg); }
.nav__link[aria-current="page"] { font-weight: 500; color: var(--fg); background: var(--rule); }

/*
 * THE WORDMARK. Mono at 600, letterspaced, and nothing else.
 *
 * It was `> stalewatch_` — a shell prompt with a blinking cursor, carried over from the One Shot
 * kit. That is a developer-tool wordmark and it says the wrong thing about what this is: a prompt
 * implies something you run, and this is an instrument you read.
 *
 * `var(--fg)` rather than a fixed colour, because the mark also renders on the light auth cards and
 * the alias rebind makes one declaration correct on both grounds.
 */
.logo {
  font: 600 15px/1 var(--font-mono);
  letter-spacing: 0.18em;
  color: var(--fg);
  text-decoration: none;
}

/* Account menu (signed-in app chrome). Inline dropdown on desktop; hamburger sheet on mobile. */
.account { position: relative; display: inline-flex; }
.account__trigger {
  display: inline-flex; align-items: center; gap: 7px; height: 40px; padding: 0 12px;
  background: transparent; border: 1px solid var(--rule); border-radius: var(--r);
  color: var(--fg-2); font-family: var(--font-mono); font-size: 13px; cursor: pointer;
  transition: border-color 0.15s, color 0.15s;
}
.account__trigger:hover { color: var(--fg); border-color: var(--rule); }
.account__label { display: none; }
.account__caret { width: 14px; height: 14px; display: none; transition: transform 0.15s; }
.account__trigger[aria-expanded="true"] .account__caret { transform: rotate(180deg); }
.account__burger { width: 22px; height: 22px; }
@media (min-width: 860px) {
  .account__label, .account__caret { display: inline-flex; }
  .account__burger { display: none; }
}

.account__menu {
  position: absolute; right: 0; top: calc(100% + 8px); min-width: 232px; z-index: 60;
  display: flex; flex-direction: column; gap: 2px; padding: 6px;
  background: var(--card); border: 1px solid var(--rule); border-radius: var(--r);
}
.account__menu[hidden] { display: none; }
.account__email {
  padding: 8px 10px 10px; font-family: var(--font-mono); font-size: 12px; color: var(--fg-3);
  border-bottom: 1px solid var(--rule); margin-bottom: 4px; overflow: hidden; text-overflow: ellipsis;
}
.account__menu form { margin: 0; }
.account__item {
  display: block; width: 100%; text-align: left; padding: 9px 10px; border: 0; border-radius: var(--r);
  background: transparent; color: var(--fg-2); font-family: inherit; font-size: 14px; cursor: pointer;
}
.account__item:hover { background: var(--panel-deep); color: var(--fg); }

body.nav-locked { overflow: hidden; }
/* Mobile: the menu drops to a full-width sheet under the bar. */
@media (max-width: 859px) {
  .account { position: static; }
  .account__menu {
    left: 0; right: 0; top: 100%; min-width: 0; border-radius: 0;
    border-left: 0; border-right: 0;
  }
}

/* -------------------------------------------------------------- Footer ----- */
.footer { border-top: 1px solid var(--rule); padding-block: 48px; color: var(--fg-3); font-size: 13px; }
.footer__links { display: flex; flex-wrap: wrap; gap: 20px; margin: 16px 0; }
.footer__links a { color: var(--fg-3); }
.footer__links a:hover { color: var(--fg); }

/* ------------------------------------------------------------- Flash ------- */
.flash { border-radius: var(--r); padding: 12px 16px; margin-bottom: 16px; font-size: 14px; border: 1px solid var(--rule); }
.flash--notice { color: var(--inband-ink); border-color: color-mix(in oklch, var(--inband-ink) 40%, var(--rule)); }
.flash--alert { color: var(--breach-ink); border-color: var(--breach); background: var(--card); }

/* --------------------------------------------------------- Utilities ------- */
.stack > * + * { margin-top: 16px; }
.row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.trust-bar { display: flex; flex-wrap: wrap; gap: 8px 20px; font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--fg-3); }
.narrow { max-width: 720px; margin-inline: auto; }
.auth-card { max-width: 440px; margin: 64px auto; }

/* ------------------------------------------------------------- Mobile ------ */
@media (max-width: 640px) {
  :root { --margin: 20px; --s6: 56px; }
  body { font-size: 16px; }
  h1 { font-size: clamp(34px, 11vw, 52px); }
  .lede { font-size: 17px; }
  .nav__inner { height: 56px; }
  .auth-card { margin: 32px auto; }
  /* Never let a wide element (code wells, terminal mocks) force horizontal page scroll. */
  .well-block__body { overflow-x: auto; }
  .btn { padding: 12px 18px; }
}
