/* NexusCMS Dark Theme — esmaelnexusx.com style */

:root {
  --bg:         #0f1117;
  --bg2:        #1a1d27;
  --bg3:        #232635;
  --border:     #2a2d3e;
  --text:       #c5cad8;
  --text-dim:   #7a8098;
  --heading:    #e8eaf0;
  --accent:     #3399dd;
  --accent-h:   #4aadee;
  --danger:     #e05555;
  --success:    #3a9e6f;
  --warning:    #d4a017;
  --radius:     8px;
  --radius-lg:  14px;
  --font:       'Inter', 'Segoe UI', system-ui, sans-serif;
  --font-mono:  'Fira Code', 'Cascadia Code', monospace;
  --nav-h:      60px;
  --shadow:     0 4px 24px rgba(0,0,0,.45);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; scroll-padding-top: calc(var(--nav-h) + 16px); }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.75;
  -webkit-font-smoothing: antialiased;
}

/* ── Typography ──────────────────────────────────────────── */
h1,h2,h3,h4,h5,h6 { color: var(--heading); line-height: 1.3; font-weight: 700; }
h1 { font-size: clamp(1.8rem, 4vw, 2.8rem); }
h2 { font-size: clamp(1.4rem, 3vw, 2rem); }
h3 { font-size: 1.35rem; }
h4 { font-size: 1.15rem; }

a { color: var(--accent); text-decoration: none; transition: color .15s; }
a:hover { color: var(--accent-h); }

p { margin-bottom: 1.1rem; }

img { max-width: 100%; height: auto; display: block; border-radius: var(--radius); }

code {
  font-family: var(--font-mono);
  font-size: .875em;
  background: var(--bg3);
  color: #e07bbc;
  padding: .15em .4em;
  border-radius: 4px;
}

pre {
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem 1.5rem;
  overflow-x: auto;
  margin: 1.5rem 0;
}
pre code { background: none; padding: 0; color: var(--text); }

blockquote {
  border-left: 3px solid var(--accent);
  margin: 1.5rem 0;
  padding: .75rem 1.5rem;
  background: var(--bg2);
  border-radius: 0 var(--radius) var(--radius) 0;
  color: var(--text-dim);
  font-style: italic;
}

table { width: 100%; border-collapse: collapse; margin: 1.5rem 0; }
th,td { padding: .65rem 1rem; border: 1px solid var(--border); text-align: left; }
th { background: var(--bg3); color: var(--heading); font-weight: 600; }
tr:nth-child(even) { background: var(--bg2); }

ul, ol { padding-left: 1.75rem; margin-bottom: 1.1rem; }
li { margin-bottom: .35rem; }

hr { border: none; border-top: 1px solid var(--border); margin: 2.5rem 0; }

/* ── Layout ──────────────────────────────────────────────── */
.container { max-width: 1140px; margin: 0 auto; padding: 0 1.25rem; }
.content-wrap { display: grid; grid-template-columns: 1fr 300px; gap: 2.5rem; padding: 2rem 0 4rem; }
@media (max-width: 900px) { .content-wrap { grid-template-columns: 1fr; } .sidebar { display: none; } }

