/* ========================================================
   CodeGlitch Homepage — production styles
   Shared base + three variants (Safe / Balanced / Bold)
   ======================================================== */

:root {
  --bg: #07090d;
  --bg-2: #0b0f16;
  --bg-3: #101723;
  --line: rgba(255,255,255,0.06);
  --line-2: rgba(255,255,255,0.1);
  --fg: #e8ecf2;
  --fg-2: #a6b0bf;
  --fg-3: #6b7688;
  --accent: #22d3ee;
  --accent-2: oklch(0.82 0.14 220);
  --good: #34d399;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
html, body { margin: 0; padding: 0; background: var(--bg); color: var(--fg); }
body {
  font-family: "Inter Tight", "Inter", system-ui, sans-serif;
  font-feature-settings: "ss01", "cv11";
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}
::selection { background: var(--accent); color: #001014; }
a { color: inherit; text-decoration: none; }

.mono { font-family: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace; }
.display {
  font-family: "Space Grotesk", "Inter Tight", system-ui, sans-serif;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.wrap { max-width: 1240px; margin: 0 auto; padding: 0 32px; }

/* ===== A11y: skip link ===== */
.skip-link {
  position: absolute; left: -9999px; top: 0; z-index: 999;
  background: var(--accent); color: #001014;
  padding: 10px 16px; font: 600 13px/1 "JetBrains Mono", monospace;
  letter-spacing: 0.05em; text-transform: uppercase;
}
.skip-link:focus { left: 12px; top: 12px; outline: 2px solid var(--fg); outline-offset: 2px; }

/* ===== A11y: button resets (FAQ, swatches, toggle) ===== */
.v-balanced .faq-q,
.tweaks .sw,
.tweaks .toggle {
  appearance: none; -webkit-appearance: none;
  font: inherit; color: inherit; text-align: inherit;
  background: transparent; border: 0; margin: 0;
}
.v-balanced .faq-q { width: 100%; padding: 0; cursor: pointer; }
.v-balanced .faq-q:focus-visible,
.tweaks .sw:focus-visible,
.tweaks .toggle:focus-visible,
.tweaks-toggle:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 3px;
}

/* ===== Tweaks panel ===== */
.tweaks-toggle {
  position: fixed; right: 20px; bottom: 20px; z-index: 99;
  width: 44px; height: 44px;
  border-radius: 50%;
  background: rgba(10,13,20,0.92);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid var(--line-2);
  color: var(--fg-2);
  font-size: 18px;
  cursor: pointer;
  transition: color 0.2s, border-color 0.2s, transform 0.2s;
  display: flex; align-items: center; justify-content: center;
}
.tweaks-toggle:hover { color: var(--fg); border-color: var(--fg-3); transform: rotate(45deg); }
.tweaks {
  position: fixed; right: 20px; bottom: 76px; z-index: 99;
  width: 280px;
  background: rgba(10,13,20,0.92);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--line-2);
  border-radius: 14px;
  padding: 16px;
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 11px;
  color: var(--fg-2);
  display: none;
}
.tweaks.open { display: block; }
.tweaks h4 { margin: 0 0 12px; color: var(--fg); font-size: 11px; letter-spacing: 0.15em; text-transform: uppercase; }
.tweaks .row { display: flex; align-items: center; justify-content: space-between; padding: 8px 0; border-top: 1px solid var(--line); }
.tweaks .row:first-of-type { border-top: 0; }
.tweaks label { color: var(--fg-3); }
.tweaks .swatches { display: flex; gap: 6px; }
.tweaks .sw { width: 18px; height: 18px; border-radius: 50%; border: 1px solid var(--line-2); cursor: pointer; }
.tweaks .sw.active { box-shadow: 0 0 0 2px var(--fg); }
.tweaks select {
  background: rgba(255,255,255,0.04); color: var(--fg);
  border: 1px solid var(--line-2); border-radius: 6px; padding: 4px 8px;
  font-family: inherit; font-size: 11px;
}
.tweaks .toggle { width: 36px; height: 20px; border-radius: 999px; background: rgba(255,255,255,0.08); position: relative; cursor: pointer; transition: background 0.2s; }
.tweaks .toggle::after { content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: var(--fg-3); transition: all 0.2s; }
.tweaks .toggle.on { background: var(--accent); }
.tweaks .toggle.on::after { left: 18px; background: #000; }

/* decorative helpers */
.starfield {
  position: absolute; inset: 0;
  background-image:
    radial-gradient(1px 1px at 20% 30%, rgba(34,211,238,0.4), transparent),
    radial-gradient(1px 1px at 70% 60%, rgba(255,255,255,0.2), transparent),
    radial-gradient(1px 1px at 40% 80%, rgba(34,211,238,0.3), transparent),
    radial-gradient(1px 1px at 85% 20%, rgba(255,255,255,0.15), transparent),
    radial-gradient(1px 1px at 10% 70%, rgba(34,211,238,0.25), transparent);
  pointer-events: none;
}
.grid-bg {
  position: absolute; inset: 0;
  background-image:
    linear-gradient(rgba(255,255,255,0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.025) 1px, transparent 1px);
  background-size: 64px 64px;
  pointer-events: none;
  -webkit-mask-image: radial-gradient(ellipse at 50% 30%, black 40%, transparent 80%);
  mask-image: radial-gradient(ellipse at 50% 30%, black 40%, transparent 80%);
}

/* shared labels */
.eyebrow { display: inline-flex; align-items: center; gap: 10px; color: var(--accent); font-family: "JetBrains Mono", ui-monospace, monospace; font-size: 11px; letter-spacing: 0.25em; text-transform: uppercase; }
.eyebrow::before { content: ""; width: 24px; height: 1px; background: var(--accent); }

.tag {
  display: inline-block; padding: 3px 8px;
  font-size: 10px; letter-spacing: 0.1em; text-transform: uppercase;
  border: 1px solid var(--line-2); border-radius: 4px;
  color: var(--fg-3); font-family: "JetBrains Mono", ui-monospace, monospace;
}

.live {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 8px; font-size: 10px; letter-spacing: 0.15em;
  background: rgba(52,211,153,0.1); color: var(--good);
  border: 1px solid rgba(52,211,153,0.3); border-radius: 4px;
  font-family: "JetBrains Mono", ui-monospace, monospace;
}
.live::before { content: ""; width: 5px; height: 5px; background: var(--good); border-radius: 50%; box-shadow: 0 0 6px var(--good); animation: pulse 2s infinite; }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: 0.4; } }

