/* ==========================================================================
   Cruxio — landing page styles (landing-only).
   Clean modern SaaS aesthetic: generous whitespace, hairline borders,
   soft shadows, one violet accent, crisp system typography, subtle motion.
   Mobile-first: base styles target a narrow viewport, then scale up at
   640px and 900px. Adapts to light/dark automatically.
   ========================================================================== */

/* ---- Self-hosted variable fonts (SIL OFL) — no external request ---------- */
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 100 900;         /* variable weight axis */
  font-display: swap;           /* show fallback text immediately, swap when ready */
  src: url('/fonts/inter-latin-wght-normal.woff2') format('woff2');
}

/* ---- Design tokens ------------------------------------------------------- */
:root {
  --page: #f9f9f7;
  --surface: #ffffff;
  --surface-2: #f3f3f0;
  --border: rgba(15, 15, 15, 0.10);
  --hairline: #e6e5e0;
  --ink: #0e0e0e;
  --ink-2: #55544f;
  --muted: #8a8983;
  --accent: #4b3fb0;
  --accent-2: #6a5cf0;
  --accent-ink: #ffffff;
  --good: #0ca30c;
  --warn: #b7791f;
  --serious: #d1622c;
  --critical: #cf3b3b;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(15, 15, 15, 0.05), 0 8px 24px -12px rgba(15, 15, 15, 0.12);

  /* Landing-local helpers derived from the tokens above. */
  --radius-sm: 10px;
  --radius-pill: 999px;
  --maxw: 1080px;
  /* Inter first (self-hosted), with a system fallback while it loads. */
  --font: 'Inter', system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --page: #0c0c0d;
    --surface: #161618;
    --surface-2: #202023;
    --border: rgba(255, 255, 255, 0.10);
    --hairline: #2a2a2d;
    --ink: #f5f5f4;
    --ink-2: #c3c2bb;
    --muted: #8a8983;
    --accent: #9a8ff5;
    --accent-2: #b3a8ff;
    --accent-ink: #0c0c0d;
    --good: #22b342;
    --warn: #e0a52a;
    --serious: #ec835a;
    --critical: #e35d5d;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 10px 30px -12px rgba(0, 0, 0, 0.6);
  }
}

/* ---- Reset / base -------------------------------------------------------- */
* { box-sizing: border-box; }

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

body {
  margin: 0;
  font-family: var(--font);
  background: var(--page);
  color: var(--ink);
  /* Readability: a roomy 1.65 leading for comfortable reading. */
  line-height: 1.65;
  font-size: 16px;
  overflow-x: hidden;
  font-optical-sizing: auto;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

/* Tighter leading on headings; balance wrapping so titles don't leave orphans. */
h1, h2, h3 { line-height: 1.15; letter-spacing: -0.02em; text-wrap: balance; }
/* Cap prose line length near the ~66-character comfortable "measure". */
p { text-wrap: pretty; }
.hero p, .feature p { max-width: 62ch; }

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

/* Tabular numerals wherever numbers appear. */
.status-line,
.reassure,
.feature-num,
.recent-item .muted,
.muted { font-variant-numeric: tabular-nums; }

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

.wrap {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 20px 72px;
}

/* ---- Visible keyboard focus --------------------------------------------- */
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 4px;
}
.btn:focus-visible,
.scan-form input:focus-visible { outline-offset: 3px; }

/* ---- Top bar ------------------------------------------------------------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--surface);
  background: color-mix(in srgb, var(--page) 72%, transparent);
  -webkit-backdrop-filter: saturate(180%) blur(12px);
  backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--hairline);
}
.topbar-inner {
  max-width: var(--maxw);
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 20px;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 650;
  font-size: 17px;
  letter-spacing: -0.02em;
  color: var(--ink);
  min-height: 44px;
}
.brand:hover { text-decoration: none; }
.brand-mark { color: var(--accent); font-size: 19px; }
.topbar .spacer { flex: 1; }

/* ---- Buttons ------------------------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 11px 18px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--ink);
  font-family: inherit;
  font-size: 15px;
  font-weight: 600;
  line-height: 1;
  cursor: pointer;
  transition: border-color .15s ease, background-color .15s ease,
              box-shadow .15s ease, transform .15s ease;
}
.btn:hover { text-decoration: none; border-color: color-mix(in srgb, var(--accent) 45%, var(--border)); }

.btn-ghost { background: transparent; }
.btn-ghost:hover { background: var(--surface-2); }

.btn-primary {
  border-color: transparent;
  background: linear-gradient(180deg, var(--accent-2), var(--accent));
  color: var(--accent-ink);
  box-shadow: var(--shadow);
}
.btn-primary:hover {
  border-color: transparent;
  filter: brightness(1.05);
}
.btn-primary:disabled {
  opacity: .6;
  cursor: not-allowed;
  filter: none;
  transform: none;
}

/* ---- Hero ---------------------------------------------------------------- */
.hero {
  text-align: center;
  padding: 56px 0 40px;
  max-width: 720px;
  margin: 0 auto;
}
.eyebrow {
  display: inline-block;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent);
  padding: 6px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  background: var(--surface);
  box-shadow: var(--shadow);
}
.hero h1 {
  font-size: clamp(30px, 8vw, 52px);
  margin: 18px 0 14px;
  letter-spacing: -0.03em;
}
.hero .lede {
  font-size: 17px;
  color: var(--ink-2);
  max-width: 600px;
  margin: 0 auto 28px;
}

