/**
 * Charta 4.2.0 unified experience system.
 * Loaded after legacy theme layers to normalize tone, reading comfort and responsiveness.
 */
:root{
  --chx-primary:#2563eb;
  --chx-primary-hover:#1d4ed8;
  --chx-primary-soft:#eaf2ff;
  --chx-navy:#172033;
  --chx-text:#253247;
  --chx-muted:#66758a;
  --chx-line:#dbe4ee;
  --chx-line-strong:#c8d5e3;
  --chx-page:#f5f7fb;
  --chx-surface:#fff;
  --chx-surface-soft:#f8fafc;
  --chx-success:#16815d;
  --chx-warning:#ad6800;
  --chx-danger:#c2414f;
  --chx-radius-sm:10px;
  --chx-radius:16px;
  --chx-radius-lg:22px;
  --chx-shadow-sm:0 5px 16px rgba(23,32,51,.055);
  --chx-shadow:0 14px 38px rgba(23,32,51,.075);
  --chx-shadow-hover:0 18px 44px rgba(23,32,51,.11);
  --chx-content:min(100% - 32px,1360px);
  --chx-reading:min(100%,780px);
  --chx-focus:0 0 0 3px rgba(37,99,235,.22);
}

html{scroll-behavior:smooth;text-size-adjust:100%;}
body{
  overflow-x:hidden;
  color:var(--chx-text);
  background:var(--chx-page);
  font-size:16px;
  line-height:1.72;
  -webkit-font-smoothing:antialiased;
  text-rendering:optimizeLegibility;
}
body,*{box-sizing:border-box;}
img,video,iframe,embed,object{max-width:100%;}
img{height:auto;}

