/* ============================================================
   Ceeprinto — Documentation page (template-docs.php)
   Uses the theme tokens from theme.css (:root). Enqueued only on
   the Documentation template (init/docs.php).
   ============================================================ */

.cee-docs {
  --docs-offset: 96px;               /* sticky header height + breathing room */
  --docs-code-bg: var(--dark-bg, #1A1916);
  --docs-code-ink: #F2EEE6;
  --docs-radius: 12px;
  --docs-get: #14784A;
  --docs-post: #1F5FBF;
  --docs-put: #A86200;
  --docs-delete: #C0231F;
  min-width: 0;
}
.admin-bar .cee-docs { --docs-offset: 128px; }
.cee-header-static .cee-docs { --docs-offset: 24px; }
.admin-bar.cee-header-static .cee-docs { --docs-offset: 56px; }

.cee-docs .screen-reader-text {
  position: absolute !important;
  width: 1px; height: 1px;
  overflow: hidden;
  clip: rect(1px, 1px, 1px, 1px);
  clip-path: inset(50%);
  white-space: nowrap;
}

/* ── Top bar ─────────────────────────────────────────────────── */
.cee-docs__top {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px 24px;
  margin: 0 0 32px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--line);
}
.cee-docs__heading .cee-entry__title { margin: 0 0 14px; }
.cee-docs__pills { display: flex; flex-wrap: wrap; gap: 8px; }
.cee-docs__pill {
  display: inline-flex;
  align-items: center;
  padding: 7px 16px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--ink);
  font-size: 14px;
  font-weight: 600;
}
.cee-docs__pill:hover { border-color: var(--ink); opacity: 1; }

.cee-docs__ai-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 16px;
}
.cee-docs__machine-links { display: inline-flex; flex-wrap: wrap; gap: 6px 14px; font-size: 13px; }
.cee-docs__machine-links a {
  color: var(--ink-2);
  font-family: var(--mono);
  text-decoration: underline;
  text-underline-offset: 3px;
}
.cee-docs__machine-links a:hover { color: var(--accent-ink); }

/* ── Layout ──────────────────────────────────────────────────── */
.cee-docs__layout {
  display: grid;
  grid-template-columns: 270px minmax(0, 1fr);
  gap: 40px;
  align-items: start;
}
.cee-docs__body { min-width: 0; display: flex; flex-direction: column; gap: 20px; }

/* ── Sidebar nav ─────────────────────────────────────────────── */
.cee-docs__sidebar {
  position: sticky;
  top: var(--docs-offset);
  max-height: calc(100vh - var(--docs-offset) - 16px);
  overflow-y: auto;
  overscroll-behavior: contain;
  padding-right: 6px;
  scrollbar-width: thin;
}
.cee-docs__nav-toggle { display: none; }

.cee-docs__search {
  position: relative;
  margin: 0 0 20px;
}
.cee-docs__search .fa-magnifying-glass {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  font-size: 13px;
  pointer-events: none;
}
.cee-docs__search input {
  width: 100%;
  padding: 11px 14px 11px 36px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  color: var(--ink);
  font: 14px/1.3 var(--body);
}
.cee-docs__search input:focus { outline: 2px solid var(--ink); outline-offset: 1px; border-color: var(--ink); }

.cee-docs__nav-cat { margin: 0 0 22px; }
.cee-docs__nav-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 15px;
  letter-spacing: -0.01em;
  margin: 0 0 8px;
}
.cee-docs__nav-title a { color: var(--ink); }
.cee-docs__nav-group { margin: 0 0 12px; }
.cee-docs__nav-label {
  margin: 0 0 4px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}
