/* ============================================================
   NexusDefault Theme Stylesheet
   NexusCMS Default Theme v1.0.0
   ============================================================ */

/* ─── CSS Custom Properties ─────────────────────────────── */
:root {
    --color-primary:       #3b82f6;
    --color-primary-dark:  #2563eb;
    --color-secondary:     #6366f1;
    --color-accent:        #f59e0b;
    --color-text:          #1e293b;
    --color-text-muted:    #64748b;
    --color-border:        #e2e8f0;
    --color-bg:            #ffffff;
    --color-bg-alt:        #f8fafc;
    --color-card:          #ffffff;
    --color-header-bg:     #ffffff;
    --color-footer-bg:     #1e293b;
    --color-footer-text:   #94a3b8;
    --color-footer-title:  #f1f5f9;
    --color-link:          #3b82f6;
    --color-link-hover:    #2563eb;
    --font-sans:           'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --font-serif:          Georgia, 'Times New Roman', serif;
    --font-mono:           'Fira Code', 'Fira Mono', Menlo, monospace;
    --radius:              0.5rem;
    --radius-lg:           1rem;
    --shadow:              0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.04);
    --shadow-md:           0 4px 6px rgba(0,0,0,.07), 0 2px 4px rgba(0,0,0,.04);
    --shadow-lg:           0 10px 15px rgba(0,0,0,.08), 0 4px 6px rgba(0,0,0,.04);
    --container-width:     1200px;
    --container-padding:   1.5rem;
    --header-height:       70px;
    --transition:          .2s ease;
}

/* ─── Reset & Base ───────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
    scroll-behavior: smooth;
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: var(--font-sans);
    font-size: 1rem;
    line-height: 1.7;
    color: var(--color-text);
    background: var(--color-bg);
    -webkit-font-smoothing: antialiased;
}

img, video { max-width: 100%; height: auto; display: block; }
a { color: var(--color-link); text-decoration: none; transition: color var(--transition); }
a:hover { color: var(--color-link-hover); }
p { margin-bottom: 1em; }
h1,h2,h3,h4,h5,h6 { line-height: 1.25; font-weight: 700; margin-bottom: .75em; color: var(--color-text); }
h1 { font-size: clamp(1.75rem, 4vw, 2.5rem); }
h2 { font-size: clamp(1.35rem, 3vw, 2rem); }
h3 { font-size: 1.35rem; }
h4 { font-size: 1.125rem; }
ul, ol { padding-left: 1.5rem; margin-bottom: 1em; }
li { margin-bottom: .3em; }
code { font-family: var(--font-mono); font-size: .875em; background: var(--color-bg-alt); padding: .1em .4em; border-radius: .25em; border: 1px solid var(--color-border); }
pre { background: #1e293b; color: #e2e8f0; padding: 1.25rem; border-radius: var(--radius); overflow-x: auto; margin-bottom: 1.5em; }
pre code { background: none; border: none; padding: 0; font-size: .9em; }
blockquote { border-left: 4px solid var(--color-primary); padding: .75rem 1.25rem; margin: 1.5rem 0; color: var(--color-text-muted); background: var(--color-bg-alt); border-radius: 0 var(--radius) var(--radius) 0; }
table { width: 100%; border-collapse: collapse; margin-bottom: 1.5em; }
th,td { padding: .65rem 1rem; text-align: left; border-bottom: 1px solid var(--color-border); }
th { font-weight: 600; background: var(--color-bg-alt); }
hr { border: none; border-top: 1px solid var(--color-border); margin: 2rem 0; }

/* ─── Layout ─────────────────────────────────────────────── */
.container { max-width: var(--container-width); margin: 0 auto; padding: 0 var(--container-padding); width: 100%; }

.content-area {
    display: grid;
    grid-template-columns: 1fr 320px;
    gap: 2.5rem;
    padding: 3rem 0;
}

.main-content { min-width: 0; }

.single-main .content-area,
.page-main .content-area { grid-template-columns: 1fr 280px; }

