/* TBF Fellows — front-end styles. Scoped under .tbf-fellows / .tbf-fellows-
   carousel-wrap. Brand tokens mirror the existing programme + helexpo
   plugins so the visual language is consistent. */
.tbf-fellows,
.tbf-fellows-carousel-wrap,
.tbf-modal-root.tbf-fellows-modal {
    --tbf-black:   #000;
    --tbf-text:    #555;
    --tbf-muted:   #8a8a8a;
    --tbf-border:  #e5e5e5;
    --tbf-subtle:  #f6f6f6;
    --tbf-yellow:  #FEFF06;
    --tbf-accent:  #195afe;
    --tbf-radius:  4px;
    --tbf-font:    "Roboto Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
    color: var(--tbf-black);
}
.tbf-fellows *, .tbf-fellows *::before, .tbf-fellows *::after,
.tbf-fellows-carousel-wrap *, .tbf-fellows-carousel-wrap *::before, .tbf-fellows-carousel-wrap *::after {
    box-sizing: border-box;
}

.tbf-fellows-head { margin-bottom: 22px; }
.tbf-fellows-head h2 {
    font-family: var(--tbf-font);
    font-size: 22px; font-weight: 700;
    margin: 0 0 4px;
    letter-spacing: -.01em;
}
.tbf-fellows-head .lede { color: var(--tbf-text); font-size: 14px; margin: 0 0 18px; }

.tbf-fellows-filters { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 8px; }
.tbf-fellows-filters input,
.tbf-fellows-filters select {
    padding: 9px 12px; border: 1px solid var(--tbf-border);
    border-radius: var(--tbf-radius); font: inherit; background: #fff;
    font-size: 13px;
}
.tbf-fellows-filters input { flex: 1; min-width: 200px; }
.tbf-fellows-filters select { min-width: 180px; }

/* ── Grid ──────────────────────────────────────────────────────────── */
.tbf-fellows-grid {
    list-style: none; margin: 0; padding: 0;
    display: grid; gap: 18px;
    /* `minmax(0, 1fr)` — not the shorthand `1fr` — so tracks can shrink
       below their content's intrinsic min-width. Without this, a long
       unbreakable string in one card stretches its column wider than the
       sibling. */
    grid-template-columns: repeat(4, minmax(0, 1fr));
}
.tbf-fellows-grid > li { min-width: 0; list-style: none; }
@media (max-width: 900px) { .tbf-fellows-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 600px) { .tbf-fellows-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; } }
@media (max-width: 380px) { .tbf-fellows-grid { grid-template-columns: minmax(0, 1fr); } }

.tbf-fellow-card {
    background: #fff;
    border: 1px solid var(--tbf-border);
    border-radius: 6px;
    overflow: hidden;
    cursor: pointer;
    transition: transform .15s ease, box-shadow .2s ease, border-color .15s ease;
    position: relative;
    text-align: left;
    width: 100%;
    /* `<button>` defaults to min-width: min-content. A long unbreakable
       company name (e.g. "Parasitenpresse publishing house") then forces
       the grid track wider than its sibling, breaking the equal-column
       layout. Explicit min-width: 0 lets the grid own the width. */
    min-width: 0;
    padding: 0;
    font: inherit; color: inherit;
    /* `<button>` UA defaults vertically center content; force a top-anchored
       column so photo + body align to the top of the card regardless of
       text length differences across cards. */
    display: flex; flex-direction: column;
    align-items: stretch; justify-content: flex-start;
}
.tbf-fellow-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 18px rgba(0,0,0,.08);
    border-color: var(--tbf-black);
}
.tbf-fellow-card:focus-visible {
    outline: 2px solid var(--tbf-yellow);
    outline-offset: 2px;
}

.tbf-fellow-photo {
    margin: 0; aspect-ratio: 1; overflow: hidden; background: var(--tbf-subtle);
    display: block; line-height: 0; font-size: 0;
}
.tbf-fellow-photo img {
    width: 100%; height: 100%; object-fit: cover; display: block;
}
.tbf-fellow-body { padding: 12px 14px 14px; }
.tbf-fellow-name {
    font-family: var(--tbf-font);
    font-size: 14px; font-weight: 700; margin: 0 0 3px;
    line-height: 1.25; letter-spacing: -.005em;
}
.tbf-fellow-role { font-size: 12px; color: var(--tbf-text); margin: 0 0 6px; line-height: 1.35; }
.tbf-fellow-company { font-size: 12px; color: var(--tbf-black); margin: 0; line-height: 1.35; font-weight: 600; }
.tbf-fellow-country {
    display: inline-block; font-weight: 400; color: var(--tbf-text);
    font-size: 11px; text-transform: uppercase; letter-spacing: .05em;
    margin-top: 2px;
}

.tbf-fellows-empty {
    padding: 40px 16px; text-align: center;
    color: var(--tbf-muted); font-style: italic;
}

