/* =============================================================================
   KOTOVA X · shared navigation of the product pages (class prefix xn-):
   kotova.io/x/* (Kotova X) and kotova.io/books/* (Kotova Books)
   -----------------------------------------------------------------------------
   Load AFTER /styles.css and BEFORE the page stylesheet:
     /styles.css, /x/x.css, /x/<page>.css   (Books: /books/books.css, page css)
   The markup is generated (scripts/generate-x-nav.mjs from scripts/site-nav.json
   + the product's bar spec, scripts/x-nav.json or scripts/books-nav.json)
   between <!--XNAV:START [product=<id> ]current=<id>--> and <!--XNAV:END-->
   on every product page; the behaviour is /x/x.js. Neither depends on page code.

   Header = row 1 + row 2, both inside ONE fixed <nav class="navbar xn-navbar">:
     row 1  the site navbar (styles.css .navbar, same markup as kotova.io), so
            script.js keeps driving the currency/language switchers and the
            hide-on-scroll. Brand -> / (kotova.io). Services from 1024px; the
            globe (-> kotova.io) at EVERY width. No "Products" menu (row 2 has
            the product switcher) and no Launch App: that button belongs to
            the app, so it lives in the app's bar (row 2).
     row 2  .xn-bar, the product's section bar, absolutely positioned under
            row 1. Being a child of the fixed navbar it rides the navbar's
            hide-on-scroll transform, which moves the navbar up by exactly
            row 1's height (translateY(-100%)), so row 2 ends up pinned at the
            top of the viewport. At its left the product switcher (.xn-prod,
            768px and up: Kotova X <-> Kotova Books), then
              >= 1024px  .xn-desk   inline links + menu dropdowns ("Get listed")
              768-1023   .xn-tab    pill track (fits in all six languages from 768px)
              < 768px    .xn-phone  section switcher + .xn-sheet (with a
                                    "Products" group instead of .xn-prod)
            and at every width the app's CTA (.xn-cta: Launch App, or the
            disabled Launch Books while Books is closed) at its right end,
            pinned with row 2 when row 1 scrolls away.

   Heights (row 1 + row 2) -> --xn-offset:
              >= 1024px   77 + 49 = 126
              769-1023    77 + 53 = 130
              768         73 + 53 = 126   (site navbar padding 16px at <=768)
              600-767     73 + 61 = 134   (row 2 is already the phone switcher)
              < 600px     65 + 61 = 126   (44px controls + 2 x 10px on phones)
   x.js re-measures the real height and writes --xn-offset on <html>; these
   values are the pre-JS fallback (a tablet row on fit step 7, section 4b,
   is the 61px phone row). The Books pages pad by it too (--bk-offset).

   Touch targets below 1024px are at least 44 x 44: phones get real 44px
   row-1 controls and a 44px Launch App; tablets keep the site's 40px
   switchers, the 36px pills and the 36px Launch App visually and get an
   invisible 44px hit area (::after, sections 1, 3b and 4).

   Page contract: content in <main class="xn-main"> (gets the top offset);
   html gets scroll-padding-top so #anchors clear the header.

   Leak rules (same as books/books.css): every class is xn-, or scoped under
   .navbar.xn-navbar / .xn-main / .kxd-chrome .xn-navbar; html only as
   html:has(.xn-navbar) or html.xn-locked; :root only gains --xn-* (and the
   --kxd-nav fallback on asset pages, which kx-pages.js overwrites anyway).

   Sections
     0. Tokens + breakpoints
     1. Row 1 (site navbar, Kotova X variant)
     2. Row 2 shell + breakpoint switch
     3. Desktop row + dropdown + live pill
     3a. Product switcher, badge
     3b. Launch App (row 2, every width)
     4. Tablet pill track
     4b. Tablet fit (steps x.js adds while the track would not fit)
     5. Phone switcher + sheet
     6. Page frame (offset, scroll padding, existing /x pages)
     7. Asset pages (navbar inside .kxd-chrome)
     8. Motion
   ========================================================================== */


/* =============================================================================
   0. TOKENS + BREAKPOINTS
   ========================================================================== */

