/*
 * Estate theme — the "modern property portal" look.
 *
 * What actually produces that look is not clever CSS: it is large photographs
 * at consistent aspect ratios, generous vertical rhythm, one accent colour used
 * sparingly, and shadows soft enough to read as depth rather than decoration.
 * Everything below is in service of those four things.
 *
 * Per-site values still arrive as custom properties from Site::themeTokens(),
 * so an agency can recolour this without touching a stylesheet and there is
 * still no build step.
 */

:root {
    --brand: #1b6ef3;
    --brand-ink: #ffffff;
    --accent: #f0a020;
    --radius: 14px;
    --font: system-ui, -apple-system, "Segoe UI", sans-serif;
    --heading-weight: 700;

    --ink: #0f1724;
    --ink-muted: #64748b;
    --line: #e6eaf0;
    --surface: #ffffff;
    --surface-alt: #f6f8fb;
    --surface-dark: #0d1420;
    --max: 1280px;

    /* One spacing scale. Sections that each invent their own padding are what
       make a page feel assembled rather than designed. */
    --gap-xs: .5rem;
    --gap-sm: 1rem;
    --gap: 1.5rem;
    --gap-lg: 2.5rem;
    --section-gap: 5.5rem;

    --shadow-sm: 0 1px 2px rgb(15 23 36 / .06), 0 1px 3px rgb(15 23 36 / .1);
    --shadow: 0 4px 6px -1px rgb(15 23 36 / .07), 0 10px 24px -6px rgb(15 23 36 / .12);
    --shadow-lg: 0 20px 40px -12px rgb(15 23 36 / .22);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

body {
    margin: 0;
    font-family: var(--font);
    font-size: 16px;
    line-height: 1.6;
    color: var(--ink);
    background: var(--surface);
    -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; height: auto; display: block; }
a { color: inherit; text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3, h4 {
    line-height: 1.15;
    margin: 0 0 var(--gap-xs);
    font-weight: var(--heading-weight);
    letter-spacing: -.02em;
}

h1 { font-size: clamp(2rem, 1.2rem + 3.4vw, 3.4rem); }
h2 { font-size: clamp(1.5rem, 1.1rem + 1.6vw, 2.1rem); }
h3 { font-size: 1.1rem; }

p { margin: 0 0 var(--gap-sm); }
.muted { color: var(--ink-muted); }
.plain { list-style: none; margin: 0; padding: 0; }

.wrap { width: min(100% - 2.5rem, var(--max)); margin-inline: auto; }

.skip {
    position: absolute; left: -9999px;
}
.skip:focus { left: 1rem; top: 1rem; background: var(--surface); padding: .5rem 1rem; z-index: 100; }

/* --------------------------------------------------------------------------
   Buttons
   -------------------------------------------------------------------------- */

.btn, button[type="submit"] {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .5rem;
    padding: .8rem 1.6rem;
    border: 0;
    border-radius: var(--radius);
    background: var(--brand);
    color: var(--brand-ink);
    font: inherit;
    font-weight: 600;
    cursor: pointer;
    transition: transform .15s ease, box-shadow .15s ease, filter .15s ease;
}

.btn:hover, button[type="submit"]:hover {
    text-decoration: none;
    filter: brightness(1.07);
    transform: translateY(-1px);
    box-shadow: var(--shadow);
}

.btn-ghost {
    background: transparent;
    color: inherit;
    border: 1px solid currentColor;
}

/* --------------------------------------------------------------------------
   Header — transparent over a hero, solid everywhere else
   -------------------------------------------------------------------------- */

.site-header {
    position: sticky;
    top: 0;
    z-index: 40;
    background: color-mix(in srgb, var(--surface) 88%, transparent);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--line);
}

.header-inner {
    display: flex;
    align-items: center;
    gap: var(--gap);
    min-height: 72px;
}

.brand { display: inline-flex; align-items: center; gap: .6rem; font-weight: 700; }
.brand:hover { text-decoration: none; }

.brand-mark {
    display: grid;
    place-items: center;
    width: 38px; height: 38px;
    border-radius: 10px;
    background: var(--brand);
    color: var(--brand-ink);
    font-weight: 700;
}

.nav { margin-left: auto; display: flex; flex-wrap: wrap; gap: var(--gap); font-size: .95rem; }
.nav a { color: var(--ink-muted); font-weight: 500; }
.nav a:hover { color: var(--ink); text-decoration: none; }

/* --------------------------------------------------------------------------
   Hero — full bleed photograph, dark scrim, search card floating over it
   -------------------------------------------------------------------------- */

.hero {
    position: relative;
    display: grid;
    place-items: center;
    min-height: clamp(420px, 62vh, 680px);
    padding: var(--section-gap) 0 calc(var(--section-gap) + 2rem);
    color: #fff;
    text-align: center;
    background-image: var(--hero-image, none);
    background-size: cover;
    background-position: center;
    background-color: var(--surface-dark);
}

/*
 * The scrim is what makes white text readable over an unknown photograph. An
 * agency will upload something bright and something dark in the same week, so
 * the theme cannot assume either.
 */
.hero::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, rgb(9 14 24 / .55) 0%, rgb(9 14 24 / .35) 45%, rgb(9 14 24 / .7) 100%);
}

