/* Derby Documentation — docs.css */

/* ── Light Theme Variables ── */
[data-theme="light"] {
  --bg-primary: #f8fafc;
  --bg-secondary: #f1f5f9;
  --bg-card: #ffffff;
  --bg-card-hover: #f8fafc;
  --text-primary: #1e293b;
  --text-secondary: #475569;
  --text-muted: #94a3b8;
  --border: #e2e8f0;
  --accent: #3b82f6;
  --accent-hover: #2563eb;
  --accent-subtle: rgba(59, 130, 246, 0.1);
  --shadow: 0 4px 24px rgba(0, 0, 0, 0.08);
}

[data-theme="light"] .site-header {
  background: rgba(248, 250, 252, 0.92);
}

[data-theme="light"] .download-banner {
  box-shadow: 0 4px 20px rgba(79, 140, 255, 0.2);
}

[data-theme="light"] .promo-card {
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

/* ── Theme Toggle ── */
.theme-toggle {
  position: fixed;
  top: 16px;
  right: 24px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--bg-card);
  border: 1px solid var(--border);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  transition: all 0.3s ease;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
  z-index: 9999;
}

.theme-toggle:hover {
  transform: scale(1.1);
  border-color: var(--accent);
}

.theme-toggle .icon-sun,
.theme-toggle .icon-moon {
  position: absolute;
  transition: all 0.3s ease;
}

/* Show destination (what you'll switch TO), not current state */
/* In dark mode: show sun (click to go light) */
/* In light mode: show moon (click to go dark) */
.theme-toggle .icon-sun {
  opacity: 1;
  transform: rotate(0) scale(1);
}

.theme-toggle .icon-moon {
  opacity: 0;
  transform: rotate(90deg) scale(0);
}

[data-theme="light"] .theme-toggle .icon-sun {
  opacity: 0;
  transform: rotate(-90deg) scale(0);
}

[data-theme="light"] .theme-toggle .icon-moon {
  opacity: 1;
  transform: rotate(0) scale(1);
}

/* ── Docs Layout ── */
.docs-layout {
  display: flex;
  min-height: calc(100vh - 64px);
  padding-top: 64px;
}

/* ── Sidebar ── */
.docs-sidebar {
  width: 280px;
  flex-shrink: 0;
  background: var(--bg-secondary);
  border-right: 1px solid var(--border);
  padding: 24px;
  position: sticky;
  top: 64px;
  height: calc(100vh - 64px);
  overflow-y: auto;
}

.docs-search {
  margin-bottom: 24px;
}

.docs-search input {
  width: 100%;
  padding: 10px 14px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text-primary);
  font-size: 0.9rem;
  transition: border-color var(--transition);
}

.docs-search input:focus {
  outline: none;
  border-color: var(--accent);
}

.docs-search input::placeholder {
  color: var(--text-muted);
}

/* ── Search Results Dropdown ── */
.docs-search {
  position: relative;
}

.search-results {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: var(--shadow);
  margin-top: 4px;
  max-height: 400px;
  overflow-y: auto;
  z-index: 100;
}

.search-results-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.search-result-item {
  border-bottom: 1px solid var(--border);
}

.search-result-item:last-child {
  border-bottom: none;
}

.search-result-item a {
  display: block;
  padding: 12px 16px;
  text-decoration: none;
  transition: background 0.15s ease;
}

.search-result-item a:hover,
.search-result-item.active a {
  background: var(--accent-subtle);
}

.search-result-category {
  display: block;
  font-size: 0.7rem;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 4px;
}

.search-result-title {
  display: block;
  font-weight: 600;
  color: var(--text-primary);
  font-size: 0.9rem;
  margin-bottom: 4px;
}

.search-result-desc {
  display: block;
  font-size: 0.8rem;
  color: var(--text-secondary);
  line-height: 1.4;
}

