/* ============================================================
   MG Blog Widgets v1.1.0 — Stylesheet
   Design system: Playfair Display + Nunito Sans
   Coral #FF6B47 · Charcoal #1A1A2E · Cream #FFF8F0
   ============================================================ */

:root {
    --mg-coral:      #FF6B47;
    --mg-charcoal:   #1A1A2E;
    --mg-muted:      #6B7280;
    --mg-border:     #E8E4DC;
    --mg-bg:         #FAFAF7;
    --mg-cream:      #FFF8F0;
    --mg-white:      #ffffff;
    --mg-ocean:      #1B6CA8;
    --mg-palm:       #2D8A5E;
    --mg-radius:     8px;
    --mg-radius-sm:  4px;
    --mg-shadow:     0 2px 12px rgba(26,26,46,0.07);
    --mg-shadow-hv:  0 8px 28px rgba(26,26,46,0.14);
    --mg-font-serif: 'Playfair Display', Georgia, serif;
    --mg-font-sans:  'Nunito Sans', system-ui, sans-serif;
    --mg-transition: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.mg-carousel-wrap *, .mg-latest-section *, .mg-more-grid *,
.mg-related-wrap *, .mg-breaking-bar *, .mg-feed-grid *,
.mg-load-more-wrap *, .mg-pagination *, .mg-cats-widget * {
    box-sizing: border-box; margin: 0; padding: 0;
}

.mg-no-posts { font-family: var(--mg-font-sans); color: var(--mg-muted); font-size: 14px; padding: 24px 0; text-align: center; }

/* CATEGORY PILL */
.mg-cat-pill {
    display: inline-block; font-family: var(--mg-font-sans); font-size: 10px; font-weight: 700;
    letter-spacing: 1.2px; text-transform: uppercase; padding: 3px 10px; border-radius: 3px;
    text-decoration: none; line-height: 1.6; transition: opacity 0.15s; position: relative; z-index: 2;
}
.mg-cat-pill:hover { opacity: 0.85; }

/* SHARED CARD */
.mg-card-thumb-link { display: block; text-decoration: none; }

.mg-card-thumb {
    position: relative; overflow: hidden; height: 200px;
    border-radius: var(--mg-radius) var(--mg-radius) 0 0;
    display: flex; align-items: flex-end; padding: 12px;
    background-size: cover; background-position: center;
}
.mg-card-thumb--related { height: 160px; }

.mg-card-thumb-overlay {
    position: absolute; inset: 0;
    background: linear-gradient(to top, rgba(26,26,46,0.55) 0%, transparent 65%);
    border-radius: inherit; pointer-events: none;
}

.mg-card-body { padding: 16px; background: var(--mg-white); border-radius: 0 0 var(--mg-radius) var(--mg-radius); flex: 1; display: flex; flex-direction: column; gap: 8px; }
.mg-card-body--main { padding: 20px; gap: 10px; }
.mg-card-body--compact { padding: 12px; gap: 6px; }

.mg-card-title { font-family: var(--mg-font-serif); font-size: 16px; font-weight: 700; line-height: 1.3; color: var(--mg-charcoal); }
.mg-card-title a { color: inherit; text-decoration: none; transition: color 0.15s; }
.mg-card-title a:hover { color: var(--mg-coral); }
.mg-card-title--large { font-size: 20px; }

.mg-card-excerpt { font-family: var(--mg-font-sans); font-size: 13px; color: var(--mg-muted); line-height: 1.65; }

.mg-card-meta { display: flex; align-items: center; gap: 7px; font-family: var(--mg-font-sans); font-size: 11px; color: var(--mg-muted); }
.mg-meta-dot { width: 3px; height: 3px; background: var(--mg-border); border-radius: 50%; display: inline-block; flex-shrink: 0; }

.mg-read-more { display: inline-block; font-family: var(--mg-font-sans); font-size: 12px; font-weight: 700; color: var(--mg-coral); text-decoration: none; margin-top: 4px; transition: opacity 0.15s; }
.mg-read-more:hover { opacity: 0.75; }

/* ============================================================
   FEATURED CAROUSEL
   ============================================================ */
.mg-carousel-wrap {
    position: relative;
    overflow: hidden;
    padding: 16px 0 52px;
}

.mg-carousel-track {
    position: relative;
    height: 420px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.mg-carousel-card {
    position: absolute;
    width: 52%;
    max-width: 560px;
    background: var(--mg-white);
    border-radius: 12px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transition: transform var(--mg-transition), opacity var(--mg-transition), box-shadow var(--mg-transition);
    will-change: transform, opacity;
    cursor: pointer;
}

.mg-carousel-card.mg-carousel-active {
    transform: translateX(0) scale(1);
    opacity: 1;
    z-index: 10;
    box-shadow: 0 16px 48px rgba(26,26,46,0.18);
}
.mg-carousel-card.mg-carousel-next {
    transform: translateX(62%) scale(0.82);
    opacity: 0.55;
    z-index: 5;
    box-shadow: var(--mg-shadow);
    pointer-events: none;
}
.mg-carousel-card.mg-carousel-prev {
    transform: translateX(-62%) scale(0.82);
    opacity: 0.55;
    z-index: 5;
    box-shadow: var(--mg-shadow);
    pointer-events: none;
}
.mg-carousel-card.mg-carousel-hidden {
    transform: translateX(110%) scale(0.7);
    opacity: 0;
    z-index: 1;
    pointer-events: none;
}

.mg-carousel-thumb-link { display: block; text-decoration: none; }
.mg-carousel-thumb {
    height: 240px; position: relative; background-size: cover; background-position: center;
    overflow: hidden; display: flex; align-items: flex-end; padding: 14px;
}
.mg-carousel-overlay {
    position: absolute; inset: 0;
    background: linear-gradient(to top, rgba(26,26,46,0.6) 0%, transparent 60%);
    pointer-events: none;
}

.mg-carousel-body { padding: 18px 20px 20px; display: flex; flex-direction: column; gap: 8px; }
.mg-carousel-title { font-family: var(--mg-font-serif); font-size: 18px; font-weight: 700; line-height: 1.3; color: var(--mg-charcoal); }
.mg-carousel-title a { color: inherit; text-decoration: none; transition: color 0.15s; }
.mg-carousel-title a:hover { color: var(--mg-coral); }
.mg-carousel-excerpt { font-family: var(--mg-font-sans); font-size: 13px; color: var(--mg-muted); line-height: 1.6; }

.mg-carousel-arrow {
    position: absolute; top: 50%; transform: translateY(-60%); z-index: 20;
    background: var(--mg-white); border: 1.5px solid var(--mg-border); border-radius: 50%;
    width: 40px; height: 40px; display: flex; align-items: center; justify-content: center;
    font-size: 16px; color: var(--mg-charcoal); cursor: pointer;
    transition: background var(--mg-transition), border-color var(--mg-transition), color var(--mg-transition);
    box-shadow: var(--mg-shadow);
}
.mg-carousel-arrow:hover { background: var(--mg-coral); border-color: var(--mg-coral); color: white; }
.mg-carousel-prev-btn { left: 8px; }
.mg-carousel-next-btn { right: 8px; }

.mg-carousel-dots { position: absolute; bottom: 18px; left: 0; right: 0; display: flex; justify-content: center; gap: 7px; z-index: 20; }
.mg-carousel-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--mg-border); border: none; cursor: pointer; transition: background var(--mg-transition), transform var(--mg-transition); padding: 0; }
.mg-carousel-dot.mg-dot-active { background: var(--mg-coral); transform: scale(1.3); }
.mg-carousel-dot:hover:not(.mg-dot-active) { background: var(--mg-muted); }

