/* ==========================================================================
   BSTC — Building Systems Trading & Contracting
   ========================================================================== */

:root {
    /* Brand colours (from the logo) */
    --navy: #243459;
    --cyan: #00cfe5;
    --cyan-light: #8feef8;

    /* Neutrals */
    --text: hsl(0, 0%, 10%);
    --text-muted: hsl(0, 0%, 35%);
    --bg: hsl(0, 0%, 100%);
    --bg-soft: hsl(0, 0%, 95%);
    --bg-pill: hsl(0, 0%, 90%);

    /* Layout */
    --maxwidth: 1024px;
    --gutter: 20px;
    --section-gap: clamp(40px, 8vw, 80px);
    --rounding: 10px;
    --buttonrounding: 100px;

    /* Effects */
    --gallery-shrink: 0.95;   /* projects gallery photos on hover and in the moving hint (1 = no shrink) */

    --font: 'Montserrat', Arial, sans-serif;
}

/* ---------- Reset ---------- */

*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    scroll-behavior: smooth;
    /* Stops double-tap zooming on phones (pinch zoom still works) */
    touch-action: manipulation;
}

/* Page is always at least the full window height, so the footer sits at
   the bottom even when the content is short (or the page is zoomed out) */
body {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    min-height: 100dvh;
    font-family: var(--font);
    line-height: 1.6;
    color: var(--text);
    background-color: var(--bg);
}

main {
    flex-grow: 1;
}

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

a {
    color: inherit;
    text-decoration: none;
}

/* Visible keyboard focus everywhere */
:focus-visible {
    outline: 2px solid var(--cyan);
    outline-offset: 3px;
}

/* Lets keyboard users jump past the nav */
.skip-link {
    position: absolute;
    left: var(--gutter);
    top: -100px;
    padding: 10px 20px;
    border-radius: var(--buttonrounding);
    background-color: var(--navy);
    color: white;
    z-index: 10;
}

.skip-link:focus {
    top: 10px;
}

.container {
    width: 100%;
    max-width: calc(var(--maxwidth) + 2 * var(--gutter));
    margin: 0 auto;
    padding: 0 var(--gutter);
}

/* ---------- Header & navigation ---------- */

.site-header {
    padding: clamp(24px, 6vw, 50px) var(--gutter) clamp(10px, 2vw, 20px);
    text-align: center;
}

/* Full-width white band that sits above the page content, so content
   pulled up by the rubber band (app.js) slides underneath the logo and
   project pills instead of over them (e.g. when zoomed far out) */
.site-header,
.nav-child {
    position: relative;
    z-index: 4;
    background-color: var(--bg);
    box-shadow: 0 0 0 100vmax var(--bg);
    /* Also reaches 40px up, to cover the gap below the sticky nav */
    clip-path: inset(-40px -100vmax 0);
}

/* The logo's band continues down behind the nav (50px tall), so no seam
   between the two can let content show through at odd zoom levels */
.site-header {
    clip-path: inset(-40px -100vmax -50px);
}

.logo {
    display: inline-block;
    transition: opacity 0.25s;
}

.logo:hover {
    opacity: 0.6;
}

.logo img {
    width: clamp(180px, 40vw, 250px);
}

/* Stays pinned to the top of the screen while scrolling */
.nav-main {
    position: sticky;
    top: 0;
    z-index: 5;
    margin-bottom: clamp(20px, 4vw, 40px);
    background-color: var(--bg);
    /* See-through frosted glass look, turned off for now:
    background-color: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(8px);
    */
}

/* Always one row: on narrow phones the text and padding shrink to fit */
.nav-main ul {
    display: flex;
    justify-content: center;
    list-style: none;
}

/* Wide padding = big clickable area, and the underline spans all of it */
.nav-main a {
    position: relative;
    display: block;
    padding: 0 clamp(8px, 4.5vw, 60px);
    font-weight: 500;
    font-size: min(0.9rem, 3.8vw);
    white-space: nowrap;
    text-transform: capitalize;
    line-height: 50px;
}

/* Underline that grows on hover / marks the current page */
.nav-main a::after {
    content: '';
    position: absolute;
    left: 0;
    bottom: 0;
    width: 100%;
    height: 1px;
    border-radius: var(--rounding);
    background-color: currentColor;
    transform: scaleX(0);
    transition: transform 0.3s ease;
}

