:root{
  --cf-blue:#0b4aa2;     /* primary */
  --cf-blue2:#0a3f8a;
  --cf-bg:#f5f7fb;
  --cf-text:#0f172a;
  --cf-muted:#64748b;
  --cf-line:#e5e7eb;
  --cf-card:#ffffff;
  --cf-shadow:0 8px 24px rgba(2,8,23,.08);
  --radius:14px;
}

*{ box-sizing:border-box; }
html,body{ height:100%; }

body{
  margin:0;
  background:var(--cf-bg);
  color:var(--cf-text);
  font-family: "Open Sans", Arial, sans-serif;
}

h1,h2,h3{
  font-family:"Merriweather", Georgia, serif;
  letter-spacing:-0.2px;
}

a{ color:var(--cf-blue); text-decoration:none; }
a:hover{ text-decoration:underline; }

/* =========================
   Top bar (fix wrapping)
   ========================= */
.cf-topbar{
  position:sticky;
  top:0;
  z-index:50;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  padding:12px 14px;
  background:linear-gradient(90deg, var(--cf-blue), var(--cf-blue2));
  color:#fff;
  box-shadow: 0 6px 20px rgba(2,8,23,.18);
}

/* Important: prevent flex children from forcing weird wrapping */
.cf-topbar > *{ min-width:0; }

.cf-brand{
  display:flex;
  align-items:center;
  gap:10px;
  color:#fff;
  text-decoration:none;

  /* make brand shrink nicely instead of wrapping ugly */
  flex:1;
  min-width:0;
}

.cf-logo{
  width:40px;
  height:40px;
  object-fit:contain;
  border-radius:10px;
  background:rgba(255,255,255,.12);
  padding:6px;
  flex:0 0 auto;
}

.cf-brand-text{
  font-weight:800;
  font-size:15px;
  line-height:1.05;

  /* key fix */
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
}

/* Optional top links (if you have them in template.php) */
.cf-toplinks{
  display:flex;
  gap:10px;
  align-items:center;
  flex:0 0 auto;
  min-width:0;
}

.cf-toplink{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  padding:8px 12px;
  border-radius:999px;
  font-weight:800;
  font-size:13px;
  color:#fff;
  background:rgba(255,255,255,.12);
  border:1px solid rgba(255,255,255,.18);
  text-decoration:none;
  white-space:nowrap;
}
.cf-toplink:hover{
  background:rgba(255,255,255,.18);
  text-decoration:none;
}

.cf-burger{
  appearance:none;
  border:0;
  background:rgba(255,255,255,.18);
  color:#fff;
  font-size:20px;
  padding:8px 10px;
  border-radius:12px;
  cursor:pointer;
  flex:0 0 auto;
}

/* =========================
   Shell + layout
   ========================= */
.cf-shell{
  display:flex;
  min-height:calc(100vh - 64px);
  max-width:1200px;
  margin:0 auto;
}

/* If sidebar is still present in HTML but empty, hide it automatically */
.cf-sidebar:empty{ display:none; }

/* If sidebar is hidden, let main take full width */
.cf-sidebar{
  width:280px;
  padding:14px;
}

.cf-main{
  flex:1;
  padding:14px;
  min-width:0;
}

.cf-content{
  background:var(--cf-card);
  border:1px solid var(--cf-line);
  border-radius:var(--radius);
  box-shadow:var(--cf-shadow);
  padding:16px;
}

/* If you entirely removed the aside in template, this still looks good */
.cf-main:only-child{
  padding:18px 14px;
}

/* =========================
   Breadcrumbs
   ========================= */
.cf-breadcrumbs{
  font-size:13px;
  color:var(--cf-muted);
  margin:10px 0 12px 0;
}
.cf-breadcrumbs a{ color:var(--cf-blue); }
.cf-sep{ margin:0 6px; color:#94a3b8; }

/* =========================
   Sidebar nav (won't show if sidebar removed)
   ========================= */
.cf-nav{
  background:var(--cf-card);
  border:1px solid var(--cf-line);
  border-radius:var(--radius);
  box-shadow:var(--cf-shadow);
  padding:12px;
}
.cf-nav-title{
  font-weight:800;
  color:var(--cf-text);
  margin:4px 6px 10px 6px;
  font-size:12px;
  text-transform:uppercase;
  letter-spacing:.10em;
}
.cf-nav-link{
  display:block;
  padding:10px 10px;
  border-radius:12px;
  margin:3px 0;
  color:var(--cf-text);
  text-decoration:none;
  background:transparent;
}
.cf-nav-link:hover{
  background:#eef2ff;
  text-decoration:none;
}

/* =========================
   Common UI helpers
   ========================= */
.card{
  background:var(--cf-card);
  border:1px solid var(--cf-line);
  border-radius:var(--radius);
  box-shadow:var(--cf-shadow);
  padding:14px;
}

.input, select, textarea{
  width:100%;
  padding:12px 12px;
  border-radius:12px;
  border:1px solid #cbd5e1;
  font-size:14px;
  outline:none;
  background:#fff;
}
.input:focus, select:focus, textarea:focus{
  border-color:rgba(11,74,162,.55);
  box-shadow:0 0 0 4px rgba(11,74,162,.12);
}

.btn{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  gap:8px;
  padding:11px 14px;
  border-radius:12px;
  border:1px solid transparent;
  cursor:pointer;
  font-weight:800;
  font-size:14px;
  text-decoration:none;
}
.btn-primary{
  background:var(--cf-blue);
  color:#fff;
}
.btn-primary:hover{ background:var(--cf-blue2); text-decoration:none; }
.btn-secondary{
  background:#f1f5f9;
  border-color:#e2e8f0;
  color:var(--cf-text);
}
.btn-secondary:hover{ background:#eaf0f7; text-decoration:none; }

.article-meta{
  color:var(--cf-muted);
  font-size:12px;
}

/* Related articles block created by internal_linker.php */
.related-articles{
  margin-top:18px;
  padding-top:12px;
  border-top:1px solid var(--cf-line);
}
.related-articles h3{
  margin:0 0 8px 0;
  font-size:16px;
}
.related-articles ul{
  margin:0;
  padding-left:18px;
}

/* Mobile nav overlay + slide-in sidebar */
.cf-nav-overlay{
  display:none;
}

/* =========================
   Responsive
   ========================= */
@media (max-width: 900px){
  .cf-shell{ max-width:100%; }

  /* If sidebar exists, it becomes slide-in */
  .cf-sidebar{
    position:fixed;
    top:64px;
    bottom:0;
    left:-320px;
    width:300px;
    background:var(--cf-bg);
    z-index:60;
    overflow:auto;
    transition:left .18s ease;
  }
  body.cf-nav-open .cf-sidebar{ left:0; }

  .cf-main{ padding:12px; }

  .cf-nav-overlay{
    display:block;
    position:fixed;
    top:64px;
    left:0;
    right:0;
    bottom:0;
    background:rgba(2,8,23,.45);
    opacity:0;
    pointer-events:none;
    transition:opacity .18s ease;
    z-index:55;
  }
  body.cf-nav-open .cf-nav-overlay{
    opacity:1;
    pointer-events:auto;
  }

  /* Topbar: if you have right-side links, hide them on small screens */
  .cf-toplinks{ display:none; }
}

/* Ultra-small screens: keep brand from looking cramped */
@media (max-width: 420px){
  .cf-brand-text{ font-size:14px; }
  .cf-logo{ width:36px; height:36px; }
}
