/* =========================================================
   MAGNOVA — Main Stylesheet
   Modern magazine theme. Uses CSS variables (set by customizer).
   ========================================================= */

/* ------- Reset / Base ------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
    margin: 0;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 16px;
    line-height: 1.65;
    color: var(--magnova-text, #1a1a1a);
    background: var(--magnova-bg, #fff);
    -webkit-font-smoothing: antialiased;
}
img, svg, video { max-width: 100%; height: auto; display: block; }
a { color: var(--magnova-accent, #1d3557); text-decoration: none; transition: color .18s ease; }
a:hover { color: var(--magnova-primary, #e63946); }
button { font: inherit; cursor: pointer; border: 0; background: none; }

h1, h2, h3, h4, h5, h6 {
    font-family: 'Playfair Display', Georgia, serif;
    line-height: 1.25;
    margin: 0 0 .5em;
    font-weight: 700;
    color: #111;
}
p { margin: 0 0 1em; }

/* Accessibility */
.screen-reader-text {
    position: absolute !important;
    clip: rect(1px,1px,1px,1px); width: 1px; height: 1px;
    overflow: hidden;
}
.skip-link {
    position: absolute; top: -50px; left: 8px; z-index: 9999;
    background: var(--magnova-primary); color: #fff; padding: 10px 14px;
    border-radius: 4px;
}
.skip-link:focus { top: 8px; }

/* ------- Layout ------- */
.container {
    width: 100%;
    max-width: 1240px;
    margin: 0 auto;
    padding: 0 20px;
}