.nav-main a:hover::after,
.nav-main a[aria-current="page"]::after {
    transform: scaleX(1);
}

/* Soft shadow fades in once the page scrolls (browsers without
   scroll-driven animations simply don't show it) */
@supports (animation-timeline: scroll()) {
    .nav-main {
        animation: nav-shadow linear both;
        animation-timeline: scroll();
        animation-range: 0 120px;
    }

    @keyframes nav-shadow {
        to { box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08); }
    }
}

/* Section links (projects page).
   Always one row: on narrow phones the text, padding and gaps shrink to fit */
.nav-child ul {
    display: flex;
    justify-content: center;
    /* Spacing grows with the screen (6px on small phones, up to 32px) */
    gap: clamp(6px, 3vw, 32px);
    list-style: none;
    padding-bottom: clamp(24px, 5vw, 50px);
}

.nav-child a {
    display: inline-block;
    min-width: 170px;
    padding: 0 24px;
    border-radius: var(--buttonrounding);
    background-color: var(--bg-pill);
    font-weight: 500;
    font-size: min(0.9rem, 3.4vw);
    white-space: nowrap;
    line-height: 40px;
    text-align: center;
    text-transform: capitalize;
    transition: background-color 0.3s;
}

.nav-child a:hover {
    background-color: var(--bg-soft);
}

/* ---------- Image frames ----------
   Crops a photo to fill its box, centred with flexbox.
   The photo fills the frame's width; if the frame is relatively taller than
   the photo, it fills the height instead. Container queries check the
   frame's own shape, so this keeps working as frames resize.
   Photos are tagged by shape: .landscape (3:2) or .portrait (2:3). */

.frame {
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
    container-type: size;
    border-radius: var(--rounding);
}

.frame img {
    flex: none;
    width: 100%;
    height: auto;
    max-width: none;
}

@container (max-aspect-ratio: 3 / 2) {
    .frame img.landscape {
        width: auto;
        height: 100%;
    }
}

@container (max-aspect-ratio: 2 / 3) {
    .frame img.portrait {
        width: auto;
        height: 100%;
    }
}

/* ---------- Hero ---------- */

.hero {
    position: relative;
    display: grid;
    place-items: center;
    min-height: clamp(320px, 55vw, 560px);
    padding: var(--gutter);
    border-radius: var(--rounding);
    background-color: var(--navy);
    color: white;
    text-align: center;
}

.hero-media {
    position: absolute;
    inset: 0;
}

/* Darken the photo so the text stays readable */
.hero::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    background-color: rgba(0, 0, 0, 0.45);
}

/* The whole frame grows slightly on hover (gallery photos shrink instead) */
.hero,
.split-image,
.team-photo,
.gallery a {
    transition: scale 0.2s ease;
}

/* Only on devices with a mouse or trackpad: on touch screens a tap would
   leave the image stuck in its hover state */
@media (hover: hover) and (pointer: fine) {
    .hero:hover,
    .split-image:hover,
    .team-photo:hover {
        scale: 1.025;
    }

    .gallery a:hover {
        scale: var(--gallery-shrink);
    }
}

.hero h1 {
    position: relative;
    z-index: 1;
}

/* Hero text, also used for the home page photo labels */
.hero h1,
.split-label {
    font-size: clamp(1.5rem, 4vw, 2rem);
    font-weight: 900;
    line-height: 1.3;
    text-transform: uppercase;
}

.hero--short {
    min-height: clamp(200px, 30vw, 320px);
}

/* Team page: shorter still, so the team's faces show sooner */
.hero--compact {
    min-height: clamp(130px, 18vw, 200px);
}

/* Every hero links to the next section on its page. Jumps to any section
   (hero links, project pills) stop just below the sticky nav (50px tall). */
main [id] {
    scroll-margin-top: 70px;
}

/* ---------- Content sections ---------- */

main > section {
    margin-top: var(--section-gap);
}

/* A page that starts with a section (no hero) sits just below the nav */
main > section:first-child {
    margin-top: 0;
}

.split {
    display: grid;
    grid-template-columns: 1fr 1fr;
    align-items: center;
    gap: clamp(30px, 5vw, 60px);
}

/* Swap image/text order on alternating rows (desktop only) */
.split--reverse .split-image {
    order: 2;
}

