/* R&R Services - global styles
   Palette: Dark Spruce main color, Soft Linen backgrounds, Sand Dune surfaces,
   with Dark Amaranth and Faded Copper as small accents. */

:root {
    --color-spruce: #2e4a2f;
    --color-spruce-dark: #243b25;
    /* --color-amaranth: #650513; */
    --color-amaranth: #594b40;
    --color-copper: #a67852;
    /* Copper darkened for use as a panel fill: --color-copper with light
       text is only 3.4:1 (fails AA), this is ~4.9:1. Never used for text. */
    --color-copper-deep: #243b25;
    --color-sand: #e8ddc9;
    --color-linen: #f5f0e6;
    --color-ink: #1c261f;
    --color-white: #ffffff;
    --color-border: #e8ddc9;

    --font-body: system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
    --content-width: 70rem;
}

/* Reset */
*,
*::before,
*::after {
    box-sizing: border-box;
}

body,
h1,
h2,
h3,
p,
ul,
figure {
    margin: 0;
}

ul {
    padding: 0;
    list-style: none;
}

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

a {
    color: var(--color-spruce);
}

/* Base typography */
body {
    background-color: var(--color-linen);
    color: var(--color-ink);
    font-family: var(--font-body);
    font-size: 1rem;
    line-height: 1.6;
}

/* Faint leaf line-art behind all page content, washed with translucent
   Soft Linen (--color-linen). Header, hero, and footer paint over it,
   so it shows only below the header and hero. The layer is oversized and
   blurred so the leaf lines stay soft and the blur fade stays off-screen. */
body::before {
    content: "";
    position: fixed;
    inset: -1rem;
    z-index: -1;
    pointer-events: none;
    background-image:
        linear-gradient(rgba(245, 240, 230, 0.92), rgba(245, 240, 230, 0.92)),
        url("../images/leafs.png");
    background-repeat: no-repeat;
    background-position: center;
    background-size: cover;
    filter: blur(6px);
}

h1,
h2,
h3 {
    line-height: 1.2;
    color: var(--color-spruce);
}

h1 {
    font-size: clamp(1.9rem, 4vw + 1rem, 3rem);
}

h2 {
    font-size: clamp(1.5rem, 2vw + 1rem, 2.25rem);
}

h3 {
    font-size: 1.25rem;
}

p + p {
    margin-top: 1rem;
}

.container {
    width: min(100% - 2rem, var(--content-width));
    margin-inline: auto;
    /* Bootstrap (gallery page only) adds gutter padding to .container;
       the site manages its own gutters via the width above. */
    padding-inline: 0;
}

/* Header */
.site-header {
    background-color: var(--color-spruce);
    color: var(--color-linen);
    padding-block: 0.9rem;
}

.header-inner {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 1rem 1.5rem;
}

.brand {
    display: inline-flex;
    align-items: center;
    text-decoration: none;
}

.brand-logo {
    width: auto;
    height: 4.5rem;
    max-width: 100%;
}

.header-right {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-end;
    gap: 1rem 1.75rem;
    margin-left: auto;
}

.site-nav ul {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.25rem 1.5rem;
}

.site-nav a {
    display: inline-block;
    padding-block: 0.5rem;
    color: var(--color-linen);
    font-size: 1.1rem;
    font-weight: 500;
    text-decoration: none;
}

.site-nav a:hover,
.site-nav a:focus {
    text-decoration: underline;
}

.site-nav a:focus-visible {
    border-radius: 2px;
    outline: 3px solid var(--color-linen);
    outline-offset: 2px;
}

.header-actions {
    display: flex;
    flex-shrink: 0;
    align-items: center;
    gap: 0.6rem;
}

.header-actions .button {
    min-height: 2.75rem;
    padding: 0.6rem 1.1rem;
    font-size: 0.95rem;
    white-space: nowrap;
}

.header-actions .button--primary {
    border-color: var(--color-linen);
    background-color: var(--color-linen);
    color: var(--color-spruce);
}

