/*
 * spark-site: the site's own rules, linked into every page after the
 * captured Twenty Seventeen head (see serve_document() in src/pages.php).
 * Keep this small: layout lives in the templates; this is what the theme
 * does not do for us.
 */

/* Agents grid: every headshot is a circle, whatever shape the photo is.
   The theme rounds the image's corners; without a square frame that turns
   a landscape or portrait photo into an ellipse. The frame is made square
   and the photo cropped to fill it, anchored a little above centre so the
   face in a portrait shot stays inside the circle. */
.wp-block-image.is-style-rounded img {
    aspect-ratio: 1 / 1;
    object-fit: cover;
    object-position: 50% 25%;
}

/* No headshot on record: the agent's initials on a soft grey disc with a
   dashed edge -- the avatar the console shows for that profile -- at 60%
   of a headshot's diameter. Where cards sit side by side (the block
   editor's 782px column breakpoint) the figure keeps the full square a
   headshot would take, with the disc centred in it, so a row's names stay
   aligned whether or not the neighbour has a photo; stacked on a phone it
   shrinks to the disc. */
.wp-block-image.spark-no-headshot figure.aligncenter {
    display: flex;
    width: 100%;
    align-items: center;
    justify-content: center;
}
@media (min-width: 782px) {
    .wp-block-image.spark-no-headshot figure.aligncenter {
        aspect-ratio: 1 / 1;
    }
}
.spark-no-headshot figure > a {
    display: block;
    width: 60%;
    box-shadow: none;
}
.spark-no-headshot .spark-initials {
    display: block;
    width: 100%;
    height: auto;
    font-family: "Libre Franklin", "Helvetica Neue", helvetica, arial, sans-serif;
    font-weight: 800;
    letter-spacing: .02em;
}
.spark-no-headshot .spark-initials circle {
    fill: #eef0f2;
    stroke: #c9ced3;
    stroke-width: 1;
    stroke-dasharray: 3 2;
    vector-effect: non-scaling-stroke;
}
.spark-no-headshot .spark-initials text {
    fill: #5f666d;
    font-size: 40px; /* viewBox units: 40% of the disc */
}

/* Photo viewer (assets/site.js): a profile's photos, one at a time, over
   the page. The track is a horizontal scroller with snap points -- that is
   the swiping -- and the bar and arrows float over it. Arrows only where
   there is a mouse to hover them; on a phone the swipe is the control. */
.spark-photo,
.spark-photo a,
.spark-photo img {
    cursor: zoom-in;
}
.spark-photo:focus-visible {
    outline: 2px solid #222;
    outline-offset: 3px;
}
.spark-lightbox {
    position: fixed;
    inset: 0;
    z-index: 100000;
    background: #000;
    color: #fff;
    opacity: 0;
    transition: opacity .18s ease-out;
    overscroll-behavior: contain;
    -webkit-tap-highlight-color: transparent;
}
.spark-lightbox[hidden] {
    display: none;
}
.spark-lightbox.is-open {
    opacity: 1;
}
.spark-lightbox__track {
    position: absolute;
    inset: 0;
    display: flex;
    overflow-x: auto;
    overflow-y: hidden;
    scroll-snap-type: x mandatory;
    overscroll-behavior-x: contain;
    -webkit-overflow-scrolling: touch;
    touch-action: pan-x pinch-zoom;
    scrollbar-width: none;
}
.spark-lightbox__track::-webkit-scrollbar {
    display: none;
}
.spark-lightbox__slide {
    position: relative;
    flex: 0 0 100%;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    scroll-snap-align: center;
    scroll-snap-stop: always;
}
.spark-lightbox__slide img {
    display: block;
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    object-fit: contain;
    opacity: 0;
    transition: opacity .2s ease-out;
    -webkit-user-drag: none;
    user-select: none;
    -webkit-user-select: none;
}
.spark-lightbox__slide.is-loaded img {
    opacity: 1;
}
/* A quiet ring while a photo is on its way. */
.spark-lightbox__slide::before {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 28px;
    height: 28px;
    margin: -14px 0 0 -14px;
    border: 2px solid rgba(255, 255, 255, .25);
    border-top-color: rgba(255, 255, 255, .9);
    border-radius: 50%;
    animation: spark-spin .8s linear infinite;
}
.spark-lightbox__slide.is-loaded::before {
    display: none;
}
@keyframes spark-spin {
    to { transform: rotate(360deg); }
}
.spark-lightbox__bar {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: calc(10px + env(safe-area-inset-top, 0px)) 10px 14px 18px;
    background: linear-gradient(rgba(0, 0, 0, .55), rgba(0, 0, 0, 0));
    pointer-events: none;
}
.spark-lightbox__bar > * {
    pointer-events: auto;
}
.spark-lightbox__count {
    font-family: "Libre Franklin", "Helvetica Neue", helvetica, arial, sans-serif;
    font-size: 14px;
    font-weight: 600;
    letter-spacing: .06em;
    font-variant-numeric: tabular-nums;
    color: rgba(255, 255, 255, .85);
}
.spark-lightbox__close,
.spark-lightbox__nav {
    -webkit-appearance: none;
    appearance: none;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    margin: 0;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: rgba(0, 0, 0, .35);
    box-shadow: none;
    color: #fff;
    font: inherit;
    line-height: 1;
    cursor: pointer;
    transition: background .15s;
}
.spark-lightbox__close:hover,
.spark-lightbox__nav:hover,
.spark-lightbox__close:focus-visible,
.spark-lightbox__nav:focus-visible {
    background: rgba(255, 255, 255, .22);
    color: #fff;
    outline: none;
}
.spark-lightbox__close svg,
.spark-lightbox__nav svg {
    width: 22px;
    height: 22px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}
.spark-lightbox__nav {
    position: absolute;
    top: 50%;
    z-index: 2;
    display: none;
    transform: translateY(-50%);
}
.spark-lightbox__nav--prev {
    left: 14px;
}
.spark-lightbox__nav--next {
    right: 14px;
}
.spark-lightbox__nav[disabled] {
    opacity: .25;
    cursor: default;
}
@media (hover: hover) and (pointer: fine) {
    .spark-lightbox__nav {
        display: flex;
    }
    /* With a mouse there is room to inset the photo clear of the arrows. */
    .spark-lightbox__slide {
        box-sizing: border-box;
        padding: 24px 80px;
    }
}
