/**
 * CrowdControl — shared design tokens & component styles
 * Used by: index.html, guide.html, privacy.html
 *
 * Token strategy: dark-first.
 * Bare :root defines the dark palette.
 * @media (prefers-color-scheme: light) guards :root:not([data-theme="dark"]).
 * [data-theme="dark"] overrides to restore dark regardless of OS setting.
 */

/* ── Brand constants (same in any theme) ── */
:root {
  --cc-cyan:    #1cfff7;
  --cc-magenta: #ff42e0;
  --cc-lime:    #93e200;
  --cc-amber:   #f5a623;
  --cc-white:   #f3f3f3;
  --cc-dark:    #0a0a14;

  /* Wordmark weight tokens */
  --wm-light:   200;
  --wm-bold:    800;
  --wm-spacing-light: 0.18em;
  --wm-spacing-bold: -0.03em;
}

/* ── Dark palette (default) ── */
:root {
  --bg:           #0a0a14;
  --bg-surface:   #10101e;
  --bg-card:      #14142a;
  --border:       #1e1e38;
  --border-faint: #161628;
  --text-primary: #f3f3f3;
  --text-secondary: #9898b8;
  --text-muted:   #5a5a7a;
  --accent:       #1cfff7;
  --accent-dim:   rgba(28, 255, 247, 0.12);
  --nav-bg:       rgba(10, 10, 20, 0.85);
}

/* ── Light overrides ── */
/* Accent shifts from cyan to deep magenta in light mode — cyan is invisible on white */
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    --cc-cyan:      #c80090;  /* override brand const — magenta reads on light */
    --bg:           #f5f5fb;
    --bg-surface:   #ffffff;
    --bg-card:      #eeeef8;
    --border:       #d8d8ee;
    --border-faint: #ebebf5;
    --text-primary: #12121e;
    --text-secondary: #44446a;
    --text-muted:   #8888aa;
    --accent:       #c80090;
    --accent-dim:   rgba(200, 0, 144, 0.10);
    --nav-bg:       rgba(245, 245, 251, 0.92);
  }
}

/* ── Explicit dark theme override ── */
:root[data-theme="dark"] {
  --bg:           #0a0a14;
  --bg-surface:   #10101e;
  --bg-card:      #14142a;
  --border:       #1e1e38;
  --border-faint: #161628;
  --text-primary: #f3f3f3;
  --text-secondary: #9898b8;
  --text-muted:   #5a5a7a;
  --accent:       #1cfff7;
  --accent-dim:   rgba(28, 255, 247, 0.12);
  --nav-bg:       rgba(10, 10, 20, 0.85);
}

/* ── Explicit light theme override ── */
:root[data-theme="light"] {
  --cc-cyan:      #c80090;
  --bg:           #f5f5fb;
  --bg-surface:   #ffffff;
  --bg-card:      #eeeef8;
  --border:       #d8d8ee;
  --border-faint: #ebebf5;
  --text-primary: #12121e;
  --text-secondary: #44446a;
  --text-muted:   #8888aa;
  --accent:       #c80090;
  --accent-dim:   rgba(200, 0, 144, 0.10);
  --nav-bg:       rgba(245, 245, 251, 0.92);
}

/* ── Logo mark container ── */
.cc-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  line-height: 0;
}

/* ── Wordmark ── */
.cc-wordmark {
  display: inline-flex;
  align-items: baseline;
  line-height: 1;
  letter-spacing: 0;
  font-family: inherit;
}

.cc-wordmark .crowd {
  font-weight: var(--wm-light);
  letter-spacing: var(--wm-spacing-light);
  color: var(--cc-cyan);
  text-transform: uppercase;
}

.cc-wordmark .control {
  font-weight: var(--wm-bold);
  letter-spacing: var(--wm-spacing-bold);
  color: var(--text-primary);
  text-transform: uppercase;
}

/* ── cc-header (shared top nav) ── */
cc-header {
  display: block;
}

.cc-header-inner {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0 clamp(1.5rem, 5vw, 4rem);
  height: 60px;
  background: var(--bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-faint);
}

.cc-nav-logo {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  text-decoration: none;
  color: inherit;
  flex-shrink: 0;
}