.cee-docs__nav ul { list-style: none; margin: 0; padding: 0; }
.cee-docs__nav li { margin: 0; }
.cee-docs__nav [data-nav] {
  display: block;
  padding: 5px 10px;
  margin-left: -10px;
  border-left: 2px solid transparent;
  border-radius: 0 6px 6px 0;
  color: var(--ink-2);
  font-size: 14px;
  line-height: 1.35;
}
.cee-docs__nav [data-nav]:hover { color: var(--ink); background: rgba(0, 0, 0, 0.03); opacity: 1; }
.cee-docs__nav [data-nav].is-active {
  color: var(--ink);
  font-weight: 600;
  border-left-color: var(--accent);
  background: rgba(255, 16, 12, 0.05);
}

/* ── Copy buttons ────────────────────────────────────────────── */
.cee-docs-copy:not(.cee-btn) {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
  padding: 6px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--ink);
  font: 600 12px/1 var(--body);
  cursor: pointer;
  white-space: nowrap;
  transition: border-color 120ms ease, background 120ms ease;
}
.cee-docs-copy:not(.cee-btn):hover { border-color: var(--ink); }
.cee-docs-copy.is-copied { border-color: var(--good) !important; color: var(--good) !important; }
.cee-docs-copy.is-copied.cee-btn { background: var(--good); color: #fff !important; }
.cee-docs-copy--mini:not(.cee-btn) { padding: 4px 9px; font-size: 11px; color: var(--ink-2); }
.cee-docs-copy--prompt::before,
.cee-docs__section-head .cee-docs-copy::before,
.cee-docs__cat-head .cee-docs-copy::before {
  content: "\f544"; /* fa-robot */
  font-family: "Font Awesome 6 Free";
  font-weight: 900;
  font-size: 11px;
}
.cee-docs-copy:focus-visible,
.cee-docs-examples__tab:focus-visible,
.cee-docs__nav [data-nav]:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }

/* ── Category headers & sections ─────────────────────────────── */
.cee-docs__cat { display: flex; flex-direction: column; gap: 20px; }
.cee-docs__cat + .cee-docs__cat { margin-top: 28px; }
.cee-docs__cat-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 6px 16px;
}
.cee-docs__category {
  font-size: clamp(26px, 3vw, 36px);
  margin: 0;
  scroll-margin-top: var(--docs-offset);
}
.cee-docs__cat-desc { margin: 0; color: var(--ink-2); font-size: 14px; flex: 1 1 240px; }

.cee-docs__section {
  scroll-margin-top: var(--docs-offset);
  padding: 28px 32px;
  min-width: 0;
}
.cee-docs__section-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}
.cee-docs__eyebrow {
  margin: 0 0 4px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}
.cee-docs__section .cee-card__title { font-size: clamp(22px, 2.4vw, 28px); margin: 0 0 6px; }
.cee-docs__anchor { color: inherit; }
.cee-docs__anchor:hover { opacity: 1; text-decoration: underline; text-underline-offset: 4px; text-decoration-thickness: 1px; }
.cee-docs__section > .cee-card__sub { font-size: 15px; margin-bottom: 22px; }

.cee-docs.is-searching .is-hidden,
.cee-docs .is-hidden { display: none !important; }