:root {
    --xn-r1-h: 77px;                         /* row 1: 44px logo + 2 x 16px + 1px border */
    --xn-bar-h: 49px;                        /* row 2: 48px + 1px border (desktop) */
    --xn-offset: calc(var(--xn-r1-h) + var(--xn-bar-h));
    --xn-pad-x: var(--spacing-xl);
    --xn-pad-y: var(--spacing-md);

    --xn-canvas: rgba(10, 15, 28, 0.97);
    --xn-ink: #F5F7FA;
    --xn-ink-2: #C3CBD8;
    --xn-muted: var(--color-text-secondary);  /* #8B95A5 */
    --xn-gold: var(--color-secondary);        /* #C5A572 */
    --xn-gold-2: #E8D5B5;
    --xn-line: var(--color-border-light);     /* rgba(255,255,255,.1) */
    --xn-line-soft: rgba(255, 255, 255, 0.06);
    --xn-surface: var(--color-background-card);  /* #151C2C */
    --xn-surface-3: #222C42;                  /* menus, popovers */
    --xn-gold-line: rgba(197, 165, 114, 0.45);
    --xn-gold-tint: rgba(197, 165, 114, 0.10);
    --xn-gold-tint-2: rgba(197, 165, 114, 0.15);
    --xn-under: linear-gradient(90deg, rgba(197, 165, 114, 0) 0%, #C5A572 30%, #E8D5B5 50%, #C5A572 70%, rgba(197, 165, 114, 0) 100%);
    --xn-ring: 2px solid var(--color-secondary);
}

@media (max-width: 1023.98px) {
    :root {
        --xn-bar-h: 53px;                    /* 36px pill + 2 x 8px + 1px border */
    }
}

@media (max-width: 768px) {
    :root {
        --xn-r1-h: 73px;                     /* 40px toggles + 2 x 16px + 1px border */
        --xn-pad-x: var(--spacing-md);
    }
}

/* Row 2 switches to the phone switcher below 768px: under that width the pill
   track no longer fits in every language (Russian needs ~760px). */
@media (max-width: 767.98px) {
    :root {
        --xn-bar-h: 61px;                    /* 44px switcher + 2 x 8px + 1px border */
    }
}

@media (max-width: 599.98px) {
    :root {
        --xn-r1-h: 65px;                     /* 44px controls + 2 x 10px + 1px border */
        --xn-pad-y: 10px;
    }
}


/* =============================================================================
   1. ROW 1 — the site navbar, Kotova X variant
   styles.css .navbar / .nav-links / .nav-controls / switchers all still
   apply; this keeps the globe visible at every width (the site hides the
   whole .nav-links group at <=1024px) and tightens phones. No .nav-app-btn
   here: the Launch App is the app's, in row 2 (section 3b).
   ========================================================================== */

.navbar.xn-navbar {
    padding: var(--xn-pad-y) var(--xn-pad-x);
}

/* Never wrap or hyphenate a nav label (the global span/a rule allows both). */
.xn-navbar a.navbar-brand,
.xn-navbar .brand-accent,
.xn-navbar .nav-link,
.xn-bar a,
.xn-bar button,
.xn-bar span,
.xn-bar p {
    white-space: nowrap;
    word-break: keep-all;
    overflow-wrap: normal;
    -webkit-hyphens: none;
    hyphens: none;
}

.xn-navbar .xn-brand {
    flex-shrink: 0;
}

.navbar.xn-navbar .nav-links {
    display: flex;
    align-items: center;
}

.xn-navbar .nav-link:focus-visible,
.xn-navbar .xn-brand:focus-visible {
    outline: 2px solid rgba(197, 165, 114, 0.6);
    outline-offset: 4px;
    border-radius: 4px;
}

/* Desktop: the globe keeps the site's bare 18px icon; an invisible 40px square
   around it is the click target (32px of free row on each side, so it never
   reaches the separator or the currency switcher). */
@media (min-width: 1024px) {
    .xn-navbar .xn-home {
        position: relative;
    }

    .xn-navbar .xn-home::after {
        content: "";
        position: absolute;
        inset: -11px;
    }
}

/* One rule for every /x page: the panther shows above 500px (styles.css hides
   it at <=500px site-wide; the API page used to drop it at 540px for its
   longer "Become Partner" button, which this navbar no longer has). */
@media (min-width: 501px) {
    .navbar.xn-navbar a.navbar-brand .brand-logo {
        display: block;
    }
}

/* Below 1024px: Contact, Services and the separator hide (as on kotova.io);
   the globe stays as a 40px square, the same height as the switchers. */
@media (max-width: 1023.98px) {
    .xn-navbar .xn-wide {
        display: none;
    }

    .navbar.xn-navbar .nav-links {
        gap: 0;
        margin-right: var(--spacing-sm);
    }

    .xn-navbar .xn-home {
        width: 40px;
        height: 40px;
        justify-content: center;
        border-radius: var(--radius-md);
        transition: background-color var(--transition-fast);
    }

    .xn-navbar .xn-home:hover {
        background: var(--xn-gold-tint);
    }

    /* 44px hit areas without changing the look: an invisible ::after, 44px
       tall and centred, on every row-1 control (the globe also 2px wider on
       each side). Nothing in styles.css uses these pseudo-elements. */
    .xn-navbar .xn-brand,
    .xn-navbar .xn-home,
    .xn-navbar .currency-toggle,
    .xn-navbar .language-toggle {
        position: relative;
    }

    .xn-navbar .xn-brand::after,
    .xn-navbar .xn-home::after,
    .xn-navbar .currency-toggle::after,
    .xn-navbar .language-toggle::after {
        content: "";
        position: absolute;
        top: 50%;
        left: 0;
        right: 0;
        height: 44px;
        margin-top: -22px;
    }

    .xn-navbar .xn-home::after {
        left: -2px;
        right: -2px;
    }
}

/* Phones: real 44px controls (the approved phone navbar), in the same 65px
   row (padding 10px instead of 12px, see --xn-pad-y). */
@media (max-width: 599.98px) {
    .xn-navbar a.navbar-brand {
        min-height: 44px;
    }

    .xn-navbar .xn-home {
        width: 44px;
        height: 44px;
    }

    .xn-navbar .currency-toggle,
    .xn-navbar .language-toggle {
        height: 44px;
        min-width: 44px;
        justify-content: center;
    }
}

/* Phones: brand + globe + both switchers must fit from 320px. */
@media (max-width: 420px) {
    .xn-navbar a.navbar-brand {
        font-size: 1.2rem;
    }

    .navbar.xn-navbar .nav-links {
        margin-right: 6px;
    }

    .xn-navbar .nav-controls {
        gap: 6px;
    }

    .xn-navbar .currency-toggle,
    .xn-navbar .language-toggle {
        padding: 0 0.55rem;
        gap: 0.35rem;
    }
}

@media (max-width: 360px) {
    .xn-navbar .currency-toggle .chevron,
    .xn-navbar .language-toggle .chevron {
        display: none;
    }
}

/* The merged menu (script.js initNavMenu, styles.css MERGED NAV MENU) replaces
   the two switchers when Services hides, i.e. below 1024px on /x (styles.css
   switches at <=1024px for the other pages). On phones it is 44px tall like
   the globe beside it, not the app's compact 36px. */
@media (min-width: 1024px) {
    .navbar.xn-navbar.has-nav-menu .nav-menu {
        display: none;
    }

    .navbar.xn-navbar.has-nav-menu .currency-switch,
    .navbar.xn-navbar.has-nav-menu .language-switch {
        display: block;
    }
}

@media (max-width: 599.98px) {
    .xn-navbar .nav-menu-trigger {
        height: 44px;
    }
}


/* =============================================================================
   2. ROW 2 — shell + breakpoint switch
   ========================================================================== */

.xn-bar {
    position: absolute;
    top: calc(100% + 1px);                   /* under row 1's 1px bottom border */
    left: 0;
    right: 0;
    background: var(--xn-canvas);
    border-bottom: 1px solid var(--xn-line);
    font-family: var(--font-primary);
    color: var(--xn-ink);
}

.xn-bar ul {
    list-style: none;
    margin: 0;
    padding: 0;
}

/* Row 2 is one flex line: the variant for this width (desk / tab / phone)
   takes the room, the app's Launch App (.xn-cta, section 3b) the right end.
   The sheet is absolutely positioned and stays out of the line. */
.xn-bar {
    display: flex;
    align-items: center;
}

.xn-desk,
.xn-tab,
.xn-phone {
    flex: 1 1 auto;
    min-width: 0;
}

.xn-desk {
    display: flex;
}

.xn-tab,
.xn-phone,
.xn-sheet {
    display: none;
}

@media (max-width: 1023.98px) {
    .xn-desk {
        display: none;
    }

    .xn-tab {
        display: block;
    }
}

@media (max-width: 767.98px) {
    .xn-tab {
        display: none;
    }

    .xn-phone {
        display: flex;
    }

    .xn-sheet:not([hidden]) {
        display: block;
    }
}


/* =============================================================================
   3. DESKTOP ROW (>= 1024px) + "Get listed" dropdown + live pill
   ========================================================================== */

.xn-desk {
    align-items: center;
    gap: 4px;
    height: 48px;
    padding: 0 var(--xn-pad-x);
}

/* The product switcher (section 3a) leads the row and keeps row 1's inset. */
.xn-bar--prod .xn-desk {
    padding-left: 0;
}

.xn-group {
    flex: none;
    display: flex;
    align-items: center;
}

/* A hairline before every group: after the product switcher and between groups. */
.xn-group::before {
    content: "";
    flex: none;
    display: block;
    width: 1px;
    height: 16px;
    margin: 0 4px;
    background: var(--xn-line);
}

.xn-link {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    height: 48px;
    padding: 0 12px;
    border: 0;
    background: transparent;
    color: var(--xn-muted);
    font-family: inherit;
    font-size: 14px;
    font-weight: 500;
    line-height: 20px;
    text-decoration: none;
    cursor: pointer;
    transition: color var(--transition-fast);
}

.xn-link:hover {
    color: var(--xn-ink);
}

/* Current page (aria-current, set by the generator), and the dropdown trigger
   while it is open or holds the current page: gold. */
.xn-link[aria-current],
.xn-dd-btn.is-current,
.xn-dd-btn[aria-expanded="true"] {
    color: var(--xn-gold);
}

.xn-link[aria-current]:hover,
.xn-dd-btn.is-current:hover,
.xn-dd-btn[aria-expanded="true"]:hover {
    color: var(--xn-gold-2);
}

/* Gold underline on the row's bottom edge, fading out at both ends. */
.xn-link[aria-current]::after,
.xn-dd-btn.is-current::after {
    content: "";
    position: absolute;
    left: 12px;
    right: 12px;
    bottom: 0;
    height: 2px;
    border-radius: 2px;
    background: var(--xn-under);
}

.xn-link:focus-visible {
    outline: var(--xn-ring);
    outline-offset: -6px;
    border-radius: 10px;
}

.xn-ext {
    flex: none;
    opacity: 0.7;
}

.xn-chev {
    flex: none;
    transition: transform 0.2s ease;
}

.xn-dd-btn[aria-expanded="true"] .xn-chev,
.xn-switch[aria-expanded="true"] .xn-chev {
    transform: rotate(180deg);
}

/* --- Dropdown --- */
.xn-dd {
    position: relative;
}

.xn-dd-btn {
    gap: 6px;
}

.xn-dd-panel {
    position: absolute;
    top: calc(100% + 6px);
    left: 4px;
    z-index: 2;
    width: 400px;
    max-width: calc(100vw - 2 * var(--xn-pad-x));
    padding: 8px;
    border-radius: var(--radius-xl);
    border: 1px solid rgba(197, 165, 114, 0.22);
    background: var(--xn-surface-3);
    box-shadow: 0 24px 48px -16px rgba(0, 0, 0, 0.6);
}

.xn-dd-panel[hidden] {
    display: none;
}

.xn-dd-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.xn-dd-row {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px;
    border-radius: var(--radius-lg);
    text-decoration: none;
    transition: background-color var(--transition-fast);
}

.xn-dd-row:hover {
    background: rgba(255, 255, 255, 0.05);
}

.xn-dd-row[aria-current],
.xn-dd-row[aria-current]:hover {
    background: rgba(197, 165, 114, 0.08);
}

.xn-dd-row:focus-visible {
    outline: var(--xn-ring);
    outline-offset: -2px;
}

.xn-dd-icon {
    flex: none;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 10px;
    border: 1px solid rgba(197, 165, 114, 0.25);
    background: var(--xn-gold-tint);
    color: var(--xn-gold);
}

.xn-dd-text {
    flex: 1 1 auto;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.xn-dd-title {
    font-size: 14px;
    line-height: 20px;
    font-weight: 600;
    color: var(--xn-ink);
}

.xn-dd-row[aria-current] .xn-dd-title {
    color: var(--xn-gold);
}

.xn-bar .xn-dd-desc {
    font-size: 13px;
    line-height: 18px;
    color: var(--xn-ink-2);
    white-space: normal;
}

.xn-dd-end {
    flex: none;
    color: var(--xn-muted);
}

.xn-dd-row[aria-current] .xn-dd-end {
    color: var(--xn-gold);
}

.xn-bar .xn-dd-talk {
    margin-top: 4px;
    padding: 12px 12px 6px;
    border-top: 1px solid var(--xn-line-soft);
    font-size: 12px;
    line-height: 18px;
    color: var(--xn-ink-2);
    white-space: normal;
}

.xn-dd-talk a {
    color: var(--xn-gold);
    text-decoration: none;
    white-space: nowrap;
}

.xn-dd-talk a:hover {
    color: var(--xn-gold-2);
}

.xn-dd-talk a:focus-visible {
    outline: var(--xn-ring);
    outline-offset: 2px;
    border-radius: 4px;
}

/* --- Live pill (>= 1200px): the connected-source count from script.js
   initLiveStats (.stat-inline[data-stat]), "10+" until it arrives. --- */
/* May shrink (min-width 0, overflow hidden) so a long custom site-notice
   heading ends in an ellipsis instead of running under Launch App; the count
   and the preset headings always fit. */
.xn-live {
    flex: 0 1 auto;
    min-width: 0;
    overflow: hidden;
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    height: 26px;
    margin-left: auto;
    padding: 0 12px;
    border-radius: var(--radius-full);
    border: 1px solid rgba(0, 212, 170, 0.3);
    background: rgba(0, 212, 170, 0.12);
    color: var(--color-success);
    font-size: 12px;
    font-weight: 600;
    line-height: 16px;
}

.xn-live-dot {
    flex: none;
    display: block;
    width: 6px;
    height: 6px;
    border-radius: var(--radius-full);
    background: var(--color-success);
}

.xn-live-num {
    font-family: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
    font-weight: 500;
}

/* Site notice on (x/x.js section 6): the notice's translated heading in the
   notice's colour (--xn-notice-rgb, "r, g, b" of the admin's #rrggbb), same
   tints as the green default. A translation too long for the row ends in an
   ellipsis. */
.xn-live--notice {
    border-color: rgba(var(--xn-notice-rgb), 0.3);
    background: rgba(var(--xn-notice-rgb), 0.12);
    color: rgb(var(--xn-notice-rgb));
}

.xn-live--notice .xn-live-dot {
    background: rgb(var(--xn-notice-rgb));
}

.xn-live-notice {
    min-width: 0;
    max-width: 360px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

@media (max-width: 1199.98px) {
    .xn-live {
        display: none;
    }
}


/* =============================================================================
   3a. PRODUCT SWITCHER (.xn-prod, 768px and up), BADGE
   The product mark at the left of row 2 is a dropdown (scripts/site-nav.json
   products): the current product's icon + name + chevron; the panel lists
   every product (icon tile, name, "Early access" badge, description; a check
   on the current one). x.js drives it like any [data-xn-dd]. It sits outside
   .xn-desk, so it leads the tablet row as well (icon + chevron there, the
   name stays the accessible name); phones get the sheet's "Products" group.
   Placed after the dropdown rules: same specificity, these win.
   ========================================================================== */

.xn-prod {
    flex: none;
    align-self: stretch;                     /* full row height: the panel hangs 6px under the bar, like "Get listed" */
    display: flex;
    align-items: center;
    margin-left: calc(var(--xn-pad-x) - 8px);   /* the icon lines up with row 1's brand */
}

.xn-prod-btn {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    height: 36px;
    padding: 0 6px 0 8px;
    border: 0;
    border-radius: 10px;
    background: transparent;
    color: var(--xn-gold);
    font-family: inherit;
    font-size: 12px;
    line-height: 16px;
    font-weight: 600;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    cursor: pointer;
    transition: color var(--transition-fast), background-color var(--transition-fast);
}

.xn-prod-btn:hover {
    color: var(--xn-gold-2);
    background: rgba(255, 255, 255, 0.05);
}

.xn-prod-btn[aria-expanded="true"],
.xn-prod-btn[aria-expanded="true"]:hover {
    color: var(--xn-gold-2);
    background: var(--xn-gold-tint);
}

.xn-prod-btn:focus-visible {
    outline: var(--xn-ring);
    outline-offset: 0;
}

.xn-prod-icon {
    display: block;
    flex: none;
    width: 20px;
    height: 20px;
    border-radius: 5px;
}

/* The letter-spacing already leaves room after the name. */
.xn-prod-btn .xn-chev {
    margin-left: -4px;
    color: var(--xn-muted);
    transition: transform 0.2s ease, color var(--transition-fast);
}

.xn-prod-btn:hover .xn-chev,
.xn-prod-btn[aria-expanded="true"] .xn-chev {
    color: inherit;
}

.xn-prod-panel {
    width: 400px;
}

/* Product rows: the product's own square icon instead of a gold glyph tile. */
.xn-bar .xn-prod-tile {
    border: 0;
    background: none;
}

.xn-prod-tile img {
    display: block;
    width: 40px;
    height: 40px;
    border-radius: 9px;
}

.xn-dd-head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px 8px;
}

/* "Early access": the IR page's badge (investor-relations .product-card.early),
   Live's green as a dashed outline. */
.xn-bar .xn-badge {
    flex: none;
    display: inline-flex;
    align-items: center;
    height: 20px;
    padding: 0 8px;
    border-radius: var(--radius-full);
    border: 1px dashed rgba(0, 212, 170, 0.45);
    color: var(--color-success);
    font-size: 10px;
    line-height: 1;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

/* Tablet: icon + chevron, a hairline to the pill track; the track's run
   starts at its soft edge (x.css 4b tightens both further if needed). */
@media (max-width: 1023.98px) {
    .xn-prod::after {
        content: "";
        flex: none;
        display: block;
        width: 1px;
        height: 20px;
        margin-left: 6px;
        background: var(--xn-line);
    }

    .xn-prod-btn {
        gap: 6px;
        padding: 0 6px 0 8px;
    }

    .xn-prod-name {
        position: absolute;
        width: 1px;
        height: 1px;
        margin: -1px;
        overflow: hidden;
        clip: rect(0 0 0 0);
        clip-path: inset(50%);
    }

    .xn-prod-btn .xn-chev {
        margin-left: 0;
    }

    /* 44px tall hit area for the 36px button. */
    .xn-prod-btn::after {
        content: "";
        position: absolute;
        top: 50%;
        left: 0;
        right: 0;
        height: 44px;
        margin-top: -22px;
    }

    .xn-bar.xn-bar--prod .xn-track-run {
        padding-left: var(--xn-fade);
    }
}

@media (max-width: 767.98px) {
    .xn-prod {
        display: none;
    }
}


/* =============================================================================
   3b. LAUNCH APP (.xn-cta) — the app's own button, every width
   One link at the right end of row 2 (x-nav.json bar.cta; .xn-bar--cta when
   the bar has one); row 1 has none on these pages, so the next app's pages
   bring their own in their own bar. Gold like the site's .nav-app-btn, sized
   per row variant:
     >= 1024px  32px tall in the 48px row, after the live pill
     768-1023   36px (the pill height), outside the pill track: never scrolls
                away; x.js steps the row tighter if the track would not fit
                (section 4b), the last steps show a compact label ("App"),
                then the arrow
     < 768px    44px (the switcher height), right of the section switcher
   It ends at row 1's right inset (--xn-pad-x), under the language switcher.
   Row 2 stays pinned when row 1 hides on scroll, so the button stays in view.
   While the phone sheet is open (.xn-bar.xn-sheet-open, x.js) it steps aside
   for the close button; the sheet's foot has its own Launch App.
   ========================================================================== */

.xn-cta {
    position: relative;
    flex: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    height: 32px;
    margin-right: var(--xn-pad-x);
    padding: 0 16px;
    border-radius: var(--radius-md);
    background: var(--gradient-primary);
    color: var(--color-background);
    font-family: inherit;
    font-size: 14px;
    font-weight: 600;
    line-height: 20px;
    text-decoration: none;
    transition: transform var(--transition-fast), box-shadow var(--transition-fast);
}

.xn-cta:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-gold);
}

.xn-cta:focus-visible {
    outline: var(--xn-ring);
    outline-offset: 3px;
}

/* Only the arrow-only tablet step (4b, step 6) shows the icon. */
.xn-cta-icon {
    display: none;
    flex: none;
}

/* App not open yet (bar.cta.soon, the Books bar): the button keeps its
   design, dimmed and without its hover lift; it stays hoverable and
   focusable for its "Coming soon" tooltip (books/books.js §6), so no
   pointer-events: none. Same look as books.css .btn[data-bk-soon]. */
.xn-cta[data-bk-soon],
.xn-sheet-cta[data-bk-soon] {
    opacity: 0.55;
    cursor: not-allowed;
}

.xn-cta[data-bk-soon]:hover,
.xn-sheet-cta[data-bk-soon]:hover {
    transform: none;
    box-shadow: none;
}

.xn-bar--cta .xn-desk {
    padding-right: 12px;
}

@media (max-width: 1023.98px) {
    .xn-cta {
        height: 36px;
        padding: 0 14px;
    }

    /* 44px tall hit area for the 36px tablet button (the 53px row holds it). */
    .xn-cta::after {
        content: "";
        position: absolute;
        top: 50%;
        left: 0;
        right: 0;
        height: 44px;
        margin-top: -22px;
    }
}

@media (max-width: 767.98px) {
    .xn-cta {
        height: 44px;
        margin-left: 8px;
        padding: 0 16px;
        border-radius: var(--radius-lg);
    }

    .xn-bar--cta .xn-phone {
        padding-right: 0;
    }

    .xn-bar.xn-sheet-open .xn-cta {
        display: none;
    }

    .xn-bar.xn-sheet-open .xn-phone {
        padding-right: var(--spacing-md);
    }
}

/* Small phones: a tighter button, and the switcher trades its "KOTOVA X /"
   (or "KOTOVA BOOKS /") prefix for the product's icon (the words stay as part
   of its accessible name), so the current section keeps room next to the
   button. From 480px the full prefix fits beside the button in all six
   languages. */
@media (max-width: 479.98px) {
    .xn-cta {
        padding: 0 12px;
        font-size: 13px;
    }

    .xn-bar--cta .xn-switch {
        padding: 0 12px;
    }

    .xn-bar--cta .xn-switch-icon {
        display: block;
    }

    .xn-bar--cta .xn-switch-kx {
        position: absolute;
        width: 1px;
        height: 1px;
        margin: -1px;
        padding: 0;
        overflow: hidden;
        clip: rect(0 0 0 0);
        clip-path: inset(50%);
    }

    .xn-bar--cta .xn-switch-sep {
        display: none;
    }
}


/* =============================================================================
   4. TABLET PILL TRACK (768-1023px)
   Centred while it fits; scrolls from the first pill when it does not (the
   run is max-content wide with auto margins, which collapse to 0 on
   overflow). x.js scrolls the current pill into view once.
   With the app's Launch App at the row's end (.xn-bar--cta) the run starts
   at row 1's inset instead, under the brand, as the desktop row does, and
   section 4b keeps it from scrolling at all.
   ========================================================================== */

.xn-track {
    --xn-fade: 20px;                         /* soft edges; the run's end padding is at least this */
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-x: contain;
    -webkit-mask-image: linear-gradient(90deg, transparent 0, #000 var(--xn-fade), #000 calc(100% - var(--xn-fade)), transparent 100%);
    mask-image: linear-gradient(90deg, transparent 0, #000 var(--xn-fade), #000 calc(100% - var(--xn-fade)), transparent 100%);
}

.xn-track::-webkit-scrollbar {
    display: none;
}

.xn-track-run {
    display: flex;
    align-items: center;
    gap: 8px;
    width: max-content;
    margin: 0 auto;
    padding: 8px var(--xn-fade);
}

.xn-bar--cta .xn-track-run {
    margin: 0;
    padding-left: var(--xn-pad-x);
}

/* min-width keeps a short label ("API") a full 44px touch target wide;
   position: relative anchors the 44px-tall hit area (::after). */
.xn-pill {
    position: relative;
    flex: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-width: 44px;
    height: 36px;
    padding: 0 14px;
    border-radius: var(--radius-full);
    border: 1px solid var(--xn-line);
    background: var(--xn-surface);
    color: var(--xn-ink-2);
    font-size: 14px;
    font-weight: 500;
    line-height: 1;
    text-decoration: none;
    transition: color var(--transition-fast), border-color var(--transition-fast);
}

/* 44px hit area for the 36px pill: the run's 8px top/bottom padding holds it,
   so the track (overflow-y: hidden) does not clip it. */
.xn-pill::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    height: 44px;
    margin-top: -22px;
}

.xn-pill:hover {
    color: var(--xn-gold-2);
    border-color: rgba(197, 165, 114, 0.5);
}

.xn-pill[aria-current] {
    color: var(--xn-gold);
    border-color: var(--xn-gold-line);
    background: var(--xn-gold-tint-2);
}

.xn-pill:focus-visible {
    outline: var(--xn-ring);
    outline-offset: 2px;
}

.xn-track-rule {
    flex: none;
    display: block;
    width: 1px;
    height: 20px;
    background: var(--xn-line);
}

/* Narrower tablets: tighter pills, so the whole row fits without sideways
   scrolling in all six languages from 768px (iPad mini portrait) up; below
   768px row 2 is the phone switcher. The soft edges stay as a safety net. */
@media (max-width: 900px) {
    .xn-track {
        --xn-fade: 16px;
    }

    .xn-track-run {
        gap: 4px;
    }

    .xn-pill {
        padding: 0 11px;
    }

    .xn-track-rule {
        margin: 0 2px;
    }
}

@media (max-width: 800px) {
    .xn-pill {
        padding: 0 10px;
        font-size: 13px;
    }

    .xn-track-rule {
        margin: 0;
    }
}


/* =============================================================================
   4b. TABLET FIT (768-1023px, rows with a Launch App)
   The pill track shares row 2 with the Launch App and must still fit without
   sideways scrolling in every language. x.js (fitTrack) measures the track
   and adds these steps to .xn-bar one at a time, only as far as needed, so
   English and German keep the designed row almost everywhere and only the
   long languages (Spanish, Russian) give up more:
     xn-fit-1  16px insets and soft edges instead of row 1's insets (the run
               and the button stop aligning with the brand and the language
               switcher)
     xn-fit-2  the 13px pills of the narrowest band
     xn-fit-3  tighter pills, 8px soft edges
     xn-fit-4  the two thin rules between the pill groups drop out
     xn-fit-5  the button shows its compact label (bar.cta.short, "App";
               .xn-cta--short) instead of the full one; a button without
               one skips this step
     xn-fit-6  the button shows only its arrow (36 x 36)
     xn-fit-7  last resort: the phone row (section switcher + sheet) instead
               of the product switcher and the pill track; the button gets
               its full label back
   In steps 5 and 6 the full label stays in the DOM, visually hidden, as the
   accessible name (the compact label is aria-hidden; its word is part of
   every translation of the full one).
   Measured on /x on 26.11.2026, with the product switcher (Chromium, the
   real fonts): English needs up to step 3, German 4, Italian, French and
   Spanish 5 (below ~810px), Russian 5 below ~915px, 6 below ~831px and 7
   below ~819px. The Books bar (two pills) never needs a step.
   The steps are cumulative. Without JS the row keeps step 0 and the track's
   soft-edged scrolling is the fallback. Desktop and phones never get them.
   ========================================================================== */

.xn-cta-short {
    display: none;
}

@media (min-width: 768px) and (max-width: 1023.98px) {
    /* The fade must not reach into the first pill: the run's left padding
       is 16px here, the soft edge above 900px is 20px. */
    .xn-bar.xn-fit-1 .xn-track {
        --xn-fade: 16px;
    }

    .xn-bar.xn-fit-1 .xn-track-run {
        padding-left: 16px;
    }

    .xn-bar.xn-fit-1 .xn-cta {
        margin-right: 16px;
    }

    /* The product switcher's icon moves to the same 16px inset. */
    .xn-bar.xn-fit-1 .xn-prod {
        margin-left: 8px;
    }

    .xn-bar.xn-fit-2 .xn-track-run {
        gap: 4px;
    }

    .xn-bar.xn-fit-2 .xn-pill {
        padding: 0 10px;
        font-size: 13px;
    }

    .xn-bar.xn-fit-2 .xn-track-rule {
        margin: 0;
    }

    .xn-bar.xn-fit-3 .xn-track {
        --xn-fade: 8px;
    }

    .xn-bar.xn-fit-3 .xn-track-run {
        padding-left: 8px;
    }

    .xn-bar.xn-fit-3 .xn-pill {
        gap: 4px;
        padding: 0 8px;
    }

    .xn-bar.xn-fit-4 .xn-track-rule {
        display: none;
    }

    /* Steps 5 + 6: the full label leaves the view but stays the name. */
    .xn-bar.xn-fit-5 .xn-cta--short > span[data-i18n],
    .xn-bar.xn-fit-6 .xn-cta > span[data-i18n] {
        position: absolute;
        width: 1px;
        height: 1px;
        margin: -1px;
        overflow: hidden;
        clip: rect(0 0 0 0);
        clip-path: inset(50%);
    }

    .xn-bar.xn-fit-5 .xn-cta--short {
        min-width: 44px;
        padding: 0 10px;
    }

    .xn-bar.xn-fit-5 .xn-cta-short {
        display: inline;
    }

    .xn-bar.xn-fit-6 .xn-cta {
        width: 36px;
        min-width: 0;
        padding: 0;
    }

    .xn-bar.xn-fit-6 .xn-cta::after {
        left: -4px;
        right: -4px;
    }

    .xn-bar.xn-fit-6 .xn-cta-short {
        display: none;
    }

    .xn-bar.xn-fit-6 .xn-cta-icon {
        display: block;
    }

    /* Step 7, when even step 6 overflows (Russian from 768px to about 819px
       since the product switcher took its ~60px of the row): the row turns
       into the phone row, section switcher + sheet (whose "Products" group
       stands in for the switcher), and the button gets its label back at
       the phone size. x.js closes an open sheet when the row leaves step 7. */
    .xn-bar.xn-fit-7 .xn-tab,
    .xn-bar.xn-fit-7 .xn-prod {
        display: none;
    }

    .xn-bar.xn-fit-7 .xn-phone {
        display: flex;
        padding-right: 0;
    }

    .xn-bar.xn-fit-7 .xn-sheet:not([hidden]) {
        display: block;
    }

    .xn-bar.xn-fit-7 .xn-cta > span[data-i18n] {
        position: static;
        width: auto;
        height: auto;
        margin: 0;
        overflow: visible;
        clip: auto;
        clip-path: none;
    }

    .xn-bar.xn-fit-7 .xn-cta {
        width: auto;
        min-width: 0;
        height: 44px;
        margin-left: 8px;
        padding: 0 16px;
        border-radius: var(--radius-lg);
    }

    .xn-bar.xn-fit-7 .xn-cta::after {
        left: 0;
        right: 0;
    }

    .xn-bar.xn-fit-7 .xn-cta-short,
    .xn-bar.xn-fit-7 .xn-cta-icon {
        display: none;
    }

    .xn-bar.xn-fit-7.xn-sheet-open .xn-cta {
        display: none;
    }

    .xn-bar.xn-fit-7.xn-sheet-open .xn-phone {
        padding-right: var(--spacing-md);
    }
}


/* =============================================================================
   5. PHONE (< 768px): section switcher + sheet (row 1 keeps its phone sizing below 600px)
   The sheet hangs under row 2 and covers the rest of the viewport with a
   scrim (tap it to close); its panel scrolls inside itself, capped at the
   space left under the bars (x.js measures it; the fallback is 100dvh minus
   --xn-offset). While it is open x.js locks the page scroll (html.xn-locked).
   ========================================================================== */

.xn-phone {
    align-items: center;
    gap: 8px;
    padding: 8px var(--spacing-md);
}

.xn-switch {
    position: relative;
    flex: 1 1 auto;
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 8px;
    height: 44px;
    padding: 0 14px;
    border-radius: var(--radius-lg);
    border: 1px solid var(--xn-line);
    background: var(--xn-surface);
    color: var(--xn-ink);
    font-family: inherit;
    font-size: 14px;
    line-height: 20px;
    text-align: left;
    cursor: pointer;
    transition: border-color var(--transition-fast);
}

.xn-switch:hover,
.xn-switch[aria-expanded="true"] {
    border-color: var(--xn-gold-line);
}

.xn-switch:focus-visible,
.xn-close:focus-visible {
    outline: var(--xn-ring);
    outline-offset: 2px;
}

/* Small phones with a Launch App only (section 3b). */
.xn-switch-icon {
    display: none;
    flex: none;
    width: 20px;
    height: 20px;
    border-radius: 5px;
}

.xn-switch-kx {
    flex: none;
    font-size: 12px;
    line-height: 16px;
    font-weight: 600;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--xn-gold);
}

.xn-switch-sep {
    flex: none;
    color: var(--xn-muted);
}

.xn-bar .xn-switch-cur {
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    font-weight: 600;
}

.xn-switch .xn-chev {
    color: var(--xn-muted);
}

.xn-close {
    flex: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border-radius: var(--radius-lg);
    border: 1px solid var(--xn-line);
    background: var(--xn-surface);
    color: var(--xn-ink-2);
    cursor: pointer;
    transition: color var(--transition-fast), border-color var(--transition-fast), background-color var(--transition-fast);
}

.xn-close:hover {
    color: var(--xn-gold);
    border-color: rgba(197, 165, 114, 0.6);
    background: var(--xn-gold-tint);
}

.xn-close[hidden] {
    display: none;
}

/* --- Sheet --- */
.xn-sheet {
    position: absolute;
    top: calc(100% + 1px);
    left: 0;
    right: 0;
    height: 100vh;
    background: rgba(5, 8, 16, 0.72);
}

.xn-sheet-panel {
    display: flex;
    flex-direction: column;
    gap: 20px;
    max-height: var(--xn-sheet-max, calc(100vh - var(--xn-offset)));
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    padding: 16px 16px 20px;
    background: var(--color-background-light);
    border-bottom: 1px solid rgba(197, 165, 114, 0.22);
}

@supports (height: 100dvh) {
    .xn-sheet-panel {
        max-height: var(--xn-sheet-max, calc(100dvh - var(--xn-offset)));
    }
}

.xn-sheet-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.xn-bar .xn-sheet-label {
    margin: 0;
    font-size: 12px;
    line-height: 16px;
    font-weight: 600;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--xn-muted);
}

