/*
  Split-pane components

  .component-section-split-pane         one container: .row of .section-content + .section-bg-image-spacer (either order)
  .component-section-double-split-pane  that container, then a second .container below, over one shared background

  Images come from inline custom properties: style="--pane-mobile:url(…);--pane-desktop:url(…)"
  Single pane desktop image fit: --pane-desktop-size (default cover), --pane-desktop-position (default center center)
  Background helpers (on the section): .--no-mobile-background, .--no-desktop-background
  Alignment helpers (on the .container): .centered, .mobile-centered (under 1000px), .desktop-centered (1000px and up); left otherwise
*/

.component-section-split-pane,
.component-section-double-split-pane {
    --pane-mobile-height: 450px;
    --pane-mobile-size: 100%;
}

.component-section-double-split-pane {
    --pane-mobile-height: 300px;
    --pane-mobile-size: min(100%, 460px);
}

/*
  Standard top and bottom padding for every component section. .component-section-bottom-hero keeps its own bottom (its image needs the room).
  A component changes it by setting --pad-top / --pad-bottom; helpers .--no-top-margin, .--no-top-margin-mobile
  and .--no-top-margin-desktop (end of this file) remove the top, for when an image comes first.
*/

section[class*="component-"] {
    --pad-top: calc(3 * var(--space));
    --pad-bottom: calc(3 * var(--space));
    padding: var(--pad-top) 0 var(--pad-bottom) !important;
}

:where([class*="component-"]) .button-wrapper {
    margin-top: 1rem;
}

:is(.component-section-split-pane, .component-section-double-split-pane) .section-bg-image-spacer {
    flex: 1 0 auto;
    height: 0;
}

:is(.component-section-split-pane, .component-section-double-split-pane) .section-content > :first-child {
    margin-top: 0;
}

:is(.component-section-split-pane, .component-section-double-split-pane) .section-content .as-featured {
    justify-content: start;
}

@media (max-width: 999px) {
    :is(.component-section-split-pane, .component-section-double-split-pane) .section-bg-image-spacer {
        order: -1;
    }
}

@media (max-width: 499px) {
    .component-section-split-pane:not(.--no-mobile-background) .section-bg-image-spacer {
        flex: none;
        height: var(--pane-mobile-height);
        background: var(--pane-mobile, none) top center / var(--pane-mobile-size) no-repeat;
    }
}

@media (max-width: 999px) {
    .component-section-double-split-pane:not(.--no-mobile-background) .section-bg-image-spacer {
        flex: none;
        height: var(--pane-mobile-height);
        background: var(--pane-mobile, none) top center / var(--pane-mobile-size) no-repeat;
    }
}

@media (min-width: 1000px) {
    :is(.component-section-split-pane, .component-section-double-split-pane).--no-desktop-background .section-bg-image-spacer {
        display: none;
    }
}

/* alignment: left unless the .container says otherwise; centred content stays in block flow so margins collapse */

:is(.component-section-split-pane, .component-section-double-split-pane) .container.centered .section-content {
    text-align: center;
}

:is(.component-section-split-pane, .component-section-double-split-pane) .container.centered .section-content > * {
    margin-left: auto;
    margin-right: auto;
}

:is(.component-section-split-pane, .component-section-double-split-pane) .container.centered .section-content > :is(ul, ol) {
    width: fit-content;
}

:is(.component-section-split-pane, .component-section-double-split-pane) .container.centered .section-content :is(.button-wrapper, .as-featured) {
    justify-content: center;
}

@media (max-width: 999px) {
    :is(.component-section-split-pane, .component-section-double-split-pane) .container.mobile-centered .section-content {
        text-align: center;
    }

    :is(.component-section-split-pane, .component-section-double-split-pane) .container.mobile-centered .section-content > * {
        margin-left: auto;
        margin-right: auto;
    }

    :is(.component-section-split-pane, .component-section-double-split-pane) .container.mobile-centered .section-content > :is(ul, ol) {
        width: fit-content;
    }

    :is(.component-section-split-pane, .component-section-double-split-pane) .container.mobile-centered .section-content :is(.button-wrapper, .as-featured) {
        justify-content: center;
    }
}