.header-actions .button--primary:hover,
.header-actions .button--primary:focus {
    border-color: var(--color-white);
    background-color: var(--color-white);
}

.header-actions .button--secondary {
    border-color: var(--color-linen);
    background-color: transparent;
    color: var(--color-linen);
}

.header-actions .button--secondary:hover,
.header-actions .button--secondary:focus {
    border-color: var(--color-linen);
    background-color: var(--color-linen);
    color: var(--color-spruce);
}

.header-actions .button:focus-visible {
    outline: 3px solid var(--color-linen);
    outline-offset: 3px;
}

/* Hero */
.hero-home {
    position: relative;
    display: grid;
    place-items: center;
    /* Fill the first viewport below the header. --header-height is set by
       js/hero-height.js; the fallback keeps the layout sane without JS. */
    min-height: max(20rem, calc(100svh - var(--header-height, 6.5rem)));
    margin-block-end: 2rem;
    /* The inline --hero-photo override comes from the hosted photo when one is
       imported; the static file stays as the offline fallback. */
    background-image: var(--hero-photo, url("../images/scenic_photo.png"));
    background-position: center;
    background-size: cover;
    isolation: isolate;
}

/* Translucent dark layer keeps the photo visible while white text stays readable. */
.hero-home::before {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 0;
    background-color: rgba(52, 51, 51, 0.6);
}

.hero-content {
    position: relative;
    z-index: 1;
    padding-block: 3rem;
    text-align: center;
}

.hero-title {
    color: var(--color-white);
    font-family: Georgia, "Times New Roman", serif;
    font-size: clamp(2rem, 6vw + 0.5rem, 4.25rem);
    font-weight: 600;
    letter-spacing: 0.01em;
    line-height: 1.1;
    text-shadow: 0 2px 18px rgba(0, 0, 0, 0.35);
}

/* Main content */
main {
    padding-block: 2rem;
}

/* The home hero sits directly under the header, edge to edge. */
.home-main {
    padding-top: 0;
}

/* Footer */
.site-footer {
    margin-top: 3rem;
    padding-block: 1.75rem;
    background-color: var(--color-spruce);
    color: var(--color-linen);
}

.footer-inner {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem 1.5rem;
}

.footer-brand {
    font-weight: 700;
}

.footer-contact {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem 1.25rem;
}

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

/* Buttons */
.button {
    display: inline-block;
    min-height: 2.75rem;
    padding: 0.65rem 1.4rem;
    border: 2px solid var(--color-spruce);
    border-radius: 0.35rem;
    background-color: var(--color-spruce);
    color: var(--color-white);
    font-weight: 600;
    text-align: center;
    text-decoration: none;
}

.button:hover,
.button:focus {
    background-color: var(--color-spruce-dark);
    border-color: var(--color-spruce-dark);
}

/* Keyboard users can jump straight to the page content */
.skip-link {
    position: absolute;
    left: -9999px;
    padding: 0.75rem 1rem;
    background-color: var(--color-linen);
    color: var(--color-spruce);
}

.skip-link:focus {
    left: 1rem;
    top: 1rem;
    z-index: 10;
}

/* Gallery */
/* Service tiles that open a Bootstrap modal carousel. */
.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(18rem, 1fr));
    gap: 1rem;
    margin-block: 1.5rem;
}

.gallery-tile {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    width: 100%;
    padding: 0;
    border: 1px solid var(--color-border);
    border-radius: 0.5rem;
    background-color: var(--color-white);
    font: inherit;
    text-align: left;
    cursor: pointer;
    overflow: hidden;
}

.gallery-tile:hover {
    border-color: var(--color-spruce);
}

.gallery-tile:focus-visible {
    outline: 3px solid var(--color-amaranth);
    outline-offset: 2px;
}

.gallery-tile img {
    width: 100%;
    aspect-ratio: 4 / 3;
    object-fit: cover;
}

