:root {
  --bg: #020617;
  --bg-soft: #081226;
  --primary: #6366f1;
  --accent: #22d3ee;
  --text: #e2e8f0;
  --muted: #94a3b8;
  --card: rgba(255, 255, 255, 0.05);
  --card-border: rgba(148, 163, 184, 0.2);
  --card-glow: rgba(99, 102, 241, 0.34);
  --radius: 18px;
  --shadow: 0 20px 45px rgba(2, 6, 23, 0.42);
  --max-width: 1200px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  font-family: "Inter", system-ui, -apple-system, Segoe UI, Roboto, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at 18% 8%, rgba(34, 211, 238, 0.16), transparent 36%),
    radial-gradient(circle at 86% 16%, rgba(99, 102, 241, 0.2), transparent 38%),
    linear-gradient(180deg, var(--bg-soft), var(--bg));
  line-height: 1.6;
  min-height: 100vh;
}

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

button,
input,
select {
  font: inherit;
}

.container {
  width: min(100% - 2rem, var(--max-width));
  margin: 0 auto;
}

.navbar {
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(14px);
  background: rgba(2, 6, 23, 0.68);
  border-bottom: 1px solid rgba(148, 163, 184, 0.16);
  transition: background 220ms ease, border-color 220ms ease;
}

.navbar.scrolled {
  background: rgba(2, 6, 23, 0.86);
  border-color: rgba(148, 163, 184, 0.26);
}

.nav-shell {
  width: min(100% - 2rem, var(--max-width));
  margin: 0 auto;
  min-height: 72px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.logo {
  font-weight: 800;
  letter-spacing: 0.02em;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.nav-links a {
  padding: 0.5rem 0.8rem;
  border-radius: 999px;
  color: var(--muted);
  transition: color 180ms ease, background-color 180ms ease;
}

.nav-links a:hover {
  color: #f8fafc;
  background: rgba(34, 211, 238, 0.12);
}

.hero {
  position: relative;
  min-height: 88vh;
  display: grid;
  place-items: center;
  overflow: hidden;
}

#hero-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}

.hero-shade {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 30% 14%, rgba(34, 211, 238, 0.18), transparent 40%),
    radial-gradient(circle at 76% 22%, rgba(99, 102, 241, 0.24), transparent 42%),
    linear-gradient(180deg, rgba(2, 6, 23, 0.3), rgba(2, 6, 23, 0.82));
}

.hero-content {
  position: relative;
  z-index: 2;
  text-align: center;
  width: min(100% - 2rem, 900px);
}

.eyebrow {
  margin: 0;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  font-size: 0.76rem;
  color: var(--accent);
}

.hero-content h1 {
  margin: 0.65rem 0 0.4rem;
  font-size: clamp(2rem, 5vw, 4.1rem);
  line-height: 1.08;
  letter-spacing: -0.03em;
}

.subtitle {
  margin: 0;
  color: #cbd5e1;
  font-size: clamp(1rem, 2.2vw, 1.22rem);
}

.btn,
.card-btn,
.paper-btn,
.mini-btn {
  border-radius: 999px;
  border: 1px solid rgba(99, 102, 241, 0.46);
  color: #f8fafc;
  cursor: pointer;
  transition: transform 180ms ease, box-shadow 220ms ease, background 220ms ease;
}

.btn {
  margin-top: 1.4rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.76rem 1.3rem;
  font-weight: 700;
  background: linear-gradient(135deg, rgba(34, 211, 238, 0.26), rgba(99, 102, 241, 0.24));
  border-color: rgba(34, 211, 238, 0.46);
}

.btn:hover,
.card-btn:hover,
.paper-btn:hover:not(:disabled),
.mini-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 28px rgba(99, 102, 241, 0.32);
}

.section {
  padding: 76px 0;
}

.section-header {
  max-width: 760px;
  margin-bottom: 1.3rem;
}

.section-header h2 {
  margin: 0.56rem 0 0.66rem;
  font-size: clamp(1.55rem, 3.2vw, 2.4rem);
}

.section-header p {
  margin: 0;
  color: var(--muted);
  line-height: 1.75;
}

