/* JS Graph Libraries — elevated dark theme */

@import url("https://fonts.googleapis.com/css2?family=Outfit:wght@400;500;600;700&family=Source+Serif+4:opsz,wght@8..60,500;8..60,600&display=swap");

:root {
  --bg: #0a0c10;
  --bg-elevated: #12151c;
  --bg-card: #151922;
  --bg-card-hover: #1a1f2b;
  --border: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.14);
  --text: #f4f6f8;
  --text-muted: rgba(244, 246, 248, 0.68);
  --text-faint: rgba(244, 246, 248, 0.45);
  --accent: #e8b84a;
  --accent-hover: #f0c65c;
  --accent-soft: rgba(232, 184, 74, 0.14);
  --accent-line: rgba(232, 184, 74, 0.35);
  --header-bg: rgba(10, 12, 16, 0.82);
  --radius: 12px;
  --radius-sm: 8px;
  --font-sans: "Outfit", system-ui, sans-serif;
  --font-display: "Source Serif 4", Georgia, serif;
  --shadow-card: 0 1px 0 rgba(255, 255, 255, 0.04) inset,
    0 12px 32px rgba(0, 0, 0, 0.35);
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

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

html {
  scroll-behavior: smooth;
}

body.site-body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  font-family: var(--font-sans);
  background-color: var(--bg);
  background-image:
    radial-gradient(
      ellipse 90% 55% at 50% -15%,
      rgba(232, 184, 74, 0.09),
      transparent 55%
    ),
    radial-gradient(
      ellipse 50% 40% at 100% 20%,
      rgba(80, 140, 180, 0.06),
      transparent 50%
    ),
    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: auto, auto, 48px 48px, 48px 48px;
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
}

/* —— Header —— */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--header-bg);
  backdrop-filter: blur(14px) saturate(1.2);
  -webkit-backdrop-filter: blur(14px) saturate(1.2);
  border-bottom: 1px solid var(--border);
  box-shadow: none;
}

.site-header .container {
  padding-top: 0.85rem;
  padding-bottom: 0.85rem;
}

.site-logo {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  font-family: var(--font-sans);
  font-size: 1.05rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--text) !important;
  text-decoration: none;
  transition: color 0.2s var(--ease);
}

.site-logo__mark {
  display: inline-flex;
  width: 2.15rem;
  height: 2.15rem;
  color: var(--accent);
  flex-shrink: 0;
  border-radius: 0.55rem;
  overflow: hidden;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.1),
    0 4px 14px rgba(0, 0, 0, 0.35);
  transition: transform 0.28s var(--ease), box-shadow 0.28s var(--ease);
}

.site-logo__mark svg {
  width: 100%;
  height: 100%;
  display: block;
}

.site-logo__bar {
  transform-box: fill-box;
  transform-origin: bottom;
  transition: transform 0.35s var(--ease);
}

.site-logo__text {
  font-size: 1.12rem;
  letter-spacing: -0.03em;
}

.site-logo__text span {
  color: var(--accent);
  font-weight: 700;
}

.site-logo:hover {
  color: var(--text) !important;
}

.site-logo:hover .site-logo__mark {
  transform: translateY(-2px) scale(1.04);
  box-shadow: 0 0 0 1px var(--accent-line), 0 10px 22px rgba(232, 184, 74, 0.22);
}

.site-logo:hover .site-logo__bar {
  transform: scaleY(1.1);
}

.site-logo__bar:nth-child(4) {
  transition-delay: 0s;
}
.site-logo__bar:nth-child(5) {
  transition-delay: 0.04s;
}
.site-logo__bar:nth-child(6) {
  transition-delay: 0.08s;
}
.site-logo__bar:nth-child(7) {
  transition-delay: 0.12s;
}

.site-logo:hover .site-logo__text span {
  color: var(--accent-hover);
}

