/* =============================================================
   Fourth Alpha Theme — Base CSS
   Design tokens, reset, typography foundation
   ============================================================= */

/* -----------------------------------------------------------
   CSS Custom Properties (Design Tokens)
   ----------------------------------------------------------- */
:root {
  /* Colors */
  --color-bg:             #0A0F1E;
  --color-bg-secondary:   #0D1628;
  --color-surface:        #111827;
  --color-surface-raised: #1A2332;
  --color-surface-hover:  #1F2D40;
  --color-border:         #1E2D40;
  --color-border-subtle:  #152030;

  /* Accent */
  --color-accent:         #00D4FF;
  --color-accent-dim:     rgba(0, 212, 255, 0.15);
  --color-accent-glow:    rgba(0, 212, 255, 0.4);
  --color-purple:         #7B61FF;
  --color-purple-dim:     rgba(123, 97, 255, 0.15);
  --color-purple-glow:    rgba(123, 97, 255, 0.4);
  --color-green:          #00F5A0;
  --color-green-dim:      rgba(0, 245, 160, 0.15);

  /* Text */
  --color-text:           #F8FAFC;
  --color-text-secondary: #94A3B8;
  --color-text-muted:     #64748B;
  --color-text-disabled:  #334155;

  /* Gradients */
  --gradient-primary:     linear-gradient(135deg, #00D4FF 0%, #7B61FF 100%);
  --gradient-hero:        radial-gradient(ellipse at 20% 50%, rgba(0, 212, 255, 0.12) 0%, transparent 55%),
                          radial-gradient(ellipse at 80% 20%, rgba(123, 97, 255, 0.12) 0%, transparent 55%);
  --gradient-glow-cyan:   radial-gradient(circle, rgba(0, 212, 255, 0.2) 0%, transparent 70%);
  --gradient-glow-purple: radial-gradient(circle, rgba(123, 97, 255, 0.2) 0%, transparent 70%);
  --gradient-card:        linear-gradient(135deg, rgba(26, 35, 50, 0.6) 0%, rgba(10, 15, 30, 0.6) 100%);
  --gradient-text:        linear-gradient(135deg, #00D4FF 0%, #7B61FF 50%, #00F5A0 100%);

  /* Shadows */
  --shadow-sm:   0 1px 3px rgba(0,0,0,0.4);
  --shadow-md:   0 4px 12px rgba(0,0,0,0.4);
  --shadow-lg:   0 10px 30px rgba(0,0,0,0.5);
  --shadow-xl:   0 20px 60px rgba(0,0,0,0.6);
  --shadow-glow: 0 0 20px var(--color-accent-glow), 0 0 60px rgba(0,212,255,0.1);
  --shadow-card: 0 0 0 1px var(--color-border), var(--shadow-lg);

  /* Typography */
  --font-display: 'Syne', system-ui, sans-serif;
  --font-body:    'DM Sans', system-ui, sans-serif;
  --font-mono:    'JetBrains Mono', 'Courier New', monospace;

  /* Font sizes (fluid) */
  --text-xs:   0.75rem;
  --text-sm:   0.875rem;
  --text-base: 1rem;
  --text-md:   1.125rem;
  --text-lg:   1.25rem;
  --text-xl:   1.5rem;
  --text-2xl:  1.875rem;
  --text-3xl:  2.25rem;
  --text-4xl:  clamp(2rem, 4vw, 3rem);
  --text-5xl:  clamp(2.5rem, 5vw, 3.75rem);
  --text-6xl:  clamp(3rem, 6vw, 4.5rem);
  --text-7xl:  clamp(3.5rem, 8vw, 5.5rem);

  /* Spacing */
  --space-1:  0.25rem;
  --space-2:  0.5rem;
  --space-3:  0.75rem;
  --space-4:  1rem;
  --space-5:  1.25rem;
  --space-6:  1.5rem;
  --space-8:  2rem;
  --space-10: 2.5rem;
  --space-12: 3rem;
  --space-16: 4rem;
  --space-20: 5rem;
  --space-24: 6rem;
  --space-32: 8rem;
  --space-40: 10rem;

  /* Layout */
  --container-sm:  640px;
  --container-md:  768px;
  --container-lg:  1024px;
  --container-xl:  1280px;
  --container-2xl: 1440px;
  --container-pad: clamp(1rem, 4vw, 2rem);

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

  /* Transitions */
  --ease-default: cubic-bezier(0.4, 0, 0.2, 1);
  --ease-spring:  cubic-bezier(0.34, 1.56, 0.64, 1);
  --ease-out:     cubic-bezier(0, 0, 0.2, 1);
  --duration-fast: 150ms;
  --duration-base: 250ms;
  --duration-slow: 400ms;

  /* Z-index */
  --z-base:    1;
  --z-raised:  10;
  --z-overlay: 100;
  --z-modal:   1000;
  --z-toast:   2000;
  --z-header:  500;
}

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

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  tab-size: 4;
}

body {
  font-family: var(--font-body);
  font-size: var(--text-base);
  line-height: 1.7;
  color: var(--color-text);
  background-color: var(--color-bg);
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

/* -----------------------------------------------------------
   Typography
   ----------------------------------------------------------- */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-display);
  color: var(--color-text);
  line-height: 1.15;
  letter-spacing: -0.025em;
  font-weight: 700;
}

