/* ============================================================
   ColorCube — Design System
   Themes: light (default), dark, vivid, neon
   Type: Space Grotesk (display) / Inter (body) / DM Mono (data)
         Compacta LT Std Light (logo + home hero title)
   Signature: spectral gradient line runs through the header
   ============================================================ */

@font-face {
  font-family: 'Compacta LT Std';
  src: url('compacta-lt-std-light.otf') format('opentype');
  font-weight: 300;
  font-style: normal;
  font-display: swap;
}

/* ── Light theme (default) ───────────────────────────────────── */
:root {
  --bg:          #eeeeee;
  --surface:     #e0e0e0;
  --surface2:    #d4d4d4;
  --border:      #bbbbbb;
  --text:        #1a1a22;
  --text-muted:  #666677;
  --accent-r:    #cc1111;
  --accent-g:    #007733;
  --accent-b:    #1155cc;
  --accent-y:    #aa8800;
  --accent-m:    #aa0077;
  --accent-c:    #007799;
  --white:       #111118;
  --hero-title:  #111118;

  --font-display:  'Space Grotesk', sans-serif;
  --font-body:     'Inter', sans-serif;
  --font-mono:     'DM Mono', monospace;
  --font-compacta: 'Compacta LT Std', sans-serif;

  --radius:   6px;
  --radius-l: 12px;
  --gap:      1.5rem;
  --max-w:    860px;
  --nav-h:    60px;
  --trans:    0.2s ease;
}

/* ── Dark theme ──────────────────────────────────────────────── */
[data-theme="dark"] {
  --bg:          #0f0f11;
  --surface:     #18181c;
  --surface2:    #222228;
  --border:      #2e2e38;
  --text:        #e8e8ee;
  --text-muted:  #8888a0;
  --accent-r:    #ff3c3c;
  --accent-g:    #3cff7a;
  --accent-b:    #3c8fff;
  --accent-y:    #ffe03c;
  --accent-m:    #ff3ccc;
  --accent-c:    #3cefff;
  --white:       #ffffff;
  --hero-title:  #ffffff;
}

/* ── Vivid theme — warm cream, fully saturated primaries ─────── */
/* Surfaces carry warmth; accents are pure, no grey mixed in.    */
[data-theme="vivid"] {
  --bg:          #fdf6ee;
  --surface:     #fff9f2;
  --surface2:    #ffe8cc;
  --border:      #f0a060;
  --text:        #1a0500;
  --text-muted:  #994400;
  --accent-r:    #ee0000;
  --accent-g:    #009900;
  --accent-b:    #0033ff;
  --accent-y:    #cc7700;
  --accent-m:    #cc0099;
  --accent-c:    #0088bb;
  --white:       #0d0200;
  --hero-title:  #1a0500;
}

/* ── Neon theme — deep navy base, electric neon accents ──────── */
[data-theme="neon"] {
  --bg:          #112233;
  --surface:     #162840;
  --surface2:    #1e3352;
  --border:      #2a4466;
  --text:        #ddeeff;
  --text-muted:  #7799bb;
  --accent-r:    #ff2244;
  --accent-g:    #00ff88;
  --accent-b:    #00aaff;
  --accent-y:    #ffee00;
  --accent-m:    #ff00cc;
  --accent-c:    #00ffee;
  --white:       #ffffff;
  --hero-title:  #ffffff;
}

/* ── Reset ─────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: 1.7;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  transition: background var(--trans), color var(--trans);
}
img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
button { cursor: pointer; font-family: inherit; }

/* ── Header ─────────────────────────────────────────────────── */
#site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--nav-h);
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 2rem;
  gap: 1.5rem;
  transition: background var(--trans), border-color var(--trans);
}

