/*
  Lemin KB – targeted readability refinements
  - Unifies font stacks across theme and weDocs
  - Improves base type scale and content width
  - Harmonizes spacing and list readability
  - Polishes weDocs grids and lists alignment
*/

/* Global font variables */
:root {
  --kb-font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, "Helvetica Neue", Arial, "Noto Sans", "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", sans-serif;
  --kb-font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
}

/* Base typography */
html, body {
  font-family: var(--kb-font-sans);
  font-size: 17px; /* ~1.0625rem */
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  color: #0f172a;
}

/* Consistent heading scale (fluid for responsiveness) */
.wp-block-post-content h1, .wedocs-single-wrap h1 { font-size: clamp(1.9rem, 1.2rem + 2vw, 2.4rem); }
.wp-block-post-content h2, .wedocs-single-wrap h2 { font-size: clamp(1.5rem, 1.0rem + 1.2vw, 1.9rem); }
.wp-block-post-content h3, .wedocs-single-wrap h3 { font-size: clamp(1.25rem, 0.95rem + 0.6vw, 1.5rem); }
.wp-block-post-content h4, .wedocs-single-wrap h4 { font-size: 1.125rem; }
.wp-block-post-content h5, .wedocs-single-wrap h5 { font-size: 1rem; }
.wp-block-post-content h6, .wedocs-single-wrap h6 { font-size: 0.9375rem; }

code, kbd, pre, samp { font-family: var(--kb-font-mono); }

/* Base content rhythm */
.kb-container,
.entry-content,
.wp-block-post-content {
  max-width: 1100px;
  margin-left: auto;
  margin-right: auto;
}

/* HARD STOP: never show header/footer template-parts inside page content */
.wp-block-post-content .wp-block-template-part { display: none !important; }

.wp-block-post-content p,
.wp-block-group p {
  line-height: 1.7;
}

/* Headings spacing */
.wp-block-post-content h1,
.wp-block-post-content h2,
.wp-block-post-content h3 {
  margin-top: 1.2em;
  margin-bottom: 0.6em;
}

/* Search block sizing on hero */
.kb-search { margin: 8px auto; max-width: 720px; }

/* Lists readability */
.wp-block-post-content ul,
.wp-block-post-content ol {
  padding-left: 1.25rem;
  margin-top: 0.5rem;
  margin-bottom: 1rem;
}

/* weDocs specifics (frontend classes) */
/* Shortcode grid (frontend) */
.wedocs-shortcode-wrap .wedocs-docs-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 24px;
  padding-left: 0;
  list-style: none;
}

/* Remove plugin clearfix pseudo-items that create an empty first grid cell */
.wedocs-shortcode-wrap ul.wedocs-docs-list::before,
.wedocs-shortcode-wrap ul.wedocs-docs-list::after {
  content: none !important;
  display: none !important;
}

.wedocs-shortcode-wrap ul.wedocs-docs-list li.wedocs-docs-single {
  margin: 0 !important;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  padding: 16px 16px 8px !important;
  display: flex;
  flex-direction: column;
  height: 100%;
  box-shadow: 0 1px 2px rgba(0,0,0,0.03);
}

.wedocs-shortcode-wrap ul.wedocs-docs-list li.wedocs-docs-single h3 {
  margin: 0 0 8px;
  font-size: 1.125rem !important;
  line-height: 1.4;
}

.wedocs-shortcode-wrap ul.wedocs-docs-list ul.wedocs-doc-sections ul.children > li {
  margin: 8px 0;
}

.wedocs-shortcode-wrap ul.wedocs-docs-list li.wedocs-docs-single .inside {
  flex: 1;
  height: auto !important;
  overflow: visible !important;
}

.wedocs-doc-sections {
  margin: 8px 0 0;
  padding-left: 0;
  list-style: none;
}

.wedocs-doc-sections > li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 0;
  border-bottom: 1px dashed #eef2f6;
}

.wedocs-doc-sections > li:last-child { border-bottom: 0; }

.wedocs-doc-link { text-align: right; padding-top: 8px; }

