/* =========================================================
   Handyman William - global stylesheet
   Font: Atkinson Hyperlegible
   ========================================================= */

@import url('https://fonts.googleapis.com/css2?family=Atkinson+Hyperlegible:ital,wght@0,400;0,700;1,400;1,700&display=swap');

:root {
    --c-primary:    #1f4e79;
    --c-primary-d:  #143655;
    --c-accent:     #ffd24a;
    --c-red:        #c8102e;
    --c-text:       #1c2531;
    --c-muted:      #5a6470;
    --c-bg:         #ffffff;
    --c-bg-alt:     #f4f6f9;
    --c-border:     #d8dee6;
    --c-success:    #1f7a4d;

    --radius:       8px;
    --shadow-sm:    0 2px 4px rgba(20,54,85,0.08);
    --shadow-md:    0 6px 18px rgba(20,54,85,0.12);

    --max-w:        1180px;
    --header-h:     78px;

    --ff: 'Atkinson Hyperlegible', Arial, Helvetica, sans-serif;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
    margin: 0;
    font-family: var(--ff);
    font-size: 17px;
    line-height: 1.65;
    color: var(--c-text);
    background: var(--c-bg);
    -webkit-text-size-adjust: 100%;
    -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; height: auto; display: block; }

a {
    color: var(--c-primary);
    text-decoration: underline;
    text-decoration-thickness: 1px;
    text-underline-offset: 2px;
}
a:hover, a:focus-visible { color: var(--c-red); }

a:focus-visible, button:focus-visible, input:focus-visible,
textarea:focus-visible, select:focus-visible {
    outline: 3px solid var(--c-accent);
    outline-offset: 2px;
}

h1, h2, h3, h4 {
    font-weight: 700;
    line-height: 1.2;
    color: var(--c-primary-d);
    margin: 0 0 .6em;
}
h1 { font-size: 2.1rem; }
h2 { font-size: 1.55rem; margin-top: 1.4em; }
h3 { font-size: 1.2rem; margin-top: 1.2em; }
h4 { font-size: 1.05rem; }

p, ul, ol { margin: 0 0 1em; }

ul, ol { padding-left: 1.2em; }

/* ---------- Skip link ---------- */
.skip-link {
    position: absolute; top: -40px; left: 0;
    background: var(--c-primary-d); color: #fff;
    padding: .5rem 1rem; z-index: 1000;
    text-decoration: none;
}
.skip-link:focus { top: 0; }

/* ---------- Containers ---------- */
.container {
    width: 100%;
    max-width: var(--max-w);
    margin: 0 auto;
    padding: 0 16px;
}

/* ---------- Header ---------- */
.site-header {
    background: #fff;
    border-bottom: 1px solid var(--c-border);
    position: sticky; top: 0; z-index: 100;
    box-shadow: var(--shadow-sm);
}
.site-header .container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: var(--header-h);
    gap: 1rem;
}
.site-logo { display: inline-flex; align-items: center; }
.site-logo img { height: 56px; width: auto; }

.primary-nav { display: none; }
.primary-nav ul {
    list-style: none;
    margin: 0; padding: 0;
    display: flex;
    gap: 1.6rem;
    align-items: center;
}
.primary-nav a {
    color: var(--c-primary-d);
    text-decoration: none;
    font-weight: 700;
    padding: .35rem 0;
    border-bottom: 2px solid transparent;
}
.primary-nav a:hover, .primary-nav a.active {
    border-bottom-color: var(--c-accent);
    color: var(--c-primary);
}

