/* ==========================================================
   CARDIAC-PURR DESIGN SYSTEM EXTENSIONS
   Enterprise Architecture Layer - Complete Unified Master File
   ========================================================== */

/* ---------- 1. DESIGN TOKENS & SYSTEM VARIABLES ---------- */
:root {
  /* Semantic Surfaces */
  --surface-0: #050810;
  --surface-1: #0b111c;
  --surface-2: #111a29;
  --surface-3: #172233;

  /* Semantic Text colors */
  --text-primary: #edf3fa;
  --text-secondary: #c9d2df;
  --text-muted: #8f9ab0;

  /* Enterprise Accent Colors */
  --accent: #2dd4bf;
  --accent-soft: rgba(45, 212, 191, .18);
  --accent-glow: rgba(45, 212, 191, .08);

  /* Fluid Typography Scale (Scales smoothly via viewport width) */
  --fs-xs: clamp(.72rem, .70rem + .08vw, .80rem);
  --fs-sm: clamp(.84rem, .82rem + .12vw, .92rem);
  --fs-md: clamp(.98rem, .94rem + .22vw, 1.08rem);
  --fs-lg: clamp(1.18rem, 1.02rem + .48vw, 1.38rem);
  --fs-xl: clamp(1.6rem, 1.3rem + .9vw, 2rem);
  --fs-2xl: clamp(2.4rem, 1.8rem + 1.8vw, 3.6rem);
  --fs-hero: clamp(3rem, 2rem + 3vw, 5rem);

  /* Border Radii */
  --radius-sm: 10px;
  --radius-md: 16px;
  --radius-lg: 24px;
  --radius-xl: 34px;

  /* Elevation Shadows */
  --shadow-1: 0 12px 28px rgba(0, 0, 0, .18);
  --shadow-2: 0 20px 60px rgba(0, 0, 0, .28);
  --shadow-3: 0 40px 90px rgba(0, 0, 0, .42);

  /* Glassmorphism Specs */
  --glass-bg: rgba(255, 255, 255, .045);
  --glass-border: rgba(255, 255, 255, .08);
  --glass-blur: 18px;
  
  /* Layout Layout Defaults */
  --container-max-width: 1280px;
  --grid-gap: 2rem;
}

/* ---------- 2. MODERN BASE RESET & ACCESSIBILITY ---------- */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  font-size: 16px;
}

body {
  background-color: var(--surface-0);
  color: var(--text-primary);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  font-size: var(--fs-md);
  line-height: 1.6;
  overflow-x: hidden;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

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

/* Focus indicator for modern accessibility */
*:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 4px;
}

/* ---------- 3. GLOBAL LAYOUT PRIMITIVES ---------- */
.container {
  width: 100%;
  max-width: var(--container-max-width);
  margin-left: auto;
  margin-right: auto;
  padding-left: 1.5rem;
  padding-right: 1.5rem;
}

.section {
  padding-top: clamp(4rem, 8vw, 8rem);
  padding-bottom: clamp(4rem, 8vw, 8rem);
  position: relative;
}

/* Unified section backgrounds — no alternating tones */
section:nth-of-type(even) {
  background: transparent;
  border-top: none;
  border-bottom: none;
}

/* Enterprise Flex/Grid Layout Utilities */
.cp-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--grid-gap);
}

@media (min-width: 768px) {
  .cp-grid-2 { grid-template-columns: repeat(2, 1fr); }
  .cp-grid-3 { grid-template-columns: repeat(3, 1fr); }
  .cp-grid-4 { grid-template-columns: repeat(4, 1fr); }
}

/* ---------- 4. UNIQUE ARCHITECTURAL PAGE ENVIRONMENTS ---------- */
.page-platform {
  background: #050A12;
}

.page-compliance {
  background: #050A12;
}

.page-benchmarks {
  background: #050A12;
}

.page-pricing {
  background: #050A12;
}

.page-usecases {
  background: #050A12;
}

.page-company {
  background: #050A12;
}

/* Universal Radial Fading Environmental Technical Grid */
.page-platform::before,
.page-compliance::before,
.page-benchmarks::before,
.page-pricing::before,
.page-usecases::before,
.page-company::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(90, 169, 255, .015) 1px, transparent 1px),
    linear-gradient(90deg, rgba(90, 169, 255, .015) 1px, transparent 1px);
  background-size: 72px 72px;
  mask-image: radial-gradient(circle at center, black 20%, transparent 100%);
  -webkit-mask-image: radial-gradient(circle at center, black 20%, transparent 100%);
  opacity: .12;
  z-index: 0;
}

