/* Base reset */
* { margin: 0; padding: 0; box-sizing: border-box; }

/* ---------------- Light theme (default) ---------------- */
:root {
  --color-bg: #0b1220;
  --color-fg: #e6eaf3;
  --color-card: #0f1629;
  --color-border: #1d2740;
  --color-primary: #8ab4ff;
  --color-primary-light: #b3c9ff;
  --color-accent: #c792ea;
  --color-muted: #9aa7bd;
  --color-shadow: rgba(0, 0, 0, 0.5);
  --color-shadow-glow: rgba(138, 180, 255, 0.2);
}

html { font-size: 100%; }
/* 1rem = 16px (browser default) */

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  background: transparent;
  color: var(--color-fg);
  line-height: 1.6;
  position: relative;
  overflow-x: hidden;
}

/* ---------------- Sitewide background (aurora + grid) ---------------- */
.site-bg {
  position: fixed;
  inset: -20vh;
  z-index: 0;
  pointer-events: none;
  background: radial-gradient(circle at 10% 20%, rgba(79, 70, 229, 0.25), transparent 55%),
  radial-gradient(circle at 80% 30%, rgba(168, 85, 247, 0.22), transparent 55%),
  radial-gradient(circle at 50% 80%, rgba(56, 189, 248, 0.18), transparent 55%),
  linear-gradient(to right, rgba(148, 163, 184, 0.12) 1px, transparent 1px),
  linear-gradient(to bottom, rgba(148, 163, 184, 0.08) 1px, transparent 1px),
  #020617;
  background-size: 120% 120%,
  110% 110%,
  130% 130%,
  40px 40px,
  40px 40px,
  auto;
  background-position: 0 0,
  10% 10%,
  80% 80%,
  0 0,
  0 0,
  center;
  mix-blend-mode: normal;
  opacity: 0.95;
  animation: inf-bg-drift 40s linear infinite alternate,
  inf-grid-pan 60s linear infinite;
}

/* Container */
.container {
  max-width: min(80rem, 100%);
  margin-inline: auto;
  padding-inline: 1rem;
}

/* Hero */
.hero {
  position: relative;
  z-index: 1;
  overflow: hidden;
  background: linear-gradient(180deg, rgba(15, 23, 42, 0.85) 0%, rgba(15, 23, 42, 0.95) 100%);
  padding: clamp(1rem, 3vw, 2rem) 1rem;
  text-align: center;
}
.hero::before, .hero::after {
  content: ''; position: absolute; border-radius: 50%;
  filter: blur(5rem); opacity: 0.4;
}
.hero::before {
  top: -6.25rem; right: -6.25rem;
  width: clamp(18rem, 35vw, 25rem); height: clamp(18rem, 35vw, 25rem);
  background: var(--color-primary);
  animation: float 6s ease-in-out infinite;
}
.hero::after {
  bottom: -6.25rem; left: -6.25rem;
  width: clamp(18rem, 35vw, 25rem); height: clamp(18rem, 35vw, 25rem);
  background: var(--color-accent);
  animation: float 6s ease-in-out infinite 1s;
}

@keyframes float {
  0%, 100% {transform: translateY(0)}
  50% {transform: translateY(-1.25rem)}
}
@keyframes fadeIn {
  from {opacity: 0;transform: translateY(1.25rem)}
  to {opacity: 1;transform: translateY(0)}
}
@keyframes pulse {
  0%, 100% {opacity: 1}
  50% {opacity: .5}
}

/* Aurora drift */
@keyframes inf-bg-drift {
  0% { transform: translate3d(0, 0, 0) scale(1); }
  50% { transform: translate3d(-2vw, -1vh, 0) scale(1.03); }
  100% { transform: translate3d(2vw, 1vh, 0) scale(1.06); }
}

/* Grid pan */
@keyframes inf-grid-pan {
  0% { background-position: 0 0, 0 0, 0 0, 0 0, 0 0, center; }
  100% { background-position: 10% 5%, 15% 10%, 5% 15%, 80px 40px, 40px 80px, center; }
}

