/* ===========================
   Root Variables & Reset
   =========================== */

:root {
    --primary-color: #2c3e50;
    --accent-color: #2471a3;   /* 5.30:1 on white */
    --accent-hover: #1a5f8f;   /* 6.82:1 on white */
    --text-dark: #2c3e50;
    --text-light: #5d6d6e;     /* 5.42:1 on white */
    --bg-light: #f8f9fa;
    --bg-white: #ffffff;
    --border-color: #ecf0f1;
    --success-color: #177245;  /* 5.95:1 on white */
    
    --font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    --font-size-base: 1rem;
    --font-size-h1: 3rem;
    --font-size-h2: 2.25rem;
    --font-size-h3: 1.5rem;
    --spacing-unit: 16px;
}

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

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-family);
    color: var(--text-dark);
    background-color: var(--bg-white);
    line-height: 1.6;
    font-size: var(--font-size-base);
}

/* ===========================
   Typography
   =========================== */

h1, h2, h3, h4, h5, h6 {
    font-weight: 600;
    line-height: 1.3;
    margin-bottom: var(--spacing-unit);
}

h1 {
    font-size: var(--font-size-h1);
}

h2 {
    font-size: var(--font-size-h2);
    color: var(--primary-color);
}

h3 {
    font-size: var(--font-size-h3);
    color: var(--primary-color);
}

p {
    margin-bottom: var(--spacing-unit);
    color: var(--text-light);
    line-height: 1.7;
}

a {
    color: var(--accent-color);
    text-decoration: none;
    transition: color 0.3s ease;
}

a:hover {
    color: var(--accent-hover);
}

/* ===========================
   Container & Layout
   =========================== */

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 var(--spacing-unit);
}

/* ===========================
   Navigation
   =========================== */

.navbar {
    position: sticky;
    top: 0;
    background-color: var(--bg-white);
    border-bottom: 1px solid var(--border-color);
    z-index: 100;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.navbar .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: calc(var(--spacing-unit) * 0.75) var(--spacing-unit);
}

.nav-brand {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary-color);
}

.nav-menu {
    display: flex;
    list-style: none;
    gap: calc(var(--spacing-unit) * 2);
}

.nav-menu a {
    display: flex;
    align-items: center;
    min-height: 44px;
    padding: 0 10px;
    color: var(--text-dark);
    font-weight: 500;
    transition: color 0.3s ease;
}

.nav-menu a:hover {
    color: var(--accent-color);
}

@media (max-width: 768px) {
    .nav-menu {
        flex-wrap: wrap;
        justify-content: center;
        gap: 4px;
    }

    /* Collapsible menu only once JS is present to reopen it. */
    .has-js .nav-menu {
        display: none;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        flex-direction: column;
        align-items: stretch;
        gap: 0;
        padding: 8px 0;
        background-color: var(--bg-white);
        border-top: 1px solid var(--border-color);
        box-shadow: 0 8px 16px rgba(0, 0, 0, 0.08);
    }

    .has-js .nav-menu.is-open {
        display: flex;
    }

    .has-js .nav-menu a {
        padding: 0 24px;
    }

    .has-js .nav-toggle {
        display: flex;
    }
}

/* ===========================
   Hero Section
   =========================== */

.hero {
    background: linear-gradient(135deg, var(--primary-color) 0%, #34495e 100%);
    color: white;
    padding: calc(var(--spacing-unit) * 8) var(--spacing-unit);
    text-align: center;
}

.hero h1 {
    color: white;
    margin-bottom: var(--spacing-unit);
    font-size: clamp(2rem, 8vw, 3rem);
}

.hero-subtitle {
    color: #ecf0f1;
    font-size: 1.25rem;
    margin-bottom: calc(var(--spacing-unit) * 2);
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}

/* ===========================
   CTA Button
   =========================== */

.cta-button {
    display: inline-block;
    background-color: var(--accent-color);
    color: white;
    padding: var(--spacing-unit) calc(var(--spacing-unit) * 2);
    border-radius: 4px;
    font-weight: 600;
    transition: background-color 0.3s ease, transform 0.2s ease;
    cursor: pointer;
    border: none;
    font-size: var(--font-size-base);
}

.cta-button:hover {
    background-color: var(--accent-hover);
    transform: translateY(-2px);
}

/* ===========================
   Services Section
   =========================== */

.services {
    padding: calc(var(--spacing-unit) * 6) var(--spacing-unit);
    background-color: var(--bg-light);
}

.services h2 {
    text-align: center;
    margin-bottom: calc(var(--spacing-unit) * 4);
}

.service-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: calc(var(--spacing-unit) * 2);
}

