/* Scoped quality layer: readable text, safe sizing, and improved controls. */
*,*::before,*::after{min-width:0}
#content{min-width:0;width:100%;max-width:100%;overflow-wrap:anywhere}
#content :where(h1,h2,h3,h4,p,li,a,button,label,span){overflow-wrap:anywhere;word-break:normal}
#content :where(p,li){line-height:1.9}
#content :where(h1,h2,h3){line-height:1.35;max-width:100%}
#content img,#content video,#content iframe{max-width:100%}
.section-head,.articles-list-head,.articles-list-body,.card-body,.product-info,.product-actions{min-width:0;max-width:100%}
.sidebar-search{margin:16px 0 6px}
.search-widget{display:flex;align-items:center;gap:10px;padding:5px 12px;border:1px solid var(--theme-line);border-radius:16px;background:var(--theme-surface-2);box-shadow:inset 0 1px 0 var(--shadow-color);transition:border-color .2s,box-shadow .2s}
.search-widget:focus-within{border-color:var(--theme-accent);box-shadow:0 0 0 3px color-mix(in srgb,var(--theme-accent) 18%,transparent)}
.search-widget-icon{font-size:1.45rem;color:var(--theme-accent);line-height:1}
.search-widget-input{width:100%;min-width:0;padding:9px 0;border:0!important;outline:0!important;background:transparent!important;color:var(--theme-text);font-size:.9rem}
.search-widget-input::placeholder{color:var(--theme-muted)}
.profile-card,.intro-inner,.article-card,.article-list-card,.product-card,.academy-card{min-width:0;overflow-wrap:anywhere}
.article-content-actions,.article-card-actions{display:flex;align-items:center;justify-content:space-between;gap:12px;flex-wrap:wrap;margin-top:14px}
.article-votes{display:flex;gap:7px;align-items:center;flex-wrap:wrap}
.article-votes button{display:inline-flex;align-items:center;gap:6px;padding:7px 11px;border:1px solid var(--theme-line);border-radius:999px;background:var(--theme-surface-2);color:var(--theme-text);font-size:.82rem;transition:background .2s,border-color .2s,transform .2s}
.article-votes button:hover{border-color:var(--theme-accent);transform:translateY(-1px)}
.article-votes button[aria-pressed="true"]{border-color:var(--theme-accent);background:color-mix(in srgb,var(--theme-accent) 17%,var(--theme-surface));box-shadow:0 0 0 1px var(--theme-accent)}
.article-image,.article-thumb-placeholder{display:block;width:100%;max-height:420px;object-fit:cover;border-radius:16px;margin:0 0 16px}
.article-image-placeholder,.article-thumb-placeholder{display:grid;place-items:center;gap:8px;min-height:160px;background:linear-gradient(135deg,var(--theme-surface-2),var(--theme-surface-3));border:1px dashed var(--theme-line);border-radius:16px;color:var(--theme-muted);font-size:2rem}
.article-thumb-placeholder{height:100%;min-height:200px;margin:0;border:0;border-radius:0}
/* Academy */
.academy-panel{display:flex;flex-direction:column;gap:18px}
.academy-intro{max-width:72ch;color:var(--theme-soft)}
.academy-toolbar{display:flex;flex-direction:column;gap:12px}
.academy-search{display:flex;align-items:center;gap:10px;padding:8px 14px;border:1px solid var(--theme-line);border-radius:14px;background:var(--theme-surface);color:var(--theme-muted)}
.academy-search input{width:100%;border:0;outline:0;background:transparent;color:var(--theme-text);min-width:0}
.academy-filters{display:flex;flex-wrap:wrap;gap:8px}
.academy-filters button,.academy-details,.academy-interest{border:1px solid var(--theme-line);border-radius:999px;padding:8px 13px;background:var(--theme-surface-2);color:var(--theme-text);transition:.2s}
.academy-filters button.is-active,.academy-interest{background:var(--theme-accent);border-color:var(--theme-accent);color:var(--text-on-primary)}
.academy-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:16px}
.academy-card{display:flex;gap:15px;padding:20px;border:1px solid var(--theme-line);border-radius:20px;background:var(--theme-surface);box-shadow:var(--shadow-soft);transition:transform .2s,border-color .2s}
.academy-card:hover{transform:translateY(-3px);border-color:var(--theme-accent)}
.academy-card-icon{flex:0 0 52px;width:52px;height:52px;display:grid;place-items:center;border-radius:16px;background:var(--theme-surface-2);color:var(--theme-accent);font-size:1.4rem;font-weight:700}
.academy-card-content{flex:1;min-width:0;display:flex;flex-direction:column;gap:10px}
.academy-card-meta,.academy-course-facts{display:flex;flex-wrap:wrap;gap:8px;color:var(--theme-muted);font-size:.78rem}
.academy-card-meta span,.academy-course-facts span{padding:3px 9px;border-radius:999px;background:var(--theme-surface-2)}
.academy-card h3{font-size:1.12rem;color:var(--theme-text)}.academy-card p{color:var(--theme-soft);font-size:.92rem}
.academy-actions{display:flex;gap:8px;flex-wrap:wrap;margin-top:4px}.academy-details{background:transparent}.academy-empty,.academy-feedback{padding:14px;border-radius:12px;background:var(--theme-surface-2);color:var(--theme-soft)}
.academy-dialog{width:min(560px,calc(100% - 28px));max-height:80vh;margin:auto;padding:24px;border:1px solid var(--theme-line);border-radius:22px;background:var(--theme-surface);color:var(--theme-text);box-shadow:var(--shadow);overflow:auto}
.academy-dialog::backdrop{background:rgba(0,0,0,.55);backdrop-filter:blur(4px)}.academy-dialog-close{float:inline-end;border:0;background:transparent;color:var(--theme-text);font-size:1.5rem}.academy-dialog h3{margin:10px 0}.academy-dialog p{color:var(--theme-soft)}
@media(max-width:800px){.academy-grid{grid-template-columns:1fr}.academy-card{padding:16px}.academy-actions>*{flex:1}.article-list-card{flex-direction:column}.card-thumb{width:100%;flex-basis:auto;aspect-ratio:16/9}.article-card-actions{align-items:flex-start}}
@media(max-width:540px){#content{padding-inline:14px}.academy-card{gap:12px}.academy-card-icon{flex-basis:42px;width:42px;height:42px}.article-votes button{padding:6px 9px}.article-content-actions{align-items:stretch}.article-content-actions .article-read-btn{max-width:100%}.articles-list-panel{padding:22px 14px 60px!important}.articles-list-body{grid-template-columns:minmax(0,1fr)}.articles-filters{position:static;max-height:none}.articles-search-form,.articles-search-form input{width:100%;min-width:0}}

/* ================================================================
   v55 sidebar overlay fix — applied WITHOUT touching styles.css.
   Root cause: styles.css :root declares --sidebar-x (292px/300px),
   but every layout rule consumes --sidebar-w, which had NO desktop
   definition (only the max-width:1040px query sets 260px). Both the
   body offset (padding-left/right) and .sidebar width resolved to
   invalid → 0/auto, so the fixed sidebar floated ON TOP of the
   page content whenever it was open.
   Fix: map --sidebar-w to the existing --sidebar-x token, desktop
   only (min-width:1041px) so that:
     • tablet keeps 260px from styles.css @media(max-width:1040px)
     • mobile keeps the sidebar hidden @media(max-width:840px)
     • a runtime :root{--sidebar-w:…!important} emitted by
       includes/cms-layout.php (Move editor) still wins.
   The width always follows whatever --sidebar-x is set to in the
   styles.css :root — nothing is hardcoded here.
   ================================================================ */
@media(min-width:1041px){
  :root{--sidebar-w:var(--sidebar-x,300px)}
}