.search-no-results {
  padding: 16px;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.docs-nav-section {
  margin-bottom: 28px;
}

.docs-nav-section h4 {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin-bottom: 12px;
}

.docs-nav-section ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.docs-nav-section ul li {
  margin-bottom: 4px;
}

.docs-nav-section ul li a {
  display: block;
  padding: 8px 12px;
  color: var(--text-secondary);
  font-size: 0.9rem;
  border-radius: 6px;
  transition: all var(--transition);
}

.docs-nav-section ul li a:hover {
  color: var(--text-primary);
  background: var(--bg-card);
}

.docs-nav-section ul li a.active {
  color: var(--accent);
  background: var(--accent-subtle);
}

/* ── Main Content ── */
.docs-content {
  flex: 1;
  padding: 48px;
  max-width: 900px;
}

.docs-header {
  margin-bottom: 48px;
}

.docs-header h1 {
  font-size: 2.4rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  margin-bottom: 12px;
}

.docs-header p {
  color: var(--text-secondary);
  font-size: 1.1rem;
}

/* ── Cards Grid ── */
.docs-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 20px;
  margin-bottom: 48px;
}

.docs-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 28px;
  text-decoration: none;
  color: inherit;
  transition: all var(--transition);
}

.docs-card:hover {
  background: var(--bg-card-hover);
  border-color: rgba(79, 140, 255, 0.3);
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}

.docs-card-icon {
  font-size: 2rem;
  margin-bottom: 16px;
}

.docs-card h3 {
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 8px;
  color: var(--text-primary);
}

.docs-card p {
  color: var(--text-secondary);
  font-size: 0.9rem;
  line-height: 1.5;
}

/* ── Sections ── */
.docs-section {
  margin-bottom: 48px;
}

.docs-section h2 {
  font-size: 1.4rem;
  font-weight: 700;
  margin-bottom: 20px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}

/* ── Topic List ── */
.docs-topic-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.docs-topic-list a {
  display: block;
  padding: 12px 16px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text-secondary);
  font-size: 0.95rem;
  transition: all var(--transition);
}

.docs-topic-list a:hover {
  color: var(--accent);
  border-color: var(--accent);
  background: var(--accent-subtle);
}

.docs-topic-list a::before {
  content: "\2192";
  margin-right: 12px;
  color: var(--accent);
}

/* ── Tier Grid ── */
.docs-tier-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
}

.docs-tier {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
}

.docs-tier h4 {
  font-size: 0.95rem;
  font-weight: 600;
  margin-bottom: 12px;
  color: var(--accent);
}

.docs-tier ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.docs-tier ul li {
  padding: 6px 0;
  border-bottom: 1px solid var(--border);
}

.docs-tier ul li:last-child {
  border-bottom: none;
}

.docs-tier ul li a {
  color: var(--text-secondary);
  font-size: 0.9rem;
}

.docs-tier ul li a:hover {
  color: var(--accent);
}

/* ── Help Section ── */
.docs-help {
  text-align: center;
  padding: 40px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}

.docs-help h2 {
  border-bottom: none;
  padding-bottom: 0;
}

.docs-help p {
  color: var(--text-secondary);
  margin-bottom: 20px;
}

.docs-help-options {
  display: flex;
  gap: 12px;
  justify-content: center;
}

/* ── Article Pages ── */
.docs-article {
  max-width: 720px;
}

.docs-article h1 {
  font-size: 2rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  margin-bottom: 16px;
}

.docs-article .docs-meta {
  color: var(--text-muted);
  font-size: 0.85rem;
  margin-bottom: 32px;
}

.docs-article h2 {
  font-size: 1.4rem;
  font-weight: 700;
  margin-top: 40px;
  margin-bottom: 16px;
}

.docs-article h3 {
  font-size: 1.15rem;
  font-weight: 600;
  margin-top: 32px;
  margin-bottom: 12px;
}

.docs-article p {
  color: var(--text-secondary);
  font-size: 0.95rem;
  line-height: 1.7;
  margin-bottom: 16px;
}

.docs-article ul,
.docs-article ol {
  margin-bottom: 20px;
  padding-left: 24px;
}

.docs-article ul li,
.docs-article ol li {
  color: var(--text-secondary);
  font-size: 0.95rem;
  line-height: 1.7;
  margin-bottom: 8px;
}

