/* The catalogue's pages (Figma 38-24, 2256-25) -- what every one of them shares: the width, the
   header with its trail and yellow mark, the pill search, section heads, buttons and chips.
   Logical properties throughout: Hebrew and Arabic read from the right, English and Russian from
   the left, and the same rules serve both. Colours are the brand's tokens (design-system/palette.css). */

.cil-ctl, .cil-ctl *, .cil-ctl *::before, .cil-ctl *::after { box-sizing: border-box; }

.cil-ctl {
    display: block;
    /* Below the fixed header, by its own height. */
    margin-top: var(--cil-hdr-height, 64px);
    padding-bottom: 120px;
    background: var(--cil-white);
    color: var(--cil-black);
    font-family: 'Assistant', 'Assistant-Regular', Arial, sans-serif;
    font-size: 16px;
    line-height: 1.2;
}
.cil-ctl a { text-decoration: none; }

/* 1420 wide on a wide screen, as the design's grid; 16 from the edge on a phone. */
.cil-ctl-wrap { width: 100%; max-width: calc(1420px + 48px); margin-inline: auto; padding-inline: 24px; }

/* A mark pointing along the line of reading turns round on a left-to-right page. */
.cil-ctl-forward { display: inline-flex; }
.lang-to-css-ltr .cil-ctl-forward { transform: scaleX(-1); }
.cil-ctl svg { display: block; flex: none; }

/* ---- The page's header ---- */
.cil-ctl-head { display: flex; flex-direction: column; align-items: flex-start; gap: 14px; padding-block: 40px 32px; }

.cil-ctl-crumbs ol { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 0; padding: 0; list-style: none; }
/* No padding: the theme gives every `ol > li` 12px below, which pushed the title 12px under the design's. */
.cil-ctl-crumbs li { display: flex; align-items: center; gap: 6px; padding: 0; color: var(--cil-black-regular-7); font-size: 14px; }
.cil-ctl-crumbs a { display: inline-flex; align-items: center; gap: 4px; color: var(--cil-blue-dark-1); }
.cil-ctl-crumbs a:hover { text-decoration: underline; }

/* The title with its yellow mark at the start of the line. */
.cil-ctl-title,
.cil-ctl-sectionHead__title {
    display: flex; align-items: center; gap: 14px;
    margin: 0;
    color: var(--cil-black);
    font-size: 48px; font-weight: 700; line-height: 1.2;
}
.cil-ctl-title::before,
.cil-ctl-sectionHead__title::before {
    content: ''; flex: none;
    width: 4px; height: 46px; border-radius: 2px;
    background: var(--cil-yellow);
}
.cil-ctl-intro { max-width: 900px; margin: 0; color: var(--cil-black-regular-7); font-size: 18px; }
.cil-ctl-facts { margin: 0; color: var(--cil-black-regular-7); font-size: 14px; }

/* The catalogue's own search, the pill with its button inside: assets/pill-search.css (shared with the landing pages'
   search-first hero). Its phone shape is below. */
/* A search field's "×" is ours (search-clear.php), as the admin draws its clear buttons: round, quiet,
   red when pointed at. The browser's own is hidden. */
.cil-ctl input[type="search"]::-webkit-search-cancel-button { -webkit-appearance: none; appearance: none; display: none; }
.cil-ctl-clear {
    display: inline-grid; place-items: center; flex: none;
    width: 24px; height: 24px; padding: 0;
    border: 0; border-radius: 50%; background: transparent; color: var(--cil-black-regular-7);
    cursor: pointer; transition: background-color .15s ease, color .15s ease;
}
.cil-ctl-clear[hidden] { display: none; }
.cil-ctl-clear:hover, .cil-ctl-clear:focus-visible { background: var(--cil-red-light-2); color: var(--cil-red-dark-1); }

/* ---- Sections ---- */
.cil-ctl-section { display: flex; flex-direction: column; gap: 24px; margin-top: 96px; }
.cil-ctl-sectionHead { display: flex; align-items: flex-start; justify-content: space-between; gap: 24px; }
.cil-ctl-sectionHead__words { display: flex; flex-direction: column; gap: 8px; }
.cil-ctl-sectionHead__title { font-size: 40px; }
.cil-ctl-sectionHead__title::before { height: 36px; }
.cil-ctl-sectionHead__text { margin: 0; color: var(--cil-black-regular-7); font-size: 18px; }
/* As tall as the title's line, so the link sits level with the title. */
.cil-ctl-sectionHead__link {
    display: inline-flex; align-items: center; gap: 6px; flex: none; min-height: 48px;
    color: var(--cil-blue-dark-1); font-size: 14px; font-weight: 600;
    text-decoration: underline; text-decoration-color: transparent; text-underline-offset: 5px;
    transition: text-decoration-color .25s ease;
}
/* Pointed at, its colour holds (the theme would turn it green), an underline fades in under it and
   its chevron steps forward (below). */