.hero-content { position: relative; z-index: 1; animation: fadeIn .8s ease-out; }
.hero-badge {
  display: inline-flex; align-items: center; gap: .5rem; padding: .5rem 1rem;
  background: rgba(79, 70, 229, 0.25); border: 1px solid rgba(79, 70, 229, 0.35);
  border-radius: 9999px; color: var(--color-primary-light); font-size: .875rem; font-weight: 500;
  margin-bottom: 2rem;
}
.pulse-dot { width: .5rem; height: .5rem; border-radius: 50%; background: var(--color-primary-light); animation: pulse 2s ease-in-out infinite; }
.hero h1 {
  font-size: clamp(2.5rem, 8vw, 4.5rem); font-weight: 700;
  background: linear-gradient(135deg, var(--color-primary-light), var(--color-accent));
  -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
  margin-bottom: 1.5rem; line-height: 1.1;
}
.hero p { font-size: clamp(1rem, 1.5vw, 1.25rem); color: var(--color-muted); margin: 0 auto 2rem; }
.search-box { max-width: clamp(24rem, 60vw, 36rem); margin: 0 auto; position: relative; }
.search-icon {
  position: absolute;
  left: 1rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--color-primary-light);
  width: 1.25rem;
  height: 1.25rem;
  opacity: 0.95;
  pointer-events: none;
}
.search-input {
  width: 100%; padding: 1rem 1rem 1rem 3rem; font-size: 1rem;
  border: 1px solid rgba(148, 163, 184, 0.4); border-radius: .75rem;
  background: rgba(15, 23, 42, 0.9); backdrop-filter: blur(18px);
  color: var(--color-fg);
  transition: all .3s ease;
}
.search-input::placeholder {
  color: rgba(148, 163, 184, 0.9);
}
.search-input:focus {
  outline: none;
  border-color: rgba(138, 180, 255, 0.8);
  box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.28);
}

/* Docs Section */
.docs-section {
  position: relative;
  z-index: 1;
  padding: clamp(2rem, 4vw, 3rem) 1rem;
}
.section-header { text-align: center; margin-bottom: clamp(2rem, 4vw, 3rem); animation: fadeIn .8s ease-out; }
.section-header h2 { font-size: clamp(2rem, 4vw, 2.5rem); font-weight: 700; margin-bottom: 1rem; }
.section-header p { font-size: clamp(1rem, 1.5vw, 1.125rem); color: var(--color-muted); max-width: 42rem; margin: 0 auto; }

/* ---- Force ONE project per row (all breakpoints) ---- */
.doc-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: clamp(1rem, 2vw, 1.5rem);
  margin-top: clamp(2rem, 4vw, 3rem);
}

/* Pagination */
.pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: .75rem;
  margin-top: 2rem;
  flex-wrap: wrap;
}

.page-btn {
  padding: .4rem .9rem;
  border-radius: .5rem;
  border: 1px solid rgba(138, 180, 255, 0.35);
  background: rgba(15, 23, 42, 0.9);
  font-size: .875rem;
  font-weight: 500;
  color: var(--color-primary-light);
  cursor: pointer;
  transition: all .2s ease;
}

.page-btn:hover:not(:disabled) {
  background: rgba(37, 99, 235, 0.4);
  transform: translateY(-1px);
}

.page-btn:disabled {
  opacity: .45;
  cursor: default;
}

.page-info {
  font-size: .875rem;
  color: var(--color-muted);
}

/* Make all cards fill the grid column */
.docs-section .doc-grid .doc-card {
  width: 100%;
  max-width: none;
  margin-inline: 0;
}