/* Spectral underline */
#site-header::after {
  content: '';
  position: absolute;
  bottom: 0; left: 0; right: 0;
  height: 2px;
  background: linear-gradient(
    to right,
    #ff0000, #ff7700, #ffff00, #00ff00, #0077ff, #7700ff, #ff00ff
  );
  opacity: 0.7;
}
[data-theme="neon"] #site-header::after  { height: 3px; opacity: 1; }
[data-theme="vivid"] #site-header::after { height: 3px; opacity: 1; }

.site-logo {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-shrink: 0;
}
.logo-img { height: 32px; width: auto; }
.logo-text {
  font-family: var(--font-compacta);
  font-size: 1.3rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--white);
  line-height: 1;
}

#main-nav {
  display: flex;
  gap: 0.25rem;
  flex: 1;
}
#main-nav a {
  font-size: 0.78rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-muted);
  padding: 0.4rem 0.75rem;
  border-radius: var(--radius);
  transition: color var(--trans), background var(--trans);
  white-space: nowrap;
}
#main-nav a:hover  { color: var(--text);  background: var(--surface2); }
#main-nav a.active { color: var(--white); background: var(--surface2); }

#lang-switcher { display: flex; gap: 0.2rem; flex-shrink: 0; }
.lang-btn {
  background: none;
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 0.7rem;
  font-weight: 500;
  letter-spacing: 0.06em;
  padding: 0.25rem 0.5rem;
  border-radius: var(--radius);
  transition: color var(--trans), border-color var(--trans);
}
.lang-btn:hover  { color: var(--text);  border-color: var(--text-muted); }
.lang-btn.active { color: var(--white); border-color: var(--white); }

/* ── Theme switcher — four buttons matching lang buttons ─────── */
#theme-switcher {
  display: flex;
  gap: 0.2rem;
  flex-shrink: 0;
}
.theme-btn {
  background: none;
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 0.7rem;
  font-weight: 500;
  letter-spacing: 0.06em;
  padding: 0.25rem 0.5rem;
  border-radius: var(--radius);
  transition: color var(--trans), border-color var(--trans), background var(--trans);
  white-space: nowrap;
}
.theme-btn:hover  { color: var(--text);  border-color: var(--text-muted); }
.theme-btn.active { color: var(--white); border-color: var(--white); }

[data-theme="vivid"] .theme-btn.active {
  border-color: var(--accent-m);
  color: var(--accent-m);
}
[data-theme="neon"] .theme-btn.active {
  border-color: var(--accent-c);
  color: var(--accent-c);
  text-shadow: 0 0 8px var(--accent-c);
}

#nav-toggle {
  display: none;
  background: none;
  border: none;
  color: var(--text);
  font-size: 1.4rem;
  margin-left: auto;
}

/* ── Main ────────────────────────────────────────────────────── */
#page-content {
  flex: 1;
  width: 100%;
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 3rem 2rem 4rem;
}

/* ── Footer ─────────────────────────────────────────────────── */
#site-footer {
  border-top: 1px solid var(--border);
  text-align: center;
  padding: 1.25rem 2rem;
  font-size: 0.78rem;
  color: var(--text-muted);
  transition: border-color var(--trans);
}

/* ── Typography ─────────────────────────────────────────────── */
.page-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(2rem, 5vw, 3rem);
  line-height: 1.15;
  color: var(--white);
  margin-bottom: 0.5rem;
}
.page-subtitle {
  font-size: 1.05rem;
  color: var(--text-muted);
  margin-bottom: 2.5rem;
  max-width: 560px;
}
h2 {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.35rem;
  color: var(--white);
  margin: 2.5rem 0 0.75rem;
}
h3 {
  font-size: 1rem;
  font-weight: 600;
  color: var(--white);
  margin: 1.5rem 0 0.5rem;
}
p { margin-bottom: 1rem; }
p:last-child { margin-bottom: 0; }

