/* =====================================================================
   Firetrace Ductwork - visual polish layer
   ---------------------------------------------------------------------
   Loaded last on every page. Refines colour contrast, corners, shadows,
   buttons, form fields and interaction states WITHOUT changing layout,
   text, wrapping or images. Delete the <link> to polish.css to go back.
   ===================================================================== */

/* ---------- 1. Design tokens (shared values) ---------- */
:root {
    /* Brand palette (unchanged colours, named once) */
    --ft-red: #d32f2f;
    --ft-red-dark: #b71c1c;
    --ft-red-darker: #8e1515;
    --ft-ink: #1a1a1a;
    --ft-text: #333333;
    --ft-text-muted: #595959;      /* 7:1 on white - AA for small text */
    --ft-text-subtle: #666666;     /* 5.7:1 on white, 5.4:1 on #f9f9f9 */
    --ft-surface: #ffffff;
    --ft-surface-alt: #fafafa;
    --ft-line: #eeeeee;
    --ft-field-border: #949494;    /* 3:1 against white - AA for form field edges */
    --ft-field-border-hover: #6e6e6e;
    --ft-on-dark-muted: #a6a6a6;   /* 7.6:1 on #1a1a1a */

    /* Corners */
    --ft-radius-sm: 4px;           /* buttons, inputs */
    --ft-radius-md: 6px;           /* cards, boxes, panels */
    --ft-radius-lg: 8px;           /* menus, search panel */
    --ft-radius-pill: 20px;        /* chips, tabs, search toggle */

    /* Elevation */
    --ft-shadow-card: 0 1px 2px rgba(18, 20, 23, 0.04), 0 2px 8px rgba(18, 20, 23, 0.05);
    --ft-shadow-card-hover: 0 2px 4px rgba(18, 20, 23, 0.05), 0 10px 24px rgba(18, 20, 23, 0.10);
    --ft-shadow-pop: 0 8px 24px rgba(18, 20, 23, 0.14);

    /* Focus ring */
    --ft-focus: 0 0 0 3px rgba(211, 47, 47, 0.35);
    --ft-focus-outline: 2px solid var(--ft-red);
    --ft-focus-outline-on-dark: 2px solid #ffffff;

    /* Motion */
    --ft-ease: cubic-bezier(0.2, 0.7, 0.2, 1);
    --ft-dur-fast: 200ms;
    --ft-dur: 220ms;
}

/* ---------- 2. Text selection ---------- */
::selection { background: rgba(211, 47, 47, 0.18); color: inherit; }

