/* Shared marketing components — the single source for site chrome (nav,
   footer, skip-link) and brutalist primitives (.btn, .tag, .card, .section,
   .code-block). Loaded globally from base.njk and by the scanner Pages
   Function (functions/scan/[domain].ts). Page stylesheets (index.css,
   learn.css, legal.css, scan.css) hold page-specific styles ONLY — never
   redefine these components there.
   Design tokens come from the shared /tokens.css; the logo @keyframes from
   /animations.css. Single source: packages/design-tokens — see adr/0016. */

/* ---------- base ---------- */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
html, body { background: hsl(var(--paper)); color: hsl(var(--ink)); }
/* The nav is sticky, so an in-page anchor (#pricing, #how-it-works) would land
   its target under the header. Clear the nav plus a little air, so a jumped-to
   section opens with the same breathing room as a scrolled-to one. */
html { scroll-padding-top: 100px; }
body { font-family: var(--font-sans); font-size: 16px; line-height: 1.45; }
a { color: inherit; text-decoration: none; transition: text-decoration-color 0.12s ease; }
/* Hover keeps the text ink and moves Hazard Orange onto the underline: orange
   text on paper is 2.96:1 and fails AA at every size, while an orange rule under
   ink text is legal. Same idiom as .nav-links a:hover (an orange bottom border). */
a:not(.btn):not(.tier-cta):not(.brand):hover {
  text-decoration: underline;
  text-decoration-color: hsl(var(--pop));
  text-decoration-thickness: 2px;
  text-underline-offset: 3px;
}
/* Focus-visible, not :focus — a mouse click on a button should not leave the
   Hazard Orange ring behind. Keyboard and AT navigation still get it. */
button:focus-visible, a:focus-visible { outline: 2px solid hsl(var(--pop)); outline-offset: 2px; }
h1, h2, h3 { font-family: var(--font-sans); font-weight: 800; letter-spacing: -0.02em; }
code, pre, .mono { font-family: var(--font-mono); }

/* Keyboard-only skip link — visually hidden until focused. */
.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  background: hsl(var(--ink));
  color: hsl(var(--paper));
  padding: 10px 16px;
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.04em;
  z-index: 100;
}
.skip-link:focus { left: 0; }

/* Logo "eyes" — blink + look. @keyframes blinkLook lives in /animations.css. */
.brand svg .eyes {
  transform-box: fill-box;
  transform-origin: center;
  animation: blinkLook 7s ease-in-out infinite;
}
@media (prefers-reduced-motion: reduce) {
  .brand svg .eyes { animation: none; }
}

/* ---------- primitives ---------- */
.tag {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: hsl(var(--ink));
  display: inline-block;
  white-space: nowrap;
}
.tag--bordered {
  border: var(--rule-width) solid hsl(var(--ink));
  padding: 4px 8px;
}
.tag--filled {
  background: hsl(var(--ink));
  color: hsl(var(--paper));
  padding: 4px 10px;
}
/* INK FIELDS ONLY. Hazard Orange text is 2.96:1 on paper (fails AA at every
   size) and 6.17:1 on ink — never put this modifier on a paper surface.
   Currently unused in markup. */
.tag--pop {
  color: hsl(var(--pop));
}

.card {
  background: hsl(var(--paper));
  color: hsl(var(--ink));
  border: 1.5px solid hsl(var(--ink));
  box-shadow: 4px 4px 0 hsl(var(--ink));
  padding: 24px;
}
.card--accent {
  background: hsl(var(--ink));
  color: hsl(var(--paper));
}

.btn {
  font-family: var(--font-mono);
  font-size: 14px;
  font-weight: 700;
  padding: 12px 20px;
  background: transparent;
  color: hsl(var(--ink));
  border: 1.5px solid hsl(var(--ink));
  box-shadow: 4px 4px 0 hsl(var(--ink));
  cursor: pointer;
  letter-spacing: 0.04em;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  line-height: 1;
  text-decoration: none;
}
.btn--primary {
  background: hsl(var(--ink));
  color: hsl(var(--paper));
  box-shadow: 4px 4px 0 hsl(var(--pop));
}
.btn--big {
  font-size: 15px;
  padding: 16px 24px;
}
.btn--pop {
  background: hsl(var(--pop));
  color: hsl(var(--ink));
  border-color: hsl(var(--pop));
  box-shadow: 6px 6px 0 hsl(var(--paper));
  padding: 18px 28px;
  font-size: 15px;
}
/* Pre-launch gate: registration is closed until launch — see _includes/base.njk */
.is-soon {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
  box-shadow: none;
}

