/* ==========================================================================
   Kalasec — shared stylesheet (single source of truth for custom CSS).
   Linked by every page as <link rel="stylesheet" href="/shared.css">.
   Superset of the v2 catalog: tokens + type + cards + buttons + nav + legal.
   Tailwind UTILITY classes still come from the CDN + per-page tailwind.config;
   this file holds only the :root vars and hand-written classes.
   Edit here once — do NOT re-inline per page (that reintroduced 8x drift).
   ========================================================================== */

:root {
  --bg: #0d0f12;
  --surface: #13161b;
  --elevated: #1a1d23;
  --border: #232830;
  --accent: #00d68f;
  --accent-hover: #00b87a;
  --accent-dim: #00b87a;
  --headline: #eef0f3;
  --body: #8c95a0;
  --muted: #555e6a;
  --critical: #ff6b6b;
  --warning: #f5a623;
  --yellow: #fcd306;
}

html, body { background-color: var(--bg); color: var(--headline); }
html { scroll-behavior: smooth; scroll-padding-top: 100px; }
body { min-height: 100dvh; font-family: 'Manrope', sans-serif; }

.material-symbols-outlined {
  font-variation-settings: 'FILL' 0, 'wght' 400, 'GRAD' 0, 'opsz' 24;
  opacity: 0;
  transition: opacity 0.15s ease;
}
.fonts-loaded .material-symbols-outlined { opacity: 1; }

/* Type rhythm */
h1, h2, h3, h4 { color: var(--headline); }
.h-display { font-weight: 900; letter-spacing: -0.035em; line-height: 1.02; }
.h-section { font-weight: 800; letter-spacing: -0.03em; line-height: 1.05; }
.h-card    { font-weight: 800; letter-spacing: -0.02em; }
.body-text { color: var(--body); font-weight: 400; line-height: 1.65; }
.label, .eyebrow {
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-size: 11px;
}

.mono { font-family: 'Space Grotesk', ui-monospace, monospace; font-feature-settings: "tnum" 1, "ss01" 1; }

.hero-bg {
  background: var(--bg);
  position: relative;
}
/* Section background rhythm — subtle alternating bands (hero excluded) */
section:not(.hero-bg):nth-of-type(even) { background-color: #111318; }
section:not(.hero-bg):nth-of-type(odd)  { background-color: #141414; }
/* Sequential row fade-in for result card */
@keyframes row-in {
  from { opacity: 0; transform: translateX(-8px); }
  to   { opacity: 1; transform: translateX(0); }
}
.result-row { opacity: 0; }
.result-card.in-view .result-row { animation: row-in 0.5s ease-out forwards; }
.result-card.in-view .result-row:nth-child(1) { animation-delay: 0.1s; }
.result-card.in-view .result-row:nth-child(2) { animation-delay: 0.3s; }
.result-card.in-view .result-row:nth-child(3) { animation-delay: 0.5s; }
.result-card.in-view .result-row:nth-child(4) { animation-delay: 0.7s; }
.ai-preview { opacity: 0; }
.result-card.in-view .ai-preview { animation: row-in 0.5s ease-out 0.95s forwards; }

@media (prefers-reduced-motion: reduce) {
  .result-row,
  .ai-preview {
    opacity: 1 !important;
    animation: none !important;
    transform: none !important;
  }
}

/* Logo */
.logo-word {
  font-weight: 900;
  letter-spacing: 3px;
  line-height: 1;
  color: var(--accent);
}
.logo-tagline {
  color: var(--yellow);
  font-style: italic;
  letter-spacing: 0.5px;
  font-weight: 500;
}

/* Buttons */
.btn-primary {
  background-color: var(--accent);
  color: var(--bg);
  font-weight: 800;
  letter-spacing: -0.01em;
  transition: background-color .18s ease, transform .18s ease, box-shadow .18s ease;
  box-shadow: 0 0 0 0 rgba(0, 214, 143, 0);
}
.btn-primary:hover {
  background-color: var(--accent-hover);
  box-shadow: 0 8px 24px rgba(0, 214, 143, 0.18);
}
.btn-primary:active { transform: translateY(1px); }

.btn-border {
  background-color: transparent;
  border: 1px solid var(--border);
  color: var(--headline);
  font-weight: 600;
  min-height: 40px;
  transition: border-color .18s ease, color .18s ease, background-color .18s ease;
}
.btn-border:hover {
  border-color: var(--accent);
  color: var(--accent);
  background-color: rgba(0, 214, 143, 0.04);
}

/* URL input frame */
.url-shell {
  background-color: var(--elevated);
  border: 1px solid var(--border);
  border-radius: 12px;
  transition: border-color .2s ease, box-shadow .2s ease;
}
.url-shell:focus-within {
  border-color: var(--accent);
  box-shadow:
    inset 0 0 0 1px rgba(0, 214, 143, 0.4),
    0 0 32px rgba(0, 214, 143, 0.10);
}

/* Cards */
.card {
  background-color: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  transition: border-color .18s ease, transform .18s ease;
}
.card:hover,
.fade-up.visible.card:hover {
  border-color: rgba(0, 214, 143, 0.35);
  transform: translateY(-2px);
}

.card-elevated {
  background-color: var(--elevated);
  border: 1px solid var(--border);
  border-radius: 12px;
}

.card-popular {
  background-color: var(--elevated);
  border-radius: 12px;
  box-shadow:
    0 0 0 1px var(--accent),
    0 0 32px rgba(0, 214, 143, 0.12);
  position: relative;
  transition: box-shadow .18s ease, transform .18s ease;
}
.card-popular:hover,
.fade-up.visible.card-popular:hover {
  transform: translateY(-2px);
  box-shadow:
    0 0 0 1px var(--accent),
    0 0 40px rgba(0, 214, 143, 0.22);
}

.card-premium {
  background:
    linear-gradient(180deg, rgba(0, 214, 143, 0.04) 0%, rgba(0, 214, 143, 0) 100%),
    var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  position: relative;
  overflow: hidden;
  transition: border-color .18s ease, transform .18s ease;
}
.card-premium:hover,
.fade-up.visible.card-premium:hover {
  transform: translateY(-2px);
  border-color: rgba(0, 214, 143, 0.4);
}
.card-premium::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 12px;
  padding: 1px;
  background: linear-gradient(180deg, rgba(0, 214, 143, 0.35), rgba(0, 214, 143, 0));
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
          mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
          mask-composite: exclude;
  pointer-events: none;
}

/* Scroll fade */
.fade-up {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.55s cubic-bezier(0.2, 0.9, 0.4, 1), transform 0.55s cubic-bezier(0.2, 0.9, 0.4, 1);
}
.fade-up.visible { opacity: 1; transform: translateY(0); }
.pricing-card:nth-child(1) { transition-delay: 0ms; }
.pricing-card:nth-child(2) { transition-delay: 60ms; }
.pricing-card:nth-child(3) { transition-delay: 120ms; }
.pricing-card:nth-child(4) { transition-delay: 180ms; }
.faq-item:nth-child(1) { transition-delay: 0ms; }
.faq-item:nth-child(2) { transition-delay: 40ms; }
.faq-item:nth-child(3) { transition-delay: 80ms; }
.faq-item:nth-child(4) { transition-delay: 120ms; }
.faq-item:nth-child(5) { transition-delay: 160ms; }
.faq-item:nth-child(6) { transition-delay: 200ms; }
.step-item:nth-child(1) { transition-delay: 0ms; }
.step-item:nth-child(2) { transition-delay: 100ms; }
.step-item:nth-child(3) { transition-delay: 200ms; }
.step-item:nth-child(4) { transition-delay: 300ms; }

/* Nav active underline */
.nav-active {
  color: var(--headline);
  font-weight: 600;
  position: relative;
}
.nav-active::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: -8px;
  height: 2px;
  background: var(--accent);
  border-radius: 2px;
}

