/* ==========================================================================
   Gratienne — the legal pages: the terms and the privacy policy

   A long document made to be read, not scrolled past: a wide page with the
   contents standing beside the text, the numbers hanging in the margin so the
   words keep one straight edge, a measure of about seventy characters and
   generous leading. The house's paper, ink and gold (site.css tokens), a
   hairline for every rule. legal.js adds the reading aids: the contents that
   follow the reader, the gold progress line, the way back up and the glide
   to every place in the document. The PDF is drawn by the server.
   ========================================================================== */

/* ------------------------------------------------------------- 1. Frame */

.lex {
    --hang: 4.25rem;
    --lex-caps: 0.84rem;
    /* About seventy-five characters of the text's own face: the upper end of a comfortable line for a long read. */
    --measure: 74ch;
    width: 100%;
    /* The home page's margins, the gutter alone; the provisions keep their measure. */
    margin: 0 auto;
    /* Little air above the title, as the panel's and the guests' pages start. */
    padding: var(--page-top) var(--gutter) clamp(4rem, 9vw, 8rem);
}

/* The reading progress: one gold hairline under the header, drawn by legal.js. */
.lex__progress {
    position: fixed;
    top: var(--header);
    left: 0;
    right: 0;
    z-index: 59;
    height: 1px;
    pointer-events: none;
}

    .lex__progress span {
        display: block;
        height: 100%;
        background: var(--gold);
        transform-origin: 0 50%;
        transform: scaleX(var(--lex-progress, 0));
    }

/* ------------------------------------------------------------- 2. Head */

.lex__head {
    max-width: 58rem;
    margin-bottom: clamp(2.5rem, 5vw, 4rem);
}

.lex__title {
    font-family: var(--display);
    font-weight: var(--weight-display);
    font-size: var(--type-hero);
    line-height: 1.02;
    letter-spacing: var(--display-tracking);
    text-wrap: balance;
}

.lex__lede {
    max-width: 40rem;
    margin-top: 1.6rem;
    font-size: var(--type-lede);
    line-height: 1.55;
    color: var(--ink-soft);
    text-wrap: pretty;
}

/* The document's PDF closes the lede, in the house's small capitals over its hairline (.link), set into the sentence's
   line rather than standing as a button of its own. It never breaks inside. */
.lex__pdf {
    display: inline;
    min-height: 0;
    margin-left: 0.6em;
    padding-bottom: 0.12rem;
    white-space: nowrap;
    color: var(--ink);
    border-bottom-color: var(--gold);
    vertical-align: 0.08em;
}

.lex__toc-toggle,
.lex__clause-title,
.lex__no,
.lex__mark,
.lex__toc-no {
    font-family: var(--sans);
    font-weight: var(--sans-weight);
    font-size: var(--caps-size);
    letter-spacing: var(--caps-tracking);
    text-transform: uppercase;
}

/* A section's number, a clause's number and a clause's title are one size, a step over the small capitals of the
   contents, so the document's structure reads as one series beside its text. */
.lex__clause-title,
.lex__no,
.lex__mark {
    font-size: var(--lex-caps);
}

.lex__notice {
    max-width: 46rem;
    margin-top: 1.6rem;
}

/* ----------------------------------------------------------- 3. Layout */

.lex__body {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 2.5rem;
}

@media (min-width: 64rem) {
    .lex__body {
        grid-template-columns: 16rem minmax(0, 1fr);
        gap: clamp(2.5rem, 4vw, 4.5rem);
        align-items: start;
    }
}

/* -------------------------------------------------------- 4. Contents */

.lex__toc-toggle {
    position: relative;
    display: flex;
    align-items: center;
    min-height: 3.25rem;
    padding-right: 2rem;
    border-top: 1px solid var(--rule);
    border-bottom: 1px solid var(--rule);
    cursor: pointer;
    list-style: none;
}

    .lex__toc-toggle::-webkit-details-marker {
        display: none;
    }

    /* A plus that turns into a minus: two hairlines, the upright one folding away when the contents open. */
    .lex__toc-toggle::before,
    .lex__toc-toggle::after {
        content: '';
        position: absolute;
        right: 0.1rem;
        top: 50%;
        width: 0.8rem;
        height: 1px;
        background: currentColor;
        transition: transform 0.4s var(--slow);
    }

    .lex__toc-toggle::after {
        transform: rotate(90deg);
    }