h1 { font-size: var(--text-7xl); font-weight: 800; letter-spacing: -0.03em; }
h2 { font-size: var(--text-5xl); font-weight: 700; }
h3 { font-size: var(--text-3xl); font-weight: 600; letter-spacing: -0.02em; }
h4 { font-size: var(--text-2xl); font-weight: 600; letter-spacing: -0.015em; }
h5 { font-size: var(--text-xl);  font-weight: 600; font-family: var(--font-body); }
h6 { font-size: var(--text-lg);  font-weight: 600; font-family: var(--font-body); }

p {
  color: var(--color-text-secondary);
  line-height: 1.75;
}

p + p { margin-top: 1em; }

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

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

strong, b { font-weight: 700; color: var(--color-text); }
em, i { font-style: italic; }

small { font-size: var(--text-sm); }

code, kbd, samp, pre {
  font-family: var(--font-mono);
  font-size: 0.9em;
}

code {
  background: var(--color-surface-raised);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  padding: 0.15em 0.4em;
  color: var(--color-accent);
}

pre {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-6);
  overflow-x: auto;
}

pre code {
  background: none;
  border: none;
  padding: 0;
}

blockquote {
  border-left: 3px solid var(--color-accent);
  padding: var(--space-4) var(--space-6);
  background: var(--color-surface);
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
  font-style: italic;
  color: var(--color-text-secondary);
}

/* -----------------------------------------------------------
   Lists
   ----------------------------------------------------------- */
ul, ol {
  padding-left: var(--space-6);
  color: var(--color-text-secondary);
}

li + li { margin-top: 0.4em; }

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

img {
  object-fit: cover;
  aspect-ratio: attr(width) / attr(height);
}

/* -----------------------------------------------------------
   Forms
   ----------------------------------------------------------- */
input, textarea, select, button {
  font-family: inherit;
  font-size: inherit;
}

input, textarea, select {
  width: 100%;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  color: var(--color-text);
  padding: var(--space-3) var(--space-4);
  transition: border-color var(--duration-fast) var(--ease-default),
              box-shadow var(--duration-fast) var(--ease-default);
  outline: none;
}

input::placeholder, textarea::placeholder {
  color: var(--color-text-muted);
}

input:focus, textarea:focus, select:focus {
  border-color: var(--color-accent);
  box-shadow: 0 0 0 3px rgba(0, 212, 255, 0.1);
}

textarea { resize: vertical; min-height: 120px; }

label {
  display: block;
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--color-text-secondary);
  margin-bottom: var(--space-2);
  letter-spacing: 0.01em;
}

/* -----------------------------------------------------------
   Tables
   ----------------------------------------------------------- */
table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--text-sm);
}

th {
  font-family: var(--font-display);
  font-weight: 600;
  text-align: left;
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--color-border);
  color: var(--color-text);
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

