/**
 * Theme Name: MGA Kasinot - Blocksy Child
 * Description: Custom Blocksy child theme for uudetmgakasinot.net - Finnish MGA casino guide
 * Author: UudetMGAKasinot
 * Template: blocksy
 * Version: 1.0.0
 * Text Domain: mga-kasinot
 */

/* ============================================
   ROOT VARIABLES & GLOBAL RESETS
   ============================================ */
:root {
    --mga-primary: #0067FF;
    --mga-primary-dark: #005EE9;
    --mga-primary-light: #3b82f6;
    --mga-dark: #0F172A;
    --mga-dark-2: #1a1a2e;
    --mga-text: #364151;
    --mga-text-light: #6b7280;
    --mga-bg: #f8fafc;
    --mga-bg-alt: #e7f6ff;
    --mga-white: #ffffff;
    --mga-border: #e2e8f0;
    --mga-success: #10b981;
    --mga-warning: #f59e0b;
    --mga-danger: #dc3545;
    --mga-radius: 12px;
    --mga-radius-lg: 16px;
    --mga-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
    --mga-shadow-lg: 0 8px 25px rgba(0, 103, 255, 0.15);
    --mga-transition: all 0.3s ease;
    --mga-font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --mga-max-width: 1200px;
}

/* ============================================
   GLOBAL STYLES
   ============================================ */
body {
    font-family: var(--mga-font);
    color: var(--mga-text);
    background: var(--mga-bg);
    line-height: 1.7;
    -webkit-font-smoothing: antialiased;
}

/* Fix Blocksy content area - don't fight inline styles */
.entry-content {
    font-size: 1rem;
    line-height: 1.7;
}

/* ============================================
   HIDE BLOCKSY DUPLICATE PAGE TITLE
   Content already has its own H1 title inside
   .entry-content, so hide Blocksy's entry-header
   ============================================ */
body.page .entry-header,
body.single .entry-header,
article .entry-header,
.site-main .entry-header,
[data-prefix] .entry-header,
header.entry-header {
    display: none !important;
    height: 0 !important;
    overflow: hidden !important;
    margin: 0 !important;
    padding: 0 !important;
}

/* ============================================
   HEADER - DARK BACKGROUND

   Blocksy's exact rule is:
   [data-header*="type-1"] .ct-header [data-row*="middle"] {
       background-color: var(--theme-palette-color-8);   // = #ffffff
   }

   We override by:
   1. Overriding --theme-palette-color-8 in header context
   2. Matching Blocksy's exact selector + adding !important
   3. Using #id selectors for maximum specificity
   ============================================ */

/* Override the CSS variable that Blocksy uses for header bg */
[data-header*="type-1"],
[data-header*="type-1"] .ct-header {
    --theme-palette-color-8: transparent !important;
}

#header.ct-header,
header#header.ct-header,
header.ct-header[data-id="type-1"],
header[data-id="type-1"] {
    background: #0F172A !important;
    background-color: #0F172A !important;
    background-image: linear-gradient(135deg, #0F172A 0%, #16213e 100%) !important;
    box-shadow: 0 2px 20px rgba(0, 0, 0, 0.15);
    position: sticky;
    top: 0;
    z-index: 1000;
}

/* Match Blocksy's EXACT selector + add !important */
[data-header*="type-1"] .ct-header [data-row*="middle"],
[data-header*="type-1"] .ct-header [data-row*="top"],
[data-header*="type-1"] .ct-header [data-row*="bottom"],
[data-header*="type-1"] .ct-header [data-row] {
    background: transparent !important;
    background-color: transparent !important;
    background-image: none !important;
}

/* Also with #id for extra specificity */
#header [data-row],
#header.ct-header [data-row],
#header [data-row="middle"],
#header [data-row="top"],
#header [data-row="bottom"] {
    background: transparent !important;
    background-color: transparent !important;
    background-image: none !important;
}

