/* ============================================================
   KronoGraph Design System — main.css
   Variables, reset, typography, utilities, dark/light modes
   ============================================================ */

/* --- Logo SVG dark/light mode fix --- */
:root .logo-svg .cls-1 { fill: #EFF6F8; }
[data-theme="light"] .logo-svg .cls-1 { fill: #232830; }

/* --- CSS Custom Properties (Dark mode = default) --- */
:root {
  /* Brand colors — immutable across modes */
  --brand-teal: #2BBCD4;
  --brand-coral: #F0854A;
  --brand-gray: #3D4F5C;

  /* Dark mode palette (default) */
  --bg-primary: #090D0F;
  --bg-secondary: #0F1518;
  --bg-card: #141C20;
  --accent: #2BBCD4;
  --accent-hover: #3DD1E9;
  --accent-secondary: #F0854A;
  --accent-glow: rgba(43, 188, 212, 0.12);
  --text-primary: #EFF6F8;
  --text-secondary: #7A9BAA;
  --border: rgba(43, 188, 212, 0.12);

  /* Shadows */
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.5);
  --shadow-glow: 0 0 24px rgba(43, 188, 212, 0.15);

  /* Spacing scale */
  --space-xs: 0.25rem;
  --space-sm: 0.5rem;
  --space-md: 1rem;
  --space-lg: 1.5rem;
  --space-xl: 2rem;
  --space-2xl: 3rem;
  --space-3xl: 4rem;
  --space-4xl: 6rem;
  --space-5xl: 8rem;

  /* Typography scale */
  --font-display: 'Barlow Condensed', 'Arial Narrow', sans-serif;
  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;

  --text-xs: 0.75rem;
  --text-sm: 0.875rem;
  --text-base: 1rem;
  --text-lg: 1.125rem;
  --text-xl: 1.25rem;
  --text-2xl: 1.5rem;
  --text-3xl: 2rem;
  --text-4xl: 3rem;
  --text-5xl: 4rem;
  --text-hero: clamp(2.5rem, 6vw, 6rem);

  --leading-tight: 1.05;
  --leading-snug: 1.2;
  --leading-normal: 1.6;

  --weight-regular: 400;
  --weight-medium: 500;
  --weight-semibold: 600;
  --weight-bold: 700;
  --weight-extrabold: 800;

  /* Border radius */
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;
  --radius-full: 9999px;

  /* Transitions */
  --transition-fast: 150ms ease;
  --transition-base: 250ms ease;
  --transition-slow: 400ms ease;

  /* Layout */
  --max-width: 1200px;
  --navbar-height: 72px;
}

/* --- Light mode --- */
[data-theme="light"] {
  --bg-primary: #F5FAFB;
  --bg-secondary: #EAF4F7;
  --bg-card: #FFFFFF;
  --accent: #1FA8C0;
  --accent-hover: #2BBCD4;
  --accent-secondary: #E06B30;
  --accent-glow: rgba(43, 188, 212, 0.08);
  --text-primary: #0A1518;
  --text-secondary: #4A6B78;
  --border: rgba(43, 188, 212, 0.15);

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.06);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.1);
  --shadow-glow: 0 0 24px rgba(43, 188, 212, 0.1);
}

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

html {
  font-size: 16px;
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  font-family: var(--font-body);
  font-size: var(--text-base);
  font-weight: var(--weight-regular);
  line-height: var(--leading-normal);
  color: var(--text-primary);
  background-color: var(--bg-primary);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
  transition: background-color var(--transition-base), color var(--transition-base);
}

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

a {
  color: inherit;
  text-decoration: none;
}

button {
  font: inherit;
  color: inherit;
  background: none;
  border: none;
  cursor: pointer;
}

ul, ol {
  list-style: none;
}

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

/* Remove autofill styles */
input:-webkit-autofill {
  -webkit-box-shadow: 0 0 0 1000px var(--bg-card) inset;
  -webkit-text-fill-color: var(--text-primary);
}

/* --- Typography --- */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-display);
  font-weight: var(--weight-bold);
  line-height: var(--leading-tight);
  color: var(--text-primary);
  text-transform: uppercase;
  letter-spacing: -0.01em;
}

h1 {
  font-size: var(--text-hero);
  font-weight: var(--weight-extrabold);
}

h2 {
  font-size: var(--text-4xl);
}

