/* CALONTERRA MASTER STYLESHEET (V-SOVEREIGN 5.6 - Final Release - Performance Optimized Commercial Card Fix) */

:root {
    --primary: #D97706; /* Amber 600 */
    --primary-hover: #B45309; /* Amber 700 */
    --dark: #111827; /* Gray 900 */
    --dark-blue: #1F2937; /* Slate 800 */
    --light: #F3F4F6; /* Gray 100 */
    --white: #FFFFFF;
    --border: #E5E7EB; /* Gray 200 */
    --text-main: #1F2937;
    --text-muted: #4B5563; /* WCAG AA on light */
    --text-light: #E5E7EB; /* WCAG AA on dark */
    
    --container-width: 1200px;
    --header-height: 80px;
    --radius: 0.5rem;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html {
    scroll-padding-top: var(--header-height); 
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background-color: var(--light);
    color: var(--text-main);
    line-height: 1.6;
    overflow-x: hidden;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    padding-top: var(--header-height); 
}

img { max-width: 100%; display: block; }
a { text-decoration: none; color: inherit; transition: 0.2s; }
ul { list-style: none; }

h1, h2, h3, h4 { font-weight: 800; line-height: 1.2; margin-bottom: 1rem; }
h1 { font-size: 2.5rem; }
h2 { font-size: 2rem; }
h3 { font-size: 1.5rem; }

@media (min-width: 768px) {
    h1 { font-size: 3.5rem; }
    h2 { font-size: 2.5rem; }
}

.text-amber { color: var(--primary); }
.text-white { color: var(--white); }
.text-center { text-align: center; }
.text-shadow { text-shadow: 0 2px 4px rgba(0,0,0,0.5); }
.italic { font-style: italic; }
.font-bold { font-weight: 700; }
.text-muted { color: var(--text-muted) !important; }
.text-light { color: var(--text-light) !important; }

.mt-1 { margin-top: 1rem; } .mb-1 { margin-bottom: 1rem; }
.mt-2 { margin-top: 2rem; } .mb-2 { margin-bottom: 2rem; }
.mt-3 { margin-top: 3rem; } .mb-3 { margin-bottom: 3rem; }
.mb-4 { margin-bottom: 4rem; }
.mb-5 { margin-bottom: 5rem; }
.hidden { display: none; }

.divider-brand {
    height: 3px;
    background-color: #D97706;
    width: 100%;
}

.container {
    max-width: var(--container-width);
    margin: 0 auto;
    padding: 0 1.5rem;
}

.section { padding: 5rem 0; }

.section-dark { 
    background-color: var(--dark-blue);
    color: var(--white);
    background-image: repeating-linear-gradient(45deg, #2C3E50, #2C3E50 1px, transparent 1px, transparent 28px);
    border-top: 4px solid var(--primary);
    border-bottom: 4px solid var(--primary);
}
.section-dark h2, .section-dark h3, .section-dark p, .section-dark li { color: var(--white); }
.section-dark .text-amber { color: var(--primary) !important; }
.section-dark .text-muted, .section-dark .text-light { color: var(--text-light) !important; }

.bg-white { background-color: var(--white); }
.bg-light { background-color: var(--light); }
.bg-contrast { background-color: #E5E7EB; }
.bg-contrast h2, .bg-contrast h3, .bg-contrast p, .bg-contrast li { color: var(--text-main); }
.bg-contrast .text-dark-blue { color: var(--dark-blue); }

.grid-2 { display: grid; grid-template-columns: 1fr; gap: 2rem; }
.grid-3 { display: grid; grid-template-columns: 1fr; gap: 2rem; }
.grid-4 { display: grid; grid-template-columns: 1fr; gap: 2rem; }

@media (min-width: 768px) {
    .grid-2 { grid-template-columns: 1fr 1fr; }
    .grid-3 { grid-template-columns: 1fr 1fr 1fr; }
    .grid-4 { grid-template-columns: 1fr 1fr 1fr 1fr; }
}
@media (min-width: 1024px) {
    .grid-4 { grid-template-columns: 1fr 1fr 1fr 1fr; }
}

.align-center { align-items: center; }

/* BUTTONS */
.btn { display: inline-block; padding: 0.75rem 1.5rem; border-radius: var(--radius); font-weight: 600; text-align: center; cursor: pointer; border: none; }

.btn-primary { background-color: var(--primary); color: var(--white); }
.btn-primary:hover { background-color: var(--primary-hover); transform: translateY(-2px); }

.btn-secondary { background-color: transparent; border: 1px solid var(--border); color: var(--text-main); }
.btn-secondary:hover { border-color: var(--text-main); background: var(--white); }

.btn-dark {
    background-color: var(--dark-blue);
    color: var(--white);
    border: 1px solid var(--dark-blue);
}
.btn-dark:hover {
    background-color: var(--dark);
    transform: translateY(-2px);
    box-shadow: 0 4px 6px rgba(0,0,0,0.2);
}

.card {
    background: var(--white);
    color: var(--text-main) !important;
    border-radius: var(--radius);
    overflow: hidden;
    border: 1px solid var(--border);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    display: flex;
    flex-direction: column;
}
.card h3, .card h4, .card p, .card li { color: var(--text-main); }
.card .text-muted { color: var(--text-muted) !important; }
.card:hover { transform: translateY(-5px); box-shadow: 0 10px 15px rgba(0,0,0,0.1); }
.card-body { padding: 1.5rem; flex-grow: 1; }
.card img { width: 100%; height: 220px; object-fit: cover; }

.card-transparent { 
    background: rgba(255, 255, 255, 0.05) !important; 
    border: 1px solid rgba(255, 255, 255, 0.1) !important; 
    color: var(--text-light) !important;
}
.card-transparent h3,
.card-transparent h4 { 
    color: var(--primary) !important; 
}
.card-transparent p, 
.card-transparent li,
.card-transparent ul { 
    color: var(--text-light) !important;
}
.card-transparent .text-white {
    color: #FFFFFF !important;
}

.icon-circle { width: 60px; height: 60px; background: rgba(217, 119, 6, 0.1); border-radius: 50%; display: flex; align-items: center; justify-content: center; margin: 0 auto 1rem auto; color: var(--primary); font-weight: 800; font-size: 1.2rem; }

/* Navbar */
.navbar {
    background: rgba(255, 255, 255, 0.98);
    position: fixed;
    width: 100%; top: 0; z-index: 1000;
    border-bottom: 1px solid var(--border);
    height: var(--header-height);
    display: flex;
    align-items: center;
}
.nav-container { display: flex; justify-content: space-between; align-items: center; width: 100%; position: relative; }

.mobile-menu-btn {
    display: block;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.5rem;
    color: var(--text-main);
}
.mobile-menu-btn svg { width: 28px; height: 28px; }

.nav-links {
    display: none;
    flex-direction: column;
    position: absolute;
    top: 100%; 
    left: 0;
    width: 100%;
    background: var(--white);
    border-top: 1px solid var(--border);
    padding: 1rem;
    gap: 1rem;
    box-shadow: 0 15px 30px rgba(0,0,0,0.15);
    z-index: 999;
    max-height: 80vh;
    overflow-y: auto;
}
.nav-links.active { display: flex; } 
.nav-links a { font-weight: 500; font-size: 0.95rem; padding: 0.5rem 0; color: var(--text-main); }
.nav-links a:hover { color: var(--primary); }

@media (min-width: 768px) {
    .mobile-menu-btn { display: none; } 
    .nav-links {
        display: flex; 
        flex-direction: row;
        position: static;
        width: auto;
        background: transparent;
        border: none;
        padding: 0;
        box-shadow: none;
        gap: 2rem;
        overflow-y: visible;
        max-height: none;
    }
}

.hero { 
    background-color: var(--dark-blue);
    height: 70vh; 
    min-height: 500px; 
    position: relative; 
    display: flex; 
    align-items: center; 
    justify-content: center; 
    text-align: center; 
    margin-top: 0; 
    border-bottom: 4px solid var(--primary);
}
.hero-overlay { position: absolute; inset: 0; background: rgba(0,0,0,0.5); z-index: 1; }
.hero-content { position: relative; z-index: 2; color: var(--white); max-width: 800px; padding: 1rem; }

/* FAQ */
details {
    background: var(--white);
    padding: 1.5rem;
    border-radius: var(--radius);
    margin-bottom: 1rem;
    border: 1px solid var(--border);
    cursor: pointer;
}
summary {
    font-weight: 700;
    color: var(--text-main);
    list-style: none;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
summary::after {
    content: "+";
    color: var(--primary);
    font-size: 1.5rem;
    font-weight: 800;
}
details[open] summary::after {
    content: "-";
}

.form-card { 
    background-color: var(--dark-blue); 
    color: var(--white); 
    background-image: repeating-linear-gradient(45deg, #2C3E50, #2C3E50 1px, transparent 1px, transparent 28px); 
    padding: 2.5rem; 
    border-radius: var(--radius); 
    text-align: left; 
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.2); 
}

input, select, textarea { 
    width: 100%; 
    padding: 0.75rem; 
    background-color: var(--white); 
    border: 1px solid transparent; 
    border-radius: 0.25rem; 
    margin-bottom: 1rem; 
    font-family: inherit; 
    color: var(--text-main);
    font-size: 16px !important;
}

input:focus, select:focus, textarea:focus { 
    outline: none; 
    border-color: var(--primary); 
    box-shadow: 0 0 0 3px rgba(217, 119, 6, 0.4); 
}
label { 
    display: block; 
    font-weight: 600; 
    margin-bottom: 0.5rem; 
    font-size: 0.9rem; 
    color: var(--text-light); 
}

.urgency-box { 
    background: rgba(220, 38, 38, 0.1); 
    border: 1px solid rgba(220, 38, 38, 0.3); 
    border-radius: 4px; 
    padding: 1rem; 
    margin-bottom: 1.5rem; 
    display: flex; 
    align-items: flex-start; 
    gap: 1rem; 
}
.urgency-box input[type="checkbox"] { 
    width: 24px; height: 24px; margin: 0; flex-shrink: 0; accent-color: #DC2626; 
}
.urgency-box label { color: #FCA5A5; margin: 0; cursor: pointer; }
.urgency-box p { color: #FECACA; font-size: 0.8rem; margin: 0; line-height: 1.4; margin-top: 4px; }

.modal-overlay { 
    position: fixed; inset: 0; 
    background: rgba(0,0,0,0.8); 
    z-index: 9999; 
    display: flex; align-items: center; justify-content: center; 
    opacity: 0; pointer-events: none; 
    transition: opacity 0.3s ease; 
}
.modal-overlay.active { opacity: 1; pointer-events: all; }
.modal-content { 
    background: white; 
    padding: 2.5rem; 
    border-radius: 12px; 
    width: 90%; max-width: 500px; 
    text-align: center; 
    border-top: 6px solid var(--primary); 
    box-shadow: 0 25px 50px -12px rgba(0,0,0,0.5); 
    transform: scale(0.9); 
    transition: transform 0.3s ease; 
}
.modal-overlay.active .modal-content { transform: scale(1); }

#price-display { 
    background: rgba(255,255,255,0.1); 
    padding: 1rem; 
    border-radius: var(--radius); 
    text-align: center; 
    margin-bottom: 1rem; 
    display: none; 
    color: var(--white); 
    border: 1px solid rgba(255,255,255,0.2); 
}
#price-display p, #price-display span, #location-note { color: #ffffff !important; }
#final-price { font-size: 1.5rem; font-weight: 800; color: var(--primary) !important; }

.site-footer { 
    background-color: var(--dark-blue); 
    color: var(--white); 
    background-image: repeating-linear-gradient(45deg, #2C3E50, #2C3E50 1px, transparent 1px, transparent 28px); 
    padding: 4rem 0; 
    margin-top: auto; 
    border-top: 4px solid var(--primary); 
}
.footer-social { display: flex; justify-content: center; gap: 2rem; margin-bottom: 2rem; }
.footer-social a { color: var(--text-light); transition: 0.2s; }
.footer-social a:hover { color: var(--primary); transform: translateY(-2px); }
.icon-social { width: 28px; height: 28px; }
.footer-legal { 
    text-align: center; 
    font-size: 0.85rem; 
    color: var(--text-light); 
    max-width: 800px; 
    margin: 0 auto; 
    border-top: 1px solid rgba(255,255,255,0.1); 
    padding-top: 2rem; 
}
.footer-legal a { 
    text-decoration: underline; 
    color: var(--text-light); 
    padding: 12px 5px;
    display: inline-block;
}
.footer-legal a:hover { color: var(--primary); }

.footer-contact { text-align: center; margin-bottom: 1.5rem; color: var(--text-light); }
.footer-contact a { color: var(--white); font-weight: 700; margin: 0 10px; display: inline-block; }
.footer-contact a:hover { color: var(--primary); text-decoration: none; }

.zone-checker {
    background: var(--dark-blue);
    color: white;
    padding: 2rem;
    border-radius: 12px;
    text-align: center;
    border: 1px solid var(--primary);
    position: relative;
    z-index: 10;
    box-shadow: 0 10px 25px rgba(0,0,0,0.2);
    margin-top: 2rem; 
    margin-bottom: 2rem;
}

@media (min-width: 768px) {
    .zone-checker { margin-top: -4rem; margin-bottom: 0; }
}

.status-box {
    margin-top: 1rem;
    padding: 1rem;
    border-radius: 6px;
    background: rgba(255,255,255,0.1);
    display: none;
    text-align: left;
}
.status-green { border-left: 4px solid #34D399; }
.status-amber { border-left: 4px solid #FBBF24; }

.location-list li {
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
}
.location-list li:before {
    content: "📍";
    margin-right: 10px;
    color: var(--primary);
}

/* Background images for other pages */
.hero-res { background-image: url('residential-roof-inspection-no-scaffolding.webp') !important; background-position: center bottom; background-size: cover; background-repeat: no-repeat; }
.hero-comm { background-image: url('commercial-mobile-hero.webp') !important; background-position: center bottom; background-size: cover; background-repeat: no-repeat; height: 60vh !important; min-height: 500px !important; }
@media (min-width: 768px) { .hero-comm { background-image: url('commercial-infrastructure-precision-mapping.webp') !important; } }
.hero-loc { background-image: url('locations-mobile-hero.webp') !important; background-position: center center !important; background-size: cover; background-repeat: no-repeat; height: 50vh !important; min-height: 400px !important; }
@media (min-width: 768px) { .hero-loc { background-image: url('calonterra-rapid-response-survey-unit-south-wales.webp') !important; } }
.hero-topo { background-image: url('topographical-mobile-hero.webp') !important; background-position: center center !important; background-size: cover; background-repeat: no-repeat; height: 60vh !important; min-height: 500px !important; }
@media (min-width: 768px) { .hero-topo { background-image: url('listed-building-non-invasive-aerial-survey.webp') !important; } }
.hero-terms { background-image: url('calonterra-mobile-hero.webp') !important; background-position: center bottom !important; background-size: cover; background-repeat: no-repeat; height: 40vh !important; min-height: 300px !important; }
@media (min-width: 768px) { .hero-terms { background-image: url('calonterra-digital-twin-drone-surveying-south-wales.webp') !important; } }

@media (max-width: 767px) {
    .hero { height: auto !important; min-height: auto !important; padding-top: 4rem; padding-bottom: 4rem; }
    .hero-content { padding-bottom: 1rem; }
    .hero h1 { font-size: 2.2rem; }
    .hero .mt-2 { display: flex !important; flex-direction: column; gap: 1rem; }
    .hero .mt-2 .btn { width: 100%; display: block; }
}

/* FINAL ACCESSIBILITY & STYLE FIXES */

/* 1. Hero service boxes: ensure light text in dark Commercial card */
/* Apply the light color specifically to the commercial card's content */
.hero .commercial-card,
.hero .commercial-card *,
.hero .commercial-card p,
.hero .commercial-card ul,
.hero .commercial-card li {
    color: #E5E7EB !important; /* Matches --text-light */
}

/* 2. Hero service boxes (Residential side and others) - Keep general rule */
/* Exclude the commercial card from this general rule using :not() */
.hero .grid-2 > div:not(.commercial-card),
.hero .grid-2 > div:not(.commercial-card) *,
.hero .grid-2 > div:not(.commercial-card) ul li {
    color: #374151 !important;
}

/* 3. "Why Choose CalonTerra?" cards in .bg-contrast section */
.section.bg-contrast .card h3,
.section.bg-contrast .card p {
    color: #374151 !important;
}