/* buttons */
.btn {
  display: inline-flex; align-items: center; gap: 10px;
  padding: 14px 22px;
  background: var(--fg); color: #000;
  border: 0; border-radius: 8px;
  font-weight: 600; font-size: 14px;
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s;
}
.btn:hover { transform: translateY(-1px); box-shadow: 0 8px 24px rgba(255,255,255,0.15); }
.btn.ghost { background: transparent; color: var(--fg); border: 1px solid var(--line-2); }
.btn.ghost:hover { border-color: var(--fg); background: rgba(255,255,255,0.03); box-shadow: none; }
.btn.accent { background: var(--accent); color: #001014; }
.btn.accent:hover { box-shadow: 0 8px 24px rgba(34,211,238,0.25); }

/* scrollbar */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--line-2); border-radius: 5px; }
::-webkit-scrollbar-thumb:hover { background: var(--fg-3); }

/* ============================================
   02 · BALANCED — terminal/agent dashboard
   ============================================ */
.v-balanced {
  --accent: #a3e635;
  --accent-warm: #f59e0b;
  --panel: #0c1018;
  --panel-2: #0f1420;
  background: #07090d;
  font-family: "JetBrains Mono", ui-monospace, SFMono-Regular, monospace;
  color: #d4dae3;
}
.v-balanced .display {
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-weight: 700;
  letter-spacing: -0.03em;
}

