/*
Theme Name:   MDS Group (Astra Child)
Template:     astra
Description:  Thème enfant Astra pour mds-group.tn — Direction A « Industriel ».
Author:       MDS Group
Version:      1.0.18
Text Domain:  mds-astra-child
*/

/* ---------- Tokens ---------- */
:root {
	--mds-primary: #082645;
	--mds-accent: #0184c1;
	--mds-gold: #D4AF37;
	--mds-ink: #1F2937;
	--mds-muted: #6B7280;
	--mds-ground: #F4F3EF;
	--mds-line: #E5E7EB;
	--mds-white: #FFFFFF;
	--mds-font: 'Inter', sans-serif;
	--mds-gutter: 64px;
}

body {
	background: var(--mds-ground);
	color: var(--mds-ink);
	font-family: var(--mds-font);
}
h1, h2, h3, h4, .site-title {
	font-family: var(--mds-font);
	color: var(--mds-primary);
	letter-spacing: -0.02em;
}
a { color: var(--mds-primary); }
a:hover, a:focus { color: var(--mds-accent); }

/* ---------- Layout helpers ---------- */
.mds-section { padding: 72px var(--mds-gutter); margin: 0 !important; }
.mds-section.is-white { background: var(--mds-white); }
.mds-section.is-dark { background: var(--mds-primary); color: var(--mds-white); }
.mds-kicker {
	font-size: 14px !important; font-weight: 600; letter-spacing: 2px;
	text-transform: uppercase; color: var(--mds-accent); margin: 0 0 12px !important;
}
.mds-section.is-dark .mds-kicker { color: var(--mds-gold); }
.mds-lead { font-size: 20px; line-height: 1.55; color: var(--mds-ink); max-width: 520px; }

/* ---------- Absolute Contrast Fixes for Dark Sections & Cards ---------- */
/* Using 'body' prefix to guarantee victory over Astra's core heading colors */
body div.mds-section.is-dark h1,
body div.mds-section.is-dark h2,
body div.mds-section.is-dark h3,
body div.mds-section.is-dark .wp-block-heading {
    color: var(--mds-white) !important;
}

body div.mds-section.is-dark p,
body div.mds-section.is-dark .wp-block-paragraph { 
    color: #D4D7DE !important; 
}

/* HIGH SPECIFICITY: Forcing dark background cards (is-dark) to have light text */
body div.mds-card.is-dark,
body .mds-section .mds-card.is-dark {
    background-color: var(--mds-primary) !important;
    background: var(--mds-primary) !important;
    color: var(--mds-white) !important;
    border: 0 !important;
}

body div.mds-card.is-dark h3,
body div.mds-card.is-dark .wp-block-heading,
body .mds-section .mds-card.is-dark h3,
body .mds-section .mds-card.is-dark .wp-block-heading {
    color: var(--mds-white) !important;
}

body div.mds-card.is-dark p,
body div.mds-card.is-dark .wp-block-paragraph,
body .mds-section .mds-card.is-dark p,
body .mds-section .mds-card.is-dark .wp-block-paragraph {
    color: #D4D7DE !important;
}

body div.mds-card.is-dark .mds-step,
body .mds-section .mds-card.is-dark .mds-step {
    color: var(--mds-gold) !important;
}

/* Forces text inside white cards (within dark sections) to stay dark */
body .mds-section.is-dark .mds-card:not(.is-dark) p,
body .mds-section.is-dark .mds-card:not(.is-dark) .wp-block-paragraph { 
    color: var(--mds-ink) !important; 
}
body .mds-section.is-dark .mds-card:not(.is-dark) h3,
body .mds-section.is-dark .mds-card:not(.is-dark) .wp-block-heading { 
    color: var(--mds-primary) !important; 
}
body .mds-section.is-dark .mds-card:not(.is-dark) .mds-step { 
    color: var(--mds-accent) !important; 
}

