/* Share cards (js/share-cards.js, Helpers/ShareCards.cs): the Share chip on a finished heat card, the Share button in
   the heat's dialog, the sheet (whose card, three styles, Share and Save image), and a card's own page (/c/{code}). */

/* ---- Share as a round icon (the site's share icon, as in "Share this event"): beside DONE on a finished heat card,
   in "Last Heat Results" and on each champion. The word is in its label and tooltip (2026-11-02: the outline pill
   with a box-and-arrow looked bolted on, and pushed the champions' division names onto two lines). */
.hc-share {
    position: relative; display: inline-grid; place-items: center; flex-shrink: 0; margin-left: auto;
    width: 32px; height: 32px; padding: 0; border: 0; border-radius: 50%; background: var(--ag-tint); color: var(--ag-deep);
    font-size: 15px; line-height: 1; cursor: pointer; transition: background-color 0.15s, color 0.15s;
}
.hc-share .bi { display: block; line-height: 1; }
.hc-share .bi::before { display: block; vertical-align: 0; }
.hc-share::after { content: ""; position: absolute; inset: -6px; } /* a finger-sized target */
.hc-share:hover { background: var(--ag-deep); color: #FFFFFF; }
.hc-share:focus-visible { outline: 2px solid var(--ag-cyan); outline-offset: 2px; }

/* "Last Heat Results": at the header's end; on a phone beside the title, the heat's name on the line below */
.lhr-share { width: 34px; height: 34px; }
@media (max-width: 559px) {
    .lhr-header:has(.lhr-share) .lhr-heat-info { order: 2; flex-basis: 100%; }
}

/* a champion: gold, like the card it sits on */
.champ-share { width: 34px; height: 34px; background: rgba(255, 255, 255, 0.8); color: #B45309; box-shadow: inset 0 0 0 1px #FDE68A; }
.champ-share:hover { background: #D97706; color: #FFFFFF; box-shadow: none; }

/* ---- Share in the heat's dialog */
.hdm-head > div:first-child { flex: 1; min-width: 0; }
.hdm-share {
    display: inline-flex; align-items: center; gap: 6px; flex-shrink: 0; min-height: 40px; padding: 0 14px;
    border: 1px solid var(--ag-line); border-radius: 999px; background: #FFFFFF; color: var(--ag-deep);
    font-family: var(--ag-font-body); font-size: 15px; font-weight: 700; cursor: pointer;
}
.hdm-share:hover { background: var(--ag-tint); border-color: var(--ag-arc); }
.hdm-share[hidden] { display: none; }

/* ---- the sheet: from the bottom on a phone, a dialog in the middle on a computer */
.scs-backdrop { position: fixed; inset: 0; z-index: 10000; background: rgba(6, 47, 56, 0.55); opacity: 0; transition: opacity 0.2s; }
.scs-backdrop.show { opacity: 1; }
/* --card: a surfer's card (4:5), which sets the stage's height; --slide: the card showing (the whole heat's is wider).
   Switching between a name and the whole heat changes the picture only: the sheet keeps its size, so the names and
   buttons stay under the finger (2026-11-02: it used to shrink by 160 px and jump). */
.scs {
    --card: min(68vw, 290px); --slide: var(--card);
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 10001;
    max-height: 94vh; max-height: 94dvh; overflow-y: auto; overscroll-behavior: contain;
    padding: 8px 0 calc(18px + env(safe-area-inset-bottom));
    border-radius: 24px 24px 0 0; background: #FFFFFF; color: var(--ag-ink);
    box-shadow: 0 -12px 40px rgba(6, 47, 56, 0.25);
    transform: translateY(100%); transition: transform 0.28s cubic-bezier(0.2, 0.8, 0.2, 1);
    font-family: var(--ag-font-body);
}
.scs.show { transform: translateY(0); }
.scs--wide { --slide: min(84vw, 380px); }
.scs:focus { outline: none; }
.scs__grab { width: 40px; height: 5px; margin: 0 auto 10px; border-radius: 3px; background: var(--ag-line); }
.scs__head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 0 16px; }
.scs__title { margin: 0; font-family: var(--ag-font-display); font-size: 17px; font-weight: 600; line-height: 1.3; }
.scs__close {
    width: 40px; height: 40px; flex-shrink: 0; border: 0; border-radius: 50%; background: var(--ag-tint);
    color: var(--ag-deep); font-size: 22px; line-height: 40px; cursor: pointer;
}
/* every name in full: the chips wrap to a second line rather than scroll out of sight */
.scs__who { display: flex; flex-wrap: wrap; gap: 8px; padding: 12px 16px 2px; }
.scs__who[hidden] { display: none; }
.scs__chip {
    flex: none; max-width: 100%; min-height: 40px; padding: 0 15px; border: 1px solid var(--ag-line); border-radius: 999px; background: #FFFFFF;
    color: var(--ag-deep); font-family: inherit; font-size: 14px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; cursor: pointer;
}
.scs__chip[aria-checked="true"] { border-color: var(--ag-deep); background: var(--ag-deep); color: #FFFFFF; }
/* the names' outline while they load */
.scs__chip--sk { width: 8em; border-color: transparent; background: var(--ag-tint); cursor: default; animation: scs-pulse 1s ease-in-out infinite alternate; }
.scs__chip--sk:first-child { width: 6.5em; }
.scs__chip--sk:last-child { width: 9.5em; }
@keyframes scs-pulse { from { opacity: 0.55; } to { opacity: 1; } }
.scs__track {
    display: flex; align-items: center; gap: 14px; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none;
    box-sizing: content-box; height: calc(var(--card) * 1.25);
    padding: 14px calc(50% - var(--slide) / 2) 16px;
}
.scs__track::-webkit-scrollbar { display: none; }
.scs__track:focus-visible { outline: 2px solid var(--ag-cyan); outline-offset: -2px; }
.scs__slide {
    position: relative; flex: none; width: var(--slide); margin: 0; scroll-snap-align: center;
    opacity: 0.55; transform: scale(0.92); transition: opacity 0.2s, transform 0.2s;
}
.scs__slide.is-on { opacity: 1; transform: none; }
.scs__slide img {
    display: block; width: 100%; height: auto; border-radius: 14px; background: var(--ag-tint);
    box-shadow: 0 10px 26px rgba(6, 47, 56, 0.22);
}
/* while a card is being drawn: a soft shimmer where it will be */
.scs__slide img.is-loading {
    background: linear-gradient(100deg, var(--ag-tint) 30%, #FFFFFF 50%, var(--ag-tint) 70%) 0 0 / 300% 100%;
    animation: scs-shimmer 1.4s ease-in-out infinite;
}
@keyframes scs-shimmer { from { background-position: 100% 0; } to { background-position: 0 0; } }
/* a picture that didn't come after three tries: say so, and a tap tries again */
.scs__retry { display: none; }
.scs__slide img { aspect-ratio: 4 / 5; }
.scs--wide .scs__slide img { aspect-ratio: 1200 / 630; }
.scs__slide.is-failed .scs__retry {
    position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; padding: 16px;
    border: 1px dashed var(--ag-line); border-radius: 14px; background: var(--ag-tint); color: var(--ag-deep);
    font-family: inherit; font-size: 14px; font-weight: 700; line-height: 1.35; text-align: center; cursor: pointer;
}
/* the cards didn't load at all: the reason and Try again, in place of the cards */
.scs__fail { padding: 28px 20px 8px; text-align: center; }
.scs__fail[hidden] { display: none; }
.scs__fail p { margin: 0 0 16px; font-size: 16px; line-height: 1.45; color: var(--ag-ink); }
.scs--failed .scs__who, .scs--failed .scs__track, .scs--failed .scs__nav, .scs--failed .scs__acts, .scs--failed .scs__fine { display: none; }
.scs__nav { display: flex; align-items: center; justify-content: center; gap: 18px; }
.scs__arrow {
    width: 40px; height: 40px; border: 1px solid var(--ag-line); border-radius: 50%; background: #FFFFFF;
    color: var(--ag-deep); font-size: 26px; line-height: 1; cursor: pointer;
}
.scs__arrow:disabled { opacity: 0.35; cursor: default; }
.scs__dots { display: flex; flex-direction: column; align-items: center; gap: 6px; min-width: 120px; }
.scs__label { font-size: 15px; font-weight: 700; color: var(--ag-ink); }
.scs__dots span { display: flex; gap: 6px; }
.scs__dots i { width: 7px; height: 7px; border-radius: 4px; background: var(--ag-line); transition: width 0.2s, background-color 0.2s; }
.scs__dots i.on { width: 20px; background: var(--ag-deep); }
.scs__acts { display: flex; gap: 10px; padding: 16px 16px 0; }
.scs__acts .ag-btn { flex: 1; min-height: 52px; padding: 0 14px; font-size: 17px; }
.scs__acts .ag-btn svg { flex-shrink: 0; }
.scs__acts .ag-btn:disabled { opacity: 0.5; cursor: default; }
.scs__menu { display: flex; gap: 10px; padding: 10px 16px 0; }
.scs__menu[hidden] { display: none; }
.scs__menu button {
    flex: 1; min-height: 44px; border: 1px solid var(--ag-line); border-radius: 12px; background: var(--ag-tint);
    color: var(--ag-deep); font-family: inherit; font-size: 15px; font-weight: 700; cursor: pointer;
}
.scs__fine { margin: 12px 16px 0; text-align: center; font-size: 13px; color: var(--ag-muted); }
.scs__note { margin: 8px 16px 0; text-align: center; font-size: 14px; font-weight: 600; color: var(--ag-deep); }
.scs__note[hidden] { display: none; }
/* a message's own button (Save it, Open it) */
.scs__note-act {
    min-height: 36px; margin-left: 4px; padding: 0 14px; border: 1px solid var(--ag-deep); border-radius: 999px; background: var(--ag-deep);
    color: #FFFFFF; font-family: inherit; font-size: 14px; font-weight: 700; cursor: pointer;
}

/* Save image: which size */
.scs__pick { position: absolute; left: 10px; right: 10px; bottom: calc(12px + env(safe-area-inset-bottom)); z-index: 2; display: flex; flex-direction: column; gap: 8px; }
.scs__pick[hidden] { display: none; }
.scs__pick::before { content: ""; position: fixed; inset: -100vh 0 0; z-index: -1; background: rgba(6, 47, 56, 0.35); }
.scs__pick-box { overflow: hidden; border-radius: 16px; background: #FFFFFF; box-shadow: 0 10px 30px rgba(6, 47, 56, 0.3); }
.scs__pick-box button {
    display: flex; align-items: center; gap: 14px; width: 100%; min-height: 64px; padding: 12px 18px;
    border: 0; border-top: 1px solid var(--ag-line-2); background: #FFFFFF; color: var(--ag-ink);
    font-family: inherit; font-size: 16px; font-weight: 700; text-align: left; cursor: pointer;
}
.scs__pick-box button:first-child { border-top: 0; }
.scs__pick-box small { display: block; margin-top: 2px; font-size: 13px; font-weight: 500; color: var(--ag-muted); }
.scs__shape { flex: none; border: 2px solid var(--ag-deep); border-radius: 4px; }
.scs__shape--post { width: 20px; height: 25px; }
.scs__shape--story { width: 16px; height: 28px; }
.scs__pick-cancel {
    min-height: 56px; border: 0; border-radius: 16px; background: #FFFFFF; color: var(--ag-deep);
    font-family: inherit; font-size: 16px; font-weight: 700; cursor: pointer; box-shadow: 0 10px 30px rgba(6, 47, 56, 0.3);
}

@media (min-width: 640px) {
    .scs {
        --card: 280px;
        left: 50%; right: auto; bottom: auto; top: 50%; width: 500px; max-height: 92vh; max-height: 92dvh;
        padding-bottom: 20px; border-radius: 24px;
        transform: translate(-50%, -46%); opacity: 0; transition: transform 0.22s, opacity 0.22s;
    }
    .scs.show { transform: translate(-50%, -50%); opacity: 1; }
    .scs--wide { --slide: 400px; }
    .scs__grab { display: none; }
    .scs__head { padding-top: 10px; }
}
@media (prefers-reduced-motion: reduce) {
    .scs, .scs-backdrop, .scs__slide { transition: none; }
    .scs__slide img.is-loading, .scs__chip--sk { animation: none; }
}

/* ---- a card's own page */
.scard__wrap { display: grid; gap: 28px; align-items: center; }
.scard__figure { margin: 0 auto; width: 100%; max-width: 420px; }
.scard__figure--wide { max-width: 640px; }
.scard__figure img { display: block; width: 100%; height: auto; border-radius: 18px; background: var(--ag-tint); box-shadow: 0 18px 40px rgba(6, 47, 56, 0.2); }
.scard__event { margin: 0 0 6px; font-size: 14px; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ag-cyan-ink); }
.scard__title { margin: 0 0 8px; font-family: var(--ag-font-display); font-size: clamp(24px, 3.2vw, 34px); font-weight: 600; line-height: 1.25; overflow-wrap: anywhere; }
.scard__meta { margin: 0 0 22px; font-size: 16px; color: var(--ag-text); }
.scard__actions { display: flex; flex-wrap: wrap; gap: 12px; }
.scard__styles { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; margin-top: 22px; font-size: 15px; color: var(--ag-muted); }
.scard__styles a { color: var(--ag-cyan-ink); font-weight: 700; text-decoration: none; }
.scard__styles a:hover { text-decoration: underline; }
.scard__styles a[aria-current="page"] { color: var(--ag-ink); text-decoration: underline; text-underline-offset: 4px; }
.scard__save { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; margin-top: 16px; font-size: 15px; color: var(--ag-muted); }
.scard__save[hidden] { display: none; }
.scard__save button {
    min-height: 40px; padding: 0 16px; border: 1px solid var(--ag-line); border-radius: 999px; background: #FFFFFF;
    color: var(--ag-deep); font-family: inherit; font-size: 15px; font-weight: 700; cursor: pointer;
}
.scard__save button:hover { background: var(--ag-tint); border-color: var(--ag-arc); }
.scard__heat { margin: 14px 0 0; font-size: 15px; }
.scard__heat a { color: var(--ag-cyan-ink); font-weight: 700; }
.scard__note { margin-top: 12px; font-weight: 600; color: var(--ag-deep); }
.scard__note[hidden] { display: none; }
@media (min-width: 900px) {
    .scard__wrap { grid-template-columns: minmax(0, 420px) minmax(0, 1fr); gap: 56px; }
    .scard__wrap:has(.scard__figure--wide) { grid-template-columns: minmax(0, 600px) minmax(0, 1fr); }
    .scard__figure { margin: 0; }
}
@media (max-width: 480px) {
    .scard__actions .ag-btn { width: 100%; }
}