.xn-bar .xn-sheet-list {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
}

.xn-bar .xn-sheet-list--rich {
    grid-template-columns: minmax(0, 1fr);
}

.xn-sheet-row {
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 48px;
    height: 100%;
    padding: 10px 12px;
    border-radius: var(--radius-lg);
    border: 1px solid var(--xn-line-soft);
    background: var(--xn-surface);
    color: var(--xn-ink-2);
    text-decoration: none;
    transition: background-color var(--transition-fast);
}

.xn-sheet-row:hover {
    background: #1C2335;
}

.xn-sheet-row[aria-current],
.xn-sheet-row[aria-current]:hover {
    color: var(--xn-gold);
    border-color: rgba(197, 165, 114, 0.35);
    background: var(--xn-gold-tint);
}

.xn-sheet-row:focus-visible,
.xn-sheet-cta:focus-visible,
.xn-sheet-sec:focus-visible,
.xn-sheet-home:focus-visible {
    outline: var(--xn-ring);
    outline-offset: 2px;
}

/* Opened by a tap: x.js focuses the current entry without a ring until the
   first key press (it is already highlighted). */
.xn-sheet.xn-by-pointer :focus-visible {
    outline: none;
}

.xn-sheet-icon {
    flex: none;
}

.xn-sheet-text {
    flex: 1 1 auto;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.xn-bar .xn-sheet-title {
    display: flex;
    align-items: center;
    gap: 4px;
    min-width: 0;
    font-size: 14px;
    line-height: 20px;
    font-weight: 600;
}

.xn-sheet-title > span {
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Two-column tiles: a label longer than its half of the sheet wraps onto a
   second line instead of losing its end ("Accesso anticipato" at 390px,
   "Early access" with the check mark at 375px); the tile grows to 62px and its
   row partner stretches with it. Only between words (keep-all from the
   .xn-bar rule above); the ellipsis stays the last resort for a single word. */
.xn-sheet-list:not(.xn-sheet-list--rich) .xn-sheet-title > span {
    white-space: normal;
    text-wrap: balance;
}

.xn-bar .xn-sheet-desc {
    font-size: 12px;
    line-height: 16px;
    font-weight: 400;
    color: var(--xn-muted);
    white-space: normal;
}

.xn-sheet-check {
    flex: none;
    color: var(--xn-gold);
}

/* "Products" group: the product's own icon, its name with the badge. */
.xn-sheet-prod-icon {
    width: 24px;
    height: 24px;
    border-radius: 6px;
}

/* The badge drops below the name when the two do not fit on one line
   ("Kotova Books" + "Accesso anticipato" below 380px). */
.xn-bar .xn-sheet-prod .xn-sheet-title {
    flex-wrap: wrap;
    gap: 2px 8px;
}

.xn-sheet-title > .xn-badge {
    overflow: visible;
}

.xn-sheet-foot {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding-top: 16px;
    border-top: 1px solid var(--xn-line-soft);
}

.xn-sheet-cta {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 48px;
    border-radius: var(--radius-lg);
    background: var(--gradient-primary);
    color: var(--color-background);
    font-size: 15px;
    font-weight: 600;
    line-height: 20px;
    text-decoration: none;
    transition: box-shadow var(--transition-fast);
}

.xn-sheet-cta:hover {
    box-shadow: var(--shadow-gold);
}

/* One equal column per site link in scripts/site-nav.json row1.links (today
   only Services: the products are the sheet's "Products" group). */
.xn-sheet-pair {
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: minmax(0, 1fr);
    gap: 8px;
}

.xn-sheet-sec {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    border-radius: var(--radius-lg);
    border: 1px solid var(--xn-line-soft);
    background: var(--xn-surface);
    color: var(--xn-ink-2);
    font-size: 14px;
    font-weight: 500;
    line-height: 20px;
    text-decoration: none;
    transition: background-color var(--transition-fast);
}

.xn-sheet-sec:hover {
    background: #1C2335;
}

.xn-sheet-home {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 44px;
    border-radius: var(--radius-lg);
    color: var(--xn-ink-2);
    font-size: 14px;
    font-weight: 500;
    line-height: 20px;
    text-decoration: none;
    transition: background-color var(--transition-fast), color var(--transition-fast);
}

.xn-sheet-home:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--xn-ink);
}