.lex__toc[open] > .lex__toc-toggle::after {
    transform: rotate(0deg);
}

.lex__toc-nav {
    padding: 1rem 0 0.5rem;
}

.lex__toc-list {
    display: grid;
}

.lex__toc-link {
    display: grid;
    grid-template-columns: 2.6rem minmax(0, 1fr);
    align-items: baseline;
    padding: 0.5rem 0 0.5rem 1rem;
    border-left: 1px solid var(--rule);
    color: var(--ink-soft);
    font-size: var(--type-body);
    line-height: 1.35;
    transition: color 0.3s var(--slow), border-color 0.3s var(--slow);
}

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

    .lex__toc-link[aria-current="location"] {
        color: var(--ink);
        border-left-color: var(--gold);
        box-shadow: inset 1px 0 0 var(--gold);
    }

@media (min-width: 64rem) {
    .lex__toc {
        position: sticky;
        top: calc(var(--header) + 2.5rem);
        max-height: calc(100vh - var(--header) - 4rem);
        overflow-y: auto;
        overscroll-behavior: contain;
        scrollbar-width: thin;
    }

        /* Beside the text the contents simply stand; the fold exists only on a narrow screen. */
        .lex__toc > .lex__toc-toggle {
            display: none;
        }

    .lex__toc-nav {
        padding-top: 0;
    }
}

/* -------------------------------------------------------- 5. Document */

/* The column is the hanging numbers and the text's own measure, the measure counted in the text's own face. Every
   paragraph of the provisions is set in one size, the scale's reading size — the lede's — on every screen, and nothing
   else in the document sets a size of its own but the headings and the small capitals, so the provisions stand in the
   same size as the sentence above them. */
.lex {
    --lex-text: var(--type-lede);
}

@media (min-width: 64rem) {
    .lex__body {
        grid-template-columns: 18rem minmax(0, 1fr);
    }

    .lex__heading {
        font-size: clamp(1.9rem, 1.4rem + 0.8vw, 2.5rem);
    }
}

/* The document itself is not capped: each clause's text holds its own measure (.lex__text), beside its hanging number. */
.lex__document {
    max-width: none;
}

.lex__section {
    scroll-margin-top: calc(var(--header) + 1.5rem);
}

/* A place reached by a link takes the focus for the next Tab (legal.js), never a frame around a whole section. */
.lex[tabindex="-1"]:focus,
.lex__section[tabindex="-1"]:focus,
.lex__clause[tabindex="-1"]:focus {
    outline: none;
}

/* Every link to a place in the document glides there: legal.js steers it, and this
   carries the glide where the script has not run. Never for a reader who asks for reduced motion. */
@media (prefers-reduced-motion: no-preference) {
    html:has(.lex) {
        scroll-behavior: smooth;
    }
}

    .lex__section + .lex__section {
        margin-top: clamp(3rem, 6vw, 5rem);
        padding-top: clamp(2.5rem, 5vw, 4rem);
        border-top: 1px solid var(--rule);
    }

/* The heading and, after it, the section's own link: the link stands outside the h2 so the heading's name is its own. */
.lex__heading-row {
    display: flex;
    align-items: baseline;
    margin-bottom: clamp(1.6rem, 3vw, 2.4rem);
}

.lex__heading {
    flex: 1 1 auto;
    min-width: 0;
    display: grid;
    grid-template-columns: var(--hang) minmax(0, 1fr);
    align-items: baseline;
    font-family: var(--display);
    font-weight: var(--weight-display);
    font-size: var(--type-subtitle);
    line-height: 1.12;
    letter-spacing: var(--display-tracking);
    text-wrap: balance;
}

/* The section's number set exactly as its clauses' numbers are — tracking and figures as well as size. */
.lex__mark {
    letter-spacing: 0.06em;
    font-variant-numeric: tabular-nums;
    color: var(--ink-soft);
}