/* ---------- 5. COMPONENT UPGRADES (GLASSMORPHIC CARDS) ---------- */
/* Applies premium architectural shading directly over existing card classes */
.card, .cp-card {
  position: relative;
  overflow: hidden;
  border-radius: var(--radius-md);
  padding: 2rem;
  box-shadow: var(--shadow-1);
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
  background: linear-gradient(180deg, rgba(255, 255, 255, .05), rgba(255, 255, 255, .025));
  border: 1px solid var(--glass-border);
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.3s ease;
  z-index: 1;
}

/* High-fidelity top-left lightning corner bloom */
.card::before, .cp-card::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: radial-gradient(circle at top left, rgba(255, 255, 255, .07), transparent 45%);
  pointer-events: none;
}

.card:hover, .cp-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-2);
  border-color: rgba(45, 212, 191, 0.2);
}

/* TYPOGRAPHY UTILITIES CODE STAGE */
h1 { font-size: var(--fs-2xl); font-weight: 800; letter-spacing: 0; line-height: 1.1; color: var(--text-primary); }
h2 { font-size: var(--fs-xl); font-weight: 700; letter-spacing: 0; color: var(--text-primary); }
h3 { font-size: var(--fs-lg); font-weight: 600; color: var(--text-secondary); }
p { color: var(--text-secondary); font-size: var(--fs-md); }
small { font-size: var(--fs-xs); color: var(--text-muted); }

/* ==========================================================
   SHARED ADDITIONS — v2 (August 2026)
   Applied site-wide; do not override per-page.
   ========================================================== */

/* ── EYEBROW → HEADLINE BREATHING ROOM (all pages) ───────── */
/* Applies wherever .eyebrow precedes h2/h3 inside a section title or card */
.section-title .eyebrow,
.article-card .eyebrow,
.card > .eyebrow,
.tier-body > .tier-badge-premium { margin-bottom: 10px; }

/* ── SKIP LINK (accessibility, all pages share this pattern) ─ */
.skip-link { position: absolute; left: -9999px; }
.skip-link:focus {
  position: fixed; top: 8px; left: 8px; z-index: 9999;
  padding: 8px 16px;
  background: var(--accent, #2dd4bf);
  color: #031018;
  border-radius: 6px;
  text-decoration: none;
  font-weight: 700;
}

/* ── GLOBAL FOCUS-VISIBLE RING ───────────────────────────── */
:focus-visible {
  outline: 2px solid rgba(45, 212, 191, 0.8);
  outline-offset: 3px;
  border-radius: 4px;
}
:focus:not(:focus-visible) { outline: none; }

/* ── SCREEN-READER ONLY UTILITY ──────────────────────────── */
.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;
}

/* ── HEADING TEXT-WRAP BALANCE (all pages) ───────────────── */
h1, h2, h3, h4, h5, h6 { text-wrap: balance; }

/* ── TABULAR NUMS ON DATA CELLS ──────────────────────────── */
.tier-price-premium, .calc-val, .benchmark-value,
.data-table td, .stat-badge-row li strong {
  font-variant-numeric: tabular-nums;
}

/* ── PRESS-STATE SCALE ON CTÁS ───────────────────────────── */
.btn-primary:active,
.btn-secondary:active,
.pedestal-cta:active { transform: scale(0.97) !important; }

/* ── FOOTER (shared structure — all pages) ───────────────── */
/* Markup: <footer><div class="container"><div class="footer-grid">
   <div class="footer-col footer-col-brand">...</div>
   <div class="footer-col">...</div> (Platform)
   <div class="footer-col">...</div> (Legal)
   </div><div class="footer-bottom">...</div></div></footer>
   Per-page accent tints (border colors, top hairline gradient) stay in
   each page's own <style> block — only shared structure lives here. */
footer {
  position: relative;
  padding-top: 1.5rem;
  padding-bottom: 2rem;
}

.footer-grid {
  display: grid;
  grid-template-columns: minmax(260px, 1.25fr) repeat(2, minmax(160px, .55fr));
  gap: 32px;
  padding-bottom: 28px;
}

.footer-col-brand {
  padding-right: 28px;
  border-right: 1px solid var(--glass-border);
}

.footer-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 1.1em;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 10px;
}

.footer-logo { border-radius: 6px; object-fit: contain; }

.footer-blurb {
  font-size: var(--fs-sm);
  color: var(--text-muted);
  margin-bottom: 12px;
  max-width: 42ch;
  line-height: 1.5;
}