/* ============================================================
   CATEGORY TABS WIDGET
   ============================================================ */
.mg-cats-widget {
    background: var(--mg-white);
    border-top: 1.5px solid var(--mg-border);
    border-bottom: 1.5px solid var(--mg-border);
    position: relative;
}
.mg-cats-widget::after {
    content: ''; position: absolute; right: 0; top: 0; bottom: 0; width: 48px;
    background: linear-gradient(to right, transparent, var(--mg-white));
    pointer-events: none; z-index: 2;
}

.mg-cats-inner {
    display: flex; overflow-x: auto; -webkit-overflow-scrolling: touch;
    scrollbar-width: none; max-width: 1200px; margin: 0 auto; padding: 0 32px;
}
.mg-cats-inner::-webkit-scrollbar { display: none; }

.mg-cat-tab {
    display: inline-flex; align-items: center; gap: 7px;
    padding: 13px 18px 12px; font-family: var(--mg-font-sans); font-size: 12px; font-weight: 600;
    color: var(--mg-muted); text-decoration: none; white-space: nowrap;
    border-bottom: 2.5px solid transparent; transition: color 0.15s, border-color 0.15s;
    flex-shrink: 0;
}
.mg-cat-tab:hover { color: var(--mg-charcoal); }
.mg-cat-tab.mg-cat-active { color: var(--mg-charcoal); border-bottom-color: var(--mg-coral); font-weight: 700; }

.mg-cat-tab-dot {
    width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0;
    display: inline-block; opacity: 0.6; transition: opacity 0.15s, transform 0.15s;
}
.mg-cat-tab:hover .mg-cat-tab-dot,
.mg-cat-tab.mg-cat-active .mg-cat-tab-dot { opacity: 1; transform: scale(1.25); }