/* Override container inside rows */
#header .ct-container,
[data-header*="type-1"] .ct-header .ct-container {
    background: transparent !important;
    background-color: transparent !important;
}

/* Site title / logo text - white */
#header .site-title,
#header .site-title a,
header.ct-header .site-title a,
[data-header*="type-1"] .ct-header [data-id="logo"] .site-title a {
    color: #ffffff !important;
    --theme-link-initial-color: #ffffff !important;
    font-weight: 800;
    font-size: 1.4rem;
    text-decoration: none;
}

/* ============================================
   NAVIGATION MENU - WHITE TEXT
   Blocksy uses --theme-link-initial-color CSS
   variable set via inline styles. Override both
   the variable AND the color property.
   ============================================ */
#header .ct-menu-link,
#header nav a,
#header .menu a,
#header .menu-container a,
#header [data-id="menu"] a,
#header [data-id="menu"] .ct-menu-link,
#header .header-menu-1 a,
#header .header-menu-1 .ct-menu-link,
#header ul.menu > li > a,
#header ul.menu > li > .ct-menu-link,
header.ct-header .ct-menu-link,
header.ct-header nav.menu-container a,
[data-header*="type-1"] .ct-header [data-id="menu"] > ul > li > a {
    color: #ffffff !important;
    --theme-link-initial-color: #ffffff !important;
    --theme-link-hover-color: #ffffff !important;
    --theme-text-color: #ffffff !important;
    font-weight: 600;
    font-size: 0.8rem;
    padding: 6px 10px !important;
    border-radius: 6px;
    transition: all 0.3s ease;
    white-space: nowrap;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

#header .ct-menu-link:hover,
#header nav a:hover,
#header .menu a:hover,
#header ul.menu > li > a:hover,
#header ul.menu > li.current_page_item > a,
#header ul.menu > li.current-menu-item > a,
header.ct-header .ct-menu-link:hover {
    color: #ffffff !important;
    background: rgba(0, 103, 255, 0.3) !important;
}

/* "More" dropdown arrow */
#header .ct-sub-menu-parent > .ct-menu-link::after,
#header .menu li .ct-menu-link::after {
    border-color: #ffffff !important;
}

/* Dropdown/submenu */
#header .sub-menu,
header.ct-header .sub-menu {
    background: #0F172A !important;
    border: 1px solid rgba(255,255,255,0.1);
}

#header .sub-menu a,
#header .sub-menu .ct-menu-link,
header.ct-header .sub-menu .ct-menu-link {
    color: rgba(255, 255, 255, 0.8) !important;
    --theme-link-initial-color: rgba(255,255,255,0.8) !important;
    font-size: 0.8rem;
    text-transform: none;
}

#header .sub-menu a:hover,
#header .sub-menu .ct-menu-link:hover {
    color: #ffffff !important;
    background: rgba(0, 103, 255, 0.2) !important;
}

/* Mobile menu trigger button */
#header .ct-toggle,
#header [data-id="trigger"],
header.ct-header .ct-toggle {
    color: #ffffff !important;
    --theme-icon-color: #ffffff !important;
}

/* Mobile menu panel */
.ct-panel .mobile-menu a,
.ct-panel .ct-menu-link {
    color: var(--mga-dark) !important;
}

/* Search icon in header */
#header [data-id="search"] svg,
#header [data-id="search"] {
    color: #ffffff !important;
    --theme-icon-color: #ffffff !important;
}

/* Logo image */
#header .site-logo-container img,
header.ct-header .site-logo-container img {
    max-height: 45px;
    width: auto;
}

/* ============================================
   HERO BANNER (for homepage)
   ============================================ */
