/* ═══════════════════════════════════════════════════════════
   Commvio — Base Design System
   Reset · Variables · Typography · Layout · Grid
   ═══════════════════════════════════════════════════════════ */

/* ── CSS Variables (Design Tokens) ────────────────────────── */
:root {
  /* Colors */
  --accent:           #0A84FF;
  --accent-hover:     #0070E0;
  --accent-light:     rgba(10, 132, 255, 0.10);
  --accent-glow:      rgba(10, 132, 255, 0.25);

  --bg:               #FAFAFA;
  --bg-alt:           #F2F2F7;
  --bg-card:          rgba(255, 255, 255, 0.72);
  --bg-glass:         rgba(255, 255, 255, 0.60);
  --bg-overlay:       rgba(0, 0, 0, 0.45);

  --text:             #1D1D1F;
  --text-secondary:   #6E6E73;
  --text-tertiary:    #AEAEB2;
  --text-on-accent:   #FFFFFF;

  --border:           rgba(0, 0, 0, 0.08);
  --border-strong:    rgba(0, 0, 0, 0.14);

  --success:          #30D158;
  --error:            #FF453A;
  --warning:          #FFD60A;

  /* Radius */
  --radius-sm:        10px;
  --radius-md:        16px;
  --radius-lg:        22px;
  --radius-xl:        28px;
  --radius-pill:      100px;

  /* Shadows */
  --shadow-sm:        0 1px 3px rgba(0,0,0,0.04), 0 1px 2px rgba(0,0,0,0.06);
  --shadow-md:        0 4px 14px rgba(0,0,0,0.06), 0 2px 6px rgba(0,0,0,0.04);
  --shadow-lg:        0 10px 40px rgba(0,0,0,0.08), 0 4px 12px rgba(0,0,0,0.04);
  --shadow-glass:     0 8px 32px rgba(0,0,0,0.06);

  /* Layout */
  --container:        1160px;
  --container-narrow: 800px;
  --gutter:           24px;
  --section-py:       88px;
  --section-py-sm:    56px;

  /* Typography */
  --font-body:        'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-heading:     'Plus Jakarta Sans', var(--font-body);
  --font-mono:        'SF Mono', 'Fira Code', monospace;

  /* Transitions */
  --ease:             cubic-bezier(0.25, 0.46, 0.45, 0.94);
  --ease-spring:      cubic-bezier(0.34, 1.56, 0.64, 1);
  --duration:         0.3s;
  --duration-fast:    0.15s;
  --duration-slow:    0.5s;

  /* Z-index scale */
  --z-dropdown:       100;
  --z-sticky:         200;
  --z-overlay:        300;
  --z-modal:          400;
  --z-toast:          500;

  /* Header */
  --header-h:         64px;
}

/* ── Reset / Normalize ────────────────────────────────────── */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  -webkit-text-size-adjust: 100%;
  -moz-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
  min-height: 100dvh;
  overflow-x: hidden;
}

body.scroll-locked {
  overflow: hidden;
  position: fixed;
  width: 100%;
  top: var(--scroll-top, 0);
}

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

img {
  border: 0;
}

a {
  color: var(--accent);
  text-decoration: none;
  transition: color var(--duration-fast) var(--ease);
}

a:hover {
  color: var(--accent-hover);
}

button, input, select, textarea {
  font: inherit;
  color: inherit;
  border: none;
  background: none;
  outline: none;
}

button {
  cursor: pointer;
}

ul, ol {
  list-style: none;
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-heading);
  font-weight: 700;
  line-height: 1.15;
  color: var(--text);
  letter-spacing: -0.02em;
}

/* ── Typography Scale (SEO-optimized hierarchy) ──────────── */
/* Display — Hero headlines only (H1)                         */
/* H1 — Page section feature titles                          */
/* H2 — Section headings                                     */
/* H3 — Sub-section headings, card titles                    */
/* H4 — Card sub-headings, labels                            */
/* H5 — Small headings, form step titles                     */
/* H6 — Micro headings, footer column titles                 */

.t-display {
  font-size: clamp(2.25rem, 5vw, 3.5rem); /* 36px–56px */
  line-height: 1.08;
  letter-spacing: -0.03em;
}

.t-h1 {
  font-size: clamp(1.875rem, 4vw, 2.75rem); /* 30px–44px */
  line-height: 1.1;
}

.t-h2 {
  font-size: clamp(1.5rem, 3vw, 2.125rem); /* 24px–34px */
  line-height: 1.15;
}

.t-h3 {
  font-size: clamp(1.25rem, 2.5vw, 1.5rem); /* 20px–24px */
  line-height: 1.25;
}

.t-h4 {
  font-size: 1.125rem; /* 18px */
  line-height: 1.3;
}

.t-h5 {
  font-size: 1rem; /* 16px */
  line-height: 1.35;
  font-weight: 600;
}

