/* Spektrum Control Portal — design tokens aligned with the Spektrum Control app
   (Next.js + Tailwind + shadcn). Pure static HTML/CSS, no build step. */

:root {
  /* Brand — exact match with software/web/src/app/globals.css :root */
  --zop-primary: #1E3A5F;          /* Deep Navy */
  --zop-primary-hover: #18324f;
  --zop-accent: #D97706;           /* Warm Amber */
  --zop-accent-hover: #b9650a;
  --zop-success: #059669;
  --zop-destructive: #DC2626;
  --zop-warning: #D97706;
  --zop-info: #1E3A5F;

  --background: #FFFFFF;
  --foreground: #111827;
  --card: #FFFFFF;
  --surface: #F8F9FB;
  --muted: #4B5563;
  --muted-foreground: #6B7280;
  --border: #E5E7EB;
  --border-strong: #D1D5DB;

  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.05);
  --shadow-md: 0 4px 12px rgba(15, 23, 42, 0.08);
  --shadow-lg: 0 14px 32px rgba(15, 23, 42, 0.12);

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-xl: 20px;

  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;

  --topbar-height: 56px;
  --container-max: 1120px;
}

[data-theme="dark"] {
  --zop-primary: #2A4F7A;          /* Navy lightened */
  --zop-primary-hover: #355c8c;
  --zop-accent: #D97706;
  --zop-accent-hover: #b9650a;
  --zop-success: #34D399;
  --zop-destructive: #E53E3E;
  --zop-info: #D97706;

  --background: #0F1419;
  --foreground: #E6EDF3;
  --card: #161B22;
  --surface: #1C2129;
  --muted: #8B949E;
  --muted-foreground: #6B7280;
  --border: #30363D;
  --border-strong: #4B5563;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 14px 32px rgba(0, 0, 0, 0.55);
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.6;
  color: var(--foreground);
  background: var(--background);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  position: relative;
  overflow-x: hidden;
}

/* Base link styling — wrapped in :where() to drop specificity to 0,0,0 so
   any class-based color rule (.cta-primary, .topbar-brand, .legal-row a, etc.)
   wins automatically. Without :where(), `[data-theme="dark"] a` (spec 0,1,1)
   would override `.cta-primary` color (spec 0,1,0), painting button text amber
   on amber background → invisible. */
:where(a) {
  color: var(--zop-primary);
  text-decoration: none;
  transition: color 0.15s ease;
}
:where([data-theme="dark"]) :where(a) { color: var(--zop-accent); }
:where(a):hover { color: var(--zop-primary-hover); text-decoration: underline; }
:where([data-theme="dark"]) :where(a):hover { color: var(--zop-accent-hover); }

/* ─── Background pattern (matches app login) ─────────────────── */
.bg-pattern {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  opacity: 0.05;
  background-image:
    radial-gradient(circle at 18% 22%, rgb(220, 38, 38) 0%, transparent 45%),
    radial-gradient(circle at 82% 78%, rgb(30, 58, 95) 0%, transparent 45%);
}
[data-theme="dark"] .bg-pattern { opacity: 0.08; }

/* ─── Topbar ─────────────────────────────────────────────────── */
.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  height: var(--topbar-height);
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: color-mix(in srgb, var(--background) 90%, transparent);
  backdrop-filter: saturate(140%) blur(8px);
  -webkit-backdrop-filter: saturate(140%) blur(8px);
  border-bottom: 1px solid var(--border);
}

.topbar-brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--foreground);
  font-weight: 700;
  letter-spacing: -0.01em;
  text-decoration: none !important;
}
.topbar-brand img {
  width: 32px; height: 32px;
  border-radius: 8px;
  object-fit: contain;
}
.topbar-brand-text {
  font-size: 15px;
  font-weight: 700;
}
@media (max-width: 480px) {
  .topbar-brand-text { display: none; }
}

.topbar-actions {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.topbar-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 36px;
  padding: 0 10px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--foreground);
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}
.topbar-btn:hover {
  background: var(--surface);
  border-color: var(--border-strong);
}
.topbar-btn svg {
  flex-shrink: 0;
}

/* Theme icons toggle */
.theme-icon { display: none; }
[data-theme="light"] .theme-icon-light { display: inline; }
[data-theme="dark"] .theme-icon-dark { display: inline; }

/* Locale dropdown */
.locale-wrap { position: relative; }
.locale-btn { min-width: 120px; }
.locale-current-label { font-weight: 600; }

.locale-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  width: 230px;
  max-height: 360px;
  overflow-y: auto;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  padding: 6px;
  z-index: 60;
}
.locale-menu[hidden] { display: none; }

.locale-option {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 9px 10px;
  border: none;
  background: transparent;
  color: var(--foreground);
  font-family: inherit;
  font-size: 14px;
  text-align: left;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background 0.12s ease;
}
.locale-option:hover { background: var(--surface); }
.locale-option.is-active {
  background: color-mix(in srgb, var(--zop-primary) 12%, transparent);
  color: var(--zop-primary);
  font-weight: 600;
}
[data-theme="dark"] .locale-option.is-active {
  background: color-mix(in srgb, var(--zop-accent) 18%, transparent);
  color: var(--zop-accent);
}
.locale-option .flag {
  font-size: 18px;
  line-height: 1;
}
.locale-option .label {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.locale-option .beta {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.04em;
  padding: 2px 6px;
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted);
  border: 1px solid var(--border);
}