.gallery-tile__name {
    padding: 0 0.9rem;
    font-weight: 700;
    color: var(--color-spruce);
}

.gallery-tile__count {
    padding: 0 0.9rem 0.8rem;
    font-size: 0.9rem;
    color: var(--color-ink);
}

/* Gallery modal carousel */
.modal-content {
    border-radius: 0.5rem;
}

/* Dark Spruce title bar with Soft Linen text (contrast well above AA) */
.modal-header {
    background-color: var(--color-spruce);
    color: var(--color-linen);
    border-bottom: none;
}

.modal-header .modal-title {
    color: var(--color-linen);
    font-size: 1.25rem;
}

/* White close icon on the dark title bar */
.modal-header .btn-close {
    filter: invert(1);
}

/* Square-ish photo stage; the SVG placeholders are 4:3. max-height keeps the
   popup inside the viewport on shorter desktop screens. */
.carousel-item img {
    aspect-ratio: 4 / 3;
    max-height: 65vh;
    object-fit: cover;
    background-color: var(--color-sand);
}

/* Controls must stay visible over the light placeholder images */
.carousel-control-prev-icon,
.carousel-control-next-icon {
    background-color: rgba(46, 74, 47, 0.85); /* Dark Spruce disc behind the arrow */
    border-radius: 50%;
    padding: 1rem;
}

/* Page sections */
section.container {
    margin-block-end: 2rem;
}

.hero p,
.quote-cta p {
    margin-top: 0.75rem;
}

.hero .button,
.quote-cta .button {
    margin-top: 0.75rem;
}

/* Services */
.service-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(18rem, 1fr));
    gap: 1rem;
    margin-block: 1.5rem;
}

.service-card {
    padding: 1.25rem;
    border: 1px solid var(--color-border);
    border-radius: 0.5rem;
    background-color: var(--color-white);
}

.service-card h2,
.service-card h3 {
    margin-bottom: 0.5rem;
}

.service-card img {
    margin-bottom: 0.75rem;
    border-radius: 0.35rem;
}

/* Home service categories */
.services-intro {
    margin-block-end: 4rem;
}

/* Heading and intro sit beside a placeholder image on wide screens and
   stack above it on phones. */
.services-intro-inner {
    margin-top: 8rem;
    margin-bottom: 4rem;
    display: grid;
    /* align-items: center; */
    gap: 1.5rem;
}

.services-intro-copy p {
    max-width: 46rem;
    margin-top: 0.6rem;
    font-size: 1.15rem;
}

/* Full-bleed photo band behind the overview cards: pool.png washed with
   translucent Dark Spruce so white card text stays readable on top. */
.service-overview-band {
    margin-block: 1.5rem 0;
    padding-block: clamp(2rem, 6vw, 3rem);
    background-image:
        /* linear-gradient(rgba(46, 74, 47, 0.75), rgba(46, 74, 47, 0.75)), */
        linear-gradient(rgba(46, 74, 47, 0.75), rgba(46, 74, 47, 0.75)),
        var(--band-photo, url("../images/pool.png"));
    background-position: center;
    background-size: cover;
    background-repeat: no-repeat;
}

.service-overview-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr));
    gap: 1.25rem;
}

.overview-card {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.25rem;
    padding: 1.75rem 1.5rem;
    border: 1px solid rgba(245, 240, 230, 0.7);
    transition: background-color 0.18s ease, border-color 0.18s ease;
}

/* Highlight the whole card on hover and keyboard focus. A translucent
   linen fill lifts the card off the dark photo band without hiding it. */
.overview-card:hover,
.overview-card:focus-within {
    border-color: var(--color-linen);
    background-color: rgba(245, 240, 230, 0.15);
}

.overview-card h3 {
    color: var(--color-white);
}

/* Linen button (same convention as the header's primary button) so it
   stands out on the dark band; a Dark Spruce button would blend into it. */