.nav-toggle {
    display: inline-flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    width: 44px; height: 44px;
    background: var(--c-primary);
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
    padding: 0;
}
.nav-toggle span {
    display: block;
    width: 24px; height: 3px;
    background: #fff;
    margin: 3px 0;
    border-radius: 2px;
    transition: transform .25s, opacity .25s;
}
.nav-toggle[aria-expanded="true"] span:nth-child(1) { transform: translateY(9px) rotate(45deg); }
.nav-toggle[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.nav-toggle[aria-expanded="true"] span:nth-child(3) { transform: translateY(-9px) rotate(-45deg); }

/* ---------- Mobile nav ---------- */
.mobile-nav {
    display: none;
    background: var(--c-primary-d);
    border-top: 3px solid var(--c-accent);
}
.mobile-nav.open { display: block; }
.mobile-nav ul { list-style: none; margin: 0; padding: 0; }
.mobile-nav li { border-bottom: 1px solid rgba(255,255,255,0.1); }
.mobile-nav a {
    display: block;
    padding: 1rem 16px;
    color: #fff;
    text-decoration: none;
    font-weight: 700;
}
.mobile-nav a:hover { background: var(--c-primary); color: var(--c-accent); }

/* ---------- Breadcrumb ---------- */
.breadcrumb {
    background: var(--c-bg-alt);
    padding: .6rem 0;
    font-size: .9rem;
}
.breadcrumb ol {
    list-style: none;
    display: flex;
    flex-wrap: wrap;
    gap: .35rem;
    padding: 0;
    margin: 0;
}
.breadcrumb li + li::before {
    content: "›";
    margin-right: .35rem;
    color: var(--c-muted);
}
.breadcrumb a { color: var(--c-primary); text-decoration: none; }
.breadcrumb [aria-current="page"] { color: var(--c-muted); }

/* ---------- Hero ---------- */
.hero {
    background: linear-gradient(135deg, var(--c-primary-d), var(--c-primary));
    color: #fff;
    padding: 3rem 0 2.6rem;
    text-align: center;
}
.hero h1 { color: #fff; margin-bottom: .4em; }
.hero p { color: rgba(255,255,255,0.92); font-size: 1.1rem; max-width: 720px; margin: 0 auto 1.4em; }

/* ---------- Buttons ---------- */
.btn {
    display: inline-block;
    background: var(--c-accent);
    color: var(--c-primary-d);
    padding: .85rem 1.6rem;
    border-radius: var(--radius);
    text-decoration: none;
    font-weight: 700;
    border: none;
    cursor: pointer;
    transition: transform .15s, box-shadow .15s;
}
.btn:hover, .btn:focus-visible {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
    color: var(--c-primary-d);
}
.btn-secondary {
    background: #fff;
    color: var(--c-primary-d);
    border: 2px solid #fff;
}
.btn-block { display: block; width: 100%; text-align: center; }

/* ---------- Sections ---------- */
section { padding: 2.4rem 0; }
section.alt { background: var(--c-bg-alt); }

.section-title {
    text-align: center;
    margin-bottom: 1.6rem;
}
.section-title h2 { margin: 0 0 .3em; }
.section-title p { color: var(--c-muted); margin: 0; }

/* ---------- Service grid ---------- */
.service-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.2rem;
}
.service-card {
    background: #fff;
    border: 1px solid var(--c-border);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    transition: transform .15s, box-shadow .15s;
    display: flex;
    flex-direction: column;
}
.service-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); }
.service-card img {
    width: 100%;
    height: 200px;
    object-fit: cover;
}
.service-card .body { padding: 1rem 1.1rem 1.2rem; flex: 1 1 auto; }
.service-card h3 { margin: 0 0 .4em; font-size: 1.15rem; }
.service-card h3 a { color: var(--c-primary-d); text-decoration: none; }
.service-card h3 a:hover { color: var(--c-red); }
.service-card p { font-size: .96rem; color: var(--c-text); }

/* ---------- Strip / images row ---------- */
.image-strip {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: .6rem;
    margin: 2rem 0;
}
.image-strip img {
    width: 100%;
    height: 220px;
    object-fit: cover;
    border-radius: var(--radius);
}

/* ---------- Two-col content ---------- */
.two-col {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.6rem;
}
.two-col img { border-radius: var(--radius); }

/* ---------- Trust bar ---------- */
.trust-bar {
    background: var(--c-primary-d);
    color: #fff;
    padding: 1rem 0;
}
.trust-bar ul {
    list-style: none;
    margin: 0; padding: 0;
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: .6rem 1rem;
    text-align: center;
    font-weight: 700;
    font-size: .95rem;
}
.trust-bar li::before { content: "✓ "; color: var(--c-accent); margin-right: .3rem; }

/* ---------- FAQ ---------- */
.faq details {
    background: #fff;
    border: 1px solid var(--c-border);
    border-radius: var(--radius);
    padding: 1rem 1.2rem;
    margin-bottom: .8rem;
}
.faq summary {
    font-weight: 700;
    cursor: pointer;
    color: var(--c-primary-d);
    list-style: none;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: " +"; float: right; color: var(--c-red); font-size: 1.4rem; line-height: 1; }
