/* Fully Sealed: Listen (8 October 2026). The controls for Tommy's own reading of a question
   page, ported from the Book Development Service and dressed in this site's paper, ink and red.
   Everything here is built by js/listen.js, so nothing applies to a page without a recording. */
:root {
    --fl-paper: #F3EEE2; --fl-paper-2: #ECE5D5; --fl-ink: #1F1B16; --fl-soft: #5B5449;
    --fl-red: #A3291F; --fl-red-deep: #87211A; --fl-coin: #C49A2C; --fl-line: rgba(31,27,22,.16);
    --fl-said-line: rgba(196,154,44,.20); --fl-said-word: rgba(196,154,44,.55);
    --fl-sans: "IBM Plex Sans", "Helvetica Neue", Arial, sans-serif;
}

/* ---- under the title: Listen, and the pace once it is playing ---- */
.fl-ribbon { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin: .1rem 0 1.15rem; }
.fl-listen, .fl-pace, .fl-stop {
    display: inline-flex; align-items: center; justify-content: center; gap: .55em;
    min-height: 44px; margin: 0; border-radius: 999px;
    font-family: var(--fl-sans); font-size: 15px; font-weight: 600; line-height: 1; letter-spacing: 0;
    cursor: pointer; -webkit-tap-highlight-color: transparent;
    transition: background-color .2s, color .2s, border-color .2s;
}
.fl-listen { padding: 0 20px 0 7px; border: 0; background: var(--fl-red); color: var(--fl-paper); }
.fl-listen:hover { background: var(--fl-red-deep); }
.fl-listen[disabled] { cursor: default; opacity: .6; }
.fl-icon { box-sizing: border-box; display: block; flex: 0 0 auto; width: 30px; height: 30px; padding: 8px; border-radius: 50%; background: var(--fl-paper); color: var(--fl-red); }
.fl-listen .fl-pause { display: none; }
.fl-listen.is-playing .fl-play { display: none; }
.fl-listen.is-playing .fl-pause { display: block; }
.fl-pace { padding: 0 16px; border: 1.5px solid rgba(31,27,22,.28); background: transparent; color: var(--fl-ink); font-weight: 500; font-variant-numeric: tabular-nums; }
.fl-pace:hover { border-color: var(--fl-red); color: var(--fl-red); }
.fl-pace[hidden], .fl-stop[hidden] { display: none; }
.fl-listen:focus-visible, .fl-pace:focus-visible, .fl-stop:focus-visible, .fl-where:focus-visible, .fl-continue-btn:focus-visible { outline: 2px solid var(--fl-red); outline-offset: 3px; }

/* ---- coming back part way through ---- */
.fl-continue { margin: -.45rem 0 1.15rem; }
.fl-continue-btn { display: inline-flex; align-items: center; gap: .5em; min-height: 44px; padding: 0; border: 0; background: none; color: var(--fl-red); font: 600 15px/1.3 var(--fl-sans); text-align: left; text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px; cursor: pointer; }
.fl-continue-btn .fl-arrow { display: inline-block; text-decoration: none; animation: flBeckonX 5s ease-in-out infinite; }
@keyframes flBeckonX { 0%, 78%, 100% { transform: translateX(0); } 83% { transform: translateX(6px); } 88% { transform: translateX(0); } 93% { transform: translateX(6px); } }