/* ── Cards ───────────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-l);
  padding: var(--gap);
  transition: background var(--trans), border-color var(--trans);
}
.card + .card { margin-top: 1rem; }

/* ── Spectrum bar ────────────────────────────────────────────── */
.spectrum-bar {
  width: 100%;
  height: 8px;
  border-radius: 4px;
  background: linear-gradient(
    to right,
    #ff0000, #ff7700, #ffff00, #00ff00, #0077ff, #4400ff, #8800ff
  );
  margin: 1rem 0;
}

/* ── Code ────────────────────────────────────────────────────── */
code {
  font-family: var(--font-mono);
  font-size: 0.85em;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 0.1em 0.4em;
  color: var(--accent-c);
  transition: background var(--trans), border-color var(--trans);
}

/* ── Home hero ───────────────────────────────────────────────── */
.home-hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 3rem 0 4rem;
  gap: 1.25rem;
}
.home-hero-img {
  width: min(240px, 55vw);
  filter: drop-shadow(0 0 48px rgba(80, 80, 255, 0.15));
  animation: float 6s ease-in-out infinite;
}
[data-theme="dark"] .home-hero-img {
  filter: drop-shadow(0 0 48px rgba(80, 80, 255, 0.3));
}
[data-theme="neon"] .home-hero-img {
  filter: drop-shadow(0 0 60px rgba(0, 200, 255, 0.5));
}
[data-theme="vivid"] .home-hero-img {
  filter: drop-shadow(0 0 50px rgba(220, 0, 140, 0.35));
}
@keyframes float {
  0%, 100% { transform: translateY(0); }
  50%       { transform: translateY(-10px); }
}
.home-hero-title {
  font-family: var(--font-compacta);
  font-weight: 300;
  font-size: clamp(3rem, 10vw, 5.5rem);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--hero-title);
  line-height: 1;
}
[data-theme="neon"] .home-hero-title {
  text-shadow: 0 0 30px rgba(0, 220, 255, 0.4);
}
/* Vivid hero title — spectral gradient text */
[data-theme="vivid"] .home-hero-title {
  background: linear-gradient(
    to right,
    #ee0000, #dd6600, #aaaa00, #009900, #0033ff, #8800cc
  );
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.home-hero-tagline {
  font-size: 1.05rem;
  color: var(--text-muted);
  max-width: 460px;
  line-height: 1.6;
}
.home-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 1rem;
  width: 100%;
  margin-top: 0.5rem;
}
.home-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-l);
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  transition: border-color var(--trans), transform var(--trans), background var(--trans);
  cursor: pointer;
  text-align: left;
}
.home-card:hover {
  border-color: var(--text-muted);
  transform: translateY(-2px);
}
[data-theme="neon"] .home-card:hover {
  border-color: var(--accent-c);
  box-shadow: 0 0 12px rgba(0, 255, 238, 0.15);
}
[data-theme="vivid"] .home-card:hover {
  border-color: var(--accent-m);
  box-shadow: 0 2px 16px rgba(204, 0, 153, 0.15);
}
.home-card-icon { font-size: 1.4rem; line-height: 1; }
.home-card-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.92rem;
  color: var(--white);
}
.home-card-desc {
  font-size: 0.8rem;
  color: var(--text-muted);
  line-height: 1.5;
  margin: 0;
}

/* ── Responsive ──────────────────────────────────────────────── */
@media (max-width: 700px) {
  #site-header { padding: 0 1rem; gap: 0.75rem; }
  #main-nav { display: none; }
  #main-nav.open {
    display: flex;
    flex-direction: column;
    position: absolute;
    top: var(--nav-h);
    left: 0; right: 0;
    background: var(--bg);
    border-bottom: 1px solid var(--border);
    padding: 1rem;
    gap: 0.25rem;
    z-index: 99;
  }
  #nav-toggle { display: block; }
  #page-content { padding: 2rem 1rem 3rem; }
}

@media (prefers-reduced-motion: reduce) {
  .home-hero-img { animation: none; }
  * { transition: none !important; }
}