.hero > * { position: relative; z-index: 1; }
.hero h1 { color: #fff; text-shadow: 0 2px 24px rgb(0 0 0 / .35); }
.hero-sub { font-size: clamp(1rem, .9rem + .5vw, 1.2rem); opacity: .92; max-width: 46ch; margin-inline: auto; }

.hero-search {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: var(--gap-sm);
    align-items: center;
    margin: var(--gap-lg) auto 0;
    padding: var(--gap-sm);
    width: min(100%, 940px);
    background: var(--surface);
    border-radius: calc(var(--radius) + 4px);
    box-shadow: var(--shadow-lg);
    text-align: left;
}

.hero-search input, .hero-search select {
    width: 100%;
    padding: .8rem .9rem;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    font: inherit;
    color: var(--ink);
    background: var(--surface);
}

.hero-stats { margin-top: var(--gap); font-size: .95rem; opacity: .9; }

/* --------------------------------------------------------------------------
   Sections
   -------------------------------------------------------------------------- */

main > section, .section { padding-block: var(--section-gap); }
.section-alt, .section-about { background: var(--surface-alt); }

/* A centred heading with a short line under it is the single most recognisable
   signal of this style, and it costs nothing. */
.section > .wrap > h2,
.section-head h2 { text-align: center; }

.section > .wrap > h2::after,
.section-head h2::after {
    content: "";
    display: block;
    width: 56px;
    height: 3px;
    margin: var(--gap-sm) auto var(--gap-lg);
    border-radius: 3px;
    background: var(--brand);
}

.section-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: var(--gap-sm); }
.section-head a { margin-left: auto; color: var(--brand); font-weight: 600; }
.section-more { text-align: center; margin-top: var(--gap-lg); }

/* --------------------------------------------------------------------------
   Listing cards
   -------------------------------------------------------------------------- */

.grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: var(--gap);
}

.card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    transition: transform .18s ease, box-shadow .18s ease;
}

.card:hover { transform: translateY(-4px); box-shadow: var(--shadow); }

.card-media {
    position: relative;
    display: block;
    /* Fixed ratio is what makes a grid of agency photographs look deliberate
       rather than ragged — phone photos arrive in every proportion. */
    aspect-ratio: 3 / 2;
    background: var(--surface-alt);
    overflow: hidden;
}

.card-media img { width: 100%; height: 100%; object-fit: cover; transition: transform .4s ease; }
.card:hover .card-media img { transform: scale(1.04); }

.card-media-empty {
    display: grid; place-items: center; height: 100%;
    color: var(--ink-muted); font-size: .9rem;
}

.card-badges { position: absolute; top: .75rem; left: .75rem; display: flex; gap: .4rem; }

.badge {
    padding: .3rem .6rem;
    border-radius: 999px;
    font-size: .75rem;
    font-weight: 600;
    background: rgb(255 255 255 / .92);
    color: var(--ink);
    backdrop-filter: blur(4px);
}

