/* ==========================================================================
   Shieldmark — base styles
   Design tokens, reset, typography, buttons, pills, cards, reveal utilities.
   Section styles live in css/<section>.css and must only use these tokens.
   ========================================================================== */

:root {
  /* Brand blues */
  --blue: #1f5bff;
  --blue-600: #1748d6;
  --blue-700: #1238a8;
  --blue-300: #7fa4ff;
  --blue-100: #dce7ff;
  --blue-50: #eef3ff;

  /* Navy — text, outlines, dark sections */
  --navy: #0b1b3f;
  --navy-800: #102654;
  --navy-700: #1b3470;
  --navy-600: #2a4585;

  /* Accents */
  --yellow: #ffc83d;
  --yellow-100: #fff3b5;
  --green: #22c06a;
  --green-100: #d3f6e2;
  --red: #ff4b3e;
  --red-100: #ffe0dc;
  --orange: #ff7a2e;

  /* Surfaces & text */
  --bg: #ffffff;
  --bg-alt: #f3f6ff;
  --ink: #0b1b3f;
  --muted: #4b5a7a;
  --line: #0b1b3f;
  --hairline: #dbe3f5;

  /* Shape */
  --radius-sm: 12px;
  --radius: 24px;
  --radius-lg: 32px;
  --border: 2px solid var(--line);
  --shadow-pop: 6px 6px 0 var(--navy);
  --shadow-pop-sm: 4px 4px 0 var(--navy);
  --shadow-soft: 0 24px 60px -24px rgba(11, 27, 63, 0.35);

  /* Type */
  --font-sans: "Plus Jakarta Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  /* Layout */
  --container: 1200px;
  --gutter: 24px;
  --section-y: clamp(80px, 11vw, 140px);
  --nav-h: 76px;

  /* Motion */
  --ease-out: cubic-bezier(0.2, 0.7, 0.2, 1);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
}

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

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--nav-h) + 16px);
}

body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 1rem;
  line-height: 1.6;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

img, svg, video { display: block; max-width: 100%; }
img { height: auto; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: inherit; text-decoration: none; }
h1, h2, h3, h4, p, ul, ol, figure, blockquote { margin: 0; }
ul[role="list"], ol[role="list"] { list-style: none; padding: 0; }
code, kbd, pre, samp { font-family: var(--font-mono); font-variant-ligatures: none; }

::selection { background: var(--yellow); color: var(--navy); }

:focus-visible {
  outline: 3px solid var(--blue);
  outline-offset: 3px;
  border-radius: 6px;
}
/* A blue ring disappears on blue/navy surfaces — use yellow there */
.section--dark :focus-visible,
.on-dark :focus-visible { outline-color: var(--yellow); }

.sr-only {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0);
  white-space: nowrap; border: 0;
}

.skip-link {
  position: absolute;
  left: 16px; top: -60px;
  z-index: 1000;
  padding: 10px 16px;
  background: var(--navy);
  color: #fff;
  border-radius: 10px;
  font-weight: 700;
  transition: top 0.2s;
}
.skip-link:focus { top: 12px; }

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

.section {
  position: relative;
  padding-block: var(--section-y);
}
.section--alt { background: var(--bg-alt); }
.section--dark { background: var(--navy); color: #fff; }
.section--dark .lead,
.section--dark .muted { color: #b9c6e6; }

.section-head {
  max-width: 760px;
  margin: 0 auto clamp(48px, 6vw, 72px);
  text-align: center;
}
.section-head .lead { margin-top: 18px; }
.section-head--left { margin-left: 0; text-align: left; }

/* ---------- Typography ---------- */
.display {
  font-size: clamp(2.6rem, 5.6vw, 4.6rem);
  font-weight: 800;
  line-height: 1.02;
  letter-spacing: -0.035em;
}
.title {
  font-size: clamp(2rem, 3.8vw, 3.1rem);
  font-weight: 800;
  line-height: 1.08;
  letter-spacing: -0.03em;
}
.subtitle {
  font-size: clamp(1.25rem, 1.8vw, 1.5rem);
  font-weight: 800;
  line-height: 1.2;
  letter-spacing: -0.02em;
}
.lead {
  font-size: clamp(1.05rem, 1.4vw, 1.22rem);
  line-height: 1.65;
  color: var(--muted);
}
.muted { color: var(--muted); }
.mono { font-family: var(--font-mono); }

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 18px;
  font-size: 0.8rem;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--blue);
}
.eyebrow::before {
  content: "";
  width: 8px; height: 8px;
  border-radius: 50%;
  background: currentColor;
  box-shadow: 0 0 0 4px color-mix(in srgb, currentColor 22%, transparent);
}
.section--dark .eyebrow { color: var(--blue-300); }

/* Text highlight — yellow marker that sweeps in when its parent .reveal becomes visible */
.hl {
  position: relative;
  white-space: nowrap;
  background-image: linear-gradient(var(--yellow), var(--yellow));
  background-repeat: no-repeat;
  background-position: 0 88%;
  background-size: 100% 0.32em;
}
.reveal .hl,
.reveal.hl {
  background-size: 0% 0.32em;
  transition: background-size 0.9s var(--ease-out) 0.35s;
}
.reveal.is-visible .hl,
.reveal.hl.is-visible { background-size: 100% 0.32em; }
.text-blue { color: var(--blue); }

