/* The legal documents (Figma 38-39, 38-40): the document in sections, "בעמוד הזה" beside it and the
   other documents under that. The page's header is the catalogue's (catalogue-pages/assets/page.css).
   The design's #F6F6F6 bar has no brand token; the nearest, white-light-2, stands in for it. */

.cil-doc *, .cil-doc *::before, .cil-doc *::after { box-sizing: border-box; }
.cil-doc { --cil-doc-pin: calc(var(--cil-hdr-height, 64px) + 24px); }
/* The contents lead, on the reading side (Oren 2026-10-07: on the right of a Hebrew page, not the
   design's left), the document after them. */
.cil-doc__body {
    display: grid; grid-template-columns: 340px minmax(0, 760px); grid-template-areas: "side text";
    justify-content: start; align-items: start; gap: 96px; padding-block: 16px 96px;
}
.cil-doc__body--alone { grid-template-columns: minmax(0, 760px); grid-template-areas: "text"; }

/* ---- The document ---- */
.cil-doc__text { grid-area: text; display: flex; flex-direction: column; gap: 48px; min-width: 0; color: var(--cil-black); }
.cil-doc__section { display: flex; flex-direction: column; gap: 16px; scroll-margin-top: var(--cil-doc-pin); overflow-wrap: anywhere; }
.cil-doc__section:focus { outline: none; }
.cil-doc .cil-doc__heading { margin: 0; color: var(--cil-black); font-size: 24px; font-weight: 700; line-height: 1.2; }
.cil-doc .cil-doc__subhead { margin: 8px 0 0; color: var(--cil-black); font-size: 20px; font-weight: 700; line-height: 1.2; }
.cil-doc__section :is(p, ul, ol) { margin: 0; font-size: 18px; line-height: 1.2; }
.cil-doc__section :is(ul, ol) { display: flex; flex-direction: column; gap: 4px; padding-inline-start: 27px; }
.cil-doc__section ul { list-style: disc; }
.cil-doc__section ol { list-style: decimal; }
.cil-doc__section li :is(ul, ol) { margin-top: 4px; }
.cil-doc__section :is(h1, h2, h3, h4, h5, h6):not(.cil-doc__heading, .cil-doc__subhead) { margin: 0; font-size: 18px; font-weight: 700; }
.cil-doc .cil-doc__section a { color: var(--cil-blue-dark-1); text-decoration: underline; text-underline-offset: 3px; overflow-wrap: anywhere; }
.cil-doc .cil-doc__section a:is(:hover, :focus-visible) { color: var(--cil-blue-dark-1); text-decoration-thickness: 2px; }

/* ---- Beside it ---- */
.cil-doc__side {
    grid-area: side; position: sticky; top: var(--cil-doc-pin);
    display: flex; flex-direction: column; gap: 20px;
    max-height: calc(100vh - var(--cil-doc-pin) - 24px); overflow-y: auto; overscroll-behavior: contain;
}
.cil-doc-toc { display: flex; flex-direction: column; gap: 4px; padding-bottom: 20px; border-bottom: 1px solid var(--cil-black-light-3); }
.cil-doc-toc__title, .cil-doc-related__title { margin: 0 0 8px; color: var(--cil-black-regular-7); font-size: 14px; font-weight: 600; line-height: 1.2; }
.cil-doc-toc__toggle { display: none; }
.cil-doc-toc__list, .cil-doc-related__list { display: flex; flex-direction: column; gap: 4px; margin: 0; padding: 0; list-style: none; }
.cil-doc .cil-doc-toc__list li, .cil-doc .cil-doc-related__list li { margin: 0; padding: 0; }
.cil-doc .cil-doc-toc__link {
    display: block; padding: 10px 16px; border-radius: 8px;
    color: var(--cil-black); font-size: 16px; font-weight: 600; line-height: 1.2; text-decoration: none;
}
/* Pointed at, a line draws in under the words; the section in view sits on the teal tint. */
.cil-doc-toc__words {
    background: linear-gradient(currentColor, currentColor) no-repeat right bottom / 0 1px;
    transition: background-size .25s cubic-bezier(.2, .8, .2, 1);
}
.lang-to-css-ltr .cil-doc-toc__words { background-position: left bottom; }
.cil-doc .cil-doc-toc__link:is(:hover, :focus-visible) { color: var(--cil-black); }
.cil-doc .cil-doc-toc__link:is(:hover, :focus-visible) .cil-doc-toc__words { background-size: 100% 1px; }
.cil-doc .cil-doc-toc__link.is-current { background: var(--cil-blue-light-1); color: var(--cil-blue-dark-1); font-weight: 700; }
.cil-doc .cil-doc-toc__link.is-current .cil-doc-toc__words { background-size: 0 1px; }