.badge-brand { background: var(--brand); color: var(--brand-ink); }
.badge-accent { background: var(--accent); color: #1a1205; }

.card-body { padding: var(--gap); }
.card-price { font-size: 1.3rem; font-weight: 700; color: var(--brand); margin: 0 0 .25rem; }
.card-title { font-size: 1.02rem; margin: 0 0 .25rem; }
.card-title a:hover { color: var(--brand); text-decoration: none; }
.card-location { font-size: .9rem; margin: 0 0 var(--gap-sm); }

.card-specs {
    display: flex;
    flex-wrap: wrap;
    gap: var(--gap-sm);
    padding-top: var(--gap-sm);
    border-top: 1px solid var(--line);
    font-size: .88rem;
    color: var(--ink-muted);
}

.card-ref { font-size: .78rem; margin: var(--gap-xs) 0 0; }

/* --------------------------------------------------------------------------
   Category tiles and mosaic gallery
   -------------------------------------------------------------------------- */

.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: var(--gap); }

.tile {
    position: relative;
    display: block;
    aspect-ratio: 4 / 3;
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    color: #fff;
}

.tile img { width: 100%; height: 100%; object-fit: cover; transition: transform .4s ease; }
.tile:hover img { transform: scale(1.05); }
.tile:hover { text-decoration: none; }

.tile-label {
    position: absolute; inset: auto 0 0 0;
    padding: var(--gap-sm);
    background: linear-gradient(180deg, transparent, rgb(9 14 24 / .8));
    font-weight: 600;
}

.tile-count { display: block; font-size: .8rem; font-weight: 400; opacity: .85; }

/*
 * Mosaic: a few tiles span two rows so the grid stops reading as a spreadsheet.
 * Pure CSS — no masonry library, and it degrades to a plain grid on narrow
 * screens where the effect would be lost anyway.
 */
.mosaic {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    grid-auto-rows: 180px;
    gap: var(--gap-sm);
}

.mosaic > * { border-radius: var(--radius); overflow: hidden; }
.mosaic > *:nth-child(4n+1) { grid-row: span 2; }
.mosaic img { width: 100%; height: 100%; object-fit: cover; }

@media (max-width: 640px) {
    .mosaic > *:nth-child(4n+1) { grid-row: span 1; }
}

/* --------------------------------------------------------------------------
   Dark band
   -------------------------------------------------------------------------- */

.band-dark {
    background: var(--surface-dark);
    color: #e8edf5;
}

.band-dark h2, .band-dark h3 { color: #fff; }
.band-dark .muted { color: #9fb0c6; }

.band-dark h2::after { background: var(--accent); }

.band-grid { display: grid; gap: var(--gap-lg); grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); align-items: center; }

.feature-list { display: grid; gap: var(--gap-sm); }

.feature-list li {
    display: flex;
    gap: .75rem;
    align-items: start;
    padding-bottom: var(--gap-sm);
    border-bottom: 1px solid rgb(255 255 255 / .1);
}

.feature-list li::before {
    content: "";
    flex: 0 0 8px;
    width: 8px; height: 8px;
    margin-top: .55rem;
    border-radius: 50%;
    background: var(--accent);
}

/* --------------------------------------------------------------------------
   Horizontal scrollers — agents, testimonials
   -------------------------------------------------------------------------- */

/*
 * scroll-snap instead of a carousel library: it works without JavaScript, it is
 * reachable by keyboard and touch for free, and it cannot break the page when a
 * script fails to load.
 */
.scroller {
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: minmax(260px, 1fr);
    gap: var(--gap);
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    padding-bottom: var(--gap-sm);
    scrollbar-width: thin;
}

.scroller > * { scroll-snap-align: start; }

@media (min-width: 900px) {
    .scroller { grid-auto-columns: minmax(280px, 1fr); }
}

.agent, .testimonial, .service {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: var(--gap);
    box-shadow: var(--shadow-sm);
}

.band-dark .agent, .band-dark .testimonial, .band-dark .service {
    background: rgb(255 255 255 / .04);
    border-color: rgb(255 255 255 / .12);
}

.testimonial blockquote { margin: 0 0 var(--gap-sm); font-size: 1.02rem; }
.testimonial figcaption { font-size: .9rem; color: var(--ink-muted); }

/* --------------------------------------------------------------------------
   Stats, CTA, FAQ, prose
   -------------------------------------------------------------------------- */

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: var(--gap); text-align: center; }
.stat strong { display: block; font-size: clamp(1.8rem, 1.2rem + 2vw, 2.8rem); color: var(--brand); line-height: 1.1; }
.stat span { color: var(--ink-muted); }

