/* ─── Team Section — louisbourg/team-section ─────────────────────────────
   Curated profile grid. Cards follow the Business Owners mockup: tall photo,
   name, role, focus blurb, and an underlined "Book a Conversation" link.
   Uses global theme tokens (--crimson, --serif, --grey, --bone, --ink). */

.ts {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 32px;
    padding-block: var(--section-y, 110px);
}

.ts--cols-1 { grid-template-columns: 1fr; }
.ts--cols-2 { grid-template-columns: repeat(2, 1fr); }
.ts--cols-3 { grid-template-columns: repeat(3, 1fr); }
.ts--cols-4 { grid-template-columns: repeat(4, 1fr); }

/* ─── Card ─── */

.ts-card {
    display: flex;
    flex-direction: column;
    text-decoration: none;
    color: inherit;
}

/* ─── Photo ─── */

.ts-photo {
    aspect-ratio: 1 / 1;
    position: relative;
    overflow: hidden;
    background: var(--bone);
    border: 1px solid var(--line);
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ts-photo img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center top;
    display: block;
    filter: grayscale(1) contrast(1.02);
}

.ts-photo::after {
    content: '';
    position: absolute;
    inset: 0;
    pointer-events: none;
}

.ts-monogram {
    font-family: var(--serif);
    font-weight: 700;
    font-size: 46px;
    letter-spacing: .02em;
    color: var(--grey);
    line-height: 1;
    opacity: .55;
}

/* ─── Body ─── */

.ts-body {
    display: flex;
    flex-direction: column;
    flex: 1;
}

.ts-name {
    font-family: var(--serif);
    font-size: 22px;
    color: var(--ink);
    margin-bottom: 4px;
}

.ts-role {
    font-family: var(--sans);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .18em;
    text-transform: uppercase;
    color: var(--crimson);
    margin-bottom: 12px;
}

.ts-focus {
    font-family: var(--sans);
    font-size: 14px;
    color: var(--grey);
    line-height: 1.65;
    margin-bottom: 18px;
}

/* ─── Book a Conversation link ─── */

.ts-link {
    font-family: var(--sans);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .18em;
    text-transform: uppercase;
    color: var(--ink);
    margin-top: auto;
    align-self: flex-start;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding-bottom: 4px;
    border-bottom: 1.5px solid var(--ink);
    transition: color .2s, border-color .2s;
}

.ts-link::after { content: '→'; }

.ts-card:hover .ts-link {
    color: var(--crimson);
    border-color: var(--crimson);
}

/* ─── Responsive ─────────────────────────────────────────────────────────
   The .ts--cols-N modifier sets the desktop column count; these queries cap
   it as the viewport narrows so cards never get too cramped:
   4 → 3 (≤1100px) → 2 (≤860px) → 1 (≤560px). */