/* Compare table */
.cmp th, .cmp td { border-bottom: 1px solid var(--border); }
.cmp td.tick { color: var(--accent-dim); }
.cmp td.dash { color: var(--muted); }

/* Selection */
::selection { background: rgba(0, 214, 143, 0.3); color: var(--headline); }

/* Inputs reset */
input { color: var(--headline); }
input::placeholder { color: var(--muted); }

/* Details / disclosure (FAQ) */
details summary::-webkit-details-marker { display: none; }
details summary { cursor: pointer; list-style: none; }
details[open] summary .chevron { transform: rotate(180deg); }
.chevron { transition: transform 0.2s; }

/* Legal page content (privacy / terms — restrained flat scale) */
.legal h2 { font-size: 19px; font-weight: 800; letter-spacing:-0.02em; margin-top: 32px; margin-bottom: 10px; }
.legal p, .legal li { color: var(--body); line-height: 1.65; font-size: 15px; }
.legal ul { padding-left: 0; list-style: none; } .legal li { margin: 7px 0; }
.legal a { color: var(--accent); text-decoration: none; }
.legal strong { font-weight: 400; color: var(--body); }
.legal .card:hover { transform: none; }

/* Accessibility — skip link (visually hidden until focused) */
.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 100;
  background: var(--accent);
  color: var(--bg);
  padding: 10px 16px;
  border-radius: 0 0 8px 0;
  font-weight: 700;
}
.skip-link:focus { left: 0; }

/* ---- Tools page (link checker): inset card, tab switcher, spinner, staggered findings ---- */
.card-inset { background-color: var(--bg); border: 1px solid var(--border); border-radius: 12px; }

.tab-btn { color: var(--body); transition: color .18s ease; position: relative; }
.tab-btn:hover { color: var(--headline); }
.tab-btn.active { color: var(--headline); }
.tab-btn.active::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: -1px;
  height: 2px; background: var(--accent);
}

@keyframes spin { to { transform: rotate(360deg); } }
.spinner { animation: spin 0.8s linear infinite; }

.result-finding { opacity: 0; }
.linkResult-revealed .result-finding { animation: row-in 0.4s ease-out forwards; }
.linkResult-revealed .result-finding:nth-of-type(1) { animation-delay: 0.10s; }
.linkResult-revealed .result-finding:nth-of-type(2) { animation-delay: 0.25s; }
.linkResult-revealed .result-finding:nth-of-type(3) { animation-delay: 0.40s; }
.linkResult-revealed .result-finding:nth-of-type(4) { animation-delay: 0.55s; }
.linkResult-revealed .result-finding:nth-of-type(5) { animation-delay: 0.70s; }

@media (prefers-reduced-motion: reduce) {
  .result-finding, #aiExplanation, #demoUpsell, #demoActions {
    opacity: 1 !important; animation: none !important; transform: none !important;
  }
}