.section-cta { background: var(--brand); color: var(--brand-ink); text-align: center; }
.section-cta h2::after { background: var(--brand-ink); opacity: .6; }
.section-cta .btn { background: var(--surface); color: var(--ink); }

.faq { display: grid; gap: var(--gap-sm); max-width: 780px; margin-inline: auto; }

.faq details {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: var(--gap-sm) var(--gap);
}

.faq summary { cursor: pointer; font-weight: 600; }
.faq details[open] summary { margin-bottom: var(--gap-xs); }

.prose { max-width: 72ch; }
.prose h2 { text-align: left; }
.prose h2::after { margin-inline: 0; }

.about-grid { display: grid; gap: var(--gap-lg); grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); align-items: center; }
.about-grid img { border-radius: var(--radius); box-shadow: var(--shadow); }

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

.site-footer { background: var(--surface-dark); color: #b9c6d6; padding-block: var(--section-gap) var(--gap-lg); margin-top: var(--section-gap); }
.site-footer a { color: #dbe5f0; }
.footer-grid { display: grid; gap: var(--gap-lg); grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.footer-title { color: #fff; font-weight: 600; margin-bottom: var(--gap-xs); }
.footer-grid li { padding: .2rem 0; }
.footer-legal { margin-top: var(--gap-lg); padding-top: var(--gap); border-top: 1px solid rgb(255 255 255 / .1); font-size: .85rem; }

/* --------------------------------------------------------------------------
   Reduced motion
   -------------------------------------------------------------------------- */

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: .01ms !important;
        transition-duration: .01ms !important;
        scroll-behavior: auto !important;
    }
}

/* --------------------------------------------------------------------------
   Tabs — radio inputs and sibling selectors, no JavaScript
   -------------------------------------------------------------------------- */

.tab-input { position: absolute; opacity: 0; pointer-events: none; }

.tab-list {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: var(--gap-xs);
    margin-bottom: var(--gap-lg);
}

.tab-label {
    padding: .55rem 1.2rem;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: var(--surface);
    font-weight: 600;
    font-size: .92rem;
    cursor: pointer;
    transition: background .15s ease, color .15s ease, border-color .15s ease;
}

.tab-label:hover { border-color: var(--brand); color: var(--brand); }

.tab-panel { display: none; }

/*
 * nth-of-type counts per element type, so the inputs and the panels index
 * independently — which is why the panels are divs and the tab strip is a nav.
 */
.tab-input:nth-of-type(1):checked ~ .tab-panel:nth-of-type(1),
.tab-input:nth-of-type(2):checked ~ .tab-panel:nth-of-type(2),
.tab-input:nth-of-type(3):checked ~ .tab-panel:nth-of-type(3) { display: block; }

.tab-input:nth-of-type(1):checked ~ .tab-list .tab-label:nth-of-type(1),
.tab-input:nth-of-type(2):checked ~ .tab-list .tab-label:nth-of-type(2),
.tab-input:nth-of-type(3):checked ~ .tab-list .tab-label:nth-of-type(3) {
    background: var(--brand);
    border-color: var(--brand);
    color: var(--brand-ink);
}

/* Keyboard users must still see which tab has focus. */
.tab-input:focus-visible ~ .tab-list .tab-label { outline: 2px solid var(--brand); outline-offset: 2px; }

/* --------------------------------------------------------------------------
   Trio of closing calls to action
   -------------------------------------------------------------------------- */

.trio { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: var(--gap); }

.trio-panel {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: flex-end;
    gap: var(--gap-xs);
    min-height: 260px;
    padding: var(--gap-lg) var(--gap);
    border-radius: var(--radius);
    overflow: hidden;
    color: #fff;
    background: var(--surface-dark) var(--panel-image, none) center / cover no-repeat;
}

.trio-panel::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, rgb(9 14 24 / .25), rgb(9 14 24 / .8));
}

