/* Chip variants */
.chip.ok {
  background: rgba(var(--ok-rgb, 61, 214, 140), 0.2);
  border-color: rgba(var(--ok-rgb, 61, 214, 140), 0.4);
  color: var(--ok);
}

/* Favorite button on cards */
.fav-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  background: none;
  border: none;
  font-size: 20px;
  line-height: 1;
  padding: 0;
  cursor: pointer;
  color: var(--muted);
  transition: color var(--tr-fast, 0.2s ease);
}
.fav-btn.active {
  color: var(--brand-2);
}
.fav-btn:hover {
  color: var(--brand-3);
}

/* Breadcrumb navigation */
.breadcrumb {
  font-size: 14px;
  color: var(--muted);
  margin-bottom: 12px;
}
.breadcrumb a {
  color: var(--brand-2);
  text-decoration: none;
}
.breadcrumb span {
  color: var(--txt);
}
.breadcrumb a:hover {
  text-decoration: underline;
}

/* Copy code button inside pre blocks */
.copy-btn {
  position: absolute;
  top: 4px;
  right: 4px;
  font-size: 12px;
  padding: 4px 6px;
  background: var(--panel-2);
  border: 1px solid var(--glass-bd);
  border-radius: 4px;
  color: var(--txt);
  cursor: pointer;
  z-index: 10;
  transition: background var(--tr-fast, 0.2s ease), color var(--tr-fast, 0.2s ease);
}
.copy-btn:hover {
  background: var(--panel);
}

/* Offline/online indicator */
#offline-indicator.online {
  background: #65b566;
}
#offline-indicator.offline {
  background: #d86e6e;
}

/* Back to top button in article */
#art-back-top {
  display: block;
  margin: 20px auto 0;
  padding: 6px 12px;
  font-size: 14px;
}

/* KB filter styles */
.kb-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}

/* Knowledge base layout with sidebar */
.kb-container {
  display: flex;
  gap: 24px;
}

/* Sidebar for categories */
.kb-sidebar {
  width: 220px;
  flex-shrink: 0;
}
.kb-sidebar ul {
  list-style: none;
  margin: 0;
  padding: 0;
}
.kb-sidebar li {
  margin: 4px 0;
}
.kb-sidebar li button {
  width: 100%;
  text-align: left;
  border: none;
  background: none;
  padding: 6px 10px;
  border-radius: 6px;
  color: var(--txt);
  cursor: pointer;
  transition: background var(--tr-fast, 0.2s ease), color var(--tr-fast, 0.2s ease);
}
.kb-sidebar li button.active {
  background: var(--brand-2);
  color: #fff;
}
.kb-sidebar li button:hover {
  background: var(--panel-2);
}

/* Main area in KB when using sidebar */
.kb-main {
  flex: 1;
  min-width: 0;
}

/* Suggestions dropdown under search */
.kb-suggestions {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  width: 100%;
  max-height: 240px;
  overflow-y: auto;
  border: 1px solid var(--glass-bd);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
  z-index: 100;
  display: none;
}
.kb-suggestions .suggestion {
  padding: 8px 12px;
  cursor: pointer;
  transition: background var(--tr-fast, 0.2s ease);
}
.kb-suggestions .suggestion:hover,
.kb-suggestions .suggestion:focus {
  background: var(--panel-2);
}

@media (max-width: 900px) {
  /* Stack KB sidebar below search on small screens */
  .kb-container {
    flex-direction: column;
  }
  .kb-sidebar {
    display: flex;
    overflow-x: auto;
    margin-bottom: 12px;
    width: auto;
  }
  .kb-sidebar ul {
    display: flex;
    gap: 8px;
  }
  .kb-sidebar li button {
    white-space: nowrap;
  }
}
.kb-filters .chip {
  cursor: pointer;
  user-select: none;
}
.kb-filters .chip.active {
  background: var(--brand-2);
  border-color: var(--brand-2);
  color: #fff;
}

/* Theme toggle (uses existing btn classes) */
#theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  padding: 6px 10px;
}