.mga-hero {
    background: linear-gradient(135deg, var(--mga-dark) 0%, #16213e 50%, var(--mga-primary-dark) 100%);
    padding: 60px 0 50px;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.mga-hero::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: radial-gradient(circle at 30% 50%, rgba(0, 103, 255, 0.15) 0%, transparent 60%);
}

.mga-hero h1 {
    color: var(--mga-white) !important;
    font-size: 2.5rem;
    font-weight: 800;
    margin-bottom: 16px;
}

.mga-hero p {
    color: rgba(255, 255, 255, 0.85) !important;
    font-size: 1.15rem;
    max-width: 700px;
    margin: 0 auto;
}

/* ============================================
   CONTENT AREA - COMPLEMENT INLINE STYLES
   ============================================ */

/* Don't override inline .entry-content styles, enhance around them */
.site-main {
    padding: 2rem 0;
}

.site-main .entry-content > * {
    max-width: var(--mga-max-width);
    margin-left: auto;
    margin-right: auto;
}

/* ============================================
   CASINO CARDS (used in page content)
   ============================================ */
.casino-card,
.entry-content .casino-card {
    background: var(--mga-white);
    border-radius: var(--mga-radius-lg);
    box-shadow: var(--mga-shadow);
    padding: 24px;
    margin: 1.5rem 0;
    border: 1px solid var(--mga-border);
    transition: var(--mga-transition);
}

.casino-card:hover {
    box-shadow: var(--mga-shadow-lg);
    transform: translateY(-2px);
}

.casino-card .casino-rating {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: linear-gradient(135deg, var(--mga-warning), #f97316);
    color: var(--mga-white) !important;
    padding: 4px 12px;
    border-radius: 20px;
    font-weight: 700;
    font-size: 0.9rem;
}

/* CTA Buttons */
.entry-content .cta-button,
.cta-button,
.btn-primary {
    display: inline-block;
    background: linear-gradient(135deg, var(--mga-primary) 0%, var(--mga-primary-dark) 100%);
    color: var(--mga-white) !important;
    padding: 12px 28px;
    border-radius: 10px;
    font-weight: 700;
    font-size: 1rem;
    text-decoration: none !important;
    border: none;
    cursor: pointer;
    transition: var(--mga-transition);
    box-shadow: 0 4px 15px rgba(0, 103, 255, 0.3);
}

.cta-button:hover,
.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 103, 255, 0.4);
    color: var(--mga-white) !important;
}

/* ============================================
   TRUST BADGES
   ============================================ */
.trust-badges,
.entry-content .trust-badges {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
    justify-content: center;
    margin: 2rem 0;
}

.trust-badge {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--mga-white);
    padding: 10px 18px;
    border-radius: 10px;
    border: 1px solid var(--mga-border);
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--mga-dark) !important;
}

.trust-badge i {
    color: var(--mga-success) !important;
    font-size: 1.1rem;
}

/* ============================================
   TABLE OF CONTENTS
   ============================================ */
.toc-wrapper,
.custom-toc {
    background: linear-gradient(135deg, var(--mga-bg) 0%, var(--mga-bg-alt) 100%);
    border: 2px solid var(--mga-primary);
    border-radius: var(--mga-radius-lg);
    padding: 28px 32px;
    margin: 2rem 0;
    box-shadow: 0 4px 15px rgba(0, 103, 255, 0.08);
}

.toc-wrapper h3,
.custom-toc h3,
.toc-toggle {
    color: var(--mga-dark) !important;
    font-weight: 700;
}

.toc-wrapper a,
.custom-toc a {
    color: var(--mga-text) !important;
    text-decoration: none;
    transition: var(--mga-transition);
}

.toc-wrapper a:hover,
.custom-toc a:hover {
    color: var(--mga-primary) !important;
}

/* ============================================
   INFO BOXES & CALLOUTS
   ============================================ */
.key-info-box {
    background: linear-gradient(135deg, var(--mga-primary) 0%, var(--mga-primary-light) 50%, var(--mga-primary-dark) 100%);
    padding: 32px;
    border-radius: var(--mga-radius-lg);
    margin: 2rem 0;
    box-shadow: 0 8px 25px rgba(0, 103, 255, 0.2);
}