/* ---- the strip at the foot of the screen ---- */
.fl-pin {
    position: fixed; z-index: 40; left: 50%; bottom: max(1rem, env(safe-area-inset-bottom, 0px));
    display: flex; flex-direction: column; align-items: center; gap: 8px;
    width: max-content; max-width: calc(100vw - 2rem);
    transform: translate(-50%, 160%); opacity: 0; transition: transform .45s, opacity .45s;
}
.fl-pin.is-shown { transform: translate(-50%, 0); opacity: 1; }
.fl-strip { display: flex; align-items: stretch; }
/* offered: one invitation, Listen from here, with a ring that beckons */
.fl-pin .fl-toggle { position: relative; min-height: 48px; box-shadow: 0 8px 24px rgba(31,27,22,.22); }
.fl-pin:not(.is-active) .fl-toggle::before {
    content: ""; position: absolute; z-index: 0; pointer-events: none; left: 7px; top: 50%;
    width: 30px; height: 30px; margin-top: -15px; border: 2px solid var(--fl-paper); border-radius: 50%;
    opacity: 0; animation: flRing 2.6s ease-out infinite;
}
@keyframes flRing { 0% { transform: scale(1); opacity: .6; } 45% { transform: scale(1.85); opacity: 0; } 100% { transform: scale(1.85); opacity: 0; } }
/* listening: Pause, the pace and Stop in one strip of paper */
.fl-pin.is-active .fl-strip { background: var(--fl-paper); border: 1px solid rgba(31,27,22,.22); border-radius: 999px; box-shadow: 0 8px 24px rgba(31,27,22,.18); overflow: hidden; }
.fl-pin.is-active .fl-toggle { box-shadow: none; border-radius: 0; background: transparent; color: var(--fl-ink); padding: 0 16px 0 9px; }
.fl-pin.is-active .fl-toggle .fl-icon { background: var(--fl-red); color: var(--fl-paper); }
.fl-pin.is-active .fl-toggle:hover { background: var(--fl-paper-2); }
.fl-pin .fl-pace, .fl-pin .fl-stop { min-height: 48px; min-width: 54px; padding: 0 14px; border: 0; border-left: 1px solid var(--fl-line); border-radius: 0; background: transparent; color: var(--fl-ink); }
.fl-pin .fl-pace { font-weight: 600; }
.fl-pin .fl-pace:hover, .fl-pin .fl-stop:hover { background: var(--fl-paper-2); color: var(--fl-ink); }
.fl-pin .fl-stop:hover { color: var(--fl-red); }
.fl-stop { position: relative; }
.fl-stop svg { display: block; width: 14px; height: 14px; }
.fl-stop .fl-word { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
/* the way back to the voice: filled in ink, the one colour the strip is not */
.fl-where {
    display: none; align-items: center; gap: .6em; max-width: min(26rem, calc(100vw - 2rem));
    padding: 11px 16px; border: 0; border-radius: 14px; background: var(--fl-ink); color: var(--fl-paper);
    font: 500 14px/1.3 var(--fl-sans); text-align: left; cursor: pointer;
    box-shadow: 0 8px 24px rgba(31,27,22,.22); animation: flArrive .4s ease-out;
}
.fl-where.is-shown { display: flex; }
.fl-where:hover { background: #000; }
.fl-where .fl-arrow { flex: 0 0 auto; color: var(--fl-coin); font-weight: 700; }
.fl-where.is-shown .fl-arrow { animation: flBeckonDown 2.6s ease-in-out infinite; }
.fl-where.is-shown.is-up .fl-arrow { animation-name: flBeckonUp; }
@keyframes flArrive { 0% { opacity: 0; transform: translateY(6px); } 100% { opacity: 1; transform: none; } }
@keyframes flBeckonDown { 0%, 68%, 100% { transform: translateY(0); } 76% { transform: translateY(3px); } 84% { transform: translateY(0); } 92% { transform: translateY(3px); } }
@keyframes flBeckonUp { 0%, 68%, 100% { transform: translateY(0); } 76% { transform: translateY(-3px); } 84% { transform: translateY(0); } 92% { transform: translateY(-3px); } }

/* ---- what is being read ---- */
.fl-listening main h2, .fl-listening main h3, .fl-listening main p, .fl-listening main li,
.fl-listening main blockquote, .fl-listening main td { cursor: pointer; }
.fl-read { position: relative; }
.fl-read:not(td):not(h1)::after { content: ""; position: absolute; left: -.9rem; top: .15em; bottom: .15em; width: 2px; background: var(--fl-red); pointer-events: none; }
main > h2.fl-read::after { top: calc(1.25rem + .1em); }
li.fl-read::after { left: -1.7rem; }
blockquote p.fl-read::after { left: -.75rem; }
.cta .fl-read::after { background: var(--fl-coin); }
td.fl-read { box-shadow: inset 3px 0 0 var(--fl-red); }
h1.fl-read { text-decoration: underline; text-decoration-color: var(--fl-red); text-decoration-thickness: 2px; text-underline-offset: .16em; }
::highlight(fl-said-line) { background-color: var(--fl-said-line); }
::highlight(fl-said-word) { background-color: var(--fl-said-word); }

/* ---- the voice at the edges of the screen ---- */
.fl-pulse { position: fixed; inset: 0; z-index: 35; pointer-events: none; opacity: 0; transition: opacity .5s; --vp: 0; --vp-c: rgba(196,154,44,.75); }
.fl-pulse.is-on { opacity: 1; }
.fl-vp-wash { position: absolute; opacity: calc(var(--vp) * .30); }
.fl-vp-line { position: absolute; opacity: calc(var(--vp) * .55); }
.fl-vp-t, .fl-vp-b { left: 0; right: 0; height: 5.5rem; }
.fl-vp-l, .fl-vp-r { top: 0; bottom: 0; width: 3.6rem; }
.fl-vp-t { top: 0; transform-origin: center top; transform: scaleY(calc(.3 + var(--vp) * .7)); background: linear-gradient(to bottom, var(--vp-c), transparent); }
.fl-vp-b { bottom: 0; transform-origin: center bottom; transform: scaleY(calc(.3 + var(--vp) * .7)); background: linear-gradient(to top, var(--vp-c), transparent); }
.fl-vp-l { left: 0; transform-origin: left center; transform: scaleX(calc(.3 + var(--vp) * .7)); background: linear-gradient(to right, var(--vp-c), transparent); }
.fl-vp-r { right: 0; transform-origin: right center; transform: scaleX(calc(.3 + var(--vp) * .7)); background: linear-gradient(to left, var(--vp-c), transparent); }
.fl-vp-line-t { top: 0; left: 0; right: 0; height: 7px; transform-origin: center top; transform: scaleY(calc(.3 + var(--vp) * .75)); background: linear-gradient(to bottom, var(--vp-c), transparent); }
.fl-vp-line-b { bottom: 0; left: 0; right: 0; height: 7px; transform-origin: center bottom; transform: scaleY(calc(.3 + var(--vp) * .75)); background: linear-gradient(to top, var(--vp-c), transparent); }
.fl-vp-line-l { left: 0; top: 0; bottom: 0; width: 7px; transform-origin: left center; transform: scaleX(calc(.3 + var(--vp) * .75)); background: linear-gradient(to right, var(--vp-c), transparent); }
.fl-vp-line-r { right: 0; top: 0; bottom: 0; width: 7px; transform-origin: right center; transform: scaleX(calc(.3 + var(--vp) * .75)); background: linear-gradient(to left, var(--vp-c), transparent); }

/* ---- silent mode, on Apple phones and iPads ---- */
.fl-silent {
    position: fixed; z-index: 45; left: 50%; top: var(--fl-top, 5rem); transform: translateX(-50%);
    display: flex; align-items: stretch; width: min(36rem, calc(100vw - 1rem));
    background: var(--fl-paper); border: 1.5px solid var(--fl-red); border-radius: 12px; overflow: hidden;
    box-shadow: 0 8px 24px rgba(31,27,22,.18); animation: flDrop .24s ease both;
}
.fl-silent p { margin: 0; }
.fl-silent .fl-silent-head { display: flex; align-items: center; flex: 0 0 auto; max-width: 5.6rem; padding: .5rem .7rem; background: var(--fl-red); color: var(--fl-paper); font: 600 .72rem/1.2 var(--fl-sans); letter-spacing: .06em; text-transform: uppercase; }
.fl-silent p:not(.fl-silent-head) { flex: 1 1 auto; align-self: center; padding: .5rem .7rem; color: var(--fl-ink); font: 400 .85rem/1.35 var(--fl-sans); }
.fl-silent button { flex: 0 0 auto; align-self: center; min-height: 36px; margin: 0 .5rem 0 0; padding: 0 .85rem; border: 0; border-radius: 999px; background: var(--fl-red); color: var(--fl-paper); font: 600 .78rem/1 var(--fl-sans); cursor: pointer; }
@keyframes flDrop { 0% { opacity: 0; transform: translate(-50%, -.5rem); } 100% { opacity: 1; transform: translate(-50%, 0); } }

/* ---- Listen arrives: the letters fly in red, the frame fills, it settles, the play mark nudges ---- */
.fl-listen { --ls-t0: .6s; }
.fl-lw { display: inline-block; white-space: nowrap; }
.fl-ch { display: inline-block; }
.fl-wait { opacity: 0; }
.fl-split {
    opacity: 0;
    animation: flAppear .01s linear var(--ls-t0) forwards,
               flFrame .6s ease-out calc(var(--ls-t0) + 1.6s) backwards,
               flSettle .9s cubic-bezier(.33, 0, .2, 1) calc(var(--ls-t0) + 2.5s) forwards;
}
.fl-split .fl-a .fl-ch { animation: flDrift 1.25s cubic-bezier(.16, .84, .34, 1) calc(var(--ls-t0) + var(--d)) backwards; }
.fl-split .fl-icon { animation: flIconIn .6s ease-out calc(var(--ls-t0) + 1.6s) backwards, flNudge 1.6s ease-in-out calc(var(--ls-t0) + 3.5s) 2; }
@keyframes flAppear { 100% { opacity: 1; } }
@keyframes flFrame { 0% { background-color: transparent; color: var(--fl-red); } 100% { background-color: var(--fl-red); color: var(--fl-paper); } }
@keyframes flIconIn { 0% { background-color: var(--fl-red); color: var(--fl-paper); } 100% { background-color: var(--fl-paper); color: var(--fl-red); } }
@keyframes flDrift {
    0% { opacity: 0; transform: translate(var(--dx), var(--dy)) rotate(var(--r)) scale(.7); }
    10% { opacity: 1; }
    80% { transform: translate(0, 0) rotate(0deg) scale(1.09); }
    100% { opacity: 1; transform: translate(0, 0) rotate(0deg) scale(1); }
}
@keyframes flSettle { 0% { transform: scale(1); } 46% { transform: scale(1.06); } 100% { transform: scale(1); } }
@keyframes flNudge { 0%, 100% { transform: translateX(0); } 50% { transform: translateX(3px); } }

/* ---- phones ---- */
@media (max-width: 640px) {
    .fl-pin .fl-pace, .fl-pin .fl-stop { min-width: 50px; padding: 0 12px; }
    .fl-where { font-size: 13px; padding: 10px 14px; }
    .fl-read:not(td):not(h1)::after { left: -.7rem; }
    li.fl-read::after { left: -1.55rem; }
    .fl-vp-t, .fl-vp-b { height: 3.6rem; }
    .fl-vp-l, .fl-vp-r { width: 2.1rem; }
}
@media (max-width: 380px) {
    .fl-silent .fl-silent-head { font-size: .66rem; max-width: 4.8rem; }
    .fl-silent p:not(.fl-silent-head) { font-size: .78rem; padding: .45rem .55rem; }
}

/* ---- a reader who has asked for less movement ---- */
@media (prefers-reduced-motion: reduce) {
    .fl-pin, .fl-listen, .fl-pace, .fl-stop { transition: none; }
    .fl-pin:not(.is-active) .fl-toggle::before, .fl-continue-btn .fl-arrow, .fl-where, .fl-where.is-shown .fl-arrow, .fl-silent { animation: none; }
    .fl-wait, .fl-split { opacity: 1; animation: none; }
    .fl-split .fl-a .fl-ch, .fl-split .fl-icon { animation: none; }
    .fl-pulse { display: none; }
}

/* ---- dark (9 October 2026): follows the site's light and dark switch ---- */
html[data-theme="dark"] {
    --fl-paper: #17130E; --fl-paper-2: #201A13; --fl-ink: #F2EADA; --fl-soft: #BBB09E;
    --fl-red: #E2B451; --fl-red-deep: #F0CF85; --fl-coin: #E2B451; --fl-line: rgba(242,234,218,.15);
    --fl-said-line: rgba(226,180,81,.14); --fl-said-word: rgba(226,180,81,.4);
}
html[data-theme="dark"] .fl-pace { border-color: rgba(242,234,218,.3); }
html[data-theme="dark"] .fl-pin.is-active .fl-strip { border-color: rgba(242,234,218,.22); }
html[data-theme="dark"] .fl-where:hover { background: #FFFFFF; }