/* ─── Hero ────────────────────────────────────────────────────── */
.hero {
  position: relative;
  z-index: 1;
  padding: 64px 24px 48px;
}
.hero-inner {
  max-width: 760px;
  margin: 0 auto;
  text-align: center;
}
.hero-logo {
  width: 96px;
  height: 96px;
  border-radius: 20px;
  margin-bottom: 24px;
  box-shadow: var(--shadow-md);
  object-fit: contain;
}
.hero-title {
  margin: 0 0 12px;
  font-size: clamp(34px, 5vw, 48px);
  font-weight: 800;
  letter-spacing: -0.025em;
  line-height: 1.1;
  color: var(--zop-primary);
}
[data-theme="dark"] .hero-title { color: var(--foreground); }
.hero-pitch {
  margin: 0 0 12px;
  font-size: clamp(17px, 2vw, 20px);
  font-weight: 500;
  color: var(--foreground);
}
.hero-sub {
  margin: 0 auto 40px;
  max-width: 580px;
  font-size: 15px;
  color: var(--muted);
}

.cta-row {
  display: flex;
  gap: 14px;
  justify-content: center;
  flex-wrap: wrap;
  max-width: 640px;
  margin: 0 auto;
}

.cta {
  display: inline-flex;
  align-items: center;
  gap: 14px;
  padding: 14px 18px;
  border-radius: var(--radius-lg);
  text-decoration: none !important;
  font-weight: 600;
  transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease, border-color 0.15s ease;
  min-width: 280px;
  flex: 1 1 280px;
  text-align: left;
}
.cta:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-lg);
}

.cta-primary {
  background: var(--zop-primary);
  color: #ffffff;
  border: 1px solid var(--zop-primary);
}
.cta-primary:hover {
  background: var(--zop-primary-hover);
  border-color: var(--zop-primary-hover);
  color: #ffffff !important;
}
[data-theme="dark"] .cta-primary {
  background: var(--zop-accent);
  border-color: var(--zop-accent);
  color: #1A0F03;  /* deep warm dark — 10:1 contrast on #D97706 amber (WCAG AAA) */
}
[data-theme="dark"] .cta-primary:hover {
  background: var(--zop-accent-hover);
  border-color: var(--zop-accent-hover);
  color: #1A0F03 !important;  /* override :where(a):hover */
}

.cta-secondary {
  background: var(--card);
  color: var(--foreground);
  border: 1px solid var(--border-strong);
}
.cta-secondary:hover {
  background: var(--surface);
  color: var(--foreground) !important;
}

.cta-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  flex-shrink: 0;
  background: color-mix(in srgb, currentColor 18%, transparent);
}
.cta-content {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
  min-width: 0;
}
.cta-label {
  font-size: 15px;
  font-weight: 700;
  line-height: 1.2;
}
.cta-host {
  font-size: 11px;
  opacity: 0.75;
  font-weight: 500;
  letter-spacing: 0.01em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 100%;
}
.cta-arrow {
  font-size: 18px;
  opacity: 0.6;
  flex-shrink: 0;
}

/* ─── Features ───────────────────────────────────────────────── */
.features {
  position: relative;
  z-index: 1;
  padding: 64px 24px;
  background: var(--surface);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}
.features-inner {
  max-width: var(--container-max);
  margin: 0 auto;
}
.features-heading {
  margin: 0 0 36px;
  font-size: clamp(22px, 3vw, 28px);
  font-weight: 700;
  letter-spacing: -0.02em;
  text-align: center;
  color: var(--foreground);
}

.feature-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 20px;
}

.feature-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow-sm);
  transition: box-shadow 0.15s ease, border-color 0.15s ease, transform 0.15s ease;
}
.feature-card:hover {
  box-shadow: var(--shadow-md);
  border-color: var(--border-strong);
  transform: translateY(-2px);
}

.feature-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  background: color-mix(in srgb, var(--zop-primary) 12%, transparent);
  color: var(--zop-primary);
  margin-bottom: 16px;
}
[data-theme="dark"] .feature-icon {
  background: color-mix(in srgb, var(--zop-accent) 18%, transparent);
  color: var(--zop-accent);
}

.feature-title {
  margin: 0 0 8px;
  font-size: 17px;
  font-weight: 700;
  color: var(--foreground);
  letter-spacing: -0.01em;
}
.feature-body {
  margin: 0;
  font-size: 14px;
  color: var(--muted);
  line-height: 1.6;
}

/* ─── Trust ──────────────────────────────────────────────────── */
.trust {
  position: relative;
  z-index: 1;
  padding: 48px 24px;
}
.trust-inner {
  max-width: 760px;
  margin: 0 auto;
  text-align: center;
}
.trust-line {
  margin: 0;
  font-size: 15px;
  color: var(--muted);
  font-style: italic;
}

/* ─── Footer ─────────────────────────────────────────────────── */
.footer {
  position: relative;
  z-index: 1;
  padding: 32px 24px;
  border-top: 1px solid var(--border);
  background: var(--surface);
}
.footer-inner {
  max-width: var(--container-max);
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-items: center;
  text-align: center;
}

.legal-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  font-size: 13px;
}
.legal-row a {
  color: var(--muted);
}
.legal-row a:hover { color: var(--foreground); }
.legal-row span[aria-hidden="true"] {
  color: var(--border-strong);
}

.footer-owner {
  margin: 0;
  font-size: 13px;
  color: var(--muted);
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: center;
}
.footer-sep { color: var(--border-strong); }

/* ─── Focus visibility ───────────────────────────────────────── */
:focus-visible {
  outline: 2px solid var(--zop-primary);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}
[data-theme="dark"] :focus-visible { outline-color: var(--zop-accent); }

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