.split-image {
    aspect-ratio: 4 / 5;
}

/* Home page photos link to their page. On hover the photo darkens like
   the hero and a label fades in (mouse only; touch screens never show it) */
.split-link {
    position: relative;
}

.split-link::after {
    content: '';
    position: absolute;
    inset: 0;
    background-color: rgba(0, 0, 0, 0.45);
}

/* Text animation for hero headings and home page photo labels (app.js splits the text) */
.split-link,
.hero {
    --label-animate: letter;       /* word, letter or none (plain fade) */
    --label-rise: 0.6em;            /* how far each piece rises from */
    --label-in: 0.5s;               /* how long each piece takes to arrive */
    --label-out: 0.2s;              /* fade out when the mouse leaves (labels) */
    --label-stagger-word: 140ms;    /* delay between words */
    --label-stagger-letter: 30ms;   /* delay between letters */
    --label-ease: cubic-bezier(0.2, 0.7, 0.2, 1);   /* fast start, soft landing */
    --hero-delay: 0.25s;             /* heroes: wait this long after the photo loads */

    /* Phones and tablets (no hover): photo labels play on a loop while on screen */
    --label-cycle-on: 3s;           /* from starting to animate in, to fading out */
    --label-cycle-off: 1.5s;        /* hidden before the next play */
    --label-cycle-out: 0.6s;        /* text fade-out speed in the loop */
    --label-cycle-tint-out: 1.2s;   /* dark tint fade-out speed in the loop */
}

.split-label {
    position: absolute;
    inset: 0;
    z-index: 1;
    display: grid;
    place-items: center;
    padding: var(--gutter);
    color: white;
    text-align: center;
}

.split-link::after,
.split-label {
    opacity: 0;
    transition: opacity 0.3s;
}

/* Split into words or letters by app.js: the pieces animate instead of the whole label */
.split-label[data-split] {
    opacity: 1;
}

[data-split="word"] {
    --label-stagger: var(--label-stagger-word);
}

[data-split="letter"] {
    --label-stagger: var(--label-stagger-letter);
}

.label-word {
    display: inline-block;
    white-space: nowrap;
}

.label-piece {
    display: inline-block;
    opacity: 0;
    translate: 0 var(--label-rise);
    transition: opacity var(--label-out), translate var(--label-out);
}

/* While the hero or photo is on screen (is-layered, app.js section 10), each
   piece keeps its own graphics layer. Otherwise the browser drops the layer
   when the rise ends and redraws the text snapped to the pixel grid, a tiny
   "pop" into place. (Animating "top" instead avoids layers but moves in
   whole-pixel steps, which looks juddery.) */
.is-layered .label-piece {
    will-change: opacity, translate;
}

/* Touch screens: app.js adds .is-cycling, then turns .is-in on and off */
.split-link.is-cycling::after {
    transition-duration: var(--label-cycle-tint-out);
}

/* ...but the tint still fades in at the normal speed */
.split-link.is-cycling.is-in::after {
    transition-duration: 0.3s;
}

.split-link.is-cycling .split-label {
    transition-duration: var(--label-cycle-out);
}

/* Fading out, the text stays where it is (no drop back down); it only
   moves back to its starting spot once it's invisible */
.split-link.is-cycling .label-piece {
    transition: opacity var(--label-cycle-out), translate 0s var(--label-cycle-out);
}

.split-link.is-in::after,
.split-link.is-in .split-label {
    opacity: 1;
}

.split-link.is-in .label-piece {
    opacity: 1;
    translate: 0 0;
    transition-duration: var(--label-in);
    transition-timing-function: var(--label-ease);
    transition-delay: calc(var(--i) * var(--label-stagger));
}

@media (hover: hover) and (pointer: fine) {
    .split-link:hover::after,
    .split-link:hover .split-label {
        opacity: 1;
    }

    .split-link:hover .label-piece {
        opacity: 1;
        translate: 0 0;
        transition-duration: var(--label-in);
        transition-timing-function: var(--label-ease);
        transition-delay: calc(var(--i) * var(--label-stagger));
    }
}

/* Heroes: once the photo has loaded (app.js adds .is-in), the dark tint
   fades in and the heading plays, after --hero-delay. Only hidden while
   JavaScript is running (the "js" class on <html>), so the heading never
   goes missing without it. */
