/* Kraybazaar help — Cascade Index (cx-)
   Sticky TOC + scrollable article stream + side contact panel.
   Independent of helix-/zx-/a70 help systems. */

.page-help.cx-cascade {
  --cx-ink: #14241f;
  --cx-mute: #5a6b63;
  --cx-ice: #f3f7f5;
  --cx-paper: #fbfdfc;
  --cx-teal: #0f8f7f;
  --cx-apricot: #ef7a3a;
  --cx-line: rgba(20, 36, 31, 0.12);
  --cx-display: "Red Hat Display", "Segoe UI", sans-serif;
  --cx-sans: "Red Hat Text", "Segoe UI", sans-serif;
  --cx-ease: cubic-bezier(0.22, 1, 0.36, 1);
}

body.a70-body.page-help.cx-cascade {
  background:
    radial-gradient(80% 50% at 0% 0%, rgba(15, 143, 127, 0.12), transparent 55%),
    linear-gradient(180deg, var(--cx-paper) 0%, var(--cx-ice) 100%);
  color: var(--cx-ink);
  font-family: var(--cx-sans);
}

.cx-world {
  width: min(1180px, calc(100% - 2rem));
  margin: 0 auto;
  padding: 1.5rem 0 3.5rem;
}

.cx-mast {
  display: grid;
  gap: 1rem;
  margin-bottom: 1.5rem;
  animation: cx-rise 0.7s var(--cx-ease) both;
}

.cx-kicker {
  margin: 0 0 0.4rem;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--cx-mute);
}

.cx-mast h1 {
  margin: 0 0 0.45rem;
  font-family: var(--cx-display);
  font-size: clamp(2rem, 5vw, 3.2rem);
  letter-spacing: -0.03em;
  line-height: 1.05;
}

.cx-lede {
  margin: 0;
  max-width: 46ch;
  color: var(--cx-mute);
  line-height: 1.5;
}

.cx-search {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.45rem;
  max-width: 40rem;
  padding: 0.4rem;
  background: rgba(255, 255, 255, 0.85);
  border: 1px solid var(--cx-line);
  box-shadow: 0 12px 28px rgba(20, 36, 31, 0.06);
}

.cx-search input {
  min-height: 2.7rem;
  padding: 0.55rem 0.85rem;
  border: 0;
  background: transparent;
  font: inherit;
  color: var(--cx-ink);
}

.cx-search input:focus {
  outline: none;
}

.cx-search button,
.cx-btn {
  min-height: 2.7rem;
  padding: 0.55rem 1.15rem;
  border: 0;
  background: var(--cx-teal);
  color: #fff;
  font: inherit;
  font-size: 0.88rem;
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s var(--cx-ease), transform 0.2s var(--cx-ease);
}

.cx-search button:hover,
.cx-btn:hover {
  background: var(--cx-ink);
  transform: translateY(-1px);
}

.cx-search-meta {
  margin: 0;
  font-size: 0.86rem;
  color: var(--cx-mute);
  font-weight: 600;
}

.cx-layout {
  display: grid;
  grid-template-columns: 15.5rem minmax(0, 1fr) 15.5rem;
  gap: 1rem;
  align-items: start;
  min-height: 62vh;
}

.cx-toc {
  position: sticky;
  top: 1rem;
  display: grid;
  gap: 0.35rem;
  padding: 0.85rem;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid var(--cx-line);
}

.cx-toc-label {
  margin: 0 0 0.35rem;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--cx-mute);
}

.cx-toc-item {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 0.55rem;
  align-items: center;
  width: 100%;
  padding: 0.65rem 0.55rem;
  border: 1px solid transparent;
  background: transparent;
  color: inherit;
  text-align: left;
  font: inherit;
  cursor: pointer;
  opacity: 0;
  transform: translateX(-8px);
  animation: cx-rise 0.45s var(--cx-ease) calc(var(--i) * 0.05s) both;
  transition: border-color 0.2s var(--cx-ease), background 0.2s var(--cx-ease), transform 0.2s var(--cx-ease);
}

.cx-toc-item:hover,
.cx-toc-item.is-on {
  background: #fff;
  border-color: var(--cx-teal);
  transform: translateX(2px);
}

.cx-toc-ix {
  font-family: var(--cx-display);
  font-size: 0.85rem;
  color: var(--cx-teal);
}

.cx-toc-text {
  display: grid;
  gap: 0.1rem;
  min-width: 0;
}

.cx-toc-text strong {
  font-size: 0.9rem;
}

.cx-toc-text small {
  color: var(--cx-mute);
  font-size: 0.72rem;
  line-height: 1.3;
}

.cx-toc-count {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--cx-apricot);
}

.cx-toc-contact {
  margin-top: 0.45rem;
  padding: 0.7rem 0.75rem;
  background: var(--cx-ink);
  color: #fff;
  text-align: center;
  text-decoration: none;
  font-weight: 700;
  font-size: 0.86rem;
  transition: background 0.2s var(--cx-ease);
}

.cx-toc-contact:hover {
  background: var(--cx-teal);
}

.cx-stream {
  position: relative;
  max-height: min(70vh, 760px);
  overflow: auto;
  padding: 0.25rem 0.85rem 0.25rem 0.35rem;
  scroll-behavior: smooth;
  display: grid;
  gap: 0.55rem;
  align-content: start;
}

.cx-progress {
  position: sticky;
  top: 0;
  z-index: 2;
  width: 3px;
  height: 100%;
  float: left;
  margin-left: -0.35rem;
  background: rgba(20, 36, 31, 0.08);
  pointer-events: none;
}