.xn-sheet-globe {
    flex: none;
}

/* Short phones (iPhone SE and smaller, or any phone in a browser with its
   toolbars showing): tighter rhythm, so more of the sheet is in view before
   it has to scroll. */
@media (max-height: 760px) {
    .xn-sheet-panel {
        gap: 16px;
        padding: 12px 16px 16px;
    }

    .xn-sheet-row {
        min-height: 44px;
        padding: 8px 12px;
    }

    .xn-sheet-foot {
        padding-top: 12px;
    }

    .xn-sheet-cta {
        min-height: 44px;
    }
}

/* Narrow phones (320-374px): a two-column tile is 140-167px wide, too little
   for icon, check mark and a long word at 14px ("Panoramica" at 360px);
   tighter tiles with 13px labels. Below 360px the current tile shows its
   check mark without the leading icon. */
@media (max-width: 374.98px) {
    .xn-sheet-list:not(.xn-sheet-list--rich) .xn-sheet-row {
        gap: 8px;
        padding-left: 10px;
        padding-right: 10px;
    }

    .xn-bar .xn-sheet-list:not(.xn-sheet-list--rich) .xn-sheet-title {
        font-size: 13px;
        line-height: 18px;
    }
}

@media (max-width: 359.98px) {
    .xn-sheet-list:not(.xn-sheet-list--rich) .xn-sheet-row[aria-current] > .xn-sheet-icon {
        display: none;
    }
}