/* ── Navbar ──────────────────────────────────────────────── */
.site-nav {
  position: fixed; top: 0; left: 0; right: 0; z-index: 1000;
  height: var(--nav-h);
  background: rgba(15,17,23,.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center;
}
.site-nav .container { display: flex; align-items: center; justify-content: space-between; width: 100%; }

.nav-brand { display: flex; align-items: center; gap: .75rem; color: var(--heading); font-weight: 700; font-size: 1.2rem; }
.nav-brand img { height: 36px; width: auto; border-radius: 6px; }
.nav-brand:hover { color: var(--accent); }

.nav-links { display: flex; align-items: center; gap: .25rem; list-style: none; }
.nav-links a { padding: .4rem .75rem; border-radius: var(--radius); color: var(--text); font-size: .9rem; transition: background .15s, color .15s; }
.nav-links a:hover { background: var(--bg3); color: var(--heading); }

.nav-search-btn { background: none; border: none; cursor: pointer; color: var(--text-dim); padding: .4rem; display: flex; align-items: center; }
.nav-search-btn:hover { color: var(--accent); }

.nav-toggle { display: none; background: none; border: none; cursor: pointer; color: var(--text); padding: .4rem; }

@media (max-width: 768px) {
  .nav-toggle { display: flex; }
  .nav-links { display: none; position: absolute; top: var(--nav-h); left: 0; right: 0; background: var(--bg2); border-bottom: 1px solid var(--border); flex-direction: column; padding: .75rem 1rem; gap: .1rem; }
  .nav-links.open { display: flex; }
}

body { padding-top: var(--nav-h); }

/* ── Categories strip ────────────────────────────────────── */
.cat-strip {
  background: var(--bg2);
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
  scrollbar-width: none;
}
.cat-strip::-webkit-scrollbar { display: none; }
.cat-strip-inner { display: flex; align-items: center; gap: .1rem; padding: .35rem 0; white-space: nowrap; }
.cat-strip a { padding: .3rem .9rem; border-radius: 50px; font-size: .8rem; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--text-dim); transition: background .15s, color .15s; }
.cat-strip a:hover, .cat-strip a.active { background: var(--accent); color: #fff; }

/* ── Post cards ──────────────────────────────────────────── */
.post-grid { display: flex; flex-direction: column; gap: 2rem; }

.post-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  display: grid;
  grid-template-columns: 320px 1fr;
  transition: border-color .2s, transform .2s, box-shadow .2s;
}
.post-card:hover { border-color: var(--accent); transform: translateY(-2px); box-shadow: var(--shadow); }

@media (max-width: 700px) { .post-card { grid-template-columns: 1fr; } }

.post-card-img { position: relative; aspect-ratio: 16/9; overflow: hidden; }
.post-card-img img { width: 100%; height: 100%; object-fit: cover; border-radius: 0; transition: transform .3s; }
.post-card:hover .post-card-img img { transform: scale(1.04); }

.post-card-body { padding: 1.5rem; display: flex; flex-direction: column; gap: .5rem; }