.cil-ctl a.cil-ctl-sectionHead__link:hover, .cil-ctl a.cil-ctl-sectionHead__link:focus-visible {
    color: var(--cil-blue-dark-1); text-decoration: underline; text-decoration-color: currentColor;
}

/* Links whose words are drawn by what is inside them: pointed at, the theme's green does not reach them. */
.cil-ctl :is(.cil-ctl-mosaic__tile, .cil-ctl-catBlock__photo):is(:hover, :focus-visible) { color: inherit; }

/* Every link that ends in a chevron -- a section's "all of it", a subject chip, a subject's tile:
   pointed at, the chevron steps forward (left on a Hebrew page), the chevron itself unchanged. */
.cil-ctl :is(.cil-ctl-sectionHead__link, .cil-ctl-topic, .cil-ctl-subjectTile) .cil-ctl-forward { transition: transform .25s cubic-bezier(.2, .8, .2, 1); }
.cil-ctl :is(.cil-ctl-sectionHead__link, .cil-ctl-topic, .cil-ctl-subjectTile):is(:hover, :focus-visible) .cil-ctl-forward { transform: translateX(-3px); }
.lang-to-css-ltr .cil-ctl :is(.cil-ctl-sectionHead__link, .cil-ctl-topic, .cil-ctl-subjectTile):is(:hover, :focus-visible) .cil-ctl-forward { transform: scaleX(-1) translateX(-3px); }

/* ---- Buttons ---- */
.cil-ctl-btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    height: 48px; padding-inline: 24px;
    border: 1px solid var(--cil-black); border-radius: 24px;
    background: var(--cil-white); color: var(--cil-black);
    font: inherit; font-size: 16px; font-weight: 700;
    cursor: pointer;
    transition: background-color .2s ease, border-color .2s ease;
}
.cil-ctl-btn:hover { background: var(--cil-black-light-2); }
.cil-ctl-btn--primary { background: var(--cil-blue); border-color: var(--cil-blue-dark-1); color: var(--cil-black); }
.cil-ctl-btn--primary:hover { background: var(--cil-blue-light-10); }
.cil-ctl-btn--quiet { border-color: transparent; background: none; }
.cil-ctl a.cil-ctl-btn:hover { color: var(--cil-black); }

/* ---- Chips ---- */
.cil-ctl-chips ul { display: flex; flex-wrap: wrap; gap: 8px; margin: 0; padding: 0; list-style: none; }
.cil-ctl-chip {
    display: inline-flex; align-items: center;
    height: 35px; padding-inline: 18px;
    border: 1px solid var(--cil-black-light-3); border-radius: 20px;
    background: var(--cil-white); color: var(--cil-black);
    font-size: 14px; font-weight: 600; white-space: nowrap;
}
.cil-ctl-chip:hover { border-color: var(--cil-blue-dark-1); color: var(--cil-blue-dark-1); }
.cil-ctl-chip.is-current, .cil-ctl-chip.is-current:hover { border-color: var(--cil-blue-dark-1); background: var(--cil-blue-dark-1); color: var(--cil-white); font-weight: 700; }
/* A chip is as wide as its words in bold, chosen or not, so the row never shifts when the choice moves
   (the bold copy holds the width and is never seen). */
.cil-ctl-chips li { flex: none; }   /* a phone's scrolling row must not squeeze them below it */
.cil-ctl-chip__label { display: inline-grid; }
.cil-ctl-chip__label::after { content: attr(data-label); height: 0; overflow: hidden; visibility: hidden; font-weight: 700; }

/* Focus: one ring for every control the catalogue draws. */
.cil-ctl a:focus-visible, .cil-ctl button:focus-visible, .cil-ctl summary:focus-visible,
.cil-ctl input:focus-visible, .cil-ctl select:focus-visible {
    outline: 2px solid var(--cil-blue-dark-1); outline-offset: 2px;
}