.mg-cat-tab-count {
    font-size: 10px; font-weight: 700; color: var(--mg-muted);
    background: var(--mg-bg); border-radius: 10px; padding: 1px 7px;
    line-height: 1.6; transition: background 0.15s, color 0.15s;
    border: 1px solid var(--mg-border);
}
.mg-cat-tab.mg-cat-active .mg-cat-tab-count,
.mg-cat-tab:hover .mg-cat-tab-count { background: var(--mg-coral); color: white; border-color: var(--mg-coral); }

/* ============================================================
   LATEST POSTS
   ============================================================ */
.mg-latest-section { width: 100%; }

.mg-latest-wrap {
    display: grid; grid-template-columns: 3fr 2fr; gap: 24px; padding: 0 0 24px;
}

.mg-latest-main {
    background: var(--mg-white); border: 1px solid var(--mg-border);
    border-radius: var(--mg-radius); overflow: hidden; display: flex;
    flex-direction: column; transition: box-shadow 0.2s;
}
.mg-latest-main:hover { box-shadow: var(--mg-shadow-hv); }

.mg-latest-main-thumb {
    position: relative; height: 260px; display: flex; align-items: flex-end;
    padding: 16px; background-size: cover; background-position: center; overflow: hidden;
}

.mg-latest-sidebar { display: flex; flex-direction: column; gap: 2px; }

.mg-latest-side-card {
    background: var(--mg-white); border: 1px solid var(--mg-border);
    border-radius: var(--mg-radius-sm); padding: 14px 16px;
    display: flex; align-items: flex-start; gap: 12px; flex: 1;
    transition: background 0.15s; cursor: pointer;
}
.mg-latest-side-card:hover { background: var(--mg-bg); }

.mg-side-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; margin-top: 5px; }
.mg-side-content { flex: 1; display: flex; flex-direction: column; gap: 5px; }
.mg-side-title { font-family: var(--mg-font-serif); font-size: 13px; font-weight: 700; color: var(--mg-charcoal); line-height: 1.4; }
.mg-side-title a { color: inherit; text-decoration: none; transition: color 0.15s; }
.mg-side-title a:hover { color: var(--mg-coral); }

/* Overflow grid below */
.mg-latest-overflow {
    display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; padding-bottom: 8px;
}
.mg-latest-overflow:not(:empty) {
    border-top: 1.5px solid var(--mg-border); padding-top: 24px; margin-bottom: 0;
}

@keyframes mg-fade-up {
    from { opacity: 0; transform: translateY(16px); }
    to   { opacity: 1; transform: translateY(0); }
}

.mg-card--overflow {
    background: var(--mg-white); border: 1px solid var(--mg-border);
    border-radius: var(--mg-radius); overflow: hidden; display: flex;
    flex-direction: column; transition: box-shadow 0.2s, transform 0.2s;
    animation: mg-fade-up 0.35s ease both;
}
.mg-card--overflow:hover { box-shadow: var(--mg-shadow-hv); transform: translateY(-3px); }

/* ============================================================
   MORE STORIES
   ============================================================ */
.mg-more-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; padding: 0 0 24px; }

.mg-card--compact {
    background: var(--mg-white); border: 1px solid var(--mg-border);
    border-radius: var(--mg-radius); overflow: hidden; display: flex;
    flex-direction: column; transition: box-shadow 0.2s, transform 0.2s;
}
.mg-card--compact:hover { box-shadow: var(--mg-shadow-hv); transform: translateY(-2px); }

.mg-compact-thumb {
    height: 120px; position: relative; overflow: hidden;
    border-radius: var(--mg-radius) var(--mg-radius) 0 0;
    background-size: cover; background-position: center;
}
.mg-compact-title { font-family: var(--mg-font-serif); font-size: 13px; font-weight: 700; line-height: 1.35; color: var(--mg-charcoal); margin-top: 6px; }
.mg-compact-title a { color: inherit; text-decoration: none; transition: color 0.15s; }
.mg-compact-title a:hover { color: var(--mg-coral); }

/* ============================================================
   RELATED, BREAKING, FEED — unchanged
   ============================================================ */
.mg-related-wrap { padding: 32px 0 0; border-top: 1.5px solid var(--mg-border); margin-top: 40px; }
.mg-related-header { margin-bottom: 20px; }
.mg-related-title { font-family: var(--mg-font-serif); font-size: 20px; font-weight: 700; color: var(--mg-charcoal); display: flex; align-items: center; gap: 12px; }
.mg-title-bar { display: block; width: 4px; height: 24px; background: var(--mg-coral); border-radius: 2px; flex-shrink: 0; }
.mg-related-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.mg-card--related { background: var(--mg-white); border: 1px solid var(--mg-border); border-radius: var(--mg-radius); overflow: hidden; display: flex; flex-direction: column; transition: box-shadow 0.2s, transform 0.2s; }
.mg-card--related:hover { box-shadow: var(--mg-shadow-hv); transform: translateY(-2px); }