.trio-panel > * { position: relative; z-index: 1; }
.trio-panel h3 { color: #fff; font-size: 1.3rem; }
.trio-panel .btn { background: var(--surface); color: var(--ink); }

/* --------------------------------------------------------------------------
   Search page — filters, facets, results
   --------------------------------------------------------------------------
   minimal.css already gives these structure; what follows is only the look, so
   the search page belongs to the same design as the home page.
   -------------------------------------------------------------------------- */

.listing-head h1 { text-align: left; }
.listing-head h1::after { display: none; }

.filters {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: var(--gap-sm);
    align-items: end;
    padding: var(--gap);
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
}

.field { display: grid; gap: .3rem; }
.field > span, .field > label { font-size: .8rem; font-weight: 600; color: var(--ink-muted); }

.filters input, .filters select {
    width: 100%;
    padding: .65rem .8rem;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    font: inherit;
    background: var(--surface);
    color: var(--ink);
}

.filters input:focus, .filters select:focus {
    outline: 2px solid color-mix(in srgb, var(--brand) 45%, transparent);
    outline-offset: 1px;
    border-color: var(--brand);
}

.field-row { display: flex; gap: var(--gap-sm); align-items: end; }

.sidebar, .listing-aside {
    align-self: start;
    padding: var(--gap);
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
}

.facet + .facet { margin-top: var(--gap-lg); }

.facet-title {
    font-size: .75rem;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: var(--ink-muted);
    font-weight: 700;
    margin-bottom: var(--gap-xs);
}

.facet-link {
    display: flex;
    justify-content: space-between;
    gap: var(--gap-sm);
    padding: .45rem .6rem;
    border-radius: calc(var(--radius) - 4px);
    font-size: .92rem;
}

.facet-link:hover { background: var(--surface-alt); text-decoration: none; }
.facet-link.is-active { background: var(--brand); color: var(--brand-ink); font-weight: 600; }

.chips { display: flex; flex-wrap: wrap; gap: .4rem; }

.chip {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    padding: .3rem .7rem;
    border-radius: 999px;
    background: var(--surface-alt);
    border: 1px solid var(--line);
    font-size: .85rem;
}

.chip:hover { text-decoration: none; border-color: var(--brand); color: var(--brand); }

/* Listing detail */
.listing-price { font-size: clamp(1.6rem, 1.2rem + 1.6vw, 2.2rem); color: var(--brand); font-weight: 700; }
.gallery-main img { border-radius: var(--radius); }
.gallery-thumbs { display: grid; grid-template-columns: repeat(auto-fit, minmax(90px, 1fr)); gap: .5rem; margin-top: .5rem; }
.gallery-thumbs img { border-radius: calc(var(--radius) - 6px); aspect-ratio: 4/3; object-fit: cover; }
.map, .map-block { border-radius: var(--radius); overflow: hidden; }
.lead-form { display: grid; gap: var(--gap-sm); }
.lead-form input, .lead-form textarea, .lead-form select {
    width: 100%;
    padding: .7rem .85rem;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    font: inherit;
}

.pagination { display: flex; flex-wrap: wrap; gap: .35rem; justify-content: center; margin-top: var(--gap-lg); }
.pagination a, .pagination span {
    padding: .5rem .9rem;
    border: 1px solid var(--line);
    border-radius: calc(var(--radius) - 4px);
}
.pagination .is-current { background: var(--brand); color: var(--brand-ink); border-color: var(--brand); }

.breadcrumbs { font-size: .85rem; color: var(--ink-muted); margin-bottom: var(--gap-sm); }

/* Category tiles: a subtitle under the heading, and gradients rather than flat
   fills for the photo-less state, so an empty tile still reads as designed. */
.section-sub {
    text-align: center;
    max-width: 60ch;
    margin: calc(var(--gap-lg) * -1 + .25rem) auto var(--gap-lg);
}

.tile-tint-0 { background: linear-gradient(140deg, #1b6ef3, #0d3f8f); }
.tile-tint-1 { background: linear-gradient(140deg, #16a394, #0b6058); }
.tile-tint-2 { background: linear-gradient(140deg, #f0a020, #b4650a); }
.tile-tint-3 { background: linear-gradient(140deg, #6366f1, #3730a3); }
.tile-tint-4 { background: linear-gradient(140deg, #ef6461, #a02c2a); }
.tile-tint-5 { background: linear-gradient(140deg, #0f1724, #33415c); }