/* ── Detail content (used by the modal) ────────────────────────────── */
.tbf-fellow-detail .detail-head {
    display: grid;
    grid-template-columns: 200px 1fr;
    gap: 24px; align-items: start;
    margin-bottom: 22px;
}
.tbf-fellow-detail .detail-head .photo {
    aspect-ratio: 1; overflow: hidden; border-radius: 6px;
    background: var(--tbf-subtle);
}
.tbf-fellow-detail .detail-head .photo img {
    width: 100%; height: 100%; object-fit: cover; display: block;
}
.tbf-fellow-detail h2 {
    font-family: var(--tbf-font);
    font-size: 26px; font-weight: 700; margin: 0 0 6px; letter-spacing: -.01em;
}
.tbf-fellow-detail .detail-meta { color: var(--tbf-text); font-size: 14px; margin: 0 0 12px; }
.tbf-fellow-detail .detail-meta strong { color: var(--tbf-black); }
.tbf-fellow-detail .detail-links {
    display: flex; gap: 14px; flex-wrap: wrap; font-size: 13px; margin-top: 10px;
}
.tbf-fellow-detail .detail-links a {
    color: var(--tbf-accent); text-decoration: none; word-break: break-all;
}
.tbf-fellow-detail .detail-links a:hover { text-decoration: underline; }
.tbf-fellow-detail h3 {
    font-family: var(--tbf-font);
    font-size: 13px; text-transform: uppercase; letter-spacing: .06em;
    color: var(--tbf-muted); font-weight: 600;
    margin: 22px 0 10px; padding-bottom: 6px;
    border-bottom: 1px solid var(--tbf-border);
}
.tbf-fellow-detail .detail-bio p,
.tbf-fellow-detail .detail-company p { margin: 0 0 12px; line-height: 1.65; font-size: 15px; }
@media (max-width: 600px) {
    .tbf-fellow-detail .detail-head { grid-template-columns: 1fr; gap: 16px; }
    .tbf-fellow-detail .detail-head .photo { max-width: 200px; }
    .tbf-fellow-detail h2 { font-size: 22px; }
}

