/*
Theme Name: Critchmere
Theme URI: https://critchmere.example
Author: Barry White
Author URI: https://www.linkedin.com/in/barry-white-7081a310
Description: A clean, single-page scroll theme for Critchmere Consulting — a freelance CRM consultancy specialising in Salesforce, data integrations, and solutions architecture. Pure PHP, CSS, and vanilla JS. No page builder dependencies.
Version: 1.0.1
Requires at least: 6.0
Tested up to: 6.5
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: critchmere
*/

/* ==========================================================================
   1. Design tokens
   ========================================================================== */
:root {
    /* Colour palette */
    --color-black: #0f0f0f;     /* near black */
    --color-cream: #f5f4f0;     /* warm off-white */
    --color-blue: #2563eb;      /* blue accent */
    --color-blue-dark: #1d4ed8;
    --color-muted: #5c5c58;     /* muted body text on cream */
    --color-line: #e4e2db;      /* hairline borders on cream */
    --color-line-dark: rgba(245, 244, 240, 0.14);

    /* Typography */
    --font-body: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    --font-head: "Bricolage Grotesque", Georgia, serif;

    /* Spacing — 8px base grid */
    --space-1: 8px;
    --space-2: 16px;
    --space-3: 24px;
    --space-4: 32px;
    --space-5: 48px;
    --space-6: 64px;
    --space-7: 96px;
    --space-8: 128px;

    /* Layout */
    --max-width: 1140px;
    --header-height: 80px;
    --radius: 14px;

    /* Motion */
    --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

/* ==========================================================================
   2. Reset & base
   ========================================================================== */
*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    /* Offset anchored sections so the sticky header doesn't cover them */
    scroll-padding-top: var(--header-height);
}

/* Respect users who prefer reduced motion */
@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }
    *,
    *::before,
    *::after {
        animation-duration: 0.001ms !important;
        transition-duration: 0.001ms !important;
    }
}

body {
    margin: 0;
    font-family: var(--font-body);
    font-size: 18px;
    line-height: 1.65;
    color: var(--color-black);
    background-color: var(--color-cream);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

h1, h2, h3, h4 {
    font-family: var(--font-head);
    font-weight: 700;
    line-height: 1.1;
    letter-spacing: -0.02em;
    margin: 0 0 var(--space-3);
}

p {
    margin: 0 0 var(--space-3);
}

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

a:hover {
    color: var(--color-blue-dark);
}

img,
svg {
    display: block;
    max-width: 100%;
}

/* ==========================================================================
   3. Layout helpers
   ========================================================================== */
.container {
    width: 100%;
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 var(--space-3);
}

.section {
    padding: var(--space-8) 0;
}

.section__eyebrow {
    display: inline-block;
    font-family: var(--font-body);
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--color-blue);
    margin-bottom: var(--space-2);
}

/* Accessible skip link */
.skip-link {
    position: absolute;
    left: -9999px;
    top: 0;
    z-index: 1000;
    padding: var(--space-1) var(--space-2);
    background: var(--color-black);
    color: var(--color-cream);
    border-radius: 0 0 var(--radius) 0;
}

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

/* ==========================================================================
   4. Buttons
   ========================================================================== */
.btn {
    display: inline-flex;
    align-items: center;
    gap: var(--space-1);
    padding: var(--space-2) var(--space-4);
    font-family: var(--font-body);
    font-size: 16px;
    font-weight: 600;
    line-height: 1;
    border: 2px solid transparent;
    border-radius: 999px;
    cursor: pointer;
    transition: transform 0.2s var(--ease), background-color 0.2s var(--ease), color 0.2s var(--ease);
}

.btn--primary {
    background-color: var(--color-blue);
    color: #fff;
}

.btn--primary:hover {
    background-color: var(--color-blue-dark);
    color: #fff;
    transform: translateY(-2px);
}

.btn--ghost {
    background-color: transparent;
    color: var(--color-black);
    border-color: var(--color-black);
}

.btn--ghost:hover {
    background-color: var(--color-black);
    color: var(--color-cream);
}

/* ==========================================================================
   5. Header
   ========================================================================== */