.post-meta { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; font-size: .8rem; color: var(--text-dim); }
.post-meta .cat-badge { background: var(--accent); color: #fff; padding: .15rem .6rem; border-radius: 50px; font-weight: 600; text-transform: uppercase; font-size: .7rem; }

.post-card-title { font-size: 1.25rem; font-weight: 700; color: var(--heading); line-height: 1.3; }
.post-card-title a { color: inherit; }
.post-card-title a:hover { color: var(--accent); }

.post-card-excerpt { color: var(--text-dim); font-size: .9rem; line-height: 1.6; flex: 1; }

.read-more { display: inline-flex; align-items: center; gap: .4rem; font-size: .85rem; font-weight: 600; color: var(--accent); margin-top: .5rem; }
.read-more:hover { gap: .65rem; }
.read-more::after { content: '→'; transition: margin-left .15s; }

/* ── Single post ─────────────────────────────────────────── */
.post-hero { width: 100%; max-height: 480px; object-fit: cover; border-radius: var(--radius-lg); margin-bottom: 2rem; }

.post-header { margin-bottom: 2rem; }
.post-header h1 { margin-bottom: .75rem; }

.post-content { font-size: 1.05rem; line-height: 1.85; }
.post-content h2 { margin: 2rem 0 1rem; }
.post-content h3 { margin: 1.5rem 0 .75rem; }
.post-content p  { margin-bottom: 1.25rem; }
.post-content img { margin: 1.5rem 0; }
.post-content a  { text-decoration: underline; text-underline-offset: 3px; }

.tag-list { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: 2rem; }
.tag { background: var(--bg3); color: var(--text-dim); padding: .25rem .75rem; border-radius: 50px; font-size: .8rem; }
.tag:hover { background: var(--accent); color: #fff; }

/* ── Comments ────────────────────────────────────────────── */
.comments-section { margin-top: 3rem; padding-top: 2rem; border-top: 1px solid var(--border); }
.comment-list { display: flex; flex-direction: column; gap: 1.25rem; margin: 1.5rem 0; }
.comment {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
}
.comment-author { font-weight: 600; color: var(--heading); }
.comment-date { color: var(--text-dim); font-size: .8rem; }
.comment-body { margin-top: .6rem; font-size: .95rem; }

/* ── Forms ───────────────────────────────────────────────── */
.form-group { margin-bottom: 1.1rem; }
label { display: block; margin-bottom: .4rem; font-size: .875rem; font-weight: 500; color: var(--text-dim); }
input, textarea, select {
  width: 100%;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  padding: .6rem .9rem;
  font: inherit;
  font-size: .95rem;
  transition: border-color .15s, box-shadow .15s;
}
input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(51,153,221,.2);
}
textarea { resize: vertical; min-height: 120px; }

.btn {
  display: inline-flex; align-items: center; gap: .5rem;
  padding: .55rem 1.25rem;
  border-radius: var(--radius);
  border: none;
  font: inherit;
  font-size: .9rem;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s, transform .1s;
  text-decoration: none;
}
.btn:active { transform: scale(.98); }
.btn-primary  { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-h); color: #fff; }
.btn-ghost    { background: var(--bg3); color: var(--text); border: 1px solid var(--border); }
.btn-ghost:hover { border-color: var(--accent); color: var(--accent); }
.btn-danger   { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #c94444; color: #fff; }
.btn-sm { padding: .35rem .85rem; font-size: .8rem; }

/* ── Sidebar ─────────────────────────────────────────────── */
.sidebar { display: flex; flex-direction: column; gap: 1.75rem; }
.sidebar-widget { background: var(--bg2); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 1.25rem; }
.widget-title { font-size: .8rem; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--text-dim); margin-bottom: 1rem; padding-bottom: .5rem; border-bottom: 1px solid var(--border); }
.widget-list { list-style: none; padding: 0; }
.widget-list li { padding: .35rem 0; border-bottom: 1px solid var(--border); }
.widget-list li:last-child { border-bottom: none; }
.widget-list a { color: var(--text); font-size: .9rem; }
.widget-list a:hover { color: var(--accent); }
.widget-count { float: right; background: var(--bg3); color: var(--text-dim); font-size: .75rem; padding: .1rem .45rem; border-radius: 50px; }

.newsletter-widget input { margin-bottom: .65rem; }

/* ── Pagination ──────────────────────────────────────────── */
.pagination { display: flex; justify-content: center; align-items: center; gap: .5rem; padding: 2rem 0; }
.pagination a, .pagination span {
  display: inline-flex; align-items: center; justify-content: center;
  width: 38px; height: 38px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--bg2);
  color: var(--text);
  font-size: .9rem;
  transition: all .15s;
}
.pagination a:hover { border-color: var(--accent); color: var(--accent); }
.pagination .current { background: var(--accent); border-color: var(--accent); color: #fff; }

/* ── Search overlay ──────────────────────────────────────── */
.search-overlay {
  position: fixed; inset: 0; z-index: 2000;
  background: rgba(10,12,18,.88);
  backdrop-filter: blur(8px);
  display: none; align-items: flex-start; justify-content: center;
  padding-top: 10vh;
}
.search-overlay.open { display: flex; }
.search-box { background: var(--bg2); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 1.5rem; width: min(640px, 90vw); box-shadow: var(--shadow); }
.search-box input { font-size: 1.15rem; }

/* ── Footer ──────────────────────────────────────────────── */
.site-footer { background: var(--bg2); border-top: 1px solid var(--border); padding: 3rem 0 1.5rem; margin-top: 4rem; }
.footer-grid { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 2rem; margin-bottom: 2rem; }
@media (max-width: 700px) { .footer-grid { grid-template-columns: 1fr; } }
.footer-brand { font-weight: 700; font-size: 1.1rem; color: var(--heading); margin-bottom: .5rem; }
.footer-desc { color: var(--text-dim); font-size: .875rem; }
.footer-heading { font-size: .8rem; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--text-dim); margin-bottom: .85rem; }
.footer-links { list-style: none; padding: 0; }
.footer-links li { margin-bottom: .4rem; }
.footer-links a { color: var(--text-dim); font-size: .875rem; }
.footer-links a:hover { color: var(--accent); }
.footer-bottom { border-top: 1px solid var(--border); padding-top: 1rem; display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: .5rem; }
.footer-copy { color: var(--text-dim); font-size: .8rem; }