/* ------- Buttons ------- */
.btn {
    display: inline-flex; align-items: center; gap: 8px;
    padding: 12px 22px; border-radius: 999px;
    font-weight: 600; font-size: 14px;
    transition: transform .15s ease, box-shadow .2s ease;
}
.btn:hover { transform: translateY(-1px); }
.btn-primary { background: var(--magnova-primary); color: #fff; }
.btn-primary:hover { color: #fff; box-shadow: 0 8px 20px rgba(0,0,0,.15); }

/* =========================================================
   HEADER
   ========================================================= */
.site-header {
    position: sticky; top: 0; z-index: 100;
    background: #fff;
    border-bottom: 1px solid #eee;
    backdrop-filter: blur(8px);
}
.site-header__inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    padding: 16px 20px;
}

/* Logo / Branding */
.site-branding { flex: 0 0 auto; }
.site-branding .site-title-link { display: inline-block; }
.site-title {
    font-family: 'Playfair Display', serif;
    font-size: 28px;
    font-weight: 800;
    letter-spacing: -.02em;
    color: #111;
}
.site-title-link:hover .site-title { color: var(--magnova-primary); }
.site-description {
    font-size: 12px; color: #888; margin: 2px 0 0;
    text-transform: uppercase; letter-spacing: .12em;
}
.custom-logo { max-height: 50px; width: auto; }

/* Nav */
.site-nav { flex: 1; display: flex; justify-content: center; }
.nav-menu {
    display: flex; gap: 4px;
    list-style: none; padding: 0; margin: 0;
    align-items: center;
}
.nav-menu li { position: relative; }
.nav-menu a {
    display: block;
    padding: 10px 16px;
    font-weight: 500;
    font-size: 15px;
    color: #222;
    border-radius: 6px;
    transition: all .15s ease;
}
.nav-menu a:hover,
.nav-menu .current-menu-item > a {
    color: var(--magnova-primary);
    background: rgba(0,0,0,.03);
}
.nav-menu .sub-menu {
    position: absolute; top: 100%; left: 0;
    background: #fff; box-shadow: 0 8px 24px rgba(0,0,0,.1);
    border-radius: 8px; padding: 8px;
    min-width: 200px;
    list-style: none; margin: 0;
    opacity: 0; visibility: hidden; transform: translateY(8px);
    transition: all .2s ease;
}
.nav-menu li:hover > .sub-menu {
    opacity: 1; visibility: visible; transform: translateY(0);
}
.nav-menu .sub-menu a { font-size: 14px; padding: 8px 12px; }

/* Header actions */
.header-actions { display: flex; align-items: center; gap: 6px; }
.header-search-toggle {
    width: 40px; height: 40px; border-radius: 999px;
    color: #222; transition: background .2s ease;
}
.header-search-toggle:hover { background: rgba(0,0,0,.05); color: var(--magnova-primary); }

/* Hamburger */
.hamburger {
    display: none;
    width: 40px; height: 40px;
    flex-direction: column; justify-content: center; align-items: center;
    gap: 5px;
}
.hamburger span {
    width: 22px; height: 2px; background: #111; border-radius: 2px;
    transition: all .25s ease;
}
.hamburger.is-open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.hamburger.is-open span:nth-child(2) { opacity: 0; }
.hamburger.is-open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* Header search dropdown */
.header-search { background: #fafafa; border-top: 1px solid #eee; padding: 16px 0; }
.header-search .search-form { max-width: 600px; margin: 0 auto; }

/* Search form */
.search-form {
    display: flex; align-items: center; gap: 0;
    border: 1px solid #ddd; border-radius: 999px;
    background: #fff; overflow: hidden;
}
.search-field {
    flex: 1; border: 0; padding: 12px 18px;
    font-size: 15px; outline: none; background: transparent;
}
.search-submit {
    padding: 0 20px; height: 44px;
    background: var(--magnova-primary); color: #fff;
    transition: opacity .2s ease;
}
.search-submit:hover { opacity: .9; }

/* =========================================================
   HERO
   ========================================================= */
.hero { padding: 30px 0 10px; }
.hero__layout {
    display: grid;
    grid-template-columns: 1.5fr 1fr;
    gap: 18px;
    min-height: 480px;
}
.hero__main, .hero__side {
    position: relative; overflow: hidden; border-radius: 14px;
    background: #111;
}
.hero__main { grid-row: span 2; }
.hero__side { min-height: 230px; }
.hero__thumb { display: block; height: 100%; position: relative; }
.hero__thumb img {
    width: 100%; height: 100%; object-fit: cover;
    transition: transform .5s ease;
}
.hero__main:hover img, .hero__side:hover img { transform: scale(1.04); }

.hero__overlay {
    position: absolute; inset: 0;
    display: flex; flex-direction: column; justify-content: flex-end;
    padding: 24px;
    background: linear-gradient(180deg, rgba(0,0,0,0) 30%, rgba(0,0,0,.85) 100%);
    color: #fff;
}
.hero__cat {
    display: inline-block; align-self: flex-start;
    background: var(--magnova-primary); color: #fff;
    font-size: 11px; font-weight: 700; letter-spacing: .12em;
    text-transform: uppercase;
    padding: 5px 12px; border-radius: 4px;
    margin-bottom: 10px;
}
.hero__title {
    color: #fff; font-size: 28px; margin: 0 0 8px;
    font-family: 'Playfair Display', serif;
}
.hero__main .hero__title { font-size: 38px; line-height: 1.15; }
.hero__excerpt { color: rgba(255,255,255,.85); font-size: 15px; margin: 0 0 10px; }
.hero__meta { display: flex; gap: 14px; font-size: 13px; color: rgba(255,255,255,.8); }
.hero__meta i { margin-right: 4px; }

/* =========================================================
   BLOCK SYSTEM (.m-block, .m-card, .m-grid)
   ========================================================= */
.m-block { padding: 50px 0 20px; }
.m-block__head {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 26px;
    padding-bottom: 14px;
    border-bottom: 1px solid #eee;
    position: relative;
}
.m-block__head::after {
    content: ""; position: absolute; bottom: -1px; left: 0;
    width: 80px; height: 3px; background: var(--magnova-primary);
}
.m-block__title {
    font-size: 26px; margin: 0;
    font-family: 'Playfair Display', serif;
}
.m-block__more {
    font-size: 13px; font-weight: 600; color: #555;
    text-transform: uppercase; letter-spacing: .1em;
}
.m-block__more:hover { color: var(--magnova-primary); }
.m-block__more i { margin-left: 4px; transition: transform .18s ease; }
.m-block__more:hover i { transform: translateX(4px); }

/* Grid */
.m-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 28px;
}
.m-grid--auto {
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
}

/* Card */
.m-card {
    background: #fff;
    border-radius: 12px;
    overflow: hidden;
    transition: transform .25s ease, box-shadow .25s ease;
    display: flex; flex-direction: column;
}
.m-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 14px 30px rgba(0,0,0,.08);
}
.m-card__thumb {
    position: relative; display: block;
    aspect-ratio: 16 / 10;
    overflow: hidden;
    border-radius: 10px;
    background: #f3f3f3;
}
.m-card__thumb img {
    width: 100%; height: 100%; object-fit: cover;
    transition: transform .5s ease;
}
.m-card:hover .m-card__thumb img { transform: scale(1.06); }
.m-card__placeholder {
    width: 100%; height: 100%;
    background: linear-gradient(135deg,#f0f0f0,#e0e0e0);
}
.m-card__cat {
    position: absolute; top: 12px; left: 12px;
    background: var(--magnova-primary); color: #fff;
    font-size: 11px; font-weight: 700; letter-spacing: .1em;
    text-transform: uppercase;
    padding: 5px 10px; border-radius: 4px;
}
.m-card__body { padding: 16px 4px 8px; }
.m-card__title {
    font-size: 18px; margin: 0 0 8px;
    font-family: 'Playfair Display', serif;
    line-height: 1.3;
}
.m-card__title a { color: #111; }
.m-card__title a:hover { color: var(--magnova-primary); }
.m-card__excerpt {
    color: #555; font-size: 14px; margin: 0 0 10px;
}
.m-card__meta {
    display: flex; gap: 14px; flex-wrap: wrap;
    font-size: 12px; color: #888;
}
.m-card__meta i { margin-right: 4px; }

/* Card variants */
.m-card--large .m-card__title { font-size: 26px; }
.m-card--large .m-card__excerpt { font-size: 15px; }

/* Featured layout (1 large + side list) */
.m-featured { display: grid; grid-template-columns: 1.4fr 1fr; gap: 28px; }
.m-featured__side { display: flex; flex-direction: column; gap: 18px; }
.m-card--side {
    flex-direction: row; gap: 14px;
}
.m-card--side .m-card__thumb {
    flex: 0 0 130px; aspect-ratio: 1; border-radius: 8px;
}
.m-card--side .m-card__cat { font-size: 9px; padding: 3px 6px; }
.m-card--side .m-card__body { padding: 0; flex: 1; }
.m-card--side .m-card__title { font-size: 16px; }

/* List layout */
.m-list { display: flex; flex-direction: column; gap: 26px; }
.m-list .m-card {
    flex-direction: row; gap: 22px;
}
.m-list .m-card__thumb { flex: 0 0 280px; aspect-ratio: 16/11; }
.m-list .m-card__body { padding: 4px 0; flex: 1; }
.m-list .m-card__title { font-size: 22px; }

/* =========================================================
   PAGINATION
   ========================================================= */
.pagination { margin: 50px 0 30px; }
.pagination .nav-links {
    display: flex; gap: 6px; justify-content: center; align-items: center;
}
.pagination a, .pagination span.page-numbers {
    display: inline-flex; align-items: center; justify-content: center;
    min-width: 42px; height: 42px; padding: 0 14px;
    border-radius: 999px;
    font-size: 14px; font-weight: 600;
    color: #444;
    transition: all .18s ease;
}
.pagination a:hover { background: rgba(0,0,0,.05); color: var(--magnova-primary); }
.pagination span.current {
    background: var(--magnova-primary); color: #fff;
}

/* =========================================================
   ARCHIVE / PAGE HEADER
   ========================================================= */
.page-header {
    text-align: center; padding: 40px 0 30px;
}
.page-title {
    font-size: 38px; margin: 0 0 10px;
    font-family: 'Playfair Display', serif;
}
.archive-description { color: #666; max-width: 700px; margin: 0 auto; }

/* Breadcrumb */
.breadcrumb {
    font-size: 13px; color: #777;
    padding: 22px 0 0;
}
.breadcrumb a { color: #777; }
.breadcrumb a:hover { color: var(--magnova-primary); }
.breadcrumb .sep { margin: 0 6px; color: #bbb; }

/* =========================================================
   SINGLE POST
   ========================================================= */
.single-post { padding-bottom: 40px; }
.post-article {
    max-width: 820px; margin: 0 auto;
    padding: 30px 0;
}
.post-header { text-align: center; margin-bottom: 30px; }
.post-category {
    display: inline-block;
    background: var(--magnova-primary); color: #fff;
    font-size: 11px; font-weight: 700; letter-spacing: .12em;
    text-transform: uppercase;
    padding: 6px 14px; border-radius: 4px;
    margin-bottom: 16px;
}
.post-category:hover { color: #fff; opacity: .9; }
.post-title {
    font-size: 44px; line-height: 1.15; margin: 0 0 18px;
    font-family: 'Playfair Display', serif;
}
.post-meta {
    display: flex; flex-wrap: wrap; gap: 18px;
    justify-content: center;
    font-size: 13px; color: #777;
}
.post-meta i { margin-right: 4px; }

.post-thumb {
    margin: 30px 0;
    border-radius: 14px; overflow: hidden;
}
.post-thumb img { width: 100%; height: auto; }

.post-content {
    font-size: 17px; line-height: 1.8;
}
.post-content p { margin: 0 0 1.4em; }
.post-content h2 { font-size: 30px; margin-top: 1.5em; }
.post-content h3 { font-size: 24px; margin-top: 1.3em; }
.post-content blockquote {
    margin: 1.5em 0;
    padding: 18px 26px;
    border-left: 4px solid var(--magnova-primary);
    background: #fafafa;
    font-style: italic; color: #444;
}
.post-content img { border-radius: 10px; margin: 1.2em 0; }
.post-content ul, .post-content ol { padding-left: 24px; }
.post-content code {
    background: #f4f4f4; padding: 2px 6px;
    border-radius: 4px; font-size: .9em;
}
.post-content pre {
    background: #1a1a1a; color: #f5f5f5;
    padding: 18px; border-radius: 8px;
    overflow-x: auto;
}

.post-tags {
    display: flex; flex-wrap: wrap; gap: 8px; align-items: center;
    margin: 30px 0; padding-top: 24px;
    border-top: 1px solid #eee;
    font-size: 13px;
}
.post-tags a, .post-tags span {
    background: #f3f3f3; padding: 5px 12px; border-radius: 999px;
    color: #555; font-size: 12px;
}
.post-tags a:hover { background: var(--magnova-primary); color: #fff; }

.post-share {
    display: flex; gap: 8px; align-items: center;
    margin: 24px 0;
    font-size: 14px; font-weight: 600;
}
.post-share a {
    width: 36px; height: 36px; border-radius: 999px;
    display: inline-flex; align-items: center; justify-content: center;
    background: #f3f3f3; color: #444;
    transition: all .2s ease;
}
.post-share a:hover { background: var(--magnova-primary); color: #fff; transform: translateY(-2px); }

.related-posts { padding: 50px 0 20px; max-width: 1240px; margin: 0 auto; }
.related-posts .m-block__title {
    margin-bottom: 24px; padding-bottom: 14px;
    border-bottom: 1px solid #eee; position: relative;
}
.related-posts .m-block__title::after {
    content: ""; position: absolute; bottom: -1px; left: 0;
    width: 80px; height: 3px; background: var(--magnova-primary);
}

/* =========================================================
   PAGE
   ========================================================= */
.single-page .page-article { max-width: 820px; margin: 0 auto; padding: 30px 0; }
.single-page .page-header { text-align: center; margin-bottom: 30px; }

/* =========================================================
   COMMENTS
   ========================================================= */
.comments-area { max-width: 820px; margin: 50px auto 0; padding-top: 30px; border-top: 1px solid #eee; }
.comments-title { font-size: 24px; margin-bottom: 24px; }
.comment-list { list-style: none; padding: 0; }
.comment-list li { margin-bottom: 24px; }
.comment-author { display: flex; gap: 12px; align-items: center; margin-bottom: 8px; }
.comment-author img { border-radius: 999px; }
.comment-form input[type="text"], .comment-form input[type="email"], .comment-form input[type="url"], .comment-form textarea {
    width: 100%; padding: 12px 14px; border: 1px solid #ddd;
    border-radius: 8px; font-size: 15px; font-family: inherit;
    margin-top: 4px;
}
.comment-form .submit {
    background: var(--magnova-primary); color: #fff;
    padding: 12px 26px; border-radius: 999px;
    font-weight: 600;
}

/* =========================================================
   SIDEBAR / WIDGETS
   ========================================================= */
.sidebar { padding: 30px 0; }
.widget { margin-bottom: 30px; }
.widget-title {
    font-size: 16px; margin: 0 0 14px;
    text-transform: uppercase; letter-spacing: .08em;
    padding-bottom: 8px; border-bottom: 2px solid var(--magnova-primary);
    display: inline-block;
}

/* =========================================================
   FOOTER
   ========================================================= */
.site-footer {
    background: var(--magnova-footer-bg, #0c0c0c);
    color: var(--magnova-footer-text, #e5e7eb);
    padding: 60px 0 0;
    margin-top: 60px;
}
.site-footer__grid {
    display: grid;
    grid-template-columns: 1.6fr 1fr 1fr 1fr;
    gap: 40px;
    padding-bottom: 40px;
    border-bottom: 1px solid rgba(255,255,255,.1);
}
.site-footer .footer-brand .site-title { color: #fff; font-size: 26px; }
.site-footer .footer-brand .site-title-link:hover .site-title { color: var(--magnova-primary); }
.site-footer .custom-logo { filter: brightness(0) invert(1); max-height: 44px; }
.footer-about { color: rgba(255,255,255,.7); font-size: 14px; margin-top: 14px; line-height: 1.7; }

.site-footer .widget-title, .site-footer h5 {
    color: #fff;
    font-size: 14px; letter-spacing: .12em;
    text-transform: uppercase;
    border-bottom: 0;
    padding: 0 0 0 12px;
    border-left: 3px solid var(--magnova-primary);
    margin-bottom: 16px;
    font-family: 'Inter', sans-serif;
    font-weight: 700;
}
.site-footer ul { list-style: none; padding: 0; margin: 0; }
.site-footer ul li { margin-bottom: 10px; }
.site-footer ul li a {
    color: rgba(255,255,255,.7); font-size: 14px;
    transition: color .18s ease, padding-left .18s ease;
}
.site-footer ul li a:hover { color: var(--magnova-primary); padding-left: 6px; }

.footer-social { display: flex; gap: 10px; margin-top: 16px; }
.footer-social a {
    width: 36px; height: 36px; border-radius: 999px;
    display: inline-flex; align-items: center; justify-content: center;
    background: rgba(255,255,255,.08); color: #fff;
    transition: all .2s ease;
}
.footer-social a:hover { background: var(--magnova-primary); transform: translateY(-3px); }

.site-footer__bottom {
    padding: 20px 0; text-align: center;
    font-size: 13px; color: rgba(255,255,255,.55);
}
.site-footer__bottom strong { color: #fff; }

/* =========================================================
   404
   ========================================================= */
.error-404 { padding: 80px 0; }
.error-404__wrap { text-align: center; max-width: 600px; margin: 0 auto; }
.error-404__code {
    font-size: 140px; line-height: 1; margin: 0;
    font-weight: 800;
    background: linear-gradient(135deg, var(--magnova-primary), var(--magnova-accent));
    -webkit-background-clip: text; background-clip: text;
    -webkit-text-fill-color: transparent;
}
.error-404__title { font-size: 30px; margin: 10px 0; }
.error-404__text { color: #666; margin-bottom: 24px; }
.error-404__search { margin-top: 30px; }

/* =========================================================
   Back to top
   ========================================================= */
.back-to-top {
    position: fixed; right: 24px; bottom: 24px; z-index: 99;
    width: 44px; height: 44px;
    background: var(--magnova-primary); color: #fff;
    border-radius: 999px;
    box-shadow: 0 8px 20px rgba(0,0,0,.18);
    transition: all .2s ease;
}
.back-to-top:hover { transform: translateY(-3px); }

/* =========================================================
   Responsive
   ========================================================= */
@media (max-width: 1024px) {
    .m-grid { grid-template-columns: repeat(2, 1fr); }
    .m-featured { grid-template-columns: 1fr; }
    .site-footer__grid { grid-template-columns: 1fr 1fr; }
    .hero__layout { grid-template-columns: 1fr; min-height: auto; }
    .hero__main { grid-row: span 1; }
    .hero__main .hero__title { font-size: 28px; }
    .post-title { font-size: 34px; }
}

@media (max-width: 768px) {
    .hamburger { display: flex; }
    .site-nav {
        position: fixed; top: 0; right: -100%;
        width: 80%; max-width: 320px; height: 100vh;
        background: #fff;
        flex-direction: column; justify-content: flex-start;
        padding: 80px 24px 24px;
        box-shadow: -8px 0 24px rgba(0,0,0,.1);
        transition: right .3s ease;
        z-index: 90;
        overflow-y: auto;
    }
    .site-nav.is-open { right: 0; }
    .nav-menu { flex-direction: column; align-items: stretch; gap: 4px; width: 100%; }
    .nav-menu a { padding: 12px 14px; }
    .nav-menu .sub-menu {
        position: static; opacity: 1; visibility: visible; transform: none;
        box-shadow: none; padding: 0 0 0 16px;
        background: transparent;
    }

    .nav-overlay {
        position: fixed; inset: 0; background: rgba(0,0,0,.4);
        z-index: 80; opacity: 0; visibility: hidden;
        transition: all .25s ease;
    }
    .nav-overlay.is-open { opacity: 1; visibility: visible; }

    .m-grid { grid-template-columns: 1fr; gap: 22px; }
    .m-list .m-card { flex-direction: column; }
    .m-list .m-card__thumb { flex: 0 0 auto; width: 100%; }
    .m-card--side { flex-direction: row; }

    .post-title { font-size: 28px; }
    .page-title { font-size: 28px; }
    .post-content { font-size: 16px; }

    .site-footer__grid { grid-template-columns: 1fr; gap: 30px; text-align: left; }
}

@media (max-width: 480px) {
    .hero__main .hero__title { font-size: 22px; }
    .hero__overlay { padding: 18px; }
    .post-title { font-size: 24px; }
    .error-404__code { font-size: 96px; }
    .container { padding: 0 16px; }
}