.cil-doc-related { display: flex; flex-direction: column; gap: 4px; }
.cil-doc-related--end { display: none; }
.cil-doc .cil-doc-related__link {
    display: inline-flex; align-items: center; gap: 8px; padding: 10px 16px;
    color: var(--cil-blue-dark-1); font-size: 16px; font-weight: 600; line-height: 1.2;
    text-decoration: underline; text-underline-offset: 3px;
}
.cil-doc .cil-doc-related__link svg { flex: none; transition: transform .25s cubic-bezier(.2, .8, .2, 1); }
.cil-doc .cil-doc-related__link:is(:hover, :focus-visible) { color: var(--cil-blue-dark-1); text-decoration-thickness: 2px; }
.cil-doc .cil-doc-related__link:is(:hover, :focus-visible) svg { transform: translateX(-3px); }
.lang-to-css-ltr .cil-doc .cil-doc-related__link:is(:hover, :focus-visible) svg { transform: scaleX(-1) translateX(-3px); }

/* ---- Phones: the contents fold into a bar that stays under the header ---- */
@media (max-width: 1079px) {
    .cil-doc { --cil-doc-pin: calc(var(--cil-hdr-height, 62px) + 80px); }
    .cil-doc__body, .cil-doc__body--alone { display: flex; flex-direction: column; align-items: stretch; gap: 32px; padding-block: 8px 48px; }
    .cil-doc__side { display: contents; }
    .cil-doc__text { gap: 32px; }
    .cil-doc .cil-doc__heading { font-size: 20px; }
    .cil-doc .cil-doc__subhead { font-size: 18px; }
    .cil-doc__section :is(p, ul, ol) { font-size: 16px; }

    /* Under the bar as it stands: 56px once the page has scrolled (header-component/assets/mobile-header.css). */
    .cil-doc { --cil-doc-bar-top: var(--cil-hdr-height, 62px); }
    body:has(#header.cil-hdr.is-scrolled) .cil-doc { --cil-doc-bar-top: 56px; }
    .cil-doc-toc.is-ready {
        position: sticky; top: var(--cil-doc-bar-top); z-index: 5;
        margin-block: -8px; margin-inline: -16px; padding: 8px 16px; border: 0; background: var(--cil-white);
        transition: box-shadow .2s ease, top .28s cubic-bezier(.22, 1, .36, 1);
    }
    /* Same size pinned or not, so pinning never moves the text under it. */
    .cil-doc-toc.is-ready.is-pinned { box-shadow: 0 1px 0 var(--cil-black-light-3); }
    .cil-doc-toc.is-ready .cil-doc-toc__title { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
    .cil-doc-toc.is-ready .cil-doc-toc__toggle {
        display: flex; align-items: center; justify-content: space-between; gap: 12px; width: 100%; min-height: 48px;
        padding: 14px 16px; border: 0; border-radius: 12px; background: var(--cil-white-light-2);
        color: var(--cil-black); font: inherit; font-size: 16px; font-weight: 600; line-height: 1.2; text-align: start; cursor: pointer;
    }
    .cil-doc-toc.is-ready .cil-doc-toc__toggle[aria-expanded="true"] { border-end-start-radius: 0; border-end-end-radius: 0; }
    .cil-doc-toc__toggleText { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
    .cil-doc-toc__toggle svg { flex: none; transition: transform .25s cubic-bezier(.2, .8, .2, 1); }
    .cil-doc-toc__toggle[aria-expanded="true"] svg { transform: rotate(180deg); }
    .cil-doc-toc.is-ready .cil-doc-toc__list {
        display: none; max-height: calc(100dvh - var(--cil-hdr-height, 62px) - 96px); overflow-y: auto; overscroll-behavior: contain;
        padding: 0 8px 8px; border-radius: 0 0 12px 12px; background: var(--cil-white-light-2);
    }
    .cil-doc-toc.is-ready.is-open .cil-doc-toc__list { display: flex; }
    .cil-doc .cil-doc-toc.is-ready .cil-doc-toc__link.is-current { background: var(--cil-white); }

    .cil-doc-related--side { display: none; }
    .cil-doc-related--end { display: flex; padding-top: 20px; border-top: 1px solid var(--cil-black-light-3); }
    .cil-doc .cil-doc-related--end .cil-doc-related__link { padding-inline: 0; }
}

@media (prefers-reduced-motion: reduce) {
    .cil-doc *, .cil-doc *::after { transition: none !important; }
}