/* Align the shortcode search */
.wedocs-shortcode-wrap .wedocs-search-form { max-width: 720px; margin: 0 auto 16px; }
.wedocs-shortcode-wrap .wedocs-search-input input[type="search"] { padding: 12px 14px; border-radius: 8px; }

/* Sidebar spacing (single doc) */
.wedocs-sidebar {
  padding-top: 10px;
}

.wedocs-sidebar ul {
  margin: 0.25rem 0 1rem 0;
}

/* Content area line length (single doc) */
.wedocs-single .entry,
.wedocs-single .entry-content {
  max-width: 760px;
}

.wedocs-single .entry-content p {
  font-size: 1.0625rem;
  line-height: 1.75;
}

/* Tighten metadata spacing */
.wedocs .doc-meta,
.wedocs-single .doc-meta {
  margin-top: 16px;
}

/* Make anchors subtle */
.wedocs-single .entry-content a {
  text-decoration: none;
}
.wedocs-single .entry-content a:hover,
.wedocs-single .entry-content a:focus {
  text-decoration: underline;
}

/* Small screens: ensure safe padding */
@media (max-width: 782px) {
  .kb-container { padding-left: 12px; padding-right: 12px; }
  .kb-search { max-width: 100%; }
  .wedocs-shortcode-wrap .wedocs-docs-list { grid-template-columns: 1fr; }
}

@media (max-width: 480px) {
  .kb-hero .kb-search .kb-search-kbd,
  .kb-hero-wrap .kb-search .kb-search-kbd { display: none; }
}

/* Center the hero search */
.kb-hero .kb-search,
.kb-hero .wedocs-search-form,
.kb-hero .wedocs-single-search-input { max-width: 720px;  }