/* ── Section content typography ──────────────────────────────── */
.cee-docs__content {
  font-size: 15.5px;
  line-height: 1.7;
  color: var(--ink);
  min-width: 0;
}
.cee-docs__content > :last-child { margin-bottom: 0; }
.cee-docs__content h3 {
  font-size: 20px;
  margin: 1.8em 0 0.6em;
  scroll-margin-top: var(--docs-offset);
}
.cee-docs__content h4 { font-size: 16px; margin: 1.5em 0 0.5em; letter-spacing: -0.01em; }
.cee-docs__content > h3:first-child,
.cee-docs__content > h4:first-child { margin-top: 0; }
.cee-docs__content p { margin: 0 0 1em; }
.cee-docs__content ul,
.cee-docs__content ol { padding-left: 1.4em; margin: 0 0 1em; }
.cee-docs__content li { margin-bottom: 0.35em; }
.cee-docs__content a { color: var(--accent-ink); text-decoration: underline; text-underline-offset: 3px; }
.cee-docs__content :not(pre) > code {
  background: rgba(0, 0, 0, 0.055);
  border-radius: 4px;
  padding: 1px 6px;
  font-family: var(--mono);
  font-size: 0.88em;
  overflow-wrap: anywhere;
}
.cee-docs__content blockquote {
  margin: 1.2em 0;
  padding: 10px 18px;
  border-left: 3px solid var(--line);
  color: var(--ink-2);
}
.cee-docs__lead { font-size: 17px; color: var(--ink); margin: 0 0 1.2em; }
.cee-docs .cee-inline-notice { font-size: 14px; }
.cee-docs .cee-inline-notice__body { min-width: 0; }
.cee-docs .cee-inline-notice--warning { border-left-color: #C98A00; background: rgba(201, 138, 0, 0.08); color: var(--ink); }
.cee-docs__empty { margin: 0; }
.cee-docs__empty[hidden] { display: none; }

.cee-docs kbd {
  display: inline-block;
  min-width: 1.6em;
  padding: 1px 7px;
  border: 1px solid var(--line);
  border-bottom-width: 2px;
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  font: 600 0.82em/1.5 var(--mono);
  text-align: center;
  white-space: nowrap;
}

.cee-docs mark {
  background: rgba(255, 16, 12, 0.16);
  color: inherit;
  border-radius: 3px;
  padding: 0 1px;
}

/* ── Code blocks ─────────────────────────────────────────────── */
.cee-docs-code {
  margin: 1em 0 1.3em;
  border-radius: var(--docs-radius);
  background: var(--docs-code-bg);
  overflow: hidden;
  min-width: 0;
}
.cee-docs-code__bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 10px 8px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  color: rgba(242, 238, 230, 0.65);
  font: 500 12px/1.2 var(--mono);
}
.cee-docs-code__bar .cee-docs-copy {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.14);
  color: var(--docs-code-ink);
}
.cee-docs-code__bar .cee-docs-copy:hover { border-color: rgba(255, 255, 255, 0.5); }
.cee-docs-code__bar .cee-docs-copy.is-copied { color: #7fd6a9 !important; border-color: #7fd6a9 !important; }
.cee-docs-code pre {
  margin: 0;
  padding: 16px 18px;
  overflow-x: auto;
  background: transparent;
  color: var(--docs-code-ink);
  font: 13.5px/1.6 var(--mono);
  tab-size: 2;
  white-space: pre;
  border-radius: 0;
}
.cee-docs-code code {
  background: none;
  padding: 0;
  font: inherit;
  color: inherit;
  white-space: inherit;
}

/* ── Example tabs ────────────────────────────────────────────── */
.cee-docs-examples {
  margin: 1em 0 1.3em;
  border-radius: var(--docs-radius);
  background: var(--docs-code-bg);
  overflow: hidden;
}
.cee-docs-examples__tabs {
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 6px 8px 0;
  overflow-x: auto;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  scrollbar-width: none;
}
.cee-docs-examples__title {
  margin-right: auto;
  padding: 0 8px 6px;
  color: rgba(242, 238, 230, 0.55);
  font: 500 12px/1 var(--mono);
  white-space: nowrap;
}
.cee-docs-examples__tab {
  padding: 8px 12px 9px;
  border: 0;
  border-bottom: 2px solid transparent;
  background: none;
  color: rgba(242, 238, 230, 0.6);
  font: 600 12.5px/1 var(--body);
  cursor: pointer;
  white-space: nowrap;
}
.cee-docs-examples__tab:hover { color: var(--docs-code-ink); }
.cee-docs-examples__tab.is-active,
.cee-docs-examples__tab[aria-selected="true"] { color: #fff; border-bottom-color: var(--accent); }
.cee-docs-examples__panel .cee-docs-code { margin: 0; border-radius: 0; }
.cee-docs-examples__panel .cee-docs-code__bar { border-bottom: 0; padding-top: 6px; padding-bottom: 0; }

/* ── Tables ──────────────────────────────────────────────────── */
.cee-docs-table {
  margin: 0.6em 0 1.3em;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 10px;
  -webkit-overflow-scrolling: touch;
}
.cee-docs-table table { width: 100%; border-collapse: collapse; font-size: 14px; line-height: 1.5; }
.cee-docs-table caption {
  caption-side: top;
  text-align: left;
  padding: 10px 14px;
  font-weight: 600;
  color: var(--ink-2);
  border-bottom: 1px solid var(--line);
}
.cee-docs-table th,
.cee-docs-table td { padding: 9px 14px; text-align: left; vertical-align: top; border-bottom: 1px solid var(--line); }
.cee-docs-table th { background: var(--bg); font-weight: 600; font-size: 12.5px; color: var(--ink-2); white-space: nowrap; }
.cee-docs-table tr:last-child td { border-bottom: 0; }
.cee-docs-table td code { white-space: nowrap; }

/* ── Endpoint cards ──────────────────────────────────────────── */
.cee-docs-endpoint {
  margin: 1.4em 0;
  padding: 20px 22px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--bg);
  scroll-margin-top: var(--docs-offset);
  min-width: 0;
}
.cee-docs-endpoint__head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
  margin-bottom: 10px;
}
.cee-docs-endpoint__title {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 !important;
  font-size: 16px !important;
  min-width: 0;
  flex: 1 1 260px;
}
.cee-docs-endpoint__path {
  background: none !important;
  padding: 0 !important;
  font: 600 15px/1.3 var(--mono) !important;
  color: var(--ink);
  overflow-wrap: anywhere;
}
.cee-docs-endpoint__meta { display: flex; flex-wrap: wrap; gap: 6px; list-style: none; margin: 0 !important; padding: 0 !important; }
.cee-docs-endpoint__meta li { margin: 0; }
.cee-docs-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--ink-2);
  font-size: 12px;
  line-height: 1.5;
}
.cee-docs-chip code { background: none !important; padding: 0 !important; color: var(--ink); }
.cee-docs-endpoint__summary { margin: 0 0 0.8em; }
.cee-docs-endpoint h4 { font-size: 14px; margin: 1.1em 0 0.4em; color: var(--ink-2); text-transform: uppercase; letter-spacing: 0.06em; }
.cee-docs-endpoint .cee-docs-table { background: #fff; }
.cee-docs-endpoint__notes { margin-bottom: 0 !important; }

.cee-docs-method {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 58px;
  padding: 4px 8px;
  border-radius: 6px;
  color: #fff;
  font: 700 11.5px/1 var(--mono);
  letter-spacing: 0.04em;
  flex-shrink: 0;
}
.cee-docs-method--get { background: var(--docs-get); }
.cee-docs-method--post { background: var(--docs-post); }
.cee-docs-method--put,
.cee-docs-method--patch { background: var(--docs-put); }
.cee-docs-method--delete { background: var(--docs-delete); }
.cee-docs-method--head,
.cee-docs-method--options { background: var(--ink-2); }

/* ── AI box ──────────────────────────────────────────────────── */
.cee-docs-ai {
  margin: 1.6em 0 0.4em;
  padding: 16px 20px;
  border: 1px solid rgba(255, 16, 12, 0.22);
  border-left: 3px solid var(--accent);
  border-radius: 10px;
  background: rgba(255, 16, 12, 0.035);
  font-size: 14px;
}
.cee-docs-ai h4 {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 8px !important;
  font-size: 13px !important;
  font-family: var(--body);
  font-weight: 600;
  letter-spacing: 0.06em !important;
  text-transform: uppercase;
  color: var(--accent-ink);
}
.cee-docs-ai ul { margin: 0 !important; padding-left: 1.2em !important; }
.cee-docs-ai li { margin-bottom: 0.3em; }

/* ── Steps ───────────────────────────────────────────────────── */
.cee-docs-steps {
  list-style: none;
  counter-reset: cee-step;
  margin: 1em 0 1.3em !important;
  padding: 0 !important;
}
.cee-docs-steps__item {
  position: relative;
  counter-increment: cee-step;
  padding: 0 0 18px 46px;
  margin: 0 !important;
  min-width: 0;
}
.cee-docs-steps__item::before {
  content: counter(cee-step);
  position: absolute;
  left: 0;
  top: 0;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--ink);
  color: #fff;
  font: 600 13px/30px var(--display);
  text-align: center;
}
.cee-docs-steps__item:not(:last-child)::after {
  content: "";
  position: absolute;
  left: 14px;
  top: 36px;
  bottom: 6px;
  width: 2px;
  background: var(--line);
}
.cee-docs-steps__title { margin: 4px 0 6px !important; font-size: 16px !important; }
.cee-docs-steps__body { min-width: 0; }
.cee-docs-steps__body > :last-child { margin-bottom: 0; }