/* ── Modal popup ───────────────────────────────────────────────────── */
.tbf-modal-root.tbf-fellows-modal { position: fixed; inset: 0; display: none; z-index: 100000; }
.tbf-modal-root.tbf-fellows-modal.open { display: block; }
.tbf-modal-root.tbf-fellows-modal .tbf-modal-backdrop {
    position: absolute; inset: 0; background: rgba(0,0,0,.6);
    animation: tbf-fade .18s ease both;
}
@keyframes tbf-fade { from { opacity: 0; } to { opacity: 1; } }
.tbf-modal-root.tbf-fellows-modal .tbf-modal {
    position: absolute; left: 50%; top: 50%;
    transform: translate(-50%, -50%);
    background: #fff;
    width: min(720px, calc(100vw - 24px));
    max-height: calc(100vh - 48px);
    overflow-y: auto; overflow-x: hidden;
    border-radius: 8px;
    box-shadow: 0 30px 80px rgba(0,0,0,.4);
    padding: 28px 28px 24px;
    animation: tbf-pop .22s cubic-bezier(.2,.8,.2,1) both;
}
@keyframes tbf-pop {
    from { opacity: 0; transform: translate(-50%, -48%) scale(.97); }
    to   { opacity: 1; transform: translate(-50%, -50%) scale(1); }
}
.tbf-modal-root.tbf-fellows-modal .tbf-modal-close {
    position: absolute; top: 10px; right: 12px;
    width: 36px; height: 36px;
    background: transparent; border: 0; font-size: 28px; line-height: 1;
    cursor: pointer; color: #666; padding: 0; border-radius: 50%;
}
.tbf-modal-root.tbf-fellows-modal .tbf-modal-close:hover { background: #f0f0f0; color: #000; }
.tbf-modal-root.tbf-fellows-modal .tbf-modal-foot {
    margin-top: 20px; padding-top: 16px;
    border-top: 1px solid var(--tbf-border);
    display: flex; gap: 12px;
    align-items: center; justify-content: center;
}
.tbf-modal-root.tbf-fellows-modal .tbf-modal-close-bottom {
    display: inline-block; padding: 10px 22px;
    background: var(--tbf-black); color: #fff; border: 0; border-radius: 4px;
    font: inherit; font-weight: 600; font-size: 13px; cursor: pointer;
}

/* Two sets of prev/next nav arrows:
   - .tbf-modal-nav--side  desktop only: siblings of .tbf-modal, anchored
     to the modal's left/right edges. Hidden on mobile (<800px).
   - .tbf-modal-nav--foot  mobile only: inline flex children of the modal
     foot, alongside the bottom Close button. Hidden on desktop. */
.tbf-modal-root.tbf-fellows-modal .tbf-modal-nav {
    width: 44px; height: 44px;
    background: var(--tbf-black); color: #fff;
    border: 0; border-radius: 50%;
    font: inherit; font-size: 26px; line-height: 1; cursor: pointer;
    display: inline-flex; align-items: center; justify-content: center;
    transition: opacity .15s ease;
    padding: 0;
}
.tbf-modal-root.tbf-fellows-modal .tbf-modal-nav:hover { opacity: .85; }

.tbf-modal-root.tbf-fellows-modal .tbf-modal-nav--side {
    position: absolute; top: 50%; transform: translateY(-50%);
    box-shadow: 0 4px 14px rgba(0,0,0,.25);
    z-index: 2;
}
@media (min-width: 800px) {
    .tbf-modal-root.tbf-fellows-modal .tbf-modal-nav--side.tbf-modal-prev { right: calc(50% + 372px); }
    .tbf-modal-root.tbf-fellows-modal .tbf-modal-nav--side.tbf-modal-next { left:  calc(50% + 372px); }
}
@media (max-width: 799px) {
    /* Hide the side arrows entirely on small screens — the foot ones take
       over so the bio text isn't covered. */
    .tbf-modal-root.tbf-fellows-modal .tbf-modal-nav--side { display: none !important; }
}

.tbf-modal-root.tbf-fellows-modal .tbf-modal-nav--foot {
    width: 38px; height: 38px; font-size: 22px;
}
@media (min-width: 800px) {
    .tbf-modal-root.tbf-fellows-modal .tbf-modal-nav--foot { display: none !important; }
}

/* ── Carousel ──────────────────────────────────────────────────────── */
.tbf-fellows-carousel-wrap { font-family: inherit; }
.tbf-fellows-carousel-head {
    display: flex; align-items: baseline; justify-content: space-between;
    gap: 12px; margin: 0 0 16px; flex-wrap: wrap;
}
.tbf-fellows-carousel-wrap h2 {
    font-family: var(--tbf-font);
    font-size: 18px; font-weight: 700; margin: 0;
}
.tbf-carousel-view-all {
    color: var(--tbf-accent); text-decoration: none;
    font-size: 13px; font-weight: 600; white-space: nowrap;
}
.tbf-carousel-view-all:hover { text-decoration: underline; }

.tbf-fellows-carousel {
    display: grid;
    grid-template-columns: 1fr auto auto 1fr;
    grid-template-rows: auto auto;
    column-gap: 8px; row-gap: 14px;
    align-items: center;
}
.tbf-fellows-carousel-track {
    grid-column: 1 / -1; grid-row: 1;
    display: grid; grid-auto-flow: column;
    grid-auto-columns: calc((100% - 4 * 14px) / 5);
    gap: 14px;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    scroll-behavior: smooth;
    scrollbar-width: none;
    padding-bottom: 4px;
}
.tbf-fellows-carousel-track::-webkit-scrollbar { display: none; }
@media (max-width: 900px) { .tbf-fellows-carousel-track { grid-auto-columns: calc((100% - 2 * 14px) / 3); } }
@media (max-width: 600px) { .tbf-fellows-carousel-track { grid-auto-columns: calc((100% - 1 * 14px) / 2); } }
@media (max-width: 380px) { .tbf-fellows-carousel-track { grid-auto-columns: 100%; } }

.tbf-fellow-mini {
    scroll-snap-align: start;
    background: #fff;
    border: 1px solid var(--tbf-border);
    border-radius: 6px;
    /* Inset padding gives the photo breathing room from the card border on
       all sides (mirrors how a polaroid card looks). */
    padding: 12px 12px 0;
    cursor: pointer;
    text-align: left; width: 100%;
    /* `<button>` defaults: see .tbf-fellow-card for the same explanation. */
    min-width: 0;
    font: inherit; color: inherit;
    transition: border-color .15s, box-shadow .15s;
    display: flex; flex-direction: column;
    align-items: stretch; justify-content: flex-start;
}
.tbf-fellow-mini:hover { border-color: var(--tbf-black); box-shadow: 0 4px 14px rgba(0,0,0,.08); }
.tbf-fellow-mini .photo {
    aspect-ratio: 1; overflow: hidden; background: var(--tbf-subtle);
    display: block; line-height: 0; font-size: 0;
    border-radius: 4px;
}
.tbf-fellow-mini .photo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.tbf-fellow-mini .body { padding: 10px 0 12px; }
.tbf-fellow-mini h4 {
    font-family: var(--tbf-font);
    font-size: 13px; font-weight: 700; margin: 0 0 3px; line-height: 1.25;
}
.tbf-fellow-mini .meta { font-size: 11px; color: var(--tbf-text); margin: 0; line-height: 1.35; }

.tbf-carousel-arrow {
    width: 38px; height: 38px;
    border-radius: 50%; border: 0;
    background: var(--tbf-black); color: #fff;
    font: inherit; font-size: 22px; line-height: 1;
    cursor: pointer;
    display: inline-flex; align-items: center; justify-content: center;
    padding: 0;
}
.tbf-carousel-arrow:hover  { background: #333; }
.tbf-carousel-arrow[disabled] { opacity: .3; cursor: default; }
.tbf-fellows-carousel .tbf-carousel-prev { grid-column: 2; grid-row: 2; }
.tbf-fellows-carousel .tbf-carousel-next { grid-column: 3; grid-row: 2; }