/* Page scroll lock while the sheet is open (x.js). */
html.xn-locked,
html.xn-locked body {
    overflow: hidden;
}


/* =============================================================================
   6. PAGE FRAME
   ========================================================================== */

.xn-main {
    padding-top: var(--xn-offset);
}

/* Every scroll the browser makes on its own (anchor jumps, focus moving
   under the header) clears the header. */
html:has(.navbar.xn-navbar) {
    scroll-padding-top: calc(var(--xn-offset) + var(--spacing-md));
}

@supports not selector(:has(a)) {
    .xn-main [id] {
        scroll-margin-top: calc(var(--xn-offset) + var(--spacing-md));
    }
}

/* The /x pages that predate this navbar reserve room for the old 77px header
   in their first section (styles.css). Inside .xn-main the header offset is
   already paid, so those sections keep only the gap they had BELOW it. */
.xn-main > .kxapi-hero {
    padding-top: var(--spacing-4xl);             /* was 76px + 96px */
}

.xn-main > .assets-section,
.xn-main > .guides-section,
.xn-main > .swap-hero {
    padding-top: 73px;                           /* was 150px = 77px header + 73px */
}

@media (max-width: 768px) {
    .xn-main > .assets-section,
    .xn-main > .guides-section,
    .xn-main > .swap-hero {
        padding-top: 57px;                       /* was 130px = 73px header + 57px */
    }
}