.cc-nav-links {
  display: flex;
  align-items: center;
  gap: 1.75rem;
  list-style: none;
  margin: 0;
  padding: 0;
  flex: 1;
  justify-content: flex-end;
}

.cc-nav-links a {
  font-size: 0.875rem;
  color: var(--text-secondary);
  text-decoration: none;
  transition: color 0.15s;
}

.cc-nav-links a:hover { color: var(--text-primary); text-decoration: none; }

.cc-nav-links a[aria-current="page"] {
  color: var(--accent);
}

.cc-header-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-shrink: 0;
}

.cc-nav-cta {
  display: inline-flex;
  align-items: center;
  background: var(--accent);
  color: var(--bg);
  font-size: 0.8rem;
  font-weight: 700;
  padding: 0.45rem 1.1rem;
  border-radius: 100px;
  text-decoration: none;
  white-space: nowrap;
  transition: opacity 0.12s;
}

.cc-nav-cta:hover { opacity: 0.85; text-decoration: none; }

/* ── Hamburger button (hidden on desktop) ── */
.cc-hamburger {
  display: none;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  background: none;
  border: none;
  border-radius: 6px;
  color: var(--text-primary);
  cursor: pointer;
  padding: 0;
  flex-shrink: 0;
  transition: background 0.12s;
}
.cc-hamburger:hover { background: var(--surface); }
.cc-hamburger:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ── Mobile slide-down menu (hidden by default) ── */
.cc-mobile-menu {
  display: none;
  position: fixed;
  top: 60px;
  left: 0;
  right: 0;
  z-index: 99;
  background: var(--bg);
  border-bottom: 1px solid var(--border-faint);
  padding: 0.75rem 0 1rem;
  flex-direction: column;
}
.cc-mobile-menu--open { display: flex; }

.cc-mobile-links {
  list-style: none;
  margin: 0;
  padding: 0 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0;
}
.cc-mobile-links li a {
  display: block;
  padding: 0.7rem 0;
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--text-secondary);
  text-decoration: none;
  border-bottom: 1px solid var(--border-faint);
  transition: color 0.12s;
}
.cc-mobile-links li:last-child a { border-bottom: none; }
.cc-mobile-links li a:hover { color: var(--text-primary); }
.cc-mobile-links li a[aria-current="page"] { color: var(--accent); }

.cc-mobile-cta-wrap {
  padding: 1rem 1.25rem 0;
}
.cc-mobile-cta-wrap .cc-nav-cta {
  display: inline-flex;
  width: auto;
}

@media (max-width: 760px) {
  .cc-nav-links { display: none; }
  .cc-nav-cta   { display: none; }
  .cc-hamburger  { display: inline-flex; }
}

/* ── cc-footer web component ── */
cc-footer {
  display: block;
}

.cc-footer-inner {
  border-top: 1px solid var(--border);
  padding: 2.5rem 2rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1.5rem 2.5rem;
  background: var(--bg);
}

.cc-footer-brand {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  text-decoration: none;
  color: inherit;
  flex-shrink: 0;
}

.cc-footer-brand .cc-wordmark {
  font-size: 0.95rem;
}

.cc-footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1.25rem;
  list-style: none;
  margin: 0;
  padding: 0;
  flex: 1;
}

.cc-footer-links a {
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 0.825rem;
  transition: color 0.15s;
}

.cc-footer-links a:hover {
  color: var(--accent);
}

.cc-footer-copy {
  color: var(--text-muted);
  font-size: 0.75rem;
  white-space: nowrap;
  margin-left: auto;
}

@media (max-width: 600px) {
  .cc-footer-inner {
    flex-direction: column;
    align-items: flex-start;
    gap: 1rem;
    padding: 2rem 1.25rem;
  }

  .cc-footer-copy {
    margin-left: 0;
  }
}

/* ── Theme toggle button ── */
cc-theme-toggle {
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
}

.cc-theme-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
  line-height: 0;
}

.cc-theme-btn:hover {
  color: var(--accent);
  border-color: var(--accent);
  background: var(--accent-dim);
}

.cc-theme-btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
