/* =========================================================
   Roadlined mobile UX layer (v1.3.0)
   tables, images, TOC, bottom bar, back-to-top, share
   ========================================================= */
:root {
    --rl-bnav-h: 62px;
    --rl-safe: env(safe-area-inset-bottom, 0px);
    --rl-ink: #1B3641;
    --rl-muted: #6b7c85;
}

/* ---------- overflow guards ---------- */
html, body { overflow-x: clip; }
#flyoff {
    right: 0;
    width: min(340px, 88vw);
    transform: translate3d(calc(100% + 40px), 0, 0);
    transition: transform .3s ease, visibility .3s;
}
#flyoff.is-open { right: 0; transform: none; }
.search-overlay-inner { max-width: calc(100vw - 24px); }
.search-overlay .search-form { max-width: 100%; }
.search-overlay .search-field { min-width: 0; }

.entry-content,
.single-shell .post-title,
.single-lead { overflow-wrap: anywhere; word-break: normal; }
.entry-content a { overflow-wrap: anywhere; }
.entry-content pre,
.entry-content code { white-space: pre-wrap; overflow-wrap: anywhere; }
.entry-content pre { overflow-x: auto; max-width: 100%; }
.entry-content iframe,
.entry-content video,
.entry-content embed,
.entry-content object { max-width: 100%; }
.entry-content iframe { width: 100%; aspect-ratio: 16 / 9; height: auto; }