/* ── Figures ─────────────────────────────────────────────────── */
.cee-docs-figure { margin: 1.2em 0 1.4em; }
.cee-docs-figure img {
  border: 1px solid var(--line);
  border-radius: 10px;
  max-width: 100%;
  height: auto;
}
.cee-docs-figure figcaption { margin-top: 8px; font-size: 13px; color: var(--ink-2); }

/* ── Manual-copy fallback dialog ─────────────────────────────── */
.cee-docs-copybox {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(14, 14, 12, 0.5);
}
.cee-docs-copybox__panel {
  width: min(720px, 100%);
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 18px;
  border-radius: 14px;
  background: #fff;
}
.cee-docs-copybox__panel p { margin: 0; font-size: 14px; color: var(--ink-2); }
.cee-docs-copybox textarea {
  width: 100%;
  min-height: 300px;
  flex: 1;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  font: 12.5px/1.5 var(--mono);
  resize: vertical;
}
.cee-docs-copybox__panel .cee-btn { align-self: flex-end; }

/* ── Responsive ──────────────────────────────────────────────── */
@media (max-width: 900px) {
  .cee-docs__layout { grid-template-columns: minmax(0, 1fr); gap: 20px; }
  .cee-docs__sidebar {
    position: sticky;
    top: calc(var(--docs-offset) - 24px);
    z-index: 5;
    max-height: none;
    overflow: visible;
    padding: 0;
  }
  .cee-docs__nav-toggle { display: inline-flex; width: 100%; justify-content: center; }
  .cee-docs__nav {
    display: none;
    margin-top: 8px;
    padding: 16px;
    max-height: calc(100vh - var(--docs-offset) - 60px);
    overflow-y: auto;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: #fff;
    box-shadow: 0 12px 32px rgba(14, 14, 12, 0.12);
  }
  .cee-docs__sidebar.is-open .cee-docs__nav { display: block; }
  .cee-docs__section { padding: 22px 18px; }
  .cee-docs__top { align-items: flex-start; }
}

@media (max-width: 600px) {
  .cee-container--wide.cee-docs { padding-left: 16px; padding-right: 16px; }
  .cee-docs__section-head { flex-direction: column; gap: 8px; }
  .cee-docs-endpoint { padding: 16px 14px; }
  .cee-docs-code pre { padding: 14px; font-size: 12.5px; }
  .cee-docs-steps__item { padding-left: 40px; }
  .cee-docs__ai-toolbar .cee-btn { width: 100%; justify-content: center; }
}

@media (max-width: 420px) {
  .cee-docs__section { padding: 18px 16px; }
}

@media print {
  .cee-docs__sidebar,
  .cee-docs__ai-toolbar,
  .cee-docs-copy,
  .cee-docs-examples__tabs { display: none !important; }
  .cee-docs__layout { display: block; }
  .cee-docs-examples__panel[hidden] { display: block !important; }
}