.js .hero::after,
.js .hero h1:not([data-split]) {
    opacity: 0;
    transition: opacity var(--label-in) var(--hero-delay);
}

.hero.is-in::after,
.hero.is-in h1 {
    opacity: 1;
}

.hero.is-in .label-piece {
    opacity: 1;
    translate: 0 0;
    transition-duration: var(--label-in);
    transition-timing-function: var(--label-ease);
    transition-delay: calc(var(--hero-delay) + var(--i) * var(--label-stagger));
}

h2 {
    font-size: clamp(1.4rem, 3vw, 1.75rem);
    line-height: 1.3;
    margin-bottom: 20px;
}

p {
    margin-bottom: 30px;
}

.section-intro {
    max-width: 65ch;
    color: var(--text-muted);
}

/* Links styled as buttons */
.button {
    display: inline-block;
    padding: 15px 30px;
    border: 0;
    border-radius: var(--rounding);
    font-family: inherit;
    cursor: pointer;
    background-color: var(--cyan);
    color: var(--navy);
    font-weight: 500;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    transition: background-color 0.4s, padding 0.4s, transform 0.15s;
}

/* Button stretches wider on hover */
.button:hover {
    padding: 15px 50px;
    background-color: var(--cyan-light);
}

.button:active {
    transform: scale(0.95);
}

/* ---------- Project galleries ---------- */

/* Justified rows (like Google Photos / 500px): photos in a row share a height,
   keep their full shape (no cropping) and the row stretches to fill the width.
   app.js plans the rows so every row is full and none gets too tall
   (--row-height is the target). The CSS below is the fallback without JS:
   each photo starts at the target row height and grows in proportion to its
   width-to-height ratio, which keeps heights equal within a row. */
.gallery {
    --row-height: 240px;
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    list-style: none;
}

.gallery li {
    --ratio: 1.5;   /* landscape 3:2 */
    flex-grow: var(--ratio);
    flex-basis: calc(var(--ratio) * var(--row-height));
}

.gallery li:has(img.portrait) {
    --ratio: 0.6667;   /* portrait 2:3 */
}

/* Invisible filler so the last row isn't stretched to full width
   (not needed once app.js has laid the rows out) */
.gallery::after {
    content: '';
    flex-grow: 1000;
}

.gallery.is-justified::after {
    display: none;
}

.gallery a,
.gallery img {
    display: block;
    width: 100%;
    border-radius: 5px;
}

/* "Click to enlarge" hints: zoom-in cursor, plus a light darkening and an
   expand icon that fade in on hover (mouse/trackpad) or keyboard focus */
.gallery a {
    position: relative;
    cursor: zoom-in;
}

.gallery a::before,
.gallery a::after {
    content: '';
    position: absolute;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
}

.gallery a::before {
    inset: 0;
    border-radius: inherit;
    background-color: rgba(0, 0, 0, 0.15);
}

.gallery a::after {
    top: 10px;
    right: 10px;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.55) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M15 3h6v6M9 21H3v-6M21 3l-7 7M3 21l7-7'/%3E%3C/svg%3E") center / 16px 16px no-repeat;
}

.gallery a:focus-visible::before,
.gallery a:focus-visible::after {
    opacity: 1;
}

@media (hover: hover) and (pointer: fine) {
    .gallery a:hover::before,
    .gallery a:hover::after {
        opacity: 1;
    }
}

/* Entrance (app.js section 8): photos start hidden and fade in one by one when
   their gallery first comes into view (0.8s each; the stagger is in app.js). */
.gallery a {
    transition: scale 0.2s ease, opacity 0.8s ease;
}

.gallery.will-reveal a:not(.is-revealed) {
    opacity: 0;
}

/* Same for heroes and home page photos while they're on screen (app.js adds
   is-layered): without it, the hover grow ends with the photo being redrawn
   snapped to the pixel grid, a visible jump at some in-between screen widths. */
.hero.is-layered,
.split-image.is-layered {
    will-change: scale;
}

/* While a gallery is on screen, keep its photos on their own graphics layer so
   hovering and the hint don't make them "pop". Only the visible gallery, to
   keep memory use down (this was too heavy on phones when applied everywhere). */
.gallery.is-layered a {
    will-change: scale;
}