.faq details[open] summary::after { content: " –"; }
.faq details > *:not(summary) { margin-top: .8em; }

/* ---------- Reviews ---------- */
.reviews {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
}
@media (min-width: 720px) {
    .reviews { grid-template-columns: 1fr 1fr; }
}
.review {
    background: #fff;
    border: 1px solid var(--c-border);
    border-left: 4px solid var(--c-accent);
    border-radius: var(--radius);
    padding: 1.1rem 1.2rem;
    box-shadow: var(--shadow-sm);
}
.review .stars { color: #f5b301; letter-spacing: 1px; margin-bottom: .3rem; }
.review p { font-style: italic; margin-bottom: .6rem; }
.review cite { color: var(--c-muted); font-style: normal; font-weight: 700; font-size: .9rem; }

/* ---------- Map ---------- */
.map-wrap {
    position: relative;
    overflow: hidden;
    border-radius: var(--radius);
    border: 1px solid var(--c-border);
    margin: 1.2rem 0;
}
.map-wrap iframe {
    display: block;
    width: 100%;
    height: 340px;
    border: 0;
}

/* ---------- Form ---------- */
.contact-form {
    background: #fff;
    border: 1px solid var(--c-border);
    border-radius: var(--radius);
    padding: 1.4rem;
    box-shadow: var(--shadow-sm);
    max-width: 720px;
    margin: 0 auto;
}
.form-row { margin-bottom: 1rem; }
.form-row label {
    display: block;
    font-weight: 700;
    margin-bottom: .35rem;
    color: var(--c-primary-d);
}
.form-row input,
.form-row select,
.form-row textarea {
    width: 100%;
    padding: .7rem .8rem;
    border: 1px solid var(--c-border);
    border-radius: var(--radius);
    font-family: inherit;
    font-size: 1rem;
    background: #fff;
}
.form-row textarea { min-height: 140px; resize: vertical; }
.form-row .hp { display: none; }
.form-note { font-size: .85rem; color: var(--c-muted); margin-top: 1rem; }

/* ---------- Tag list ---------- */
.tag-list {
    line-height: 2.2;
    font-size: .95rem;
}
.tag-list a {
    background: var(--c-bg-alt);
    padding: .2rem .55rem;
    border-radius: 4px;
    text-decoration: none;
    margin-right: .15rem;
    color: var(--c-primary);
    border: 1px solid var(--c-border);
}
.tag-list a:hover { background: var(--c-accent); color: var(--c-primary-d); }

/* ---------- Locations grid ---------- */
.locations-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: .5rem .8rem;
    margin: 1.2rem 0;
}
.locations-grid a {
    display: block;
    padding: .6rem .8rem;
    background: var(--c-bg-alt);
    border: 1px solid var(--c-border);
    border-radius: var(--radius);
    text-decoration: none;
    color: var(--c-primary-d);
    font-weight: 700;
}
.locations-grid a:hover { background: var(--c-accent); }

