/* --- S4U Home Screen app: nudge card + steps sheet (site-wide) --------------------------
   Rendered by home-screen.js at body level, outside any .s4u wrapper, so the .s4u-hs
   namespace carries its own look. Self-contained on purpose (same reasoning as
   net-watch.css): this sheet also loads on legacy _Layout pages where design-system.css
   is absent, so colors are plain values in the site's ink/champagne palette, no oklch.
   Old TV notes: no flex gap (margins instead), plain `bottom` declared before the
   safe-area calc so an unknown env() just falls back.
   z-index: nudge 2147483390 and sheet 2147483450. The nudge sits UNDER the lite-mode
   toast (2147483400, lite-mode.css); both sit UNDER the connection pill (2147483500,
   net-watch.css) and the feed-guard overlay (2147483600): status and blocking dialogs
   outrank an invitation. Unlike the pill, both take taps. The card also steps aside
   (html:has) while a nav drawer, theater, modal, settings or channel drawer, page-zoom
   dialog or SweetAlert is open; it comes back when that closes, no state is burned.
   Light theme (html.s4u-light, s4u layouts only): paper ground, dark ink, deeper gold.
   -------------------------------------------------------------------------------------- */

/* ---- nudge card ---- */
.s4u-hs,
.s4u-hs * { box-sizing: border-box; }

.s4u-hs {
    position: fixed;
    left: 16px;
    right: 16px;
    bottom: 16px;
    bottom: calc(16px + env(safe-area-inset-bottom, 0px));
    z-index: 2147483390;
    margin: 0 auto;
    max-width: 440px;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    padding: 12px 14px 12px;
    border-radius: 16px;
    background: rgba(20, 20, 26, 0.97);
    border: 1px solid rgba(212, 183, 121, 0.30);
    box-shadow: 0 14px 36px rgba(0, 0, 0, 0.50);
    color: #f3ede1;
    font-family: Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    font-size: 13.5px;
    line-height: 1.35;
    letter-spacing: 0.005em;
    opacity: 0;
    visibility: hidden;
    transform: translateY(12px);
    transition: opacity 0.25s ease, visibility 0.25s ease, transform 0.25s ease;
}

.s4u-hs.is-visible {
    opacity: 1;
    visibility: visible;
    transform: none;
}

/* Step aside while an overlay owns the screen: a nav drawer, theater, modal, settings or
   channel drawer, page-zoom dialog or SweetAlert outranks an invitation. Only phones get
   the card and all of them support :has(); engines without it drop the rule and never
   show the card anyway. The settings drawer is Alpine x-show + x-cloak: cloaked (Alpine
   not running yet) or display:none means closed. Specificity beats .s4u-hs.is-visible. */