/* Cycling hint (app.js): one photo per gallery at a time shows the icon and
   the hover shrink. The icon crossfades slowly from photo to photo ("hint-out"
   keeps the slow timing while it fades away). The 0.6s below is the only place
   the hint's fade speed is set; app.js reads it from here.
   The shrink uses the same quick 0.2s as a real mouse hover. */
.gallery a.is-hinting {
    scale: var(--gallery-shrink);
}

.gallery a.is-hinting::after {
    opacity: 1;
}

.gallery a.is-hinting::after,
.gallery a.hint-out::after {
    transition-duration: 0.25s;
}

/* Phones and tablets: the icon is a little smaller, as the photos are smaller */
@media (hover: none) {
    .gallery a::after {
        top: 6px;
        right: 6px;
        width: 26px;
        height: 26px;
        background-size: 14px 14px;
    }
}

/* 3D tour block under the Custom homes gallery: smaller heading than a section */
.tour-block {
    margin-top: clamp(32px, 5vw, 48px);
}

.tour-block h3 {
    font-size: clamp(1.1rem, 2vw, 1.25rem);
    font-weight: 500;   /* loaded weights: 400, 500, 700, 900 */
    line-height: 1.6;
    color: var(--text);
    margin-bottom: 6px;
}

.tour-note {
    margin-bottom: 0;
    color: var(--text-muted);
}

/* Matterport 3D tour: full content width, 16:9 on every screen */
.tour {
    display: block;
    width: 100%;
    aspect-ratio: 16 / 9;
    margin-top: 16px;
    border: 0;
    border-radius: var(--rounding);
    background-color: var(--bg-soft);
}

.placeholder {
    padding: 40px;
    border-radius: var(--rounding);
    background-color: var(--bg-soft);
    color: var(--text-muted);
    text-align: center;
}

/* ---------- Lightbox (built by app.js) ---------- */

/* Stop the page scrolling behind the viewer, without the layout jumping
   when the scrollbar disappears */
html.lightbox-open {
    overflow: hidden;
    scrollbar-gutter: stable;
}

.lightbox {
    width: calc(100% - 32px);
    max-width: 1400px;
    height: calc(100% - 32px);
    max-height: none;
    margin: auto;
    padding: 0;
    border: 0;
    border-radius: var(--rounding);
    overflow: hidden;
    background-color: hsl(0, 0%, 8%);
    color: white;
    /* Slides up from below the screen */
    translate: 0 100vh;
    transition: translate 0.45s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.lightbox[open] {
    display: grid;
    grid-template-rows: auto 1fr auto;
}

.lightbox.is-open {
    translate: 0 0;
}

.lightbox::backdrop {
    background-color: rgba(0, 0, 0, 0.6);
    opacity: 0;
    transition: opacity 0.45s ease;
}

.lightbox.is-open::backdrop {
    opacity: 1;
}

.lightbox button {
    display: grid;
    place-items: center;
    border: 0;
    color: inherit;
    cursor: pointer;
}

.lightbox svg {
    width: 24px;
    height: 24px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.lightbox-bar {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 60px;
    padding: 8px;
}

.lightbox-close {
    position: absolute;
    top: 8px;
    left: 8px;
    width: 44px;
    height: 44px;
    border-radius: var(--rounding);
    background-color: transparent;
    transition: background-color 0.2s;
}

.lightbox-close:hover {
    background-color: rgba(255, 255, 255, 0.12);
}

.lightbox-count {
    margin: 0;
    font-size: 0.85rem;
    color: hsl(0, 0%, 70%);
}

/* Big photo, fitted inside the stage with max-width / max-height */
.lightbox-stage {
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 0;
    padding: 0 16px;
}

/* Width and height are set by app.js so the photo always fills the stage */
.lightbox-image {
    flex: none;
    max-width: none;
    border-radius: 5px;
    user-select: none;
}

.lightbox-arrow {
    position: absolute;
    top: 50%;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background-color: rgba(0, 0, 0, 0.5);
    translate: 0 -50%;
    transition: background-color 0.2s;
}

.lightbox-arrow:hover {
    background-color: rgba(0, 0, 0, 0.75);
}

.lightbox-prev {
    left: 40px;
}

.lightbox-next {
    right: 40px;
}

/* Thumbnail strip: scrolls sideways; the clip hides it when it rubber-bands */
.lightbox-strip-clip {
    overflow: hidden;
    padding: 12px 0 16px;
}

.lightbox-strip {
    display: flex;
    gap: 8px;
    padding: 4px 16px;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    scrollbar-width: none;
}

.lightbox-strip::-webkit-scrollbar {
    display: none;
}

.lightbox-thumb {
    flex: none;
    padding: 0;
    border-radius: 4px;
    background: none;
    opacity: 0.45;
    transition: opacity 0.2s;
}

.lightbox-thumb:hover,
.lightbox-thumb.is-active {
    opacity: 1;
}

.lightbox-thumb.is-active {
    outline: 2px solid white;
    outline-offset: 2px;
}

.lightbox-thumb img {
    width: auto;
    max-width: none;
    height: 64px;
    border-radius: 4px;
}

/* ---------- Team ---------- */

.team-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 30px;
    list-style: none;
}

/* Square photo (the grey shows while it loads, or if a photo is missing) */
.team-photo {
    display: block;
    width: 100%;
    height: auto;
    aspect-ratio: 1;
    border-radius: var(--rounding);
    background-color: var(--bg-pill);
    margin-bottom: 15px;
}

.team-grid h3 {
    font-size: 1.1rem;
}

.team-grid p {
    color: var(--text-muted);
    margin-bottom: 0;
}

/* LinkedIn link under each person's title */
.team-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-top: 6px;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-muted);
    transition: color 0.2s;
}