.site-header {
    position: sticky;
    top: 0;
    z-index: 100;
    height: var(--header-height);
    display: flex;
    align-items: center;
    background-color: rgba(245, 244, 240, 0.82);
    backdrop-filter: saturate(180%) blur(12px);
    -webkit-backdrop-filter: saturate(180%) blur(12px);
    border-bottom: 1px solid transparent;
    transition: border-color 0.3s var(--ease), background-color 0.3s var(--ease);
}

/* Hairline appears once the user scrolls (toggled in JS) */
.site-header.is-scrolled {
    border-bottom-color: var(--color-line);
}

.site-header__inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
}

.site-logo {
    font-family: var(--font-head);
    font-size: 22px;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--color-black);
}

.site-logo:hover {
    color: var(--color-black);
}

/* Primary navigation */
.site-nav {
    display: flex;
    align-items: center;
}

.site-nav ul {
    display: flex;
    align-items: center;
    gap: var(--space-4);
    margin: 0;
    padding: 0;
    list-style: none;
}

.site-nav a {
    font-size: 16px;
    font-weight: 500;
    color: var(--color-black);
}

.site-nav a:hover {
    color: var(--color-blue);
}

/* Mobile nav toggle (hamburger) */
.nav-toggle {
    display: none;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    width: 44px;
    height: 44px;
    padding: 0;
    background: none;
    border: none;
    cursor: pointer;
}

.nav-toggle span {
    display: block;
    width: 24px;
    height: 2px;
    background-color: var(--color-black);
    transition: transform 0.3s var(--ease), opacity 0.3s var(--ease);
}

/* Animate hamburger into an X when open */
.nav-toggle[aria-expanded="true"] span:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
}
.nav-toggle[aria-expanded="true"] span:nth-child(2) {
    opacity: 0;
}
.nav-toggle[aria-expanded="true"] span:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
}

/* ==========================================================================
   6. Hero
   ========================================================================== */
.hero {
    position: relative;
    /* A touch under full height so the top of the About section peeks above the
       fold, hinting there's more to scroll to. */
    min-height: 88vh;
    display: flex;
    align-items: center;
    /* Asymmetric vertical padding biases the centred content upward, so there's
       less empty space between the header and the hero text. */
    padding: var(--space-5) 0 var(--space-6);
    overflow: hidden;
    /* Subtle CSS-only grid pattern */
    background-color: var(--color-cream);
    background-image:
        linear-gradient(to right, rgba(15, 15, 15, 0.04) 1px, transparent 1px),
        linear-gradient(to bottom, rgba(15, 15, 15, 0.04) 1px, transparent 1px);
    background-size: 48px 48px;
}

/* Soft radial glow layered over the grid for depth */
.hero::before {
    content: "";
    position: absolute;
    inset: 0;
    background:
        radial-gradient(60% 60% at 75% 25%, rgba(37, 99, 235, 0.10), transparent 70%),
        radial-gradient(50% 50% at 10% 90%, rgba(37, 99, 235, 0.06), transparent 70%);
    pointer-events: none;
}

/* Fade the grid out toward the bottom edge */
.hero::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(to bottom, transparent 55%, var(--color-cream));
    pointer-events: none;
}

.hero__inner {
    position: relative;
    z-index: 1;
    max-width: 820px;
}

.hero__founder {
    font-size: 15px;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--color-blue);
    margin-bottom: var(--space-2);
}

.hero__title {
    font-size: clamp(2.75rem, 7vw, 5.25rem);
    margin-bottom: var(--space-3);
}

.hero__tagline {
    font-family: var(--font-head);
    font-size: clamp(1.4rem, 3vw, 2rem);
    font-weight: 600;
    letter-spacing: -0.01em;
    color: var(--color-black);
    margin-bottom: var(--space-2);
}

.hero__subline {
    font-size: clamp(1.05rem, 2vw, 1.3rem);
    color: var(--color-muted);
    margin-bottom: var(--space-5);
    max-width: 620px;
}

/* ==========================================================================
   7. About
   ========================================================================== */
.about {
    background-color: var(--color-cream);
    /* Tighter top padding so the About content follows the hero closely. */
    padding-top: var(--space-6);
}

.about__grid {
    display: grid;
    grid-template-columns: 1.2fr 1fr;
    gap: var(--space-7);
    align-items: center;
}

