/* =====================================================================================================
   Saved · on every reader page (board Components › 17-18, HeaderSaved). Loaded by layouts/app.
   .saved-link (header: star + count, __star, __count, __tip; .has-count; [aria-current="page"] on the Saved page)
   · .saved-pill (the phone menu row's count) · .lhc-toast (__icon, __text, __action, __long, __short; .is-shown)
   Scripts: public/js/lhc.js. Everything here starts [hidden] and needs JavaScript and working storage.
   ===================================================================================================== */

/* ---- Header link: 44px, star only (none yet) or star + count in tabular figures; outside the nav */
.saved-link {
    position: relative; flex: none; height: 44px; min-width: 44px; display: inline-flex; align-items: center; justify-content: center;
    gap: 6px; padding: 0 var(--sp-12); border: 1px solid var(--c-navy-border); border-radius: var(--r-control);
    background: transparent; color: #ffffff; font-size: var(--fs-14); font-weight: 700; line-height: 1; text-decoration: none;
}
.saved-link:not(.has-count) { width: 44px; padding: 0; }
.saved-link[hidden] { display: none; }
.saved-link:hover { background: var(--c-navy-field); color: #ffffff; }
.saved-link__count { font-variant-numeric: tabular-nums; }
.saved-link[aria-current="page"] { background: var(--c-navy-field); border-color: #ffffff; }
.saved-link[aria-current="page"] .saved-link__star { fill: currentColor; }
.site-header--light .saved-link { border-color: var(--c-control); background: #ffffff; color: var(--c-primary); }
.site-header--light .saved-link:hover { background: var(--c-subtle); }
.site-header--light .saved-link[aria-current="page"] { background: var(--c-selected); border-color: var(--c-primary); }

/* The tooltip names it on pointer over and keyboard focus (the count isn't a notification: no red dot). */
.saved-link__tip {
    position: absolute; z-index: 30; top: calc(100% + 8px); left: 50%; transform: translateX(-50%); display: none;
    padding: 4px 8px; border-radius: var(--r-badge); background: var(--c-navy); color: #ffffff; box-shadow: var(--shadow-2);
    font-size: var(--fs-12); font-weight: 500; line-height: var(--lh-ui); white-space: nowrap; pointer-events: none;
}
.site-header--light .saved-link__tip { background: var(--c-navy); }
.saved-link:hover .saved-link__tip, .saved-link:focus-visible .saved-link__tip { display: block; }

/* ---- Phone menu row: a neutral count pill before the chevron; none when nothing is saved */
[data-saved-row][hidden] { display: none; }
.saved-pill {
    min-width: 24px; height: 24px; padding: 0 var(--sp-8); display: inline-flex; align-items: center; justify-content: center;
    border-radius: var(--r-pill); background: var(--c-subtle); color: var(--c-strong) !important;
    font-size: var(--fs-13); font-weight: 700; font-variant-numeric: tabular-nums;
}
.saved-pill[hidden] { display: none; }
.mobile-menu__row .saved-pill[hidden] + .icon { margin-inline-start: auto !important; }
.mobile-menu__row[aria-current="page"] > .icon:first-child { fill: currentColor; }

/* ---- Toast: one at a time, bottom centre, 24px above the edge; phones: full width less the 16px gutters */
.lhc-toast {
    position: fixed; z-index: 60; bottom: var(--sp-24); left: 50%; transform: translateX(-50%);
    width: max-content; max-width: min(560px, calc(100% - 32px)); min-height: 52px;
    display: flex; align-items: center; gap: var(--sp-12); padding: var(--sp-8) var(--sp-8) var(--sp-8) var(--sp-16);
    border-radius: var(--r-card); background: var(--c-navy); color: #ffffff; box-shadow: var(--shadow-3);
    font-size: var(--fs-15); line-height: var(--lh-ui);
}
[dir="rtl"] .lhc-toast { padding: var(--sp-8) var(--sp-16) var(--sp-8) var(--sp-8); }
.lhc-toast[hidden], .lhc-toast [hidden] { display: none !important; }
.lhc-toast__icon { flex: none; display: inline-flex; color: var(--c-mint); }
.lhc-toast__text { flex: 1 1 auto; min-width: 0; margin: 0; padding-block: var(--sp-4); }
.lhc-toast__action {
    position: relative; flex: none; height: 36px; display: inline-flex; align-items: center; justify-content: center; padding: 0 var(--sp-12);
    border: 1px solid var(--c-navy-border); border-radius: var(--r-control); background: transparent; color: #ffffff;
    font-size: var(--fs-14); font-weight: 500; line-height: 1; text-decoration: none; cursor: pointer;
}
.lhc-toast__action::before { content: ""; position: absolute; inset: -4px; }
.lhc-toast__action:hover { background: var(--c-navy-field); color: #ffffff; }
.lhc-toast :focus-visible { outline-color: #ffffff; }
.lhc-toast__short { display: none; }
@media (max-width: 640px) {
    .lhc-toast { left: var(--sp-16); right: var(--sp-16); transform: none; width: auto; max-width: none; bottom: calc(var(--sp-16) + env(safe-area-inset-bottom, 0px)); }
    .lhc-toast__long { display: none; }
    .lhc-toast__short { display: inline; }
}
@media (prefers-reduced-motion: no-preference) {
    .lhc-toast.is-shown { animation: lhc-fade .12s ease-out; }
}
@keyframes lhc-fade { from { opacity: 0; } to { opacity: 1; } }

@media print {
    .saved-link, .lhc-toast { display: none !important; }
}
