/* ThreadSync UI Step 2: Crisp Typography + Spacing (bridge layer)
   - Keeps ThreadSync palette (blue/purple)
   - Centralizes repeated legacy styles (container/section/card/btn)
   - Loaded AFTER per-page <style> blocks to unify the look without rewriting every page
*/

:root {
  /* Type scale */
  --ts-type-h1: clamp(2.2rem, 4.2vw, 3.4rem);
  --ts-type-h2: clamp(1.6rem, 2.4vw, 2.25rem);
  --ts-type-h3: clamp(1.15rem, 1.5vw, 1.55rem);
  --ts-type-lead: clamp(1.05rem, 1.35vw, 1.25rem);
  --ts-reading-max: 72ch;

  /* Spacing rhythm */
  --ts-space-section: clamp(52px, 6.5vw, 88px);
  --ts-space-section-tight: clamp(40px, 5vw, 64px);
  --ts-space-container: clamp(18px, 3vw, 28px);

  /* Crisp surfaces */
  --ts-border-strong: rgba(148, 163, 184, 0.24);
  --ts-shadow-crisp: 0 18px 45px rgba(0, 0, 0, 0.32);
  --ts-shadow-crisp-hover: 0 28px 80px rgba(0, 0, 0, 0.48);
}

body {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

/* Re-assert the shared background system (some pages override body::before in their inline CSS) */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background:
    radial-gradient(900px circle at 18% 12%, var(--ts-glow-primary, rgba(59,130,246,0.22)) 0%, transparent 55%),
    radial-gradient(850px circle at 82% 20%, var(--ts-glow-accent, rgba(139,92,246,0.18)) 0%, transparent 60%),
    radial-gradient(700px circle at 35% 88%, var(--ts-glow-primary-soft, rgba(59,130,246,0.10)) 0%, transparent 55%),
    radial-gradient(800px circle at 80% 86%, var(--ts-glow-accent-soft, rgba(139,92,246,0.08)) 0%, transparent 58%);
  opacity: 1;
}

body::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  opacity: 0.06;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='140' height='140' filter='url(%23n)' opacity='.45'/%3E%3C/svg%3E");
}

/* Ensure content layers above background */
main, header, footer, section, nav {
  position: relative;
  z-index: 1;
}

/* Unified typography rhythm */
h1, h2, h3 {
  letter-spacing: -0.02em;
}

h1 {
  font-size: var(--ts-type-h1);
  line-height: 1.08;
  font-weight: 800;
  margin: 0 0 0.6em;
}

h2 {
  font-size: var(--ts-type-h2);
  line-height: 1.15;
  font-weight: 800;
  margin: 0 0 0.7em;
}

h3 {
  font-size: var(--ts-type-h3);
  line-height: 1.2;
  font-weight: 800;
  margin: 0 0 0.6em;
}

main p {
  color: var(--ts-muted, rgba(255, 255, 255, 0.68));
  line-height: 1.75;
  margin: 0 0 1rem;
}

main p strong {
  color: var(--ts-text, rgba(255, 255, 255, 0.92));
  font-weight: 800;
}

main a {
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

main a:hover {
  text-decoration: underline;
}

/* Container + section rhythm (avoid clobbering .hero styles that use class="hero section") */
.container {
  padding-left: var(--ts-space-container);
  padding-right: var(--ts-space-container);
}

/* Many pages use .section; keep it consistent but do NOT override hero padding */
.section:not(.hero) {
  padding-top: var(--ts-space-section);
  padding-bottom: var(--ts-space-section);
}

.section.section-alt {
  background: rgba(255, 255, 255, 0.02);
}

.section-header {
  text-align: center;
  margin-bottom: clamp(28px, 4vw, 52px);
}

.section-header h2 {
  margin-bottom: 0.6rem;
}

.section-header p {
  max-width: var(--ts-reading-max);
  margin-left: auto;
  margin-right: auto;
}

/* Bring gradient-text into alignment with ThreadSync tokens */
.gradient-text {
  background: var(--ts-gradient, linear-gradient(135deg, rgba(59,130,246,1) 0%, rgba(139,92,246,1) 100%));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

/* CRISP SURFACES: unify common “card-like” blocks across pages */
.stat-box,
.platform-card,
.solution-card,
.integration-box,
.arch-box,
.mission-card,
.value-card,
.team-card,
.stat-card,
.feature-card,
.endpoint-card,
.workflow-card,
.card {
  background: var(--ts-surface, rgba(15, 23, 42, 0.55));
  border: 1px solid var(--ts-border, rgba(148, 163, 184, 0.18));
  border-radius: var(--ts-radius, 16px);
  box-shadow: var(--ts-shadow, 0 20px 50px rgba(0, 0, 0, 0.35));
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.stat-box:hover,
.platform-card:hover,
.solution-card:hover,
.integration-box:hover,
.workflow-card:hover,
.card:hover {
  border-color: rgba(59,130,246,0.38);
  box-shadow: var(--ts-shadow-hover, 0 30px 70px rgba(0, 0, 0, 0.45)),
              0 0 0 1px rgba(59, 130, 246, 0.14),
              0 0 42px rgba(59, 130, 246, 0.12);
  transform: translateY(-2px);
}

/* Legacy button system bridge (.btn + modifiers)
   NOTE: We intentionally style only `.btn.btn-primary` / `.btn.btn-secondary` so pages that define their own
   standalone `.btn-primary` (e.g., ROI Calculator modals) keep their bespoke sizing/shape.
*/
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: 12px;
  border: 1px solid transparent;
  font-weight: 700;
  font-size: 0.95rem;
  line-height: 1;
  transition: transform 150ms ease, box-shadow 150ms ease, background-color 150ms ease, border-color 150ms ease, opacity 150ms ease;
  cursor: pointer;
  user-select: none;
  text-decoration: none !important;
}

.btn.btn-primary {
  background: var(--ts-gradient, linear-gradient(135deg, rgba(59,130,246,1) 0%, rgba(139,92,246,1) 100%));
  color: #fff;
  box-shadow: 0 12px 30px rgba(59, 130, 246, 0.22);
}

.btn.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 18px 42px rgba(59, 130, 246, 0.28);
}

.btn.btn-secondary {
  background: rgba(255,255,255,0.05);
  border-color: rgba(255,255,255,0.14);
  color: #fff;
}

.btn.btn-secondary:hover {
  background: rgba(255,255,255,0.08);
  border-color: rgba(255,255,255,0.22);
  transform: translateY(-1px);
}

.btn:active { transform: translateY(0px); }

/* Small quality-of-life tweaks */
hr {
  border: 0;
  height: 1px;
  background: rgba(148, 163, 184, 0.14);
  margin: 28px 0;
}

code, pre {
  font-family: "Source Code Pro", ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
}

@media (max-width: 900px) {
  .section:not(.hero) {
    padding-top: var(--ts-space-section-tight);
    padding-bottom: var(--ts-space-section-tight);
  }
}

/* Disable glowing background effects on mobile for performance */
@media (max-width: 768px) {
  body::before,
  body::after {
    display: none;
  }
}

/* Prevent horizontal overflow on mobile */
html, body {
  overflow-x: hidden;
  max-width: 100vw;
}
