/* Nexlla legal pages (privacy, terms, cookies, AUP, DPA, legal centre).
   Shared by includes/legal/layout.php. Content is server-rendered so search
   engines and AI crawlers read the full text without running JavaScript. */

/* ─── Scroll-progress bar at top of viewport ─── */
.nx-scroll-progress {
    position: fixed; top: 0; left: 0; right: 0;
    height: 2px; z-index: 9999;
    background: rgba(241,237,228,.04); pointer-events: none;
}
.nx-scroll-progress__bar {
    height: 100%; width: 0%;
    background: linear-gradient(90deg, var(--nx-color-accent), var(--nx-color-accent-soft));
    transition: width .12s linear;
}

/* ─── Reveal motion ─── */
.nx-reveal { opacity: 0; transform: translate3d(0, 28px, 0); transition: opacity .9s var(--nx-ease-out), transform .9s var(--nx-ease-out); }
.nx-reveal.is-in { opacity: 1; transform: translate3d(0, 0, 0); }
@media (prefers-reduced-motion: reduce) {
    .nx-reveal, .nx-reveal.is-in { opacity: 1; transform: none; transition: none; }
}

/* ════════════════════════ A. HERO BAND ════════════════════════ */
.nx-legal-hero {
    position: relative;
    padding: clamp(120px, 18vh, 200px) clamp(20px, 5vw, 64px) clamp(52px, 7vh, 92px);
    isolation: isolate; overflow: hidden;
}
.nx-legal-hero::before {
    content:""; position: absolute; inset: 0; z-index: 0;
    background:
        radial-gradient(ellipse 65% 55% at 18% 22%, rgba(197, 205, 214,.10), transparent 62%),
        radial-gradient(ellipse 55% 50% at 92% 80%, rgba(255,179,122,.05), transparent 60%);
    pointer-events: none;
}
.nx-legal-hero::after {
    content:""; position: absolute; inset: 0; z-index: 0;
    background-image:
        linear-gradient(to right, rgba(241,237,228,.045) 1px, transparent 1px);
    background-size: clamp(60px, 8vw, 110px) 100%;
    background-position: left center;
    opacity: .55;
    mask-image: linear-gradient(to bottom, transparent, #000 18%, #000 82%, transparent);
    -webkit-mask-image: linear-gradient(to bottom, transparent, #000 18%, #000 82%, transparent);
    pointer-events: none;
}
.nx-legal-hero > * { position: relative; z-index: 1; }
.nx-legal-hero__inner {
    max-width: var(--nx-w-wide); margin-inline: auto;
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: clamp(22px, 3vh, 36px);
}
.nx-legal-hero__eyebrow {
    display: inline-flex; align-items: center; gap: 12px;
    font-family: var(--nx-font-mono); font-size: 11px;
    letter-spacing: .22em; text-transform: uppercase;
    color: var(--nx-color-accent);
    margin: 0;
}
.nx-legal-hero__eyebrow::before {
    content:""; flex: 0 0 28px; height: 1px;
    background: var(--nx-color-accent);
}
.nx-legal-hero__title {
    font-family: var(--nx-font-display);
    font-size: clamp(2.4rem, 5vw, 4.4rem);
    font-weight: 700;
    line-height: 1.04;
    letter-spacing: -.03em;
    margin: 0;
    max-width: 18ch;
    color: var(--nx-color-text);
}
.nx-legal-hero__title em {
    font-family: var(--nx-font-serif);
    font-style: italic; font-weight: 400;
    color: var(--nx-color-accent);
}

/* Thin animated underline trickle */
.nx-legal-hero__trickle {
    position: relative;
    height: 1px;
    width: clamp(180px, 26vw, 360px);
    background: var(--nx-color-line);
    overflow: hidden;
    margin: 0;
}
.nx-legal-hero__trickle::after {
    content:"";
    position: absolute; inset: 0;
    width: 38%;
    background: linear-gradient(90deg, transparent, var(--nx-color-accent), transparent);
    transform: translateX(-100%);
    animation: nxTrickle 4.2s var(--nx-ease-out) infinite;
}
@keyframes nxTrickle {
    0%   { transform: translateX(-100%); }
    100% { transform: translateX(280%); }
}
@media (prefers-reduced-motion: reduce) {
    .nx-legal-hero__trickle::after { animation: none; }
}

.nx-legal-hero__lede {
    max-width: 60ch;
    font-size: clamp(1rem, 1.3vw, 1.18rem);
    line-height: 1.7;
    color: var(--nx-color-text-muted);
    margin: 0;
}
.nx-legal-hero__lede strong { color: var(--nx-color-text); font-weight: 500; }
.nx-legal-hero__chip {
    display: inline-flex; align-items: center; gap: 10px;
    font-family: var(--nx-font-mono);
    font-size: 10.5px; letter-spacing: .22em; text-transform: uppercase;
    color: var(--nx-color-text-muted);
    padding: 8px 14px;
    border: 1px solid var(--nx-color-line);
    border-radius: 999px;
    background: rgba(241,237,228,.02);
    width: max-content;
}
.nx-legal-hero__chip::before {
    content:""; width: 6px; height: 6px; border-radius: 999px;
    background: var(--nx-color-accent);
    box-shadow: 0 0 12px var(--nx-color-accent);
}

/* ════════════════════════ B. CONTENT BODY ════════════════════════ */
.nx-legal-body {
    position: relative;
    padding: clamp(40px, 5vw, 72px) clamp(20px, 5vw, 64px) clamp(64px, 9vw, 120px);
}
.nx-legal-body__shell {
    max-width: var(--nx-w-wide); margin-inline: auto;
    display: grid;
    grid-template-columns: 280px minmax(0, 1fr);
    gap: clamp(40px, 5vw, 80px);
    align-items: start;
}
@media (max-width: 1023px) {
    .nx-legal-body__shell { grid-template-columns: minmax(0, 1fr); }
}

/* ─── LEFT: TOC ─── */
.nx-toc {
    position: relative;
    /* JS-driven sticky on desktop. We translate via rAF since
       DSN smooth-scroll's transform on #dsn-scrollbar breaks
       position:sticky for descendants. */
    transform: translate3d(0, 0, 0);
    will-change: transform;
}
@media (max-width: 1023px) {
    .nx-toc { transform: none !important; }
}
.nx-toc__label {
    font-family: var(--nx-font-mono);
    font-size: 10.5px; letter-spacing: .22em; text-transform: uppercase;
    color: var(--nx-color-text-dim);
    margin: 0 0 18px;
    display: flex; align-items: center; gap: 12px;
}
.nx-toc__label::after {
    content:""; flex: 1; height: 1px;
    background: var(--nx-color-line);
}
.nx-toc__list {
    display: flex; flex-direction: column;
    margin: 0; padding: 0;
    counter-reset: nxtoc;
    border-top: 1px solid var(--nx-color-line);
}
.nx-toc__list a {
    counter-increment: nxtoc;
    display: grid;
    grid-template-columns: 32px 1fr;
    gap: 14px;
    padding: 14px 4px;
    font-family: var(--nx-font-sans);
    font-size: .95rem;
    line-height: 1.4;
    color: var(--nx-color-text-muted);
    text-decoration: none;
    border-bottom: 1px solid var(--nx-color-line);
    transition: color var(--nx-dur) var(--nx-ease-out),
                background var(--nx-dur) var(--nx-ease-out),
                padding-left var(--nx-dur) var(--nx-ease-out);
}
.nx-toc__list a::before {
    content: counter(nxtoc, decimal-leading-zero);
    font-family: var(--nx-font-mono);
    font-size: 10.5px; letter-spacing: .12em;
    color: var(--nx-color-text-dim);
    align-self: center;
    transition: color var(--nx-dur) var(--nx-ease-out);
}
.nx-toc__list a:hover,
.nx-toc__list a.is-active {
    color: var(--nx-color-text);
    background: rgba(197, 205, 214,.04);
    padding-left: 10px;
}
.nx-toc__list a:hover::before,
.nx-toc__list a.is-active::before {
    color: var(--nx-color-accent);
}
.nx-toc__empty {
    font-family: var(--nx-font-sans);
    font-size: .9rem;
    color: var(--nx-color-text-dim);
    margin: 12px 0 0;
    font-style: italic;
}

/* ─── RIGHT: policy article ─── */
.nx-policy {
    counter-reset: nxpol;
    color: var(--nx-color-text);
    max-width: var(--nx-w-prose);
}
/* The api-loader injects a chunk of HTML directly into the inner
   #privacy-policy-content node. We style the loader's children
   here so the freshly-rendered policy adopts Nexlla typography. */
#privacy-policy-content { display: block; }
#privacy-policy-content > *:first-child { margin-top: 0; }

.nx-policy h1, .nx-policy h2 {
    font-family: var(--nx-font-display);
    font-weight: 700;
    line-height: 1.1;
    letter-spacing: -.02em;
    color: var(--nx-color-text);
    margin: 48px 0 16px;
    font-size: clamp(1.6rem, 2.2vw, 2rem);
}
.nx-policy h3 {
    counter-increment: nxpol;
    font-family: var(--nx-font-display);
    font-weight: 600;
    font-size: clamp(1.3rem, 1.6vw, 1.6rem);
    line-height: 1.2;
    letter-spacing: -.012em;
    color: var(--nx-color-text);
    margin: 56px 0 18px;
    padding-left: 56px;
    position: relative;
    scroll-margin-top: 120px;
}
.nx-policy h3::before {
    content: counter(nxpol, decimal-leading-zero);
    position: absolute;
    left: 0; top: 3px;
    font-family: var(--nx-font-mono);
    font-size: 11px;
    letter-spacing: .18em;
    color: var(--nx-color-accent);
    padding: 4px 8px;
    border: 1px solid rgba(197, 205, 214,.30);
    border-radius: 6px;
    background: rgba(197, 205, 214,.06);
}
.nx-policy h3:first-of-type,
.nx-policy h3:first-child { margin-top: 0; }
.nx-policy h4 {
    font-family: var(--nx-font-display);
    font-weight: 600;
    font-size: 1.05rem;
    color: var(--nx-color-text);
    margin: 28px 0 12px;
}
.nx-policy p {
    font-family: var(--nx-font-sans);
    font-weight: 400;
    font-size: clamp(1rem, 1.1vw, 1.1rem);
    line-height: 1.75;
    color: var(--nx-color-text-muted);
    margin: 0 0 18px;
}
.nx-policy p strong,
.nx-policy strong {
    color: var(--nx-color-text);
    font-weight: 500;
}
.nx-policy em {
    font-family: var(--nx-font-serif);
    font-style: italic;
    color: var(--nx-color-accent-soft);
}
.nx-policy a {
    color: var(--nx-color-accent);
    text-decoration: underline;
    text-underline-offset: 4px;
    text-decoration-thickness: 1px;
    transition: color var(--nx-dur) var(--nx-ease-out),
                text-decoration-color var(--nx-dur) var(--nx-ease-out);
}
.nx-policy a:hover {
    color: var(--nx-color-accent-soft);
    text-decoration-color: var(--nx-color-accent-soft);
}
.nx-policy ul, .nx-policy ol {
    list-style: none;
    padding-left: 0;
    margin: 0 0 24px;
}
.nx-policy ul li, .nx-policy ol li {
    position: relative;
    padding-left: 28px;
    margin: 0 0 12px;
    font-family: var(--nx-font-sans);
    font-size: clamp(.98rem, 1.05vw, 1.05rem);
    line-height: 1.7;
    color: var(--nx-color-text-muted);
}
.nx-policy ul li::before {
    content:"";
    position: absolute;
    left: 0; top: .72em;
    width: 16px; height: 1px;
    background: var(--nx-color-accent);
}
.nx-policy ol { counter-reset: nxpol-ol; }
.nx-policy ol li {
    counter-increment: nxpol-ol;
}
.nx-policy ol li::before {
    content: counter(nxpol-ol)".";
    position: absolute;
    left: 0; top: 0;
    font-family: var(--nx-font-mono);
    font-size: .85rem;
    color: var(--nx-color-accent);
}
.nx-policy code {
    font-family: var(--nx-font-mono);
    font-size: .92em;
    color: var(--nx-color-accent);
    padding: 2px 8px;
    border-radius: 4px;
    background: rgba(197, 205, 214,.08);
    border: 1px solid rgba(197, 205, 214,.18);
}
.nx-policy pre {
    font-family: var(--nx-font-mono);
    font-size: .9rem;
    background: var(--nx-color-surface);
    border: 1px solid var(--nx-color-line);
    border-radius: var(--nx-radius-md);
    padding: 18px 22px;
    overflow-x: auto;
    margin: 0 0 24px;
    color: var(--nx-color-text);
}
.nx-policy blockquote {
    margin: 24px 0;
    padding: 18px 22px;
    border-left: 2px solid var(--nx-color-accent);
    background: rgba(197, 205, 214,.04);
    border-radius: 0 var(--nx-radius-md) var(--nx-radius-md) 0;
    font-family: var(--nx-font-serif);
    font-style: italic;
    color: var(--nx-color-text);
}
.nx-policy table {
    width: 100%;
    border-collapse: collapse;
    margin: 0 0 24px;
    font-family: var(--nx-font-sans);
    font-size: .95rem;
}
.nx-policy th, .nx-policy td {
    text-align: left;
    padding: 12px 14px;
    border-bottom: 1px solid var(--nx-color-line);
    color: var(--nx-color-text-muted);
}
.nx-policy th {
    color: var(--nx-color-text);
    font-weight: 600;
    font-family: var(--nx-font-mono);
    font-size: 11px;
    letter-spacing: .14em;
    text-transform: uppercase;
}
.nx-policy hr {
    border: 0;
    height: 1px;
    background: var(--nx-color-line);
    margin: 36px 0;
}
/* The dashboard often emits a"Last updated …" line at the top
   of the policy. If the editor wraps it in .nx-policy__meta or
   we can't influence the markup, we still gently dim it. */
.nx-policy__meta,
#privacy-policy-content > p:first-child {
    font-family: var(--nx-font-mono);
    font-size: 11px;
    letter-spacing: .18em;
    text-transform: uppercase;
    color: var(--nx-color-accent);
    margin-bottom: 32px;
}

/* Initial loading state — softens the wait while the fetch
   resolves so the right column doesn't feel empty. */
.nx-policy__skeleton {
    display: flex; flex-direction: column; gap: 14px;
}
.nx-policy__skeleton span {
    height: 14px; border-radius: 4px;
    background: linear-gradient(90deg, rgba(241,237,228,.04), rgba(241,237,228,.08), rgba(241,237,228,.04));
    background-size: 200% 100%;
    animation: nxSkel 1.8s linear infinite;
}
.nx-policy__skeleton span:nth-child(1) { width: 30%; }
.nx-policy__skeleton span:nth-child(2) { width: 90%; }
.nx-policy__skeleton span:nth-child(3) { width: 84%; }
.nx-policy__skeleton span:nth-child(4) { width: 76%; }
.nx-policy__skeleton span:nth-child(5) { width: 92%; }
.nx-policy__skeleton span:nth-child(6) { width: 65%; }
@keyframes nxSkel {
    0%   { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}
@media (prefers-reduced-motion: reduce) {
    .nx-policy__skeleton span { animation: none; }
}

/* ════════════════════════ C. FOOT NOTE / CONTACT ════════════════════════ */
.nx-legal-foot {
    margin-top: clamp(56px, 7vw, 88px);
    padding: clamp(28px, 4vw, 44px);
    background: var(--nx-color-surface);
    border: 1px solid var(--nx-color-line);
    border-radius: var(--nx-radius-lg);
    display: grid;
    gap: 18px;
    position: relative;
    overflow: hidden;
    isolation: isolate;
}
.nx-legal-foot::before {
    content:""; position: absolute; inset: 0; z-index: -1;
    background: radial-gradient(ellipse 60% 80% at 92% 8%, rgba(197, 205, 214,.10), transparent 60%);
    pointer-events: none;
}
.nx-legal-foot__eyebrow {
    font-family: var(--nx-font-mono);
    font-size: 10.5px; letter-spacing: .22em; text-transform: uppercase;
    color: var(--nx-color-accent);
    margin: 0;
}
.nx-legal-foot__title {
    font-family: var(--nx-font-display);
    font-weight: 600;
    font-size: clamp(1.25rem, 1.8vw, 1.6rem);
    line-height: 1.2; letter-spacing: -.012em;
    color: var(--nx-color-text);
    margin: 0;
    max-width: 28ch;
}
.nx-legal-foot__title em {
    font-family: var(--nx-font-serif);
    font-style: italic; font-weight: 400;
    color: var(--nx-color-accent);
}
.nx-legal-foot__lede {
    font-family: var(--nx-font-sans);
    font-size: 1rem;
    line-height: 1.65;
    color: var(--nx-color-text-muted);
    margin: 0;
    max-width: 56ch;
}
.nx-legal-foot__lede a {
    color: var(--nx-color-accent);
    text-decoration: underline;
    text-underline-offset: 3px;
}
.nx-legal-foot__actions {
    display: flex; flex-wrap: wrap; gap: 12px;
    margin-top: 4px;
}
.nx-btn {
    display: inline-flex; align-items: center; gap: 10px;
    padding: 14px 22px;
    font-family: var(--nx-font-mono);
    font-size: 11px;
    letter-spacing: .18em; text-transform: uppercase;
    text-decoration: none;
    border-radius: 999px;
    border: 1px solid transparent;
    transition: transform var(--nx-dur) var(--nx-ease-out),
                background var(--nx-dur) var(--nx-ease-out),
                border-color var(--nx-dur) var(--nx-ease-out),
                color var(--nx-dur) var(--nx-ease-out);
    will-change: transform;
}
.nx-btn--primary,
.nx-btn--primary:link,
.nx-btn--primary:visited {
    background: var(--nx-color-accent);
    color: var(--nx-color-text-invert) !important;
    border-color: var(--nx-color-accent);
    text-decoration: none;
}
.nx-btn--primary .nx-btn__arrow,
.nx-btn--primary span { color: inherit !important; }
.nx-btn--primary:hover {
    background: var(--nx-color-accent-soft);
    border-color: var(--nx-color-accent-soft);
    color: #0A0908 !important;
    transform: translateY(-2px);
}
.nx-btn--ghost {
    color: var(--nx-color-text);
    border-color: var(--nx-color-line-strong);
}
.nx-btn--ghost:hover {
    border-color: var(--nx-color-accent);
    color: var(--nx-color-accent);
    transform: translateY(-2px);
}
.nx-btn__arrow { transition: transform var(--nx-dur) var(--nx-ease-out); }
.nx-btn:hover .nx-btn__arrow { transform: translateX(4px); }

/* ─── Server-rendered TOC: sticky via CSS where DSN smooth-scroll is off ─── */
.nx-toc__list a { word-break: break-word; }

/* ─── Meta row under the hero ─── */
.nx-legal-hero__meta { display: flex; flex-wrap: wrap; gap: 10px; }

/* ─── "At a glance" summary (answer-first block for readers and AI engines) ─── */
.nx-glance {
    margin: 0 0 44px;
    padding: clamp(22px, 3vw, 32px);
    border: 1px solid var(--nx-color-line);
    border-radius: var(--nx-radius-lg);
    background: var(--nx-color-surface);
}
.nx-glance__label {
    font-family: var(--nx-font-mono); font-size: 10.5px;
    letter-spacing: .22em; text-transform: uppercase;
    color: var(--nx-color-accent); margin: 0 0 14px;
}
.nx-policy .nx-glance ul { margin: 0; }
.nx-policy .nx-glance li { margin-bottom: 10px; }
.nx-policy .nx-glance li:last-child { margin-bottom: 0; }

/* ─── Section headings are h2 here; number them like the old h3s ─── */
.nx-policy { counter-reset: nxpol; }
.nx-policy .nx-sec > h2 {
    counter-increment: nxpol;
    font-size: clamp(1.3rem, 1.6vw, 1.6rem);
    font-weight: 600; line-height: 1.2; letter-spacing: -.012em;
    margin: 56px 0 18px; padding-left: 56px; position: relative;
    scroll-margin-top: 120px;
}
.nx-policy .nx-sec > h2::before {
    content: counter(nxpol, decimal-leading-zero);
    position: absolute; left: 0; top: 3px;
    font-family: var(--nx-font-mono); font-size: 11px; letter-spacing: .18em;
    color: var(--nx-color-accent);
    padding: 4px 8px; border: 1px solid rgba(197, 205, 214,.30);
    border-radius: 6px; background: rgba(197, 205, 214,.06);
}
.nx-policy .nx-sec:first-of-type > h2 { margin-top: 0; }
.nx-policy h3 { counter-increment: none; padding-left: 0; margin: 30px 0 12px; font-size: 1.08rem; }
.nx-policy h3::before { content: none; }

/* ─── Tables scroll sideways on phones instead of widening the page ─── */
.nx-table-wrap { width: 100%; overflow-x: auto; margin: 0 0 24px; -webkit-overflow-scrolling: touch; }
.nx-table-wrap table { margin: 0; min-width: 560px; }
.nx-policy td { vertical-align: top; }

/* ─── FAQ (rendered as FAQPage JSON-LD too) ─── */
.nx-faq { margin-top: 56px; }
.nx-faq details {
    border-bottom: 1px solid var(--nx-color-line);
    padding: 16px 0;
}
.nx-faq summary {
    cursor: pointer; list-style: none;
    font-family: var(--nx-font-display); font-weight: 600;
    font-size: 1.02rem; color: var(--nx-color-text);
    display: flex; justify-content: space-between; gap: 16px;
}
.nx-faq summary::-webkit-details-marker { display: none; }
.nx-faq summary::after { content: "+"; color: var(--nx-color-accent); font-family: var(--nx-font-mono); }
.nx-faq details[open] summary::after { content: "–"; }
.nx-faq details p { margin: 12px 0 0; }

/* ─── Related documents + legal centre cards ─── */
.nx-legal-cards {
    display: grid; gap: 16px;
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 260px), 1fr));
    margin: 0 0 32px;
}
.nx-legal-card,
.nx-legal-card:link,
.nx-legal-card:visited {
    display: grid; gap: 8px; align-content: start;
    padding: 22px; border-radius: var(--nx-radius-lg);
    border: 1px solid var(--nx-color-line);
    background: var(--nx-color-surface);
    text-decoration: none !important; color: var(--nx-color-text) !important;
    transition: border-color var(--nx-dur) var(--nx-ease-out), transform var(--nx-dur) var(--nx-ease-out);
}
.nx-legal-card:hover { border-color: var(--nx-color-accent); transform: translateY(-2px); }
.nx-legal-card strong { font-family: var(--nx-font-display); font-size: 1.05rem; font-weight: 600; }
.nx-legal-card span { font-size: .92rem; line-height: 1.55; color: var(--nx-color-text-muted); }
.nx-legal-card small { font-family: var(--nx-font-mono); font-size: 10px; letter-spacing: .16em; text-transform: uppercase; color: var(--nx-color-accent); }

@media print {
    .nx-toc, .nx-legal-foot__actions, .nx-scroll-progress, .nx-foot, .nx-closing { display: none !important; }
    .nx-legal-body__shell { display: block; }
}