.paper-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
}

.paper-card {
  position: relative;
  border-radius: var(--radius);
  border: 1px solid var(--card-border);
  background: var(--card);
  backdrop-filter: blur(14px);
  box-shadow: var(--shadow);
  padding: 1rem;
  overflow: hidden;
  transition: transform 220ms ease, border-color 220ms ease, box-shadow 220ms ease;
}

.paper-card::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(160deg, rgba(34, 211, 238, 0.1), rgba(99, 102, 241, 0));
  pointer-events: none;
}

.paper-card:hover {
  transform: translateY(-9px) scale(1.012);
  border-color: rgba(34, 211, 238, 0.6);
  box-shadow: 0 22px 50px var(--card-glow);
}

.paper-canvas-wrap {
  height: 220px;
  border-radius: 12px;
  background: linear-gradient(180deg, rgba(2, 6, 23, 0.56), rgba(15, 23, 42, 0.82));
  border: 1px solid rgba(148, 163, 184, 0.16);
  overflow: hidden;
}

.paper-canvas {
  width: 100%;
  height: 100%;
  display: block;
}

.catalog-toolbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(260px, 0.56fr);
  gap: 1rem;
  align-items: end;
  padding: 1rem;
  border-radius: var(--radius);
}

.catalog-toolbar h2 {
  margin: 0.4rem 0 0.35rem;
  font-size: clamp(1.35rem, 4vw, 2rem);
}

.catalog-copy {
  margin: 0;
  color: var(--muted);
  line-height: 1.7;
}

.catalog-search-wrap {
  display: block;
}

.catalog-search {
  width: 100%;
  min-height: 48px;
  padding: 0.9rem 1rem;
  border-radius: 16px;
  border: 1px solid rgba(148, 163, 184, 0.18);
  background: rgba(2, 6, 23, 0.45);
  color: var(--text);
  font: inherit;
}

.catalog-search::placeholder {
  color: rgba(148, 163, 184, 0.82);
}

.catalog-search:focus {
  outline: 2px solid rgba(34, 211, 238, 0.55);
  outline-offset: 2px;
}

.paper-card h3 {
  margin: 0.9rem 0 0.42rem;
  font-size: 1.38rem;
}

.paper-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.7;
  min-height: 76px;
}

.paper-btn {
  margin-top: 0.95rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.72rem 1.1rem;
  font-weight: 700;
  background: rgba(99, 102, 241, 0.2);
}

.paper-btn:disabled {
  cursor: not-allowed;
  opacity: 0.56;
}

.paper-card.coming {
  border-color: rgba(34, 211, 238, 0.34);
}

.topics-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
}

.topic-card {
  position: relative;
  border-radius: var(--radius);
  border: 1px solid var(--card-border);
  background: var(--card);
  backdrop-filter: blur(14px);
  box-shadow: var(--shadow);
  padding: 1rem;
  transition: transform 220ms ease, border-color 220ms ease, box-shadow 220ms ease;
  overflow: hidden;
}

.topic-card::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(160deg, rgba(99, 102, 241, 0.12), rgba(34, 211, 238, 0));
  pointer-events: none;
}

.topic-card:hover {
  transform: translateY(-8px) scale(1.01);
  border-color: rgba(34, 211, 238, 0.6);
  box-shadow: 0 20px 45px var(--card-glow);
}

.topic-canvas-wrap {
  height: 180px;
  border-radius: 12px;
  background: linear-gradient(180deg, rgba(2, 6, 23, 0.55), rgba(15, 23, 42, 0.8));
  border: 1px solid rgba(148, 163, 184, 0.16);
  overflow: hidden;
}

.topic-canvas {
  width: 100%;
  height: 100%;
  display: block;
}

.topic-card h3 {
  margin: 0.95rem 0 0.4rem;
  font-size: 1.2rem;
}

.topic-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.68;
  min-height: 72px;
}

.card-btn {
  margin-top: 0.95rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.64rem 1.05rem;
  font-weight: 600;
  background: rgba(99, 102, 241, 0.2);
}

.demo-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
}

