/*
Theme Name: DEC Quiz Theme
Theme URI: https://decquiz.com
Author: DEC Quiz Team
Author URI: https://decquiz.com
Description: Thème enfant professionnel pour DEC Quiz avec architecture modulaire et optimisée. Hérite du thème parent decquiz-parent. Séparation complète du moteur de quiz (plugin) et du visuel (thème).
Version: 1.0.0
Requires at least: 6.0
Tested up to: 6.8
Requires PHP: 7.4
License: GNU General Public License v2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Text Domain: decquiz-theme
Template: decquiz-parent
Tags: quiz, education, professional, modular, optimized, child-theme
*/

/* ============================================
   RESET & BASE STYLES
   ============================================ */
:root {
    /* OVERRIDE PARENT THEME SPACING VARIABLES (Fix 30px padding issue) */
    --wp--preset--spacing--60: 0px !important;
    --wp--preset--spacing--50: 0px !important;
    --wp--preset--spacing--40: 0px !important;
    --wp--preset--spacing--30: 0px !important;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    padding: 0;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    line-height: 1.6;
    color: #1e293b;
    background: #ffffff;
}

/* ============================================
   UTILITY CLASSES
   ============================================ */
.container {
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 20px;
}

@media (min-width: 640px) {
    .container {
        padding: 0 32px;
    }
}

@media (min-width: 1024px) {
    .container {
        padding: 0 40px;
    }
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}

/* ============================================
   FOOTER STYLES (Override Parent)
   ============================================ */
.site-footer {
    background-color: #ffffff;
    border-top: 2px solid #000;
    padding: 40px 0;
    text-align: center;
    position: relative;
    z-index: 10;
}

.site-info {
    font-size: 0.9rem;
    color: #666;
    font-weight: 500;
}

/* ============================================
   QUIZ PAGES - HEADER FIX
   ============================================ */
/* Force header to full width on quiz pages */
body[class*="quiz-gratuit"] header,
body[class*="quiz-gratuit"] .site-header,
body[class*="quiz-gratuit"] #masthead,
body[class*="quiz-gratuit"] .header,
body[class*="quiz-gratuit"] #decquiz-main-header,
body[class*="quiz-gratuit"] #mqa-mobile-menu {
    max-width: 100% !important;
    width: 100% !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
    left: 0 !important;
    right: 0 !important;
}

/* Ensure header container doesn't limit width */
body[class*="quiz-gratuit"] header .container,
body[class*="quiz-gratuit"] .site-header .container,
body[class*="quiz-gratuit"] #masthead .container,
body[class*="quiz-gratuit"] #decquiz-main-header .container {
    max-width: 100% !important;
    width: 100% !important;
    padding-left: 20px !important;
    padding-right: 20px !important;
    margin: 0 auto !important;
}

/* DESKTOP ONLY: Override header layout on quiz pages */
@media (min-width: 969px) {
    body[class*="quiz-gratuit"] #decquiz-main-header {
        padding-left: 0 !important;
        padding-right: 0 !important;
        grid-template-columns: 0px 1fr 200px !important;
        justify-content: center !important;
    }

    body[class*="quiz-gratuit"] #decquiz-main-header .logo {
        display: none !important;
    }

    body[class*="quiz-gratuit"] #decquiz-main-header nav {
        justify-self: center !important;
        padding-left: 40px !important;
    }
}


/* ============================================
   NESTED DROPDOWN SUPPORT (DEC MENU) - NUCLEAR FIX + SKETCH
   ============================================ */

/* 0. GLOBAL OVERRIDES (Crucial for visibility) */
#decquiz-main-header,
#decquiz-main-header nav,
ul.desktop-nav,
ul.submenu,
li.menu-item-has-children {
    overflow: visible !important;
}

/* 1. ANCHOR (LI) */
li.has-nested-submenu {
    position: relative !important;
}

/* 2. TRIGGER AREA EXTENSION (Bridge) */
li.has-nested-submenu::after {
    content: '';
    position: absolute;
    top: -10px;
    right: -40px;
    /* Bridge gap */
    width: 60px;
    height: 150%;
    background: transparent;
    z-index: 99998;
}

/* 3. TRIGGER LINK STYLE */
li.has-nested-submenu>a.nested-trigger {
    display: flex !important;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    padding-right: 20px;
}

/* Hover State */
li.has-nested-submenu:hover>a.nested-trigger {
    background-color: transparent !important;
    color: #2563eb !important;
    font-weight: 600 !important;
}

li.has-nested-submenu:hover>a.nested-trigger::after {
    transform: rotate(90deg);
}