.overview-card .button {
    margin-top: auto;
    border-color: var(--color-linen);
    background-color: var(--color-linen);
    color: var(--color-spruce);
}

/* Stretch the Learn More link over the entire card so a click anywhere in
   the box follows the same in-page anchor. The link keeps its own focus ring. */
.overview-card .button::after {
    content: "";
    position: absolute;
    inset: 0;
}

.overview-card .button:hover,
.overview-card .button:focus {
    border-color: var(--color-white);
    background-color: var(--color-white);
}

.overview-card .button:focus-visible {
    outline: 3px solid var(--color-linen);
    outline-offset: 3px;
}

.service-detail {
    display: grid;
    align-items: center;
    gap: 1.5rem;
}

/* Solid accent panel behind each service detail's title, copy, and list.
   The reversed sections take copper so the two accents alternate down
   the page (amaranth, copper, amaranth, copper). */
.service-detail-copy {
    padding: clamp(1.25rem, 3vw, 2rem);
    border-radius: 1.2rem;
    background-color: var(--color-amaranth);
    color: var(--color-linen);
}

.service-detail--reverse .service-detail-copy {
    background-color: var(--color-copper-deep);
}

.service-detail-copy h2 {
    color: var(--color-linen);
}

.service-detail-copy > p {
    margin-top: 0.6rem;
}

.service-items {
    margin-top: 1rem;
    padding-left: 1.25rem;
    list-style: disc;
}

.service-items li {
    margin-block: 0.3rem;
}

.service-media {
    margin: 0;
}

.service-media img {
    width: 100%;
    aspect-ratio: 4 / 3;
    object-fit: cover;
    border: 1px solid var(--color-border);
    border-radius: 0.5rem;
    background-color: var(--color-sand);
}

.service-cta {
    padding: 2rem;
    border: 1px solid var(--color-border);
    border-radius: 0.6rem;
    background-color: var(--color-sand);
}

.service-cta p {
    margin-top: 0.5rem;
}

.service-cta .button {
    margin-top: 1rem;
}

/* Why choose us and testimonials */
.why-us ul,
.contact-details ul {
    margin-top: 0.75rem;
}

.why-us li,
.contact-details li {
    margin-block: 0.35rem;
}

.testimonial-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(20rem, 1fr));
    gap: 1rem;
    margin-top: 1rem;
}

.testimonial-list blockquote {
    height: 100%;
    padding: 1.25rem;
    border: 1px solid var(--color-border);
    border-left: 4px solid var(--color-copper);
    border-radius: 0.5rem;
    background-color: var(--color-white);
}

.testimonial-list footer {
    margin-top: 0.75rem;
    font-size: 0.95rem;
}

/* Quote form */
.contact-layout {
    display: grid;
    gap: 2rem;
    margin-top: 1.5rem;
}

.quote-form {
    max-width: 40rem;
}

.form-field {
    margin-bottom: 1rem;
}

.form-field label {
    display: block;
    margin-bottom: 0.3rem;
    font-weight: 600;
}

.form-field input,
.form-field select,
.form-field textarea {
    width: 100%;
    max-width: 100%;
    padding: 0.65rem 0.75rem;
    border: 1px solid var(--color-copper);
    border-radius: 0.35rem;
    background-color: var(--color-white);
    color: var(--color-ink);
    font: inherit;
}

.form-field textarea {
    resize: vertical;
}

.form-field input:focus,
.form-field select:focus,
.form-field textarea:focus {
    outline: 3px solid var(--color-amaranth);
    outline-offset: 1px;
}

.required {
    color: var(--color-amaranth);
}

.help-text,
.form-note {
    margin-top: 0.35rem;
    font-size: 0.9rem;
}

.field-error {
    margin-top: 0.35rem;
    color: var(--color-amaranth);
    font-weight: 600;
}

.quote-form .button {
    margin-top: 0.5rem;
}

