/* ═══════════════════════════════════════════════════════════════════════════
 * COMPONENT PRIMITIVES — DO NOT OVERWRITE
 *
 * Base styles, animations, layout utilities, and component classes.
 * Theme tokens live in tokens.css (overwritten by generate_theme).
 * ═══════════════════════════════════════════════════════════════════════════ */

/* ═══════════════════════════════════════════════════════════════════════════
 * DEFENSIVE ALIASES
 * Safety net — resolved by tokens.css if it defines the canonical names.
 * These ensure components work regardless of which naming convention
 * tokens.css uses (template placeholders vs generateTheme output).
 * ═══════════════════════════════════════════════════════════════════════════ */

:root {
  /* Color aliases (component names → canonical names) */
  --color-text: var(--color-foreground);
  --color-text-secondary: var(--color-muted-foreground);
  --color-surface-elevated: color-mix(in oklch, var(--color-surface, oklch(0.97 0 0)), white 5%);
  --color-card: var(--color-surface-elevated);
  --color-card-foreground: var(--color-foreground);
  --color-accent: var(--color-primary);
  --color-accent-foreground: var(--color-primary-foreground);
  --color-warning: var(--color-cta);
  --color-primary-light: color-mix(in oklch, var(--color-primary) 60%, white);
  --color-primary-dark: color-mix(in oklch, var(--color-primary) 80%, black);

  /* Static tokens (theme-independent) */
  --shadow-xl: 0 20px 25px -5px oklch(0.2 0 0 / 0.1), 0 8px 10px -6px oklch(0.2 0 0 / 0.05);
  --duration-slower: 1s;
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* ═══════════════════════════════════════════════════════════════════════════
 * BASE STYLES
 * ═══════════════════════════════════════════════════════════════════════════ */

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.7;
  color: var(--color-text);
  background: var(--color-background);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

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

::selection {
  background: var(--color-primary);
  color: white;
}

:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
}

/* ═══════════════════════════════════════════════════════════════════════════
 * ANIMATION KEYFRAMES
 * ═══════════════════════════════════════════════════════════════════════════ */

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(30px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes slideInLeft {
  from { opacity: 0; transform: translateX(-40px); }
  to { opacity: 1; transform: translateX(0); }
}

@keyframes slideInRight {
  from { opacity: 0; transform: translateX(40px); }
  to { opacity: 1; transform: translateX(0); }
}

@keyframes scaleIn {
  from { opacity: 0; transform: scale(0.9); }
  to { opacity: 1; transform: scale(1); }
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

@keyframes shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

@keyframes successRing {
  from { opacity: 0.6; transform: scale(0.8); }
  to { opacity: 0; transform: scale(1.6); }
}

/* ═══════════════════════════════════════════════════════════════════════════
 * ANIMATION UTILITIES
 * Use these classes on elements for entrance animations
 * ═══════════════════════════════════════════════════════════════════════════ */

.fade-up {
  opacity: 0;
  transform: translateY(30px);
  animation: fadeUp var(--duration-slow) var(--ease-out) forwards;
}

.fade-in {
  opacity: 0;
  animation: fadeIn var(--duration-slow) var(--ease-out) forwards;
}

.slide-in-left {
  opacity: 0;
  transform: translateX(-40px);
  animation: slideInLeft var(--duration-slow) var(--ease-out) forwards;
}

.slide-in-right {
  opacity: 0;
  transform: translateX(40px);
  animation: slideInRight var(--duration-slow) var(--ease-out) forwards;
}

.scale-in {
  opacity: 0;
  transform: scale(0.9);
  animation: scaleIn var(--duration-slow) var(--ease-spring) forwards;
}

.pulse {
  animation: pulse 2s ease-in-out infinite;
}

.success-ring {
  animation: successRing 0.8s var(--ease-out) forwards;
}

/* Animation Delays */
.delay-100 { animation-delay: 0.1s; }
.delay-200 { animation-delay: 0.2s; }
.delay-300 { animation-delay: 0.3s; }
.delay-400 { animation-delay: 0.4s; }
.delay-500 { animation-delay: 0.5s; }
.delay-600 { animation-delay: 0.6s; }

/* Hover Effects */
.hover-lift {
  transition: transform var(--duration-normal) var(--ease-out),
              box-shadow var(--duration-normal) var(--ease-out);
}
.hover-lift:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-xl);
}

.hover-scale {
  transition: transform var(--duration-normal) var(--ease-spring);
}
.hover-scale:hover {
  transform: scale(1.02);
}

/* ═══════════════════════════════════════════════════════════════════════════
 * LAYOUT UTILITIES
 * ═══════════════════════════════════════════════════════════════════════════ */

