/* ===== BASE RESET & GLOBAL STYLES ===== */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  scroll-behavior: smooth;
  scroll-padding-top: var(--space-20);
  hanging-punctuation: first last;
}

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

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

img { height: auto; }

input, button, textarea, select {
  font: inherit;
  color: inherit;
}

h1, h2, h3, h4, h5, h6 {
  text-wrap: balance;
  line-height: 1.15;
  font-family: var(--font-display);
  letter-spacing: -0.02em;
}

p, li, figcaption {
  text-wrap: pretty;
  max-width: 72ch;
}

ul[role="list"], ol[role="list"] {
  list-style: none;
}

::selection {
  background: var(--color-primary-glow-strong);
  color: var(--color-text);
}

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

a {
  color: inherit;
  text-decoration: none;
  transition: color var(--transition-interactive);
}

button {
  cursor: pointer;
  background: none;
  border: none;
}

@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;
  }
}

/* ===== LAYOUT UTILITIES ===== */
.container {
  width: 100%;
  max-width: var(--content-wide);
  margin-inline: auto;
  padding-inline: clamp(var(--space-5), 5vw, var(--space-16));
}

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

.section {
  padding-block: clamp(var(--space-16), 8vw, var(--space-32));
}

.section--sm {
  padding-block: clamp(var(--space-10), 5vw, var(--space-20));
}

.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;
}

/* ===== TYPOGRAPHY UTILITIES ===== */
.text-hero    { font-size: var(--text-hero);  font-family: var(--font-display); letter-spacing: -0.03em; line-height: 1.05; }
.text-3xl     { font-size: var(--text-3xl);   font-family: var(--font-display); letter-spacing: -0.03em; line-height: 1.08; }
.text-2xl     { font-size: var(--text-2xl);   font-family: var(--font-display); letter-spacing: -0.025em; line-height: 1.1; }
.text-xl      { font-size: var(--text-xl);    font-family: var(--font-display); letter-spacing: -0.02em;  line-height: 1.15; }
.text-lg      { font-size: var(--text-lg);    line-height: 1.4; }
.text-base    { font-size: var(--text-base);  line-height: 1.65; }
.text-sm      { font-size: var(--text-sm);    line-height: 1.5; }
.text-xs      { font-size: var(--text-xs);    line-height: 1.4; }
.text-muted   { color: var(--color-text-muted); }
.text-faint   { color: var(--color-text-faint); }
.text-primary { color: var(--color-primary-bright); }
.font-display { font-family: var(--font-display); }
.font-mono    { font-family: var(--font-mono); }

/* ===== BUTTON SYSTEM ===== */
.btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: 0.75rem 1.5rem;
  font-size: var(--text-sm);
  font-family: var(--font-body);
  font-weight: 500;
  letter-spacing: 0.01em;
  border-radius: var(--radius-md);
  border: 1.5px solid transparent;
  cursor: pointer;
  transition:
    background var(--transition-interactive),
    color var(--transition-interactive),
    border-color var(--transition-interactive),
    box-shadow var(--transition-interactive),
    transform var(--transition-interactive);
  white-space: nowrap;
  text-decoration: none;
}

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

/* Primary button */
.btn--primary {
  background: var(--color-primary);
  color: #fff;
  border-color: var(--color-primary);
}
.btn--primary:hover {
  background: var(--color-primary-bright);
  border-color: var(--color-primary-bright);
  box-shadow: var(--shadow-blue);
}

/* Ghost button */
.btn--ghost {
  background: transparent;
  color: var(--color-text);
  border-color: var(--color-border);
}
.btn--ghost:hover {
  background: var(--glass-hover);
  border-color: var(--color-border);
  color: var(--color-text);
}

/* Outline blue */
.btn--outline {
  background: transparent;
  color: var(--color-primary-bright);
  border-color: var(--color-primary);
}
.btn--outline:hover {
  background: var(--color-primary-glow);
  box-shadow: var(--shadow-blue);
}

/* Large button */
.btn--lg {
  padding: 1rem 2rem;
  font-size: var(--text-base);
  border-radius: var(--radius-lg);
}

/* ===== CARD SYSTEM ===== */
.card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-xl);
  padding: var(--space-8);
  transition:
    border-color var(--transition-interactive),
    box-shadow var(--transition-interactive),
    transform var(--transition-interactive),
    background var(--transition-interactive);
}

.card--glass {
  background: var(--glass-bg);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--glass-border);
}

.card--interactive {
  cursor: pointer;
}

.card--interactive:hover {
  border-color: var(--color-primary);
  box-shadow: var(--shadow-blue);
  transform: translateY(-3px);
  background: var(--color-surface-2);
}

/* ===== BADGE ===== */
.badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: 0.25rem 0.75rem;
  font-size: var(--text-xs);
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  border-radius: var(--radius-full);
  border: 1px solid;
}

.badge--blue {
  background: var(--color-primary-glow);
  border-color: rgba(37,99,235,0.25);
  color: var(--color-primary-bright);
}

.badge--subtle {
  background: var(--glass-hover);
  border-color: var(--color-border);
  color: var(--color-text-muted);
}

/* ===== GRID UTILITIES ===== */
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: var(--space-6); }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--space-6); }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--space-6); }

@media (max-width: 1024px) {
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 768px) {
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
}

/* ===== SECTION HEADING PATTERN ===== */
.section-label {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--color-primary-bright);
  margin-bottom: var(--space-4);
}

.section-label::before {
  content: '';
  display: inline-block;
  width: 20px;
  height: 2px;
  background: var(--color-primary);
  border-radius: 2px;
}

/* ===== DIVIDER ===== */
.divider {
  border: none;
  border-top: 1px solid var(--color-border-subtle);
  margin-block: var(--space-1);
}

/* ===== GLOW DOT DECORATION ===== */
.glow-dot {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  pointer-events: none;
  opacity: 0.4;
}

/* ===== ICON WRAPPER ===== */
.icon-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  border-radius: var(--radius-lg);
  background: var(--color-primary-glow);
  border: 1px solid rgba(37,99,235,0.2);
  color: var(--color-primary-bright);
  flex-shrink: 0;
}

/* ===== SCROLL ANIMATIONS ===== */
.fade-in {
  opacity: 1;
}

@supports (animation-timeline: scroll()) {
  .fade-in {
    opacity: 0;
    animation: reveal-fade linear both;
    animation-timeline: view();
    animation-range: entry 0% entry 60%;
  }
}

@keyframes reveal-fade {
  to { opacity: 1; }
}

.slide-up {
  opacity: 1;
}

@supports (animation-timeline: scroll()) {
  .slide-up {
    opacity: 0;
    clip-path: inset(20px 0 0 0);
    animation: reveal-up linear both;
    animation-timeline: view();
    animation-range: entry 0% entry 65%;
  }
}

@keyframes reveal-up {
  to {
    opacity: 1;
    clip-path: inset(0 0 0 0);
  }
}

/* Stagger delays */
.stagger-1 { animation-delay: 0.05s; }
.stagger-2 { animation-delay: 0.1s; }
.stagger-3 { animation-delay: 0.15s; }
.stagger-4 { animation-delay: 0.2s; }

/* ===== PAGE TRANSITION ===== */
@view-transition { navigation: auto; }
::view-transition-old(root) { animation: fade-out 0.2s var(--ease-in); }
::view-transition-new(root) { animation: fade-in-vt 0.3s var(--ease-out); }
@keyframes fade-out { to { opacity: 0; } }
@keyframes fade-in-vt { from { opacity: 0; } }