/* ─── Buttons ────────────────────────────────────────────── */
.btn {
    display: inline-flex; align-items: center; gap: .4rem;
    padding: .6rem 1.25rem;
    border-radius: var(--radius);
    font-size: .9rem; font-weight: 500;
    transition: all var(--transition);
    cursor: pointer; border: 2px solid transparent;
    text-decoration: none;
}
.btn-primary { background: var(--color-primary); color: #fff; border-color: var(--color-primary); }
.btn-primary:hover { background: var(--color-primary-dark); border-color: var(--color-primary-dark); color: #fff; }
.btn-outline { background: transparent; color: var(--color-primary); border-color: var(--color-primary); }
.btn-outline:hover { background: var(--color-primary); color: #fff; }

/* ─── Site Header ────────────────────────────────────────── */
.site-header {
    position: sticky; top: 0; z-index: 100;
    background: var(--color-header-bg);
    border-bottom: 1px solid var(--color-border);
    box-shadow: var(--shadow);
    height: var(--header-height);
    display: flex; align-items: center;
}

.header-inner {
    display: flex; align-items: center;
    justify-content: space-between;
    gap: 1.5rem; width: 100%;
}

.site-logo img { height: 44px; width: auto; }

.site-title-link { text-decoration: none; }
.site-title {
    font-size: 1.4rem; font-weight: 800;
    color: var(--color-text); display: block;
    letter-spacing: -.025em;
}
.site-tagline { font-size: .75rem; color: var(--color-text-muted); display: block; font-weight: 400; }

.menu-toggle {
    display: none; background: none; border: none;
    cursor: pointer; padding: .4rem; flex-direction: column;
    gap: 5px; z-index: 101;
}
.hamburger-line {
    display: block; width: 24px; height: 2px;
    background: var(--color-text);
    transition: all var(--transition);
    border-radius: 2px;
}
.menu-toggle.active .hamburger-line:nth-child(1) { transform: rotate(45deg) translate(5px, 5px); }
.menu-toggle.active .hamburger-line:nth-child(2) { opacity: 0; }
.menu-toggle.active .hamburger-line:nth-child(3) { transform: rotate(-45deg) translate(5px, -5px); }

/* ─── Navigation Menu ────────────────────────────────────── */
.site-navigation { margin-left: auto; }
.nav-menu { list-style: none; padding: 0; margin: 0; display: flex; align-items: center; gap: .25rem; }
.nav-menu li { position: relative; }
.nav-menu a {
    display: block; padding: .5rem .85rem;
    color: var(--color-text); font-size: .9rem; font-weight: 500;
    border-radius: var(--radius); transition: all var(--transition);
    white-space: nowrap;
}
.nav-menu a:hover, .nav-menu .current-menu-item > a { color: var(--color-primary); background: rgba(59,130,246,.07); }

/* Dropdown */
.nav-menu .menu-item-has-children > a::after { content: ' ▾'; font-size: .7em; opacity: .7; }
.nav-menu .sub-menu {
    display: none; position: absolute; top: 100%; left: 0;
    background: #fff; min-width: 200px;
    border: 1px solid var(--color-border); border-radius: var(--radius);
    box-shadow: var(--shadow-lg); list-style: none; padding: .5rem 0; z-index: 200;
}
.nav-menu li:hover > .sub-menu { display: block; }
.nav-menu .sub-menu a { border-radius: 0; font-size: .875rem; }

/* ─── Post Cards ─────────────────────────────────────────── */
.posts-wrapper { display: flex; flex-direction: column; gap: 2rem; }

.post-card {
    background: var(--color-card);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow);
    transition: transform var(--transition), box-shadow var(--transition);
}
.post-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }

.post-thumbnail img { width: 100%; height: 200px; object-fit: cover; }

.post-content-wrap { padding: 1.5rem; }

.post-title { margin-bottom: .5rem; }
.post-title a { color: var(--color-text); }
.post-title a:hover { color: var(--color-primary); }

.post-meta { display: flex; align-items: center; gap: .75rem; font-size: .8rem; color: var(--color-text-muted); margin-bottom: 1rem; flex-wrap: wrap; }

.post-excerpt { color: var(--color-text-muted); font-size: .95rem; margin-bottom: 1.25rem; }

.post-footer { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: .5rem; }

/* ─── Single Post / Page ─────────────────────────────────── */
.single-post, .page-article { background: var(--color-card); }

.post-hero-image, .page-hero-image {
    width: 100%; max-height: 400px; object-fit: cover;
    border-radius: var(--radius-lg); margin-bottom: 2rem;
}

.single-header, .page-header { margin-bottom: 1.5rem; padding-bottom: 1.5rem; border-bottom: 1px solid var(--color-border); }
.single-title, .page-title { margin-bottom: .5rem; }

.entry-content { font-size: 1.05rem; line-height: 1.8; }
.entry-content h2 { margin-top: 2rem; }
.entry-content h3 { margin-top: 1.5rem; }
.entry-content img { border-radius: var(--radius); margin: 1.5rem auto; }
.entry-content a { text-decoration: underline; text-underline-offset: 2px; }

.post-navigation { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 1rem; margin-top: 3rem; padding-top: 2rem; border-top: 1px solid var(--color-border); }
.nav-prev, .nav-next { max-width: 48%; font-weight: 500; }

/* ─── Sidebar ────────────────────────────────────────────── */
.sidebar { position: relative; }

.widget {
    background: var(--color-card);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: 1.25rem;
    margin-bottom: 1.5rem;
}
.widget-title { font-size: 1rem; font-weight: 700; margin-bottom: 1rem; padding-bottom: .5rem; border-bottom: 2px solid var(--color-primary); color: var(--color-text); }
.widget ul { list-style: none; padding: 0; }
.widget ul li { padding: .4rem 0; border-bottom: 1px solid var(--color-border); }
.widget ul li:last-child { border-bottom: none; }
.widget ul a { color: var(--color-text-muted); font-size: .9rem; }
.widget ul a:hover { color: var(--color-primary); }

/* ─── Pagination ─────────────────────────────────────────── */
.pagination { display: flex; align-items: center; justify-content: center; gap: .5rem; margin-top: 2rem; flex-wrap: wrap; }
.pagination a, .pagination span {
    display: inline-flex; align-items: center; justify-content: center;
    width: 40px; height: 40px;
    border: 1px solid var(--color-border); border-radius: var(--radius);
    font-size: .875rem; font-weight: 500; color: var(--color-text);
    transition: all var(--transition);
}
.pagination a:hover, .pagination .current { background: var(--color-primary); border-color: var(--color-primary); color: #fff; }

/* ─── Breadcrumbs ────────────────────────────────────────── */
.breadcrumbs { margin-bottom: 1.5rem; }
.breadcrumbs ol { list-style: none; padding: 0; display: flex; flex-wrap: wrap; gap: .5rem; font-size: .85rem; color: var(--color-text-muted); }
.breadcrumbs li:not(:last-child)::after { content: '/'; margin-left: .5rem; opacity: .5; }
.breadcrumbs a { color: var(--color-text-muted); }
.breadcrumbs a:hover { color: var(--color-primary); }

/* ─── Site Footer ────────────────────────────────────────── */
.site-footer { background: var(--color-footer-bg); color: var(--color-footer-text); margin-top: 4rem; }

.footer-widgets-area { padding: 3rem 0; border-bottom: 1px solid rgba(255,255,255,.07); }
.footer-widgets-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 2rem; }

.footer-widget { margin-bottom: 0; }
.footer-widget-title { color: var(--color-footer-title); font-size: 1rem; margin-bottom: 1rem; }
.footer-widget p, .footer-widget li { color: var(--color-footer-text); font-size: .875rem; }
.footer-widget a { color: var(--color-footer-text); }
.footer-widget a:hover { color: #fff; }
.footer-widget ul { list-style: none; padding: 0; }
.footer-widget ul li { padding: .3rem 0; border-bottom: 1px solid rgba(255,255,255,.05); }

.footer-bottom { padding: 1.5rem 0; }
.footer-bottom-inner { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 1rem; }
.footer-copy { font-size: .85rem; margin: 0; }
.footer-copy a { color: var(--color-footer-text); }
.footer-copy a:hover { color: #fff; }

.footer-nav-menu { list-style: none; padding: 0; display: flex; flex-wrap: wrap; gap: 1rem; }
.footer-nav-menu a { font-size: .85rem; color: var(--color-footer-text); }
.footer-nav-menu a:hover { color: #fff; }

/* ─── 404 / Error Pages ──────────────────────────────────── */
.error-page { padding: 5rem 0; text-align: center; }
.error-code { font-size: clamp(6rem, 15vw, 12rem); font-weight: 900; color: var(--color-primary); line-height: 1; opacity: .15; margin-bottom: -2rem; }
.error-title { font-size: 2rem; margin-bottom: 1rem; }
.error-message { color: var(--color-text-muted); max-width: 500px; margin: 0 auto 2rem; }
.error-actions { display: flex; gap: 1rem; justify-content: center; flex-wrap: wrap; }

/* ─── No Posts ───────────────────────────────────────────── */
.no-posts { text-align: center; padding: 4rem 0; }
.no-posts h2 { color: var(--color-text-muted); }

/* ─── Plugin / Extension Zones ───────────────────────────── */
.nexus-plugin-area { margin: 1.5rem 0; }

/* ─── Forms (frontend) ───────────────────────────────────── */
.form-group { margin-bottom: 1.25rem; }
.form-label { display: block; font-size: .875rem; font-weight: 500; margin-bottom: .4rem; }
.form-control {
    width: 100%; padding: .65rem .9rem;
    border: 1px solid var(--color-border);
    border-radius: var(--radius); font-size: .95rem;
    background: var(--color-bg); color: var(--color-text);
    transition: border-color var(--transition), box-shadow var(--transition);
}
.form-control:focus { outline: none; border-color: var(--color-primary); box-shadow: 0 0 0 3px rgba(59,130,246,.15); }

/* ─── Responsive ─────────────────────────────────────────── */
@media (max-width: 1024px) {
    .content-area,
    .single-main .content-area,
    .page-main .content-area { grid-template-columns: 1fr; }
    .sidebar { order: -1; }
    .footer-widgets-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 768px) {
    :root { --container-padding: 1rem; }

    .menu-toggle { display: flex; }

    .site-navigation {
        position: fixed; top: var(--header-height); left: 0; right: 0;
        background: var(--color-header-bg);
        border-top: 1px solid var(--color-border);
        padding: 1rem var(--container-padding);
        transform: translateY(-110%); opacity: 0;
        transition: all var(--transition);
        box-shadow: var(--shadow-lg);
        z-index: 99; pointer-events: none;
    }

    .site-navigation.is-open { transform: translateY(0); opacity: 1; pointer-events: all; }

    .nav-menu { flex-direction: column; align-items: flex-start; gap: .25rem; }
    .nav-menu a { padding: .7rem .5rem; width: 100%; border-radius: var(--radius); }
    .nav-menu .sub-menu { position: static; box-shadow: none; border: none; padding-left: 1rem; display: none; }
    .nav-menu li:hover > .sub-menu { display: none; }
    .nav-menu .sub-menu.open { display: block; }

    .footer-widgets-grid { grid-template-columns: 1fr; }
    .footer-bottom-inner { flex-direction: column; text-align: center; }

    .post-thumbnail img { height: 180px; }
    .content-area { padding: 2rem 0; }

    .post-navigation { flex-direction: column; }
    .nav-prev, .nav-next { max-width: 100%; }
}

@media (max-width: 480px) {
    h1 { font-size: 1.6rem; }
    .post-meta { flex-direction: column; align-items: flex-start; gap: .3rem; }
}

/* ─── Print Styles ───────────────────────────────────────── */
@media print {
    .site-header, .site-footer, .sidebar, .pagination, .post-navigation { display: none !important; }
    .content-area { grid-template-columns: 1fr; }
    body { font-size: 12pt; color: #000; }
    a::after { content: ' (' attr(href) ')'; font-size: 10pt; }
}