/* Card */
.doc-card {
  position: relative; background: radial-gradient(circle at top left, rgba(148, 163, 184, 0.16), transparent 55%), var(--color-card);
  border: 1px solid var(--color-border); border-radius: 1rem; overflow: hidden;
  transition: all .3s ease; animation: fadeIn .8s ease-out; animation-fill-mode: both; cursor: pointer;
}
.doc-card:nth-child(1) {animation-delay: .1s}
.doc-card:nth-child(2) {animation-delay: .2s}
.doc-card:nth-child(3) {animation-delay: .3s}
.doc-card:nth-child(4) {animation-delay: .4s}
.doc-card:nth-child(5) {animation-delay: .5s}
.doc-card:nth-child(6) {animation-delay: .6s}
.doc-card::before { content: ''; position: absolute; inset: 0;
  background: radial-gradient(circle at top left, rgba(138, 180, 255, 0.25), transparent 55%);
  opacity: 0; transition: opacity .3s ease;
  pointer-events: none;
}
.doc-card:hover { transform: translateY(-.25rem); box-shadow: 0 0.5rem 2rem var(--color-shadow-glow); }
.doc-card:hover::before { opacity: .45; }
.doc-card-image { width: 100%; height: clamp(10rem, 25vw, 12.5rem); background: linear-gradient(135deg, #1e293b, #020617); position: relative; overflow: hidden; }
.doc-card-image img { width: 100%; height: 100%; object-fit: cover; transition: transform .5s ease; }
.doc-card:hover .doc-card-image img { transform: scale(1.05); }

.doc-card-header { padding: clamp(1rem, 2vw, 1.5rem); }
.doc-card-icon-wrapper { display: flex; align-items: center; gap: 1rem; margin-bottom: 1rem; }
.doc-card-icon {
  width: clamp(2.5rem, 3vw, 3rem); height: clamp(2.5rem, 3vw, 3rem);
  display: flex; align-items: center; justify-content: center;
  background: rgba(79, 70, 229, 0.2); border-radius: .75rem; color: var(--color-primary-light); transition: all .3s ease;
}
.doc-card:hover .doc-card-icon { background: rgba(79, 70, 229, 0.35); }
.doc-card h3 {
  font-size: clamp(1.25rem, 2.2vw, 1.5rem); font-weight: 700;
  background: linear-gradient(135deg, var(--color-primary-light), var(--color-accent));
  -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
  margin-bottom: .75rem;
}
.doc-card p { color: var(--color-muted); line-height: 1.6; margin-bottom: 0.5rem; }

.doc-card-links { display: flex; flex-wrap: wrap; gap: .5rem; padding: 1rem; position: relative; z-index: 1; }
.doc-card-content { max-height: 0; overflow: hidden; transition: max-height .4s ease; background: rgba(15, 23, 42, 0.96); border-top: 1px solid transparent; }
.doc-card.expanded .doc-card-content { max-height: 1000px; border-top-color: var(--color-border); }
.doc-card-content-inner { padding: clamp(1rem, 2vw, 1.5rem); }
.doc-card-content h4 { color: var(--color-primary-light); font-size: clamp(1rem, 1.8vw, 1.125rem); font-weight: 600; margin-bottom: 1rem; }
.doc-card-content ul { list-style: none; padding: 0; }
.doc-card-content li { padding: .5rem 0; padding-left: 1.5rem; position: relative; color: var(--color-muted); }
.doc-card-content li::before { content: '→'; position: absolute; left: 0; color: var(--color-primary-light); }
.expand-icon { transition: transform .3s ease; margin-left: auto; width: 1.5rem; height: 1.5rem; color: rgba(148, 163, 184, 0.9); }
.doc-card.expanded .expand-icon { transform: rotate(180deg); }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; gap: .5rem;
  padding: .5rem 1rem; font-size: .875rem; font-weight: 500; border-radius: .5rem;
  text-decoration: none; transition: all .3s ease; cursor: pointer; border: none;
}
.btn-primary { background: linear-gradient(135deg, var(--color-primary), var(--color-accent)); color: #fff; }
.btn-primary:hover { opacity: .9; transform: translateY(-1px); }
.btn-outline {
  background: rgba(15, 23, 42, 0.95);
  border: 1px solid rgba(148, 163, 184, 0.45);
  color: var(--color-primary-light);
}
.btn-outline:hover { background: rgba(30, 64, 175, 0.55); }
.btn svg { width: 1rem; height: 1rem; }

/* Footer */
.footer {
  position: relative;
  z-index: 1;
  border-top: 1px solid rgba(15, 23, 42, 0.9);
  margin-top: clamp(3rem, 6vw, 6rem);
  background: rgba(15, 23, 42, 0.95);
  backdrop-filter: blur(16px);
}
.footer-content { display: flex; flex-direction: column; align-items: center; justify-content: space-between; gap: 1rem; padding: 3rem 1rem; }
.footer-links { display: flex; gap: 2rem; }
.footer a { color: var(--color-muted); text-decoration: none; font-size: .875rem; transition: color .3s ease; }
.footer a:hover { color: var(--color-primary-light); }

@media (min-width: 40rem) {
  .footer-content { flex-direction: row; }
}

/* Hide RTD widgets/old footer on RTD host if present */
div.footer { display: none; }
.rst-versions,
.readthedocs,
.readthedocs-flyout,
.rst-current-version,
#flyout,
.__readthedocs__container,
body > readthedocs-flyout { display: none !important; }

/* Motion preferences */
@media (prefers-reduced-motion: reduce) {
  .site-bg,
  .hero::before,
  .hero::after {
    animation: none !important;
  }
}

/* ---------- Optional: make the initials badge responsive even if JS sets width/height attrs ---------- */
.doc-card-icon .js-initials {
  width: 100% !important;
  height: 100% !important;
  border-radius: .75rem;
  display: block;
}