.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.5rem 1rem;
  background: var(--accent) !important;
  color: #12110c !important;
  font-weight: 600;
  font-size: 0.875rem;
  border-radius: var(--radius-sm) !important;
  border: none;
  text-decoration: none;
  transition: background 0.2s var(--ease), transform 0.2s var(--ease),
    box-shadow 0.2s var(--ease);
  box-shadow: 0 0 0 0 transparent;
}

.btn-primary:hover {
  background: var(--accent-hover) !important;
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(232, 184, 74, 0.25);
}

.btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.5rem 1rem;
  background: transparent !important;
  color: var(--text-muted) !important;
  font-weight: 500;
  font-size: 0.875rem;
  border-radius: var(--radius-sm) !important;
  border: 1px solid var(--border-strong) !important;
  text-decoration: none;
  transition: color 0.2s var(--ease), border-color 0.2s var(--ease),
    background 0.2s var(--ease);
}

.btn-secondary:hover {
  color: var(--text) !important;
  border-color: rgba(255, 255, 255, 0.28) !important;
  background: rgba(255, 255, 255, 0.04) !important;
}

/* —— Hero —— */
.site-hero {
  position: relative;
  text-align: center;
  padding: 4.5rem 1rem 3.5rem;
  border-bottom: 1px solid var(--border);
  overflow: hidden;
}

.site-hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(
    180deg,
    transparent 60%,
    var(--bg) 100%
  );
  pointer-events: none;
}

.site-hero .container {
  position: relative;
  z-index: 1;
}

.hero-mark {
  width: 3.5rem;
  height: 3.5rem;
  margin: 0 auto 1.25rem;
  color: var(--accent);
  animation: hero-mark-in 0.8s var(--ease) both;
}

.hero-mark svg {
  width: 100%;
  height: 100%;
  stroke-dasharray: 80;
  stroke-dashoffset: 80;
  animation: draw-line 1.2s var(--ease) 0.2s forwards;
}

@keyframes draw-line {
  to {
    stroke-dashoffset: 0;
  }
}

@keyframes hero-mark-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.site-hero h1 {
  font-family: var(--font-display);
  font-size: clamp(2.25rem, 5vw, 3.25rem);
  font-weight: 600;
  letter-spacing: -0.03em;
  line-height: 1.15;
  margin: 0 0 0.75rem;
  color: var(--text);
  animation: hero-mark-in 0.8s var(--ease) 0.1s both;
}

.site-hero .hero-lead {
  font-size: clamp(1.1rem, 2.5vw, 1.35rem);
  font-weight: 500;
  color: var(--text-muted);
  max-width: 28rem;
  margin: 0 auto;
  animation: hero-mark-in 0.8s var(--ease) 0.2s both;
}

.site-hero .hero-sub {
  font-size: 1rem;
  line-height: 1.65;
  color: var(--text-faint);
  max-width: 34rem;
  margin: 1.25rem auto 0;
  animation: hero-mark-in 0.8s var(--ease) 0.3s both;
}

/* —— Library cards —— */
.library-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
}

@media (min-width: 768px) {
  .library-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 1.15rem;
  }
}

@media (min-width: 1024px) {
  .library-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

.library-card {
  position: relative;
  display: block;
  background: var(--bg-card) !important;
  border: 1px solid var(--border) !important;
  border-radius: var(--radius) !important;
  padding: 1.25rem !important;
  text-decoration: none;
  color: inherit;
  box-shadow: var(--shadow-card);
  transition: transform 0.25s var(--ease), border-color 0.25s var(--ease),
    background 0.25s var(--ease), box-shadow 0.25s var(--ease);
}

.library-card::after {
  content: "";
  position: absolute;
  left: 1.25rem;
  right: 1.25rem;
  bottom: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--accent), transparent 70%);
  opacity: 0;
  transform: scaleX(0.6);
  transform-origin: left;
  transition: opacity 0.25s var(--ease), transform 0.25s var(--ease);
}

.library-card:hover {
  transform: translateY(-3px);
  background: var(--bg-card-hover) !important;
  border-color: var(--border-strong) !important;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.05) inset,
    0 18px 40px rgba(0, 0, 0, 0.45);
}