/* ---------- Hero ---------- */
.mds-hero h1 { font-size: clamp(44px, 5.4vw, 68px); line-height: 1.02; font-weight: 800; margin: 0 0 24px; color: var(--mds-primary); }
.mds-hero .wp-block-columns { align-items: center; gap: 56px; }
.mds-hero img { border-radius: 6px; width: 100%; height: 460px; object-fit: cover; }
.mds-card.mds-photo { background: var(--mds-primary) !important; border: 0 !important; min-height: 460px; display: flex; align-items: flex-end; }
.mds-card.mds-photo p { color: #C9CDD6; font-size: 14px; }

/* Center the card vertically inside its column */
.mds-hero .wp-block-column:last-child {
    display: flex;
    flex-direction: column;
    justify-content: center;
}

/* Adjusted for the hero logo box to force a centered rectangle */
.mds-card.mds-photo:has(.mds-hero-logo) { 
	background: var(--mds-primary) !important; 
	border: 0 !important;
	align-items: center; 
	justify-content: center; 
	min-height: unset;
	height: auto;
	aspect-ratio: 16 / 9;
	width: 100%;
	box-shadow: none;
}

.mds-hero .mds-hero-logo { margin: 0; }
.mds-hero .mds-hero-logo img { width: 300px; max-width: 70%; height: auto; object-fit: contain; border-radius: 0; margin: 0 auto; display: block; filter: none; }

/* Header logo (Astra Site Identity) */
.site-logo-img img, .custom-logo { max-height: 56px; width: auto; }

/* ---------- Buttons & CTAs (Flat & Outline-free) ---------- */
.wp-block-button .wp-block-button__link { 
    border-radius: 4px; 
    font-weight: 600; 
    padding: 15px 28px; 
    transition: all 0.2s ease-in-out;
    border: none; 
    box-shadow: none !important;
}
.mds-btn-primary .wp-block-button__link { 
    background: var(--mds-primary); 
    color: var(--mds-white); 
}
.mds-btn-primary .wp-block-button__link:hover,
.mds-btn-primary .wp-block-button__link:focus { 
    background: var(--mds-gold); 
    color: var(--mds-primary); 
}

.mds-btn-outline .wp-block-button__link { 
    background: transparent; 
    color: var(--mds-primary); 
}
.mds-btn-outline .wp-block-button__link:hover,
.mds-btn-outline .wp-block-button__link:focus {
    background: rgba(8, 38, 69, 0.05); 
    color: var(--mds-primary);
}

/* Force equal width hero buttons */
.mds-hero .wp-block-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
}
.mds-hero .wp-block-button {
    flex: 1 1 calc(50% - 8px); 
    margin: 0 !important;
}
.mds-hero .wp-block-button__link {
    width: 100%;
    text-align: center;
    box-sizing: border-box;
    display: block; 
}

/* ---------- Key figures ---------- */
.mds-stats { border-top: 2px solid var(--mds-line); padding-top: 24px; }
.mds-stat-number { font-family: var(--mds-font); font-size: 44px !important; font-weight: 800; color: var(--mds-primary); margin: 0 !important; line-height: 1.1; }
.mds-stat-label { font-size: 15px; color: var(--mds-ink); margin: 4px 0 0 !important; }

/* ---------- Cards ---------- */
.mds-card { background: var(--mds-ground); border-radius: 6px; padding: 28px; height: 100%; box-shadow: none; }
.mds-section:not(.is-white) .mds-card { background: var(--mds-white); border: 1px solid var(--mds-line); }
.mds-card h3 { font-size: 24px; margin: 8px 0; }
.mds-card p { font-size: 15px; line-height: 1.5; color: var(--mds-ink); margin: 0; }
.mds-step { font-size: 13px; font-weight: 600; color: var(--mds-accent); margin: 0 !important; }

/* ---------- Brand Cards (Centered) ---------- */
.mds-brand-card { 
    min-height: 200px; 
    display: flex; 
    flex-direction: column; 
    justify-content: center; 
    gap: 20px;
    align-items: center; 
    text-align: center;  
}
.mds-brand-card img { 
    max-height: 80px; 
    width: auto; 
    margin: 0 auto; 
}
#nos-marques > .wp-block-heading {
    text-align: center;
}

/* Inline Link Arrows */
.mds-link-arrow { 
    font-weight: 600; 
    color: var(--mds-accent) !important; 
    text-decoration: none !important; 
    transition: color 0.2s ease;
}
.mds-link-arrow:hover, .mds-link-arrow:focus {
    color: var(--mds-gold) !important;
}

/* ---------- References ---------- */
.mds-clients { font-family: var(--mds-font); font-size: 26px; line-height: 1.5; font-weight: 700; color: var(--mds-white) !important; }

/* ---------- Header / footer (Astra) ---------- */
.ast-primary-header-bar { border-bottom: 1px solid var(--mds-line); background: var(--mds-white); }
.main-header-menu .menu-link { font-weight: 500; font-size: 15px; }

/* Language switcher (Polylang menu item) */
.main-header-menu .lang-item > a {
	border: 1.5px solid var(--mds-primary);
	border-radius: 50px;
	padding: 6px 16px !important;
	margin-left: 12px;
	font-size: 14px;
	line-height: 1.2;
	font-weight: 600;
	transition: all 0.2s ease;
}
.main-header-menu .lang-item > a:hover,
.main-header-menu .lang-item > a:focus {
	background: var(--mds-primary);
	color: var(--mds-white);
}
.site-footer { background: var(--mds-white); border-top: 1px solid var(--mds-line); color: var(--mds-ink); font-size: 14px; }

/* ---------- Responsive ---------- */
@media (max-width: 781px) {
	:root { --mds-gutter: 20px; }
	.mds-section { padding: 48px var(--mds-gutter); }
	.mds-hero img, .mds-card.mds-photo { height: 280px; min-height: 280px; }
	.mds-hero .mds-hero-logo img { height: auto; width: 200px; }
	
	/* Mobile rectangle adjustment */
	.mds-card.mds-photo:has(.mds-hero-logo) { 
        height: 200px; 
        aspect-ratio: auto; 
    }
	
    .mds-hero .wp-block-button { flex: 1 1 100%; }
	.ast-mobile-popup-content .lang-item > a,
	.ast-header-break-point .main-header-menu .lang-item > a { display: inline-block; margin: 12px 20px; }
	.mds-stat-number { font-size: 34px !important; }
}