/* Predictable focus and touch behavior. */
a,button,input,select,textarea,summary{outline-offset:3px;}
a:focus-visible,button:focus-visible,input:focus-visible,select:focus-visible,textarea:focus-visible,summary:focus-visible{
  outline:2px solid var(--chx-primary)!important;
  box-shadow:var(--chx-focus)!important;
}
button,input[type="button"],input[type="submit"],input[type="reset"],.wp-element-button,.button{
  min-height:42px;
}
input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]),select,textarea{
  max-width:100%;
  border-color:var(--chx-line-strong)!important;
  border-radius:var(--chx-radius-sm)!important;
  background:#fff!important;
  color:var(--chx-text)!important;
  transition:border-color .18s ease,box-shadow .18s ease,background-color .18s ease;
}
input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]):focus,select:focus,textarea:focus{
  border-color:var(--chx-primary)!important;
  box-shadow:var(--chx-focus)!important;
}
::placeholder{color:#94a3b8;opacity:1;}

/* Site-wide content frame. */
.site-content,.charta-list-page,.charta-reading-page,.charta-blog-page,.charta-directory-page{
  min-width:0;
}
body:not(.charta-enterprise-home-enabled) .site-content.wp-block-group{
  width:var(--chx-content)!important;
  margin-inline:auto!important;
}
.site-content > *,.wp-site-blocks > *{min-width:0;}

/* Calm, consistent public cards. */
.charta-post-card,.charta-article-card,.charta-navigation-card,.charta-enterprise-sidebar-widget,
.sidebar .widget,.sidebar-wrapper .widget,.charta-member-card,.charta-stats-panel{
  border:1px solid var(--chx-line)!important;
  border-radius:var(--chx-radius)!important;
  background:var(--chx-surface)!important;
  box-shadow:var(--chx-shadow-sm)!important;
}
.charta-post-card,.charta-article-card,.charta-navigation-card{
  transition:border-color .2s ease,box-shadow .2s ease,transform .2s ease;
}
.charta-post-card:hover,.charta-article-card:hover,.charta-navigation-card:hover{
  border-color:#bed0e5!important;
  box-shadow:var(--chx-shadow-hover)!important;
  transform:translateY(-2px);
}

/* Article and page reading comfort. */
.single .post-wrapper,.page:not(.page-template-blank-fullwidth) .post-wrapper{
  min-width:0;
}
.single .post-wrapper > article,.page .post-wrapper > article,.charta-reading-page article{
  overflow:hidden;
  border:1px solid var(--chx-line);
  border-radius:var(--chx-radius-lg);
  background:var(--chx-surface);
  box-shadow:var(--chx-shadow);
}
.single .entry-header,.page .entry-header,.single .wp-block-post-title,.page .wp-block-post-title{
  text-wrap:balance;
}
.entry-content,.wp-block-post-content{
  color:#334155;
  font-size:clamp(16px,1.1vw,17px);
  line-height:1.82;
  overflow-wrap:anywhere;
}
.entry-content > :where(p,ul,ol,blockquote,pre,h2,h3,h4,h5,h6,.wp-block-image,.wp-block-gallery,.wp-block-quote,.wp-block-code,.wp-block-table),
.wp-block-post-content > :where(p,ul,ol,blockquote,pre,h2,h3,h4,h5,h6,.wp-block-image,.wp-block-gallery,.wp-block-quote,.wp-block-code,.wp-block-table){
  max-width:var(--chx-reading);
  margin-inline:auto;
}
.entry-content p,.wp-block-post-content p{margin-block:1.15em;}
.entry-content h2,.wp-block-post-content h2{
  margin-top:2.25em;
  margin-bottom:.75em;
  color:var(--chx-navy);
  font-size:clamp(24px,2.2vw,31px);
  line-height:1.34;
  letter-spacing:-.025em;
}
.entry-content h3,.wp-block-post-content h3{
  margin-top:1.8em;
  margin-bottom:.65em;
  color:#1e3552;
  font-size:clamp(20px,1.8vw,25px);
  line-height:1.42;
}
.entry-content a,.wp-block-post-content a{
  color:#1557b7;
  text-decoration-thickness:1px;
  text-underline-offset:3px;
}
.entry-content a:hover,.wp-block-post-content a:hover{color:var(--chx-primary-hover);}
.entry-content blockquote,.wp-block-post-content blockquote,.wp-block-quote{
  padding:20px 22px!important;
  border:0!important;
  border-left:4px solid var(--chx-primary)!important;
  border-radius:0 var(--chx-radius) var(--chx-radius) 0;
  background:#f2f7ff;
  color:#40536b;
  font-family:inherit;
  font-size:1.02em;
}
.entry-content pre,.wp-block-post-content pre,.wp-block-code{
  overflow:auto;
  padding:18px 20px!important;
  border:1px solid #24344a!important;
  border-radius:var(--chx-radius-sm)!important;
  background:#111c2e!important;
  color:#e7edf6!important;
  box-shadow:none!important;
  tab-size:2;
}
.entry-content code:not(pre code),.wp-block-post-content code:not(pre code){
  padding:.12em .38em;
  border-radius:6px;
  background:#edf2f7;
  color:#a6263e;
}
.entry-content figure,.wp-block-post-content figure{max-width:100%;}
.entry-content figcaption,.wp-block-post-content figcaption{
  color:var(--chx-muted);
  font-size:13px;
  line-height:1.55;
  text-align:center;
}
.entry-content img,.wp-block-post-content img{border-radius:12px;}
.entry-content iframe,.wp-block-post-content iframe{border:0;border-radius:12px;}
.wp-block-embed__wrapper{overflow:hidden;border-radius:12px;background:#0f172a;}

/* Tables remain usable on tablets and phones. */
.wp-block-table{overflow-x:auto;-webkit-overflow-scrolling:touch;border:1px solid var(--chx-line);border-radius:12px;background:#fff;}
.wp-block-table table{min-width:620px;margin:0;}
.entry-content > table,.wp-block-post-content > table{
  display:block;
  overflow-x:auto;
  max-width:var(--chx-reading);
  margin-inline:auto;
  border:1px solid var(--chx-line);
  border-radius:12px;
  background:#fff;
  -webkit-overflow-scrolling:touch;
}
table th{background:#f2f6fb;color:#25364d;font-weight:750;}
table th,table td{padding:12px 14px;border-color:var(--chx-line);vertical-align:top;}
table tbody tr:nth-child(even){background:#fbfcfe;}

/* Pagination, notices and labels. */
.wp-block-query-pagination,.navigation.pagination,.post-navigation{gap:8px;}
.wp-block-query-pagination a,.wp-block-query-pagination span,.nav-links a,.nav-links span{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  min-width:42px;
  min-height:42px;
  padding:7px 12px;
  border:1px solid var(--chx-line);
  border-radius:10px;
  background:#fff;
  color:#40536b;
  text-decoration:none;
}
.wp-block-query-pagination .current,.nav-links .current{
  border-color:var(--chx-primary);
  background:var(--chx-primary);
  color:#fff;
}

/* Sidebar readability. */
.sidebar,.sidebar-wrapper{min-width:0;}
.sidebar .widget,.sidebar-wrapper .widget,.charta-enterprise-sidebar-widget{padding:20px!important;}
.sidebar h2,.sidebar h3,.sidebar-wrapper h2,.sidebar-wrapper h3,.is-style-widget-title{
  color:var(--chx-navy)!important;
  line-height:1.4;
}
.sidebar a,.sidebar-wrapper a{color:#35506f;text-underline-offset:3px;}

/* Header/footer: preserve current structure, improve clarity only. */
.site-header{box-shadow:0 1px 0 rgba(255,255,255,.06);}
.site-header a{transition:color .18s ease,background-color .18s ease,border-color .18s ease;}
.site-footer{color:#d7e1ee;}
.site-footer a{color:#eef5ff;text-decoration-color:rgba(238,245,255,.35);}
.site-footer a:hover{color:#fff;}

/* Empty states and system messages. */
.is-empty,.charta-empty,.wp-block-query-no-results{
  padding:28px;
  border:1px dashed var(--chx-line-strong);
  border-radius:var(--chx-radius);
  background:var(--chx-surface-soft);
  color:var(--chx-muted);
  text-align:center;
}

@media (max-width:1180px){
  :root{--chx-content:min(100% - 28px,1120px);}
  .site-content > .wp-block-columns{gap:24px!important;}
  .post-wrapper{min-width:0!important;}
  .sidebar-wrapper{min-width:260px!important;}
}

@media (max-width:900px){
  :root{--chx-content:min(100% - 24px,860px);}
  body{font-size:15.5px;}
  .site-content > .wp-block-columns,.charta-post-columns{
    display:grid!important;
    grid-template-columns:minmax(0,1fr)!important;
    gap:22px!important;
  }
  .post-wrapper,.sidebar-wrapper,.sidebar{width:100%!important;max-width:none!important;min-width:0!important;}
  .sidebar-wrapper{order:2;}
  .sidebar-wrapper .sidebar,.sidebar{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:16px;}
  .entry-content,.wp-block-post-content{font-size:16px;line-height:1.78;}
}

@media (max-width:620px){
  :root{--chx-content:calc(100% - 20px);--chx-radius:14px;--chx-radius-lg:17px;}
  body{font-size:15px;line-height:1.68;}
  .site-content.wp-block-group{padding-top:20px!important;padding-bottom:34px!important;}
  .sidebar-wrapper .sidebar,.sidebar{grid-template-columns:1fr;}
  .single .post-wrapper > article,.page .post-wrapper > article,.charta-reading-page article{border-radius:16px;}
  .entry-content,.wp-block-post-content{font-size:15.5px;line-height:1.76;}
  .entry-content h2,.wp-block-post-content h2{font-size:24px;}
  .entry-content h3,.wp-block-post-content h3{font-size:20px;}
  .entry-content blockquote,.wp-block-post-content blockquote,.wp-block-quote{padding:16px!important;}
  table th,table td{padding:10px 12px;font-size:13px;}
  .wp-block-button,.wp-block-button__link{max-width:100%;}
  .wp-block-button__link{min-height:44px;white-space:normal;text-align:center;}
}

@media (prefers-reduced-motion:reduce){
  html{scroll-behavior:auto;}
  *,*::before,*::after{scroll-behavior:auto!important;animation-duration:.01ms!important;animation-iteration-count:1!important;transition-duration:.01ms!important;}
}