.key-info-box * {
    color: var(--mga-white) !important;
}

.rg-warning {
    background: linear-gradient(135deg, #fff8e1 0%, #fff3cd 100%);
    border: 2px solid var(--mga-danger);
    border-radius: var(--mga-radius);
    padding: 24px;
    margin-bottom: 2rem;
}

.rg-warning p,
.rg-warning * {
    color: #856404 !important;
}

/* ============================================
   PROS & CONS
   ============================================ */
.pros-cons {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin: 2rem 0;
}

.pros-box,
.cons-box {
    padding: 24px;
    border-radius: var(--mga-radius);
}

.pros-box {
    background: linear-gradient(135deg, #ecfdf5, #d1fae5);
    border: 1px solid #6ee7b7;
}

.cons-box {
    background: linear-gradient(135deg, #fef2f2, #fee2e2);
    border: 1px solid #fca5a5;
}

.pros-box h3 {
    color: #065f46 !important;
}

.cons-box h3 {
    color: #991b1b !important;
}

/* ============================================
   FAQ ACCORDION
   ============================================ */
.faq-section {
    margin: 2rem 0;
}

.faq-item,
.entry-content details {
    background: var(--mga-white);
    border: 1px solid var(--mga-border);
    border-radius: var(--mga-radius);
    margin-bottom: 12px;
    overflow: hidden;
    transition: var(--mga-transition);
}

.faq-item:hover,
.entry-content details:hover {
    border-color: var(--mga-primary);
    box-shadow: 0 2px 10px rgba(0, 103, 255, 0.08);
}

.entry-content details summary {
    padding: 16px 20px;
    font-weight: 600;
    cursor: pointer;
    color: #0F172A !important;
    list-style: none;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
}

.entry-content details summary::-webkit-details-marker {
    display: none;
}

.entry-content details summary::after {
    content: '\f078';
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
    color: var(--mga-primary);
    transition: var(--mga-transition);
    font-size: 0.8rem;
}

.entry-content details[open] summary::after {
    transform: rotate(180deg);
}

.entry-content details > *:not(summary) {
    padding: 0 20px 16px;
}

/* ============================================
   TABLES (complement inline styles)
   ============================================ */
.entry-content table,
.casino-table {
    width: 100%;
    border-collapse: collapse;
    border-radius: var(--mga-radius);
    overflow: hidden;
    box-shadow: var(--mga-shadow);
    margin: 1.5rem 0;
}

/* ============================================
   AUTHOR BOX
   ============================================ */
.entry-content .author-box,
.mga-author-box {
    display: flex;
    gap: 20px;
    align-items: flex-start;
    background: var(--mga-white);
    border: 1px solid var(--mga-border);
    border-radius: var(--mga-radius-lg);
    padding: 24px;
    margin: 2rem 0;
}

.mga-author-box img,
.author-box .author-avatar {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid var(--mga-primary);
}

/* Hide Blocksy's default author box if custom one exists */
.ct-author-box {
    display: none !important;
}

/* ============================================
   FOOTER
   ============================================ */
footer[data-id="type-1"],
.ct-footer {
    background: linear-gradient(135deg, var(--mga-dark) 0%, #16213e 100%) !important;
    color: rgba(255, 255, 255, 0.8);
}

.ct-footer * {
    color: rgba(255, 255, 255, 0.8) !important;
}

.ct-footer a {
    color: rgba(255, 255, 255, 0.9) !important;
    text-decoration: none;
    transition: var(--mga-transition);
}

.ct-footer a:hover {
    color: var(--mga-primary-light) !important;
}

.ct-footer h3,
.ct-footer h4,
.ct-footer .widget-title {
    color: var(--mga-white) !important;
    font-weight: 700;
    margin-bottom: 16px;
}

/* Custom footer section via functions.php hook */
.mga-footer-custom {
    background: var(--mga-dark);
    padding: 40px 0 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.mga-footer-inner {
    max-width: var(--mga-max-width);
    margin: 0 auto;
    padding: 0 20px;
}

.mga-footer-grid {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr 1fr;
    gap: 40px;
    margin-bottom: 32px;
}

.mga-footer-col h4 {
    color: var(--mga-white) !important;
    font-size: 1rem;
    font-weight: 700;
    margin-bottom: 16px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.mga-footer-col p {
    color: rgba(255, 255, 255, 0.7) !important;
    font-size: 0.9rem;
    line-height: 1.6;
}

.mga-footer-col ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.mga-footer-col ul li {
    margin-bottom: 8px;
}

.mga-footer-col ul li a {
    color: rgba(255, 255, 255, 0.7) !important;
    font-size: 0.9rem;
    text-decoration: none;
    transition: var(--mga-transition);
}

.mga-footer-col ul li a:hover {
    color: var(--mga-primary-light) !important;
    padding-left: 4px;
}

.mga-footer-col ul li a i {
    margin-right: 8px;
    width: 16px;
    color: var(--mga-primary-light) !important;
}

.mga-footer-badges {
    display: flex;
    gap: 12px;
    align-items: center;
    margin-top: 16px;
    flex-wrap: wrap;
}

.mga-footer-badge {
    background: rgba(255, 255, 255, 0.1);
    padding: 8px 14px;
    border-radius: 8px;
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.8) !important;
    display: flex;
    align-items: center;
    gap: 6px;
}

.mga-footer-badge i {
    color: var(--mga-success) !important;
}

.mga-footer-rg {
    background: rgba(220, 53, 69, 0.1);
    border: 1px solid rgba(220, 53, 69, 0.3);
    border-radius: var(--mga-radius);
    padding: 20px;
    margin: 24px 0;
    text-align: center;
}

.mga-footer-rg p {
    color: rgba(255, 255, 255, 0.8) !important;
    font-size: 0.85rem;
    margin: 0;
}

.mga-footer-rg a {
    color: var(--mga-warning) !important;
    font-weight: 600;
}

.mga-footer-bottom {
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    padding-top: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
}

.mga-footer-bottom p {
    color: rgba(255, 255, 255, 0.5) !important;
    font-size: 0.8rem;
    margin: 0;
}

.mga-footer-bottom-links {
    display: flex;
    gap: 20px;
}

.mga-footer-bottom-links a {
    color: rgba(255, 255, 255, 0.5) !important;
    font-size: 0.8rem;
}

/* ============================================
   PGSI QUIZ STYLES
   The page content embeds its own <style> block
   inside .pgsi-quiz with dark gradient background
   and light text. Do NOT override those styles.
   Only add centering/width constraints.
   ============================================ */
.entry-content .pgsi-quiz {
    max-width: var(--mga-max-width) !important;
    margin-left: auto !important;
    margin-right: auto !important;
    box-sizing: border-box !important;
}

/* ============================================
   BREADCRUMBS
   ============================================ */
.ct-breadcrumbs {
    font-size: 0.85rem;
    padding: 12px 0;
}

.ct-breadcrumbs a {
    color: var(--mga-primary) !important;
    text-decoration: none;
}

.ct-breadcrumbs span[aria-current="page"] {
    color: var(--mga-text-light);
}

/* ============================================
   SCROLL TO TOP
   ============================================ */
.mga-scroll-top {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 48px;
    height: 48px;
    background: var(--mga-primary);
    color: var(--mga-white) !important;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 15px rgba(0, 103, 255, 0.3);
    transition: var(--mga-transition);
    opacity: 0;
    visibility: hidden;
    z-index: 999;
}

.mga-scroll-top.visible {
    opacity: 1;
    visibility: visible;
}

.mga-scroll-top:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(0, 103, 255, 0.4);
}

/* ============================================
   RESPONSIVE DESIGN
   ============================================ */
@media (max-width: 991px) {
    .mga-footer-grid {
        grid-template-columns: 1fr 1fr;
        gap: 30px;
    }

    .pros-cons {
        grid-template-columns: 1fr;
    }

    .mga-hero h1 {
        font-size: 2rem;
    }

    .custom-toc ol {
        columns: 1;
    }
}

@media (max-width: 767px) {
    .mga-footer-grid {
        grid-template-columns: 1fr;
        gap: 24px;
    }

    .mga-footer-bottom {
        flex-direction: column;
        text-align: center;
    }

    .mga-hero {
        padding: 40px 20px 30px;
    }

    .mga-hero h1 {
        font-size: 1.6rem;
    }

    .page .entry-title {
        font-size: 1.6rem;
    }

    .trust-badges {
        flex-direction: column;
        align-items: center;
    }

    .mga-author-box,
    .entry-content .author-box {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }

    .key-info-box {
        padding: 20px;
    }

    .entry-content table {
        font-size: 0.85rem;
    }

    .mga-footer-badges {
        justify-content: center;
    }
}

/* ============================================
   ANIMATION & EFFECTS
   ============================================ */
@media (prefers-reduced-motion: no-preference) {
    .casino-card,
    .trust-badge,
    .cta-button {
        transition: var(--mga-transition);
    }
}

/* ============================================
   PRINT STYLES
   ============================================ */
@media print {
    .ct-header,
    .ct-footer,
    .mga-footer-custom,
    .mga-scroll-top,
    .toc-wrapper,
    .custom-toc {
        display: none !important;
    }

    body {
        background: white;
        color: black;
    }
}

/* ============================================
   HIDE-ON-MOBILE/TABLET/DESKTOP UTILITIES
   ============================================ */
@media (max-width: 767px) {
    .hide-on-mobile {
        display: none !important;
    }
}

@media (min-width: 768px) and (max-width: 991px) {
    .hide-on-tablet {
        display: none !important;
    }
}

@media (min-width: 992px) {
    .hide-on-desktop {
        display: none !important;
    }
}

/* ============================================
   FIX: HIDE "SKRIVET AV" SWEDISH TEXT IN .rg-warning
   The page content has a .rg-warning div that contains
   an inline author bar with "Skrivet av: Izak Eklund"
   AND the TOC combined. We restyle the whole block.
   ============================================ */

/* Hide the Swedish "Skrivet av" inline author bar inside .rg-warning */
.rg-warning > div:first-child > div:first-child {
    /* This targets the flex container with avatar + "Skrivet av" */
}

/* Better: hide any element containing "Skrivet av" text - use the inline style pattern */
.rg-warning > div[style*="display: flex"][style*="background: #2E3A46"] {
    display: none !important;
}

/* Style the .rg-warning box itself as a clean TOC container */
.entry-content .rg-warning {
    background: linear-gradient(135deg, var(--mga-bg) 0%, var(--mga-bg-alt) 100%) !important;
    border: 2px solid var(--mga-primary) !important;
    border-radius: var(--mga-radius-lg) !important;
    padding: 24px 28px !important;
    margin: 1.5rem auto !important;
    max-width: var(--mga-max-width) !important;
    box-shadow: 0 4px 15px rgba(0, 103, 255, 0.08) !important;
    box-sizing: border-box !important;
}

/* FIX: Ensure ALL content elements stay within 1200px width.
   WordPress is-layout-constrained may not properly constrain
   all elements (especially wp-block-group with inline styles).
   Force max-width and auto margins on all direct children. */
.entry-content > .rg-warning,
.entry-content > .wp-block-group,
.entry-content > .author-card,
.entry-content > div[style*="background"],
.entry-content > div[style*="editorial"],
.entry-content > div[style*="padding"],
.entry-content > p:first-of-type,
.entry-content > div:first-child {
    max-width: var(--mga-max-width) !important;
    margin-left: auto !important;
    margin-right: auto !important;
    box-sizing: border-box !important;
}

/* Constrain wp-block-group with is-layout-flow.
   WordPress generates high-specificity rules that set max-width:100%
   on .wp-block-group.is-layout-flow. Use body prefix + multiple classes
   for even higher specificity to override. */
body .entry-content.is-layout-constrained > .wp-block-group.is-layout-flow {
    max-width: var(--mga-max-width) !important;
    margin-left: auto !important;
    margin-right: auto !important;
    box-sizing: border-box !important;
}

/* Also target wp-block-group without is-layout-flow */
body .entry-content > .wp-block-group.key-info-box,
body .entry-content > .wp-block-group.bonus-highlight,
body .entry-content > .wp-block-group.helpline-box,
body .entry-content > .wp-block-group.rg-box,
body .entry-content > .wp-block-group.rg-warning,
body .entry-content > .wp-block-group.payment-badge,
body .entry-content > .wp-block-group.faq-item,
body .entry-content > .wp-block-group.custom-toc {
    max-width: var(--mga-max-width) !important;
    margin-left: auto !important;
    margin-right: auto !important;
    box-sizing: border-box !important;
}

.entry-content .rg-warning * {
    color: var(--mga-text) !important;
}

.entry-content .rg-warning a {
    color: var(--mga-primary) !important;
}

/* ============================================
   FIX: HIDE DUPLICATE TOC
   Pages have 2 .custom-toc elements:
   - First one inside .rg-warning (keep this)
   - Second one directly in .entry-content (hide this)
   ============================================ */
/* Ensure TOC is always visible.
   NOTE: Do NOT use :nth-of-type() for class-based hiding!
   :nth-of-type counts by TAG (div), not by class. Since .custom-toc
   is a <div> that's typically not the first div child, :nth-of-type(n+2)
   would hide it even when it's the only .custom-toc on the page.
   Instead, just always show the TOC and hide true duplicates via JS if needed. */
.entry-content .custom-toc {
    display: block !important;
}

/* ============================================
   FIX: STYLE THE .author-card IN CONTENT
   Pages have an .author-card div with
   "Kirjoittanut: Izak Eklund" at the bottom
   ============================================ */
.entry-content .author-card {
    background: linear-gradient(135deg, #0F172A 0%, #1e293b 50%, #334155 100%) !important;
    padding: 20px 28px !important;
    border-radius: var(--mga-radius-lg) !important;
    margin: 2rem auto !important;
    max-width: var(--mga-max-width) !important;
    display: flex !important;
    gap: 16px !important;
    align-items: center !important;
    border: 1px solid rgba(255, 255, 255, 0.1) !important;
    box-sizing: border-box !important;
}

.entry-content .author-card * {
    color: #fff !important;
}

.entry-content .author-card a {
    color: #60a5fa !important;
    text-decoration: none !important;
}

.entry-content .author-card a:hover {
    color: #93bbfc !important;
}

/* ============================================
   FIX: HIDE BLOCKSY REDUNDANT COPYRIGHT FOOTER
   Blocksy adds its own footer row below our custom
   footer. Hide the redundant "WordPress Theme" line.
   ============================================ */
.ct-footer [data-row="bottom"],
footer.ct-footer [data-row="bottom"] {
    display: none !important;
}

/* If Blocksy footer has no useful content, minimize it */
footer[data-id="type-1"] .ct-footer-copyright,
.ct-footer .ct-container [class*="copyright"] {
    display: none !important;
}

/* ============================================
   FIX: BREADCRUMBS
   Style breadcrumbs and ensure they show
   ============================================ */
.ct-breadcrumbs,
nav.ct-breadcrumbs {
    font-size: 0.85rem;
    padding: 12px 0;
    color: var(--mga-text-light);
}

.ct-breadcrumbs a {
    color: var(--mga-primary) !important;
    text-decoration: none;
}

.ct-breadcrumbs a:hover {
    text-decoration: underline;
}

.ct-breadcrumbs span[aria-current="page"] {
    color: var(--mga-text-light);
}

.ct-breadcrumbs .ct-breadcrumbs-separator {
    margin: 0 6px;
    opacity: 0.5;
}

/* ============================================
   FIX: .rg-warning GAMBLING WARNING PARAGRAPH
   Keep the warning at the bottom of .rg-warning
   styled appropriately
   ============================================ */
.entry-content .rg-warning > p:last-child,
.entry-content .rg-warning > p[style*="color: #856404"] {
    background: rgba(220, 53, 69, 0.08) !important;
    border: 1px solid rgba(220, 53, 69, 0.2) !important;
    border-radius: 8px !important;
    padding: 12px 16px !important;
    margin-top: 16px !important;
    font-size: 0.85rem !important;
    color: #856404 !important;
}

.entry-content .rg-warning > p:last-child * {
    color: #856404 !important;
}

/* ============================================
   CONTENT STYLING - MINIMAL, NON-DESTRUCTIVE
   DO NOT override inline content colors.
   The page content has its own <style> blocks
   that handle text colors, table styling, etc.
   We only add light styling for elements that
   DON'T have inline styles.
   ============================================ */

/* Only style headings that DON'T have inline color */
.entry-content h2:not([style*="color"]) {
    font-weight: 700;
    margin-top: 2rem;
    margin-bottom: 0.8rem;
}

/* Hide orphaned footer HTML from page content.
   The real footer is injected via JS as a direct child of <body>.
   Page content has orphaned .mga-footer-col, .mga-footer-rg,
   .mga-footer-bottom divs that render broken without wrapper.
   Also hide any .mga-footer-custom that got absorbed into content
   due to broken HTML - the JS will clean these up and re-inject. */
.entry-content .mga-footer-col,
.entry-content .mga-footer-grid,
.entry-content .mga-footer-rg,
.entry-content .mga-footer-bottom,
.entry-content .mga-footer-custom,
article > .mga-footer-rg,
article > .mga-footer-bottom,
article > .mga-footer-col,
article > .mga-footer-custom {
    display: none !important;
}
/* The JS-injected footer (direct child of body) should always show */
body > .mga-footer-custom {
    display: block !important;
}

/* ============================================
   FIX: HIDE DUPLICATE AUTHOR BOXES
   Also hide any second .author-box or
   .author-card via sibling selectors.
   ============================================ */
.entry-content .author-box ~ .author-box,
.entry-content .author-card ~ .author-card {
    display: none !important;
}

/* ============================================
   FIX: TOC COLLAPSIBLE / SCROLLABLE
   Limit TOC height and add scrollbar
   ============================================ */
.custom-toc ol,
.custom-toc ul,
.toc-wrapper ol,
.toc-wrapper ul {
    max-height: 400px;
    overflow-y: auto;
    padding-right: 8px;
}

/* Custom scrollbar for TOC */
.custom-toc ol::-webkit-scrollbar,
.toc-wrapper ol::-webkit-scrollbar {
    width: 6px;
}

.custom-toc ol::-webkit-scrollbar-thumb,
.toc-wrapper ol::-webkit-scrollbar-thumb {
    background: var(--mga-primary);
    border-radius: 3px;
}

.custom-toc ol::-webkit-scrollbar-track,
.toc-wrapper ol::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.05);
}

/* ============================================
   FIX: HIDE BLOCKSY REDUNDANT COPYRIGHT (extra selectors)
   Strengthen existing rules with additional selectors
   ============================================ */
footer[data-id="type-1"] [data-row="bottom"] {
    display: none !important;
}

footer .copyright {
    display: none !important;
}

/* ============================================
   SCHEMA/SEO HIDDEN ELEMENTS
   ============================================ */
.schema-hidden {
    display: none;
}