/* ── Message / Alert ─────────────────────────────────────── */
.alert { padding: 1rem 1.25rem; border-radius: var(--radius); border: 1px solid; margin: 1rem 0; }
.alert-success { background: rgba(58,158,111,.12); border-color: var(--success); color: #6ac99a; }
.alert-danger   { background: rgba(224,85,85,.12); border-color: var(--danger); color: #f08080; }
.alert-info     { background: rgba(51,153,221,.12); border-color: var(--accent); color: #80c4ee; }

/* ── Sticky badge ────────────────────────────────────────── */
.sticky-badge { background: var(--warning); color: #000; padding: .15rem .5rem; border-radius: 4px; font-size: .7rem; font-weight: 700; text-transform: uppercase; }

/* ── Reading progress bar ────────────────────────────────── */
#read-progress { position: fixed; top: 0; left: 0; height: 3px; background: var(--accent); z-index: 9999; width: 0; transition: width .1s; }

/* ── Back to top ─────────────────────────────────────────── */
#back-to-top {
  position: fixed; bottom: 1.5rem; right: 1.5rem;
  width: 42px; height: 42px;
  background: var(--bg3); border: 1px solid var(--border);
  border-radius: 50%; display: none; align-items: center; justify-content: center;
  cursor: pointer; color: var(--text-dim); z-index: 100;
  transition: background .15s, color .15s;
}
#back-to-top.visible { display: flex; }
#back-to-top:hover { background: var(--accent); color: #fff; border-color: var(--accent); }
#back-to-top svg { width: 18px; height: 18px; fill: currentcolor; }

/* ── Code copy button ────────────────────────────────────────── */
.code-wrap { position: relative; }
.code-wrap .copy-btn {
  position: absolute; top: .6rem; right: .6rem;
  background: var(--bg2); border: 1px solid var(--border);
  color: var(--text-dim); border-radius: 5px;
  padding: .25rem .6rem; font-size: .72rem; cursor: pointer;
  opacity: 0; transition: opacity .15s;
}
.code-wrap:hover .copy-btn { opacity: 1; }
.copy-btn.copied { color: var(--success); border-color: var(--success); }

/* ── Share buttons ────────────────────────────────────────────── */
.share-row { display: flex; gap: .5rem; flex-wrap: wrap; margin-top: 1.5rem; }
.share-btn {
  display: inline-flex; align-items: center; gap: .4rem;
  padding: .4rem .9rem; border-radius: 50px; font-size: .8rem;
  font-weight: 600; text-decoration: none; border: 1px solid var(--border);
  color: var(--text-dim); transition: all .15s;
}
.share-btn:hover { border-color: var(--accent); color: var(--accent); }

/* ── Reading mode toggle ─────────────────────────────────────── */
.read-mode-btn {
  position: fixed; bottom: 4.5rem; right: 1.5rem;
  width: 42px; height: 42px;
  background: var(--bg3); border: 1px solid var(--border);
  border-radius: 50%; display: flex; align-items: center;
  justify-content: center; cursor: pointer; color: var(--text-dim);
  z-index: 100; transition: background .15s, color .15s;
  font-size: 1rem;
}
.read-mode-btn:hover { background: var(--accent); color: #fff; border-color: var(--accent); }

body.reading-mode .site-nav,
body.reading-mode .cat-strip,
body.reading-mode .sidebar,
body.reading-mode .site-footer,
body.reading-mode .comments-section { display: none !important; }
body.reading-mode .content-wrap { grid-template-columns: 1fr; max-width: 720px; margin: 0 auto; }
body.reading-mode .post-content { font-size: 1.15rem; line-height: 2; }

/* ── Print ──────────────────────────────────────────────────── */
@media print {
  .site-nav, .cat-strip, .sidebar, .site-footer,
  .comments-section, #back-to-top, .read-mode-btn,
  .share-row, .tag-list, nav.pagination { display: none !important; }
  body { background: #fff; color: #000; padding-top: 0; }
  .content-wrap { grid-template-columns: 1fr; }
  a { color: #000; text-decoration: underline; }
  pre, code { background: #f5f5f5; border: 1px solid #ddd; }
}

/* ── Toast notification ─────────────────────────────────────── */
.nx-toast {
  position: fixed; bottom: 1.5rem; left: 50%; transform: translateX(-50%);
  background: var(--bg3); border: 1px solid var(--border);
  border-radius: 50px; padding: .55rem 1.25rem;
  font-size: .85rem; color: var(--heading);
  z-index: 9999; opacity: 0; transition: opacity .2s;
  pointer-events: none;
}
.nx-toast.show { opacity: 1; }

/* ── Reading mode ────────────────────────────────────────────── */
.read-mode-btn {
  position: fixed; bottom: 4.5rem; right: 1.5rem;
  width: 42px; height: 42px;
  background: var(--bg3); border: 1px solid var(--border);
  border-radius: 50%; display: flex; align-items: center; justify-content: center;
  cursor: pointer; font-size: 1.1rem; z-index: 100;
  transition: background .15s, border-color .15s;
}
.read-mode-btn:hover { background: var(--bg2); border-color: var(--accent); }

body.reading-mode .content-wrap { grid-template-columns: 1fr; }
body.reading-mode .sidebar { display: none; }
body.reading-mode .post-content {
  font-size: 1.15rem;
  line-height: 2;
  max-width: 700px;
  margin: 0 auto;
}
body.reading-mode .site-nav,
body.reading-mode .cat-strip,
body.reading-mode .read-mode-btn { opacity: .2; transition: opacity .3s; }
body.reading-mode .site-nav:hover,
body.reading-mode .cat-strip:hover,
body.reading-mode .read-mode-btn:hover { opacity: 1; }

/* ── Code copy button ────────────────────────────────────────── */
.code-wrap { position: relative; }
.code-copy {
  position: absolute; top: .5rem; right: .5rem;
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: 4px; padding: .2rem .55rem;
  font-size: .72rem; font-weight: 600; color: var(--text-dim);
  cursor: pointer; opacity: 0; transition: opacity .15s;
}
.code-wrap:hover .code-copy { opacity: 1; }
.code-copy:hover { color: var(--accent); border-color: var(--accent); }
.code-copy.copied { color: var(--success); border-color: var(--success); }

/* ── Post share bar ─────────────────────────────────────────── */
.share-bar {
  display: flex; align-items: center; gap: .65rem;
  flex-wrap: wrap; margin: 2rem 0;
  padding: 1rem 1.25rem;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.share-bar span { font-size: .8rem; font-weight: 700; color: var(--text-dim); text-transform: uppercase; letter-spacing: .06em; }
.share-btn {
  display: inline-flex; align-items: center; gap: .35rem;
  padding: .3rem .8rem;
  border-radius: 50px;
  font-size: .8rem; font-weight: 600;
  text-decoration: none;
  border: 1px solid var(--border);
  color: var(--text);
  background: var(--bg3);
  transition: background .15s, border-color .15s;
}
.share-btn:hover { border-color: var(--accent); color: var(--accent); }

/* ── Post footer author box ─────────────────────────────────── */
.author-box {
  display: flex; align-items: flex-start; gap: 1rem;
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 1.25rem;
  margin: 2rem 0;
}
.author-avatar {
  width: 52px; height: 52px; flex-shrink: 0;
  background: var(--accent); border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.4rem; font-weight: 800; color: #fff;
}
.author-name { font-weight: 700; color: var(--heading); margin-bottom: .2rem; }
.author-role { font-size: .8rem; color: var(--text-dim); text-transform: capitalize; }

/* ── Reading mode ────────────────────────────────────────────── */
.read-mode-btn {
  position: fixed; bottom: 4.5rem; right: 1.5rem;
  width: 42px; height: 42px;
  background: var(--bg3); border: 1px solid var(--border);
  border-radius: 50%; display: flex; align-items: center; justify-content: center;
  cursor: pointer; font-size: 1.1rem; z-index: 100;
  transition: background .15s, border-color .15s;
}
.read-mode-btn:hover { background: var(--bg2); border-color: var(--accent); }
body.reading-mode .content-wrap { grid-template-columns: 1fr; }
body.reading-mode .sidebar { display: none; }
body.reading-mode .post-content { font-size: 1.15rem; line-height: 2; max-width: 700px; margin: 0 auto; }
body.reading-mode .site-nav, body.reading-mode .cat-strip, body.reading-mode .read-mode-btn { opacity:.2; transition:opacity .3s; }
body.reading-mode .site-nav:hover, body.reading-mode .cat-strip:hover, body.reading-mode .read-mode-btn:hover { opacity:1; }

/* ── Code copy button ────────────────────────────────────────── */
.code-wrap { position: relative; }
.code-copy { position:absolute;top:.5rem;right:.5rem;background:var(--bg2);border:1px solid var(--border);border-radius:4px;padding:.2rem .55rem;font-size:.72rem;font-weight:600;color:var(--text-dim);cursor:pointer;opacity:0;transition:opacity .15s; }
.code-wrap:hover .code-copy { opacity:1; }
.code-copy:hover { color:var(--accent);border-color:var(--accent); }
.code-copy.copied { color:var(--success);border-color:var(--success); }

/* ── Post share bar ─────────────────────────────────────────── */
.share-bar { display:flex;align-items:center;gap:.65rem;flex-wrap:wrap;margin:2rem 0;padding:1rem 1.25rem;background:var(--bg2);border:1px solid var(--border);border-radius:var(--radius); }
.share-bar span { font-size:.8rem;font-weight:700;color:var(--text-dim);text-transform:uppercase;letter-spacing:.06em; }
.share-btn { display:inline-flex;align-items:center;gap:.35rem;padding:.3rem .8rem;border-radius:50px;font-size:.8rem;font-weight:600;text-decoration:none;border:1px solid var(--border);color:var(--text);background:var(--bg3);transition:background .15s,border-color .15s; }
.share-btn:hover { border-color:var(--accent);color:var(--accent); }

/* ── Author box ─────────────────────────────────────────────── */
.author-box { display:flex;align-items:flex-start;gap:1rem;background:var(--bg2);border:1px solid var(--border);border-radius:var(--radius-lg);padding:1.25rem;margin:2rem 0; }
.author-avatar { width:52px;height:52px;flex-shrink:0;background:var(--accent);border-radius:50%;display:flex;align-items:center;justify-content:center;font-size:1.4rem;font-weight:800;color:#fff; }
.author-name { font-weight:700;color:var(--heading);margin-bottom:.2rem; }
.author-role { font-size:.8rem;color:var(--text-dim);text-transform:capitalize; }