.mg-breaking-bar { background: var(--mg-charcoal); padding: 10px 24px; display: flex; align-items: center; gap: 14px; width: 100%; }
.mg-breaking-label { background: var(--mg-coral); color: white; font-family: var(--mg-font-sans); font-size: 10px; font-weight: 700; letter-spacing: 2px; text-transform: uppercase; padding: 3px 10px; border-radius: 3px; white-space: nowrap; flex-shrink: 0; }
.mg-breaking-text { font-family: var(--mg-font-sans); font-size: 13px; font-weight: 600; color: rgba(255,255,255,0.85); text-decoration: none; transition: color 0.15s; }
.mg-breaking-text:hover { color: white; }

.mg-feed-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 20px; padding: 0 0 24px; }
.mg-card--feed { background: var(--mg-white); border: 1px solid var(--mg-border); border-radius: var(--mg-radius); overflow: hidden; display: flex; flex-direction: column; transition: box-shadow 0.2s, transform 0.2s; }
.mg-card--feed:hover { box-shadow: var(--mg-shadow-hv); transform: translateY(-2px); }

/* LOAD MORE */
.mg-load-more-wrap { text-align: center; padding: 16px 0; }
.mg-load-more-btn { display: inline-block; background: transparent; color: var(--mg-charcoal); border: 1.5px solid var(--mg-border); border-radius: 24px; padding: 11px 36px; font-family: var(--mg-font-sans); font-size: 13px; font-weight: 700; cursor: pointer; transition: border-color 0.2s, color 0.2s, background 0.2s; letter-spacing: 0.3px; }
.mg-load-more-btn:hover { border-color: var(--mg-coral); color: var(--mg-coral); background: rgba(255,107,71,0.04); }
.mg-load-more-btn:disabled { opacity: 0.4; cursor: not-allowed; }
.mg-load-more-btn.mg-loading { color: var(--mg-muted); border-color: var(--mg-border); }

/* PAGINATION */
.mg-pagination { display: flex; justify-content: center; gap: 6px; padding: 16px 0 24px; flex-wrap: wrap; }
.mg-pagination .page-numbers { display: inline-flex; align-items: center; justify-content: center; min-width: 36px; height: 36px; padding: 0 10px; font-family: var(--mg-font-sans); font-size: 13px; font-weight: 600; color: var(--mg-charcoal); border: 1.5px solid var(--mg-border); border-radius: var(--mg-radius-sm); text-decoration: none; transition: all 0.15s; }
.mg-pagination .page-numbers:hover, .mg-pagination .page-numbers.current { background: var(--mg-coral); border-color: var(--mg-coral); color: white; }
.mg-pagination .page-numbers.dots { border-color: transparent; background: transparent; }

/* RESPONSIVE */
@media (max-width: 1024px) {
    .mg-more-grid { grid-template-columns: repeat(2, 1fr); }
    .mg-latest-overflow { grid-template-columns: repeat(2, 1fr); }
    .mg-carousel-card { width: 64%; }
}
@media (max-width: 768px) {
    .mg-carousel-track { height: 360px; }
    .mg-carousel-card { width: 82%; }
    .mg-carousel-card.mg-carousel-next { transform: translateX(72%) scale(0.85); }
    .mg-carousel-card.mg-carousel-prev { transform: translateX(-72%) scale(0.85); }
    .mg-carousel-thumb { height: 180px; }
    .mg-latest-wrap { grid-template-columns: 1fr; }
    .mg-latest-overflow { grid-template-columns: repeat(2, 1fr); }
    .mg-more-grid { grid-template-columns: repeat(2, 1fr); }
    .mg-related-grid { grid-template-columns: 1fr; }
    .mg-feed-grid { grid-template-columns: 1fr; }
    .mg-card-thumb { height: 180px; }
    .mg-latest-main-thumb { height: 220px; }
    .mg-cats-inner { padding: 0 16px; }
}
@media (max-width: 480px) {
    .mg-carousel-card { width: 90%; }
    .mg-carousel-card.mg-carousel-next { transform: translateX(88%) scale(0.88); opacity: 0.4; }
    .mg-carousel-card.mg-carousel-prev { transform: translateX(-88%) scale(0.88); opacity: 0.4; }
    .mg-more-grid { grid-template-columns: 1fr; }
    .mg-latest-overflow { grid-template-columns: 1fr; }
    .mg-card-title--large { font-size: 17px; }
    .mg-carousel-arrow { width: 34px; height: 34px; font-size: 14px; }
}