.demo-card {
  border-radius: var(--radius);
  border: 1px solid var(--card-border);
  background: var(--card);
  backdrop-filter: blur(14px);
  box-shadow: var(--shadow);
  padding: 1rem;
}

.demo-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.65rem;
  margin-bottom: 0.7rem;
}

.demo-head h3 {
  margin: 0;
  font-size: 1.05rem;
}

.demo-card canvas {
  width: 100%;
  height: 240px;
  border-radius: 12px;
  border: 1px solid rgba(148, 163, 184, 0.2);
  background: linear-gradient(180deg, rgba(15, 23, 42, 0.8), rgba(2, 6, 23, 0.9));
  display: block;
}

.demo-card p {
  margin: 0.8rem 0 0;
  color: var(--muted);
  line-height: 1.65;
}

.mini-btn {
  padding: 0.52rem 0.85rem;
  font-weight: 600;
  color: #dbeafe;
  background: rgba(99, 102, 241, 0.2);
}

.mini-control {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  color: #cbd5e1;
  font-size: 0.87rem;
}

.mini-control input[type="range"] {
  width: 96px;
  accent-color: var(--accent);
}

.site-footer {
  border-top: 1px solid rgba(148, 163, 184, 0.18);
  background: rgba(2, 6, 23, 0.75);
  padding: 1.25rem 0 1.55rem;
}

.footer-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
  color: var(--muted);
  font-size: 0.94rem;
}

.footer-link {
  color: #93c5fd;
}

.footer-link:hover {
  color: #bfdbfe;
}

[data-reveal] {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 620ms ease, transform 620ms ease;
}

[data-reveal].is-visible {
  opacity: 1;
  transform: translateY(0);
}

.ripple-btn {
  position: relative;
  overflow: hidden;
}

.ripple {
  position: absolute;
  border-radius: 50%;
  transform: scale(0);
  background: rgba(255, 255, 255, 0.44);
  pointer-events: none;
  animation: ripple-effect 720ms ease-out;
}

@keyframes ripple-effect {
  to {
    transform: scale(3.6);
    opacity: 0;
  }
}

@media (max-width: 1080px) {
  .paper-grid,
  .topics-grid,
  .demo-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 760px) {
  .nav-shell {
    min-height: 66px;
    flex-wrap: wrap;
    justify-content: center;
    padding: 0.65rem 0;
  }

  .nav-links {
    width: 100%;
    justify-content: center;
    gap: 1rem;
    font-size: 0.94rem;
    flex-wrap: wrap;
  }

  .hero {
    min-height: 88vh;
  }

  .section {
    padding: 68px 0;
  }

  .topics-grid,
  .paper-grid,
  .demo-grid {
    grid-template-columns: 1fr;
  }

  .catalog-toolbar {
    grid-template-columns: 1fr;
  }

  .paper-canvas-wrap {
    height: 180px;
  }

  .topic-canvas-wrap {
    height: 160px;
  }

  .demo-card canvas {
    height: 220px;
  }

  .footer-inner {
    flex-direction: column;
    align-items: flex-start;
  }
}

@media (max-width: 560px) {
  .container {
    width: min(100% - 1rem, var(--max-width));
  }

  .nav-shell {
    width: min(100% - 1rem, var(--max-width));
  }

  .hero {
    min-height: 72vh;
  }

  .hero-content {
    width: min(100% - 1rem, 900px);
  }

  .hero-content h1 {
    font-size: clamp(1.65rem, 8vw, 2.8rem);
  }

  .section {
    padding: 54px 0;
  }

  .paper-card,
  .topic-card,
  .demo-card {
    padding: 0.85rem;
  }

  .paper-canvas-wrap {
    height: 152px;
  }

  .topic-canvas-wrap {
    height: 144px;
  }

  .demo-card canvas {
    height: 188px;
  }

  .paper-card h3,
  .topic-card h3 {
    font-size: 1.04rem;
  }

  .paper-card p,
  .topic-card p,
  .demo-card p {
    font-size: 0.94rem;
    min-height: auto;
  }

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

  .footer-inner {
    align-items: center;
    text-align: center;
  }
}