/* Photo also links to LinkedIn (the text link below is the one keyboards use) */
.team-photo-link {
    display: block;
}

/* LinkedIn's brand blue, when hovering the link or the person's photo
   (mouse/trackpad only: phones would leave it stuck blue after a tap) */
@media (hover: hover) and (pointer: fine) {
    .team-link:hover,
    .team-grid li:has(.team-photo-link:hover) .team-link {
        color: #0a66c2;
    }
}

.team-link svg {
    width: 16px;
    height: 16px;
    fill: currentColor;
}

/* ---------- Contact ---------- */

/* Enquiry form */
.contact-form {
    padding: clamp(20px, 3vw, 30px);
    border-radius: var(--rounding);
    background-color: var(--bg-soft);
}

.contact-form h2 {
    margin-bottom: 8px;
}

.form-intro {
    margin-bottom: 24px;
    color: var(--text-muted);
}

.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px 20px;
    margin-bottom: 20px;
}

.field {
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-size: 0.9rem;
    font-weight: 500;
}

.field--full {
    grid-column: 1 / -1;
}

.field small {
    font-size: inherit;
    font-weight: 400;
    color: var(--text-muted);
}

.field input,
.field select,
.field textarea {
    width: 100%;
    padding: 12px 14px;
    border: 1px solid hsl(0, 0%, 85%);
    border-radius: var(--rounding);
    background-color: var(--bg);
    color: var(--text);
    font: inherit;
    font-size: 1rem;
    font-weight: 400;
    transition: border-color 0.2s;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
    border-color: var(--navy);
}

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

/* Dropdowns ignore line-height, so set the same height as the text fields.
   The browser's own arrow is replaced with a chevron that looks the same on
   every device, with room to breathe on the right. */
.field select {
    height: calc(1.6em + 26px);
    padding-right: 44px;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23555' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 16px center;
    background-size: 16px 16px;
}

/* Light grey example text until the visitor types (and the dropdown until chosen) */
.field ::placeholder {
    color: hsl(0, 0%, 65%);
    opacity: 1;
}

.field select:has(option[value=""]:checked) {
    color: hsl(0, 0%, 65%);
}

.field option {
    color: var(--text);
}

/* Spam trap: never shown to people */
.form-trap {
    display: none;
}

.form-status {
    margin: 16px 0 0;
}

.form-status:empty {
    display: none;
}

.form-status.is-error {
    color: #b00020;
}

.form-privacy {
    margin: 16px 0 0;
    font-size: 0.8rem;
    color: var(--text-muted);
}

.form-privacy a {
    text-decoration: underline;
}

/* ---------- Privacy policy (and any other long text page) ---------- */

.legal {
    max-width: 70ch;
}

.legal h1 {
    font-size: clamp(1.8rem, 4vw, 2.4rem);
    line-height: 1.2;
    margin-bottom: 8px;
}

.legal h2 {
    font-size: 1.2rem;
    margin: 36px 0 12px;
}

