/* ============================================================
   WELLBELOVE.ORG — Docs Layout Stylesheet
   ============================================================ */

.docs-layout {
  --sidebar-w: 280px;
  --sidebar-w-sm: 260px;
  --transition-speed: 0.25s;
  --transition-fn: cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  padding-top: var(--nav-h);
}

/* ── SIDEBAR ────────────────────────────────────────────────── */
.docs-sidebar {
  width: var(--sidebar-w);
  min-width: var(--sidebar-w);
  background: var(--s1);
  border-right: 1px solid var(--rule);
  overflow-y: auto;
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
  scrollbar-width: none;
  position: fixed;
  top: var(--nav-h);
  left: 0;
  height: calc(100vh - var(--nav-h));
  z-index: 160;
  transition: transform var(--transition-speed) var(--transition-fn);
}
.docs-sidebar::-webkit-scrollbar { display: none; }
.docs-sidebar.collapsed { transform: translateX(-100%); }

/* ── BACK-TO-PROJECTS LINK ──────────────────────────────────── */
.docs-back-link {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 14px 20px 6px;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--dim);
  text-decoration: none;
  transition: color 0.15s;
}
.docs-back-link:hover { color: var(--accent); }
.docs-back-arrow { font-size: 12px; }

/* ── SIDEBAR HEADER (genre + project title) ─────────────────── */
.docs-sidebar-header {
  padding: 16px 20px 10px;
  border-bottom: 1px solid var(--rule);
  margin-bottom: 8px;
}
.docs-sidebar-genre {
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 500;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 6px;
}
.docs-sidebar-title {
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 700;
  color: var(--ink);
  line-height: 1.3;
}

/* ── SEARCH ─────────────────────────────────────────────────── */
.docs-search {
  padding: 8px 12px 12px 20px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 8px;
}
.docs-search-input {
  width: 100%;
  background: var(--s2);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 300;
  padding: 8px 12px 8px 32px;
  outline: none;
  transition: border-color 0.15s, background 0.15s;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%23555' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='8'/%3E%3Cline x1='21' y1='21' x2='16.65' y2='16.65'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: 10px center;
}
.docs-search-input:focus {
  border-color: var(--accent);
  background-color: var(--bg);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%23c8f557' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='8'/%3E%3Cline x1='21' y1='21' x2='16.65' y2='16.65'/%3E%3C/svg%3E");
}
.docs-search-input::placeholder { color: var(--dim); }

/* ── NAV ────────────────────────────────────────────────────── */
.docs-nav { padding: 0 0 32px; flex: 1; }

.docs-nav-sections {
  list-style: none;
  margin: 0;
  padding: 0;
}
.docs-nav-sections a {
  display: block;
  padding: 7px 20px;
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 300;
  color: var(--muted);
  text-decoration: none;
  border-left: 2px solid transparent;
  transition: color 0.15s, background 0.15s, border-left-color 0.15s;
  line-height: 1.5;
}
.docs-nav-sections a:hover { color: var(--ink); background: var(--s2); }
.docs-nav-sections a.active {
  color: var(--ink);
  border-left-color: var(--accent);
  background: rgba(200, 245, 87, 0.04);
  font-weight: 400;
}
.docs-nav-sections li.docs-hidden { display: none; }
.docs-nav-sections li.docs-nav-h3 a {
  padding-left: 36px;
  font-size: 12px;
  color: var(--dim);
}
.docs-nav-sections li.docs-nav-h3 a.active {
  color: var(--ink);
}

/* ── CONTENT AREA ───────────────────────────────────────────── */
.docs-content {
  flex: 1;
  min-width: 0;
  max-width: 1200px;
  padding: 36px 60px 48px;
  margin-left: var(--sidebar-w);
  transition: margin-left var(--transition-speed) var(--transition-fn);
}
.docs-layout.sidebar-collapsed .docs-content { margin-left: 0; }

/* ── DOCS FOOTER (sits inside docs-layout, respects sidebar) ─ */
.docs-footer {
  margin-left: var(--sidebar-w);
  padding: 14px 20px 18px;
  border-top: 1px solid var(--rule);
  transition: margin-left var(--transition-speed) var(--transition-fn);
  flex-shrink: 0;
}
.docs-layout.sidebar-collapsed .docs-footer {
  margin-left: 0;
  width: 100%;
}
.docs-footer-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}
.docs-footer-left {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.12em;
  color: var(--dim);
  text-transform: uppercase;
}
.docs-footer-gh {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.12em;
  color: var(--dim);
  text-decoration: none;
  text-transform: uppercase;
  transition: color 0.15s;
}
.docs-footer-gh:hover { color: var(--accent); }

/* ── PROJECT LINKS (View on GitHub button row) ───────────────── */
.project-links {
  margin-top: 32px;
  padding-top: 24px;
  border-top: 1px solid var(--rule);
}