/* ---------- 3. Contrast fixes (WCAG AA, same hues, slightly darker/lighter tints) ---------- */
.enquiry-box .sub,
.cpd-info p,
.content-diagram p { color: var(--ft-text-subtle); }
.project-group-count,
.project-card .project-location,
.project-location { color: #6b6b6b; }             /* was #888: 3.4:1 -> 5.0:1 on #fafafa */
.delivery-box .call-label { color: #ffffff; }      /* was pale pink on red: 3.8:1 -> 4.6:1 */
footer .footer-bottom,
footer .footer-bottom span { color: var(--ft-on-dark-muted); }   /* was #666 on #1a1a1a: 3.0:1 */
.newsletter-form input::placeholder { color: #a6a6a6; }
.site-search-close { color: #6b6b6b; }

/* ---------- 4. Corners (tokenised; same values as before) ---------- */
.btn, .btn1, .read-more, .usp-cta-btn, .cpd-submit-btn, .submit-btn,
.hero-enquiry, .enquiry-box button,
input:not([type="checkbox"]):not([type="radio"]), textarea, select,
.form-control { border-radius: var(--ft-radius-sm); }
.filter-chip, .enquiry-type-tab { border-radius: var(--ft-radius-pill); }
.site-search-toggle { border-radius: var(--ft-radius-sm); }   /* square-ish to match the other buttons */
.site-search-inner, ul.dropdown { border-radius: var(--ft-radius-lg); }

/* ---------- 5. Card elevation (one consistent soft shadow) ---------- */
.sidebar, .sidebar-panel, .content-diagram, .cpd-form-box, .map-section,
.project-group, .section-intro:has(+ .map-section), .supply-section, .usp-card, .usp-cta-tile,
.app-card, .projects-map, .sidebar-image-card, .map-box, main.form-box {
    box-shadow: var(--ft-shadow-card);
}
ul.dropdown { box-shadow: var(--ft-shadow-pop); }

/* Cards that react to the pointer get a matching lift */
.app-card, .usp-card, .usp-cta-tile, .gallery-item {
    transition: transform var(--ft-dur) var(--ft-ease), box-shadow var(--ft-dur) var(--ft-ease);
}
.app-card:hover, .usp-card:hover, .usp-cta-tile:hover { box-shadow: var(--ft-shadow-card-hover); }

/* ---------- 6. Button animations (one consistent set, used on every page) ----------
   Hover / keyboard focus: smooth colour change, the button lifts 2px with a soft shadow,
   and arrow icons slide forward. Click: the button presses back down.
   These are small, user-triggered effects, so they also run when "reduce motion" is on. */
:root { --ft-btn-dur: 220ms; --ft-btn-press: 90ms; }

/* Solid buttons */
.btn, .hero-enquiry, .read-more, .usp-cta-btn, .cpd-submit-btn, .submit-btn, .btn1,
.enquiry-box button, .filter-chip, .enquiry-type-tab, .site-search-toggle {
    transition: background-color var(--ft-btn-dur) var(--ft-ease),
                color var(--ft-btn-dur) var(--ft-ease),
                border-color var(--ft-btn-dur) var(--ft-ease),
                box-shadow var(--ft-btn-dur) var(--ft-ease),
                transform var(--ft-btn-dur) var(--ft-ease) !important;
    will-change: transform;
}
.btn:hover, .btn:focus-visible,
.hero-enquiry:hover, .hero-enquiry:focus-visible,
.read-more:hover, .read-more:focus-visible,
.usp-cta-btn:hover, .usp-cta-btn:focus-visible, .usp-cta-tile:hover .usp-cta-btn,
.cpd-submit-btn:hover, .cpd-submit-btn:focus-visible,
.submit-btn:hover, .submit-btn:focus-visible,
.btn1:hover, .btn1:focus-visible,
.enquiry-box button:hover, .enquiry-box button:focus-visible {
    transform: translateY(-2px) !important;
    box-shadow: 0 8px 18px rgba(18, 20, 23, 0.20) !important;
}
.hero-foot .hero-enquiry:hover, .hero-foot .hero-enquiry:focus-visible {
    box-shadow: 0 10px 24px rgba(211, 47, 47, 0.45) !important;
}
/* Pills: chips, tabs and the search button lift slightly less */
.filter-chip:hover, .filter-chip:focus-visible,
.enquiry-type-tab:hover, .enquiry-type-tab:focus-visible,
.site-search-toggle:hover, .site-search-toggle:focus-visible {
    transform: translateY(-1px) !important;
    box-shadow: 0 4px 10px rgba(18, 20, 23, 0.14) !important;
}
/* Pressed */
.btn:active, .hero-enquiry:active, .read-more:active, .usp-cta-btn:active, .usp-cta-tile:hover .usp-cta-btn:active,
.usp-cta-tile:active .usp-cta-btn, .cpd-submit-btn:active,
.submit-btn:active, .btn1:active, .enquiry-box button:active,
.filter-chip:active, .enquiry-type-tab:active, .site-search-toggle:active {
    transform: translateY(0) scale(0.98) !important;
    box-shadow: 0 2px 5px rgba(18, 20, 23, 0.18) !important;
    transition-duration: var(--ft-btn-press) !important;
}
/* Arrow icons slide forward on hover */
.hero-enquiry svg { transition: transform var(--ft-btn-dur) var(--ft-ease), color var(--ft-btn-dur) var(--ft-ease) !important; }
.hero-enquiry:hover svg, .hero-enquiry:focus-visible svg { transform: translateX(5px) !important; }
.site-search-toggle svg { transition: transform var(--ft-btn-dur) var(--ft-ease) !important; }
.site-search-toggle:hover svg, .site-search-toggle:focus-visible svg { transform: scale(1.12) !important; }

/* Social icons in the footer */
.social-icon { transition: transform var(--ft-btn-dur) var(--ft-ease), opacity var(--ft-btn-dur) var(--ft-ease) !important; }
.social-icon:hover, .social-icon:focus-visible { transform: translateY(-3px) !important; }
.social-icon:active { transform: translateY(0) scale(0.95) !important; transition-duration: var(--ft-btn-press) !important; }

/* Text links: smooth colour change */
nav a, .dropdown li a, .footer-col a:not(.social-icon), .hq-box a, .contact-bar a,
.delivery-box a.phone-link, .services-box li a, .cpd-info a, .site-search-results li a {
    transition: color var(--ft-btn-dur) var(--ft-ease), background-color var(--ft-btn-dur) var(--ft-ease) !important;
}

/* Red buttons that had no hover state follow the site's existing convention (red -> black) */
.btn1-primary1:hover, button.btn1:hover { background-color: var(--ft-ink); }

/* ---------- 7. Keyboard focus (visible only when using the keyboard) ---------- */
a:focus-visible, button:focus-visible, summary:focus-visible,
[tabindex]:focus-visible, select:focus-visible {
    outline: var(--ft-focus-outline);
    outline-offset: 2px;
}
/* On dark or red backgrounds the ring is white so it stays visible */
footer a:focus-visible, footer button:focus-visible,
.contact-bar a:focus-visible, .hq-box a:focus-visible, .services-box a:focus-visible,
.form-box a:focus-visible, .form-box button:focus-visible, .delivery-box a:focus-visible,
.hero a:focus-visible, .hero button:focus-visible, .quickfacts-strip a:focus-visible,
.btn1-primary1:focus-visible, .submit-btn:focus-visible, .usp-cta-btn:focus-visible,
.cpd-submit-btn:focus-visible, .enquiry-box button:focus-visible {
    outline: var(--ft-focus-outline-on-dark);
    outline-offset: 2px;
    box-shadow: 0 0 0 4px rgba(211, 47, 47, 0.55);
}

/* ---------- 8. Form fields ---------- */
input:not([type="checkbox"]):not([type="radio"]):not([type="submit"]):not([type="button"]),
textarea, select {
    transition: border-color var(--ft-dur-fast) var(--ft-ease), box-shadow var(--ft-dur-fast) var(--ft-ease), background-color var(--ft-dur-fast) var(--ft-ease);
}
/* Light fields: edge darkened to meet 3:1 (was #ccc / #ddd) */
.enquiry-box input, .enquiry-box textarea,
.cpd-form-box input, .cpd-form-box textarea, .cpd-form-box select,
.contact-form-inner .form-control, .form-box input, .form-box textarea {
    border-color: var(--ft-field-border);
}
.enquiry-box input:hover, .enquiry-box textarea:hover,
.cpd-form-box input:hover, .cpd-form-box textarea:hover, .cpd-form-box select:hover,
.contact-form-inner .form-control:hover, .form-box input:hover, .form-box textarea:hover {
    border-color: var(--ft-field-border-hover);
}
/* Clear focus for every field (several had outline: none and no replacement) */
input:not([type="checkbox"]):not([type="radio"]):focus,
textarea:focus, select:focus, .form-control:focus {
    outline: none;
    border-color: var(--ft-red);
    box-shadow: var(--ft-focus);
}
.site-search-input:focus, .site-search-inner input:focus { box-shadow: none; }
.site-search-inner:focus-within { box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3), var(--ft-focus); }
.newsletter-form input:focus { border-color: #ffffff; box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.25); }
input[type="checkbox"]:focus-visible, input[type="radio"]:focus-visible {
    outline: var(--ft-focus-outline); outline-offset: 2px;
}

/* ---------- 9. Links inside text: clearer hover ---------- */
.main-content p a, .about-main p a, .cpd-info a, .hq-box a, .services-box li a {
    text-underline-offset: 2px;
    text-decoration-thickness: 1px;
}

/* ---------- 10. Reduced-motion preference ----------
   Page animations (homepage photo rows, logo strip, slideshows) behave exactly as on
   the original site, which already has its own reduce-motion rules where needed.
   Only the card lifts added by this file are switched off for visitors who ask for less motion. */
@media (prefers-reduced-motion: reduce) {
    .app-card:hover, .usp-card:hover, .usp-cta-tile:hover, .gallery-item:hover { transform: none !important; }
}

/* =====================================================================
   PART 2 - Consistent type scale and spacing
   (text sizes and small spacing adjustments; no text, image or order changes)
   ===================================================================== */
:root {
    /* Type scale */
    --ft-fs-xs: 12.5px;    /* form labels, table headers, small caps */
    --ft-fs-sm: 14.5px;    /* cards, sidebars, captions under headings */
    --ft-fs-caption: 13.5px; /* diagram captions, table cells, stat labels */
    --ft-fs-base: 16px;    /* main reading text and lists */
    --ft-fs-h4: 16px;
    --ft-fs-h3-card: 18px; /* headings inside cards, boxes and sidebars */
    --ft-fs-h3: 19px;      /* sub-headings in the main text */
    --ft-fs-h2-box: 19px;  /* headings of boxed sections */
    --ft-fs-h2: 26px;      /* section headings */
    --ft-fs-h1: clamp(30px, 1.6vw + 18px, 40px); /* page banner titles */

    /* Line heights */
    --ft-lh-tight: 1.2;
    --ft-lh-heading: 1.3;
    --ft-lh-body: 1.7;
    --ft-lh-compact: 1.6;

    /* Spacing scale */
    --ft-space-1: 4px;
    --ft-space-2: 8px;
    --ft-space-3: 12px;
    --ft-space-4: 16px;
    --ft-space-5: 24px;
    --ft-space-6: 32px;
}

/* ---------- Page banner titles ---------- */
.hero-text h1 { font-size: var(--ft-fs-h1); line-height: 1.15; }
.hero-text p { font-size: var(--ft-fs-base); line-height: var(--ft-lh-body); }
@media (max-width: 767px) {
    .hero-text h1 { font-size: 27px; }
    .hero-text p { font-size: 15px; line-height: var(--ft-lh-compact); }
}

/* ---------- Section headings ---------- */
.main-content > h2, .about-main h2, .wrap h2, .section-intro h2,
.classification-inner h2, .contact-form-inner h2, .compliance-banner h2, .supply-section h2 {
    font-size: var(--ft-fs-h2);
    line-height: var(--ft-lh-tight);
    margin-bottom: var(--ft-space-4);
}
/* Headings of boxed sections (Projects page boxes, Smoke Control boxes) stay a step smaller */
.project-group-heading, .map-section h2, .supply-section h2,
.section-intro:has(+ .map-section) h2 {
    font-size: var(--ft-fs-h2-box);
    line-height: var(--ft-lh-heading);
    margin-bottom: var(--ft-space-4);
}
@media (max-width: 767px) {
    .main-content > h2, .about-main h2, .wrap h2, .section-intro h2,
    .classification-inner h2, .contact-form-inner h2, .compliance-banner h2 { font-size: 22px; }
    .project-group-heading, .map-section h2, .supply-section h2,
    .section-intro:has(+ .map-section) h2 { font-size: 17px; }
}

/* ---------- Sub-headings ---------- */
.main-content > h3, .smoke-type > h3, .smoke-types h3 {
    font-size: var(--ft-fs-h3);
    line-height: var(--ft-lh-heading);
    margin-bottom: var(--ft-space-3);
}
.main-content > h3:not(:first-child) { margin-top: var(--ft-space-6); }
.usp-card h3, .feature-icon-item h3, .highlight-card h3, .cpd-info h3, .cpd-form-box h3,
.enquiry-box h3, .app-card-content h3 {
    font-size: var(--ft-fs-h3-card);
    line-height: var(--ft-lh-heading);
}
.sidebar h3, .sidebar-panel h3, .hq-box h3, .services-box h3, .delivery-box h3 {
    font-size: 17px;
    line-height: var(--ft-lh-heading);
}
.def-card h4 { font-size: var(--ft-fs-h4); line-height: var(--ft-lh-heading); }

/* ---------- Main reading text ---------- */
.main-content p, .about-main p, .smoke-text p, .supply-section p, .section-intro p,
.compliance-banner p, .contact-form-inner p, .classification-inner > p,
.wrap.intro-section p, .map-section > p {
    font-size: var(--ft-fs-base);
    line-height: var(--ft-lh-body);
    margin-bottom: var(--ft-space-4);
}
.main-content li, .supply-section li, .checklist li {
    font-size: var(--ft-fs-base);
    line-height: var(--ft-lh-compact);
    margin-bottom: var(--ft-space-2);
}
.main-content p:last-child, .smoke-text p:last-child, .section-intro:has(+ .map-section) p:last-child,
.compliance-banner p:last-child, .supply-section p:last-child { margin-bottom: 0; }

/* Unboxed section intros (e.g. "Our USPs") keep clear space before the cards below */
.section-intro:not(:has(+ .map-section)) > p:last-child { margin-bottom: var(--ft-space-5); }

/* ---------- Cards, sidebars and boxes ---------- */
.usp-card p, .app-card-content p, .highlight-card p, .feature-icon-item p,
.sidebar p, .sidebar li, .sidebar-panel p, .sidebar-panel li, .cpd-info p, .cpd-info li,
.hq-box p, .services-box p, .services-box li, .def-card p {
    font-size: var(--ft-fs-sm);
    line-height: var(--ft-lh-compact);
}
.sidebar li, .sidebar-panel li, .cpd-info li { margin-bottom: var(--ft-space-3); }

/* ---------- Captions, tables and labels ---------- */
.content-diagram p, .highlight-card .stat-label, .project-location { font-size: var(--ft-fs-caption); line-height: 1.5; }
.classification-table td { font-size: 14px; line-height: 1.5; }
.classification-table th { font-size: var(--ft-fs-xs); }
.enquiry-box label, .form-field label, .form-group label, .cpd-form-box label { font-size: var(--ft-fs-xs); }
.checkbox-group label { font-size: 14px; }

/* Test & Accreditation timeline: same steps as the rest of the scale */
.timeline-year { font-size: var(--ft-fs-base); line-height: var(--ft-lh-heading); }
.timeline-desc { font-size: var(--ft-fs-sm); line-height: var(--ft-lh-compact); color: var(--ft-text-muted); }
.timeline-item { margin-bottom: var(--ft-space-4); }

/* Justified text leaves large word gaps on narrow screens - align left there instead */
@media (max-width: 767px) {
    .about-main p { text-align: left; }
}

/* =====================================================================
   PART 3 - Homepage top section: compact phone layout (phones only, under 768px wide).
   Desktop and tablet are not affected.
   ===================================================================== */
@media (max-width: 767px) {
    /* Title card: tighter padding and a slightly smaller title */
    #heroSection .hero-card { padding: 22px 20px 20px; }
    #heroSection .hero-card h1 { font-size: 25px; line-height: 1.2; }
    #heroSection .hero-card .hero-h1-sub { margin-top: 0.7em; padding-top: 0.75em; }

    /* Licence badge and Quick Enquiry button side by side on one row */
    #heroSection .hero-foot {
        --foot-h: 42px;
        flex-wrap: wrap;
        align-items: flex-end;
        justify-content: space-between;
        gap: 10px;
        margin-top: 16px;
        padding-top: 14px;
    }
    #heroSection .hero-foot .hero-h1-brand.hero-brand-logo { gap: 6px; min-width: 0; }
    #heroSection .hero-foot .hero-brand-licence { font-size: 9.5px; letter-spacing: 0.14em; }
    #heroSection .hero-foot .hero-brand-badge { height: var(--foot-h); padding: 0 8px; }
    #heroSection .hero-foot .hero-brand-badge img { height: calc(var(--foot-h) - 16px); }
    #heroSection .hero-foot .hero-enquiry {
        height: var(--foot-h);
        padding: 0 14px;
        flex: 1 0 auto;
        justify-content: center;
        font-size: 12.5px;
        letter-spacing: 0.05em;
        gap: 6px;
        white-space: nowrap;
    }

    /* Project photos: one drifting row instead of two */
    #heroSection .work-row--2 { display: none; }
    #heroSection .work-rows { padding-bottom: 0; }
    #heroSection .work-row { height: 150px; }
}
/* Smaller phones (under 375px): a little less padding so the badge and button still share a row;
   on anything narrower still, the button drops onto its own full-width line */
@media (min-width: 480px) and (max-width: 767px) {
    #heroSection .hero-foot .hero-enquiry { flex: 0 0 auto; padding: 0 22px; }   /* larger phones: normal-width button */
}
@media (max-width: 374px) {
    #heroSection .hero-card { padding: 20px 16px 18px; }
    #heroSection .hero-foot .hero-enquiry { padding: 0 12px; letter-spacing: 0.03em; }
}

/* ---------- Applications drop-down: matches the site's squarer style and stands clear of the red banner ----------
   Square top where it hangs from the red line under the menu, small rounded bottom corners like the buttons,
   a fine grey edge and a deeper shadow so the white panel doesn't blur into the red page header below it. */
ul.dropdown {
    border-radius: 0 0 var(--ft-radius-sm) var(--ft-radius-sm);
    border: 1px solid #dcdfe3;
    border-top: 3px solid var(--ft-red);
    box-shadow: 0 2px 4px rgba(18, 20, 23, 0.10), 0 14px 32px rgba(18, 20, 23, 0.28);
    overflow: hidden;
}
ul.dropdown li:last-child a { border-bottom: 0; }