html:has(.s4u-shell-root.nav-open) .s4u-hs.is-visible,
html:has(.s4u-shell-root.is-immersive) .s4u-hs.is-visible,
html:has(.mfp-wrap) .s4u-hs.is-visible,
html:has(.modal.open) .s4u-hs.is-visible,
html:has(.s4u-pdrawer__sheet:not([x-cloak]):not([style*="none"])) .s4u-hs.is-visible,
html:has(.s4u-chanbrowser.is-open) .s4u-hs.is-visible,
html:has(.s4u-pz-modal.is-open) .s4u-hs.is-visible,
html:has(.swal-overlay--show-modal) .s4u-hs.is-visible {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.s4u-hs__icon {
    flex: none;
    width: 44px;
    height: 44px;
    margin-right: 12px;
    border-radius: 10px;
}

.s4u-hs__text {
    flex: 1 1 160px;
    min-width: 0;
}

.s4u-hs__title {
    margin: 0;
    font-size: 14px;
    font-weight: 600;
    color: #f7f2e8;
}

.s4u-hs__sub {
    margin: 2px 0 0;
    font-size: 12.5px;
    color: rgba(243, 237, 225, 0.72);
}

.s4u-hs__actions {
    flex: 1 0 100%;
    display: flex;
    justify-content: flex-end;
    margin-top: 10px;
}

.s4u-hs__btn {
    -webkit-appearance: none;
    appearance: none;
    margin: 0 0 0 8px;
    padding: 10px 16px;
    min-height: 40px;
    border: 1px solid rgba(243, 237, 225, 0.18);
    border-radius: 999px;
    background: transparent;
    color: #f3ede1;
    font: inherit;
    font-size: 13px;
    font-weight: 600;
    line-height: 1.2;
    letter-spacing: 0.01em;
    cursor: pointer;
    text-decoration: none;
    -webkit-tap-highlight-color: transparent;
}

/* Materialize (legacy _Layout and UseMaterialize pages) ships a bare button:focus
   { background-color: #00cee8 } at (0,1,1). Restate our backgrounds at (0,2,0) so a
   focused button never turns cyan. Kept above :hover so hover still wins. */
.s4u-hs__btn:focus, .s4u-hs-sheet__close:focus { background-color: transparent; }
.s4u-hs__btn--primary:focus { background-color: #d4a850; }

.s4u-hs__btn:hover { background: rgba(243, 237, 225, 0.06); }
.s4u-hs__btn:focus { outline: 2px solid rgba(236, 202, 125, 0.8); outline-offset: 2px; }
.s4u-hs__btn:focus:not(:focus-visible) { outline: none; }

.s4u-hs__btn--primary {
    background: #d4a850;
    border-color: #d4a850;
    color: #1a1408;
}

.s4u-hs__btn--primary:hover { background: #e3b85e; border-color: #e3b85e; }

/* ---- steps sheet ---- */
.s4u-hs-sheet,
.s4u-hs-sheet * { box-sizing: border-box; }

.s4u-hs-sheet {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 2147483450;
    display: none;
    color: #f3ede1;
    font-family: Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    font-size: 14px;
    line-height: 1.5;
}

.s4u-hs-sheet.is-open { display: block; }

.s4u-hs-sheet__backdrop {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.62);
}

.s4u-hs-sheet__panel {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    margin: 0 auto;
    max-width: 540px;
    max-height: 88vh;
    overflow: auto;
    -webkit-overflow-scrolling: touch;
    padding: 18px 20px 18px;
    padding-bottom: calc(18px + env(safe-area-inset-bottom, 0px));
    border-radius: 18px 18px 0 0;
    background: #14141a;
    border: 1px solid rgba(212, 183, 121, 0.25);
    border-bottom: 0;
    box-shadow: 0 -16px 40px rgba(0, 0, 0, 0.55);
}

@media (min-width: 640px) and (min-height: 560px) {
    .s4u-hs-sheet__panel {
        bottom: auto;
        top: 50%;
        transform: translateY(-50%);
        border-radius: 18px;
        border-bottom: 1px solid rgba(212, 183, 121, 0.25);
        padding-bottom: 18px;
    }
}

.s4u-hs-sheet__head {
    display: flex;
    align-items: center;
}

.s4u-hs-sheet__icon {
    flex: none;
    width: 48px;
    height: 48px;
    margin-right: 12px;
    border-radius: 11px;
}

.s4u-hs-sheet__titles { min-width: 0; flex: 1 1 auto; }

.s4u-hs-sheet__kicker {
    margin: 0;
    font-family: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 10.5px;
    font-weight: 500;
    letter-spacing: 0.22em;
    text-transform: uppercase;
    color: #ecca7d;
}

.s4u-hs-sheet__title {
    margin: 2px 0 0;
    font-family: Fraunces, Georgia, "Times New Roman", serif;
    font-size: 20px;
    font-weight: 500;
    line-height: 1.15;
    letter-spacing: -0.01em;
    color: #f7f2e8;
}

.s4u-hs-sheet__close {
    -webkit-appearance: none;
    appearance: none;
    flex: none;
    width: 36px;
    height: 36px;
    margin-left: 10px;
    padding: 0;
    border: 1px solid rgba(243, 237, 225, 0.14);
    border-radius: 50%;
    background: transparent;
    color: rgba(243, 237, 225, 0.75);
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

.s4u-hs-sheet__close svg { width: 16px; height: 16px; display: block; margin: 0 auto; }
.s4u-hs-sheet__close:hover { background: rgba(243, 237, 225, 0.06); color: #f7f2e8; }
.s4u-hs-sheet__close:focus { outline: 2px solid rgba(236, 202, 125, 0.8); outline-offset: 2px; }
.s4u-hs-sheet__close:focus:not(:focus-visible) { outline: none; }

.s4u-hs-sheet__lead {
    margin: 12px 0 0;
    color: rgba(243, 237, 225, 0.78);
}

.s4u-hs-sheet__sub {
    margin: 16px 0 0;
    font-family: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 10.5px;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: rgba(243, 237, 225, 0.5);
}

.s4u-hs-sheet__steps {
    list-style: none;
    counter-reset: s4uhs;
    margin: 10px 0 0;
    padding: 0;
}

.s4u-hs-sheet__steps li {
    position: relative;
    padding: 9px 0 9px 36px;
    border-top: 1px solid rgba(243, 237, 225, 0.09);
    counter-increment: s4uhs;
}

.s4u-hs-sheet__steps li::before {
    content: counter(s4uhs);
    position: absolute;
    left: 0;
    top: 10px;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: rgba(212, 168, 80, 0.16);
    color: #ecca7d;
    font-size: 12px;
    font-weight: 600;
    line-height: 24px;
    text-align: center;
}

.s4u-hs-sheet__steps b { color: #f7f2e8; font-weight: 600; }

.s4u-hs-sheet__steps svg {
    width: 16px;
    height: 16px;
    margin: 0 2px;
    vertical-align: -3px;
    color: #ecca7d;
}

.s4u-hs-sheet__note {
    margin: 10px 0 0;
    font-size: 12.5px;
    color: rgba(243, 237, 225, 0.6);
}

.s4u-hs-sheet__actions {
    display: flex;
    justify-content: flex-end;
    margin-top: 16px;
}

.s4u-hs-sheet__actions .s4u-hs__btn[hidden] { display: none; }

/* ---- lite mode / reduced motion ---- */
html.s4u-lite .s4u-hs { transition: none; }

@media (prefers-reduced-motion: reduce) {
    .s4u-hs { transition: none; }
}

@media print {
    .s4u-hs, .s4u-hs-sheet { display: none !important; }
}

/* ---- light theme (s4u layouts) ---- */
html.s4u-light .s4u-hs {
    background: rgba(250, 248, 244, 0.98);
    border-color: rgba(127, 95, 24, 0.35);
    color: #1c1a16;
    box-shadow: 0 14px 36px rgba(40, 30, 10, 0.22);
}
html.s4u-light .s4u-hs__title { color: #141318; }
html.s4u-light .s4u-hs__sub { color: rgba(20, 19, 24, 0.68); }
html.s4u-light .s4u-hs__btn { border-color: rgba(20, 19, 24, 0.18); color: #1c1a16; }
html.s4u-light .s4u-hs__btn:hover { background: rgba(20, 19, 24, 0.05); }
html.s4u-light .s4u-hs__btn--primary,
html.s4u-light .s4u-hs__btn--primary:hover { background: #7f5f18; border-color: #7f5f18; color: #fbf6ea; }

html.s4u-light .s4u-hs-sheet { color: #1c1a16; }
html.s4u-light .s4u-hs-sheet__backdrop { background: rgba(30, 24, 12, 0.45); }
html.s4u-light .s4u-hs-sheet__panel { background: #faf8f4; border-color: rgba(127, 95, 24, 0.30); box-shadow: 0 -16px 40px rgba(40, 30, 10, 0.25); }
html.s4u-light .s4u-hs-sheet__kicker { color: #7a5a14; }
html.s4u-light .s4u-hs-sheet__title { color: #141318; }
html.s4u-light .s4u-hs-sheet__close { border-color: rgba(20, 19, 24, 0.16); color: rgba(20, 19, 24, 0.7); }
html.s4u-light .s4u-hs-sheet__close:hover { background: rgba(20, 19, 24, 0.05); color: #141318; }
html.s4u-light .s4u-hs-sheet__lead { color: rgba(20, 19, 24, 0.75); }
html.s4u-light .s4u-hs-sheet__sub { color: rgba(20, 19, 24, 0.5); }
html.s4u-light .s4u-hs-sheet__steps li { border-top-color: rgba(20, 19, 24, 0.1); }
html.s4u-light .s4u-hs-sheet__steps li::before { background: rgba(127, 95, 24, 0.14); color: #7a5a14; }
html.s4u-light .s4u-hs-sheet__steps b { color: #141318; }
html.s4u-light .s4u-hs-sheet__steps svg { color: #7a5a14; }
html.s4u-light .s4u-hs-sheet__note { color: rgba(20, 19, 24, 0.6); }
/* champagne focus ring is near invisible on paper: deeper gold, outline-color only so the
   :focus:not(:focus-visible) resets above still drop the ring after pointer taps */
html.s4u-light .s4u-hs__btn:focus,
html.s4u-light .s4u-hs-sheet__close:focus { outline-color: #7f5f18; }