/* ── BREADCRUMBS ────────────────────────────────────────────── */
.docs-breadcrumbs {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--dim);
  margin-bottom: 14px;
}
.docs-breadcrumbs a {
  color: var(--dim);
  text-decoration: none;
  transition: color 0.15s;
}
.docs-breadcrumbs a:hover { color: var(--accent); }
.docs-breadcrumb-sep { color: var(--rule); }
.docs-breadcrumb-current { color: var(--muted); }

/* ── HEADER (genre badge row) ───────────────────────────────── */
.docs-header {
  margin-bottom: 14px;
}
.docs-title {
  font-family: var(--font-display);
  font-size: clamp(28px, 5vw, 38px);
  font-weight: 700;
  line-height: 1.15;
  color: var(--ink);
  margin-bottom: 16px;
}
.docs-source-link {
  margin-bottom: 28px;
}
.docs-source-link a {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--dim);
  text-decoration: none;
  letter-spacing: 0.04em;
  border-bottom: 1px solid var(--rule);
  padding-bottom: 2px;
  transition: color 0.15s, border-color 0.15s;
}
.docs-source-link a:hover {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

/* ── CONTENT TYPOGRAPHY ─────────────────────────────────────── */
.docs-content h1 { font-family: var(--font-display); font-size: clamp(28px, 5vw, 38px); font-weight: 700; line-height: 1.15; margin-bottom: 20px; color: var(--ink); }
.docs-content h2 { font-family: var(--font-display); font-size: clamp(20px, 3vw, 24px); font-weight: 700; line-height: 1.25; margin-top: 48px; margin-bottom: 14px; color: var(--ink); scroll-margin-top: calc(var(--nav-h) + 16px); position: relative; }
.docs-content h2:first-child { margin-top: 0; }
.docs-content h3 { font-family: var(--font-display); font-size: 18px; font-weight: 700; line-height: 1.3; margin-top: 32px; margin-bottom: 10px; color: var(--ink); scroll-margin-top: calc(var(--nav-h) + 16px); position: relative; }
.docs-content p { margin-bottom: 14px; line-height: 1.75; color: var(--muted); font-size: 15px; }
.docs-content p + p { margin-top: 0; }
.docs-content ul, .docs-content ol { margin: 0 0 18px 20px; }
.docs-content li { margin-bottom: 6px; line-height: 1.7; color: var(--muted); font-size: 15px; }
.docs-content strong { color: var(--ink); font-weight: 500; }
.docs-content em { font-style: italic; }
.docs-content a { color: var(--accent); text-decoration: none; border-bottom: 1px solid transparent; transition: border-color 0.15s; }
.docs-content a:hover { border-bottom-color: var(--accent); }
.docs-content code { font-family: var(--font-mono); font-size: 0.88em; background: var(--s2); padding: 2px 6px; border-radius: 4px; color: var(--ink); }
.docs-content pre { background: var(--s1); border: 1px solid var(--rule); border-radius: var(--radius-lg); padding: 16px 18px; margin: 18px 0 22px; overflow-x: auto; position: relative; }
.docs-content pre code { background: none; padding: 0; font-size: 13px; line-height: 1.6; }
.docs-content hr { border: none; border-top: 1px solid var(--rule); margin: 32px 0; }
.docs-content blockquote { border-left: 3px solid var(--accent); padding: 4px 0 4px 16px; margin: 18px 0; color: var(--muted); font-style: italic; }

/* ── HEADING ANCHOR LINKS ───────────────────────────────────── */
.docs-heading-anchor {
  position: absolute;
  left: -24px;
  top: 50%;
  transform: translateY(-50%);
  font-family: var(--font-mono);
  font-size: 0.7em;
  color: var(--dim) !important;
  text-decoration: none;
  opacity: 0;
  transition: opacity 0.15s, color 0.15s;
  padding: 0 6px;
  border-bottom: none !important;
}
.docs-content h2:hover .docs-heading-anchor,
.docs-content h3:hover .docs-heading-anchor,
.docs-heading-anchor:focus { opacity: 1; }
.docs-heading-anchor:hover { color: var(--accent) !important; }
.docs-heading-anchor.copied::after {
  content: "Copied";
  position: absolute;
  left: 100%;
  top: 50%;
  transform: translateY(-50%);
  margin-left: 8px;
  font-size: 10px;
  color: var(--accent);
  white-space: nowrap;
}

/* ── COPY-CODE BUTTON ───────────────────────────────────────── */
.docs-copy-code {
  position: absolute;
  top: 8px;
  right: 8px;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--dim);
  background: var(--s2);
  border: 1px solid var(--rule);
  border-radius: 4px;
  padding: 4px 8px;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.15s, color 0.15s, border-color 0.15s;
}
.docs-content pre:hover .docs-copy-code { opacity: 1; }
.docs-copy-code:hover { color: var(--ink); border-color: var(--accent); }
.docs-copy-code.copied { color: var(--accent); border-color: var(--accent); opacity: 1; }