/* Brutal hover lift — ports csp-dashboard's .csplog-lift to plain CSS.
   Box translates up-left so the existing 4px shadow visually grows,
   giving the brutal "page lifts off the paper" feel. */
.card, .btn, .tier-cta {
  transition: transform 150ms ease;
}
@media (hover: hover) {
  .btn:hover, .tier-cta:hover, .card:hover {
    transform: translate(-2px, -2px);
  }
}
.btn:active, .tier-cta:active {
  transform: translate(2px, 2px);
}
@media (prefers-reduced-motion: reduce) {
  .card, .btn, .tier-cta { transition: none !important; }
}

.section {
  padding: 80px 48px;
  border-bottom: 1.5px solid hsl(var(--ink));
}
.section--hero    { padding: 80px 48px 64px; }
.section--explain { padding: 80px 48px; }
.section--dark    { background: hsl(var(--ink)); color: hsl(var(--paper)); }
.section--paper2  { background: hsl(var(--paper-2)); }
/* Bottom rule for sections that don't carry the base .section border (e.g. hero, explainer). */
.section--ruled   { border-bottom: 1.5px solid hsl(var(--ink)); }

.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
  margin-bottom: 48px;
}
.section-head h2 {
  font-size: 52px;
  line-height: 1;
  margin: 0;
}
.section-head--compact { margin-bottom: 32px; }

.footnote {
  font-family: var(--font-mono);
  font-size: 12px;
  color: hsl(var(--ink-muted));
}

.inline-code {
  font-family: var(--font-mono);
  background: hsl(var(--paper-2));
  padding: 1px 6px;
}

/* ---------- code block ---------- */
.code-block {
  background: hsl(var(--ink));
  color: hsl(var(--paper));
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.65;
  padding: 24px;
  border: 1.5px solid hsl(var(--ink));
  box-shadow: 6px 6px 0 hsl(var(--pop));
  overflow-x: auto;
}
.code-block .dim { color: hsl(var(--muted-on-ink)); }
/* Orange is legal here because .code-block is an ink field (6.17:1). The two
   light variants — .hero .code-block (index.css) and .code-block--light
   (learn.css) — override .pop, because on paper it drops to 2.96:1. */
.code-block .pop { color: hsl(var(--pop)); }
.code-block .cb-label { color: hsl(var(--muted-on-ink)); margin-bottom: 8px; }
.code-block .cb-comment { color: hsl(var(--muted-on-ink)); font-style: italic; margin-top: 4px; }
.code-block .cb-indent { padding-left: 16px; }
.code-block .cb-spacer { height: 16px; }
.code-block .cb-directive { color: hsl(var(--code-keyword)); font-weight: 600; }
.code-block .cb-ok { color: hsl(var(--code-ok)); }
.code-block .cb-danger { color: hsl(var(--code-danger)); font-weight: 600; }

/* ---------- nav ---------- */
.nav {
  position: sticky;
  top: 0;
  z-index: 50;
  border-bottom: 1.5px solid hsl(var(--ink));
  padding: 16px 48px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 40px;
  background: hsl(var(--paper));
}
.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  font-family: var(--font-mono);
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.01em;
  text-decoration: none;
}
.brand .dot { color: hsl(var(--pop)); }
.brand svg { display: block; }
.nav-links {
  display: flex;
  gap: 20px;
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: 14px;
}
.nav-links a {
  color: hsl(var(--ink));
  text-decoration: none;
  border-bottom: 1.5px solid transparent;
  padding-bottom: 2px;
  transition: border-color 0.15s ease;
}
/* The nav already carries the orange-on-hover marker as a bottom border, so
   suppress the global underline hover to avoid doubling the rule. */