.cx-progress-fill {
  width: 100%;
  height: 100%;
  background: linear-gradient(180deg, var(--cx-teal), var(--cx-apricot));
  transform-origin: top;
  transform: scaleY(0);
  transition: transform 0.15s linear;
}

.cx-article {
  background: rgba(255, 255, 255, 0.82);
  border: 1px solid var(--cx-line);
  clip-path: polygon(0 0, 100% 0, 100% 88%, 97% 100%, 0 100%);
  transition: border-color 0.22s var(--cx-ease), transform 0.22s var(--cx-ease);
}

.cx-article:hover {
  border-color: rgba(15, 143, 127, 0.45);
}

.cx-article.is-open {
  border-color: var(--cx-teal);
  transform: translateY(-1px);
}

.cx-article-face {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 0.75rem;
  align-items: center;
  width: 100%;
  padding: 0.95rem 1rem;
  border: 0;
  background: transparent;
  color: inherit;
  text-align: left;
  font: inherit;
  cursor: pointer;
}

.cx-article-meta {
  display: grid;
  gap: 0.25rem;
  justify-items: start;
}

.cx-article-num {
  font-family: var(--cx-display);
  font-size: 0.95rem;
  color: var(--cx-teal);
}

.cx-article-tag {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--cx-mute);
}

.cx-article-q {
  font-family: var(--cx-display);
  font-size: 1.02rem;
  line-height: 1.3;
  font-weight: 700;
}

.cx-article-chev {
  width: 1.35rem;
  height: 1.35rem;
  border: 1.5px solid var(--cx-ink);
  position: relative;
  transition: transform 0.25s var(--cx-ease), background 0.25s var(--cx-ease), border-color 0.25s var(--cx-ease);
}

.cx-article-chev::before,
.cx-article-chev::after {
  content: "";
  position: absolute;
  background: var(--cx-ink);
  transition: transform 0.25s var(--cx-ease), background 0.25s var(--cx-ease);
}

.cx-article-chev::before {
  width: 0.55rem;
  height: 1.5px;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
}

.cx-article-chev::after {
  width: 1.5px;
  height: 0.55rem;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
}

.cx-article.is-open .cx-article-chev {
  background: var(--cx-teal);
  border-color: var(--cx-teal);
  transform: rotate(90deg);
}

.cx-article.is-open .cx-article-chev::before,
.cx-article.is-open .cx-article-chev::after {
  background: #fff;
}

.cx-article.is-open .cx-article-chev::after {
  transform: translate(-50%, -50%) scaleY(0);
}

.cx-article-body {
  padding: 0 1rem 1rem 4.2rem;
}

.cx-article-a {
  color: var(--cx-mute);
  line-height: 1.55;
  font-size: 0.95rem;
}

.cx-article-a a {
  color: var(--cx-teal);
  font-weight: 700;
}

.cx-empty {
  margin: 1rem 0;
  padding: 1rem;
  background: rgba(239, 122, 58, 0.1);
  border: 1px dashed var(--cx-apricot);
  color: var(--cx-ink);
  font-weight: 600;
}

.cx-side {
  position: sticky;
  top: 1rem;
  padding: 1.15rem 1.1rem 1.25rem;
  background: var(--cx-ink);
  color: #e8f2ee;
  clip-path: polygon(0 0, 100% 0, 100% 92%, 88% 100%, 0 100%);
}

.cx-side .cx-kicker {
  color: rgba(232, 242, 238, 0.55);
}

.cx-side h2 {
  margin: 0 0 0.45rem;
  font-family: var(--cx-display);
  font-size: 1.35rem;
  color: #fff;
}

.cx-side p {
  margin: 0 0 0.9rem;
  color: rgba(232, 242, 238, 0.72);
  font-size: 0.9rem;
  line-height: 1.45;
}

.cx-side .cx-btn {
  width: 100%;
  background: var(--cx-apricot);
  color: #fff;
  margin-bottom: 0.65rem;
}

.cx-side .cx-btn:hover {
  background: var(--cx-teal);
}

.cx-mail {
  display: block;
  margin-bottom: 0.45rem;
  color: #9fe8dc;
  text-decoration: none;
  font-size: 0.86rem;
  font-weight: 600;
  word-break: break-all;
}

.cx-hours {
  margin: 0 0 1rem !important;
  font-size: 0.8rem !important;
}

.cx-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.4rem;
  margin: 0;
}

.cx-stats div {
  text-align: center;
  padding: 0.45rem 0.2rem;
  background: rgba(255, 255, 255, 0.06);
}

.cx-stats dt {
  font-family: var(--cx-display);
  font-size: 1rem;
  color: #fff;
}

.cx-stats dd {
  margin: 0.15rem 0 0;
  font-size: 0.65rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: rgba(232, 242, 238, 0.55);
}

@keyframes cx-rise {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: none; }
}

@media (max-width: 980px) {
  .cx-layout {
    grid-template-columns: 1fr;
  }

  .cx-toc,
  .cx-side {
    position: static;
  }

  .cx-stream {
    max-height: none;
    overflow: visible;
    padding-right: 0;
  }

  .cx-progress {
    display: none;
  }

  .cx-article-body {
    padding-left: 1rem;
  }
}

@media (max-width: 640px) {
  .cx-search {
    grid-template-columns: 1fr;
  }

  .cx-article-face {
    grid-template-columns: 1fr auto;
  }

  .cx-article-meta {
    grid-column: 1 / -1;
    grid-auto-flow: column;
    justify-content: start;
    gap: 0.55rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .cx-mast,
  .cx-toc-item,
  .cx-article,
  .cx-search button,
  .cx-btn {
    animation: none !important;
    transition: none !important;
  }
}