/* The section's own link, shown when the reader reaches for it. */
.lex__anchor {
    margin-left: 1rem;
    padding: 0 0.3rem;
    font-family: var(--sans);
    font-weight: var(--sans-weight);
    font-size: var(--type-body);
    color: var(--ink-soft);
    opacity: 0;
    transition: opacity 0.3s var(--slow), color 0.3s var(--slow);
}

    .lex__heading-row:hover .lex__anchor,
    .lex__anchor:focus-visible {
        opacity: 1;
    }

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

@media (hover: none) {
    .lex__anchor {
        opacity: 0.4;
    }
}

.lex__clause {
    display: grid;
    grid-template-columns: var(--hang) minmax(0, 1fr);
    /* The hanging number stands on the first line's baseline, its title's or its text's, in whatever face and size. */
    align-items: first baseline;
    scroll-margin-top: calc(var(--header) + 1.5rem);
}

    .lex__clause + .lex__clause {
        margin-top: 1.9rem;
    }

    /* A clause reached by its own link is marked for a moment, so the eye finds where it landed. */
    .lex__clause:target .lex__no,
    .lex__clause.is-target .lex__no {
        color: var(--ink);
        border-bottom-color: var(--gold);
    }

/* At least 24 × 24 px to press (WCAG 2.5.8), however small the number is set. Its figures stand closer than the
   capitals' tracking, so the longest number keeps to the narrow screen's margin. */
.lex__no {
    justify-self: start;
    min-width: 1.5rem;
    min-height: 1.5rem;
    border-bottom: 1px solid transparent;
    letter-spacing: 0.06em;
    font-variant-numeric: tabular-nums;
    color: var(--ink-soft);
    transition: color 0.3s var(--slow), border-color 0.3s var(--slow);
}

    .lex__no:hover {
        color: var(--ink);
        border-bottom-color: currentColor;
    }

.lex__clause-title {
    margin-bottom: 0.6rem;
    line-height: 1.5;
}

.lex__text {
    font-size: var(--lex-text);
    max-width: var(--measure);
    /* The column's own width decides whether its provisions are justified (below). */
    container-type: inline-size;
}

    .lex__text p,
    .lex__text li {
        font-size: 1em;
        line-height: 1.72;
        hyphens: auto;
        text-wrap: pretty;
    }

    /* The Polish wording breaks only where the server's soft hyphens stand (LegalViewModel.Typeset): Chrome does not
       hyphenate Polish by itself and Firefox would add breaks of its own, so every browser breaks the same words alike.
       The English keeps its browser's hyphenation. */
    .lex__text:lang(pl) p,
    .lex__text:lang(pl) li {
        hyphens: manual;
    }

/* The provisions justified, as the journal's prose is — the paragraphs, never a clause's title or a list item, which
   stays ragged as the journal's do (a short item set in from the column stretched its few spaces across the line, the
   owner's screenshot of 2026-11-08). Only from a 30rem measure (about sixty characters), the journal's own: a phone's
   line holds too few spaces to share the slack out, so there the text stays ragged. The last line keeps to the left. */
@container (min-width: 30rem) {
    .lex__text p {
        text-align: justify;
    }
}

    .lex__text ul {
        display: grid;
        gap: 0.8rem;
        margin-top: 1rem;
    }

    /* A clause may close with a paragraph after its list („Ceny”): it stands apart from the list as the list from the
       opening paragraph. */
    .lex__text ul + p {
        margin-top: 1rem;
    }

    .lex__text li {
        position: relative;
        padding-left: 1.6rem;
    }

        .lex__text li::before {
            content: '';
            position: absolute;
            left: 0;
            top: 0.86em;
            width: 0.75rem;
            height: 1px;
            background: var(--gold);
        }

    .lex__text a {
        border-bottom: 1px solid rgba(var(--gold-rgb), 0.9);
        overflow-wrap: anywhere;
        transition: border-color 0.3s var(--slow);
    }

        .lex__text a:hover {
            border-bottom-color: var(--ink);
        }

/* On a very wide screen the section's heading steps out into a column of its own beside its clauses and stays there
   while they are read, as an annotated edition sets its titles in the margin: the line keeps its measure and the page
   is filled by the document's own structure, never by a longer line. */