/* Minimalist hero visuals */
.kb-hero-wrap {
  background: #f8fafc;
  text-align: center;
}
.kb-hero-wrap .wp-block-heading { margin: 0 0 12px; }
.kb-hero-wrap p { color: #5b6b7a; margin: 0 0 20px; }

/* Redesigned, aligned hero search */
.kb-hero .kb-search,
.kb-hero-wrap .kb-search {
  display: flex;
  align-items: center;
  gap: 10px;
  background: #ffffff;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: 0 12px;
  box-shadow: 0 1px 2px rgba(0,0,0,0.03);
  height: 48px;
}
.kb-search-icon {
  display: inline-block;
  width: 20px;
  height: 20px;
  background-repeat: no-repeat;
  background-position: center;
  background-size: 18px 18px;
  /* Magnifier icon via data URI SVG (stroke set via %2394a3b8) */
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' 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");
}
.kb-hero .kb-search .search-field,
.kb-hero-wrap .kb-search .search-field {
  flex: 1;
  height: 100%;
  border: none;
  outline: none;
  font-size: 1.0625rem;
  box-sizing: border-box;
  padding: 0; /* no vertical padding; use line-height to center */
  line-height: 48px; /* match container height for perfect centering */
  -webkit-appearance: none;
  appearance: none;
  background: transparent;
  color: #0f172a;
}

/* Remove default WebKit search decorations that shift alignment */
.kb-search .search-field::-webkit-search-decoration,
.kb-search .search-field::-webkit-search-cancel-button,
.kb-search .search-field::-webkit-search-results-button,
.kb-search .search-field::-webkit-search-results-decoration { display: none; }
.kb-hero .kb-search .search-field::placeholder,
.kb-hero-wrap .kb-search .search-field::placeholder { color: #94a3b8; }
.kb-hero .kb-search .kb-search-button,
.kb-hero-wrap .kb-search .kb-search-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 100%;
  border-radius: 10px;
  border: 0;
  background: transparent;
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' 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: center;
}
.kb-hero .kb-search .kb-search-button:hover,
.kb-hero-wrap .kb-search .kb-search-button:hover { background: #f8fafc; }
/* No key-hint badge shown on the hero search */
.kb-hero .kb-search:focus-within,
.kb-hero-wrap .kb-search:focus-within {
  border-color: #94a3b8;
  box-shadow: 0 0 0 3px rgba(148,163,184,0.25);
}
/* Screen reader text (fallback if theme lacks it) */
.screen-reader-text {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Header logo alignment */
.kb-site-logo { display: inline-flex; align-items: center; line-height: 0; }
.kb-site-logo img { height: 32px; width: auto; display: block; }

/* Enforce left alignment for header on plugin/classic views */
.kb-header { text-align: left !important; }
.wedocs-single-wrap .kb-header,
.wedocs .kb-header { text-align: left !important; }

/* Make inner group flex across all render contexts */
.kb-header .wp-block-group.is-layout-flex,
.kb-header > .wp-block-group,
.wedocs .kb-header > .wp-block-group,
.wedocs .kb-header .wp-block-group {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  width: 100%;
  flex-wrap: nowrap;
}

/* Ensure the external link sits to the far right and not next to logo */
.kb-header .kb-header-link { margin-left: auto; }
.kb-header .kb-header-link a { padding: 6px 8px; display: inline-block; }

/* Card hover refinement for docs grid */
.wedocs-shortcode-wrap ul.wedocs-docs-list li.wedocs-docs-single {
  transition: transform 120ms ease, box-shadow 120ms ease;
}
.wedocs-shortcode-wrap ul.wedocs-docs-list li.wedocs-docs-single:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(0,0,0,0.06);
}

/* =============================
   Header Consistency
   Ensure header looks identical across block and plugin pages
   ============================= */
/* Remove global block gap on header as a direct child of site blocks */
:where(.wp-site-blocks) > header { margin-block-start: 0 !important; }
.wp-site-blocks > header { margin-top: 0 !important; }
.wp-site-blocks > header .wp-block-group { margin: 0; }

/* Explicit header styles namespace */
.kb-header {
  background: #ffffff;
  border-bottom: 1px solid #e5e7eb;
}
.kb-header .wp-block-navigation { font-size: 16px; }
.kb-header .wp-block-site-title a { text-decoration: none; }
.kb-header .kb-header-link { margin: 0; }
.kb-header .kb-header-link { margin-left: auto !important; }
.kb-header .kb-header-link a {
  text-decoration: none;
  color: inherit;
}
.kb-header .kb-header-link a:hover,
.kb-header .kb-header-link a:focus { text-decoration: underline; }

/* =============================
   Single Doc (Detail) Page
   Make it coherent with the minimalist front page
   ============================= */

/* Outer container rhythm */
.wedocs-single-wrap {
  max-width: 1100px;
  margin: 24px auto;
  padding: 0 16px;
}

/* Breadcrumbs: subtle, small, muted */
.wedocs-single-wrap .wedocs-breadcrumb,
.wedocs-single-wrap .wedocs-breadcrumbs {
  font-size: 13px;
  color: #64748b;
  margin: 8px 0 12px;
}
.wedocs-single-wrap .wedocs-breadcrumb a,
.wedocs-single-wrap .wedocs-breadcrumbs a { color: inherit; text-decoration: none; }
.wedocs-single-wrap .wedocs-breadcrumb a:hover,
.wedocs-single-wrap .wedocs-breadcrumbs a:hover { text-decoration: underline; }

/* Title block: strong but compact */
.wedocs-single-wrap h1,
.wedocs-single-wrap .entry-title {
  font-size: 1.75rem;
  line-height: 1.25;
  margin: 6px 0 14px;
}

/* Layout harmony: content width + sidebar spacing */
.wedocs-single .entry,
.wedocs-single .entry-content { max-width: 760px; }
.wedocs-sidebar { padding-top: 8px; }

/* Sidebar nav as clean list */
.wedocs-sidebar ul { list-style: none; padding-left: 0; }
.wedocs-sidebar li { margin: 2px 0; }
.wedocs-sidebar a {
  display: block;
  padding: 8px 10px;
  border-radius: 8px;
  color: #0f172a;
  text-decoration: none;
}
.wedocs-sidebar a:hover,
.wedocs-sidebar a:focus { background: #f8fafc; }

/* Content text and elements */
.wedocs-single .entry-content p { margin: 0.75rem 0 1rem; }
.wedocs-single .entry-content h2 { margin-top: 1.25em; margin-bottom: 0.5em; }
.wedocs-single .entry-content h3 { margin-top: 1em; margin-bottom: 0.4em; }
.wedocs-single .entry-content ul,
.wedocs-single .entry-content ol { margin: 0.5rem 0 1rem 1.25rem; }

/* Code blocks and inline code */
.wedocs-single .entry-content pre,
.wedocs-single .entry-content code {
  background: #f8fafc;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
}
.wedocs-single .entry-content pre { padding: 12px 14px; overflow: auto; }
.wedocs-single .entry-content code { padding: 2px 6px; font-family: var(--kb-font-mono); font-size: 0.95em; }

/* Make sure plugin UI inherits fonts */
.wedocs *, .wedocs-single *, .wedocs-shortcode-wrap * { font-family: inherit; }

/* Tables: tidy, minimal */
.wedocs-single .entry-content table { border-collapse: separate; border-spacing: 0; width: 100%; }
.wedocs-single .entry-content th,
.wedocs-single .entry-content td {
  border: 1px solid #e5e7eb;
  padding: 8px 10px;
}
.wedocs-single .entry-content th { background: #f8fafc; text-align: left; }

/* Meta area spacing */
.wedocs .doc-meta,
.wedocs-single .doc-meta { margin-top: 16px; color: #64748b; font-size: 13px; }

/* Prev/Next nav subtle borders */
.wedocs .doc-nav { margin-top: 24px; padding-top: 16px; border-top: 1px solid #e5e7eb; }

/* =============================
   Sidebar Nav (doc-nav-list): minimal, professional
   ============================= */
.wedocs-sidebar .doc-nav-list {
  list-style: none;
  margin: 8px 0 0;
  padding-left: 0;
}
.wedocs-sidebar .doc-nav-list li { margin: 2px 0; }
.wedocs-sidebar .doc-nav-list li a {
  display: block;
  padding: 6px 8px;
  border-radius: 6px;
  text-decoration: none;
  color: inherit;
  background: transparent;
  border: 0;
}
.wedocs-sidebar .doc-nav-list li a:hover,
.wedocs-sidebar .doc-nav-list li a:focus {
  text-decoration: underline;
  background: transparent;
}
.wedocs-sidebar .doc-nav-list li.current_page_item > a,
.wedocs-sidebar .doc-nav-list li.current_page_ancestor > a {
  font-weight: 600;
  text-decoration: none;
}
.wedocs-sidebar .doc-nav-list ul {
  list-style: none;
  margin: 4px 0 0 10px;
  padding-left: 0;
}
.wedocs-sidebar .doc-nav-list .wedocs-caret { opacity: .4; }

/* Ensure feedback section spans full content width under content */
.wedocs-entry-footer { display: block; }
.feedback-content { display: block; width: 100%; }
.feedback-content .kb-feedback { width: 100%; }

/* =============================
   Feedback block (professional minimal)
   ============================= */
.kb-feedback {
  margin-top: 24px;
  padding: 16px;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  background: #f8fafc;
}
.kb-feedback-title {
  margin: 0 0 12px;
  font-weight: 600;
  color: #0f172a;
  text-align: center;
}
.kb-feedback-actions {
  display: flex;
  justify-content: center;
  gap: 12px;
}
.kb-feedback-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 16px;
  border-radius: 10px;
  border: 1px solid #e5e7eb;
  background: #ffffff;
  color: #0f172a;
  text-decoration: none;
}
.kb-feedback-btn .count {
  color: #64748b;
  font-size: 12px;
}
.kb-feedback-btn:hover,
.kb-feedback-btn:focus {
  background: #f1f5f9;
  border-color: #cbd5e1;
}
@media (max-width: 480px) {
  .kb-feedback-actions { flex-direction: column; }
}