.nav-links a:hover { border-bottom-color: hsl(var(--pop)); text-decoration: none; }
.nav-ctas { display: flex; gap: 12px; }
.nav-hamburger {
  display: none;
  flex-direction: column;
  justify-content: space-between;
  width: 28px;
  height: 22px;
  padding: 0;
  background: transparent;
  border: 0;
  cursor: pointer;
}
.nav-hamburger span {
  display: block;
  height: 2.5px;
  width: 100%;
  background: hsl(var(--ink));
  border-radius: 1px;
  transition: transform 0.2s ease, opacity 0.2s ease;
}
body.nav-open .nav-hamburger span:nth-child(1) { transform: translateY(9.5px) rotate(45deg); }
body.nav-open .nav-hamburger span:nth-child(2) { opacity: 0; }
body.nav-open .nav-hamburger span:nth-child(3) { transform: translateY(-9.5px) rotate(-45deg); }
.nav-menu {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 48; /* below the header (z-index: 50) so the X stays clickable */
  flex-direction: column;
  gap: 16px;
  padding: 80px 24px 24px; /* top padding clears the sticky header; panel sizes to its content */
  background: hsl(var(--paper));
  border-bottom: 1.5px solid hsl(var(--ink));
  font-family: var(--font-mono);
  font-size: 18px;
}
.nav-menu a:not(.btn) {
  color: hsl(var(--ink));
  text-decoration: none;
}
body.nav-open .nav-menu { display: flex; }
body.nav-open { overflow: hidden; }

/* ---------- footer ---------- */
/* Pages whose last section doesn't carry a bottom rule (legal, scan,
   scorecard) add `.site-footer { border-top: 1.5px solid hsl(var(--ink)) }`
   in their page CSS; home/learn end on a ruled section instead. */
.site-footer {
  padding: 32px 48px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 24px;
  flex-wrap: wrap;
  background: hsl(var(--paper));
  font-family: var(--font-mono);
  font-size: 12px;
  color: hsl(var(--ink-muted));
}
.site-footer a { color: hsl(var(--ink-muted)); text-decoration: none; }
.footer-brand { display: flex; align-items: center; gap: 12px; }
.footer-links { display: flex; gap: 24px; }
.footer-account { display: flex; gap: 18px; }

/* ---------- responsive chrome ---------- */
@media (max-width: 719px) {
  .nav { padding: 14px 20px; gap: 12px; }
  .section, .section--hero, .section--explain { padding: 56px 20px; }
  .site-footer { padding: 24px 20px; }
  /* The nav measures 70px here against 75px at wide widths. */
  html { scroll-padding-top: 80px; }

  .section-head h2 { font-size: clamp(28px, 8vw, 40px); }
  .section-head {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 32px;
  }
  .section-head .tag { order: -1; }

  .nav-links { display: none; }
  /* The conversion action stays in the sticky bar on phones — this is an
     acquisition surface, and a CTA behind a hamburger is a CTA nobody presses.
     Only the secondary action (log_in) folds into the panel. */
  .nav-ctas { margin-left: auto; } /* .nav-links carried this at wide widths */
  .nav-ctas .btn:not(.btn--primary) { display: none; }
  .nav-ctas .btn--primary { padding: 10px 12px; font-size: 13px; }
  .nav-hamburger { display: flex; }
  .brand { font-size: 16px; }

  .card { box-shadow: 3px 3px 0 hsl(var(--ink)); }
  .btn { box-shadow: 3px 3px 0 hsl(var(--ink)); }
  .btn--primary { box-shadow: 3px 3px 0 hsl(var(--pop)); }
  .btn--pop { box-shadow: 4px 4px 0 hsl(var(--paper)); padding: 16px 24px; }
  .btn--ink-on-pop { box-shadow: 3px 3px 0 hsl(var(--paper)); }
  .code-block { box-shadow: 4px 4px 0 hsl(var(--pop)); }
  .btn, .tier-cta { min-height: 44px; }

  .site-footer {
    flex-direction: column;
    align-items: flex-start;
    gap: 18px;
  }
  .footer-brand { order: 1; }
  .footer-account { order: 2; flex-wrap: wrap; }
  .footer-links { order: 3; flex-wrap: wrap; }
}

@media (max-width: 479px) {
  .nav { padding: 12px 16px; }
  .section, .section--hero, .section--explain { padding: 40px 16px; }
  .site-footer { padding: 20px 16px; }
}