.service-card {
    background-color: var(--bg-white);
    padding: calc(var(--spacing-unit) * 2);
    border-radius: 4px;
    border-left: 4px solid var(--accent-color);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.service-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.1);
}

.service-card h3 {
    margin-bottom: var(--spacing-unit);
}

/* ===========================
   Case Studies Section
   =========================== */

.case-studies {
    padding: calc(var(--spacing-unit) * 6) var(--spacing-unit);
    background-color: var(--bg-white);
}

.case-studies h2 {
    text-align: center;
    margin-bottom: var(--spacing-unit);
}

.section-intro {
    text-align: center;
    max-width: 600px;
    margin: 0 auto calc(var(--spacing-unit) * 4);
}

.cases-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: calc(var(--spacing-unit) * 2);
}

.case-card {
    background-color: var(--bg-light);
    padding: calc(var(--spacing-unit) * 2);
    border-radius: 4px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.case-card h3 {
    color: var(--primary-color);
    margin-bottom: var(--spacing-unit);
    font-size: 1.25rem;
}

.case-card p {
    margin-bottom: calc(var(--spacing-unit) * 0.75);
    font-size: 0.9375rem;
}

.case-card strong {
    color: var(--text-dark);
    font-weight: 600;
}

/* ===========================
   About Section
   =========================== */

.about {
    padding: calc(var(--spacing-unit) * 6) var(--spacing-unit);
    background: linear-gradient(135deg, #f8f9fa 0%, var(--bg-white) 100%);
}

.about h2 {
    text-align: center;
    margin-bottom: calc(var(--spacing-unit) * 2);
}

.about > .container > p {
    max-width: 700px;
    margin: 0 auto calc(var(--spacing-unit) * 1.5);
    text-align: center;
    font-size: 1.125rem;
    color: var(--text-dark);
}

.credentials {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: calc(var(--spacing-unit) * 2);
    margin-top: calc(var(--spacing-unit) * 4);
}

.cred {
    background-color: var(--bg-white);
    padding: calc(var(--spacing-unit) * 2);
    border-radius: 4px;
    text-align: center;
    border-top: 3px solid var(--accent-color);
}

.cred h4 {
    color: var(--primary-color);
    margin-bottom: var(--spacing-unit);
}

.cred p {
    font-size: 0.875rem;
    margin-bottom: 0;
}

/* ===========================
   Contact Section
   =========================== */

.contact {
    padding: calc(var(--spacing-unit) * 6) var(--spacing-unit);
    background-color: var(--primary-color);
    color: white;
}

.contact h2 {
    color: white;
    text-align: center;
    margin-bottom: var(--spacing-unit);
}

.contact > .container > p {
    text-align: center;
    color: #ecf0f1;
    margin-bottom: calc(var(--spacing-unit) * 3);
}

.contact-form {
    max-width: 600px;
    margin: 0 auto;
}

.form-group {
    margin-bottom: calc(var(--spacing-unit) * 1.5);
}

.form-group label {
    display: block;
    margin-bottom: var(--spacing-unit) * 0.5;
    font-weight: 500;
    color: white;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: calc(var(--spacing-unit) * 0.75);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 4px;
    background-color: rgba(255, 255, 255, 0.1);
    color: white;
    font-family: var(--font-family);
    font-size: var(--font-size-base);
    transition: background-color 0.3s ease, border-color 0.3s ease;
}

.form-group input::placeholder,
.form-group textarea::placeholder {
    color: rgba(255, 255, 255, 0.5);
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    background-color: rgba(255, 255, 255, 0.15);
    border-color: var(--accent-color);
}

.contact-form button {
    width: 100%;
    margin-top: var(--spacing-unit);
}

/* ===========================
   Footer
   =========================== */

.footer {
    background-color: #1a252f;
    color: #bdc3c7;
    padding: calc(var(--spacing-unit) * 3) var(--spacing-unit);
    text-align: center;
}

.footer a {
    color: var(--accent-color);
}

.footer a:hover {
    color: white;
}

/* ===========================
   Responsive Design
   =========================== */

@media (max-width: 768px) {
    :root {
        --font-size-h1: 2.25rem;
        --font-size-h2: 1.75rem;
        --font-size-h3: 1.25rem;
    }
    
    .hero {
        padding: calc(var(--spacing-unit) * 5) var(--spacing-unit);
    }
    
    .hero-subtitle {
        font-size: 1.125rem;
    }
    
    .service-grid,
    .cases-grid,
    .credentials {
        grid-template-columns: 1fr;
    }
    
}

@media (max-width: 480px) {
    :root {
        --font-size-h1: 1.75rem;
        --font-size-h2: 1.375rem;
        --font-size-h3: 1.125rem;
        --spacing-unit: 12px;
    }
    
    .hero h1 {
        font-size: 1.75rem;
    }
    
    .hero-subtitle {
        font-size: 1rem;
    }
}

/* ===========================
   Accessibility & Form State
   =========================== */

.skip-link {
    position: absolute;
    left: -9999px;
    top: 0;
    z-index: 999;
    padding: 12px 20px;
    background: var(--primary-color);
    color: var(--bg-white);
    text-decoration: none;
}

.skip-link:focus {
    left: 0;
}

/* Honeypot — hidden from people, still reachable by bots. */
.hp {
    position: absolute;
    left: -9999px;
    width: 1px;
    height: 1px;
    overflow: hidden;
}

.form-status {
    margin-top: var(--spacing-unit);
    min-height: 1.6em;
    font-size: 0.9375rem;
}

.form-status.is-success {
    color: var(--success-color);
    font-weight: 600;
}

.form-status.is-error {
    color: #c0392b;
    font-weight: 600;
}

.form-status a {
    color: inherit;
}

button[type="submit"][disabled] {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Sticky nav must not hide the section heading you just jumped to. */
section[id] {
    scroll-margin-top: 90px;
}

@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }
}

/* ===========================
   Mobile Nav Toggle
   =========================== */

.navbar .container {
    position: relative;
}

.nav-toggle {
    display: none;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-width: 44px;
    min-height: 44px;
    padding: 0 12px;
    background: none;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    color: var(--text-dark);
    font: inherit;
    font-weight: 500;
    cursor: pointer;
}

.nav-toggle:hover {
    border-color: var(--accent-color);
    color: var(--accent-color);
}

.nav-toggle-bars {
    display: block;
    width: 18px;
    height: 2px;
    background-color: currentColor;
    box-shadow: 0 -6px 0 currentColor, 0 6px 0 currentColor;
}

/* Focus is never removed anywhere — keyboard users must always see where they are. */
a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
    outline: 3px solid var(--accent-color);
    outline-offset: 2px;
    border-radius: 2px;
}