@media (max-width: 1100px) {
    .ts,
    .ts--cols-4 { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 860px) {
    .ts,
    .ts--cols-3,
    .ts--cols-4 { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 560px) {
    .ts,
    .ts--cols-2,
    .ts--cols-3,
    .ts--cols-4 { grid-template-columns: 1fr; }
}

/* ═══════════════════════════════════════════════════════════════════════════
   CAROUSEL LAYOUT
   Kicks in automatically when there are more members than columns. Built on
   CSS scroll-snap, so swipe and trackpad scroll work with JavaScript disabled;
   carousel.js only adds the arrows and dots.
   ═══════════════════════════════════════════════════════════════════════════ */

.ts-wrap {
    padding-block: var(--section-y, 110px);
}

/* The block carries its own vertical padding so it works standalone. Inside a
   Section band that doubles up with the band's padding — cancel it in both
   layouts. (This was a known issue on the grid layout too.) */
.is-style-section .ts,
.is-style-section-bone .ts,
.is-style-section-paper .ts,
.is-style-section .ts-wrap,
.is-style-section-bone .ts-wrap,
.is-style-section-paper .ts-wrap {
    padding-block: 0;
}

.ts--carousel {
    --ts-gap: 32px;
    --ts-per: 3;

    display: flex;
    gap: var(--ts-gap);
    padding-block: 0;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    scroll-snap-type: x mandatory;
    /* The dots are the scroll indicator; a native bar under the cards is noise. */
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.ts--carousel::-webkit-scrollbar { display: none; }

/* A scrollable region has to be keyboard reachable, so the scroller is
   focusable — which means it needs a visible focus ring. */
.ts--carousel:focus-visible {
    outline: 2px solid var(--crimson);
    outline-offset: 8px;
}

.ts--carousel.ts--cols-1 { --ts-per: 1; }
.ts--carousel.ts--cols-2 { --ts-per: 2; }
.ts--carousel.ts--cols-3 { --ts-per: 3; }
.ts--carousel.ts--cols-4 { --ts-per: 4; }

.ts--carousel .ts-card {
    scroll-snap-align: start;
    flex: 0 0 calc( ( 100% - ( var(--ts-gap) * ( var(--ts-per) - 1 ) ) ) / var(--ts-per) );
    min-width: 0;
}

/* ─── Arrows and dots ─── */

.ts-nav {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 18px;
    margin-top: 34px;
}

.ts-arrow {
    width: 44px;
    height: 44px;
    flex-shrink: 0;
    border-radius: 50%;
    border: 1.5px solid var(--line);
    background: #fff;
    color: var(--ink);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    padding: 0;
    transition: background .2s, border-color .2s, color .2s, opacity .2s;
}

.ts-arrow svg { width: 18px; height: 18px; display: block; }

.ts-arrow:hover:not(:disabled) {
    background: var(--crimson);
    border-color: var(--crimson);
    color: #fff;
}

.ts-arrow:focus-visible {
    outline: 2px solid var(--crimson);
    outline-offset: 3px;
}

.ts-arrow:disabled {
    opacity: .3;
    cursor: default;
}

.ts-dots {
    display: flex;
    align-items: center;
    gap: 2px;
}

/* The visible dot is 8px, but the button is 22px so it is thumb-sized. */
.ts-dot {
    width: 22px;
    height: 22px;
    padding: 0;
    border: 0;
    background: none;
    cursor: pointer;
    position: relative;
}

.ts-dot::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 8px;
    height: 8px;
    margin: -4px 0 0 -4px;
    border-radius: 50%;
    background: var(--line);
    transition: background .2s, transform .2s;
}

.ts-dot:hover::after { background: var(--grey-soft); }

.ts-dot.is-active::after {
    background: var(--crimson);
    transform: scale(1.3);
}

.ts-dot:focus-visible {
    outline: 2px solid var(--crimson);
    outline-offset: -2px;
    border-radius: 50%;
}

/* ─── Carousel breakpoints ───
   Mirrors the grid's cap-as-it-narrows behaviour. On phones it lands on a
   fractional 1.1 rather than a flat 1 on purpose: the sliver of the next card
   showing at the edge is what tells someone the row swipes. */

@media (max-width: 1100px) {
    .ts--carousel.ts--cols-4 { --ts-per: 3; }
}

@media (max-width: 860px) {
    .ts--carousel.ts--cols-3,
    .ts--carousel.ts--cols-4 { --ts-per: 2; }
}

@media (max-width: 640px) {
    .ts--carousel { --ts-gap: 18px; }
    .ts--carousel.ts--cols-2,
    .ts--carousel.ts--cols-3,
    .ts--carousel.ts--cols-4 { --ts-per: 1.1; }
    .ts-nav { margin-top: 26px; gap: 12px; }
}

/* Following a statement (Content With Image) inside a section band, the grid
   opens with a hairline, as on the Business Owners page. */
.is-style-section .wp-block-louisbourg-content-with-image + .ts,
.is-style-section-bone .wp-block-louisbourg-content-with-image + .ts,
.is-style-section-paper .wp-block-louisbourg-content-with-image + .ts {
    border-top: 1px solid var(--line, #e3ddd5);
    padding-top: 40px;
}