.about__title {
    font-size: clamp(2rem, 4vw, 3rem);
}

.about__body p {
    color: var(--color-muted);
}

/* Decorative stat panel (right column) */
.about__aside {
    display: grid;
    gap: var(--space-3);
}

.stat {
    position: relative;
    padding: var(--space-4);
    background-color: var(--color-black);
    color: var(--color-cream);
    border-radius: var(--radius);
    overflow: hidden;
}

/* Decorative corner accent on each stat card */
.stat::after {
    content: "";
    position: absolute;
    top: -40px;
    right: -40px;
    width: 120px;
    height: 120px;
    background: radial-gradient(circle, rgba(37, 99, 235, 0.5), transparent 70%);
    border-radius: 50%;
}

.stat__number {
    font-family: var(--font-head);
    font-size: clamp(1.6rem, 3vw, 2.2rem);
    font-weight: 700;
    line-height: 1;
    color: #fff;
    margin-bottom: var(--space-1);
}

.stat__label {
    font-size: 15px;
    font-weight: 500;
    color: rgba(245, 244, 240, 0.7);
    margin: 0;
}

/* ==========================================================================
   8. Services
   ========================================================================== */
.services {
    background-color: var(--color-black);
    color: var(--color-cream);
}

.services .section__eyebrow {
    color: #60a5fa;
}

.services__head {
    max-width: 640px;
    margin-bottom: var(--space-6);
}

.services__title {
    font-size: clamp(2rem, 4vw, 3rem);
    color: #fff;
}

.services__note {
    color: rgba(245, 244, 240, 0.6);
    margin: 0;
}

.services__grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--space-3);
}

.service-card {
    padding: var(--space-4);
    background-color: rgba(245, 244, 240, 0.04);
    border: 1px solid var(--color-line-dark);
    border-radius: var(--radius);
    transition: transform 0.3s var(--ease), border-color 0.3s var(--ease), background-color 0.3s var(--ease);
}

.service-card:hover {
    transform: translateY(-6px);
    border-color: rgba(37, 99, 235, 0.6);
    background-color: rgba(245, 244, 240, 0.06);
}

.service-card__icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 56px;
    height: 56px;
    margin-bottom: var(--space-3);
    color: #60a5fa;
    background-color: rgba(37, 99, 235, 0.12);
    border-radius: 12px;
}

.service-card__icon svg {
    width: 28px;
    height: 28px;
}

.service-card__title {
    font-size: 1.35rem;
    color: #fff;
    margin-bottom: var(--space-1);
}

.service-card__desc {
    font-size: 16px;
    color: rgba(245, 244, 240, 0.65);
    margin: 0;
}

/* ==========================================================================
   9. Contact
   ========================================================================== */
.contact {
    background-color: var(--color-cream);
}

.contact__grid {
    display: grid;
    grid-template-columns: 1fr 1.1fr;
    gap: var(--space-7);
    align-items: start;
}

.contact__title {
    font-size: clamp(2rem, 4vw, 3rem);
}

.contact__lead {
    color: var(--color-muted);
    margin-bottom: var(--space-4);
}

/* LinkedIn link */
.contact__linkedin {
    display: inline-flex;
    align-items: center;
    gap: var(--space-1);
    font-weight: 600;
    color: var(--color-black);
}

.contact__linkedin svg {
    width: 22px;
    height: 22px;
    color: var(--color-blue);
}

.contact__linkedin:hover {
    color: var(--color-blue);
}

/* Contact form */
.contact-form,
.contact-form .wpcf7-form {
    display: grid;
    gap: var(--space-3);
}

.form-field {
    display: grid;
    gap: var(--space-1);
}

.form-field label {
    font-size: 14px;
    font-weight: 600;
    letter-spacing: 0.02em;
}

.form-field input,
.form-field textarea {
    width: 100%;
    padding: var(--space-2);
    font-family: var(--font-body);
    font-size: 16px;
    color: var(--color-black);
    background-color: #fff;
    border: 1px solid var(--color-line);
    border-radius: 10px;
    transition: border-color 0.2s var(--ease), box-shadow 0.2s var(--ease);
}