/* ===========================
   Legal / Footer Pages
   =========================== */

.legal {
    padding: calc(var(--spacing-unit) * 5) 0;
}

.legal .container {
    max-width: 760px;
}

.legal h2 {
    margin-top: calc(var(--spacing-unit) * 2);
}

.legal h3 {
    margin-top: calc(var(--spacing-unit) * 1.5);
    font-size: 1.25rem;
}

.legal p,
.legal li {
    color: var(--text-light);
    margin-bottom: calc(var(--spacing-unit) * 0.75);
}

.legal ul {
    padding-left: calc(var(--spacing-unit) * 1.5);
    margin-bottom: var(--spacing-unit);
}

.legal a {
    color: var(--accent-color);
}

.legal .updated {
    font-size: 0.9375rem;
    margin-bottom: calc(var(--spacing-unit) * 2);
}

.footer-legal {
    margin-top: var(--spacing-unit);
    font-size: 0.9375rem;
}

.footer-legal a {
    white-space: nowrap;
}

.footer-legal .sep {
    opacity: 0.5;
    margin: 0 8px;
}

.req {
    color: var(--text-light);
    font-weight: 400;
}

/* ===========================
   Dark-Section Color Context
   =========================== */

/*
 * The "dual-colour problem" from ACCESSIBILITY-GUIDE.md: a muted grey and a
 * link blue chosen to pass 4.5:1 on white both fail on the dark footer and
 * contact panels. Rather than compromise on one value that is mediocre
 * everywhere, re-point the tokens inside dark contexts. Verified ratios:
 *   #aab7bd — 7.57:1 on #1a252f, 5.34:1 on #2c3e50
 *   #7fc2ea — 8.01:1 on #1a252f, 5.65:1 on #2c3e50
 */
.hero,
.contact,
.footer {
    --text-light: #aab7bd;
    --link-on-dark: #7fc2ea;
}

/*
 * Only inline links get the light blue. --accent-color deliberately stays
 * #2471a3 here, because the CTA button uses it as a *background* under white
 * text — re-pointing it to the light blue put white on light blue (1.94:1).
 */
.footer a,
.contact a:not(.cta-button),
.hero a:not(.cta-button) {
    color: var(--link-on-dark);
}

/* Links in prose need a non-colour cue as well (WCAG 1.4.1). */
.legal a,
.footer a {
    text-decoration: underline;
    text-underline-offset: 2px;
}