.v-balanced .topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 0;
  background: #0a0e15;
  border-bottom: 1px solid var(--line-2);
  font-size: 11px;
  padding: 0;
}
.v-balanced .topbar .tab {
  padding: 12px 18px; color: var(--fg-3);
  border-right: 1px solid var(--line-2);
  letter-spacing: 0.05em;
  cursor: pointer;
  display: flex; align-items: center; gap: 8px;
  text-decoration: none;
  transition: background 0.15s, color 0.15s;
}
.v-balanced .topbar .tab:hover { background: #07090d; color: var(--fg); }
.v-balanced .topbar .tab.active { background: #07090d; color: var(--fg); }
.v-balanced .topbar .tab .x { color: var(--fg-3); opacity: 0.5; }
.v-balanced .topbar .spacer { flex: 1; border-right: 1px solid var(--line-2); align-self: stretch; }
.v-balanced .topbar .status {
  padding: 0 18px; color: var(--fg-3);
  display: flex; align-items: center; gap: 14px;
}
.v-balanced .topbar .status .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 6px var(--accent); }

.v-balanced .hero {
  padding: 48px 0 40px;
  border-bottom: 1px dashed var(--line-2);
  position: relative;
}
.v-balanced .hero-inner { display: grid; grid-template-columns: 1.3fr 1fr; gap: 60px; }
.v-balanced .kicker { color: var(--accent); font-size: 11px; letter-spacing: 0.2em; margin-bottom: 18px; }
.v-balanced .kicker::before { content: "▸ "; }
.v-balanced .hero h1 {
  font-size: clamp(40px, 5.2vw, 76px); line-height: 1.02;
  margin: 0 0 28px; font-weight: 700; letter-spacing: -0.03em;
  color: var(--fg);
}
.v-balanced .hero h1 .hl { background: var(--accent); color: #0a0e15; padding: 0 6px; }
.v-balanced .hero h1 .cursor { display: inline-block; width: 14px; height: 1em; background: var(--accent); vertical-align: -3px; margin-left: 4px; animation: blink 1s infinite; }
.v-balanced .hero p { font-size: 14px; line-height: 1.7; color: var(--fg-2); max-width: 620px; margin: 0 0 28px; }
.v-balanced .hero-cta { display: flex; gap: 10px; flex-wrap: wrap; }
.v-balanced .btn-term {
  padding: 12px 18px; font-family: inherit; font-size: 12px;
  background: var(--accent); color: #0a0e15; border: 0;
  text-transform: uppercase; letter-spacing: 0.1em; font-weight: 600;
  cursor: pointer;
  transition: filter 0.2s;
}
.v-balanced .btn-term.ghost { background: transparent; color: var(--fg); border: 1px solid var(--line-2); }
.v-balanced .btn-term:hover { filter: brightness(1.1); }

.v-balanced .log-panel {
  background: var(--panel);
  border: 1px solid var(--line-2);
  border-radius: 0;
  font-size: 11.5px;
  line-height: 1.75;
  overflow: hidden;
  height: 100%;
  min-height: 440px;
  display: flex; flex-direction: column;
}
.v-balanced .log-head {
  padding: 10px 14px; background: #0a0e15;
  border-bottom: 1px solid var(--line-2);
  display: flex; justify-content: space-between; align-items: center;
  color: var(--fg-3); font-size: 10px; letter-spacing: 0.1em; text-transform: uppercase;
}
.v-balanced .log-head .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); display: inline-block; margin-right: 6px; animation: pulse 2s infinite; }
.v-balanced .log-body { padding: 16px 16px; overflow: hidden; flex: 1; }
.v-balanced .log-line { display: grid; grid-template-columns: 78px 60px 1fr; gap: 10px; padding: 2px 0; }
.v-balanced .log-line .t { color: var(--fg-3); }
.v-balanced .log-line .lvl-info { color: #60a5fa; }
.v-balanced .log-line .lvl-ok { color: var(--accent); }
.v-balanced .log-line .lvl-warn { color: var(--accent-warm); }
.v-balanced .log-line .lvl-task { color: #e879f9; }
.v-balanced .log-line .msg { color: #d4dae3; }
.v-balanced .log-line .msg b { color: var(--fg); }

/* hidden agent log */
.v-balanced.no-agent-log .log-panel#agentLogPanel { display: none; }
.v-balanced.no-agent-log .hero-inner { grid-template-columns: 1fr; }

.v-balanced section.block {
  padding: 72px 0;
  border-bottom: 1px dashed var(--line-2);
  position: relative;
}
.v-balanced .sec-path {
  font-size: 11px; color: var(--fg-3); letter-spacing: 0.1em;
  margin-bottom: 16px;
}
.v-balanced .sec-path .sep { opacity: 0.5; margin: 0 6px; }
.v-balanced .sec-path .cur { color: var(--accent); }
.v-balanced h2.sec-title {
  font-size: clamp(32px, 4vw, 56px); line-height: 1.05; margin: 0 0 18px;
  font-weight: 700; letter-spacing: -0.03em; color: var(--fg);
}
.v-balanced .sec-sub { font-size: 13px; color: var(--fg-2); max-width: 620px; line-height: 1.7; margin: 0 0 44px; }

.v-balanced .proj-list { display: flex; flex-direction: column; gap: 12px; }
.v-balanced .proj-row {
  display: grid; grid-template-columns: 64px 1fr auto auto;
  gap: 24px; align-items: center;
  background: var(--panel);
  border: 1px solid var(--line-2);
  padding: 22px 24px;
  transition: all 0.2s;
  cursor: pointer;
}
.v-balanced .proj-row:hover { border-color: var(--accent); background: var(--panel-2); }
.v-balanced .proj-row .idx { color: var(--fg-3); font-size: 11px; letter-spacing: 0.1em; }
.v-balanced .proj-row h3 { margin: 0 0 4px; font-size: 18px; color: var(--fg); font-weight: 700; }
.v-balanced .proj-row h3 .ghost { color: var(--fg-3); font-weight: 400; margin-left: 10px; font-size: 12px; }
.v-balanced .proj-row p { margin: 0 0 10px; font-size: 12.5px; color: var(--fg-2); line-height: 1.6; max-width: 680px; }
.v-balanced .proj-row .tags { display: flex; gap: 6px; flex-wrap: wrap; }
.v-balanced .proj-row .tags span { font-size: 10px; color: var(--fg-3); letter-spacing: 0.1em; text-transform: uppercase; padding: 2px 6px; border: 1px solid var(--line-2); }
.v-balanced .proj-row .stat-block { text-align: right; color: var(--fg-3); font-size: 11px; }
.v-balanced .proj-row .stat-block b { color: var(--fg); font-size: 20px; display: block; font-weight: 700; }
.v-balanced .proj-row .arr { color: var(--accent); font-size: 14px; }

.v-balanced .exp-list { display: grid; grid-template-columns: 1fr 1fr; gap: 0; border: 1px solid var(--line-2); }
.v-balanced .exp-row {
  padding: 22px 24px; border-right: 1px solid var(--line-2); border-bottom: 1px solid var(--line-2);
  display: grid; grid-template-columns: 28px 1fr; gap: 16px; align-items: start;
  background: var(--panel);
}
.v-balanced .exp-row:nth-child(2n) { border-right: 0; }
.v-balanced .exp-row:nth-last-child(-n+2) { border-bottom: 0; }
.v-balanced .exp-row .check {
  width: 18px; height: 18px; border: 1px solid var(--accent); color: var(--accent);
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; margin-top: 2px;
}
.v-balanced .exp-row h4 { margin: 0 0 6px; font-size: 14px; color: var(--fg); font-weight: 700; }
.v-balanced .exp-row h4 .path { color: var(--fg-3); font-weight: 400; font-size: 11px; margin-left: 10px; }
.v-balanced .exp-row p { margin: 0; font-size: 12px; color: var(--fg-2); line-height: 1.65; }

.v-balanced .about-split { display: grid; grid-template-columns: 1fr 1fr; gap: 48px; align-items: start; }
.v-balanced .about-split .meta-row { display: grid; grid-template-columns: 1fr 1fr; gap: 28px; margin: 0 0 28px; padding: 18px 0; border-top: 1px solid var(--line-2); border-bottom: 1px solid var(--line-2); }
.v-balanced .about-split .meta-row b { color: var(--accent); display: block; font-size: 22px; font-weight: 700; }
.v-balanced .about-split .meta-row span { font-size: 10px; letter-spacing: 0.15em; text-transform: uppercase; color: var(--fg-3); }
.v-balanced .about-split p { font-size: 13px; line-height: 1.75; color: var(--fg-2); margin: 0 0 16px; }
.v-balanced .about-split strong { color: var(--fg); }
.v-balanced .about-split a { color: var(--accent); border-bottom: 1px solid currentColor; }

.v-balanced .faq { border: 1px solid var(--line-2); }
.v-balanced .faq-item { border-bottom: 1px solid var(--line-2); padding: 18px 24px; cursor: pointer; background: var(--panel); transition: background 0.2s; }
.v-balanced .faq-item:last-child { border-bottom: 0; }
.v-balanced .faq-item:hover { background: var(--panel-2); }
.v-balanced .faq-q { display: grid; grid-template-columns: auto 1fr auto; gap: 14px; align-items: center; font-size: 13px; color: var(--fg); font-weight: 500; }
.v-balanced .faq-q .nm { color: var(--accent); font-size: 11px; }
.v-balanced .faq-q .sig { color: var(--fg-3); }
.v-balanced .faq-item.open .faq-q .sig { color: var(--accent); }
.v-balanced .faq-a { max-height: 0; overflow: hidden; transition: max-height 0.3s; font-size: 12.5px; color: var(--fg-2); line-height: 1.7; padding-left: 44px; }
.v-balanced .faq-item.open .faq-a { max-height: 400px; padding-top: 14px; }
.v-balanced .faq-a a { color: var(--accent); border-bottom: 1px solid currentColor; }

.v-balanced .connect-table { border: 1px solid var(--line-2); }
.v-balanced .connect-row {
  display: grid; grid-template-columns: 140px 1fr auto;
  padding: 14px 24px; border-bottom: 1px solid var(--line-2);
  align-items: center; background: var(--panel); transition: all 0.2s;
}
.v-balanced .connect-row:last-child { border-bottom: 0; }
.v-balanced .connect-row:hover { background: var(--panel-2); color: var(--accent); }
.v-balanced .connect-row .k { color: var(--fg-3); font-size: 11px; letter-spacing: 0.15em; text-transform: uppercase; }
.v-balanced .connect-row .v { color: var(--fg); font-size: 13px; }
.v-balanced .connect-row .arr { color: var(--fg-3); }
.v-balanced .connect-row:hover .arr { color: var(--accent); }
.v-balanced .connect-row.archived { opacity: 0.45; }
.v-balanced .connect-row.archived:hover { opacity: 0.75; background: transparent; color: inherit; }
.v-balanced .connect-row.archived:hover .arr { color: var(--fg-3); }
.v-balanced .connect-row.archived .v { color: var(--fg-2); text-decoration: line-through; text-decoration-color: var(--fg-3); }
.v-balanced .connect-row.archived .decom {
  margin-left: 6px; color: var(--fg-3); font-size: 10.5px;
  letter-spacing: 0.1em; text-transform: uppercase;
  text-decoration: none; display: inline-block;
}

.v-balanced .site-foot {
  max-width: 1240px; margin: 0 auto;
  padding: 40px 32px; border-top: 1px dashed var(--line-2);
  display: flex; justify-content: space-between; font-size: 10px;
  color: var(--fg-3); letter-spacing: 0.1em; text-transform: uppercase;
}

/* ============================================
   Responsive breakpoints
   ============================================ */
@media (max-width: 960px) {
  .wrap { padding: 0 24px; }

  .v-balanced .hero-inner { grid-template-columns: 1fr; }
  .v-balanced .about-split { grid-template-columns: 1fr; }
  .v-balanced .exp-list { grid-template-columns: 1fr; }
  .v-balanced .exp-row { border-right: 0 !important; }
  .v-balanced .proj-row { grid-template-columns: 1fr; gap: 12px; }
  .v-balanced .topbar { overflow-x: auto; }

  .tweaks { right: 12px; left: 12px; width: auto; bottom: 72px; }
  .tweaks-toggle { right: 12px; bottom: 12px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