.form-field input:focus,
.form-field textarea:focus {
    outline: none;
    border-color: var(--color-blue);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

.form-field textarea {
    min-height: 140px;
    resize: vertical;
}

.contact-form .btn {
    justify-self: start;
}

/* --- Contact Form 7 integration ---------------------------------------
   These rules style the markup CF7 outputs so it matches the theme. They
   are inert until the CF7 plugin renders the form, so they're safe to ship.
*/

/* CF7 wraps each control in this span — keep it block-level so our grid flows */
.contact-form .wpcf7-form-control-wrap {
    display: block;
}

/* The submit input rendered by CF7 ([submit]) — strip native button chrome */
.contact-form input[type="submit"] {
    -webkit-appearance: none;
    appearance: none;
}

/* Inline "this field is required" validation tips */
.contact-form .wpcf7-not-valid-tip {
    margin-top: var(--space-1);
    font-size: 13px;
    font-weight: 500;
    color: #dc2626;
}

/* Highlight invalid fields */
.contact-form .wpcf7-not-valid {
    border-color: #dc2626 !important;
}

/* Success / error / validation banner shown after submit */
.contact-form .wpcf7-response-output {
    margin: var(--space-2) 0 0 !important;
    padding: var(--space-2) !important;
    border-radius: 10px;
    border: 1px solid var(--color-line) !important;
    font-size: 15px;
}

.wpcf7-form.sent .wpcf7-response-output {
    border-color: #16a34a !important;
    background-color: rgba(22, 163, 74, 0.08);
    color: #15803d;
}

.wpcf7-form.invalid .wpcf7-response-output,
.wpcf7-form.failed .wpcf7-response-output {
    border-color: #dc2626 !important;
    background-color: rgba(220, 38, 38, 0.06);
    color: #b91c1c;
}

/* Loading spinner alignment */
.contact-form .wpcf7-spinner {
    margin: 0 0 0 var(--space-2);
}

/* ==========================================================================
   10. Footer
   ========================================================================== */
.site-footer {
    padding: var(--space-5) 0;
    background-color: var(--color-black);
    color: rgba(245, 244, 240, 0.6);
    font-size: 15px;
}

.site-footer__inner {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-2);
}

.site-footer a {
    color: rgba(245, 244, 240, 0.8);
}

.site-footer a:hover {
    color: #fff;
}

/* ==========================================================================
   11. Scroll-reveal animation (Intersection Observer)
   ========================================================================== */
.reveal {
    opacity: 0;
    transform: translateY(28px);
    transition: opacity 0.7s var(--ease), transform 0.7s var(--ease);
    will-change: opacity, transform;
}

.reveal.is-visible {
    opacity: 1;
    transform: none;
}

/* Stagger children when a container reveals */
.reveal[data-delay="1"] { transition-delay: 0.08s; }
.reveal[data-delay="2"] { transition-delay: 0.16s; }
.reveal[data-delay="3"] { transition-delay: 0.24s; }

/* ==========================================================================
   12. Responsive
   ========================================================================== */
@media (max-width: 900px) {
    .about__grid,
    .contact__grid {
        grid-template-columns: 1fr;
        gap: var(--space-5);
    }

    .services__grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 720px) {
    body {
        font-size: 17px;
    }

    .section {
        padding: var(--space-7) 0;
    }

    /* Collapse nav into a mobile panel */
    .nav-toggle {
        display: flex;
    }

    .site-nav {
        position: fixed;
        top: var(--header-height);
        left: 0;
        right: 0;
        flex-direction: column;
        background-color: var(--color-cream);
        border-bottom: 1px solid var(--color-line);
        padding: var(--space-2) var(--space-3) var(--space-4);
        /* Hide the closed menu reliably with opacity + visibility rather than a
           height-relative translate, which could leave the bottom of a short
           menu peeking down over the header on mobile. */
        transform: translateY(-8px);
        opacity: 0;
        visibility: hidden;
        transition: transform 0.3s var(--ease), opacity 0.3s var(--ease), visibility 0.3s var(--ease);
        box-shadow: 0 16px 30px rgba(15, 15, 15, 0.08);
    }

    .site-nav.is-open {
        transform: translateY(0);
        opacity: 1;
        visibility: visible;
    }

    .site-nav ul {
        flex-direction: column;
        align-items: flex-start;
        gap: var(--space-3);
        width: 100%;
    }
}
