/* ══════════════════════════════════════════════════════════════════
   SOVEREIGN GRID — Shared Components
   Reusable UI components used across all ecosystem sites.
   Import AFTER tokens.css.

   Components:
   1. Utility classes (.gradient-text, .badge, .sov-section)
   2. Navigation (.sg-nav)
   3. Buttons (.sg-btn)
   4. Cards (.sg-card)
   5. Grid system (.sg-grid)
   6. Footer (.sg-footer)
   7. Forms (.sg-form)
   8. Scroll reveal (.sg-reveal)
   9. Status indicators (.sg-status)
   ═══════════════════════════════════════════════════════════════ */

/* ══════════════ 1. UTILITIES ══════════════ */

.gradient-text {
  background: linear-gradient(135deg, var(--color-accent), hsl(180, 60%, 55%));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.badge {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  letter-spacing: var(--tracking-wider);
  text-transform: uppercase;
  color: var(--color-accent);
  background: var(--color-accent-soft);
  padding: 0.3em 1em;
  border-radius: var(--radius-full);
  border: 1px solid hsla(152, 68%, 48%, 0.2);
}

.sov-section {
  max-width: var(--content-max);
  margin: 0 auto;
  padding: var(--space-20) var(--space-8);
}

.section-header {
  text-align: center;
  margin-bottom: var(--space-12);
}

.section-header h2 {
  font-size: clamp(var(--text-3xl), 3.5vw, var(--text-4xl));
  font-weight: var(--weight-bold);
  margin: var(--space-3) 0;
}

.section-sub {
  font-size: var(--text-lg);
  color: var(--color-text-secondary);
  max-width: 48ch;
  margin: 0 auto;
  line-height: var(--leading-relaxed);
}

.sov-divider {
  border: none;
  height: 1px;
  background: var(--color-border);
  max-width: var(--content-max);
  margin: 0 auto;
}

/* ══════════════ 2. NAVIGATION ══════════════ */

.sg-nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: var(--z-nav);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-4) var(--space-8);
  background: transparent;
  transition: background var(--dur-normal) var(--ease-out),
              box-shadow var(--dur-normal) var(--ease-out);
}

.sg-nav--scrolled {
  background: hsla(220, 22%, 7%, 0.92);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  box-shadow: 0 1px 0 var(--color-border);
}

.sg-nav__brand {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.sg-nav__icon {
  font-size: 1.2rem;
  color: var(--color-accent);
}

.sg-nav__wordmark {
  font-weight: var(--weight-bold);
  font-size: 1.1rem;
  letter-spacing: -0.02em;
}

.sg-nav__tag {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  color: var(--color-text-tertiary);
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
  padding: 0.2em 0.6em;
  background: var(--color-surface-2);
  border-radius: var(--radius-full);
  border: 1px solid var(--color-border);
}

.sg-nav__links {
  display: flex;
  align-items: center;
  gap: var(--space-6);
}

.sg-nav__link {
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  color: var(--color-text-secondary);
  transition: color var(--dur-fast) var(--ease-out);
}

.sg-nav__link:hover {
  color: var(--color-text-primary);
}

.sg-nav__cta {
  color: var(--color-text-inverse);
  background: var(--color-accent);
  padding: 0.45em 1.2em;
  border-radius: var(--radius-sm);
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
  transition: transform var(--dur-fast) var(--ease-out),
              box-shadow var(--dur-fast) var(--ease-out);
}

.sg-nav__cta:hover {
  color: var(--color-text-inverse);
  transform: translateY(-1px);
  box-shadow: var(--shadow-glow);
}

.sg-nav__toggle {
  display: none;
  background: none;
  border: none;
  color: var(--color-text-primary);
  font-size: 1.5rem;
  cursor: pointer;
}

/* ══════════════ 3. BUTTONS ══════════════ */

.sg-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: 0.65em 1.5em;
  font-family: var(--font-sans);
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all var(--dur-normal) var(--ease-out);
  text-decoration: none;
  white-space: nowrap;
}

.sg-btn--primary {
  background: var(--color-accent);
  color: var(--color-text-inverse);
  border-color: var(--color-accent);
}

.sg-btn--primary:hover {
  background: var(--color-accent-hover);
  transform: translateY(-1px);
  box-shadow: var(--shadow-glow);
}

.sg-btn--outline {
  background: transparent;
  color: var(--color-text-primary);
  border-color: var(--color-border);
}

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

.sg-btn--ghost {
  background: transparent;
  color: var(--color-text-secondary);
  border-color: transparent;
}

.sg-btn--ghost:hover {
  color: var(--color-text-primary);
  background: var(--color-surface-2);
}

.sg-btn--lg {
  padding: 0.85em 2em;
  font-size: var(--text-base);
}

.sg-btn--full {
  width: 100%;
}

/* ══════════════ 4. CARDS ══════════════ */

.sg-card {
  background: var(--color-surface-1);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-6);
  transition: transform var(--dur-normal) var(--ease-out),
              border-color var(--dur-normal) var(--ease-out),
              box-shadow var(--dur-normal) var(--ease-out);
}

.sg-card:hover {
  border-color: var(--color-border-hover);
  transform: translateY(-3px);
  box-shadow: var(--shadow-glow);
}

.sg-card--featured {
  border-color: var(--color-accent-strong);
  background: linear-gradient(135deg, var(--color-surface-1), hsla(152, 68%, 48%, 0.04));
}

