/* ===========================================================================
   Scanner traffic in a story, and the console it becomes.
   ===========================================================================

   WHAT IS IN THE STORY BODY, AND WHY IT IS ONLY LINKS.

   The story sanitizer strips <button>, allows no data-* attributes, and does
   not permit <audio> at all. So the body carries:

       <aside class="osc-scan">
         <p class="osc-scan-kicker">Fire scanner</p>
         <p class="osc-scan-intro">Listen in as crews are dispatched…</p>
         <p class="osc-scan-track">
           <a href="…mp3"><span class="osc-scan-label">Dispatch, 1:42 a.m.</span><span class="osc-scan-time">0:34</span></a>
         </p>
         …

   and scanner-player.js turns that list into one console with the
   transmissions queued behind it.

   Same ordering as the audio deck and the document viewer, for the same
   reason: if the script fails, is blocked, or throws, every transmission is
   still a working link to the recording. Nobody is left looking at a dead
   player, and the audio is never unreachable because a script did not arrive.

   Scoped under .article-container because custom.css sets rules like
   `.article-container h3` at specificity (0,1,1), which outranks a bare class.
   ========================================================================= */

/* ---------------------------------------------------------------------------
   THE UNENHANCED BLOCK -- what a reader sees with no JavaScript, and what is
   on screen for the moment before the script runs. It has to look deliberate
   on its own, not like a player that failed to appear.
   ------------------------------------------------------------------------- */

.article-container .osc-scan {
    margin: 34px 0;
    padding: 18px 20px;
    background: #12161d;
    border: 1px solid #2b3442;
    border-left: 5px solid #d08b2c;
    border-radius: 3px;
    color: #e7e3da;
}

.article-container .osc-scan-kicker {
    margin: 0 0 6px;
    padding: 0 0 0 26px;
    position: relative;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    font-size: .7rem;
    font-weight: 700;
    letter-spacing: .16em;
    text-transform: uppercase;
    color: #e6a344;
}

/* An aerial, drawn rather than shipped: the sanitizer allows no <svg> in a
   story body, and a decorative <img> is one more request and one more 404. */
.article-container .osc-scan-kicker::before {
    content: "";
    position: absolute;
    left: 6px;
    top: 50%;
    width: 2px;
    height: 13px;
    margin-top: -7px;
    background: #e6a344;
}
.article-container .osc-scan-kicker::after {
    content: "";
    position: absolute;
    left: 0;
    top: 50%;
    width: 14px;
    height: 14px;
    margin-top: -10px;
    border: 2px solid #e6a344;
    border-bottom-color: transparent;
    border-left-color: transparent;
    border-radius: 50%;
    transform: rotate(-45deg);
    opacity: .75;
}

.article-container .osc-scan-intro {
    margin: 0 0 14px;
    font-family: Georgia, 'Times New Roman', serif;
    font-size: 1.02rem;
    line-height: 1.5;
    color: #f2efe8;
}

.article-container .osc-scan-track {
    margin: 0;
    padding: 7px 0;
    border-top: 1px solid #262f3c;
}

.article-container .osc-scan-track a {
    display: flex;
    gap: 12px;
    align-items: baseline;
    justify-content: space-between;
    color: #9ec5ec;
    text-decoration: none;
}

.article-container .osc-scan-track a:hover { text-decoration: underline; }

.article-container .osc-scan-label {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: .88rem;
}

.article-container .osc-scan-time {
    flex: 0 0 auto;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    font-size: .78rem;
    color: #8e99a8;
}

/* ---------------------------------------------------------------------------
   THE CONSOLE -- once the script has upgraded the block.
   ------------------------------------------------------------------------- */

.article-container .osc-scan.is-live .osc-scan-list { margin: 0; padding: 0; }

.article-container .osc-scan-console {
    display: flex;
    gap: 14px;
    align-items: center;
    margin: 0 0 12px;
    padding: 12px;
    background: #0b0e13;
    border: 1px solid #2b3442;
    border-radius: 3px;
}

.article-container .osc-scan-play {
    flex: 0 0 auto;
    position: relative;
    width: 52px;
    height: 52px;
    padding: 0;
    background: #e6a344;
    border: 0;
    border-radius: 50%;
    cursor: pointer;
    transition: background .15s ease, transform .15s ease;
}