.docs-article img {
  max-width: 100%;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  margin: 24px 0;
}

.docs-article code {
  background: var(--bg-card);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 0.9em;
  color: var(--accent);
}

.docs-article pre {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 20px;
  overflow-x: auto;
  margin: 20px 0;
}

.docs-article pre code {
  background: none;
  padding: 0;
  color: var(--text-secondary);
}

/* ── Callout Boxes ── */
.docs-callout {
  padding: 16px 20px;
  border-radius: var(--radius);
  margin: 20px 0;
  border-left: 4px solid;
}

.docs-callout-title {
  font-weight: 600;
  font-size: 0.9rem;
  margin-bottom: 8px;
}

.docs-callout p {
  margin-bottom: 0;
  font-size: 0.9rem;
}

.docs-callout.tip {
  background: rgba(52, 211, 153, 0.1);
  border-color: var(--success);
}

.docs-callout.tip .docs-callout-title {
  color: var(--success);
}

.docs-callout.warning {
  background: rgba(251, 191, 36, 0.1);
  border-color: var(--warning);
}

.docs-callout.warning .docs-callout-title {
  color: var(--warning);
}

.docs-callout.info {
  background: rgba(79, 140, 255, 0.1);
  border-color: var(--accent);
}

.docs-callout.info .docs-callout-title {
  color: var(--accent);
}

/* ── Steps ── */
.docs-steps {
  counter-reset: step;
  margin: 24px 0;
}

.docs-step {
  position: relative;
  padding-left: 48px;
  margin-bottom: 24px;
}

.docs-step::before {
  counter-increment: step;
  content: counter(step);
  position: absolute;
  left: 0;
  top: 0;
  width: 32px;
  height: 32px;
  background: var(--accent);
  color: #fff;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.9rem;
}

.docs-step h4 {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 8px;
}

.docs-step p {
  margin-bottom: 12px;
}

/* ── Breadcrumb ── */
.docs-breadcrumb {
  margin-bottom: 24px;
  font-size: 0.85rem;
}

.docs-breadcrumb a {
  color: var(--text-muted);
}

.docs-breadcrumb span {
  color: var(--text-muted);
  margin: 0 8px;
}

.docs-breadcrumb .current {
  color: var(--text-secondary);
}

/* ── Navigation Footer ── */
.docs-nav-footer {
  display: flex;
  justify-content: space-between;
  margin-top: 48px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
}

.docs-nav-link {
  display: flex;
  flex-direction: column;
  padding: 16px 20px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  text-decoration: none;
  transition: all var(--transition);
  max-width: 45%;
}

.docs-nav-link:hover {
  border-color: var(--accent);
  background: var(--accent-subtle);
}

.docs-nav-link.prev {
  align-items: flex-start;
}

.docs-nav-link.next {
  align-items: flex-end;
  margin-left: auto;
}

.docs-nav-link-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 4px;
}

.docs-nav-link-title {
  color: var(--accent);
  font-weight: 600;
}

/* ── Download Banner ── */
.download-banner {
  background: linear-gradient(135deg, #4f8cff 0%, #7c3aed 50%, #ec4899 100%);
  background-size: 200% 200%;
  animation: gradient-shift 3s ease infinite;
  padding: 12px 24px;
  border-radius: var(--radius);
  margin-bottom: 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  box-shadow: 0 4px 20px rgba(79, 140, 255, 0.3);
}

@keyframes gradient-shift {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

.download-banner-content {
  display: flex;
  align-items: center;
  gap: 12px;
}

.download-banner-icon {
  font-size: 1.5rem;
  animation: pulse-icon 2s ease-in-out infinite;
}

@keyframes pulse-icon {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.15); }
}

.download-banner-text {
  color: #fff;
}

.download-banner-text strong {
  display: block;
  font-size: 1rem;
  font-weight: 700;
}

.download-banner-text span {
  font-size: 0.85rem;
  opacity: 0.9;
}

