/* === Variables === */
:root {
    --primary: #1a5c57;
    --primary-light: #238c84;
    --primary-dark: #0f3d39;
    --accent: #2a9d8f;
    --text: #1e1e1e;
    --text-light: #555;
    --bg: #fafaf8;
    --white: #fff;
    --border: #e5e5e0;
    --radius: 8px;
    --shadow: 0 2px 12px rgba(0,0,0,.08);
    --font: 'Inter', sans-serif;
    --font-display: 'Playfair Display', serif;
    --max-width: 1140px;
}

/* === Reset === */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; overflow-x: hidden; }
body { font-family: var(--font); color: var(--text); background: var(--bg); line-height: 1.6; -webkit-font-smoothing: antialiased; min-height: 100vh; display: flex; flex-direction: column; overflow-x: hidden; overflow-wrap: break-word; }
main { flex: 1; }
img { max-width: 100%; display: block; }
a { color: var(--primary); text-decoration: none; }

/* === Utilities === */
.container { width: min(100% - 2.5rem, var(--max-width)); margin-inline: auto; }
@media (min-width: 768px) { .container { width: min(100% - 4rem, var(--max-width)); } }
/* The sticky header would otherwise cover whatever an in-page anchor
   (e.g. /services.php#tuning) scrolls to. */
