/*
 * Chaos Software homepage.
 * Teal-black background with a glow mesh and grid, Space Grotesk
 * headings, glass navbar, cards with an accent line, plus the dark
 * panels and pill badges of Chaos Router OS. Accent: the cyan of the logo.
 */

/* Fonts are served from this site: no requests to Google (GDPR). */
@font-face {
  font-family: "Inter";
  src: url("../fonts/inter-latin-wght-normal.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Space Grotesk";
  src: url("../fonts/space-grotesk-latin-wght-normal.woff2") format("woff2");
  font-weight: 300 700;
  font-style: normal;
  font-display: swap;
}

:root {
  --bg: #071013;
  --panel: #101a1f;
  --panel-2: #16232a;
  --panel-hover: #142228;
  --border: rgba(255, 255, 255, .08);
  --border-accent: rgba(62, 217, 207, .3);

  --accent: #3ed9cf;
  --accent-strong: #63e6dd;
  --accent-deep: #428787;
  --accent-glow: rgba(62, 217, 207, .22);
  --blue: #4ea1ff;

  --text: #eef4f5;
  --muted: #94a3b8;

  --font-heading: "Space Grotesk", system-ui, sans-serif;
  --font-body: "Inter", system-ui, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Consolas, "DejaVu Sans Mono", monospace;

  --max-width: 1200px;
  --nav-height: 72px;
  --radius: 16px;
  --radius-sm: 10px;
  --ease: cubic-bezier(.16, 1, .3, 1);
}

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--nav-height) + 16px);
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
}

a {
  color: inherit;
  text-decoration: none;
}

img {
  display: block;
  max-width: 100%;
  height: auto;
}

h1, h2, h3, h4 {
  font-family: var(--font-heading);
  line-height: 1.15;
  letter-spacing: -.02em;
}

.container {
  width: 100%;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 24px;
}

/* ---------- Scrollbars (same as Chaos Router OS) ---------- */

::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

::-webkit-scrollbar-track,
::-webkit-scrollbar-corner {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: #2d3a40;
  background-clip: padding-box;
  border: 2px solid transparent;
  border-radius: 999px;
}

::-webkit-scrollbar-thumb:hover {
  background: #3f5058;
  background-clip: padding-box;
}

::-webkit-scrollbar-thumb:active {
  background: var(--accent);
  background-clip: padding-box;
}

::-webkit-scrollbar-button {
  display: none;
}

/* Firefox: no ::-webkit-scrollbar, same colours via the standard
   properties (kept out of Chromium, which would ignore the above). */
@supports not selector(::-webkit-scrollbar) {

  * {
    scrollbar-width: thin;
    scrollbar-color: #2d3a40 transparent;
  }
}

/* The install command's scrollbar: slimmer. */
.command code::-webkit-scrollbar {
  height: 8px;
}

/* ---------- Background ---------- */

.bg-mesh,
.bg-grid {
  position: fixed;
  inset: 0;
  pointer-events: none;
}

.bg-mesh {
  z-index: -2;
  background:
    radial-gradient(circle at 15% 15%, rgba(62, 217, 207, .11) 0%, transparent 45%),
    radial-gradient(circle at 85% 55%, rgba(78, 161, 255, .07) 0%, transparent 40%),
    radial-gradient(circle at 50% 90%, rgba(20, 36, 42, .6) 0%, transparent 50%);
}

.bg-grid {
  z-index: -1;
  background-image:
    linear-gradient(var(--border) 1px, transparent 1px),
    linear-gradient(90deg, var(--border) 1px, transparent 1px);
  background-size: 60px 60px;
  mask-image: radial-gradient(ellipse at center, rgba(0, 0, 0, .4) 0%, transparent 70%);
  -webkit-mask-image: radial-gradient(ellipse at center, rgba(0, 0, 0, .4) 0%, transparent 70%);
}

/* ---------- Navbar ---------- */

.navbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  height: var(--nav-height);
  background: rgba(7, 16, 19, .72);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
}

.navbar .container {
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  font-family: var(--font-heading);
  font-size: 1.2rem;
  font-weight: 700;
  letter-spacing: -.02em;
}

.brand img {
  width: 36px;
  height: 36px;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 28px;
}

.nav-links a:not(.btn) {
  color: var(--muted);
  font-size: .95rem;
  font-weight: 500;
  transition: color .2s var(--ease);
}

.nav-links a:not(.btn):hover {
  color: var(--accent-strong);
}

.nav-toggle {
  display: none;
  width: 40px;
  height: 40px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--panel-2);
  color: var(--text);
  cursor: pointer;
}

.nav-toggle span {
  display: block;
  width: 18px;
  height: 2px;
  margin: 4px auto;
  background: currentColor;
  border-radius: 2px;
}