.download-banner .btn {
  background: #fff;
  color: #4f8cff;
  font-weight: 600;
  padding: 10px 20px;
  border-radius: 6px;
  text-decoration: none;
  transition: all 0.2s;
  white-space: nowrap;
  animation: btn-glow 2s ease-in-out infinite;
}

.download-banner .btn:hover {
  transform: scale(1.05);
  box-shadow: 0 4px 12px rgba(255, 255, 255, 0.4);
}

@keyframes btn-glow {
  0%, 100% { box-shadow: 0 0 5px rgba(255, 255, 255, 0.5); }
  50% { box-shadow: 0 0 20px rgba(255, 255, 255, 0.8); }
}

/* ── Right Sidebar Stack with Carousel Effect ── */
.docs-right-sidebar {
  width: 280px;
  flex-shrink: 0;
  padding: 24px 24px 24px 0;
  position: sticky;
  top: 88px;
  height: fit-content;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.promo-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  text-decoration: none;
  display: block;
  transition: all 0.4s ease;
  animation: card-cycle 21s infinite;
}

/* Staggered highlight animation for 7 cards (3s each) */
.promo-card:nth-child(1) { animation-delay: 0s; }
.promo-card:nth-child(2) { animation-delay: 3s; }
.promo-card:nth-child(3) { animation-delay: 6s; }
.promo-card:nth-child(4) { animation-delay: 9s; }
.promo-card:nth-child(5) { animation-delay: 12s; }
.promo-card:nth-child(6) { animation-delay: 15s; }
.promo-card:nth-child(7) { animation-delay: 18s; }

@keyframes card-cycle {
  0%, 3% {
    transform: translateX(0) scale(1);
    opacity: 0.7;
    border-color: var(--border);
  }
  5%, 12% {
    transform: translateX(-8px) scale(1.02);
    opacity: 1;
    border-color: var(--accent);
    box-shadow: 0 8px 30px rgba(79, 140, 255, 0.15);
  }
  14.28%, 100% {
    transform: translateX(0) scale(1);
    opacity: 0.7;
    border-color: var(--border);
    box-shadow: none;
  }
}

.promo-card:hover {
  animation-play-state: paused;
  transform: translateX(-8px) scale(1.02) !important;
  opacity: 1 !important;
  border-color: var(--accent) !important;
  background: var(--bg-card-hover);
}

.promo-card-icon {
  font-size: 2rem;
  margin-bottom: 12px;
  display: block;
}

.promo-card-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 8px;
  line-height: 1.3;
}

.promo-card-text {
  font-size: 0.85rem;
  color: var(--text-secondary);
  line-height: 1.5;
  margin-bottom: 12px;
}

.promo-card-link {
  font-size: 0.8rem;
  color: var(--accent);
  font-weight: 600;
}

.promo-card-link::after {
  content: " →";
}

/* Card accent colors on highlight */
.promo-card.qr { border-left: 4px solid #10b981; }
.promo-card.speed { border-left: 4px solid #f59e0b; }
.promo-card.fair { border-left: 4px solid #8b5cf6; }
.promo-card.scales { border-left: 4px solid #ef4444; }
.promo-card.presenter { border-left: 4px solid #06b6d4; }
.promo-card.quickstart { border-left: 4px solid #f97316; }
.promo-card.streaming { border-left: 4px solid #ec4899; }

/* ── Responsive ── */
@media (max-width: 1024px) {
  .docs-tier-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 900px) {
  .docs-layout {
    flex-direction: column;
  }

  .docs-sidebar {
    width: 100%;
    position: relative;
    top: 0;
    height: auto;
    border-right: none;
    border-bottom: 1px solid var(--border);
  }

  .docs-content {
    padding: 32px 24px;
  }

  .docs-cards {
    grid-template-columns: 1fr;
  }

  .docs-nav-footer {
    flex-direction: column;
    gap: 12px;
  }

  .docs-nav-link {
    max-width: 100%;
  }

  .download-banner {
    flex-direction: column;
    text-align: center;
    padding: 16px;
  }

  .download-banner-content {
    flex-direction: column;
  }

  .docs-right-sidebar {
    display: none;
  }
}
