/* Shared FocusChrist pill system. Paint and type only; component layout, wording,
   dimensions, destinations and interactions stay with the original component. */
:root {
    --fcp-ink: #fff5df;
    --fcp-rim: #b29c73;
    --fcp-rim-bright: #e4c88c;
    --fcp-focus: #fff0ba;
    --fcp-standard: radial-gradient(ellipse at 3% -38%,#fff1c812,transparent 38%),
    linear-gradient(115deg,color-mix(in oklab,#3f9272 84%,#143f34),
      #246a51 29%,#143f34 83%,#1b5745);
    --fcp-reading: radial-gradient(ellipse at 3% -38%,#fff1c812,transparent 38%),
    linear-gradient(115deg,color-mix(in oklab,#4085b8 84%,#173652),
      #245c87 29%,#173652 83%,#18446d);
    --fcp-ask: radial-gradient(ellipse at 3% -38%,#fff1c812,transparent 38%),
    linear-gradient(115deg,color-mix(in oklab,#3b9e98 84%,#163f57),
      #226e77 29%,#163f57 83%,#226379);
    --fcp-view: radial-gradient(ellipse at 8% -32%,#f3e1c00d,transparent 64%),
    linear-gradient(115deg,#294653,#294653 11%,#19343e 34%,#142c38 84%,#162e3b);
    --fcp-gold: radial-gradient(ellipse at 12% -35%,#fff8db81,transparent 58%),
    linear-gradient(119deg,#fff0ba,#f4daa0 31%,#dcb568 71%,#b68a3f);
    --fcp-gold-ink: #302314;
    --fcp-keyline: linear-gradient(128deg,#e4c88c,#887049);
    --fcp-pressed-shadow: inset 0 1px 4px #07162161;
    --fcp-face: -apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,"Helvetica Neue",Arial,sans-serif;
}
/* Fired Enamel functional color registry. All inference selectors are :where()
   so later roles win regardless of selector shape, text, DOM order, or width.
   Priority (low -> high): internal study, sources, inquiry, artwork, explicit
   progression. Component-declared roles take precedence over inferred href
   roles; the Close paint rule below is final for actual dismissal controls. */
:where(
    a:is([href^="https://"],[href^="http://"],[href^="//"]):not(
        [href^="https://focuschrist.com/"],[href^="http://focuschrist.com/"],
        [href^="https://www.focuschrist.com/"],[href^="http://www.focuschrist.com/"],
        [href^="//focuschrist.com/"],[href^="//www.focuschrist.com/"]),
    [data-hero-source-link][href],#artworkDetailSource,#missionaryDetailSource,
    [data-topic-art-source],[data-art-picture-source],.fc-inline-scripture,.fc-scripture-source
) {
    --fcp-surface: var(--fcp-reading);
    --fcp-edge: #b3a77d;
}
:where(
    [data-hero-study-link],#artworkDetailStudy,[data-art-focus-study],
    #topicArtworkDetailDialog .fc-artwork-detail-actions
        > a:first-child:not([data-topic-art-source],[data-full-image-viewer],[data-topic-art-continue]):has(~ [data-full-image-viewer])
) { --fcp-surface: var(--fcp-standard); }
:where(
    [data-hero-ask-link],[data-artwork-detail-ask],[data-art-ask],.ask-action,
    #sendBtn,.view-btn,.ask-topic-toggle,.ask-followup-button,#historySendBtn,.fc-search-trigger,
    a:is([href="ask.html"],[href$="/ask.html"],[href^="ask.html?"],[href^="ask.html#"],
         [href*="/ask.html?"],[href*="/ask.html#"])
) {
    --fcp-surface: var(--fcp-ask);
    --fcp-edge: #b7a877;
}
:where(
    :is(.fc-artwork-detail-actions,.fc-missionary-detail-actions,.fc-full-image-tools)
        > :is([data-full-image-viewer],#artworkDetailFullImage,#missionaryDetailFullImage,.fc-full-image-download),
    #artSaveImage,[data-artwork-view],.fc-art-browse-link,
    a:is([href$=".jpg" i],[href$=".jpeg" i],[href$=".webp" i],[href$=".png" i],[href$=".avif" i]),
    a:is([href*=".jpg?" i],[href*=".jpeg?" i],[href*=".webp?" i],[href*=".png?" i],[href*=".avif?" i])
) {
    --fcp-surface: var(--fcp-view);
    --fcp-edge: #b4975e;
    --fcp-label: #e9d4a7;
}
:where(
    .fc-unified-continue,.fc-scroll-cue,.timeline-opening-continue,.fc-covenant-continue,
    .scrollcue,.fc-gallery-continue,.fc-mobile-scroll-cue,
    [data-artwork-detail-continue],[data-topic-art-continue],[data-focuschrist-continue],
    .fc-missionary-detail-actions > button[data-missionary-detail-close]:not(:last-child),
    a[href="#fc-opening-retained"],.cfm-btn[href="#study-start"],
    .dc-next > a.fc-button[href^="#"]:not([href="#chapters"]),
    .atonement-chapter-actions > a.fc-button[href^="#"]:not([href="#atonement-chapters"]),
    .watch-feature-copy > a.fc-button--primary[href="#book-of-mormon"],
    a.fc-button--primary[href="#liberty-jail-study"]
) {
    --fcp-surface: var(--fcp-gold);
    --fcp-label: var(--fcp-gold-ink);
    --fcp-edge: #e2c477;
}
/* Stable opt-in for new features when their intent cannot be inferred. */
[data-fc-pill-role="study"]   { --fcp-surface: var(--fcp-standard); --fcp-label: var(--fcp-ink); --fcp-edge: var(--fcp-rim); }
[data-fc-pill-role="reading"] { --fcp-surface: var(--fcp-reading); --fcp-label: var(--fcp-ink); --fcp-edge: #b3a77d; }
[data-fc-pill-role="ask"]     { --fcp-surface: var(--fcp-ask); --fcp-label: var(--fcp-ink); --fcp-edge: #b7a877; }
[data-fc-pill-role="view"]    { --fcp-surface: var(--fcp-view); --fcp-label: #e9d4a7; --fcp-edge: #b4975e; }
[data-fc-pill-role="progress"] { --fcp-surface: var(--fcp-gold); --fcp-label: var(--fcp-gold-ink); --fcp-edge: #e2c477; }
/* Explicitly scoped: icon-only X, arrow controls, map pins, form fields, passive
   badges and the text-only menu are not restyled as pills. */
html body:is(.fc-site.fc-site.fc-site.fc-site.fc-site, :not(.fc-site))
:is(
    :is(a,button,summary,[role="button"]):is(.fc-button,.fc-unified-continue,.fc-scroll-cue,
        .timeline-opening-continue,.fc-covenant-continue,.scrollcue,.fc-gallery-continue,
        .fc-nav-atonement,[data-focuschrist-current-study],.pill,.watch-theme-tab,.watch-back-top,
        .journal-action,.ask-action,.jj-card-action,.fbtn,.hintbtn,.nearbybtn,.backbtn,.mobile-timeline-toggle,
        [data-fc-pill-role],.fc-scripture-source,.cta,.cfm-btn,.ask-topic-toggle,.ask-followup-button,.fc-art-browse-link,.timeline-return,.watch-short-open,.journal-collection-link,.fc-mobile-scroll-cue,.view-btn,#sendBtn,#clearBtn,[data-artwork-detail-continue],[data-topic-art-continue]),
    :is(.fc-artwork-detail-actions,.fc-missionary-detail-actions,.fc-art-study-links,
        .fc-art-viewer-actions,.fc-gallery-loading,.fc-full-image-tools,.chips,.mchips,.timeline-event-navigation,.controls-row) > :is(a,button),
    a:is(.fc-history-art-panel figcaption > a),
    .workspace-disclosure > summary,.controls > button.btn,.navGroup > button.navBtn,
    #viewer .cluster-pop .cplist button,.overlap button
):not([hidden],.fc-art-gallery-x,[data-hero-close],[data-artwork-detail-close],
     button[data-missionary-detail-close]:last-child:not([data-fc-dual-close] .fc-missionary-detail-actions > button),[data-gallery-close],.close,.fc-full-image-close,[data-fc-pill-role="close"]) {
    background: var(--fcp-surface,var(--fcp-standard)) padding-box,var(--fcp-keyline) border-box !important;
    color: var(--fcp-label,var(--fcp-ink)) !important;
    border-color: transparent !important;
    border-radius: 999px !important;
    box-shadow: var(--fcp-shadow,none) !important;
    text-shadow: none !important;
    font-family: var(--fcp-face) !important;
    font-weight: 600 !important;
    text-decoration: none !important;
    transition: box-shadow .12s ease,border-color .12s ease !important;
}
html body:is(.fc-site.fc-site.fc-site.fc-site.fc-site, :not(.fc-site))
:is(.fc-artwork-viewer-close-pill,.fc-full-image-close,
    #imageModal .fc-art-viewer-actions > .close,#artGalleryDialog [data-gallery-close],
    .fc-search-close,button.sheet-close,button.detail-close,button.navClose,
    button[data-topic-art-close],[data-fc-pill-role="close"]):not([hidden]) {
    background: transparent !important;
    color: #fff4dc !important;
    border-color: #b29c73 !important;
    box-shadow: none !important;
    text-shadow: none !important;
    font-family: var(--fcp-face) !important;
}
html body:is(.fc-site.fc-site.fc-site.fc-site.fc-site,:not(.fc-site))
:is(.fc-button,.fc-unified-continue,.fc-scroll-cue,.timeline-opening-continue,.fc-covenant-continue,
    .scrollcue,.fc-gallery-continue,.fc-nav-atonement,[data-focuschrist-current-study],.pill,
    .watch-theme-tab,.watch-back-top,.journal-action,.ask-action,.jj-card-action,.fbtn,.hintbtn,.nearbybtn,
    .backbtn,.mobile-timeline-toggle,.fc-artwork-viewer-close-pill,.fc-full-image-close,.fc-search-close,
    .close,.sheet-close,.detail-close,.navClose,[data-gallery-close],[data-topic-art-close],
    [data-fc-pill-role],.fc-scripture-source,.cta,.cfm-btn,.ask-topic-toggle,.ask-followup-button,.fc-art-browse-link,.timeline-return,.watch-short-open,.journal-collection-link,.fc-mobile-scroll-cue,.view-btn,#sendBtn,#clearBtn,[data-artwork-detail-continue],[data-topic-art-continue],
    :is(.fc-artwork-detail-actions,.fc-missionary-detail-actions,.fc-art-study-links,.fc-art-viewer-actions,
        .fc-gallery-loading,.fc-full-image-tools,.chips,.mchips,.timeline-event-navigation,.controls-row) > :is(a,button),
    a:is(.fc-history-art-panel figcaption > a),
    .workspace-disclosure > summary,.controls > button.btn,.navGroup > button.navBtn,
    #viewer .cluster-pop .cplist button,.overlap button
):not([hidden],:disabled,[aria-disabled="true"],.fc-art-gallery-x):hover {
    --fcp-keyline: linear-gradient(128deg,#f1dba9,#aa8e5d);
}
html body:is(.fc-site.fc-site.fc-site.fc-site.fc-site,:not(.fc-site))
:is(.fc-button,.fc-unified-continue,.fc-scroll-cue,.timeline-opening-continue,.fc-covenant-continue,
    .scrollcue,.fc-gallery-continue,.fc-nav-atonement,[data-focuschrist-current-study],.pill,
    .watch-theme-tab,.watch-back-top,.journal-action,.ask-action,.jj-card-action,.fbtn,.hintbtn,.nearbybtn,
    .backbtn,.mobile-timeline-toggle,.fc-artwork-viewer-close-pill,.fc-full-image-close,.fc-search-close,
    .close,.sheet-close,.detail-close,.navClose,[data-gallery-close],[data-topic-art-close],
    [data-fc-pill-role],.fc-scripture-source,.cta,.cfm-btn,.ask-topic-toggle,.ask-followup-button,.fc-art-browse-link,.timeline-return,.watch-short-open,.journal-collection-link,.fc-mobile-scroll-cue,.view-btn,#sendBtn,#clearBtn,[data-artwork-detail-continue],[data-topic-art-continue],
    :is(.fc-artwork-detail-actions,.fc-missionary-detail-actions,.fc-art-study-links,.fc-art-viewer-actions,
        .fc-gallery-loading,.fc-full-image-tools,.chips,.mchips,.timeline-event-navigation,.controls-row) > :is(a,button),
    a:is(.fc-history-art-panel figcaption > a),
    .workspace-disclosure > summary,.controls > button.btn,.navGroup > button.navBtn,
    #viewer .cluster-pop .cplist button,.overlap button
):not([hidden],:disabled,[aria-disabled="true"],.fc-art-gallery-x):active {
    box-shadow: var(--fcp-pressed-shadow) !important;
}
html body:is(.fc-site.fc-site.fc-site.fc-site.fc-site,:not(.fc-site))
:is(.fc-button,.fc-unified-continue,.fc-scroll-cue,.timeline-opening-continue,.fc-covenant-continue,
    .scrollcue,.fc-gallery-continue,.fc-nav-atonement,[data-focuschrist-current-study],.pill,
    .watch-theme-tab,.watch-back-top,.journal-action,.ask-action,.jj-card-action,.fbtn,.hintbtn,.nearbybtn,
    .backbtn,.mobile-timeline-toggle,.fc-artwork-viewer-close-pill,.fc-full-image-close,.fc-search-close,
    .close,.sheet-close,.detail-close,.navClose,[data-gallery-close],[data-topic-art-close],
    [data-fc-pill-role],.fc-scripture-source,.cta,.cfm-btn,.ask-topic-toggle,.ask-followup-button,.fc-art-browse-link,.timeline-return,.watch-short-open,.journal-collection-link,.fc-mobile-scroll-cue,.view-btn,#sendBtn,#clearBtn,[data-artwork-detail-continue],[data-topic-art-continue],
    :is(.fc-artwork-detail-actions,.fc-missionary-detail-actions,.fc-art-study-links,.fc-art-viewer-actions,
        .fc-gallery-loading,.fc-full-image-tools,.chips,.mchips,.timeline-event-navigation,.controls-row) > :is(a,button),
    a:is(.fc-history-art-panel figcaption > a),
    .workspace-disclosure > summary,.controls > button.btn,.navGroup > button.navBtn,
    #viewer .cluster-pop .cplist button,.overlap button
):not([hidden],.fc-art-gallery-x):focus-visible {
    outline: 2px solid var(--fcp-focus) !important;
    outline-offset: 3px !important;
}
html body :is(.watch-theme-tab,button.pill,.controls-row button.chip,.view-btn,
    a.fc-nav-atonement,a[data-focuschrist-current-study],.timeline-event-navigation button,
    .controls > button.btn,.navGroup > button.navBtn,.fbtn):is([aria-pressed="true"],
    [aria-selected="true"],[aria-current="page"],.active,.is-active,.on) {
    --fcp-keyline: linear-gradient(128deg,#fff0ba,#ad925b);
    --fcp-shadow: 0 0 0 1px #f7da8a80;
}
@media (prefers-reduced-motion: reduce) {
    html body :is(.fc-button,.fc-unified-continue,.fc-scroll-cue,.fc-artwork-viewer-close-pill,
       .fc-full-image-close,.fc-artwork-detail-actions > :is(a,button)) {transition: none !important;}
}
@media (forced-colors: active) {
    :root {
        --fcp-ink: ButtonText; --fcp-rim: ButtonText; --fcp-rim-bright: Highlight;
        --fcp-standard: linear-gradient(ButtonFace,ButtonFace); --fcp-gold: var(--fcp-standard);
        --fcp-reading: var(--fcp-standard); --fcp-ask: var(--fcp-standard); --fcp-view: var(--fcp-standard);
        --fcp-gold-ink: ButtonText; --fcp-focus: Highlight; --fcp-keyline: linear-gradient(ButtonText,ButtonText);
        --fcp-pressed-shadow: none;
    }
}

/* Artwork remains naturally sized. The keyline is drawn outside the media
   box; no border, fixed aspect ratio or crop is imposed by the paint system. */
dialog:is(.fc-artwork-detail-dialog,.fc-missionary-detail-dialog)
:is(.fc-artwork-detail-media,.fc-missionary-detail-media) > img {
    border-radius: 5px;
    outline: 1px solid #bb9d60;
    box-shadow: 0 1px 9px #0614196b;
}
@media (min-width: 1051px) and (min-height: 701px) {
    dialog:is(.fc-artwork-detail-dialog,.fc-missionary-detail-dialog)[open]:has(> [data-fc-dual-close]) {
        background: radial-gradient(ellipse at 23% -38%,#2d4b44,#1c343c 33%,transparent 69%),
                    linear-gradient(157deg,#1a3a3a,#102733 68%) !important;
        border-color: #9c8354a6 !important;
    }
    dialog[open] [data-fc-dual-close]
    :is(.fc-artwork-detail-actions,.fc-missionary-detail-actions) > :is(a,button):not([hidden]) {
        min-block-size: 44px;
        padding-inline: clamp(14px,1.3vw,22px);
    }
}