/* ---------- Buttons and pills (Router OS) ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 46px;
  padding: 0 22px;
  border: 1px solid transparent;
  border-radius: 12px;
  font: inherit;
  font-size: .95rem;
  font-weight: 600;
  cursor: pointer;
  transition: background .2s var(--ease), border-color .2s var(--ease), box-shadow .2s var(--ease), transform .2s var(--ease);
}

.btn:active {
  transform: scale(.98);
}

.btn-primary {
  background: var(--accent);
  color: #04201e;
  box-shadow: 0 4px 22px var(--accent-glow);
}

.btn-primary:hover {
  background: var(--accent-strong);
  box-shadow: 0 6px 26px rgba(62, 217, 207, .35);
  transform: translateY(-2px);
}

.btn-secondary {
  background: var(--panel-2);
  border-color: var(--border);
  color: var(--text);
}

.btn-secondary:hover {
  border-color: var(--border-accent);
  transform: translateY(-2px);
}

.btn-small {
  height: 38px;
  padding: 0 16px;
  font-size: .875rem;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  width: max-content;
  padding: 6px 12px;
  border-radius: 999px;
  background: rgba(62, 217, 207, .1);
  border: 1px solid var(--border-accent);
  color: var(--accent-strong);
  font-size: .8rem;
  font-weight: 600;
}

.pill::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 10px var(--accent);
}

.pill.planned {
  background: rgba(148, 163, 184, .08);
  border-color: var(--border);
  color: var(--muted);
}

.pill.planned::before {
  background: var(--muted);
  box-shadow: none;
}

.pill.live {
  background: rgba(34, 197, 94, .1);
  border-color: rgba(34, 197, 94, .3);
  color: #8ce5aa;
}

.pill.live::before {
  background: #22c55e;
  box-shadow: 0 0 10px #22c55e;
}

/* ---------- Hero ---------- */

.hero {
  padding: calc(var(--nav-height) + 72px) 0 72px;
}

.hero-grid {
  display: grid;
  grid-template-columns: 1.15fr .85fr;
  align-items: center;
  gap: 56px;
}

.hero h1 {
  margin: 22px 0 20px;
  font-size: clamp(2.4rem, 5vw, 4rem);
  letter-spacing: -.035em;
}

.hero h1 .accent {
  background: linear-gradient(90deg, var(--accent), var(--blue));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.hero p {
  max-width: 560px;
  margin-bottom: 32px;
  color: var(--muted);
  font-size: 1.125rem;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
}

.hero-logo {
  position: relative;
  justify-self: center;
  width: min(420px, 100%);
}

/* ---------- Sections ---------- */

section {
  padding: 72px 0;
}

.section-title {
  max-width: 640px;
  margin: 0 auto 48px;
  text-align: center;
}

.section-title h2 {
  margin-bottom: 12px;
  font-size: clamp(1.9rem, 3.5vw, 2.4rem);
}

.section-title p {
  color: var(--muted);
  font-size: 1.05rem;
}

/* ---------- Cards (Router OS panels + accent line) ---------- */

.card {
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  padding: 28px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: background .3s var(--ease), border-color .3s var(--ease), transform .3s var(--ease), box-shadow .3s var(--ease);
}

.card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
  opacity: 0;
  transition: opacity .3s var(--ease);
}

a.card:hover,
.card.hoverable:hover {
  background: var(--panel-hover);
  border-color: var(--border-accent);
  transform: translateY(-4px);
  box-shadow: 0 14px 32px rgba(0, 0, 0, .35);
}

a.card:hover::before,
.card.hoverable:hover::before {
  opacity: 1;
}

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

.card h3 {
  margin: 18px 0 10px;
  font-size: 1.3rem;
}

.card p {
  flex-grow: 1;
  color: var(--muted);
  font-size: .95rem;
}

.card-link {
  margin-top: 22px;
  color: var(--accent-strong);
  font-size: .9rem;
  font-weight: 600;
}

.card-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  border-radius: 12px;
  background: rgba(62, 217, 207, .08);
  border: 1px solid var(--border-accent);
  color: var(--accent);
}

.card-icon svg {
  width: 24px;
  height: 24px;
}

.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

/* ---------- Router OS feature section ---------- */

.feature-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  align-items: start;
  gap: 40px;
}

.feature-text h2 {
  margin: 18px 0 16px;
  font-size: clamp(1.9rem, 3.5vw, 2.4rem);
}

.feature-text > p {
  margin-bottom: 26px;
  color: var(--muted);
  font-size: 1.05rem;
}

.check-list {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px 20px;
  list-style: none;
}

.check-list li {
  position: relative;
  padding-left: 28px;
  font-size: .95rem;
}

.check-list li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 5px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: rgba(62, 217, 207, .14) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M4.5 8.2l2.2 2.2 4.8-5' fill='none' stroke='%233ed9cf' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / 14px no-repeat;
}

.feature-side {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* Grid columns may shrink below their content (the long install
   command scrolls inside its box instead of widening the page). */
.hero-grid > *,
.feature-grid > *,
.feature-side > * {
  min-width: 0;
}

/* A preview of the router dashboard header (decorative). */
.router-preview {
  padding: 20px 22px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.router-preview-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 22px;
}

.router-preview-item span {
  display: block;
  color: var(--muted);
  font-size: .75rem;
}

.router-preview-item strong {
  font-size: .95rem;
}

.router-preview-bar {
  height: 8px;
  margin-top: 18px;
  border-radius: 999px;
  background: var(--panel-2);
  overflow: hidden;
}

.router-preview-bar i {
  display: block;
  width: 46%;
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--accent-deep), var(--accent));
  animation: pulse 3.5s ease-in-out infinite alternate;
}

