/*
======================================================================
Variables
======================================================================
*/
:root {
    --bg: #0b0f14;
    --bgElev: #111826;
    --bgHover: #0f1623;
    --text: #e6eefc;
    --muted: #9db0c9;
    --primary: #5aa9ff;
    --primaryHover: #8bc2ff;
    --accent: #00e3a2;
    --danger: #ff647c;
    --border: #1c2940;
    --shadow: 0 10px 30px rgba(0, 0, 0, .35);
    --radius: 14px;
    --radiusSm: 10px;
    --focus: 0 0 0 3px rgba(90, 169, 255, .35);
    --container: 1180px;
    --gap: 22px;
    --gapSm: 12px;
    --gapLg: 32px;
    --trans: .2s ease;
}

/*
======================================================================
Reset / Base / A11y
======================================================================
*/
* { box-sizing: border-box }
html, body { height: 100% }
html { scroll-behavior: smooth }
body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font: 15px/1.6 ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, "Apple Color Emoji", "Segoe UI Emoji";
    text-rendering: optimizeLegibility;
}
img, svg { max-width: 100%; height: auto; display: block }
a { color: var(--primary); text-decoration: none }
a:hover { color: var(--primaryHover) }
button, input, select, textarea { font: inherit; color: inherit }
::selection { background: #10325a; color: #eaf3ff }

/* A11y */
.skip-link { position: absolute; left: -9999px; top: -9999px }
.skip-link:focus {
    left: 12px; top: 12px; z-index: 9999;
    background: var(--bgElev); color: var(--text);
    padding: 8px 12px; border-radius: var(--radiusSm);
    outline: none; box-shadow: var(--focus)
}

/*
======================================================================
Layout helpers
======================================================================
*/
.container { width: 100%; max-width: var(--container); margin-inline: auto; padding-inline: 20px }
.cr-main { display: block; min-height: 48vh; padding: 0 }

/*
======================================================================
Header v1 (topbar)
======================================================================
*/
.site-header {
    position: sticky; top: 0; z-index: 1000;
    background: linear-gradient(180deg, #0c1522 0%, rgba(12, 21, 34, .92) 100%);
    border-bottom: 1px solid var(--border); backdrop-filter: blur(6px)
}
.site-header__inner {
    display: grid; grid-template-columns: auto auto 1fr;
    gap: var(--gap); align-items: center; min-height: 64px
}

/* Brand */
.brand { display: flex; align-items: center; gap: 12px }
.brand__logo img { height: 36px; width: auto }
.brand__name {
    font-weight: 700; letter-spacing: .2px; padding: 6px 10px;
    border-radius: 10px; background: var(--bgElev); border: 1px solid var(--border);
    box-shadow: inset 0 -2px 0 rgba(255, 255, 255, .02); color: var(--text)
}
.brand__name:hover { background: var(--bgHover) }
.brand__tagline { color: var(--muted); font-size: 12px; display: none }

/* Mobile toggle */
.nav-toggle {
    justify-self: end; display: inline-flex; flex-direction: column; gap: 4px;
    padding: 8px 10px; border-radius: 10px; background: var(--bgElev); border: 1px solid var(--border);
    cursor: pointer; transition: background var(--trans), transform var(--trans)
}
.nav-toggle:hover { background: var(--bgHover) }
.nav-toggle:focus { outline: none; box-shadow: var(--focus) }
.nav-toggle__bar { width: 22px; height: 2px; background: var(--text); border-radius: 2px }
.nav-toggle__label { font-size: 11px; color: var(--muted); line-height: 1; margin-top: 2px }

/* Primary nav */
.site-header__nav { grid-column: 1/-1; margin-top: 10px; display: none }
.site-header__nav.is-open { display: block }
.nav-container {}
.menu { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px }
.menu--primary > li > a {
    display: inline-flex; align-items: center; gap: 8px; padding: 10px 12px;
    border-radius: 10px; color: var(--text); background: var(--bgElev); border: 1px solid var(--border);
    transition: transform var(--trans), background var(--trans), border-color var(--trans)
}
.menu--primary > li > a:hover { background: var(--bgHover); border-color: #2a3e63; transform: translateY(-1px) }
.menu-item.has-icon a { display: flex; align-items: center; gap: 8px }
.menu-item .mi-ico svg, .menu-item .mi-ico img { width: 1.25rem; height: 1.25rem; object-fit: contain }

/*
======================================================================
Header v2 (dashboard + sidebar)
======================================================================
*/
body.layout-dashboard {
    --sidebar-w: 260px;
    --sidebar-bg: #0c1520;
    --sidebar-border: rgba(255, 255, 255, .08);
    background: #0a1220;
}
body.layout-dashboard .cr-main { padding-left: var(--sidebar-w); min-height: 100vh }

/* Sidebar frame */
.cr-sidebar {
    position: fixed; left: 0; top: 0; bottom: 0; z-index: 1000; width: var(--sidebar-w);
    background: var(--sidebar-bg); border-right: 1px solid var(--sidebar-border);
    display: flex; flex-direction: column; padding: .5rem; transition: width .18s ease
}
.admin-bar .cr-sidebar { top: 32px }

/* Brand row */
.cr-sidebar__brand {
    display: flex; align-items: center; justify-content: center; gap: .625rem;
    padding: .5rem .75rem; border-bottom: 1px solid var(--sidebar-border)
}
.cr-logo img { height: 2.25rem; width: auto }
.cr-brand { font-weight: 700; color: var(--text) }
.cr-tagline { color: var(--muted); font-size: .75rem }
.cr-sidebar__toggle {
    margin-left: auto; background: transparent; border: 1px solid var(--sidebar-border);
    color: var(--text); border-radius: .625rem; padding: .375rem .625rem; cursor: pointer
}

/* Sidebar menu */
.cr-sidebar__menu { padding: 12px 6px; overflow-y: auto }
.nav-container--sidebar {}
.menu--sidebar {
    list-style: none; margin: 0; padding: 0; overflow-x: hidden;
    display: flex; flex-direction: column;
}
.menu--sidebar > li { margin: .25rem 0 }
.menu--sidebar a {
    display: block; padding: .625rem .75rem; border-radius: 10px; color: var(--text);
    border: 1px solid transparent; background: transparent;
    transition: background var(--trans), border-color var(--trans), transform var(--trans)
}
.menu--sidebar a:hover,
.menu--sidebar .current-menu-item > a,
.menu--sidebar .current_page_item > a {
    border-color: var(--sidebar-border); background: rgba(255,255,255,.04);
}

/* Sidebar collapse */
body.layout-dashboard.layout-dashboard-collapsed .cr-main { padding-left: 72px }
.cr-sidebar.is-collapsed { width: 72px }
.cr-sidebar.is-collapsed .cr-tagline,
.cr-sidebar.is-collapsed .cr-brand { display: none }
.cr-sidebar.is-collapsed .menu--sidebar a {
    padding: .625rem 0; text-indent: -9999px; white-space: nowrap; overflow: hidden; gap: 0; justify-content: center;
}
.cr-sidebar.is-collapsed .menu--sidebar li { margin: 6px 0 }
.cr-sidebar.is-collapsed .cr-logo img { height: 28px }

/* Sidebar footer + collapse button */
.cr-sidebar__footer {
    display: flex; align-items: center; gap: .5rem; justify-content: center;
    position: absolute; bottom: .5rem; left: .5rem; right: .5rem;
}
.cr-sidebar__collapse {
    width: 100%; height: 2.5rem; display: inline-flex; align-items: center; justify-content: center;
    padding: 0; border-radius: .625rem; cursor: pointer; background: var(--bgElev);
    border: 1px solid var(--border); color: var(--text)
}
.cr-sidebar__collapse:hover { background: var(--bgHover) }
.cr-sidebar__collapse-icon svg { width: 18px; height: 18px; display: block }

/*
======================================================================
Footer
======================================================================
*/
.site-footer { margin-top: 40px; background: linear-gradient(0deg, #0c1522 0%, rgba(12,21,34,.92) 100%); border-top: 1px solid var(--border) }
.site-footer__inner { padding: 32px 0 22px }
.footer__cols { display: grid; grid-template-columns: repeat(12,1fr); gap: var(--gapLg); margin-bottom: 24px }
.footer__col { grid-column: span 4 }
.footer__title { margin: 0 0 10px; font-size: 13px; text-transform: uppercase; letter-spacing: .6px; color: var(--muted) }
.nav-container--footer {}
.menu--footer { display: grid; gap: 6px }
.menu--footer a {
    display: inline-flex; padding: 8px 10px; border-radius: 8px;
    background: transparent; border: 1px dashed transparent; color: var(--text)
}
.menu--footer a:hover { background: var(--bgElev); border-color: var(--border) }

/* Social */
.social-list { list-style: none; margin: 0; padding: 0; display: flex; gap: 10px }
.social-list a {
    display: inline-flex; align-items: center; justify-content: center;
    min-width: 36px; height: 36px; border-radius: 10px;
    background: var(--bgElev); border: 1px solid var(--border); padding: 0 .5rem
}
.social-list a:hover { background: var(--bgHover) }

/* Subscribe */
.subscribe-form { display: grid; gap: 8px }
.subscribe-form__label { font-size: 12px; color: var(--muted) }
.subscribe-form__field { display: flex; gap: 8px }
.subscribe-form__control {
    flex: 1; height: 40px; padding: 0 12px; border-radius: 10px;
    border: 1px solid var(--border); background: #0e1624; color: var(--text);
    outline: none; transition: box-shadow var(--trans), border-color var(--trans)
}
.subscribe-form__control:focus { box-shadow: var(--focus); border-color: #2a3e63 }
.subscribe-form__btn {
    height: 40px; padding: 0 14px; border-radius: 10px;
    border: 1px solid #2a3e63; background: #11233d; color: var(--text);
    cursor: pointer; transition: background var(--trans), transform var(--trans)
}
.subscribe-form__btn:hover { background: #143055; transform: translateY(-1px) }

/* Footer bottom */
.footer__bottom {
    display: flex; align-items: center; justify-content: space-between;
    padding-top: 16px; border-top: 1px solid var(--border)
}
.back-to-top {
    display: inline-flex; align-items: center; justify-content: center;
    width: 36px; height: 36px; border-radius: 10px; background: var(--bgElev); border: 1px solid var(--border)
}
.back-to-top:hover { background: var(--bgHover) }
.back-to-top:focus { outline: none; box-shadow: var(--focus) }

/*
======================================================================
Content components
======================================================================
*/
/* Single */
.single-entry { padding: 22px; border-radius: var(--radius); background: var(--bgElev); border: 1px solid var(--border) }
.single-entry__header { margin-bottom: 12px }
.single-entry__title { margin: 0 0 8px; font-size: 28px; line-height: 1.25 }
.single-meta { list-style: none; padding: 0; margin: 0; display: flex; gap: 12px; color: var(--muted); font-size: 13px }
.single-meta__item a { color: var(--muted) }
.single-entry__thumb { margin: 16px 0 18px; overflow: hidden; border-radius: var(--radiusSm); border: 1px solid var(--border) }
.single-entry__img { display: block; width: 100%; height: auto }
.single-entry__content { font-size: 16px }
.single-entry__content p { margin: 0 0 1em }
.single-entry__content pre, .single-entry__content code {
    background: #0f1624; border: 1px solid var(--border); border-radius: 10px; padding: .6em .8em
}
.single-entry__footer { margin-top: 16px; display: flex; gap: 12px; flex-wrap: wrap; align-items: center }
.single-entry__tags a, .single-entry__cats a {
    display: inline-flex; padding: 6px 10px; border-radius: 999px; background: #0e1624; border: 1px solid var(--border)
}

/* Pages inside post */
.entry-pages { margin-top: 16px; display: flex; gap: 8px; flex-wrap: wrap }
.entry-page__link { display: inline-flex; padding: 6px 10px; border: 1px solid var(--border); border-radius: 10px }

/* Prev/Next */
.single-nav { margin: 20px 0; display: grid; grid-template-columns: 1fr 1fr; gap: var(--gap) }
.single-nav .nav-subtitle { display: none }
.single-nav .nav-title { color: var(--text) }
.single-nav a { display: block; padding: 14px; border: 1px solid var(--border); border-radius: var(--radiusSm); background: var(--bgElev) }
.single-nav a:hover { background: var(--bgHover) }

/* Hero */
.hero {
    position: relative; padding: 48px 0; border-bottom: 1px solid var(--border);
    background: linear-gradient(180deg, #0c1522, rgba(12,21,34,.92)), var(--hero-bg, none);
    background-size: cover; background-position: center; margin-bottom: 40px
}
.hero--compact { padding: 28px 0 }
.hero__title { margin: 0 0 6px; font-size: 32px; line-height: 1.2 }
.hero__subtitle { margin: 0; color: var(--muted) }
.hero--left .hero__inner { text-align: left }
.hero--center .hero__inner { text-align: center }
.hero--right .hero__inner { text-align: right }

/* Breadcrumbs */
.breadcrumbs { margin: 10px 0 }
.breadcrumbs__list { list-style: none; margin: 0; padding: 0; display: flex; gap: 8px; flex-wrap: wrap }
.breadcrumbs__item { display: flex; align-items: center; gap: 8px }
.breadcrumbs__item::after { content: "/"; opacity: .35 }
.breadcrumbs__item:last-child::after { display: none }
.breadcrumbs__link { display: inline-flex; padding: 6px 10px; border: 1px solid var(--border); border-radius: 999px; background: var(--bgElev) }
.breadcrumbs__link:hover { background: var(--bgHover) }
.breadcrumbs__current { opacity: .85 }

/* Sidebar (blog) */
.sidebar { position: sticky; top: 76px }
.sidebar__inner { display: grid; gap: 12px; padding: 12px }
.widget__title { margin: 0 0 8px; font-size: 13px; text-transform: uppercase; letter-spacing: .6px; color: var(--muted) }
.widget__list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px }

/* Archive grid */
.archive-grid { display: grid; grid-template-columns: repeat(12,1fr); gap: var(--gap) }
.archive-item { grid-column: span 4; padding: 12px }
.archive-item__thumb img { width: 100%; height: auto; display: block; border-radius: 10px }
.archive-item__title { margin: 10px 0 6px; font-size: 18px; line-height: 1.35 }
.archive-item__excerpt { margin: 0; color: var(--muted); font-size: 14px }
@media (max-width: 959.98px) { .archive-item { grid-column: span 12 } }

/* Pagination */
.pagination { margin: 22px 0; display: flex; justify-content: center }
.pagination__list { display: flex; gap: 8px; list-style: none; margin: 0; padding: 0; flex-wrap: wrap }
.pagination__item a, .pagination__item span {
    display: inline-flex; padding: 8px 12px; border: 1px solid var(--border); border-radius: 10px; background: var(--bgElev)
}
.pagination__item .current { background: var(--bgHover) }

/*
======================================================================
Generic buttons/cards
======================================================================
*/
button.primary {
    padding: 10px 14px; border-radius: 10px; border: 1px solid #2a3e63;
    background: #142b4b; color: var(--text)
}
button.primary:hover { background: #19365d }
.card { background: var(--bgElev); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow) }
.card--inset { box-shadow: inset 0 0 0 1px rgba(255,255,255,.02) }

/*
======================================================================
States & Animations
======================================================================
*/
[aria-expanded="true"] .nav-toggle__bar:nth-child(1) { transform: translateY(6px) rotate(45deg) }
[aria-expanded="true"] .nav-toggle__bar:nth-child(2) { opacity: 0 }
[aria-expanded="true"] .nav-toggle__bar:nth-child(3) { transform: translateY(-6px) rotate(-45deg) }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; scroll-behavior: auto } }
:root.dev * { outline: 1px solid rgba(0, 255, 163, .09) }

/*
======================================================================
Lazy skeleton (wrapper .lazy-box)
======================================================================
*/
.lazy-box { position: relative; display: block; overflow: hidden; border-radius: .3125rem }
.lazy-box img { width: 100%; height: 100%; object-fit: cover; display: block }
.lazy-box::before {
    content: ""; position: absolute; inset: 0;
    background:
            linear-gradient(90deg, rgba(0,0,0,0) 0%, rgba(255,255,255,.35) 50%, rgba(0,0,0,0) 100%),
            #e6e7eb;
    background-size: 200% 100%, auto;
    animation: crShimmer 1.1s linear infinite;
    transition: opacity .28s ease;
}
@keyframes crShimmer { 0% { background-position: -200% 0, 0 0 } 100% { background-position: 200% 0, 0 0 } }
.lazy-box.is-loaded::before { opacity: 0; pointer-events: none }
.lazy-box.is-error::before { opacity: .8; background: transparent }

/*
======================================================================
Media queries
======================================================================
*/
@media (min-width: 960px) {
    .site-header__inner { grid-template-columns: auto 1fr auto }
    .brand__tagline { display: inline-block }
    .site-header__nav { grid-column: auto; display: block; margin-top: 0; justify-self: end }
    .nav-toggle { display: none }
    .menu--primary { gap: 8px }
    .footer__col { grid-column: span 3 }
}
@media (max-width: 959.98px) {
    .menu--primary { flex-direction: column; gap: 8px }
    .footer__cols { grid-template-columns: 1fr }
    .footer__col { grid-column: span 12 }
}