.scan-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: 560px;
  margin: 0 auto;
}
.scan-form input {
  flex: 1;
  min-height: 48px;
  padding: 13px 16px;
  font-family: inherit;
  font-size: 16px; /* >=16px avoids iOS zoom-on-focus */
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow);
  transition: border-color .15s ease, box-shadow .15s ease;
}
.scan-form input::placeholder { color: var(--muted); }
.scan-form input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent);
}
.scan-form .btn-primary { min-height: 48px; }

.reassure {
  margin: 16px 0 0;
  font-size: 13px;
  color: var(--muted);
}
.status-line {
  text-align: center;
  margin-top: 10px;
  min-height: 22px;
  font-size: 14px;
  color: var(--ink-2);
  font-weight: 500;
}

/* ---- Section heads ------------------------------------------------------- */
.how { padding-top: 24px; scroll-margin-top: 80px; }
.section-head { text-align: center; max-width: 620px; margin: 0 auto 28px; }
.section-eyebrow {
  display: block;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent);
  margin-bottom: 8px;
}
.section-head h2 {
  font-size: clamp(22px, 5vw, 30px);
  margin: 0;
}

/* ---- Cards & feature grid ------------------------------------------------ */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.feature-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
}
.feature { padding: 22px; }
.feature-num {
  font-size: 13px;
  font-weight: 700;
  color: var(--accent);
  letter-spacing: 0.02em;
  margin-bottom: 12px;
}
.feature h3 { margin: 0 0 6px; font-size: 16px; font-weight: 650; }
.feature p { margin: 0; color: var(--ink-2); font-size: 14px; }

/* ---- Recent audits ------------------------------------------------------- */
.recent { margin-top: 56px; }
.section-title {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--muted);
  font-weight: 700;
  margin: 0 0 12px;
}
.recent-card { padding: 4px 4px; overflow: hidden; }
.recent-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--hairline);
  transition: background-color .15s ease;
}
.recent-item:last-child { border-bottom: none; }
.recent-item:hover { background: var(--surface-2); }
.recent-item a {
  color: var(--ink);
  font-weight: 550;
  font-size: 14px;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.recent-item a:hover { color: var(--accent); }
.recent-item .muted {
  flex: none;
  color: var(--muted);
  font-size: 13px;
  white-space: nowrap;
}

/* ---- Footer -------------------------------------------------------------- */
.footer {
  margin-top: 64px;
  padding-top: 24px;
  border-top: 1px solid var(--hairline);
  color: var(--muted);
  font-size: 13px;
  text-align: center;
}
.brandFoot { color: var(--ink-2); font-weight: 600; }

.muted { color: var(--muted); }

/* ---- Motion (opt-in; skipped entirely when reduced motion is preferred) -- */
@media (prefers-reduced-motion: no-preference) {
  /* Hero: fade + rise on load, gently staggered. */
  .rise {
    opacity: 0;
    transform: translateY(12px);
    animation: rise-in .6s cubic-bezier(.22, .61, .36, 1) forwards;
    animation-delay: calc(var(--i, 0) * 80ms + 60ms);
  }
  @keyframes rise-in {
    to { opacity: 1; transform: translateY(0); }
  }

  /* Scroll reveal: JS adds .in when the element enters the viewport. */
  .reveal {
    opacity: 0;
    transform: translateY(16px);
    transition: opacity .55s ease, transform .55s cubic-bezier(.22, .61, .36, 1);
    transition-delay: calc(var(--i, 0) * 60ms);
  }
  .reveal.in {
    opacity: 1;
    transform: translateY(0);
  }

  /* Tasteful hover lift. */
  .btn:hover { transform: translateY(-1px); }
  .btn:active { transform: translateY(0); }
  .feature { transition: border-color .18s ease, box-shadow .18s ease, transform .18s ease; }
  .feature:hover {
    transform: translateY(-2px);
    border-color: color-mix(in srgb, var(--accent) 30%, var(--border));
  }
}

/* ---- Responsive scale-up ------------------------------------------------- */
@media (min-width: 640px) {
  .wrap { padding: 0 24px 88px; }
  .hero { padding: 76px 0 48px; }
  .scan-form { flex-direction: row; }
  .scan-form input { flex: 1; }
  .scan-form .btn-primary { flex: none; padding: 13px 24px; }
  .feature-grid { grid-template-columns: repeat(2, 1fr); gap: 16px; }
}

@media (min-width: 900px) {
  .hero { padding: 96px 0 56px; }
  .feature-grid { grid-template-columns: repeat(4, 1fr); }
}