.legal p,
.legal ul {
    margin-bottom: 16px;
}

.legal ul {
    padding-left: 1.4em;
}

.legal li {
    margin-bottom: 8px;
}

.legal a {
    text-decoration: underline;
}

.legal-updated {
    color: var(--text-muted);
    font-size: 0.9rem;
}

/* Thank-you page message */
.notice {
    padding: clamp(24px, 5vw, 50px);
    border-radius: var(--rounding);
    background-color: var(--bg-soft);
    text-align: center;
}

.notice p {
    max-width: 55ch;
    margin-inline: auto;
}

.notice p a {
    text-decoration: underline;
}

.button-row {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 12px;
}

/* Info on the left, map on the right, in two equal boxes (stacked on phones) */
.contact {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.contact-info,
.contact-map {
    border-radius: var(--rounding);
    background-color: var(--bg-soft);
}

.contact-info {
    padding: clamp(20px, 3vw, 30px);
    font-style: normal;
    font-size: 0.9rem;
}

.contact-info .contact-name {
    font-weight: 700;
}

/* Every line is evenly spaced, including each line of the address */
.contact-info ul {
    --line-gap: 16px;
    display: flex;
    flex-direction: column;
    gap: var(--line-gap);
    list-style: none;
}

.contact-info a {
    display: inline-block;
    overflow-wrap: anywhere;
    transition: color 0.2s;
}

.contact-info a span {
    display: block;
}

.contact-info a span + span {
    margin-top: var(--line-gap);
}

.contact-info a:hover {
    color: var(--text-muted);
}

/* Map fills its whole box, edge to edge */
.contact-map iframe {
    display: block;
    width: 100%;
    aspect-ratio: 4 / 3;
    border: 0;
    border-radius: inherit;
}

/* ---------- Footer ---------- */

.site-footer {
    margin-top: var(--section-gap);
    padding: 50px 0;
    background-color: var(--bg-soft);
    /* Extends the footer colour below the page, so the rubber-band effect
       (app.js) reveals grey rather than white. Shadows don't add scroll height.
       Stacked copies, as one big offset would leave a gap under a short footer. */
    box-shadow:
        0 200px 0 var(--bg-soft),
        0 400px 0 var(--bg-soft),
        0 600px 0 var(--bg-soft),
        0 800px 0 var(--bg-soft),
        0 1000px 0 var(--bg-soft);
}

.site-footer .container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
}

.site-footer ul {
    list-style: none;
}

.site-footer li {
    margin-bottom: 10px;
}

.site-footer a {
    transition: color 0.2s;
}

.site-footer a:hover {
    color: grey;
}

.site-footer address {
    font-style: normal;
}

/* Copyright and privacy link, across the full width under both columns */
.footer-legal {
    grid-column: 1 / -1;
    margin: 0;
    padding-top: 20px;
    border-top: 1px solid hsl(0, 0%, 85%);
    font-size: 0.8rem;
    color: var(--text-muted);
}

.footer-legal a {
    text-decoration: underline;
}

/* Each address line gets the same spacing as the links in the left column */
.site-footer address a {
    display: inline-block;
}

.site-footer address a span {
    display: block;
}

.site-footer address a span + span {
    margin-top: 10px;
}

/* ---------- Small screens ---------- */

@media (max-width: 700px) {
    .split,
    .contact,
    .form-grid,
    .site-footer .container {
        grid-template-columns: 1fr;
    }

    /* Text and button always above the image when stacked */
    .split .split-image {
        order: 2;
    }

    .split-image {
        aspect-ratio: 4 / 3;
    }

    .gallery {
        --row-height: 140px;
        gap: 8px;
    }

    /* Viewer takes the whole screen on phones */
    .lightbox {
        width: 100%;
        height: 100%;
        border-radius: 0;
    }

    .lightbox-prev {
        left: 24px;
    }

    .lightbox-next {
        right: 24px;
    }

    .lightbox-thumb img {
        height: 52px;
    }

    /* Four pills don't fit one row on a phone: two rows of two, equal widths */
    .nav-child ul {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 8px;
        padding-inline: var(--gutter);
    }

    .nav-child a {
        display: block;
        min-width: 0;
        font-size: 0.9rem;
        padding: 0 clamp(8px, 3vw, 16px);
    }
}