.sg-card--flat {
  background: var(--color-surface-1);
}

.sg-card--flat:hover {
  transform: none;
  box-shadow: none;
}

/* ══════════════ 5. GRID SYSTEM ══════════════ */

.sg-grid {
  display: grid;
  gap: var(--space-5);
}

.sg-grid--2 {
  grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
}

.sg-grid--3 {
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
}

.sg-grid--4 {
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
}

/* ══════════════ 6. FOOTER ══════════════ */

.sg-footer {
  border-top: 1px solid var(--color-border);
  padding: var(--space-12) var(--space-8) var(--space-8);
}

.sg-footer__inner {
  max-width: var(--content-max);
  margin: 0 auto;
}

.sg-footer__grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: var(--space-8);
  margin-bottom: var(--space-8);
}

.sg-footer__logo {
  font-weight: var(--weight-bold);
  font-size: 1.1rem;
  margin-bottom: var(--space-3);
  color: var(--color-accent);
}

.sg-footer__tagline {
  font-size: var(--text-sm);
  color: var(--color-text-tertiary);
  max-width: 30ch;
  line-height: var(--leading-relaxed);
}

.sg-footer__col-title {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  letter-spacing: var(--tracking-wider);
  text-transform: uppercase;
  color: var(--color-text-tertiary);
  margin-bottom: var(--space-3);
}

.sg-footer__links li {
  margin-bottom: var(--space-2);
}

.sg-footer__links a {
  font-size: var(--text-sm);
  color: var(--color-text-secondary);
  transition: color var(--dur-fast) var(--ease-out);
}

.sg-footer__links a:hover {
  color: var(--color-text-primary);
}

.sg-footer__links a[aria-current="page"] {
  color: var(--color-accent);
}

.sg-footer__bottom {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: var(--space-6);
  border-top: 1px solid var(--color-border);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--color-text-tertiary);
}

.sg-footer__bottom a {
  color: var(--color-text-tertiary);
  transition: color var(--dur-fast) var(--ease-out);
}

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

/* ══════════════ 7. FORMS ══════════════ */

.sg-input {
  width: 100%;
  padding: 0.75rem 1rem;
  background: var(--color-surface-3);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  color: var(--color-text-primary);
  font-family: var(--font-sans);
  font-size: var(--text-sm);
  outline: none;
  transition: border-color var(--dur-fast) var(--ease-out);
}

.sg-input::placeholder {
  color: var(--color-text-tertiary);
}

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

.sg-form-row {
  display: flex;
  gap: var(--space-3);
}

/* ══════════════ 8. SCROLL REVEAL ══════════════ */

.sg-reveal-target {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity var(--dur-reveal) var(--ease-out),
              transform var(--dur-reveal) var(--ease-out);
}

.sg-revealed {
  opacity: 1;
  transform: translateY(0);
}

/* Staggered reveal for grid children */
.sg-grid > .sg-reveal-target:nth-child(1) { transition-delay: 0s; }
.sg-grid > .sg-reveal-target:nth-child(2) { transition-delay: 0.08s; }
.sg-grid > .sg-reveal-target:nth-child(3) { transition-delay: 0.16s; }
.sg-grid > .sg-reveal-target:nth-child(4) { transition-delay: 0.24s; }
.sg-grid > .sg-reveal-target:nth-child(5) { transition-delay: 0.32s; }
.sg-grid > .sg-reveal-target:nth-child(6) { transition-delay: 0.40s; }

/* ══════════════ 9. STATUS INDICATORS ══════════════ */

.sg-status {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
  padding: 0.25em 0.75em;
  border-radius: var(--radius-full);
}

.sg-status--active {
  color: var(--color-success);
  background: var(--color-success-soft);
  border: 1px solid hsla(152, 68%, 42%, 0.2);
}

.sg-status--pending {
  color: var(--color-warning);
  background: var(--color-warning-soft);
  border: 1px solid hsla(38, 80%, 55%, 0.2);
}

.sg-status--offline {
  color: var(--color-danger);
  background: var(--color-danger-soft);
  border: 1px solid hsla(350, 80%, 55%, 0.2);
}

.sg-status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: currentColor;
  animation: sg-pulse 2s ease-in-out infinite;
}

@keyframes sg-pulse {
  0%, 100% { opacity: 1; box-shadow: 0 0 0 0 currentColor; }
  50% { opacity: 0.7; box-shadow: 0 0 0 6px transparent; }
}

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

@media (max-width: 768px) {
  .sg-nav { padding: var(--space-3) var(--space-4); }
  .sg-nav__links { display: none; }
  .sg-nav__links[data-open="true"] {
    display: flex;
    flex-direction: column;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--color-surface-1);
    border-bottom: 1px solid var(--color-border);
    padding: var(--space-4);
    gap: var(--space-3);
  }
  .sg-nav__toggle { display: block; }
  .sg-nav__tag { display: none; }

  .sov-section { padding: var(--space-12) var(--space-4); }
  .section-header h2 { font-size: var(--text-2xl); }

  .sg-footer__grid { grid-template-columns: 1fr; gap: var(--space-6); }
  .sg-footer__bottom { flex-direction: column; gap: var(--space-3); text-align: center; }

  .sg-form-row { flex-direction: column; }
  .sg-grid--2, .sg-grid--3, .sg-grid--4 { grid-template-columns: 1fr; }
}