@media (min-width: 1000px) {
    :is(.component-section-split-pane, .component-section-double-split-pane) .container.desktop-centered .section-content {
        text-align: center;
    }

    :is(.component-section-split-pane, .component-section-double-split-pane) .container.desktop-centered .section-content > * {
        margin-left: auto;
        margin-right: auto;
    }

    :is(.component-section-split-pane, .component-section-double-split-pane) .container.desktop-centered .section-content > :is(ul, ol) {
        width: fit-content;
    }

    :is(.component-section-split-pane, .component-section-double-split-pane) .container.desktop-centered .section-content :is(.button-wrapper, .as-featured) {
        justify-content: center;
    }
}

/* single */

section.component-section-split-pane {
    background-repeat: no-repeat;
    background-position: var(--pane-desktop-position, center center);
    background-size: var(--pane-desktop-size, cover);
}

@media (min-width: 500px) {
    .component-section-split-pane .container {
        max-width: var(--reading-width);
    }
}

@media (min-width: 1000px) {
    section.component-section-split-pane {
        --pad-top: calc(6 * var(--space));
        --pad-bottom: calc(6 * var(--space));
    }

    section.component-section-split-pane:not(.--no-desktop-background) {
        background-image: var(--pane-desktop, none);
    }

    section.component-section-split-pane:where(.--no-desktop-background) {
        --pad-top: calc(3 * var(--space));
        --pad-bottom: calc(3 * var(--space));
    }

    .component-section-split-pane .container {
        max-width: var(--content-width);
    }
}

/* double */

section.component-section-double-split-pane {
    background-position: top right;
    background-repeat: no-repeat;
    background-size: 100%;
}

.component-section-double-split-pane > .container:first-child > .row {
    gap: 0;
}

.component-section-double-split-pane .section-content h1 {
    margin: 0;
}

.component-section-double-split-pane > .container:nth-child(2) {
    padding-top: calc(3 * var(--space));
}

@media (min-width: 800px) {
    .component-section-double-split-pane div:has(> #filter-day) {
        width: 80%;
        margin-inline: auto;
    }
}

@media (min-width: 1000px) {
    section.component-section-double-split-pane:not(.--no-desktop-background) {
        background-image: var(--pane-desktop, none);
    }

    section.component-section-double-split-pane:has(> .container:first-child > .row > .section-bg-image-spacer:first-child) {
        background-position: top left;
    }

    .component-section-double-split-pane > .container:first-child .section-content {
        max-width: 560px;
    }

    .component-section-double-split-pane > .container:nth-child(2) {
        padding-top: calc(5 * var(--space));
    }
}

/*
  Feature tabs: .component-feature-tabs
  A div whose direct children are <details> becomes an accordion under 1000px and tabs (summaries left, open panel right) from 1000px.
  components.js sets --tabs to the number of items and keeps one open on desktop.
*/

.component-feature-tabs div:has(> details) > details,
.component-feature-tabs div:has(> details) > details[open] {
    padding: 0;
    border: 0;
}

.component-feature-tabs div:has(> details) > details > summary::before {
    content: none;
}

.component-feature-tabs div:has(> details) > details > summary {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1.25rem 0;
    border-bottom: 1px solid var(--light-blue);
    color: var(--purple);
    font-weight: 700;
    cursor: pointer;
    list-style: none;
    margin: 0;
}

.component-feature-tabs div:has(> details) > details[open] > summary {
    margin: 0;
}

.component-feature-tabs div:has(> details) > details > summary::-webkit-details-marker {
    display: none;
}

.component-feature-tabs div:has(> details) > details > summary::after {
    content: "";
    width: 0.5rem;
    height: 0.5rem;
    margin-left: auto;
    border-right: 2px solid currentColor;
    border-bottom: 2px solid currentColor;
    transform: rotate(45deg);
}

.component-feature-tabs div:has(> details) > details[open] > summary::after {
    transform: rotate(-135deg);
}

.component-feature-tabs div:has(> details) > details > summary:hover,
.component-feature-tabs div:has(> details) > details[open] > summary {
    color: var(--green);
    border-bottom-color: var(--green);
}