/* ---------- tables: only the table scrolls ---------- */
.rl-table-wrap {
    position: relative;
    max-width: 100%;
    margin: 24px 0;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-x: contain;
    border: 1px solid var(--border-color, #e8e8e8);
    border-radius: 8px;
    background:
        linear-gradient(to right, #fff 30%, rgba(255,255,255,0)) left center / 28px 100% no-repeat local,
        linear-gradient(to left, #fff 30%, rgba(255,255,255,0)) right center / 28px 100% no-repeat local,
        radial-gradient(farthest-side at 0 50%, rgba(0,0,0,.14), rgba(0,0,0,0)) left center / 12px 100% no-repeat scroll,
        radial-gradient(farthest-side at 100% 50%, rgba(0,0,0,.14), rgba(0,0,0,0)) right center / 12px 100% no-repeat scroll;
}
.rl-table-wrap:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.rl-table-wrap > table {
    width: 100%;
    min-width: 520px;
    margin: 0 !important;
    max-width: none !important;
    overflow: visible !important;
    border-collapse: collapse;
    background: transparent;
}
.rl-table-wrap th,
.rl-table-wrap td { overflow-wrap: normal; word-break: normal; vertical-align: top; }
@media (max-width: 767px) {
    .rl-table-wrap { margin-left: 0; margin-right: 0; }
    .rl-table-wrap > table { font-size: 14px; line-height: 1.45; }
    .rl-table-wrap th, .rl-table-wrap td { padding: 9px 10px; min-width: 120px; }
    .rl-table-wrap th:first-child, .rl-table-wrap td:first-child { min-width: 130px; }
}

/* ---------- images ---------- */
.entry-content img {
    max-width: 100%;
    height: auto;
}
.entry-content figure,
.entry-content .wp-caption { width: auto !important; max-width: 100%; }
.entry-content .wp-caption img,
.entry-content figure img { width: 100%; margin: 0 0 6px; border-radius: 6px; background: #f2f2f2; }
.entry-content figcaption,
.entry-content .wp-caption-text { font-size: 13px; line-height: 1.5; color: #7a7a7a; overflow-wrap: anywhere; }
@media (max-width: 1023px) {
    .entry-content img,
    .entry-content figure img {
        max-height: 70vh;
        object-fit: cover;
    }
    .single-hero-image { margin: 18px auto 22px; }
    .single-hero-image img { max-height: 62vh; object-fit: cover; }
}
@media (max-width: 767px) {
    .entry-content img,
    .entry-content figure img { max-height: 58vh; }
    .single-hero-image img { max-height: 46vh; aspect-ratio: 4 / 3; }
}

/* ---------- headings anchor offset ---------- */
.entry-content h2[id],
.entry-content h3[id] { scroll-margin-top: 90px; }
.entry-content h2[id]:focus,
.entry-content h3[id]:focus { outline: none; }

/* ---------- reading progress ---------- */
.rl-progress {
    position: fixed; top: 0; left: 0; right: 0; height: 3px; z-index: 10020;
    pointer-events: none; opacity: 0; transition: opacity .2s;
}
.rl-progress__bar {
    display: block; height: 100%; background: var(--accent);
    transform-origin: 0 50%; transform: scaleX(0);
}
.rl-has-toc .rl-progress,
.single-post .rl-progress { opacity: 1; }
.rl-locked .rl-progress { opacity: 0; }

/* ---------- TOC list (shared) ---------- */
.rl-toc, .rl-toc__sub { list-style: none; margin: 0; padding: 0; }
.rl-toc a {
    display: flex; gap: 10px; align-items: baseline;
    padding: 9px 12px; border-radius: 8px;
    color: var(--rl-ink); text-decoration: none;
    font-size: 15px; line-height: 1.35; font-weight: 500;
    border-left: 3px solid transparent;
    transition: background-color .15s, color .15s, border-color .15s;
}
.rl-toc__h2 > a { font-weight: 600; }
.rl-toc__sub a { padding-left: 38px; font-size: 14px; color: #4a5a63; font-weight: 400; }
.rl-toc__n {
    flex: 0 0 auto; min-width: 22px; height: 22px; padding: 0 5px;
    display: inline-flex; align-items: center; justify-content: center;
    border-radius: 999px; background: #f0f2f4; color: var(--rl-muted);
    font-size: 12px; font-weight: 700; line-height: 1;
    transform: translateY(-1px);
}
.rl-toc a:hover, .rl-toc a:focus-visible { background: #f6f7f8; color: var(--rl-ink); }
.rl-toc a.is-done { color: #8a979e; }
.rl-toc a.is-active {
    background: rgba(253, 168, 51, .14);
    border-left-color: var(--accent);
    color: var(--rl-ink);
}
.rl-toc a.is-active .rl-toc__n { background: var(--accent); color: #fff; }

/* ---------- bottom sheets ---------- */
.rl-sheet {
    position: fixed; inset: 0; z-index: 10050;
    visibility: hidden; pointer-events: none;
}
.rl-sheet.is-open { visibility: visible; pointer-events: auto; }
.rl-sheet__overlay {
    position: absolute; inset: 0; background: rgba(16, 22, 34, .5);
    opacity: 0; transition: opacity .25s ease;
}
.rl-sheet.is-open .rl-sheet__overlay { opacity: 1; }
.rl-sheet__panel {
    position: absolute; left: 0; right: 0; bottom: 0;
    max-height: min(78vh, 720px);
    display: flex; flex-direction: column;
    background: #fff; border-radius: 18px 18px 0 0;
    box-shadow: 0 -10px 40px rgba(16, 22, 34, .25);
    padding-bottom: var(--rl-safe);
    transform: translate3d(0, 100%, 0);
    transition: transform .32s cubic-bezier(.32, .72, 0, 1);
}
.rl-sheet.is-open .rl-sheet__panel { transform: none; }
.rl-sheet__handle { width: 42px; height: 5px; border-radius: 3px; background: #d6dadd; margin: 8px auto 2px; }
.rl-sheet__head {
    display: flex; align-items: center; gap: 10px;
    padding: 8px 12px 12px 18px;
    border-bottom: 1px solid #eef0f2;
    font-family: var(--font-heading); font-weight: 700; font-size: 16px; color: var(--rl-ink);
}
.rl-sheet__head > i { color: var(--accent); }
.rl-toc-progress {
    margin-left: auto; padding: 3px 9px; border-radius: 999px;
    background: var(--accent); color: #fff; font-size: 12px; font-weight: 700;
}
.rl-toc-progress:empty { display: none; }
.rl-sheet__close {
    margin-left: auto; width: 40px; height: 40px; border: 0; border-radius: 50%;
    background: #f2f4f5; color: var(--rl-ink); font-size: 18px; cursor: pointer;
    display: inline-flex; align-items: center; justify-content: center;
}
.rl-toc-progress + .rl-sheet__close { margin-left: 6px; }
.rl-sheet__body { overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; padding: 10px 10px 16px; }
@media (min-width: 768px) {
    .rl-sheet__panel { left: 50%; right: auto; width: 560px; transform: translate3d(-50%, 100%, 0); }
    .rl-sheet.is-open .rl-sheet__panel { transform: translate3d(-50%, 0, 0); }
}
body.rl-locked { overflow: hidden; }

/* language sheet */
.rl-pop-list { list-style: none; margin: 0; }
.rl-pop-item { display: flex; align-items: center; gap: 12px; padding: 10px; border-radius: 10px; color: var(--rl-ink); text-decoration: none; }
.rl-pop-item:hover, .rl-pop-item:focus-visible { background: rgba(253, 168, 51, .12); }
.rl-pop-media { flex: 0 0 56px; width: 56px; height: 56px; border-radius: 10px; overflow: hidden; background: #eef0f2; display: flex; align-items: center; justify-content: center; color: var(--rl-muted); }
.rl-pop-media img { display: block; width: 100% !important; height: 100% !important; max-width: none; object-fit: cover; }
.rl-pop-text { min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.rl-pop-cat { font-size: 11px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--accent); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rl-pop-title { font-size: 15px; font-weight: 600; line-height: 1.3; overflow-wrap: anywhere; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.rl-sheet--pop .rl-sheet__head > i { color: #f2622e; }
.rl-lang-list { list-style: none; margin: 0; }
.rl-lang-item {
    display: flex; align-items: center; gap: 12px; padding: 13px 12px; border-radius: 10px;
    color: var(--rl-ink); text-decoration: none; font-weight: 500; font-size: 16px;
}
.rl-lang-item .lang-switch__flag {
    position: relative; display: block; flex: 0 0 34px;
    width: 34px; height: 34px; border-radius: 50%; overflow: hidden;
    box-shadow: 0 0 0 1px rgba(27, 54, 65, .14); background: #eef0f2;
    transform: translateZ(0);
}
.rl-lang-item .lang-switch__flag svg {
    position: absolute; inset: 0; display: block;
    width: 100% !important; height: 100% !important; max-width: none;
}
.rl-lang-item i { margin-left: auto; color: var(--accent); }
.rl-lang-item.is-current { background: rgba(253, 168, 51, .14); }

/* ---------- bottom navigation (phones) ---------- */
.rl-bnav { display: none; }
@media (max-width: 767px) {
    body { padding-bottom: calc(var(--rl-bnav-h) + var(--rl-safe)) !important; }
    .rl-bnav {
        display: flex; align-items: stretch;
        position: fixed; left: 0; right: 0; bottom: 0; z-index: 10010;
        height: calc(var(--rl-bnav-h) + var(--rl-safe));
        padding: 0 max(4px, env(safe-area-inset-right, 0px)) var(--rl-safe) max(4px, env(safe-area-inset-left, 0px));
        background: rgba(255, 255, 255, .97);
        -webkit-backdrop-filter: saturate(180%) blur(12px);
        backdrop-filter: saturate(180%) blur(12px);
        border-top: 1px solid #e6e9eb;
        box-shadow: 0 -6px 24px -14px rgba(16, 22, 34, .45);
        touch-action: manipulation;
    }
    .rl-bnav__item {
        flex: 1 1 0; min-width: 0;
        display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
        padding: 6px 2px; margin: 0; border: 0; background: none; cursor: pointer;
        color: var(--rl-ink); text-decoration: none; font-family: var(--font-body);
        font-size: 11.5px; font-weight: 500; line-height: 1.15;
        -webkit-tap-highlight-color: transparent;
    }
    .rl-bnav__item[hidden] { display: none; }
    @media (max-width: 419px) { .rl-bnav__item { font-size: 10.5px; padding-left: 1px; padding-right: 1px; } }
    .rl-bnav__item > span:last-child { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
    .rl-bnav__item i { font-size: 19px; color: var(--rl-muted); transition: color .15s, transform .15s; }
    .rl-bnav__item:hover i, .rl-bnav__item:focus-visible i,
    .rl-bnav__item[aria-expanded="true"] i, .rl-bnav__item[aria-current="page"] i { color: var(--accent); }
    .rl-bnav__item:active i { transform: scale(.9); }
    .rl-bnav__icon { position: relative; display: inline-flex; }
    .rl-bnav__item--accent .rl-bnav__icon {
        width: 44px; height: 30px; border-radius: 999px; align-items: center; justify-content: center;
        background: var(--accent); margin-top: -2px;
    }
    .rl-bnav__item--accent .rl-bnav__icon i { color: #fff; font-size: 16px; }
    .rl-bnav .rl-toc-step {
        position: absolute; top: -9px; right: -14px;
        padding: 2px 5px; border-radius: 999px; background: var(--rl-ink); color: #fff;
        font-size: 10px; font-weight: 700; line-height: 1.2; font-style: normal; white-space: nowrap;
    }
    .rl-bnav .rl-toc-step:empty { display: none; }

    /* header: logo on the left, language on the right; search + menu live in the bar */
    .header-top-row { padding: 10px 0 !important; }
    .header-top-inner { display: flex !important; align-items: center; justify-content: flex-start !important; flex-direction: row !important; flex-wrap: nowrap !important; gap: 12px; }
    .header-top-inner::before, .header-top-inner::after { content: none !important; display: none !important; }
    .header-social { display: none !important; }
    .site-branding { order: 0 !important; flex: 0 1 auto; text-align: left; margin: 0 !important; justify-self: start; }
    .site-branding .logo { margin: 0 !important; }
    /* logo.png has wide transparent side padding (artwork spans x 96-204 of 300): crop it so the mark really sits left */
    .site-branding .custom-logo { width: auto !important; height: 50px !important; max-width: none; max-height: none; aspect-ratio: 108 / 75; object-fit: cover; object-position: 50% 50%; }
    .header-icons { order: 1 !important; margin-left: auto !important; width: auto !important; align-self: center !important; flex: 0 0 auto; }
    .header-icons .search-toggle,
    .header-icons .flyoff-toggle { display: none !important; }
    body.search-active .rl-bnav,
    body.flyoff-active .rl-bnav { z-index: 1; }
}

/* ---------- floating TOC pill (tablets) + aside (wide desktop) ---------- */
.rl-toc-fab, .rl-up {
    position: fixed; z-index: 10000;
    display: inline-flex; align-items: center; justify-content: center;
    border: 0; margin: 0; cursor: pointer; font-family: inherit;
    -webkit-tap-highlight-color: transparent;
    opacity: 0; visibility: hidden; transform: translate3d(0, 14px, 0) scale(.92);
    transition: opacity .25s ease, transform .3s cubic-bezier(.32, .72, 0, 1), visibility .25s;
}
.rl-toc-fab[hidden] { display: none; }
.rl-toc-fab {
    left: 18px; bottom: calc(18px + var(--rl-safe));
    gap: 9px; height: 46px; padding: 0 18px 0 15px; border-radius: 999px;
    background: #fff; color: var(--rl-ink); font-size: 15px; font-weight: 600;
    box-shadow: 0 10px 26px -10px rgba(16, 22, 34, .5), 0 1px 3px rgba(16, 22, 34, .14);
}
.rl-toc-fab i { color: var(--accent); }
.rl-toc-fab .rl-toc-step {
    padding: 3px 7px; border-radius: 999px; background: var(--accent); color: #fff;
    font-size: 11px; font-weight: 700; line-height: 1.2;
}
.rl-toc-fab .rl-toc-step:empty { display: none; }
.rl-reading .rl-toc-fab { opacity: 1; visibility: visible; transform: none; }
@media (max-width: 767px), (min-width: 1280px) { .rl-toc-fab { display: none !important; } }

.rl-toc-aside { display: none; }
@media (min-width: 1280px) {
    .rl-toc-aside:not([hidden]) {
        display: block; position: fixed; z-index: 50;
        top: 110px; left: max(16px, calc(50% - 610px)); width: 230px;
        max-height: calc(100vh - 150px); overflow-y: auto; overscroll-behavior: contain;
        padding: 14px 8px 14px 6px; background: #fff;
        border: 1px solid #eef0f2; border-radius: 12px;
        box-shadow: 0 8px 30px -18px rgba(16, 22, 34, .35);
        opacity: 0; visibility: hidden; transform: translate3d(-8px, 0, 0);
        transition: opacity .25s, transform .25s, visibility .25s;
        scrollbar-width: thin;
    }
    .rl-reading .rl-toc-aside:not([hidden]) { opacity: 1; visibility: visible; transform: none; }
    .rl-toc-aside__head {
        margin: 0 0 8px; padding: 0 10px 8px; border-bottom: 1px solid #eef0f2;
        font-family: var(--font-heading); font-size: 13px; font-weight: 700;
        text-transform: uppercase; letter-spacing: .04em; color: var(--rl-ink);
    }
    .rl-toc-aside__head i { color: var(--accent); margin-right: 4px; }
    .rl-toc-aside .rl-toc a { padding: 6px 8px; font-size: 13.5px; }
    .rl-toc-aside .rl-toc__sub a { padding-left: 34px; font-size: 13px; }
    .rl-toc-aside .rl-toc__n { min-width: 20px; height: 20px; font-size: 11px; }
}

/* ---------- back to top ---------- */
.rl-up {
    right: 18px; bottom: calc(18px + var(--rl-safe));
    width: 46px; height: 46px; padding: 0; border-radius: 50%;
    background: var(--accent); color: #fff; font-size: 18px;
    box-shadow: 0 8px 22px -8px rgba(253, 168, 51, .85), 0 2px 6px rgba(16, 22, 34, .18);
}
.rl-up.is-visible { opacity: 1; visibility: visible; transform: none; }
.rl-up:hover, .rl-up:focus-visible { filter: brightness(1.06); color: #fff; }
.rl-up:active { transform: scale(.93); }
@media (max-width: 767px) {
    .rl-up { right: 14px; bottom: calc(var(--rl-bnav-h) + var(--rl-safe) + 14px); width: 44px; height: 44px; }
}
.rl-locked .rl-up, .rl-locked .rl-toc-fab,
body.search-active .rl-up, body.flyoff-active .rl-up { opacity: 0 !important; visibility: hidden !important; }

/* ---------- share ---------- */
.rl-share { display: block; padding: 20px 0; }
.rl-share__label {
    margin: 0 0 12px; font-family: var(--font-heading); font-size: 13px; font-weight: 700;
    letter-spacing: .06em; text-transform: uppercase; color: var(--rl-ink);
}
.rl-share__list { display: flex; flex-wrap: wrap; gap: 8px; }
.rl-share .share-btn {
    display: inline-flex; align-items: center; gap: 7px;
    min-height: 40px; padding: 8px 14px; border-radius: 999px;
    font-size: 13px; font-weight: 600; color: #fff; background: #555; text-decoration: none !important;
}
.rl-share .share-btn:hover, .rl-share .share-btn:focus-visible { color: #fff; opacity: .88; }
.rl-share .share-btn[hidden] { display: none; }
.rl-share--facebook { background: #1877F2 !important; }
.rl-share--x { background: #000 !important; }
.rl-share--telegram { background: #229ED9 !important; }
.rl-share--whatsapp { background: #25D366 !important; }
.rl-share--viber { background: #7360F2 !important; }
.rl-share--linkedin { background: #0A66C2 !important; }
.rl-share--pinterest { background: #E60023 !important; }
.rl-share--reddit { background: #FF4500 !important; }
.rl-share--email { background: #5f6b72 !important; }
.rl-share--copy { background: var(--rl-ink) !important; }
.rl-share--copy.is-done { background: #2e9d5b !important; }
.rl-share__native { background: var(--accent) !important; }
.rl-share__status { margin: 8px 0 0; min-height: 1em; font-size: 13px; color: #2e9d5b; }
@media (max-width: 767px) {
    .rl-share__list { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 8px; }
    .rl-share .share-btn { justify-content: center; padding: 0; min-height: 44px; border-radius: 12px; font-size: 18px; }
    .rl-share .share-btn span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
    .rl-share .rl-share__native { grid-column: 1 / -1; font-size: 15px; gap: 8px; }
    .rl-share .rl-share__native span { position: static; width: auto; height: auto; clip: auto; }
}
.rl-share .rl-ico-x { width: 15px; height: 15px; }

/* ---------- comments are off ---------- */
.kicker-comments, .comments-area, #respond, .comment-respond { display: none !important; }

@media (prefers-reduced-motion: reduce) {
    .rl-sheet__panel, .rl-sheet__overlay, .rl-up, .rl-toc-fab, .rl-toc-aside, #flyoff { transition: none !important; }
}
@media print {
    .rl-bnav, .rl-up, .rl-toc-fab, .rl-toc-aside, .rl-sheet, .rl-progress, .rl-share { display: none !important; }
    body { padding-bottom: 0 !important; }
}
