/* Community theme: competitions (layout/competitions). Colors follow the color styles; the second
   value in each var() is what shows when no style is chosen. */

.bm-comp {
    --c-ink: var(--bms-ink, #14212a);
    --c-muted: var(--bms-muted, #5a6b75);
    --c-line: var(--bms-line, #d5dee3);
    --c-card: var(--bms-card, #ffffff);
    --c-sunken: var(--bms-sunken, #f1f5f6);
    --c-accent: var(--bms-primary, #0f766e);
    --c-on-accent: var(--bms-on-primary, #ffffff);
    --c-link: var(--bms-link, #0f766e);
    --c-radius: var(--bms-radius, 10px);
    --c-gold: #b7791f;
    --c-silver: #71808c;
    --c-bronze: #a0522d;
    --c-warn: #b45309;
    --c-bad: #b42318;
    color: var(--c-ink);
}

.bm-comp *,
.bm-comp *::before,
.bm-comp *::after {
    box-sizing: border-box;
}

.bm-comp a:focus-visible,
.bm-comp button:focus-visible,
.bm-comp input:focus-visible,
.bm-comp select:focus-visible,
.bm-comp textarea:focus-visible,
.bm-comp summary:focus-visible {
    outline: 2px solid var(--c-link);
    outline-offset: 2px;
}

.bm-comp h1,
.bm-comp h2,
.bm-comp h3,
.bm-comp h4 {
    margin: 0;
    color: var(--c-ink);
    font-family: inherit;
    line-height: 1.25;
    overflow-wrap: anywhere;
}

.bm-comp h1 { font-size: 26px; font-weight: 700; }
.bm-comp h2 { font-size: 19px; font-weight: 700; }
.bm-comp h3 { font-size: 16px; font-weight: 700; }
.bm-comp p { margin: 0; }

.bm-comp .c-eyebrow {
    display: block;
    margin-bottom: 4px;
    color: var(--c-link);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .08em;
    text-transform: uppercase;
}

.bm-comp .c-muted { color: var(--c-muted); }
.bm-comp .c-small { font-size: 13px; }
.bm-comp .c-stack > * + * { margin-top: 12px; }
.bm-comp .c-block { padding: 16px; margin-bottom: 14px; }
.bm-comp .c-block > h2 { margin-bottom: 10px; }
.bm-comp .c-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.bm-comp .c-between { justify-content: space-between; }
.bm-comp .c-grow { flex: 1 1 220px; min-width: 0; }

/* Page head */
.bm-comp .c-head {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    padding: 16px;
}

.bm-comp .c-head .c-sub { margin-top: 4px; color: var(--c-muted); max-width: 60ch; }

/* Buttons that are not the theme's own */
.bm-comp .c-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 36px;
    padding: 6px 14px;
    border: 1px solid var(--c-line);
    border-radius: 8px;
    background: var(--c-card);
    color: var(--c-ink);
    font: inherit;
    font-size: 14px;
    font-weight: 600;
    line-height: 1.2;
    text-decoration: none;
    cursor: pointer;
}

.bm-comp .c-btn:hover { border-color: var(--c-accent); color: var(--c-ink); text-decoration: none; }
.bm-comp .c-btn.is-primary { background: var(--c-accent); border-color: var(--c-accent); color: var(--c-on-accent); }
.bm-comp .c-btn.is-primary:hover { filter: brightness(1.08); color: var(--c-on-accent); }
.bm-comp .c-btn.is-danger { color: var(--c-bad); }
.bm-comp .c-btn[disabled] { opacity: .55; cursor: not-allowed; }

/* Phase and status chips */
.bm-comp .c-chip {
    display: inline-block;
    padding: 2px 10px;
    border: 1px solid var(--c-line);
    border-radius: 999px;
    background: var(--c-sunken);
    color: var(--c-ink);
    font-size: 12px;
    font-weight: 600;
    line-height: 1.6;
    white-space: nowrap;
}

.bm-comp .c-chip.is-live { background: var(--c-accent); border-color: var(--c-accent); color: var(--c-on-accent); }
.bm-comp .c-chip.is-warn { border-color: var(--c-warn); color: var(--c-warn); }
.bm-comp .c-chip.is-bad { border-color: var(--c-bad); color: var(--c-bad); }

/* Filters */
.bm-comp .c-filters { display: flex; flex-wrap: wrap; gap: 8px; padding: 12px 16px; align-items: center; }
.bm-comp .c-filters .form-control { width: auto; min-width: 140px; flex: 1 1 140px; }
.bm-comp .c-tabs { display: flex; gap: 4px; }
.bm-comp .c-tabs a {
    padding: 6px 14px;
    border-radius: 999px;
    color: var(--c-muted);
    font-weight: 600;
    text-decoration: none;
}
.bm-comp .c-tabs a.is-on { background: var(--c-accent); color: var(--c-on-accent); }

/* Competition cards */
.bm-comp .c-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.bm-comp .c-card { display: flex; flex-direction: column; overflow: hidden; padding: 0; text-decoration: none; color: var(--c-ink); }
.bm-comp .c-card:hover { text-decoration: none; color: var(--c-ink); box-shadow: 0 2px 12px rgba(0, 0, 0, .12); }
.bm-comp .c-card-img {
    aspect-ratio: 16 / 9;
    background: var(--c-sunken) center / cover no-repeat;
    border-bottom: 1px solid var(--c-line);
    display: flex;
    align-items: flex-end;
    padding: 8px;
}
.bm-comp .c-card-img.is-empty {
    background-image:
        linear-gradient(var(--c-line) 1px, transparent 1px),
        linear-gradient(90deg, var(--c-line) 1px, transparent 1px);
    background-size: 20px 20px;
}
.bm-comp .c-card-body { padding: 12px 14px 14px; display: flex; flex-direction: column; gap: 6px; flex: 1; }
.bm-comp .c-card-body h3 { font-size: 16px; }
.bm-comp .c-card-meta { margin-top: auto; display: flex; flex-wrap: wrap; gap: 6px; padding-top: 6px; }

/* Phase timeline */
.bm-comp .c-timeline { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0; margin: 0; padding: 0; list-style: none; }
.bm-comp .c-timeline li {
    position: relative;
    padding: 10px 8px 0;
    border-top: 4px solid var(--c-line);
    font-size: 13px;
    color: var(--c-muted);
}
.bm-comp .c-timeline li b { display: block; color: var(--c-ink); font-size: 14px; }
.bm-comp .c-timeline li.is-done { border-top-color: var(--c-accent); }
.bm-comp .c-timeline li.is-now { border-top-color: var(--c-accent); color: var(--c-ink); }
.bm-comp .c-timeline li.is-now::before {
    content: "";
    position: absolute;
    top: -9px;
    left: 8px;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--c-accent);
    box-shadow: 0 0 0 3px var(--c-card);
}

/* Hero */
.bm-comp .c-hero { overflow: hidden; padding: 0; margin-bottom: 14px; }
.bm-comp .c-hero-img { aspect-ratio: 21 / 8; background: var(--c-sunken) center / cover no-repeat; border-bottom: 1px solid var(--c-line); }
.bm-comp .c-hero-body { padding: 16px; display: flex; flex-direction: column; gap: 10px; }
.bm-comp .c-facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
.bm-comp .c-fact { padding: 10px 12px; border: 1px solid var(--c-line); border-radius: 8px; background: var(--c-sunken); }
.bm-comp .c-fact span { display: block; font-size: 12px; color: var(--c-muted); }
.bm-comp .c-fact b { font-size: 16px; overflow-wrap: anywhere; }

/* Podium */
.bm-comp .c-podium { display: grid; grid-template-columns: 1fr 1.12fr 1fr; gap: 10px; align-items: end; margin: 8px 0 14px; }
.bm-comp .c-pod {
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    min-width: 0;
    border: 1px solid var(--c-line);
    border-top-width: 5px;
    border-radius: 8px 8px 0 0;
    background: var(--c-card);
    text-align: center;
    padding: 10px 8px;
    color: var(--c-ink);
    text-decoration: none;
}
.bm-comp .c-pod:hover { text-decoration: none; color: var(--c-ink); }
.bm-comp .c-pod.p1 { border-top-color: var(--c-gold); min-height: 190px; }
.bm-comp .c-pod.p2 { border-top-color: var(--c-silver); min-height: 150px; }
.bm-comp .c-pod.p3 { border-top-color: var(--c-bronze); min-height: 120px; }
.bm-comp .c-pod .c-place { font-size: 34px; font-weight: 800; line-height: 1; }
.bm-comp .c-pod.p1 .c-place { color: var(--c-gold); }
.bm-comp .c-pod.p2 .c-place { color: var(--c-silver); }
.bm-comp .c-pod.p3 .c-place { color: var(--c-bronze); }
.bm-comp .c-pod img { width: 100%; max-height: 90px; object-fit: cover; border-radius: 6px; margin-bottom: 8px; }
.bm-comp .c-pod .c-name { font-weight: 700; overflow-wrap: anywhere; }
.bm-comp .c-pod .c-who { font-size: 13px; color: var(--c-muted); overflow-wrap: anywhere; }
.bm-comp .c-pod .c-prize { font-size: 13px; font-weight: 700; margin-top: 4px; overflow-wrap: anywhere; }
.bm-comp .c-pod.is-empty { border-style: dashed; color: var(--c-muted); }

@media (max-width: 560px) {
    .bm-comp .c-podium { grid-template-columns: 1fr; }
    .bm-comp .c-pod.p1, .bm-comp .c-pod.p2, .bm-comp .c-pod.p3 { min-height: 0; border-radius: 8px; }
    .bm-comp .c-podium .p1 { order: 1; }
    .bm-comp .c-podium .p2 { order: 2; }
    .bm-comp .c-podium .p3 { order: 3; }
    .bm-comp .c-timeline { grid-template-columns: repeat(2, minmax(0, 1fr)); row-gap: 12px; }
}

/* Entry gallery */
.bm-comp .c-gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; }
.bm-comp .c-entry { overflow: hidden; padding: 0; color: var(--c-ink); text-decoration: none; display: flex; flex-direction: column; }
.bm-comp .c-entry:hover { text-decoration: none; color: var(--c-ink); box-shadow: 0 2px 12px rgba(0, 0, 0, .12); }
.bm-comp .c-entry-img { aspect-ratio: 4 / 3; background: var(--c-sunken) center / cover no-repeat; }
.bm-comp .c-entry-body { padding: 8px 10px 10px; }
.bm-comp .c-entry-body b { display: block; overflow-wrap: anywhere; }

/* Entry viewer */
.bm-comp .c-viewer { position: relative; background: #0d141a; border-radius: var(--c-radius); overflow: hidden; }
.bm-comp .c-viewer-stage { display: flex; align-items: center; justify-content: center; min-height: 260px; max-height: 70vh; overflow: auto; }
.bm-comp .c-viewer-stage img { display: block; max-width: 100%; transform-origin: center; transition: transform .15s; cursor: zoom-in; }
.bm-comp .c-viewer.is-zoom .c-viewer-stage img { cursor: zoom-out; }
.bm-comp .c-viewer-bar { display: flex; flex-wrap: wrap; gap: 6px; padding: 8px; background: rgba(0, 0, 0, .55); }
.bm-comp .c-viewer-bar button {
    min-height: 32px;
    padding: 4px 12px;
    border: 1px solid rgba(255, 255, 255, .4);
    border-radius: 6px;
    background: transparent;
    color: #fff;
    font: inherit;
    font-size: 13px;
    cursor: pointer;
}
.bm-comp .c-viewer-bar button:hover { background: rgba(255, 255, 255, .15); }
.bm-comp .c-thumbs { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.bm-comp .c-thumbs button { padding: 0; border: 2px solid transparent; border-radius: 6px; overflow: hidden; width: 64px; height: 48px; background: var(--c-sunken) center / cover no-repeat; cursor: pointer; }
.bm-comp .c-thumbs button.is-on { border-color: var(--c-accent); }
.bm-comp .c-viewer:fullscreen { display: flex; flex-direction: column; border-radius: 0; }
.bm-comp .c-viewer:fullscreen .c-viewer-stage { max-height: none; flex: 1; }

/* Before and after */
.bm-comp .c-ba { position: relative; overflow: hidden; border-radius: var(--c-radius); background: var(--c-sunken); user-select: none; }
.bm-comp .c-ba img { display: block; width: 100%; height: auto; }
.bm-comp .c-ba .c-ba-top { position: absolute; inset: 0; clip-path: inset(0 50% 0 0); }
.bm-comp .c-ba .c-ba-top img { height: 100%; object-fit: cover; }
.bm-comp .c-ba .c-ba-line { position: absolute; top: 0; bottom: 0; left: 50%; width: 3px; margin-left: -1px; background: #fff; box-shadow: 0 0 4px rgba(0, 0, 0, .6); pointer-events: none; }
.bm-comp .c-ba input[type=range] { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: ew-resize; margin: 0; }
.bm-comp .c-ba .c-ba-tag { position: absolute; top: 8px; padding: 2px 8px; border-radius: 4px; background: rgba(0, 0, 0, .6); color: #fff; font-size: 12px; pointer-events: none; }
.bm-comp .c-ba .c-ba-tag.l { left: 8px; }
.bm-comp .c-ba .c-ba-tag.r { right: 8px; }

.bm-comp .c-video { position: relative; aspect-ratio: 16 / 9; border-radius: var(--c-radius); overflow: hidden; background: #000; }
.bm-comp .c-video iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }

/* Forms */
.bm-comp .c-form label { display: block; margin: 0 0 4px; font-size: 13px; font-weight: 700; }
.bm-comp .c-form .c-field { margin-bottom: 14px; }
.bm-comp .c-form .c-hint { display: block; margin-top: 4px; font-size: 12.5px; color: var(--c-muted); }
.bm-comp .c-form .form-control, .bm-comp .c-form textarea, .bm-comp .c-form select { width: 100%; }
.bm-comp .c-form .c-two { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; }
.bm-comp .c-form fieldset { border: 1px solid var(--c-line); border-radius: 8px; padding: 12px 14px 4px; margin: 0 0 14px; min-width: 0; }
.bm-comp .c-form legend { width: auto; margin: 0; padding: 0 6px; border: 0; font-size: 13px; font-weight: 700; }
.bm-comp .c-check { display: flex; gap: 8px; align-items: flex-start; font-weight: 400 !important; }
.bm-comp .c-check input { margin-top: 4px; }
.bm-comp .c-pool { background: var(--c-sunken); border: 1px solid var(--c-line); border-radius: 8px; padding: 12px 14px; }
.bm-comp .c-pool b { font-size: 20px; }

/* Tables */
.bm-comp .c-table-wrap { overflow-x: auto; }
.bm-comp .c-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.bm-comp .c-table th, .bm-comp .c-table td { padding: 8px 10px; border-bottom: 1px solid var(--c-line); text-align: left; vertical-align: top; }
.bm-comp .c-table th { font-size: 12px; font-weight: 700; color: var(--c-muted); text-transform: uppercase; letter-spacing: .04em; }

/* Notices */
.bm-comp .c-note { padding: 10px 14px; border-radius: 8px; border-left: 4px solid var(--c-accent); background: var(--c-sunken); }
.bm-comp .c-note.is-warn { border-left-color: var(--c-warn); }
.bm-comp .c-note.is-bad { border-left-color: var(--c-bad); }
.bm-comp .c-status { min-height: 20px; margin-top: 8px; font-size: 14px; }
.bm-comp .c-status.is-bad { color: var(--c-bad); }
.bm-comp .c-status.is-ok { color: var(--c-accent); }

.bm-comp .c-score input[type=number] { width: 64px; }
.bm-comp .c-score-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 10px; }

.bm-comp .c-compare { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 700px) { .bm-comp .c-compare { grid-template-columns: 1fr; } }

.bm-comp .c-trophy { display: flex; gap: 10px; align-items: center; padding: 10px 12px; border: 1px solid var(--c-line); border-radius: 8px; background: var(--c-card); }
.bm-comp .c-trophy .c-medal { flex: none; width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; color: #fff; }
.bm-comp .c-medal.m1 { background: var(--c-gold); }
.bm-comp .c-medal.m2 { background: var(--c-silver); }
.bm-comp .c-medal.m3 { background: var(--c-bronze); }
.bm-comp .c-medal.m0 { background: var(--c-accent); }

/* Numbers, backers and the theme */
.bm-comp .c-bars { display: flex; align-items: flex-end; gap: 2px; height: 64px; padding: 4px; border: 1px solid var(--c-line); border-radius: 8px; background: var(--c-sunken); }
.bm-comp .c-bars span { flex: 1 1 0; min-width: 2px; background: var(--c-accent); border-radius: 2px 2px 0 0; }
.bm-comp .c-backers { list-style: none; margin: 0 0 8px; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.bm-comp .c-theme-text { font-size: 28px; font-weight: 800; line-height: 1.2; margin: 6px 0; }

@media (prefers-reduced-motion: reduce) {
    .bm-comp * { transition: none !important; }
}

@media print {
    .bm-cert-page .no-print { display: none !important; }
}

/* Voting hub: how far a member has got in a competition's categories. */
.bm-comp .c-meter { height: 8px; border-radius: 4px; background: var(--c-line, rgba(0, 0, 0, .12)); overflow: hidden; }
.bm-comp .c-meter span { display: block; height: 100%; background: var(--c-accent); }