@media (max-width: 1079px) {
    .cil-ctl { padding-bottom: 64px; }
    .cil-ctl-wrap { padding-inline: 16px; }
    .cil-ctl-head { gap: 10px; padding-block: 20px; }
    .cil-ctl-title { font-size: 24px; gap: 10px; }
    .cil-ctl-title::before { height: 28px; }
    .cil-ctl-intro { font-size: 14px; }
    .cil-ctl-crumbs li:first-child svg { display: none; }
    .cil-ctl-pillSearch { height: 48px; padding-inline: 14px; border-radius: 8px; border-color: var(--cil-black-regular-5); background: var(--cil-white-light-2); }
    .cil-ctl-pillSearch__go { display: none; }
    .cil-ctl-section { margin-top: 48px; gap: 16px; }
    .cil-ctl-sectionHead__link { min-height: 29px; }
    .cil-ctl-sectionHead__title { font-size: 24px; gap: 10px; }
    .cil-ctl-sectionHead__title::before { height: 24px; }
    .cil-ctl-sectionHead__text { font-size: 16px; }
    .cil-ctl-chips { margin-inline: -16px; }
    /* Room above and below for a chosen chip's swell (chip-swell.js), which a scrolling row would cut off. */
    .cil-ctl-chips ul { flex-wrap: nowrap; overflow-x: auto; padding: 3px 16px; margin-block: -3px; scrollbar-width: none; }
}

/* ---- A short window (items 672-673) ----
   Every page in the catalogue's look gives way on a window shorter than its first screen needs: the head, the
   sections and each page's own opening (results.css, lobby.css and each page's sheet) close up together, so its
   head and the first row of its content stand on the first screen. A page names the window height it needs
   (--ctl-from: where its first row ends as drawn) and how much its parts can give between them (--ctl-span, the
   sum of their ranges above that row); under that height the page gives by what the window lacks, shared out by
   each part's range, so the first row ends at the window's foot until every part is at its floor. A taller window
   changes nothing. Body text and small print keep their sizes; titles step down within limits. */
.cil-ctl { --ctl-give: clamp(0px, var(--ctl-from, 0px) - 100svh, var(--ctl-span, 1) * 1px); }
@media (width > 1079px) {
    .cil-ctl-head {
        gap: calc(14px - var(--ctl-give) * 6 / var(--ctl-span, 1));
        padding-block: calc(40px - var(--ctl-give) * 24 / var(--ctl-span, 1)) calc(32px - var(--ctl-give) * 20 / var(--ctl-span, 1));
    }
    .cil-ctl-title { font-size: calc(48px - var(--ctl-give) * 12 / var(--ctl-span, 1)); }
    .cil-ctl-title::before { height: calc(46px - var(--ctl-give) * 12 / var(--ctl-span, 1)); }
    .cil-ctl-section {
        gap: calc(24px - var(--ctl-give) * 12 / var(--ctl-span, 1));
        margin-top: calc(96px - var(--ctl-give) * 64 / var(--ctl-span, 1));
    }
    .cil-ctl-sectionHead__title { font-size: calc(40px - var(--ctl-give) * 8 / var(--ctl-span, 1)); }
    .cil-ctl-sectionHead__title::before { height: calc(36px - var(--ctl-give) * 8 / var(--ctl-span, 1)); }
}
@media (min-width: 1024px) and (max-width: 1079px) {
    .cil-ctl-head {
        gap: calc(10px - var(--ctl-give) * 4 / var(--ctl-span, 1));
        padding-block: calc(20px - var(--ctl-give) * 8 / var(--ctl-span, 1)) calc(20px - var(--ctl-give) * 12 / var(--ctl-span, 1));
    }
}

/* Moving to another catalogue page by a link (the trail, another category) is animated where the browser
   can: the title crossfades and the list leaves and arrives (cross-document view transitions; a browser
   without them simply opens the page). The chips -- all, certificate, credit, programmes, a category's
   subjects -- change the page in place instead (results.js, chip-swell.js), in every browser. */
@view-transition { navigation: auto; }
.cil-ctl-head .cil-ctl-title { view-transition-name: cil-ctl-title; }
.cil-ctl-results { view-transition-name: cil-ctl-results; }
::view-transition-old(cil-ctl-results) { animation: cil-ctl-list-out .16s ease-in both; }
::view-transition-new(cil-ctl-results) { animation: cil-ctl-list-in .34s cubic-bezier(.2, .8, .2, 1) .06s both; }
::view-transition-old(root), ::view-transition-new(root) { animation-duration: .2s; }
@keyframes cil-ctl-list-out { to { opacity: 0; transform: translateY(-6px); } }
@keyframes cil-ctl-list-in { from { opacity: 0; transform: translateY(12px); } }

@media (prefers-reduced-motion: reduce) {
    @view-transition { navigation: none; }
    .cil-ctl * { transition: none !important; scroll-behavior: auto !important; }
    .cil-ctl-subjects.is-tabbed .cil-ctl-tabs__panel:not([hidden]) { animation: none; }
}