@media (max-width: 640px) {
    .xn-main > .kxapi-hero {
        padding-top: var(--spacing-2xl);         /* was 76px + 48px */
    }
}


/* =============================================================================
   7. ASSET PAGES (/x/assets/<id>, templates/asset-details.html)
   There the navbar sits inside .kxd-chrome, a fixed unit with the utility bar
   that kx-pages.js slides away on scroll by the navbar's MEASURED height
   (--kxd-nav). Row 2 joins the navbar's flow here, so that measurement covers
   both rows and the utility bar parks at the top edge as before.
   ========================================================================== */

.kxd-chrome .navbar.xn-navbar {
    flex-wrap: wrap;
    padding-bottom: 0;
}

.kxd-chrome .xn-navbar .xn-bar {
    position: relative;
    top: auto;
    flex: 0 0 auto;
    width: calc(100% + 2 * var(--xn-pad-x));
    margin: var(--xn-pad-y) calc(-1 * var(--xn-pad-x)) 0;
    border-top: 1px solid var(--xn-line);
    border-bottom: 0;
}

/* No bottom border on row 2 here, so the phone sheet starts right under it. */
.kxd-chrome .xn-navbar .xn-sheet {
    top: 100%;
}

/* Pre-JS fallback only (kx-pages.js writes the measured value inline). */
html:has(.kxd-chrome .xn-navbar) {
    --kxd-nav: var(--xn-offset);
    scroll-padding-top: calc(var(--kxd-nav) + var(--kxd-bar) + var(--spacing-md));
}