.library-card:hover::after {
  opacity: 1;
  transform: scaleX(1);
}

.library-card h2 {
  font-family: var(--font-sans);
  font-size: 1.2rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  margin: 0 0 0.35rem;
  color: var(--text);
}

.library-card > p {
  color: var(--text-muted) !important;
  line-height: 1.45;
}

.library-card .feature-label {
  font-size: 0.65rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-faint) !important;
}

.feature-tag {
  display: inline-block;
  padding: 0.2rem 0.55rem;
  background: rgba(255, 255, 255, 0.04) !important;
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 0.7rem;
  color: var(--text-muted) !important;
  transition: border-color 0.2s var(--ease), background 0.2s var(--ease);
}

.library-card:hover .feature-tag {
  border-color: var(--accent-line);
  background: var(--accent-soft) !important;
}

.sponsored-badge {
  position: absolute;
  top: 0;
  right: 0;
  background: var(--accent) !important;
  color: #12110c !important;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 0.35rem 0.65rem;
  border-radius: 0 var(--radius) 0 var(--radius-sm);
}

/* —— Page content (detail / utility pages) —— */
.page-hero {
  padding: 3rem 0 2.5rem;
  border-bottom: 1px solid var(--border);
}

.page-hero.page-hero--flush {
  border-bottom: none;
  padding-top: 1.5rem;
  padding-bottom: 0.5rem;
}

.page-hero h1 {
  font-family: var(--font-display);
  font-size: clamp(2rem, 4vw, 2.75rem);
  font-weight: 600;
  letter-spacing: -0.03em;
  margin: 0 0 0.75rem;
}

.content-panel {
  background: var(--bg-card) !important;
  border: 1px solid var(--border);
  border-radius: var(--radius) !important;
  box-shadow: var(--shadow-card);
  padding: 1.5rem !important;
  margin-bottom: 1.5rem;
}

.content-panel h2 {
  font-family: var(--font-sans);
  font-weight: 600;
  letter-spacing: -0.02em;
}

/* —— Form pages (advertise / submit) —— */
@media (max-width: 639px) {
  .form-page.container {
    padding-left: 0.75rem;
    padding-right: 0.75rem;
  }

  .form-page .form-panel.content-panel {
    padding: 1rem !important;
  }

  .form-page .page-hero h1 {
    font-size: clamp(1.75rem, 8vw, 2.25rem);
  }
}

.site-form__input {
  display: block;
  width: 100%;
  box-sizing: border-box;
  margin: 0;
  padding: 0.7rem 0.85rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: rgba(0, 0, 0, 0.35);
  color: #fff;
  font: inherit;
  line-height: 1.4;
  -webkit-appearance: none;
  appearance: none;
}

.site-form__input::placeholder {
  color: var(--text-faint);
}

.site-form__input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(232, 184, 74, 0.25);
}

.site-form__submit {
  display: block;
  width: 100%;
  box-sizing: border-box;
  margin: 0;
  padding: 0.75rem 1rem;
  border: none;
  border-radius: var(--radius-sm);
  background: var(--accent);
  color: #111;
  font-family: var(--font-sans);
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s var(--ease);
}

.site-form__submit:hover {
  background: var(--accent-hover);
}

.site-form__submit:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.site-form__submit:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.back-link {
  color: var(--accent) !important;
  font-weight: 500;
  text-decoration: none;
  transition: color 0.2s var(--ease);
}

.back-link:hover {
  color: var(--accent-hover) !important;
}

a.text-yellow-500,
a[class*="text-yellow"] {
  color: var(--accent) !important;
}

a.text-yellow-500:hover,
a[class*="text-yellow"]:hover {
  color: var(--accent-hover) !important;
}

/* —— Footer —— */
.site-footer {
  background: var(--bg-elevated) !important;
  border-top: 1px solid var(--border);
  margin-top: 2rem;
  box-shadow: none !important;
}