/* Series detail page */
.series-detail {
  display: flex;
  flex-direction: column;
  gap: 20px;
  padding-top: clamp(32px, 6vw, 64px);
}
.series-detail h2 {
  font-size: clamp(28px, 4.5vw, 48px);
  font-weight: 700;
  margin: 0 0 12px;
  color: var(--txt);
}
.series-detail .meta {
  font-size: 14px;
  color: var(--muted);
  margin-bottom: 8px;
}
.series-detail p.desc {
  font-size: 16px;
  line-height: 1.6;
  max-width: 700px;
  color: var(--muted);
}
.series-detail .video-embed {
  position: relative;
  width: 100%;
  padding-top: 56.25%; /* 16:9 aspect */
  border-radius: var(--rad-md);
  overflow: hidden;
  box-shadow: var(--shadow);
}
.series-detail .video-embed iframe {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border: none;
}
.series-detail .actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 12px;
}
.series-detail .chapters {
  margin-top: 20px;
}
.series-detail .chapters h3 {
  margin: 0 0 8px;
  font-size: 20px;
  font-weight: 600;
}
.series-detail .chapters ul {
  list-style: none;
  padding: 0;
  margin: 0;
}
.series-detail .chapters li {
  margin-bottom: 4px;
  font-size: 14px;
  color: var(--muted);
}

/* clickable fix */
.card::before,.card::after{pointer-events:none}
.card a,.card .btn{position:relative;z-index:2}


/* --- Aurora polish: cards, buttons, focus, nav --- */
.btn.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 14px 36px rgba(255,110,199,.33); }
.btn.btn-primary:active { transform: translateY(0); box-shadow: 0 8px 20px rgba(255,110,199,.22); }
.btn.btn-ghost { border-color: rgba(214,179,255,.35); }
.btn.btn-ghost:hover { background: rgba(214,179,255,.08); }

.card { 
  background: linear-gradient(180deg, rgba(18,26,41,.95), rgba(18,26,41,.88));
  border: 1px solid rgba(214,179,255,.18);
  backdrop-filter: saturate(140%) blur(8px);
}
.card .ic { color: var(--brand-2); }

a:focus-visible, button:focus-visible {
  outline: 2px solid rgba(214,179,255,.9);
  outline-offset: 2px;
  border-radius: 8px;
}

#nav a.active { 
  color: var(--txt);
  background: linear-gradient(95deg, rgba(214,179,255,.16), rgba(255,110,199,.12));
  border-color: rgba(214,179,255,.35);
}



/* --- High-end polish --- */
.btn.btn-primary {
  position: relative;
  overflow: hidden;
  border: 1px solid color-mix(in oklab, var(--aurora-right) 38%, transparent);
}
.btn.btn-primary::after {
  content: "";
  position: absolute;
  inset: -220% -30% -220% -30%;
  background: linear-gradient(115deg, transparent, rgba(255,255,255,.45), transparent);
  transform: translateX(-35%);
  animation: sheen 3.7s ease-in-out infinite;
  mix-blend-mode: screen;
}
@keyframes sheen { to { transform: translateX(135%); } }

.card {
  transition: transform .35s cubic-bezier(.2,.65,.2,1), box-shadow .35s ease, border-color .35s ease;
  border: 1px solid color-mix(in oklab, var(--aurora-mid) 28%, transparent);
  box-shadow: 0 8px 36px rgba(0,0,0,.35), 0 0 0 1px rgba(255,255,255,.03) inset;
}
.card:hover {
  transform: translateY(-4px);
  box-shadow: 0 16px 48px rgba(0,0,0,.45), 0 0 0 1px rgba(255,255,255,.06) inset;
  border-color: color-mix(in oklab, var(--aurora-right) 45%, transparent);
}
.card .ic { color: color-mix(in oklab, var(--aurora-right) 65%, var(--txt) 35%); }

.hdr {
  backdrop-filter: saturate(120%) blur(10px);
  box-shadow: 0 1px 0 color-mix(in oklab, var(--aurora-mid) 20%, transparent) inset, 0 6px 24px rgba(0,0,0,.35);
}