.article-container .osc-scan-play:hover { background: #f0b45c; }
.article-container .osc-scan-play:active { transform: scale(.95); }
.article-container .osc-scan-play:focus-visible { outline: 2px solid #9ec5ec; outline-offset: 3px; }

/* A triangle, in borders. Nudged right of centre because a triangle's optical
   centre is not its bounding box's. */
.article-container .osc-scan-play::before {
    content: "";
    position: absolute;
    left: 50%;
    top: 50%;
    margin: -9px 0 0 -6px;
    border-style: solid;
    border-width: 9px 0 9px 15px;
    border-color: transparent transparent transparent #12161d;
}

/* Two bars for pause, drawn by re-using the same box. */
.article-container .osc-scan.is-playing .osc-scan-play::before {
    margin: -9px 0 0 -8px;
    border-width: 0;
    width: 5px;
    height: 18px;
    background: #12161d;
    box-shadow: 11px 0 0 #12161d;
}

.article-container .osc-scan-now {
    flex: 1 1 auto;
    min-width: 0;
}

.article-container .osc-scan-now-label {
    margin: 0 0 2px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: .92rem;
    font-weight: 700;
    line-height: 1.3;
    color: #f2efe8;
    overflow-wrap: anywhere;
}

.article-container .osc-scan-now-meta {
    margin: 0 0 7px;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    font-size: .72rem;
    letter-spacing: .06em;
    text-transform: uppercase;
    color: #8e99a8;
}

/* A real <input type="range">: keyboard operable and announced by screen
   readers, for free. Same choice as the audio deck. */
.article-container .osc-scan-seek {
    display: block;
    width: 100%;
    height: 20px;
    margin: 0;
    padding: 0;
    background: transparent;
    -webkit-appearance: none;
    appearance: none;
    cursor: pointer;
}

.article-container .osc-scan-seek::-webkit-slider-runnable-track {
    height: 4px;
    background: #2b3442;
    border-radius: 2px;
}
.article-container .osc-scan-seek::-moz-range-track {
    height: 4px;
    background: #2b3442;
    border-radius: 2px;
}
.article-container .osc-scan-seek::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 13px;
    height: 13px;
    margin-top: -4.5px;
    background: #e6a344;
    border: 0;
    border-radius: 50%;
}
.article-container .osc-scan-seek::-moz-range-thumb {
    width: 13px;
    height: 13px;
    background: #e6a344;
    border: 0;
    border-radius: 50%;
}
.article-container .osc-scan-seek:focus-visible { outline: 2px solid #9ec5ec; outline-offset: 2px; }

.article-container .osc-scan-times {
    display: flex;
    justify-content: space-between;
    margin-top: 3px;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    font-size: .72rem;
    color: #8e99a8;
}

.article-container .osc-scan-steps {
    flex: 0 0 auto;
    display: flex;
    gap: 6px;
}

.article-container .osc-scan-step {
    width: 36px;
    height: 36px;
    padding: 0;
    color: #cfd6df;
    background: #1a212b;
    border: 1px solid #2b3442;
    border-radius: 3px;
    font-size: 1rem;
    line-height: 1;
    cursor: pointer;
}

.article-container .osc-scan-step:hover:not(:disabled) { background: #253040; }
.article-container .osc-scan-step:focus-visible { outline: 2px solid #9ec5ec; outline-offset: 2px; }
.article-container .osc-scan-step:disabled { opacity: .32; cursor: default; }

/* ---------------------------------------------------------------------------
   THE QUEUE
   ------------------------------------------------------------------------- */

.article-container .osc-scan.is-live .osc-scan-track {
    border-top: 1px solid #262f3c;
}

.article-container .osc-scan-cue {
    display: flex;
    gap: 10px;
    align-items: baseline;
    width: 100%;
    padding: 9px 8px;
    color: #cfd6df;
    background: transparent;
    border: 0;
    border-radius: 3px;
    font: inherit;
    text-align: left;
    cursor: pointer;
}

.article-container .osc-scan-cue:hover { background: #1a212b; }
.article-container .osc-scan-cue:focus-visible { outline: 2px solid #9ec5ec; outline-offset: -2px; }

.article-container .osc-scan-cue-n {
    flex: 0 0 auto;
    min-width: 1.6em;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    font-size: .74rem;
    color: #7c879a;
}

.article-container .osc-scan-cue-label {
    flex: 1 1 auto;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: .86rem;
    line-height: 1.4;
}

.article-container .osc-scan-cue-time {
    flex: 0 0 auto;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    font-size: .76rem;
    color: #8e99a8;
}

.article-container .osc-scan-cue.is-current {
    background: #1d2531;
    color: #f2efe8;
}

.article-container .osc-scan-cue.is-current .osc-scan-cue-n {
    color: #e6a344;
    font-weight: 700;
}

/* A quiet marker on the transmission that is playing, so the queue shows where
   you are without needing the console. */
.article-container .osc-scan.is-playing .osc-scan-cue.is-current .osc-scan-cue-n::after {
    content: " \25B6";
}

.article-container .osc-scan-broken {
    margin: 10px 0 0;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: .82rem;
    color: #f0a8a8;
}

@media (max-width: 599px) {
    .article-container .osc-scan { padding: 16px 14px; margin: 26px 0; }
    .article-container .osc-scan-console {
        flex-wrap: wrap;
        gap: 10px;
    }
    /* The scrub bar takes the full line under the controls rather than being
       squeezed between them at 90px wide. */
    .article-container .osc-scan-now {
        order: 3;
        flex: 1 1 100%;
    }
    .article-container .osc-scan-steps { margin-left: auto; }
    .article-container .osc-scan-step { width: 44px; height: 44px; }
}

@media (prefers-reduced-motion: reduce) {
    .article-container .osc-scan-play { transition: none; }
    .article-container .osc-scan-play:active { transform: none; }
}