[id] { scroll-margin-top: 90px; }
.section { padding: 4rem 0; }
.section-title { font-family: var(--font-display); font-size: clamp(1.75rem, 4vw, 2.5rem); margin-bottom: .5rem; }
.section-subtitle { color: var(--text-light); font-size: 1.1rem; margin-bottom: 2rem; }
.text-center { text-align: center; }
.btn { display: inline-block; padding: .75rem 1.75rem; border-radius: var(--radius); font-weight: 600; font-size: .95rem; border: none; cursor: pointer; transition: all .2s; }
.btn-primary { background: var(--panel-light); color: var(--contrast-panel-light, #fff); }
.btn-primary:hover { filter: brightness(1.2); }
.btn-outline { border: 2px solid var(--primary); color: var(--primary); background: transparent; }
.btn-outline:hover { background: var(--primary); color: var(--contrast-primary, #fff); }
.btn-accent { background: var(--accent); color: var(--contrast-accent, #fff); }
.btn-accent:hover { filter: brightness(1.15); }
.btn-block { width: 100%; text-align: center; }

/* === Header === */
.site-header { background: var(--white); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 100; }
.header-inner { display: flex; align-items: center; justify-content: space-between; padding: .75rem 0; }
.logo { display: flex; flex-direction: column; }
.logo-name { font-family: var(--font-display); font-size: 1.5rem; font-weight: 700; color: var(--primary-dark); line-height: 1; }
.logo-tagline { font-size: .7rem; color: var(--text-light); letter-spacing: .05em; text-transform: uppercase; }
/* Mobile: the nav is an off-canvas drawer opened by the hamburger and closed by
   the button in its own header. Reset to a static row at the desktop breakpoint. */
.main-nav {
    display: flex; flex-direction: column;
    position: fixed; top: 0; right: 0; bottom: 0; z-index: 200;
    width: min(320px, 85vw);
    background: var(--white);
    padding: 0 1.5rem 2rem;
    overflow-y: auto; overscroll-behavior: contain;
    box-shadow: -8px 0 28px rgba(0,0,0,.16);
    /* visibility rather than display, so the slide can animate and so the links
       stay out of the tab order while the drawer is shut. Transitioning
       visibility over a duration would hold it hidden for the first frame, which
       makes an immediate .focus() on the close button a no-op; flip it instantly
       on open and defer it to the end of the slide on close. */
    visibility: hidden; transform: translateX(100%);
    transition: transform .28s ease, visibility 0s linear .28s;
}
.main-nav.open { visibility: visible; transform: translateX(0); transition: transform .28s ease, visibility 0s; }
.nav-panel-head {
    display: flex; align-items: center; justify-content: space-between; gap: 1rem;
    position: sticky; top: 0; z-index: 1; background: var(--white);
    margin: 0 -1.5rem .75rem; padding: .8rem 1rem .8rem 1.5rem;
    border-bottom: 1px solid var(--border);
}
.nav-panel-title { font-family: var(--font-display); font-size: 1.1rem; font-weight: 700; color: var(--primary-dark); }
.nav-close {
    display: inline-flex; align-items: center; justify-content: center; flex: none;
    width: 44px; height: 44px; background: none; border: 1px solid var(--border);
    border-radius: 50%; color: var(--text); cursor: pointer; transition: background .2s, color .2s;
}
.nav-close:hover { background: var(--bg); color: var(--primary); }
.nav-close:focus-visible { outline: 2px solid var(--primary); outline-offset: 3px; }
.main-nav a:focus-visible { outline: 2px solid var(--primary); outline-offset: 3px; border-radius: 4px; }
.nav-close svg { width: 18px; height: 18px; }
.nav-backdrop {
    position: fixed; inset: 0; z-index: 150; background: rgba(15,61,57,.45);
    opacity: 0; visibility: hidden; transition: opacity .28s ease, visibility 0s linear .28s;
    /* Without this, dragging the dimmed area still scrolls the page behind it. */
    touch-action: none;
}
.nav-backdrop.open { opacity: 1; visibility: visible; transition: opacity .28s ease, visibility 0s; }
@media (prefers-color-scheme: dark) { .nav-backdrop { background: rgba(0,0,0,.6); } }
/* Set while the drawer is open; JS stores and restores the scroll offset. */
body.nav-open { position: fixed; width: 100%; overflow: hidden; }
.main-nav a { padding: .6rem 0; color: var(--text); font-weight: 500; font-size: .95rem; position: relative; }
.main-nav a:hover { color: var(--primary); }
.main-nav a.active { color: var(--primary); }
.main-nav a.active::after { content: ''; position: absolute; bottom: 0; left: 0; right: 0; height: 2px; background: var(--primary); border-radius: 2px; }
.nav-cta { text-align: center; margin-top: .5rem; }
.main-nav .nav-cta.btn { padding: .75rem 1.75rem; color: var(--contrast-panel-light, #fff); }
.nav-toggle { display: flex; flex-direction: column; gap: 5px; background: none; border: none; cursor: pointer; padding: .5rem; }
.nav-toggle span { width: 24px; height: 2px; background: var(--text); border-radius: 2px; }
@media (prefers-reduced-motion: reduce) {
    .main-nav, .nav-backdrop { transition: none; }
}

/* === Hero === */
.hero {
    background:
        radial-gradient(ellipse at 20% 50%, color-mix(in srgb, var(--accent) 25%, transparent) 0%, transparent 60%),
        radial-gradient(ellipse at 80% 20%, color-mix(in srgb, var(--accent) 15%, transparent) 0%, transparent 50%),
        radial-gradient(ellipse at 60% 100%, color-mix(in srgb, var(--panel-light) 30%, transparent) 0%, transparent 50%),
        linear-gradient(160deg, var(--panel) 0%, var(--panel-light) 40%, color-mix(in srgb, var(--panel) 80%, var(--accent)) 100%);
    color: #fff; padding: 5rem 0 3.5rem; position: relative; overflow: hidden;
}
.hero::before {
    content: ''; position: absolute; inset: 0; opacity: .04;
    background-image: url("data:image/svg+xml,%3Csvg width='60' height='60' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M30 0v60M0 30h60' stroke='%23fff' stroke-width='.5' fill='none'/%3E%3C/svg%3E");
    pointer-events: none;
}
.hero > .container { position: relative; z-index: 1; }
/* Seasonal "Celebrating <holiday>" ribbon, top-right of the hero. Only rendered
   when a holiday theme is live (see it_celebration()); a frosted white pill that
   stays legible on the fixed-dark hero gradient in both light and dark modes. */
.hero-celebration {
    position: absolute; top: 1.25rem; right: 1.25rem; z-index: 2;
    display: inline-flex; align-items: center; gap: .5rem;
    padding: .5rem .95rem; border-radius: 999px;
    background: rgba(255,255,255,.14);
    border: 1px solid rgba(255,255,255,.3);
    -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
    color: #fff; font-size: .82rem; font-weight: 600; letter-spacing: .01em;
    line-height: 1; white-space: nowrap;
    box-shadow: 0 4px 16px rgba(0,0,0,.18);
}
.hero-celebration-emoji { font-size: 1.05rem; line-height: 1; }
@media (max-width: 560px) {
    .hero-celebration { top: 1rem; right: 1rem; padding: .4rem .7rem; font-size: .72rem; gap: .35rem; }
    .hero-celebration-emoji { font-size: .95rem; }
}

.hero h1 { font-family: var(--font-display); font-size: clamp(2rem, 5vw, 3.25rem); line-height: 1.15; margin-bottom: 1rem; }
.hero p { font-size: 1.1rem; opacity: .9; margin-bottom: 2rem; }
.hero-buttons { display: flex; gap: 1rem; flex-wrap: wrap; }
.hero .btn-primary { background: var(--accent); color: var(--contrast-accent, #fff); }
.hero .btn-primary:hover { filter: brightness(1.1); }
/* The hero gradient is a fixed-dark panel surface in both modes, so its outline
   button label stays white regardless of the neutral --white flipping. */
.hero .btn-outline { border-color: rgba(255,255,255,.5); color: #fff; }
.hero .btn-outline:hover { background: rgba(255,255,255,.15); }
.trust-badges { display: flex; gap: 2rem; margin-top: 2.5rem; flex-wrap: wrap; }
.trust-badge { font-size: .85rem; opacity: .8; }
.trust-badge strong { display: block; font-size: 1.25rem; opacity: 1; }

/* === Services Cards === */
.services-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 360px)); justify-content: center; gap: 1.5rem; }
.services-cta { margin-top: 2rem; }
.service-card { display: flex; flex-direction: column; background: var(--white); border-radius: var(--radius); padding: 32px 2rem; box-shadow: var(--shadow); border: 1px solid var(--border); transition: transform .2s; width: 100%; }
.service-card:hover { transform: translateY(-3px); }
.service-card .service-duration { align-self: center; display: inline-block; background: rgba(42,157,143,.12); color: var(--primary); font-size: .78rem; font-weight: 600; letter-spacing: .02em; padding: .3rem .85rem; border-radius: 999px; margin-bottom: .75rem; }
.service-card h3 { font-family: var(--font-display); font-size: 1.3rem; margin-bottom: .5rem; }
.service-card .price { color: var(--primary); font-weight: 600; font-size: 1.1rem; margin-bottom: .75rem; }
.service-card p { color: var(--text-light); font-size: .95rem; margin-bottom: 36px; }
.service-card .btn { margin-top: auto; align-self: center; }

/* === Policy Card === */
.policy-card { display: flex; gap: 1.5rem; align-items: flex-start; max-width: calc(360px * 3 + 1.5rem * 2); margin: 0 auto; background: var(--bg); border: 1px solid var(--border); border-left: 4px solid var(--accent); border-radius: var(--radius); padding: 2rem; box-shadow: var(--shadow); text-align: left; }
.policy-card-icon { flex-shrink: 0; font-size: 1.75rem; line-height: 1; width: 3rem; height: 3rem; display: flex; align-items: center; justify-content: center; background: var(--white); border-radius: 50%; box-shadow: var(--shadow); }
.policy-card-title { font-family: var(--font-display); font-size: 1.4rem; margin-bottom: .75rem; color: var(--primary-dark); }
.policy-card-text { color: var(--text); font-size: 1rem; line-height: 1.65; margin-bottom: .75rem; }
.policy-card-text strong { color: var(--primary); }
.policy-card-note { color: var(--text-light); font-size: .9rem; }
@media (max-width: 520px) {
    .policy-card { flex-direction: column; gap: 1rem; padding: 1.5rem; }
}

/* === Testimonials === */
.testimonials-grid { display: flex; flex-wrap: wrap; justify-content: center; gap: 1.5rem; }
.testimonial { background: var(--white); border-radius: var(--radius); padding: 1.5rem; box-shadow: var(--shadow); border: 1px solid var(--border); width: 340px; max-width: 100%; text-align: left; }
.testimonial .stars { color: var(--accent); margin-bottom: .5rem; font-size: 1.1rem; }
.testimonial blockquote { font-style: italic; color: var(--text-light); margin-bottom: .75rem; }
.testimonial cite { font-style: normal; font-weight: 600; font-size: .9rem; }

/* === CTA Banner === */
.cta-banner { background: var(--panel-light); color: #fff; text-align: center; padding: 3rem 0; }
.cta-banner h2 { font-family: var(--font-display); font-size: clamp(1.5rem, 3vw, 2rem); margin-bottom: .5rem; }
.cta-banner p { opacity: .85; margin-bottom: 1.5rem; }
.cta-banner .btn { background: var(--accent); color: var(--text); }

/* === About === */
.about-content { display: grid; gap: 2rem; }
.about-content img { border-radius: var(--radius); max-height: 400px; width: auto; }
.notable-clients { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: 1rem; }
.notable-clients span { background: var(--panel-light); color: #fff; padding: .3rem .75rem; border-radius: 20px; font-size: .8rem; }

/* === Forms === */
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
@media (max-width: 560px) { .form-row { grid-template-columns: 1fr; gap: 0; } }
.form-group { margin-bottom: 1.25rem; }
.form-group label { display: block; font-weight: 500; margin-bottom: .35rem; font-size: .9rem; }
.form-group input, .form-group select, .form-group textarea {
    width: 100%; padding: .7rem .9rem; border: 1px solid var(--border); border-radius: var(--radius);
    font-family: var(--font); font-size: .95rem; background: var(--white); transition: border .2s;
}
.form-group input:focus, .form-group select:focus, .form-group textarea:focus { outline: none; border-color: var(--primary); }
.form-group textarea { resize: vertical; min-height: 120px; }
.form-card { background: var(--white); border-radius: var(--radius); padding: 2rem; box-shadow: var(--shadow); max-width: 640px; margin: 0 auto; }
.alert { padding: 1rem; border-radius: var(--radius); margin-bottom: 1.5rem; font-size: .95rem; }
.alert-success { background: #e8f5e9; color: #2e7d32; }
.alert-error { background: #fce4ec; color: #c62828; }

/* === Footer === */
.site-footer { background: var(--panel); color: rgba(255,255,255,.8); padding: 3rem 0 1.5rem; margin-top: 2rem; }
.footer-grid { display: grid; gap: 2rem; }
.footer-col h3, .footer-col h4 { color: #fff; margin-bottom: .75rem; }
.footer-col a { display: block; color: rgba(255,255,255,.7); padding: .2rem 0; font-size: .9rem; }
.footer-col a:hover { color: #fff; }
.footer-bottom { border-top: 1px solid rgba(255,255,255,.15); margin-top: 2rem; padding-top: 1rem; font-size: .8rem; opacity: .6; display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: .5rem; }

/* === Desktop === */
@media (min-width: 768px) {
    .nav-toggle { display: none; }
    /* Unwind the mobile drawer: back to an inline row in the header. */
    .main-nav {
        display: flex; position: static; flex-direction: row; align-items: center; gap: 1.5rem;
        width: auto; border: none; padding: 0; background: none; box-shadow: none;
        overflow: visible; visibility: visible; transform: none; transition: none;
    }
    .nav-panel-head, .nav-backdrop { display: none; }
    /* Guard against a stale scroll lock if the drawer was open at the crossover. */
    body.nav-open { position: static; overflow: visible; }
    .nav-cta { margin-top: 0; }
    .services-grid { grid-template-columns: repeat(3, 1fr); }
    .about-content { grid-template-columns: 1fr 1fr; align-items: center; }
    .footer-grid { grid-template-columns: 2fr 1fr 1fr 1fr; }
    .hero { padding: 5rem 0 4rem; }
}

/* === Blog === */
.blog-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.5rem; }
@media (max-width: 768px) { .blog-grid { grid-template-columns: 1fr; } }
.blog-card {
    background: var(--white); border: 1px solid var(--border); border-radius: 16px; padding: 2rem;
    transition: all .3s ease; display: flex; flex-direction: column; position: relative; overflow: hidden;
}
.blog-card::before {
    content: ''; position: absolute; top: 0; left: 0; right: 0; height: 4px;
    background: linear-gradient(90deg, var(--primary), var(--accent)); opacity: 0; transition: opacity .3s;
}
.blog-card:hover { transform: translateY(-6px); box-shadow: 0 12px 32px rgba(0,0,0,.1); border-color: transparent; }
.blog-card:hover::before { opacity: 1; }
.blog-card-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1rem; }
.blog-icon { font-size: 2rem; width: 48px; height: 48px; display: flex; align-items: center; justify-content: center; background: linear-gradient(135deg, rgba(26,92,87,.08), rgba(42,157,143,.08)); border-radius: 12px; }
.blog-read { font-size: .75rem; font-weight: 600; color: var(--accent); background: rgba(42,157,143,.08); padding: 4px 10px; border-radius: 20px; }
.blog-card h3 { font-family: var(--font-display); font-size: 1.25rem; margin-bottom: .6rem; color: var(--text); line-height: 1.35; }
.blog-card p { color: var(--text-light); font-size: .9rem; flex: 1; margin-bottom: 1rem; line-height: 1.6; }
.blog-card-footer { display: flex; justify-content: space-between; align-items: center; padding-top: .75rem; border-top: 1px solid var(--border); }
.blog-date { font-size: .8rem; color: var(--text-light); font-weight: 500; }
.blog-back { display: inline-flex; align-items: center; gap: 6px; font-size: .85rem; font-weight: 600; color: var(--primary); padding: 8px 16px 8px 12px; border-radius: 8px; background: rgba(26,92,87,.06); margin-bottom: 1.5rem; transition: all .2s; }
.blog-back:hover { background: rgba(26,92,87,.12); }
.blog-back-icon { font-size: 1.2rem; line-height: 1; transition: transform .2s; }
.blog-back:hover .blog-back-icon { transform: translateX(-3px); }
.blog-content { font-size: 1.05rem; line-height: 1.8; }
.blog-content h2 { font-family: var(--font-display); font-size: 1.4rem; margin: 2rem 0 .75rem; }
.blog-content h3 { font-size: 1.15rem; margin: 1.5rem 0 .5rem; }
.blog-content p { margin-bottom: 1.25rem; }
.blog-content ul, .blog-content ol { margin: 0 0 1.25rem 1.5rem; }
.blog-content li { margin-bottom: .4rem; }

/* === Blog prev/next nav === */
.blog-nav { display: flex; justify-content: space-between; align-items: stretch; gap: 1rem; margin-top: 3rem; padding-top: 2rem; border-top: 1px solid var(--border); }
.blog-nav-link { display: flex; flex-direction: column; gap: 2px; width: 260px; max-width: 45%; text-decoration: none; }
.blog-nav-link.is-next { align-items: flex-end; text-align: right; margin-left: auto; }
.blog-nav-dir { display: inline-flex; align-items: center; gap: 4px; font-size: .7rem; text-transform: uppercase; letter-spacing: .5px; color: var(--text-light); }
.blog-nav-dir .chev { font-size: 1.2rem; line-height: 1; }
.blog-nav-title { font-size: .9rem; font-weight: 600; color: var(--primary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }

/* === Tablet === */
@media (min-width: 768px) and (max-width: 1000px) {
    /* Three equal columns squeezed each card to ~210px at this width. */
    .services-grid, .blog-grid { grid-template-columns: repeat(2, 1fr); }
}

/* === Mobile ===
   Phones previously inherited desktop spacing and sub-16px form text. Kept last
   in the file so these win on source order without needing !important. */
@media (max-width: 767px) {
    .section { padding: 2.5rem 0; }
    .section-subtitle { font-size: 1rem; margin-bottom: 1.5rem; }

    /* Buttons: 44px is the minimum comfortable touch target. */
    .btn { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; padding: .75rem 1.5rem; }

    /* Header */
    .logo-name { font-size: 1.3rem; }
    .nav-toggle { min-width: 44px; min-height: 44px; align-items: center; justify-content: center; }
    .main-nav a { padding: .75rem 0; }
    .main-nav a.active::after { top: .4rem; bottom: .4rem; left: -.85rem; right: auto; width: 3px; height: auto; }
    .main-nav .nav-cta.btn { display: flex; width: 100%; }

    /* Hero */
    .hero { padding: 3rem 0 2.5rem; }
    .hero p { font-size: 1rem; margin-bottom: 1.5rem; }
    .hero-buttons { gap: .75rem; }
    .hero-buttons .btn { flex: 1 1 100%; }
    /* Three badges at a 2rem gap wrapped 2 + 1 with a lopsided orphan; an
       explicit two-column grid keeps them aligned. */
    .trust-badges { display: grid; grid-template-columns: 1fr 1fr; gap: 1.25rem 1rem; margin-top: 2rem; }
    /* The third badge has the longest label; let it use the full row rather
       than sitting orphaned in a half-width cell. */
    .trust-badge:last-child { grid-column: 1 / -1; }
    .trust-badge strong { font-size: 1.1rem; }

    /* Cards */
    .service-card { padding: 1.5rem 1.25rem; }
    .service-card p { margin-bottom: 1.5rem; }
    .blog-card { padding: 1.5rem 1.25rem; }
    .testimonial { padding: 1.25rem; }
    .policy-card { padding: 1.25rem; }

    /* Forms: 2rem of card padding plus the container gutters left roughly 265px
       of usable width on a 375px screen. */
    .form-card { padding: 1.5rem 1.25rem; }
    .form-group { margin-bottom: 1rem; }
    /* iOS Safari auto-zooms the page when a focused field is under 16px, and
       leaves it zoomed and horizontally scrollable afterwards. */
    .form-group input, .form-group select, .form-group textarea { font-size: 16px; }
    .form-group textarea { min-height: 100px; }

    /* Blog: side by side left each title with ~48% of the width, truncating
       most of it ("What a Pitch Raise Ac..."). Stacked full-width rows let the
       title wrap to two lines instead. */
    .blog-nav { flex-direction: column; gap: 1.25rem; }
    .blog-nav-link, .blog-nav-link.is-next { width: 100%; max-width: 100%; align-items: flex-start; text-align: left; margin-left: 0; }
    .blog-nav-title { white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }

    /* Footer */
    .site-footer { padding: 2.5rem 0 1.25rem; }
    .footer-grid { gap: 1.75rem; }
    .footer-bottom { justify-content: center; text-align: center; gap: .25rem; }
}

/* Touch devices at any width. iPad portrait is exactly 768px, which lands on
   the desktop side of the breakpoint above, yet still zooms on sub-16px fields
   and still needs finger-sized targets. */
@media (pointer: coarse) {
    .form-group input, .form-group select, .form-group textarea { font-size: 16px; }
    .btn { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; }
    .main-nav a { padding: .75rem 0; }
}