.container {
  width: 100%;
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

@media (min-width: 768px) {
  .container { padding: 0 2rem; }
}

@media (min-width: 1024px) {
  .container { padding: 0 4rem; }
}

.section {
  padding: 5rem 0;
}

.section-sm {
  padding: 3rem 0;
}

@media (min-width: 768px) {
  .section { padding: 8rem 0; }
  .section-sm { padding: 4rem 0; }
}

.section-accent {
  background: var(--color-accent-bg);
  color: var(--color-accent-text);
}

.section-accent h1,
.section-accent h2,
.section-accent h3,
.section-accent h4 {
  color: var(--color-accent-text);
}

.section-overlay {
  color: white;
}

.section-overlay h1,
.section-overlay h2,
.section-overlay h3,
.section-overlay h4 {
  color: white;
}

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

/* ═══════════════════════════════════════════════════════════════════════════
 * COMPONENT BASES
 * Minimal styles for common elements - extend as needed
 * ═══════════════════════════════════════════════════════════════════════════ */

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 1rem 2rem;
  font-family: var(--font-body);
  font-size: 1rem;
  font-weight: 600;
  text-decoration: none;
  border-radius: var(--radius-md);
  border: none;
  cursor: pointer;
  transition: all var(--duration-normal) var(--ease-out);
}

.btn-primary {
  background: var(--color-cta);
  color: var(--color-cta-foreground);
  box-shadow: var(--shadow-cta-glow);
}

.btn-primary:hover {
  background: var(--color-cta-hover);
  transform: translateY(-2px);
}

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

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

.btn-lg {
  padding: 1.25rem 2.5rem;
  font-size: 1.125rem;
}

.btn-sm {
  padding: 0.625rem 1.25rem;
  font-size: 0.875rem;
}

/* Inputs */
.input {
  width: 100%;
  padding: 1rem 1.25rem;
  font-family: var(--font-body);
  font-size: 1rem;
  color: var(--color-text);
  background: var(--color-surface-elevated);
  border: 2px solid var(--color-border);
  border-radius: var(--radius-md);
  transition: all var(--duration-fast) var(--ease-out);
}

.input:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 4px color-mix(in oklch, var(--color-primary) 10%, transparent);
}

.input::placeholder {
  color: var(--color-muted-foreground);
}

.input-accent {
  background: var(--color-accent-surface);
  border-color: var(--color-accent-border);
  color: var(--color-accent-text);
}

.input-accent:focus {
  border-color: var(--color-primary);
}

/* Cards */
.card {
  background: var(--color-surface-elevated);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 2rem;
  transition: all var(--duration-normal) var(--ease-out);
}

.card:hover {
  box-shadow: var(--shadow-lg);
}

.card-accent {
  background: var(--color-accent-surface);
  border-color: var(--color-accent-border);
}

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-radius: var(--radius-full);
  background: var(--color-surface);
  color: var(--color-text-secondary);
  border: 1px solid var(--color-border);
}

/* ═══════════════════════════════════════════════════════════════════════════
 * SPECIAL EFFECTS
 * ═══════════════════════════════════════════════════════════════════════════ */