/* ---------- Buttons ---------- */
.btn {
  --btn-bg: #fff;
  --btn-fg: var(--navy);
  --btn-shadow: var(--navy);
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 52px;
  padding: 14px 26px;
  border: var(--border);
  border-radius: 999px;
  background: var(--btn-bg);
  color: var(--btn-fg);
  font-weight: 700;
  font-size: 1rem;
  line-height: 1;
  white-space: nowrap;
  box-shadow: 0 4px 0 var(--btn-shadow);
  transition: transform 0.18s var(--ease-out), box-shadow 0.18s var(--ease-out), background-color 0.2s;
}
.btn:hover { transform: translateY(-2px); box-shadow: 0 6px 0 var(--btn-shadow); }
.btn:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--btn-shadow); }
.btn svg { width: 20px; height: 20px; flex: none; }
/* On blue buttons the code-shield logo flips to a white shield with blue code */
.btn--primary svg { --logo-fill: #fff; --logo-ink: var(--blue); }

.btn--primary { --btn-bg: var(--blue); --btn-fg: #fff; }
.btn--primary:hover { --btn-bg: var(--blue-600); }
.btn--ghost { --btn-bg: #fff; --btn-fg: var(--navy); }
.btn--ghost:hover { --btn-bg: var(--blue-50); }
.btn--yellow { --btn-bg: var(--yellow); --btn-fg: var(--navy); }
.btn--light { --btn-bg: #fff; --btn-fg: var(--navy); border-color: var(--navy); }
.btn--sm { min-height: 42px; padding: 10px 18px; font-size: 0.92rem; }
.btn[aria-disabled="true"],
.btn:disabled { cursor: not-allowed; opacity: 0.9; }
.btn[aria-disabled="true"]:hover,
.btn:disabled:hover { transform: none; box-shadow: 0 4px 0 var(--btn-shadow); }

/* ---------- Pills / tags ---------- */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 16px;
  border: 1.5px solid var(--line);
  border-radius: 999px;
  background: var(--blue-50);
  color: var(--navy);
  font-size: 0.86rem;
  font-weight: 600;
  line-height: 1.3;
  white-space: nowrap;
}
.pill--yellow { background: var(--yellow-100); }
.pill--green { background: var(--green-100); }
.pill--red { background: var(--red-100); }
.pill--blue { background: var(--blue-100); }
.pill--dark { background: var(--navy); color: #fff; }

.pill .dot,
.dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: currentColor;
  flex: none;
}
.dot--live {
  background: var(--green);
  box-shadow: 0 0 0 0 rgba(34, 192, 106, 0.6);
  animation: sm-pulse 2s infinite;
}

/* ---------- Cards ---------- */
.card {
  position: relative;
  background: #fff;
  border: var(--border);
  border-radius: var(--radius);
  transition: transform 0.25s var(--ease-out), box-shadow 0.25s var(--ease-out);
}
.card--hover:hover {
  transform: translate(-4px, -4px);
  box-shadow: var(--shadow-pop);
}

/* ---------- Illustration helpers ---------- */
/* Inline SVG illustrations: navy 3px outlines, flat palette fills, offset navy shadow shapes. */
.illo { overflow: visible; }
.illo .stroke { stroke: var(--navy); stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- Device-specific content ---------- */
/* main.js sets html[data-device]; desktop content is the default without JS. */
html[data-device="mobile"] .only-desktop { display: none !important; }
html:not([data-device="mobile"]) .only-mobile { display: none !important; }

/* Keyboard keys */
kbd {
  display: inline-block;
  min-width: 1.9em;
  padding: 0.12em 0.5em;
  border: 1.5px solid var(--navy);
  border-radius: 7px;
  background: #fff;
  box-shadow: 0 2px 0 var(--navy);
  font-family: var(--font-sans);
  font-size: 0.86em;
  font-weight: 800;
  line-height: 1.4;
  text-align: center;
  color: var(--navy);
  white-space: nowrap;
}

/* ---------- Reveal-on-scroll ---------- */
/* Add .reveal (+ optional modifier) to any element. main.js adds .is-visible when it enters the viewport.
   Stagger with style="--d: 120ms". */
.reveal {
  opacity: 0;
  transform: translateY(28px);
  transition: opacity 0.8s var(--ease-out), transform 0.8s var(--ease-out);
  transition-delay: var(--d, 0ms);
}
.reveal--left { transform: translateX(-36px); }
.reveal--right { transform: translateX(36px); }
.reveal--scale { transform: scale(0.92); }
.reveal--fade { transform: none; }
.reveal.is-visible { opacity: 1; transform: none; }

.no-js .reveal { opacity: 1; transform: none; }

/* ---------- Shared keyframes (section CSS may use these) ---------- */
@keyframes sm-pulse {
  0% { box-shadow: 0 0 0 0 rgba(34, 192, 106, 0.55); }
  70% { box-shadow: 0 0 0 10px rgba(34, 192, 106, 0); }
  100% { box-shadow: 0 0 0 0 rgba(34, 192, 106, 0); }
}
@keyframes sm-float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-12px); }
}
@keyframes sm-spin { to { transform: rotate(360deg); } }
@keyframes sm-pop {
  0% { opacity: 0; transform: scale(0.6); }
  70% { opacity: 1; transform: scale(1.06); }
  100% { opacity: 1; transform: scale(1); }
}
@keyframes sm-blink { 50% { opacity: 0; } }

/* ---------- Responsive ---------- */
@media (max-width: 640px) {
  :root {
    --gutter: 16px;
    --nav-h: 64px;
  }
  .btn { min-height: 48px; padding: 12px 22px; }
}

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    transition-delay: 0ms !important;
  }
  .reveal { opacity: 1; transform: none; }
  .reveal .hl { background-size: 100% 0.32em; }
}