@media (min-width: 100rem) {
    .lex__section {
        display: grid;
        grid-template-columns: minmax(14rem, 20rem) minmax(0, 1fr);
        column-gap: clamp(2.5rem, 3vw, 4rem);
        align-items: start;
    }

        .lex__section > .lex__heading-row {
            grid-column: 1;
            grid-row: 1 / span 99;
            position: sticky;
            top: calc(var(--header) + 2.5rem);
            margin-bottom: 0;
        }

        .lex__section > .lex__clause {
            grid-column: 2;
        }

    .lex__heading {
        grid-template-columns: minmax(0, 1fr);
        row-gap: 0.4rem;
        font-size: clamp(1.7rem, 1.2rem + 0.6vw, 2.2rem);
    }
}

.lex__end {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-end;
    gap: 1rem 2rem;
    margin-top: clamp(3.5rem, 7vw, 6rem);
    padding-top: 1.2rem;
    border-top: 1px solid var(--rule);
}

/* ------------------------------------------------------ 6. Back to top */

.lex__top {
    position: fixed;
    right: max(1rem, calc(var(--gutter) / 2));
    bottom: calc(1.5rem + env(safe-area-inset-bottom, 0px));
    z-index: 50;
    display: grid;
    place-items: center;
    width: 3rem;
    height: 3rem;
    border: 1px solid var(--rule);
    border-radius: 50%;
    background: var(--ground);
    color: var(--ink);
    opacity: 0;
    visibility: hidden;
    transform: translateY(0.6rem);
    transition: opacity 0.4s var(--slow), transform 0.4s var(--slow), visibility 0s linear 0.4s, border-color 0.3s var(--slow);
}

    .lex__top.is-shown {
        opacity: 1;
        visibility: visible;
        transform: none;
        transition: opacity 0.4s var(--slow), transform 0.4s var(--slow), visibility 0s, border-color 0.3s var(--slow);
    }

    .lex__top:hover {
        border-color: var(--gold);
    }

/* ---------------------------------------------------------- 7. Narrow */

@media (max-width: 699px) {
    /* Wide enough for the longest clause number („14.12.”) in the structure's size, with air before the text. */
    .lex {
        --hang: 3.4rem;
    }

    .lex__anchor {
        display: none;
    }
}

@media (max-width: 379px) {
    .lex {
        --hang: 0;
    }

    /* On the smallest screens the number stands above its clause rather than beside it. */
    .lex__clause,
    .lex__heading {
        grid-template-columns: minmax(0, 1fr);
    }

    .lex__no,
    .lex__mark {
        margin-bottom: 0.3rem;
    }
}

/* --------------------------------------------------- 8. Reduced motion */

@media (prefers-reduced-motion: reduce) {
    .lex__pdf,
    .lex__toc-toggle::before,
    .lex__toc-toggle::after,
    .lex__toc-link,
    .lex__anchor,
    .lex__no,
    .lex__text a,
    .lex__top,
    .lex__top.is-shown {
        transition: none;
    }
}

/* ------------------------------------------------------------- 9. Print */

@media print {
    .brand,
    .foot,
    .skip,
    .lex__progress,
    .lex__toc,
    .lex__top,
    .lex__pdf,
    .lex__anchor,
    .lex__end-top {
        display: none !important;
    }

    body {
        background: #fff;
        color: #000;
    }

    .page {
        padding-top: 0;
    }

    /* On paper the structure keeps the small capitals' size: beside 10.5pt text the screen's step would match the text. */
    .lex {
        --hang: 2.6rem;
        --lex-caps: var(--caps-size);
        max-width: none;
        padding: 0;
    }

    .lex__body {
        display: block;
    }

    .lex__title {
        font-size: 30pt;
    }

    .lex__heading {
        font-size: 16pt;
    }

    .lex__heading-row {
        break-after: avoid;
    }

    .lex__clause {
        break-inside: avoid;
    }

    .lex__text p,
    .lex__text li {
        font-size: 10.5pt;
        line-height: 1.5;
    }

    .lex__text a {
        border-bottom: 0;
        text-decoration: underline;
    }

        /* On paper a link is only its address, so the body's outside links print it after their words. */
        .lex__document a[href^="http"]::after {
            content: " (" attr(href) ")";
            overflow-wrap: anywhere;
        }

    .has-ui .lex [data-reveal],
    .has-ui .lex [data-reveal-stagger] > * {
        opacity: 1;
        transform: none;
    }
}