.gradient-text {
  background: linear-gradient(135deg, var(--color-primary), var(--color-cta));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.noise-texture {
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.02;
  z-index: 9999;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.65' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E");
}

/* ═══════════════════════════════════════════════════════════════════════════
 * RESPONSIVE UTILITIES
 * ═══════════════════════════════════════════════════════════════════════════ */

@media (max-width: 768px) {
  .hide-mobile { display: none !important; }
}

@media (min-width: 769px) {
  .hide-desktop { display: none !important; }
}

/* ═══════════════════════════════════════════════════════════════════════════
 * ACCESSIBILITY — REDUCED MOTION
 * ═══════════════════════════════════════════════════════════════════════════ */

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* Blesso — Sentinel system, dark-first (palette transplanted from the Sentinel template) */


:root {
  /* Sentinel dark neutrals (hex → OKLCH):
     #0a0a0a bg · #fafafa fg · #171717 muted · #a3a3a3 muted-fg · #262626 border */
  --color-background: oklch(0.145 0 0);
  --color-foreground: oklch(0.985 0 0);
  --color-surface: oklch(0.205 0 0);
  --color-surface-elevated: oklch(0.269 0 0);
  --color-muted: oklch(0.205 0 0);
  --color-muted-foreground: oklch(0.708 0 0);
  --color-text: oklch(0.985 0 0);
  --color-text-secondary: oklch(0.708 0 0);

  /* Hairlines */
  --color-border: oklch(0.269 0 0);
  /* border @ 60% over ink — for template's border-border/60 */
  --color-border-soft: oklch(0.225 0 0);

  /* Derived opacity stand-ins (no /NN modifiers on var colors):
     foreground @ 85% (solid hover), fg @ ~12% wash, fg @ ~5% wash */
  --color-foreground-dim: oklch(0.87 0 0);
  --color-foreground-faint: oklch(0.25 0 0);
  --color-wash: oklch(0.185 0 0);

  /* Crosshair blue — Sentinel #2f80ff */
  --color-primary: oklch(0.62 0.2 259);
  --color-primary-foreground: oklch(0.985 0 0);
  --color-accent: oklch(0.62 0.2 259);
  --color-accent-foreground: oklch(0.985 0 0);

  /* Accent section group (blue-tinted ink panels) */
  --color-accent-bg: oklch(0.18 0.02 259);
  --color-accent-surface: oklch(0.22 0.03 259);
  --color-accent-text: oklch(0.93 0.01 259);
  --color-accent-border: oklch(0.3 0.05 259);

  /* CTA — Sentinel solid button: paper on ink */
  --color-cta: oklch(0.985 0 0);
  --color-cta-foreground: oklch(0.145 0 0);
  --color-cta-hover: oklch(0.87 0 0);

  /* Status */
  --color-success: oklch(0.72 0.17 155);
  --color-warning: oklch(0.8 0.16 85);
  --color-error: oklch(0.65 0.2 25);

  /* Fonts — Sentinel type system */
  --font-heading: "Source Serif 4", ui-serif, Georgia, "Times New Roman", serif;
  --font-body: "Geist", system-ui, -apple-system, sans-serif;
  --font-mono: "Geist Mono", ui-monospace, "SF Mono", monospace;

  /* Motion */
  --duration-fast: 150ms;
  --duration-normal: 300ms;
  --duration-slow: 600ms;
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);

  /* Geometry — chamfer over radius */
  --cut-button: 9px;
  --cut-card: 34px;
  --radius-sm: 2px;
  --radius-md: 4px;
  --radius-lg: 8px;
  --radius-full: 9999px;

  /* Shadows */
  --shadow-lg: 0 12px 32px oklch(0 0 0 / 0.45);
  --shadow-xl: 0 24px 64px oklch(0 0 0 / 0.55);
  --shadow-cta-glow: 0 0 24px oklch(0.985 0 0 / 0.18);

  /* Duotone art-direction stops (Sentinel dark set) */
  --duotone-bg: #05122e;
  --duotone-saturate: saturate(1.35);
  --duotone-base-filter: grayscale(1) contrast(1.2) brightness(1.08);
  --duotone-color: #1466ff;
  --duotone-multiply: #0a235c;
  --duotone-multiply-opacity: 0.4;
  --duotone-screen: #4d9bff;
  --duotone-screen-opacity: 0.25;
}

/* Light theme — Sentinel light neutrals (hex → OKLCH):
   #ffffff bg · #0a0a0a fg · #f5f5f5 muted · #737373 muted-fg · #e5e5e5 border */
html.light {
  --color-background: oklch(1 0 0);
  --color-foreground: oklch(0.145 0 0);
  --color-surface: oklch(0.97 0 0);
  --color-surface-elevated: oklch(0.922 0 0);
  --color-muted: oklch(0.97 0 0);
  --color-muted-foreground: oklch(0.556 0 0);
  --color-text: oklch(0.145 0 0);
  --color-text-secondary: oklch(0.556 0 0);

  --color-border: oklch(0.922 0 0);
  --color-border-soft: oklch(0.945 0 0);

  --color-foreground-dim: oklch(0.3 0 0);
  --color-foreground-faint: oklch(0.85 0 0);
  --color-wash: oklch(0.955 0 0);

  --color-primary-foreground: oklch(1 0 0);
  --color-accent-foreground: oklch(1 0 0);

  --color-accent-bg: oklch(0.95 0.02 259);
  --color-accent-surface: oklch(0.91 0.03 259);
  --color-accent-text: oklch(0.35 0.08 259);
  --color-accent-border: oklch(0.85 0.05 259);

  /* CTA flips: ink on paper */
  --color-cta: oklch(0.145 0 0);
  --color-cta-foreground: oklch(0.985 0 0);
  --color-cta-hover: oklch(0.3 0 0);

  --shadow-lg: 0 12px 32px oklch(0 0 0 / 0.12);
  --shadow-xl: 0 24px 64px oklch(0 0 0 / 0.16);
  --shadow-cta-glow: 0 0 24px oklch(0.145 0 0 / 0.14);

  /* Duotone art-direction stops (Sentinel light set) */
  --duotone-bg: #e6eeff;
  --duotone-saturate: saturate(1.15);
  --duotone-base-filter: grayscale(1) contrast(0.85) brightness(1.55);
  --duotone-color: #3b76ff;
  --duotone-multiply: #9bc0ff;
  --duotone-multiply-opacity: 0.3;
  --duotone-screen: #ffffff;
  --duotone-screen-opacity: 0.25;
}

html {
  color-scheme: dark;
}

html.light {
  color-scheme: light;
}

body {
  background-color: var(--color-background);
  color: var(--color-foreground);
  font-family: var(--font-body);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.focus-ring:focus-visible {
  outline: 2px solid var(--color-foreground);
  outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