/* =============================================================================
   8. MOTION
   ========================================================================== */

@media (prefers-reduced-motion: no-preference) {
    .xn-dd-panel:not([hidden]),
    .xn-sheet-panel,
    .xn-link[aria-current]::after,
    .xn-dd-btn.is-current::after {
        animation: xn-in 0.2s ease-out both;
    }

    .xn-sheet:not([hidden]) {
        animation: xn-fade 0.2s ease-out both;
    }

    .xn-live-dot {
        animation: xn-pulse 2.4s ease-out infinite;
    }

    .xn-live--notice .xn-live-dot {
        animation-name: xn-pulse-notice;
    }
}

@keyframes xn-in {
    from { opacity: 0; transform: translateY(-4px); }
    to { opacity: 1; transform: none; }
}

@keyframes xn-fade {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes xn-pulse {
    0% { box-shadow: 0 0 0 0 rgba(0, 212, 170, 0.45); }
    70%, 100% { box-shadow: 0 0 0 6px rgba(0, 212, 170, 0); }
}

@keyframes xn-pulse-notice {
    0% { box-shadow: 0 0 0 0 rgba(var(--xn-notice-rgb), 0.45); }
    70%, 100% { box-shadow: 0 0 0 6px rgba(var(--xn-notice-rgb), 0); }
}


/* =============================================================================
   SHARED COMPONENT: "Verified & listed on" logo group
   Markup is generated (scripts/generate-x-trust.mjs, <!--XTRUST:START--> in
   /x, /x/token-listing and /x/exchange-listing); the look is the site's
   .trust-logo (styles.css: no border or ground, gold hairline on hover).
   Pages add their own band, label and padding around it.
   ========================================================================== */

.x-trust-logos {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 4px 6px;
}

/* Phones: two rows of two, not three plus one left alone. */
@media (max-width: 599.98px) {
    .x-trust-logos {
        display: grid;
        grid-template-columns: repeat(2, auto);
        justify-content: center;
        justify-items: center;
        gap: 4px 20px;
    }
}

/* =============================================================================
   LISTING FORMS: OPEN ON DEMAND (x/apply-reveal.js)
   -----------------------------------------------------------------------------
   /x/token-listing and /x/exchange-listing show a compact start card where the
   form goes; the form opens when it is asked for, the way the /services
   inquiry form does (CRT flash and scanlines), but growing downwards with its
   section. A head script sets html.x-apply-js (and .x-apply-open when the
   page is opened on #form), so the first paint is already right. Without JS
   neither class is set: the form simply stands, the start card and the close
   button stay hidden.
     [data-apply-body]   shown only while open (the form card, its aside)
     .x-apply-launch     the start card, shown only while closed
   ========================================================================== */
.x-apply-launch,
.x-apply-close {
    display: none;
}

.x-apply-js:not(.x-apply-open) [data-apply-body] {
    display: none;
}

.x-apply-js:not(.x-apply-open) .x-apply-launch {
    display: flex;
}

.x-apply-js .x-apply-close {
    position: absolute;
    top: 14px;
    right: 14px;
    z-index: 2;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    padding: 0;
    border-radius: 10px;
    /* Same look as the modals on app.kotova.io (.kxa-close): no background or
       frame, red on hover / press. */
    border: 0;
    background: transparent;
    color: #8B95A5;
    cursor: pointer;
    transition: color 0.15s ease;
}

/* 4px of extra hit area around the 40px button (44px tap target). */
.x-apply-js .x-apply-close::before {
    content: "";
    position: absolute;
    inset: -4px;
}

.x-apply-js .x-apply-close:active { color: #FF4757; }

@media (hover: hover) {
    .x-apply-js .x-apply-close:hover { color: #FF4757; }
}

.x-apply-js .x-apply-close:focus-visible {
    outline: 2px solid #C5A572;
    outline-offset: 2px;
}

/* The scanlines of the /services form, fading out once the card is on. */
.x-apply-scan::after {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 1;
    border-radius: inherit;
    background: repeating-linear-gradient(0deg, transparent 0 2px, rgba(255, 255, 255, 0.05) 2px 4px);
    pointer-events: none;
    animation: x-apply-scan 1.1s ease 0.15s both;
}

@keyframes x-apply-scan {
    from { opacity: 1; }
    to   { opacity: 0; }
}

@media (prefers-reduced-motion: reduce) {
    .x-apply-scan::after { display: none; }
    .x-apply-js .x-apply-close { transition: none; }
}