/* ---------- Footer ---------- */
.site-footer {
    background: var(--c-primary-d);
    color: #cfd6df;
    padding: 2.4rem 0 1.2rem;
    margin-top: 2rem;
}
.site-footer a { color: var(--c-accent); }
.site-footer .footer-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.6rem;
    margin-bottom: 1.6rem;
}
.site-footer h4 { color: #fff; margin-bottom: .6em; font-size: 1.05rem; }
.site-footer ul { list-style: none; padding: 0; margin: 0; }
.site-footer li { margin-bottom: .4em; }
.site-footer img { height: 60px; width: auto; }
.site-footer .copyright {
    border-top: 1px solid rgba(255,255,255,0.1);
    padding-top: 1rem;
    text-align: center;
    font-size: .9rem;
}

/* ---------- Utility ---------- */
.text-center { text-align: center; }
.mt-2 { margin-top: 1rem; }
.mb-2 { margin-bottom: 1rem; }
.lead { font-size: 1.1rem; color: var(--c-muted); }

.callout {
    background: var(--c-bg-alt);
    border-left: 4px solid var(--c-accent);
    padding: 1rem 1.2rem;
    border-radius: var(--radius);
    margin: 1.2rem 0;
}

.thanks-box {
    text-align: center;
    background: #fff;
    border: 1px solid var(--c-border);
    padding: 2rem 1.5rem;
    border-radius: var(--radius);
    box-shadow: var(--shadow-md);
    max-width: 640px;
    margin: 0 auto;
}
.thanks-box .tick {
    width: 70px; height: 70px;
    background: var(--c-success);
    color: #fff;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 2.4rem;
    margin-bottom: 1rem;
}

/* =========================================================
   Tablet ( ≥ 600px )
   ========================================================= */
@media (min-width: 600px) {
    h1 { font-size: 2.5rem; }
    h2 { font-size: 1.85rem; }
    .service-grid { grid-template-columns: repeat(2, 1fr); }
    .image-strip { grid-template-columns: repeat(3, 1fr); }
    .two-col { grid-template-columns: 1fr 1fr; align-items: start; }
    .trust-bar ul { grid-template-columns: repeat(4, 1fr); }
    .locations-grid { grid-template-columns: repeat(3, 1fr); }
    .reviews { grid-template-columns: repeat(2, 1fr); }
    .site-footer .footer-grid { grid-template-columns: 2fr 1fr 1fr; }
}

/* =========================================================
   Desktop ( ≥ 900px )
   ========================================================= */
@media (min-width: 900px) {
    .service-grid { grid-template-columns: repeat(3, 1fr); }
    /* Homepage strip has 5 images — use 5 columns only when there are 5 children */
    .image-strip:has(> img:nth-child(5)) { grid-template-columns: repeat(5, 1fr); }
    /* Service pages have 3 images — keep them centred at a sensible max width */
    .image-strip:not(:has(> img:nth-child(4))) {
        grid-template-columns: repeat(3, 1fr);
        max-width: 960px;
        margin-left: auto;
        margin-right: auto;
    }
    .image-strip img { height: 280px; }
    .nav-toggle { display: none; }
    .primary-nav { display: block; }
    .mobile-nav { display: none !important; }
    .locations-grid { grid-template-columns: repeat(4, 1fr); }
    .hero { padding: 4rem 0 3.4rem; }
    .hero p { font-size: 1.2rem; }
}

/* =========================================================
   Reduced motion
   ========================================================= */
@media (prefers-reduced-motion: reduce) {
    * { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
}

/* =========================================================
   Print
   ========================================================= */
@media print {
    .site-header, .site-footer, .nav-toggle, .mobile-nav, .breadcrumb, .btn { display: none !important; }
    body { color: #000; background: #fff; }
    a { color: #000; text-decoration: underline; }
}

/* =========================================================
   Additional layout utilities for root pages
   ========================================================= */

/* Alternate background section */
.content-block.bg-alt {
    background: var(--c-bg-alt);
    border-top: 1px solid var(--c-border);
    border-bottom: 1px solid var(--c-border);
}

/* Contact page two-column layout */
.contact-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 2rem;
    margin: 2rem 0;
}
@media (min-width: 860px) {
    .contact-grid {
        grid-template-columns: 1.6fr 1fr;
    }
}
.contact-grid aside.content-block {
    background: var(--c-bg-alt);
    border: 1px solid var(--c-border);
    border-radius: var(--radius);
    padding: 1.6rem;
    align-self: start;
}
.contact-grid aside.content-block h2,
.contact-grid aside.content-block h3 {
    color: var(--c-primary-d);
}

/* Form fields */
.contact-form .field {
    margin-bottom: 1.1rem;
}
.contact-form label {
    display: block;
    font-weight: 700;
    margin-bottom: .35rem;
    color: var(--c-primary-d);
}
.contact-form .req {
    color: var(--c-red);
    font-weight: 700;
    margin-left: .15em;
}
.contact-form input,
.contact-form select,
.contact-form textarea {
    width: 100%;
    padding: .7rem .8rem;
    font-family: var(--ff);
    font-size: 1rem;
    color: var(--c-text);
    background: #fff;
    border: 1.5px solid var(--c-border);
    border-radius: var(--radius);
    transition: border-color .15s ease, box-shadow .15s ease;
}
.contact-form input:focus,
.contact-form select:focus,
.contact-form textarea:focus {
    outline: none;
    border-color: var(--c-primary);
    box-shadow: 0 0 0 3px rgba(31, 78, 121, 0.18);
}
.contact-form textarea {
    resize: vertical;
    min-height: 130px;
}
.contact-form .form-note {
    font-size: .88rem;
    color: var(--c-muted);
    margin-top: .8rem;
}

/* Sitemap list */
.sitemap-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: grid;
    grid-template-columns: 1fr;
    gap: .35rem;
}
@media (min-width: 600px) {
    .sitemap-list {
        grid-template-columns: 1fr 1fr;
    }
}
@media (min-width: 900px) {
    .sitemap-list {
        grid-template-columns: 1fr 1fr 1fr;
    }
}
.sitemap-list li {
    padding: .35rem 0;
    border-bottom: 1px dotted var(--c-border);
}
.sitemap-list li a {
    color: var(--c-primary-d);
    text-decoration: none;
}
.sitemap-list li a:hover {
    color: var(--c-red);
    text-decoration: underline;
}

/* =========================================================
   Home page hero — photographic background
   Use a darker overlay so the white headline still passes WCAG.
   ========================================================= */
.hero.hero-photo {
    background:
        linear-gradient(
            90deg,
            rgba(20, 54, 85, 0.82) 0%,
            rgba(20, 54, 85, 0.62) 55%,
            rgba(20, 54, 85, 0.30) 100%
        ),
        url('../images/hero-header.jpg') center/cover no-repeat,
        var(--c-primary-d);
    color: #fff;
    padding: 4.5rem 0 4rem;
    text-align: left;
}
.hero.hero-photo .container { max-width: var(--max-w); }
.hero.hero-photo h1 {
    font-size: 2.6rem;
    line-height: 1.05;
    max-width: 22ch;
    margin-bottom: .4em;
    color: #fff;
    text-shadow: 0 2px 16px rgba(0,0,0,0.35);
}
.hero.hero-photo p {
    max-width: 50ch;
    margin-left: 0;
    margin-right: 0;
    font-size: 1.1rem;
    color: rgba(255,255,255,0.95);
    text-shadow: 0 1px 8px rgba(0,0,0,0.35);
}
@media (min-width: 900px) {
    .hero.hero-photo {
        padding: 6rem 0 5rem;
        background:
            linear-gradient(
                90deg,
                rgba(20, 54, 85, 0.85) 0%,
                rgba(20, 54, 85, 0.55) 50%,
                rgba(20, 54, 85, 0.10) 100%
            ),
            url('../images/hero-header-wide.jpg') center right/cover no-repeat,
            var(--c-primary-d);
    }
    .hero.hero-photo h1 { font-size: 3.4rem; }
}
@media (max-width: 600px) {
    /* On very narrow screens, the photo's left negative space is mostly
       cropped out, so darken further for readability */
    .hero.hero-photo {
        background:
            linear-gradient(
                rgba(20, 54, 85, 0.78),
                rgba(20, 54, 85, 0.78)
            ),
            url('../images/hero-header.jpg') center/cover no-repeat,
            var(--c-primary-d);
        text-align: center;
        padding: 3rem 0 2.6rem;
    }
    .hero.hero-photo h1 { font-size: 2rem; max-width: 100%; }
    .hero.hero-photo p { margin: 0 auto 1.4em; max-width: 100%; }
}

/* =========================================================
   Links page list
   ========================================================= */
.links-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: grid;
    grid-template-columns: 1fr;
    gap: .25rem;
}
@media (min-width: 600px) {
    .links-list { grid-template-columns: 1fr 1fr; }
}
@media (min-width: 900px) {
    .links-list { grid-template-columns: 1fr 1fr 1fr; }
}
.links-list li {
    padding: .55rem .8rem;
    border: 1px solid var(--c-border);
    border-radius: var(--radius);
    background: var(--c-bg-alt);
    transition: background .15s ease, border-color .15s ease;
}
.links-list li:hover {
    background: #fff;
    border-color: var(--c-primary);
}
.links-list a {
    color: var(--c-primary-d);
    text-decoration: none;
    font-weight: 600;
}
.links-list a:hover {
    color: var(--c-red);
    text-decoration: underline;
}