td {
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--color-border-subtle);
  color: var(--color-text-secondary);
}

tr:last-child td { border-bottom: none; }

/* -----------------------------------------------------------
   Utility: Container
   ----------------------------------------------------------- */
.container {
  width: 100%;
  max-width: var(--container-xl);
  margin-left: auto;
  margin-right: auto;
  padding-left: var(--container-pad);
  padding-right: var(--container-pad);
}

.container-sm { max-width: var(--container-sm); }
.container-md { max-width: var(--container-md); }
.container-lg { max-width: var(--container-lg); }
.container-2xl { max-width: var(--container-2xl); }

/* -----------------------------------------------------------
   Utility: Screen Reader
   ----------------------------------------------------------- */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}

/* -----------------------------------------------------------
   Utility: Gradient Text
   ----------------------------------------------------------- */
.gradient-text {
  background: var(--gradient-text);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.gradient-accent {
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* -----------------------------------------------------------
   Utility: Flex / Grid helpers
   ----------------------------------------------------------- */
.flex { display: flex; }
.flex-center { display: flex; align-items: center; justify-content: center; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.grid { display: grid; }

/* -----------------------------------------------------------
   Section Spacing
   ----------------------------------------------------------- */
.section {
  padding-top: clamp(var(--space-16), 8vw, var(--space-32));
  padding-bottom: clamp(var(--space-16), 8vw, var(--space-32));
}

.section-sm {
  padding-top: clamp(var(--space-12), 5vw, var(--space-20));
  padding-bottom: clamp(var(--space-12), 5vw, var(--space-20));
}

/* -----------------------------------------------------------
   Section Headers
   ----------------------------------------------------------- */
.section-header {
  text-align: center;
  max-width: 700px;
  margin: 0 auto var(--space-16);
}

.section-tag {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--color-accent);
  padding: var(--space-1) var(--space-3);
  border: 1px solid rgba(0, 212, 255, 0.3);
  border-radius: var(--radius-full);
  background: rgba(0, 212, 255, 0.06);
  margin-bottom: var(--space-4);
}

.section-title {
  font-size: clamp(var(--text-3xl), 4vw, var(--text-5xl));
  margin-bottom: var(--space-4);
  line-height: 1.15;
}

.section-subtitle {
  font-size: var(--text-md);
  color: var(--color-text-secondary);
  line-height: 1.7;
  max-width: 600px;
  margin: 0 auto;
}

/* -----------------------------------------------------------
   Dividers
   ----------------------------------------------------------- */
hr {
  border: none;
  border-top: 1px solid var(--color-border);
  margin: var(--space-8) 0;
}

/* -----------------------------------------------------------
   Selection
   ----------------------------------------------------------- */
::selection {
  background: rgba(0, 212, 255, 0.25);
  color: var(--color-text);
}

/* -----------------------------------------------------------
   Scrollbar (webkit)
   ----------------------------------------------------------- */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--color-bg); }
::-webkit-scrollbar-thumb {
  background: var(--color-border);
  border-radius: var(--radius-full);
}
::-webkit-scrollbar-thumb:hover { background: var(--color-text-muted); }

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

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

/* -----------------------------------------------------------
   WordPress specifics
   ----------------------------------------------------------- */
.wp-block-group.alignfull,
.wp-block-cover.alignfull {
  max-width: 100%;
}

.alignwide {
  max-width: var(--container-xl);
  margin-left: auto;
  margin-right: auto;
}

.alignfull {
  margin-left: calc(-1 * var(--container-pad));
  margin-right: calc(-1 * var(--container-pad));
  max-width: calc(100% + 2 * var(--container-pad));
}

.wp-caption { max-width: 100%; }

.wp-caption-text {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  text-align: center;
  margin-top: var(--space-2);
}

.sticky { /* WordPress sticky post */ }
.bypostauthor { /* WordPress */ }

/* -----------------------------------------------------------
   Print
   ----------------------------------------------------------- */
@media print {
  body {
    background: white;
    color: black;
  }
  .site-header,
  .site-footer,
  .sidebar { display: none; }
}