/* Active nav item */
#nav a.active {
  background: linear-gradient(95deg, color-mix(in oklab, var(--aurora-mid) 18%, transparent), color-mix(in oklab, var(--aurora-right) 12%, transparent));
  border-color: color-mix(in oklab, var(--aurora-right) 28%, transparent);
}

/* Terminal tint to match palette */
.terminal .prompt { color: color-mix(in oklab, var(--aurora-left) 85%, white 15%); }
.terminal .path { color: color-mix(in oklab, var(--aurora-right) 70%, white 30%); }

/* Respect reduced motion */
@media (prefers-reduced-motion: reduce) {
  .btn.btn-primary::after { display: none; }
  .card { transition: none; }
}



/* Review-cleanup: breadcrumbs are intentionally hidden in the product shell. */
/* Hide breadcrumbs globally to preserve the established portal behavior. */
.breadcrumb,
.breadcrumbs,
nav.breadcrumb {
  display: none !important;
  visibility: hidden !important;
  height: 0 !important;
  margin: 0 !important;
  padding: 0 !important;
}

/* ===== Premium visual polish: components ===== */
.panel,
.card,
.metric,
.team-card,
.adv-card,
.stat-card,
.testimonial-card,
.term,
.settings-group,
.toc {
  background:
    linear-gradient(180deg, color-mix(in oklab, var(--surface-1) 96%, rgba(255,255,255,.04) 4%), color-mix(in oklab, var(--surface-3) 100%, transparent));
  border: 1px solid var(--line-soft);
  box-shadow: var(--shadow-soft), var(--shadow-line);
}

.card {
  padding: var(--card-pad);
  border-radius: 24px;
}

.card::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(180deg, rgba(255,255,255,.05), transparent 26%);
  pointer-events: none;
  opacity: .55;
}

.card > * {
  position: relative;
  z-index: 1;
}

.card:hover,
.card:focus-within,
.card:focus-visible {
  transform: translateY(-2px);
  border-color: var(--line-strong);
  box-shadow: var(--shadow-lift), var(--shadow-line);
}

.ic {
  width: 50px;
  height: 50px;
  border-radius: 15px;
  margin-bottom: 18px;
  background: linear-gradient(180deg, color-mix(in oklab, var(--surface-2) 92%, #fff 8%), color-mix(in oklab, var(--surface-3) 100%, transparent));
  box-shadow: var(--shadow-line);
}

.card h3 {
  margin-bottom: 10px;
  font-size: clamp(18px, 2.2vw, 24px);
  line-height: 1.25;
}

.card p,
.card .muted {
  color: var(--text-soft);
}

.actions {
  flex-direction: row;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 18px;
}

.tag,
.chip {
  background: color-mix(in oklab, var(--surface-2) 88%, transparent);
  border-color: var(--line-soft);
  color: color-mix(in oklab, var(--txt) 82%, var(--muted) 18%);
}

.fav-btn {
  top: 14px;
  right: 14px;
  width: 36px;
  height: 36px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  background: color-mix(in oklab, var(--surface-2) 94%, transparent);
  border: 1px solid var(--line-soft);
  box-shadow: var(--shadow-line);
}

.fav-btn.active {
  color: color-mix(in oklab, var(--brand-3) 78%, white 22%);
}

.kb-sidebar li button {
  border: 1px solid transparent;
  min-height: 40px;
}

.kb-sidebar li button.active {
  background: linear-gradient(135deg, color-mix(in oklab, var(--brand-1) 26%, transparent), color-mix(in oklab, var(--brand-3) 18%, transparent));
  color: var(--txt);
  border-color: color-mix(in oklab, var(--brand-1) 30%, transparent);
}

dialog.modal {
  border-radius: 24px;
  background: color-mix(in oklab, var(--surface-1) 96%, rgba(12,18,30,.9) 4%);
}

.m-hdr {
  padding-block: 16px;
  background: linear-gradient(180deg, color-mix(in oklab, var(--surface-2) 96%, rgba(255,255,255,.04) 4%), color-mix(in oklab, var(--surface-3) 100%, transparent));
}

.m-body {
  padding: clamp(18px, 2.8vw, 28px);
}

#art-content {
  max-width: var(--content-measure-narrow);
  margin: 0 auto;
}

#art-content p,
.m-body ul,
.m-body ol {
  color: var(--text-soft);
  line-height: 1.82;
}

#art-content h2,
#art-content h3 {
  max-width: 24ch;
}