@keyframes pulse {
  from { width: 28%; }
  to { width: 64%; }
}

/* Install command */
.install {
  padding: 22px;
  background: var(--panel);
  border: 1px solid var(--border-accent);
  border-radius: var(--radius);
  box-shadow: 0 0 40px rgba(62, 217, 207, .06);
}

.install h3 {
  margin-bottom: 6px;
  font-size: 1.1rem;
}

.install > p {
  margin-bottom: 16px;
  color: var(--muted);
  font-size: .9rem;
}

.command {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 12px 12px 16px;
  background: #050c0e;
  border: 1px solid var(--border);
  border-radius: 12px;
}

.command code {
  flex: 1;
  min-width: 0;
  overflow-x: auto;
  white-space: nowrap;
  color: var(--text);
  font-family: var(--font-mono);
  font-size: .88rem;
  padding-bottom: 4px;
}

.command code .prompt {
  color: var(--accent);
  user-select: none;
}

.copy-btn {
  flex-shrink: 0;
  height: 34px;
  padding: 0 14px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: var(--panel-2);
  color: var(--text);
  font: inherit;
  font-size: .8rem;
  font-weight: 600;
  cursor: pointer;
  transition: border-color .2s var(--ease), color .2s var(--ease);
}

.copy-btn:hover {
  border-color: var(--border-accent);
}

.copy-btn.copied {
  color: #8ce5aa;
  border-color: rgba(34, 197, 94, .4);
}

.install-note {
  margin-top: 14px;
  color: var(--muted);
  font-size: .82rem;
}

/* ---------- Footer ---------- */

.footer {
  margin-top: auto;
  padding: 56px 0 28px;
  background: rgba(13, 23, 28, .8);
  border-top: 1px solid var(--border);
}

.footer-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: 40px;
  margin-bottom: 40px;
}

.footer-brand p {
  max-width: 320px;
  margin-top: 14px;
  color: var(--muted);
  font-size: .9rem;
}

.footer h4 {
  margin-bottom: 16px;
  font-size: .95rem;
}

.footer ul {
  list-style: none;
}

.footer li {
  margin-bottom: 10px;
}

.footer li a {
  color: var(--muted);
  font-size: .9rem;
  transition: color .2s var(--ease);
}

.footer li a:hover {
  color: var(--accent-strong);
}

.footer-bottom {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: .85rem;
}

/* ---------- Legal pages ---------- */

.legal {
  padding-top: calc(var(--nav-height) + 48px);
}

.legal-content {
  max-width: 860px;
  margin: 0 auto;
  padding: 40px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.legal-content h1 {
  margin-bottom: 24px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
  font-size: 2.2rem;
}

.legal-content h2 {
  margin: 28px 0 10px;
  font-size: 1.3rem;
}

.legal-content p,
.legal-content li {
  color: var(--muted);
  margin-bottom: 10px;
}

.legal-content ul {
  padding-left: 22px;
}

.legal-content .todo {
  padding: 2px 6px;
  border-radius: 6px;
  background: rgba(245, 158, 11, .15);
  color: #fcd34d;
}

/* ---------- Small screens ---------- */

@media (max-width: 900px) {

  .hero {
    padding-top: calc(var(--nav-height) + 40px);
  }

  .hero-grid,
  .feature-grid {
    grid-template-columns: 1fr;
  }

  .hero-grid {
    text-align: center;
    gap: 32px;
  }

  .hero .pill,
  .hero p {
    margin-left: auto;
    margin-right: auto;
  }

  .hero-actions {
    justify-content: center;
  }

  .hero-logo {
    width: min(260px, 70%);
    grid-row: 1;
  }

  .footer-grid {
    grid-template-columns: 1fr 1fr;
  }

  .footer-brand {
    grid-column: 1 / -1;
  }

  .nav-toggle {
    display: block;
  }

  .nav-links {
    position: fixed;
    top: var(--nav-height);
    left: 0;
    right: 0;
    flex-direction: column;
    align-items: stretch;
    gap: 18px;
    padding: 24px;
    background: var(--panel);
    border-bottom: 1px solid var(--border);
    box-shadow: 0 16px 32px rgba(0, 0, 0, .4);
    transform: translateY(-120%);
    visibility: hidden;
    transition: transform .3s var(--ease), visibility .3s;
  }

  .nav-links.open {
    transform: none;
    visibility: visible;
  }
}

@media (max-width: 560px) {

  section {
    padding: 56px 0;
  }

  .check-list {
    grid-template-columns: 1fr;
  }

  .legal-content {
    padding: 24px;
  }

  .command {
    flex-direction: column;
    align-items: stretch;
  }
}

@media (prefers-reduced-motion: reduce) {

  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
    scroll-behavior: auto !important;
  }
}

/* AI transparency note (EU AI Act, Art. 50). */
.ai-note {
  font-size: .8rem;
  opacity: .8;
}