/* ── PREV / NEXT PAGINATION ─────────────────────────────────── */
.docs-pagination {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 56px;
  padding-top: 28px;
  border-top: 1px solid var(--rule);
}
.docs-pagination-link {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 18px;
  background: var(--s1);
  border: 1px solid var(--rule);
  border-radius: var(--radius-lg);
  text-decoration: none;
  transition: border-color 0.15s, background 0.15s;
}
.docs-pagination-link:hover { border-color: var(--accent); background: var(--s2); }
.docs-pagination-prev { justify-content: flex-start; }
.docs-pagination-next { justify-content: flex-end; text-align: right; }
.docs-pagination-arrow {
  font-family: var(--font-mono);
  font-size: 16px;
  color: var(--dim);
  flex-shrink: 0;
}
.docs-pagination-inner { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.docs-pagination-label {
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--dim);
}
.docs-pagination-title {
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 500;
  color: var(--ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ── COLLAPSE / REOPEN TOGGLE ───────────────────────────────── */
.docs-collapse-toggle {
  width: 34px; height: 34px; min-width: 34px;
  background: var(--s2);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  color: var(--dim);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: color 0.15s, background 0.15s;
}
.docs-collapse-toggle:hover { color: var(--ink); background: var(--s3); }
.docs-collapse-toggle svg { width: 14px; height: 14px; stroke: currentColor; fill: none; transition: transform 0.2s ease; }
.docs-layout.sidebar-collapsed .docs-collapse-toggle svg { transform: rotate(180deg); }

.docs-reopen-toggle {
  display: none;
  position: fixed;
  top: calc(var(--nav-h) + 12px);
  left: 12px;
  z-index: 170;
  width: 36px; height: 36px;
  background: var(--s2);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  color: var(--dim);
  cursor: pointer;
  align-items: center; justify-content: center;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.4);
  transition: color 0.15s, background 0.15s;
}
.docs-reopen-toggle:hover { color: var(--ink); background: var(--s3); }
.docs-reopen-toggle svg { width: 14px; height: 14px; stroke: currentColor; fill: none; }
.docs-layout.sidebar-collapsed .docs-reopen-toggle { display: flex; }

/* ── MOBILE ─────────────────────────────────────────────────── */
.docs-overlay { display: none; }
.docs-drawer-toggle { display: none; }

@media (max-width: 799px) {
  .docs-sidebar {
    top: 0;
    height: 100vh;
    padding-top: var(--nav-h);
    z-index: 250;
    transform: translateX(-100%);
  }
  .docs-sidebar.collapsed { transform: translateX(-100%); }
  .docs-sidebar.open { transform: translateX(0); box-shadow: 8px 0 32px rgba(0, 0, 0, 0.5); }
  .docs-content { margin-left: 0; padding: 28px 20px 56px; }
  .docs-layout.sidebar-collapsed .docs-content { margin-left: 0; }
  .docs-collapse-toggle { display: none; }
  .docs-reopen-toggle { display: none !important; }
  .docs-drawer-toggle {
    display: flex;
    position: fixed; bottom: 24px; left: 24px; z-index: 260;
    width: 44px; height: 44px;
    border-radius: 50%;
    background: var(--s2); border: 1px solid var(--rule); color: var(--ink);
    cursor: pointer; align-items: center; justify-content: center;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.5);
    transition: background 0.15s;
  }
  .docs-drawer-toggle:hover { background: var(--s3); }
  .docs-drawer-toggle svg { width: 18px; height: 18px; stroke: currentColor; fill: none; }
  .docs-overlay {
    display: block;
    position: fixed; inset: 0; z-index: 240;
    background: rgba(0, 0, 0, 0.6);
    opacity: 0; pointer-events: none;
    transition: opacity 0.25s ease;
  }
  .docs-overlay.visible { opacity: 1; pointer-events: auto; }
  .docs-heading-anchor { left: -20px; }
  .docs-pagination { grid-template-columns: 1fr; }
  .docs-content h1 { font-size: 30px; }
  .docs-content h2 { font-size: 22px; margin-top: 40px; }
}

@media (max-width: 480px) {
  .docs-sidebar { width: var(--sidebar-w-sm); min-width: var(--sidebar-w-sm); }
  .docs-content { padding: 20px 16px 48px; }
  .docs-drawer-toggle { bottom: 16px; left: 16px; }
}

@media (min-width: 800px) and (max-width: 1200px) {
  .docs-content { padding: 32px 40px 64px; }
}

@media (min-width: 1440px) {
  .docs-content { padding: 40px 80px 80px; }
}