.footer-socials {
  display: flex;
  gap: 10px;
}
.footer-socials a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 999px;
  border: 1px solid var(--glass-border);
  color: var(--text-muted);
  transition: color .2s ease, border-color .2s ease, transform .2s ease;
}
.footer-socials svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.6; }
.footer-socials a:hover,
.footer-socials a:focus-visible {
  color: var(--accent-primary, var(--accent));
  border-color: var(--accent-primary, var(--accent));
  transform: translateY(-2px);
}

.footer-col-title {
  position: relative;
  display: inline-block;
  padding-bottom: 7px;
  margin-bottom: 9px;
  font-weight: 700;
  font-size: var(--fs-sm);
  color: var(--text-primary);
}
.footer-col-title::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: 0;
  width: 28px;
  height: 1px;
  background: linear-gradient(90deg, var(--accent-primary, var(--accent)), transparent);
}

.footer-links {
  display: flex;
  flex-direction: column;
  gap: 7px;
}
.footer-links a {
  position: relative;
  padding-left: 0;
  font-size: var(--fs-sm);
  color: var(--text-muted);
  text-decoration: none;
  line-height: 1.3;
  transition: color .2s ease, padding-left .2s ease;
}
.footer-links a::before {
  content: "";
  position: absolute;
  left: 0;
  top: 50%;
  width: 0;
  height: 1px;
  background: var(--accent-primary, var(--accent));
  opacity: 0;
  transform: translateY(-50%);
  transition: width .2s ease, opacity .2s ease;
}
.footer-links a:hover,
.footer-links a:focus-visible {
  color: var(--text-primary);
  padding-left: 12px;
}
.footer-links a:hover::before,
.footer-links a:focus-visible::before {
  width: 7px;
  opacity: 1;
}

.footer-bottom {
  display: flex;
  justify-content: flex-start;
  padding-top: 16px;
  border-top: 1px solid var(--glass-border);
}
.footer-copy {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 16px;
  font-size: var(--fs-xs);
  color: var(--text-muted);
  line-height: 1.4;
}
.footer-secondary { color: var(--text-muted); opacity: .8; }

@media (max-width: 768px) {
  .footer-grid { grid-template-columns: 1fr; gap: 24px; }
  .footer-col-brand { padding-right: 0; border-right: 0; }
}

/* ── SECTION DIVIDER ─────────────────────────────────────── */
.section-divider-wrap { height: 3px; }
.section-divider {
  height: 3px;
  background: linear-gradient(
    90deg,
    transparent 0%,
    rgba(45,212,191,.18) 20%,
    rgba(45,212,191,.62) 50%,
    rgba(45,212,191,.18) 80%,
    transparent 100%
  );
}

/* Mobile production-readiness audit pass: Platform family. */
@media (max-width: 768px) {
  body.page-platform .container,
  body.page-benchmarks .container,
  body.page-compliance .container,
  body.page-pricing .container,
  body.page-usecases .container,
  body.page-agentic .container {
    width: 100%;
    padding-left: 18px;
    padding-right: 18px;
  }
  body.page-platform .page-hero,
  body.page-benchmarks .page-hero,
  body.page-compliance .page-hero,
  body.page-pricing .page-hero,
  body.page-usecases .page-hero,
  body.page-agentic .page-hero {
    min-height: auto !important;
    padding-top: 108px !important;
    padding-bottom: 54px !important;
  }
  body.page-platform .card,
  body.page-platform .cp-card,
  body.page-platform .gap-card,
  body.page-platform .protection,
  body.page-platform .session-card,
  body.page-platform .layer-card,
  body.page-platform .hiw-step,
  body.page-benchmarks .card,
  body.page-compliance .card,
  body.page-pricing .card,
  body.page-usecases .card,
  body.page-agentic .card {
    min-height: 0 !important;
    padding: clamp(16px, 4.5vw, 22px) !important;
    border-radius: 18px !important;
    backdrop-filter: blur(14px) saturate(145%) !important;
    -webkit-backdrop-filter: blur(14px) saturate(145%) !important;
  }
  body.page-platform #mobile-menu,
  body.page-benchmarks #mobile-menu,
  body.page-compliance #mobile-menu,
  body.page-pricing #mobile-menu,
  body.page-usecases #mobile-menu,
  body.page-agentic #mobile-menu {
    max-height: calc(100svh - 78px) !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch;
  }
  body.page-platform iframe,
  body.page-benchmarks iframe,
  body.page-compliance iframe,
  body.page-pricing iframe,
  body.page-usecases iframe,
  body.page-agentic iframe,
  body.page-platform video,
  body.page-agentic video {
    max-width: 100% !important;
  }
  body.page-platform .table-wrap,
  body.page-benchmarks .table-wrap,
  body.page-pricing .table-wrap,
  body.page-compliance .matrix-wrap {
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch !important;
  }
}