.site-footer h2 {
  font-family: var(--font-display);
  font-size: 1.35rem;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.site-footer a {
  transition: color 0.2s var(--ease);
}

/* —— Homepage filters —— */
.filter-bar {
  border-bottom: 1px solid var(--border);
  background: rgba(10, 12, 16, 0.55);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  position: sticky;
  top: 57px;
  z-index: 40;
}

.filter-bar__inner {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  padding: 1rem 0 1.1rem;
}

.filter-search {
  position: relative;
  display: block;
  max-width: 28rem;
}

.filter-search__icon {
  position: absolute;
  left: 0.85rem;
  top: 50%;
  width: 1rem;
  height: 1rem;
  transform: translateY(-50%);
  color: var(--text-faint);
  pointer-events: none;
}

.filter-search input {
  width: 100%;
  box-sizing: border-box;
  padding: 0.7rem 0.9rem 0.7rem 2.4rem;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--bg-card);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 0.95rem;
  outline: none;
  transition: border-color 0.2s var(--ease), box-shadow 0.2s var(--ease);
}

.filter-search input::placeholder {
  color: var(--text-faint);
}

.filter-search input:focus {
  border-color: var(--accent-line);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.filter-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.filter-chip {
  appearance: none;
  border: 1px solid var(--border-strong);
  background: transparent;
  color: var(--text-muted);
  font-family: var(--font-sans);
  font-size: 0.8rem;
  font-weight: 500;
  padding: 0.4rem 0.75rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: color 0.2s var(--ease), border-color 0.2s var(--ease),
    background 0.2s var(--ease);
}

.filter-chip:hover {
  color: var(--text);
  border-color: rgba(255, 255, 255, 0.28);
  background: rgba(255, 255, 255, 0.04);
}

.filter-chip.is-active {
  color: #12110c;
  background: var(--accent);
  border-color: var(--accent);
}

.filter-count {
  margin: 0;
  font-size: 0.85rem;
  color: var(--text-faint);
}

.filter-empty {
  text-align: center;
  color: var(--text-muted);
  padding: 3rem 1rem;
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius);
  margin-bottom: 1.5rem;
}

.library-card.is-hidden {
  display: none !important;
}

/* —— Chart examples —— */
.chart-examples-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.25rem;
}

@media (min-width: 768px) {
  .chart-examples-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

.chart-example {
  background: rgba(0, 0, 0, 0.28);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 1rem;
  min-height: 0;
}

.chart-example h3 {
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-faint);
  margin: 0 0 0.75rem;
}

.chart-frame {
  position: relative;
  width: 100%;
  min-height: 240px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.chart-frame canvas,
.chart-frame svg {
  max-width: 100%;
}

.chart-frame .plotly-graph-div,
.chart-frame > div {
  width: 100% !important;
}

.chart-frame--tall {
  min-height: 280px;
}

/* —— Example code —— */
.example-code__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.75rem;
}

.example-code__header h2 {
  margin: 0;
}

.copy-code-btn {
  flex-shrink: 0;
  font-family: var(--font-sans);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text);
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.4rem 0.75rem;
  cursor: pointer;
  transition: background 0.15s var(--ease), border-color 0.15s var(--ease),
    color 0.15s var(--ease);
}

.copy-code-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: var(--border-strong);
  color: #fff;
}

.copy-code-btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.example-code__pre {
  margin: 0;
  padding: 1rem 1.15rem;
  overflow-x: auto;
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.8125rem;
  line-height: 1.55;
}

.example-code__pre code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas,
    "Liberation Mono", "Courier New", monospace;
  color: var(--text);
  background: none;
  padding: 0;
  white-space: pre;
}

@media (prefers-reduced-motion: reduce) {
  .hero-mark,
  .hero-mark svg,
  .site-hero h1,
  .site-hero .hero-lead,
  .site-hero .hero-sub,
  .library-card,
  .btn-primary {
    animation: none !important;
    transition: none !important;
  }

  .hero-mark svg {
    stroke-dashoffset: 0;
  }

  .library-card:hover {
    transform: none;
  }
}
