/* Shared theme tokens + toggle — landing & API reference */
@import url('./brand-tokens.css');

:root {
  --header-bg: rgba(247, 249, 252, 0.92);
  --header-bg-scrolled: rgba(247, 249, 252, 0.98);
  --header-border: var(--brand-line);
  --nav-link-hover-bg: transparent;
  --hero-gradient-top: var(--brand-surface);
  --hero-wash-top: #ffffff;
  --hero-wash-purple: rgba(124, 108, 255, 0.07);
  --hero-wash-blue: rgba(76, 201, 240, 0.05);
  --hero-glow-lavender: rgba(124, 108, 255, 0.1);
  --hero-glow-blue: rgba(37, 99, 235, 0.07);
  --hero-dot-color: rgba(91, 77, 255, 0.1);
  --hero-dot-opacity: 0.35;
  --hero-ribbon-opacity: 0.48;
  --hero-ribbon-br-opacity: 0.32;
  --card-icon-bg: var(--brand-surface);
  --grid-line: transparent;
  --link: var(--brand-secondary);
  --link-hover: var(--brand-secondary-hover);
}

[data-theme="dark"] {
  color-scheme: dark;

  --bg: var(--brand-bg);
  --surface: var(--brand-surface);
  --surface-elevated: #1a2347;
  --ink: var(--brand-ink);
  --ink-soft: var(--brand-ink-soft);
  --ink-muted: var(--brand-ink-muted);
  --line: var(--brand-line);
  --line-strong: rgba(255, 255, 255, 0.18);

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow: 0 4px 12px rgba(0, 0, 0, 0.35);
  --shadow-lg: 0 16px 40px rgba(0, 0, 0, 0.45);

  --header-bg: var(--brand-logo-dark-bg);
  --header-bg-scrolled: var(--brand-logo-dark-bg);
  --header-border: var(--brand-line);
  --nav-link-hover-bg: transparent;
  --hero-gradient-top: #0f1640;
  --hero-wash-top: #0c1234;
  --hero-wash-purple: rgba(124, 108, 255, 0.12);
  --hero-wash-blue: rgba(76, 201, 240, 0.06);
  --hero-glow-lavender: rgba(124, 108, 255, 0.14);
  --hero-glow-blue: rgba(37, 99, 235, 0.1);
  --hero-dot-color: rgba(180, 170, 255, 0.14);
  --hero-dot-opacity: 0.28;
  --hero-ribbon-opacity: 0.42;
  --hero-ribbon-br-opacity: 0.28;
  --card-icon-bg: #1a2347;
  --grid-line: transparent;
  --link: var(--brand-accent-ai);
  --link-hover: #7dd8f5;
}

/* ——— Theme toggle ——— */
.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.375rem;
  height: 2.375rem;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  color: var(--ink-soft);
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.2s, color 0.2s, border-color 0.2s, box-shadow 0.2s;
}

.theme-toggle:hover {
  color: var(--ink);
  border-color: var(--line-strong, var(--line));
  box-shadow: var(--shadow-sm, var(--shadow-xs));
}

.theme-toggle:focus-visible {
  outline: none;
  box-shadow: var(--brand-focus-ring);
}

.theme-toggle svg {
  width: 1.1rem;
  height: 1.1rem;
}

.theme-toggle__moon {
  display: none;
}

[data-theme="dark"] .theme-toggle__sun {
  display: none;
}

[data-theme="dark"] .theme-toggle__moon {
  display: block;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  flex-shrink: 0;
  margin-left: auto;
  padding: 0.25rem 0.25rem 0.25rem 0.875rem;
  border-left: 1px solid var(--header-border);
}

.public-lang-switch,
.api-lang-switch {
  display: inline-flex;
  border: 1px solid var(--line, var(--brand-line));
  border-radius: 10px;
  overflow: hidden;
  background: var(--card-bg, var(--brand-bg));
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: var(--shadow-sm, 0 1px 2px rgba(11, 18, 56, 0.05));
}

.public-lang-btn,
.api-lang-btn {
  min-width: 2.25rem;
  padding: 0.4rem 0.7rem;
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  border: none;
  background: transparent;
  color: var(--ink-muted);
  cursor: pointer;
  font-family: inherit;
  transition: color 0.2s, background 0.2s;
}

.public-lang-btn:hover:not(.is-active),
.api-lang-btn:hover:not(.is-active) {
  color: var(--brand-primary);
}

.public-lang-btn.is-active:hover,
.api-lang-btn.is-active:hover {
  color: #fff;
}

.public-lang-btn.is-active,
.api-lang-btn.is-active {
  background: var(--brand-primary);
  color: #fff;
}

@media (max-width: 960px) {
  .header-end {
    order: 2;
    margin-left: auto;
  }

  .nav-toggle-btn {
    order: 3;
  }
}

/* ——— Theme-aware logos (solo uno visible) ——— */
.site-header .logo .theme-logo__light,
.footer-brand .theme-logo__light,
.api-header__brand .theme-logo__light {
  display: block;
}

.site-header .logo .theme-logo__dark,
.footer-brand .theme-logo__dark,
.api-header__brand .theme-logo__dark {
  display: none;
}

[data-theme="dark"] .site-header .logo .theme-logo__light,
[data-theme="dark"] .footer-brand .theme-logo__light,
[data-theme="dark"] .api-header__brand .theme-logo__light {
  display: none;
}

[data-theme="dark"] .site-header .logo .theme-logo__dark,
[data-theme="dark"] .footer-brand .theme-logo__dark,
[data-theme="dark"] .api-header__brand .theme-logo__dark {
  display: block;
}