.component-feature-tabs div:has(> details) > details > summary > :is(img, svg) {
    width: 1.5rem;
    height: 1.5rem;
    flex: 0 0 auto;
}

.component-feature-tabs div:has(> details) > details > div {
    padding-top: var(--space);
}

.component-feature-tabs .as-featured {
    justify-content: start;
    font-size: 0.8rem;
    margin-top: 1rem;
}

.component-feature-tabs .as-featured img {
    height: 20px !important;
}

@media (min-width: 1000px) {
    .component-feature-tabs div:has(> details) {
        display: grid;
        grid-template-columns: minmax(0, 2fr) minmax(0, 3fr);
        grid-template-rows: repeat(var(--tabs, 5), auto) 1fr;
        column-gap: calc(var(--space) * 2);
    }

    .component-feature-tabs div:has(> details) > details {
        display: contents;
    }

    .component-feature-tabs div:has(> details) > details > summary {
        grid-column: 1;
    }

    .component-feature-tabs div:has(> details) > details > summary::after {
        display: none;
    }

    .component-feature-tabs div:has(> details) > details::details-content {
        grid-column: 2;
        grid-row: 1 / -1;
    }

    .component-feature-tabs div:has(> details) > details > div {
        padding-top: 0;
    }
}

/*
  Centered list: .component-centered-list
  Put the .centered class on the .container; its ul or ol becomes divided rows
*/

.component-centered-list ul,
.component-centered-list ol {
    padding-left: 0;
    list-style: none;
    margin-bottom: calc(2 * var(--space));
    margin-top: calc(2 * var(--space));
}

.component-centered-list li {
    border-bottom: 1px solid var(--light-blue);
    padding: 1rem 0;
}

.component-centered-list li::before {
    content: none;
}

/*
  Bottom hero: .component-section-bottom-hero
  A section with a decorative court image along the bottom, leaving room beneath its .container
*/

section.component-section-bottom-hero {
    background-color: #fff;
    background-image: url(/ui/images/tennis-court-bg-no-roof.webp);
    background-size: 150%;
    background-position: center bottom -100px;
    background-repeat: no-repeat;
    --pad-bottom: 250px;
}

.component-section-bottom-hero h2 {
    margin-top: 0;
}

@media (min-width: 500px) {
    section.component-section-bottom-hero {
        --pad-bottom: 350px;
    }
}

@media (min-width: 800px) {
    section.component-section-bottom-hero {
        --pad-bottom: 500px;
    }
}

@media (min-width: 1000px) {
    section.component-section-bottom-hero {
        background-size: 100% auto;
        background-position: center bottom -150px;
        --pad-bottom: 450px;
    }
}

/*
  Testimonial: .component-testimonial
  A centred blockquote with a gold quote mark; optional <header> title and <footer> signature
*/

.component-testimonial {
    text-align: center;
}

.component-testimonial h2 {
    margin-top: calc(.5 * var(--space));
}

.component-testimonial blockquote {
    padding-top: 100px;
    background-image: url(/ui/images/icon-single-quote-gold.svg);
    background-size: 60px;
    background-repeat: no-repeat;
    background-position: top center;
    text-align: center;
}

.component-testimonial blockquote + blockquote {
    margin-top: calc(4 * var(--space));
}

.component-testimonial blockquote header {
    font-family: 'Cormorant Infant', serif;
    color: var(--dark-purple);
    margin-bottom: calc(.5 * var(--space));
    letter-spacing: normal;
    font-size: 2.5rem;
    font-weight: 500;
    line-height: 1.1;
}

.component-testimonial blockquote p {
    font-family: 'Cormorant Infant', serif;
    color: var(--dark-purple);
    margin-bottom: calc(.5 * var(--space));
    letter-spacing: normal;
    font-size: 2rem;
    font-weight: 500;
    line-height: 1.1;
}

.component-testimonial blockquote p.caption {
    font-family: 'Mulish', sans-serif;
    font-size: 1rem;
    color: var(--grey);
    margin-bottom: 1rem;
}

.component-testimonial blockquote header ~ p {
    font-family: 'Mulish', sans-serif;
    font-size: 1rem;
    color: var(--dark-grey);
    line-height: 1.5;
}