/* Success and error messages */
.messages ul {
    margin-block: 1rem;
}

.message {
    padding: 0.85rem 1rem;
    border: 1px solid var(--color-border);
    border-left: 4px solid var(--color-copper);
    border-radius: 0.35rem;
    background-color: var(--color-white);
}

/* Error messages use the amaranth accent instead of copper. */
.message.error {
    border-left-color: var(--color-amaranth);
}

/* Medium and large screens */
@media (min-width: 850px) {
    .services-intro-inner {
        grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr);
        gap: 2rem;
    }

    .service-detail {
        grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr);
        gap: 0;
    }

    /* Copy panel and image cross the column seam: the columns sit flush and
       each item reaches 1.5rem across it, so a ~3rem band is shared by both.
       z-index picks the winner in that band, letting the shorter element sit
       on top of the other (see service_detail_ref.png). Margins are applied
       regardless of z-index, so flipping the order never changes any height. */
    .service-detail .service-detail-copy {
        position: relative;
        z-index: 2;
        margin-inline-end: -1.5rem;
    }

    .service-detail .service-media {
        position: relative;
        z-index: 1;
        margin-inline-start: -1.5rem;
    }

    /* In reversed sections the seam is on the copy's inline-start side. */
    .service-detail.service-detail--reverse .service-detail-copy {
        margin-inline-end: 0;
        margin-inline-start: -1.5rem;
    }

    .service-detail.service-detail--reverse .service-media {
        margin-inline-start: 0;
        margin-inline-end: -1.5rem;
    }

    /* Sections whose image is the shorter element flip the stacking order. */
    .service-detail.service-detail--media-top .service-media {
        z-index: 2;
    }

    .service-detail.service-detail--media-top .service-detail-copy {
        z-index: 1;
    }

    /* Keep the copy clear of the shared band: an image sitting on top would
       otherwise cover the tail of any line that runs into it. Only needed
       where the image wins the stacking, and only on the seam side. */
    .service-detail.service-detail--media-top .service-detail-copy {
        padding-inline-end: 3.5rem;
    }

    .service-detail.service-detail--media-top.service-detail--reverse .service-detail-copy {
        padding-inline-end: clamp(1.25rem, 3vw, 2rem);
        padding-inline-start: 3.5rem;
    }

    .service-detail--reverse .service-detail-copy {
        order: 2;
    }

    .service-detail--reverse .service-media {
        order: 1;
    }
}

@media (min-width: 900px) {
    .contact-layout {
        grid-template-columns: minmax(0, 1fr) minmax(0, 2fr);
        align-items: start;
    }
}

/* Tablet and narrow desktop header */
@media (max-width: 900px) {
    .header-inner {
        flex-direction: column;
        align-items: flex-start;
    }

    .header-right {
        width: 100%;
        flex-direction: column;
        align-items: stretch;
        gap: 0.75rem;
        margin-left: 0;
    }

    .site-nav {
        width: 100%;
    }

    .site-nav ul {
        flex-direction: column;
        align-items: stretch;
        gap: 0;
        width: 100%;
    }

    .site-nav a {
        display: block;
        padding-block: 0.7rem;
        border-top: 1px solid rgba(245, 240, 230, 0.25);
    }

    .header-actions {
        width: 100%;
        flex-direction: column;
        align-items: stretch;
    }

    .header-actions .button {
        width: 100%;
        max-width: none;
    }

    .brand-logo {
        height: 3.75rem;
    }

    /* Matches the stacked header height so the hero does not jump before
       js/hero-height.js measures the real header. */
    .hero-home {
        min-height: max(20rem, calc(100svh - var(--header-height, 23.5rem)));
    }
}

/* Small screens */
@media (max-width: 600px) {
    .footer-inner {
        flex-direction: column;
        align-items: flex-start;
    }

    .button {
        width: 100%;
        max-width: 22rem;
    }

    .hero-content {
        padding-block: 2.5rem;
    }
}