.t-h6 {
  font-size: 0.875rem; /* 14px */
  line-height: 1.4;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* ── Body / Text Scale ───────────────────────────────────── */
.t-lead {
  font-size: clamp(1.125rem, 2vw, 1.25rem); /* 18px–20px */
  line-height: 1.6;
  color: var(--text-secondary);
}

.t-body {
  font-size: 1rem; /* 16px */
  line-height: 1.6;
}

.t-body-lg {
  font-size: 1.125rem; /* 18px */
  line-height: 1.6;
  color: var(--text-secondary);
}

.t-small {
  font-size: 0.875rem; /* 14px */
  line-height: 1.5;
  color: var(--text-secondary);
}

.t-caption {
  font-size: 0.75rem; /* 12px */
  line-height: 1.5;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 600;
}

.t-overline {
  font-size: 0.8125rem; /* 13px */
  line-height: 1.4;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 700;
}

/* ── Layout ───────────────────────────────────────────────── */
.container {
  width: 100%;
  max-width: var(--container);
  margin: 0 auto;
  padding: 0 var(--gutter);
}

.container--narrow {
  max-width: var(--container-narrow);
}

.section {
  padding: var(--section-py) 0;
}

.section--alt {
  background: var(--bg-alt);
}

.section--dark {
  background: #1C1C1E;
  color: #F5F5F7;
}

.section--dark .section-header__title,
.section--dark .t-h1,
.section--dark .t-h2,
.section--dark .t-h3,
.section--dark .t-h4,
.section--dark .t-h5,
.section--dark .t-h6,
.section--dark h1,
.section--dark h2,
.section--dark h3,
.section--dark h4,
.section--dark h5,
.section--dark h6 {
  color: #F5F5F7;
}

.section--dark .section-header__subtitle,
.section--dark p {
  color: #A1A1A6;
}

/* ── Grid Utilities ───────────────────────────────────────── */
.grid {
  display: grid;
  gap: var(--gutter);
}

.grid--2 { grid-template-columns: repeat(2, 1fr); }
.grid--3 { grid-template-columns: repeat(3, 1fr); }
.grid--4 { grid-template-columns: repeat(4, 1fr); }

/* Bento grid (6 cards: 3-col top, 3-col bottom) */
.grid--bento {
  grid-template-columns: repeat(3, 1fr);
}

/* ── Flex Utilities ───────────────────────────────────────── */
.flex { display: flex; }
.flex-col { flex-direction: column; }
.flex-wrap { flex-wrap: wrap; }
.items-center { align-items: center; }
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }
.gap-sm { gap: 12px; }
.gap-md { gap: var(--gutter); }
.gap-lg { gap: 40px; }
.gap-xl { gap: 64px; }

/* ── Text Align ───────────────────────────────────────────── */
.text-center { text-align: center; }
.text-left   { text-align: left; }

/* ── Spacers ──────────────────────────────────────────────── */
.mb-xs  { margin-bottom: 8px; }
.mb-sm  { margin-bottom: 16px; }
.mb-md  { margin-bottom: 24px; }
.mb-lg  { margin-bottom: 40px; }
.mb-xl  { margin-bottom: 64px; }
.mt-sm  { margin-top: 16px; }
.mt-md  { margin-top: 24px; }

/* ── Display Utilities ───────────────────────────────────── */
.is-hidden { display: none !important; }

/* ── Visually Hidden (SR-only) ────────────────────────────── */
.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;
}

/* ── Focus Styles ─────────────────────────────────────────── */
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 4px;
}

/* ── Reveal Animations ────────────────────────────────────── */
.reveal {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity var(--duration-slow) var(--ease),
              transform var(--duration-slow) var(--ease);
}

.reveal.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.reveal-stagger > .reveal:nth-child(1) { transition-delay: 0ms; }
.reveal-stagger > .reveal:nth-child(2) { transition-delay: 80ms; }
.reveal-stagger > .reveal:nth-child(3) { transition-delay: 160ms; }
.reveal-stagger > .reveal:nth-child(4) { transition-delay: 240ms; }
.reveal-stagger > .reveal:nth-child(5) { transition-delay: 320ms; }
.reveal-stagger > .reveal:nth-child(6) { transition-delay: 400ms; }

/* Named delay classes */
.reveal-delay-1 { transition-delay: 100ms; }
.reveal-delay-2 { transition-delay: 200ms; }
.reveal-delay-3 { transition-delay: 300ms; }
.reveal-delay-4 { transition-delay: 400ms; }

/* Scale-up variant */
.reveal-scale {
  opacity: 0;
  transform: scale(0.95);
  transition: opacity var(--duration-slow) var(--ease),
              transform var(--duration-slow) var(--ease);
}
.reveal-scale.is-visible {
  opacity: 1;
  transform: scale(1);
}

/* Upward slide-in variant (enters from below, slides up) */
.reveal-up {
  opacity: 0;
  transform: translateY(40px);
  transition: opacity var(--duration-slow) var(--ease),
              transform var(--duration-slow) var(--ease);
}
.reveal-up.is-visible {
  opacity: 1;
  transform: translateY(0);
}

/* ── Reduced Motion ───────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
  .reveal,
  .reveal-up,
  .reveal-scale {
    opacity: 1;
    transform: none;
  }
}

/* ── Responsive ───────────────────────────────────────────── */
@media (max-width: 1024px) {
  :root {
    --section-py: 64px;
    --gutter: 20px;
  }
}

@media (max-width: 768px) {
  :root {
    --section-py: 48px;
    --header-h: 56px;
  }

  .grid--2,
  .grid--3,
  .grid--4 {
    grid-template-columns: 1fr;
  }

  .grid--bento {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  :root {
    --gutter: 20px;
  }
}

/* ── Skip Link (Accessibility) ──────────────────────────── */
.skip-link {
  position: absolute;
  top: -100%;
  left: 16px;
  z-index: 10000;
  padding: 12px 24px;
  background: var(--accent);
  color: #fff;
  font-size: 0.875rem;
  font-weight: 600;
  border-radius: var(--radius-md);
  text-decoration: none;
  box-shadow: var(--shadow-md);
  transition: top 0.2s ease;
}

.skip-link:focus {
  top: 12px;
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