.component-testimonial blockquote footer {
    font-family: 'Mulish', sans-serif;
    background: transparent;
    padding: 0;
    color: var(--grey);
    margin: 0.5rem 0 0;
}

/*
  Piped items: .component-piped-items
  A .row of items with a .vertical-divider between each. Any number of items:
  two columns under 1000px (dividers hidden, a lone last item centred), one row with dividers from 1000px
*/

.component-piped-items .row {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 150px));
    justify-content: center;
}

.component-piped-items .row > .vertical-divider {
    display: none;
}

@media (max-width: 999px) {
    .component-piped-items .row > :last-child:nth-child(4n + 1) {
        grid-column: 1 / -1;
        justify-self: center;
        width: 100%;
        max-width: 150px;
    }
}

@media (min-width: 1000px) {
    .component-piped-items .row {
        display: flex;
        flex-direction: row;
    }

    .component-piped-items .row > .vertical-divider {
        display: block;
    }
}

/*
  Card features: .component-card-features
  A div of .card children becomes a grid. One across on mobile (.--two-on-mobile makes it two).
  From 1000px: two across inside a .reading-width, four across otherwise; .--triples makes it three. Extra cards wrap.
  Helpers go on the section.
*/

.component-card-features div:has(> .card) {
    --cards-mobile: 1;
    --cards-desktop: 4;
    display: grid;
    grid-template-columns: repeat(var(--cards-mobile), minmax(0, 1fr));
    gap: var(--space);
    margin-top: calc(2 * var(--space));
}

.component-card-features div:has(> .card):first-child {
    margin-top: 0;
}

.component-card-features div:has(> .card) > .card {
    min-width: 0;
}

.component-card-features div:has(> .card) > .card > * {
    align-self: stretch;
}

.component-card-features.--two-on-mobile div:has(> .card) {
    --cards-mobile: 2;
}

.component-card-features .reading-width div:has(> .card),
.component-card-features.reading-width div:has(> .card) {
    --cards-desktop: 2;
}

.component-card-features.--triples div:has(> .card) {
    --cards-desktop: 3;
}

@media (min-width: 1000px) {
    .component-card-features div:has(> .card) {
        grid-template-columns: repeat(var(--cards-desktop), minmax(0, 1fr));
    }
}

/*
  Component header: optional .component-header holding an h1, h2 or h3 and its description paragraphs.
  Use any number per section (a double split pane can have one in each container). It owns the spacing:
  nothing above it when it is first in its container, a fixed gap below it, and whatever follows drops its own top margin.
*/

.component-header {
    margin: 0 0 calc(2 * var(--space));
}

.component-header:not(:first-child) {
    margin-top: calc(2 * var(--space));
}

.component-header > * {
    margin-top: 0;
    margin-bottom: 0;
}

.component-header > :is(img, svg) + :is(h1, h2, h3),
.component-header > :is(h1, h2, h3) + * {
    margin-top: calc(.5 * var(--space));
}

.component-header > p + p {
    margin-top: 1rem;
}

.component-header > :is(img, svg) {
    vertical-align: top;
}

.card > .component-header {
    margin-bottom: calc(2 * var(--space) - var(--space));
}

.component-header + * {
    margin-top: 0 !important;
}

.component-inline-feature {
    padding: calc(4/3 * var(--space)) 0;
    margin: calc(4/3 * var(--space)) 0;
    border-top: 1px solid var(--light-blue);
    border-bottom: 1px solid var(--light-blue);
}

.component-inline-feature > :first-child,
.component-inline-feature > :first-child > :first-child {
    margin-top: 0;
}

.component-inline-feature > :last-child,
.component-inline-feature > :last-child > :last-child {
    margin-bottom: 0;
}

/* top padding helpers: keep last in this file so they win over component padding variables */

section.--no-top-margin {
    --pad-top: 0;
}

@media (max-width: 999px) {
    section.--no-top-margin-mobile {
        --pad-top: 0;
    }
}

@media (min-width: 1000px) {
    section.--no-top-margin-desktop {
        --pad-top: 0;
    }
}