/* 4. THE NESTED MENU (Hidden Child) */
ul.dec-nested-menu {
    display: block !important;
    position: absolute !important;
    top: -10px !important;
    left: 100% !important;
    margin-left: 10px !important;
    /* Closer Gap */
    width: 270px !important;

    background-color: #ffffff !important;
    border: 1px solid #f3f4f6 !important;
    border-radius: 12px !important;
    box-shadow: 0 10px 40px -5px rgba(0, 0, 0, 0.12) !important;
    z-index: 999999 !important;

    visibility: hidden !important;
    opacity: 0 !important;
    transform: translateX(-10px);
    transition: opacity 0.2s, transform 0.2s, visibility 0s 0.2s;
}

/* 5. VISIBILITY STATE */
li.has-nested-submenu:hover>ul.dec-nested-menu {
    visibility: visible !important;
    opacity: 1 !important;
    transform: translateX(0);
    transition-delay: 0s;
}

/* 6. NESTED ITEMS */
ul.dec-nested-menu li {
    display: block !important;
    width: 100% !important;
    margin: 0 !important;
    border: none !important;
}

ul.dec-nested-menu li a {
    display: flex !important;
    align-items: center;
    padding: 12px 20px !important;
    font-size: 1rem !important;
    /* Larger Text */
    font-weight: 500 !important;
    color: #374151 !important;
    /* Darker grey */
    background: transparent !important;
    transition: all 0.15s ease;
}

ul.dec-nested-menu li a:hover {
    background: #f9fafb !important;
    color: #111 !important;
    padding-left: 24px !important;
}

/* ============================================
   SKETCH ICON STYLES (Inline SVG Markers)
   ============================================ */
.sketch-icon {
    width: 28px !important;
    /* Constrain size */
    height: 28px !important;
    margin-right: 12px;
    flex-shrink: 0;
    transition: transform 0.2s ease;

    /* Ensure they behave like text icons */
    display: inline-block;
    vertical-align: middle;
}

/* Hover Effect: Slight bounce/rotate */
a:hover .sketch-icon {
    transform: scale(1.1) rotate(-3deg);
}

/* Color Variants (Stroke) */
.sketch-icon.sketch-blue {
    color: #3b82f6;
}

.sketch-icon.sketch-red {
    color: #ef4444;
}

.sketch-icon.sketch-orange {
    color: #f97316;
}

.sketch-icon.sketch-green {
    color: #10b981;
}

.sketch-icon.sketch-black {
    color: #374151;
}

.sketch-icon.sketch-yellow {
    color: #facc15;
}

/* Bright Yellow */


/* ============================================
   STABILO HIGHLIGHT STYLES (Metadata)
   ============================================ */
.mqa-stabilo-blue {
    background: linear-gradient(100deg, rgba(147, 197, 253, 0) 0%, rgba(147, 197, 253, 0.7) 5%, rgba(147, 197, 253, 0.7) 95%, rgba(147, 197, 253, 0) 100%);
    padding: 0 5px;
    display: inline;
    color: #1a1a1a;
    font-weight: 700;
}

.mqa-meta-full-line {
    display: inline-flex;
    align-items: center;
    gap: 16px;
    padding: 3px 20px;
}

.mqa-meta-full-line strong {
    font-weight: 700;
}


/* ============================================
   SILO CATEGORY TEMPLATE (Master)
   ============================================ */
/* Note: Most styles are inline in the template for Critical CSS performance and dynamic variables. 
   These are global fallbacks/helpers. */

/* Ensure Grid Container has breathing room */
.silo-container {
    padding-bottom: 80px;
}

/* Base Card transition for smoother hover */
.silo-card {
    transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

/* Ensure Sticky Sidebar stays compliant */
.silo-sidebar {
    z-index: 10;
}

/* Mobile Adjustments global overrides if needed */
@media screen and (max-width: 768px) {
    .silo-hero-icon {
        margin: 0 auto;
    }

    .silo-title,
    .silo-intro {
        text-align: center;
    }
}


/* ============================================
   MOBILE METADATA FIX (Article Header)
   ============================================ */
@media screen and (max-width: 768px) {
    .mqa-article-meta .mqa-meta-full-line {
        display: flex !important;
        flex-direction: column !important;
        align-items: flex-start !important;
        gap: 8px !important;
        padding: 15px !important;
        height: auto !important;
        line-height: 1.4 !important;
        white-space: normal !important;
    }

    .mqa-article-meta .mqa-meta-divider {
        display: none !important;
        /* Hide dots on mobile */
    }

    .mqa-article-meta span {
        display: inline-flex !important;
        align-items: center !important;
        font-size: 0.9rem !important;
    }
}