.m-body pre {
  border-radius: 16px;
  background: color-mix(in oklab, var(--surface-3) 94%, #05070d 6%);
}

.term {
  border-radius: 24px;
}

.term .inner {
  padding: 22px;
}

#toast-container {
  bottom: 24px;
  right: 24px;
}

.toast {
  border-radius: 14px;
  border: 1px solid var(--line-soft);
  box-shadow: var(--shadow-soft);
}

.runtime-fatal{padding:24px;border:1px solid rgba(255,110,199,.22);background:rgba(16,20,33,.92)}
.runtime-fatal code{font-family:ui-monospace,Consolas,monospace}


/* ===== Production polish pass: card alignment and favorites ===== */
.card.card-relative {
  padding-top: calc(var(--card-pad) + 8px);
}

.fav-btn {
  top: 18px;
  right: 18px;
  z-index: 3;
}

#series-grid .card,
.kb-grid .card,
.discover-shell + .page .card,
.page .grid.g-3 .card {
  justify-content: flex-start;
}

#series-grid .actions,
.kb-grid .actions,
.page .grid.g-3 .actions {
  margin-top: auto;
}

#series-grid .chip.ok,
#series-grid .chip {
  align-self: flex-start;
}

/* ===== Pass 8: favorites and card rhythm ===== */
.fav-btn {
  top: 16px;
  right: 16px;
  width: 28px;
  height: 28px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: color-mix(in oklab, var(--surface-2) 78%, transparent);
  border: 1px solid var(--line-soft);
  box-shadow: var(--shadow-line);
}

.fav-btn:hover {
  background: color-mix(in oklab, var(--surface-1) 86%, transparent);
}

.card .actions {
  gap: 10px;
}

/* ===== Pass 9: calmer motion, cleaner buttons, steadier cards ===== */
.btn.btn-primary,
.btn-primary {
  box-shadow: 0 10px 24px rgba(121, 100, 214, .18);
}

.btn.btn-primary::after {
  display: none;
}

.btn.btn-primary:hover,
.btn.btn-primary:focus-visible,
.btn-primary:hover,
.btn-primary:focus-visible,
.btn-ghost:hover,
.btn-ghost:focus-visible {
  transform: none;
  box-shadow: 0 12px 28px rgba(18, 24, 40, .22);
}

.card {
  transition: border-color .22s ease, box-shadow .22s ease, background .22s ease;
  box-shadow: 0 8px 24px rgba(0,0,0,.22), 0 0 0 1px rgba(255,255,255,.02) inset;
}

.card:hover {
  transform: none;
  box-shadow: 0 12px 30px rgba(0,0,0,.28), 0 0 0 1px rgba(255,255,255,.03) inset;
}

.fav-btn {
  top: 14px;
  right: 14px;
  width: 30px;
  height: 30px;
  font-size: 16px;
  background: color-mix(in oklab, var(--surface-2) 88%, transparent);
}


/* ===== Pass 17: favorites micro-position polish ===== */
#series-grid .fav-btn,
.kb-grid .fav-btn {
  top: 10px;
  right: 12px;
}

#series-grid .card.card-relative,
.kb-grid .card.card-relative {
  padding-top: calc(var(--card-pad) + 2px);
}


/* ===== Pass 18: micro polish for favorites and controls ===== */
.fav-btn {
  transition: background .18s ease, color .18s ease, border-color .18s ease;
}

#series-grid .fav-btn,
.kb-grid .fav-btn {
  width: 32px;
  height: 32px;
  font-size: 17px;
}

#series-grid .card.card-relative,
.kb-grid .card.card-relative {
  min-height: 100%;
}

dialog.modal {
  margin: auto;
}


/* ===== Pass 35: remove perpetual sheen on ready-state buttons ===== */
.btn.btn-primary::after {
  animation: none !important;
  opacity: 0 !important;
}