h3 {
  font-size: var(--text-2xl);
}

h4 {
  font-size: var(--text-xl);
}

p {
  color: var(--text-secondary);
  max-width: 65ch;
}

strong {
  font-weight: var(--weight-semibold);
}

/* Teal accent text */
.text-accent {
  color: var(--accent);
}

/* Coral accent text */
.text-coral {
  color: var(--accent-secondary);
}

.text-center {
  text-align: center;
}

/* --- Layout utilities --- */
.container {
  width: 100%;
  max-width: var(--max-width);
  margin-inline: auto;
  padding-inline: var(--space-lg);
}

.section {
  padding-block: var(--space-5xl);
}

.section-header {
  margin-bottom: var(--space-3xl);
}

.section-header p {
  margin-top: var(--space-md);
  font-size: var(--text-lg);
}

/* --- Buttons --- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  padding: 0.875rem 2rem;
  font-family: var(--font-display);
  font-size: var(--text-lg);
  font-weight: var(--weight-bold);
  text-transform: uppercase;
  letter-spacing: 0.02em;
  border-radius: var(--radius-md);
  transition: all var(--transition-fast);
  white-space: nowrap;
}

.btn-primary {
  background: var(--accent);
  color: #FFFFFF;
  box-shadow: var(--shadow-glow);
}

.btn-primary:hover {
  background: var(--accent-hover);
  box-shadow: 0 0 32px rgba(43, 188, 212, 0.25);
  transform: translateY(-1px);
}

.btn-secondary {
  background: transparent;
  color: var(--text-primary);
  border: 1px solid var(--border);
}

.btn-secondary:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.btn-sm {
  padding: 0.625rem 1.25rem;
  font-size: var(--text-sm);
}

/* --- Cards --- */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-xl);
  transition: all var(--transition-base);
}

.card:hover {
  border-color: rgba(43, 188, 212, 0.3);
  box-shadow: var(--shadow-glow);
  transform: translateY(-2px);
}

/* Glassmorphism card variant */
.card-glass {
  background: rgba(20, 28, 32, 0.6);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(43, 188, 212, 0.1);
  border-radius: var(--radius-lg);
  padding: var(--space-xl);
  transition: all var(--transition-base);
}

[data-theme="light"] .card-glass {
  background: rgba(255, 255, 255, 0.7);
  border-color: rgba(43, 188, 212, 0.12);
}

.card-glass:hover {
  border-color: rgba(43, 188, 212, 0.25);
  box-shadow: var(--shadow-glow);
}

/* --- Badge --- */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.25rem 0.75rem;
  font-family: var(--font-display);
  font-size: var(--text-xs);
  font-weight: var(--weight-bold);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-radius: var(--radius-full);
  background: var(--accent-glow);
  color: var(--accent);
  border: 1px solid var(--border);
}

.badge-coral {
  background: rgba(240, 133, 74, 0.12);
  color: var(--accent-secondary);
  border-color: rgba(240, 133, 74, 0.2);
}

/* --- Grid utilities --- */
.grid {
  display: grid;
  gap: var(--space-xl);
}

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

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

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

/* --- Flex utilities --- */
.flex {
  display: flex;
}

.flex-center {
  display: flex;
  align-items: center;
  justify-content: center;
}

.flex-between {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.gap-sm { gap: var(--space-sm); }
.gap-md { gap: var(--space-md); }
.gap-lg { gap: var(--space-lg); }
.gap-xl { gap: var(--space-xl); }

/* --- Scroll reveal animation --- */
.reveal {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

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

/* --- Dividers --- */
.divider {
  width: 100%;
  height: 1px;
  background: var(--border);
}

/* --- Screen reader 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;
}

/* --- Responsive --- */
@media (max-width: 1024px) {
  h2 {
    font-size: var(--text-3xl);
  }

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

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

@media (max-width: 768px) {
  :root {
    --navbar-height: 64px;
  }

  .container {
    padding-inline: var(--space-md);
  }

  .section {
    padding-block: var(--space-3xl);
  }

  h2 {
    font-size: var(--text-2xl);
  }

  h3 {
    font-size: var(--text-xl);
  }

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

  .btn {
    width: 100%;
  }
}

@media (max-width: 480px) {
  .container {
    padding-inline: var(--space-md);
  }

  .section {
    padding-block: var(--space-2xl);
  }
}
