/* ==========================================================================
   SITE — شركة عماد الحياة التعليمية / Imad Alhayat Educational Company.
   Vanilla CSS, no framework, no CDN. Logical properties (inline-start/end)
   throughout, so Arabic (RTL) and English (LTR) both come out of one sheet.

   THE PALETTE IS THE SEAL. Every colour below was sampled out of the company
   logo rather than chosen beside it, which is the whole reason the page and
   the mark in its corner look like one object:

       #E80032  crimson      the outer arc, and the brand
       #FF0037  crimson tip  the arc's lighter end — the gradient's other stop
       #00722A  emerald      the base bar under the nib
       #416B39  olive        the pen nib itself
       #14110F  ink          the black arc, and all body text
       ivory                 the ground the seal is printed on

   The luxury is carried by RESTRAINT, not decoration: an ivory ground instead
   of a cold grey one, hairline rules, layered soft shadows, one gradient used
   for one job (the brand), and a single crimson→emerald seal rule that marks
   the three places the page changes register — under the header, under a
   section title, along the top of a card you are pointing at.
   ========================================================================== */

/* The Cairo @font-face rules live in site-fonts.css, which index.php links
   BESIDE this file rather than @import-ing from inside it: an @import cannot
   start downloading until this sheet has been fetched and parsed, so the font
   would queue behind the theme instead of travelling with it. */

:root {
    /* This sheet paints BOTH schemes itself (see the media query below), and
       saying so is what stops the browser from also applying its own automatic
       darkening on top — which turned the logo's white plate grey and left the
       seal floating on nothing. It is also what makes form controls,
       scrollbars and the canvas behind the page follow the right scheme. */
    color-scheme: light dark;

    /* ── ground & ink ─────────────────────────────────────────────
       Warm, not blue. #F6F8FC read as a dashboard; ivory reads as paper, and
       paper is what a seal belongs on. The surfaces stay pure white so the
       cards lift off the page without needing a heavier border. */
    --bg:            #FAF7F4;
    --bg-deep:       #F2EDE8;
    --surface:       #FFFFFF;
    --surface-2:     #F6F2EE;
    --text:          #14110F;
    --text-muted:    #6B615A;
    --border:        #EAE2DA;
    --border-strong: #D6C9BD;

    /* ── the brand ────────────────────────────────────────────────
       --accent keeps its NAME from the previous theme on purpose: every rule
       in this sheet already speaks in those variables, so a customer is a
       palette swap and never a rewrite. */
    --accent:        #E80032;   /* crimson — the brand, and every primary action */
    --accent-lit:    #FF0037;   /* the arc's lighter end */
    --accent-dark:   #B8002A;   /* pressed / hover / text on a tinted ground */
    --accent-soft:   #FDECF0;   /* the faintest crimson that still reads as crimson */
    --accent-line:   rgba(232, 0, 50, .22);

    --emerald:       #00722A;   /* the base bar */
    --emerald-soft:  #E6F2E9;
    --olive:         #416B39;   /* the nib */
    --olive-soft:    #EDF2EA;
    --ink:           #14110F;   /* the black arc */
    --ink-soft:      #F1EDEA;

    /* The seal: the two arcs of the logo, as one fill. Used for the brand and
       for primary actions — nowhere else, or it stops meaning anything. */
    --seal:          linear-gradient(135deg, var(--accent-lit) 0%, var(--accent) 46%, var(--accent-dark) 100%);
    /* Crimson → emerald: the mark's whole colour story in one 2px rule. */
    --seal-rule:     linear-gradient(90deg, var(--accent) 0%, var(--accent-dark) 38%, var(--olive) 68%, var(--emerald) 100%);

    --danger:        #C1121F;
    --ok:            #00722A;

    --radius:        14px;
    --radius-sm:     10px;
    --radius-lg:     20px;
    /* Layered rather than single: a hairline contact shadow, a short soft one,
       and a wide faint one. That is what separates "elevated" from "outlined
       with a blur" — and the tint is warm brown, not neutral black, so it sits
       on ivory without turning the page grey. */
    --shadow:        0 1px 1px rgba(43, 28, 20, .04),
                     0 2px 6px rgba(43, 28, 20, .05);
    --shadow-lg:     0 1px 1px rgba(43, 28, 20, .05),
                     0 8px 20px rgba(43, 28, 20, .08),
                     0 24px 48px rgba(43, 28, 20, .07);
    --shadow-brand:  0 6px 18px rgba(232, 0, 50, .28);
    --wrap:          1120px;
}

@media (prefers-color-scheme: dark) {
    :root {
        /* Not black — warm charcoal, the same hue family as the ivory above,
           so the identity survives the switch instead of going grey. */
        --bg:            #14110F;
        --bg-deep:       #0D0B0A;
        --surface:       #1E1A17;
        --surface-2:     #272220;
        --text:          #F6F1EC;
        --text-muted:    #A99C92;
        --border:        #322B27;
        --border-strong: #473E38;

        /* #E80032 on a dark ground is a hole, not a highlight: crimson loses
           most of its contrast against charcoal. Lift it, and keep the SOFT
           tints as dark tinted grounds rather than pale washes. */
        --accent:        #FF2E57;
        --accent-lit:    #FF5C79;
        --accent-dark:   #FF7189;
        --accent-soft:   #3A1119;
        --accent-line:   rgba(255, 46, 87, .30);

        --emerald:       #34A35A;
        --emerald-soft:  #14281A;
        --olive:         #7FA872;
        --olive-soft:    #1D2619;
        --ink:           #F6F1EC;
        --ink-soft:      #2A2421;

        --shadow:        0 1px 2px rgba(0, 0, 0, .5);
        --shadow-lg:     0 8px 20px rgba(0, 0, 0, .55), 0 24px 48px rgba(0, 0, 0, .45);
        --shadow-brand:  0 6px 18px rgba(255, 46, 87, .30);
    }
}

/* ------------------------------------------------------------------ base */
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
    margin: 0;
    color: var(--text);
    /* Cairo, self-hosted (site-fonts.css). It shapes Arabic properly and
       carries real 800/900 weights — the system faces stay behind it so the
       page still renders if the font file fails. */
    font-family: "Cairo", "Segoe UI", Tahoma, system-ui, -apple-system, Arial, sans-serif;
    line-height: 1.75;
    /* Two almost-invisible washes — crimson from the leading top corner,
       emerald from the trailing one — over the ivory. You cannot name them
       while looking at the page; you would notice at once if they were gone,
       because the ground would go flat. `fixed` anchors them to the viewport
       so they never scroll into view as blobs. */
    background:
        radial-gradient(1200px 520px at 100% -8%, rgba(232, 0, 50, .055), transparent 62%),
        radial-gradient(1000px 460px at 0% -4%, rgba(0, 114, 42, .045), transparent 60%),
        var(--bg);
    background-attachment: fixed;
    -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
p  { margin: 0 0 1em; }

h1, h2, h3 {
    line-height: 1.3; text-wrap: balance; margin: 0 0 .5em;
    font-weight: 800; letter-spacing: -.015em;
}
h1 { font-size: clamp(1.55rem, 1.15rem + 1.7vw, 2.35rem); font-weight: 900; }
h2 { font-size: clamp(1.25rem, 1.05rem + .85vw, 1.6rem); }
h3 { font-size: 1.06rem; }

/* Arabic at 600 reads as running text; the same words at 800 read as a title.
   Every label with a job to do steps up a weight. */
.lesson-title { font-weight: 800; font-size: 16px; }
.lesson-meta-item { font-weight: 600; }
.lesson-meta-subject { font-weight: 800; }
.lesson-meta-level { font-weight: 700; }
.lesson-act { font-weight: 800; font-size: 14px; }
.ll-open { font-weight: 800; }
.ll-chip { font-weight: 700; }
.ll-page { font-weight: 800; }
.btn { font-weight: 700; }
.chip { font-weight: 700; }

.wrap { max-width: var(--wrap); margin-inline: auto; padding-inline: 18px; }
.section { padding-block: 44px; }
/* The front page IS the list: trim the top so the first thing on screen is
   what people came for, keep the bottom so the footer does not crowd. */
.lesson-list { padding-block: 16px 34px; }
.narrow { max-width: 720px; }
.muted { color: var(--text-muted); }
.small { font-size: .86rem; }

::selection { background: var(--accent); color: #fff; }

/* One focus ring for the whole site, in the brand colour. Never removed —
   only ever replaced by something at least as visible. */
:focus-visible {
    outline: 3px solid var(--accent);
    outline-offset: 2px;
    border-radius: 4px;
}

/* ------------------------------------------------------------------ header */
.site-header {
    position: sticky; top: 0; z-index: 40;
    background: color-mix(in srgb, var(--surface) 86%, transparent);
    backdrop-filter: blur(14px) saturate(140%);
    -webkit-backdrop-filter: blur(14px) saturate(140%);
    border-bottom: 1px solid var(--border);
}
/* THE SEAL RULE. A 2px crimson→emerald hairline along the foot of the header:
   the logo's own colours, drawn once, at the exact line where the chrome ends
   and the page begins. It is the most "signed" thing on the page and it costs
   one pseudo-element. */
.site-header::after {
    content: ''; position: absolute; inset-inline: 0; bottom: -1px; height: 2px;
    background: var(--seal-rule);
    opacity: .9;
}
.header-inner { display: flex; align-items: center; gap: 18px; min-height: 72px; }

/* ── the brand lockup ─────────────────────────────────────────
   The seal, then the name. The mark is round, so it gets a round plate with a
   hairline crimson ring — that ring is what stops a transparent PNG floating
   loose on the header, and it echoes the two circles the logo is built from. */
.brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
.brand-logo {
    width: 46px; height: 46px; flex: 0 0 auto; border-radius: 50%;
    object-fit: contain; padding: 2px; background: #fff;
    box-shadow: 0 0 0 1px var(--accent-line), 0 4px 10px rgba(43, 28, 20, .10);
    transition: transform .25s ease, box-shadow .25s ease;
}
.brand:hover .brand-logo {
    transform: rotate(-4deg) scale(1.04);
    box-shadow: 0 0 0 1px var(--accent), 0 8px 18px rgba(232, 0, 50, .22);
}
/* The gradient square the previous theme used, kept as the fallback for a
   customer who has supplied no logo file — the header must never collapse. */
.brand-mark {
    width: 30px; height: 30px; border-radius: 9px; flex: 0 0 auto;
    background: var(--seal);
    box-shadow: var(--shadow-brand);
}
.brand-name {
    font-weight: 900; font-size: 1.06rem; line-height: 1.25;
    letter-spacing: -.02em; color: var(--text);
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

.site-nav { display: flex; gap: 4px; margin-inline-start: auto; flex-wrap: wrap; }
.site-nav a {
    position: relative; padding: 9px 16px; border-radius: 999px;
    color: var(--text-muted); font-size: .95rem; font-weight: 600;
    transition: background .18s, color .18s;
}
.site-nav a:hover { background: var(--surface-2); color: var(--text); }
/* The active tab is named by a crimson fill, but a PALE one: the loudest thing
   in the header should be the logo, not the tab you are already on. */
.site-nav a.active {
    background: var(--accent-soft); color: var(--accent-dark); font-weight: 800;
    box-shadow: inset 0 0 0 1px var(--accent-line);
}
.header-actions { display: flex; align-items: center; gap: 8px; }
.lang-switch {
    width: 38px; height: 38px; display: grid; place-items: center;
    font-weight: 800; font-size: .8rem;
    border: 1px solid var(--border); border-radius: 50%; color: var(--text-muted);
    transition: border-color .18s, color .18s, background .18s;
}
.lang-switch:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }
.nav-toggle { display: none; }

/* ------------------------------------------------------------------ buttons */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    padding: 11px 20px; border: 1px solid transparent; border-radius: var(--radius-sm);
    font: inherit; font-weight: 700; cursor: pointer; white-space: nowrap;
    transition: transform .14s ease, box-shadow .18s ease, background .18s, border-color .18s, color .18s;
}
/* The gradient plus an inset white hairline along the top edge: that hairline
   is the whole difference between a flat crimson rectangle and a button that
   looks lit from above. */
.btn-primary {
    background: var(--seal); color: #fff;
    box-shadow: var(--shadow-brand), inset 0 1px 0 rgba(255, 255, 255, .22);
}
.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 10px 24px rgba(232, 0, 50, .34), inset 0 1px 0 rgba(255, 255, 255, .28);
}
.btn-primary:active { transform: translateY(0); }
.btn-ghost { background: transparent; border-color: var(--border-strong); color: var(--text); }
.btn-ghost:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }
.btn-lg { padding: 14px 28px; font-size: 1.02rem; }
.btn:disabled { opacity: .45; cursor: not-allowed; transform: none; box-shadow: none; }

/* ------------------------------------------------------------------ hero */
.hero {
    position: relative; overflow: hidden;
    padding-block: clamp(24px, 4.5vw, 52px);
    background: linear-gradient(165deg, var(--accent-soft) 0%, transparent 68%);
    border-bottom: 1px solid var(--border);
}
/* A wide emerald wash rising from the trailing edge to balance the crimson
   coming down from the leading one — the two halves of the seal, opened out
   across the banner. */
.hero::after {
    content: ''; position: absolute; inset-block: 0; inset-inline-end: -10%;
    width: 55%; pointer-events: none;
    background: radial-gradient(closest-side, rgba(0, 114, 42, .10), transparent 72%);
}
.hero > * { position: relative; }
.hero h1 { margin: 0 0 .3em; }
.hero-text { max-width: 62ch; color: var(--text-muted); margin-bottom: 0; }

/* ------------------------------------------------------------------ sections */
.section-head {
    display: flex; align-items: baseline; justify-content: space-between;
    gap: 12px; margin-bottom: 20px;
}
.section-head h2 { margin: 0; position: relative; padding-bottom: 10px; }
/* The seal rule again, in miniature, under every section title. Short and
   fixed-width so it reads as a mark rather than as an underline. */
.section-head h2::after {
    content: ''; position: absolute; inset-inline-start: 0; bottom: 0;
    width: 54px; height: 3px; border-radius: 3px;
    background: var(--seal-rule);
}
.more { color: var(--accent); font-weight: 700; font-size: .92rem; }
.more:hover { color: var(--accent-dark); text-decoration: underline; text-underline-offset: 4px; }

/* ------------------------------------------------------------------ cards */
.card-grid { display: grid; gap: 20px; grid-template-columns: repeat(auto-fill, minmax(255px, 1fr)); }
.card {
    position: relative;
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
    overflow: hidden; box-shadow: var(--shadow);
    transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease;
    display: flex; flex-direction: column;
}
/* A gradient edge that is DRAWN but transparent until you point at the card —
   animating opacity rather than adding a border on hover, so nothing shifts by
   a pixel when it appears. */
.card::before {
    content: ''; position: absolute; inset-inline: 0; top: 0; height: 3px;
    background: var(--seal-rule); opacity: 0; transition: opacity .2s ease;
    z-index: 1;
}
.card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
    border-color: var(--border-strong);
}
.card:hover::before { opacity: 1; }
.card-img { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; background: var(--surface-2); }
.card-img-ph { background: linear-gradient(135deg, var(--accent-soft), var(--emerald-soft)); }
.card-body { padding: 16px 18px 18px; display: flex; flex-direction: column; gap: 6px; }
.card-body h3 { margin: 0; }

/* ------------------------------------------------------------------ chips */
.chip {
    font-size: .74rem; font-weight: 700; padding: 3px 10px; border-radius: 999px;
    background: var(--surface-2); color: var(--text-muted);
}
/* Four tints, all four taken from the seal — crimson, emerald, olive, ink —
   so a row of chips still reads as one family rather than as a paint chart. */
.chip-rec  { background: var(--accent-soft);  color: var(--accent-dark); }
.chip-live { background: var(--emerald-soft); color: var(--emerald); }
.chip-int  { background: var(--olive-soft);   color: var(--olive); }
.chip-work { background: var(--ink-soft);     color: #5A4E45; }
.chip-done { background: var(--surface-2); color: var(--text-muted); }
.chip-prereq { background: var(--surface-2); color: var(--text-muted); }
@media (prefers-color-scheme: dark) {
    .chip-work { color: #C6B6A9; }
}
.live-when { color: var(--accent); font-weight: 700; }

/* ------------------------------------------------------------------ forms */
.form {
    display: grid; gap: 16px; background: var(--surface);
    border: 1px solid var(--border); border-radius: var(--radius);
    padding: 24px; box-shadow: var(--shadow);
}
/* A grid, so a hint <small> placed AFTER the control sits under it on its own
   row. The caption is always wrapped in its own <span> (see site/modules/) so
   it stays one row — a bare text node plus a required marker would become two
   grid items and drop the * onto a line of its own. */
.form label { display: grid; gap: 6px; font-weight: 700; }
.form label > span { display: block; }
.form input, .form textarea, .form select {
    padding: 11px 14px; border: 1px solid var(--border); border-radius: var(--radius-sm);
    background: var(--surface-2); color: var(--text); font: inherit; min-width: 0;
    transition: border-color .18s, box-shadow .18s, background .18s;
}
/* A ring rather than a thicker border: a border that grows on focus moves the
   text inside the field by a pixel, which is visible and cheap to avoid. */
.form input:focus, .form textarea:focus, .form select:focus {
    outline: none; border-color: var(--accent); background: var(--surface);
    box-shadow: 0 0 0 3px var(--accent-soft);
}
/* The required marker — the only place --danger outranks the brand crimson. */
.form label small { color: var(--danger); font-weight: 700; }
.form .check { display: flex; align-items: center; gap: 8px; font-weight: 400; }
.form .check input { width: 18px; height: 18px; accent-color: var(--accent); }

.alert {
    padding: 13px 16px; border-radius: var(--radius-sm); margin-bottom: 18px;
    border: 1px solid transparent; border-inline-start-width: 4px; font-weight: 600;
}
.alert-error { background: var(--accent-soft);  color: var(--accent-dark); border-color: var(--accent); }
.alert-ok    { background: var(--emerald-soft); color: var(--emerald);     border-color: var(--emerald); }

/* ------------------------------------------------------------------ lesson page */
.crumbs { display: flex; gap: 8px; color: var(--text-muted); font-size: .9rem; margin-bottom: 12px; }
.crumbs a { color: var(--accent); font-weight: 600; }
.crumbs a:hover { text-decoration: underline; text-underline-offset: 3px; }
.lesson-desc { max-width: 70ch; }
.box {
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
    padding: 22px; margin-block: 18px; box-shadow: var(--shadow);
}
.box h2 { display: flex; align-items: center; gap: 10px; margin-top: 0; }
.box.locked { text-align: center; }
.video {
    position: relative; aspect-ratio: 16 / 9; border-radius: var(--radius-sm);
    overflow: hidden; background: #000; box-shadow: var(--shadow);
}
.video iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.live-links { display: flex; flex-wrap: wrap; gap: 10px; }
.prereq-list { margin: 0; padding-inline-start: 1.3em; }
.prereq-list a { color: var(--accent); font-weight: 700; }
.file-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.file-list a { color: var(--accent); font-weight: 700; }
.file-list a:hover { text-decoration: underline; text-underline-offset: 3px; }

/* ------------------------------------------------------------------ article / page */
.article-img { border-radius: var(--radius); margin-block: 16px; box-shadow: var(--shadow); }
.article-body { max-width: 72ch; }
.article-body img { border-radius: var(--radius-sm); margin-block: 12px; }
.article-body a { color: var(--accent); text-decoration: underline; text-underline-offset: 3px; }
.article-body blockquote {
    margin: 18px 0; padding: 14px 18px;
    border-inline-start: 3px solid var(--accent);
    background: var(--surface-2); border-radius: var(--radius-sm);
    color: var(--text-muted);
}
.page-layout { display: grid; gap: 28px; grid-template-columns: 240px 1fr; align-items: start; }
.page-content { min-width: 0; }
.page-side ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.page-side a {
    display: block; padding: 10px 14px; border-radius: var(--radius-sm);
    color: var(--text-muted); font-weight: 600; transition: background .18s, color .18s;
}
.page-side a:hover { background: var(--surface-2); color: var(--text); }
.page-side a.active {
    background: var(--accent-soft); color: var(--accent-dark); font-weight: 800;
    box-shadow: inset 0 0 0 1px var(--accent-line);
}

/* ------------------------------------------------------------------ misc */
.data-list { display: grid; grid-template-columns: auto 1fr; gap: 10px 20px; margin: 0; }
.data-list dt { color: var(--text-muted); }
.data-list dd { margin: 0; font-weight: 700; }
.avatar { width: 100%; aspect-ratio: 1; object-fit: cover; background: var(--surface-2); }
.avatar-ph {
    display: grid; place-items: center; font-size: 2.6rem; font-weight: 800;
    color: var(--accent); background: linear-gradient(135deg, var(--accent-soft), var(--emerald-soft));
}
.social-row { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 18px; }

/* ------------------------------------------------------------------ footer */
.site-footer {
    position: relative;
    border-top: 1px solid var(--border);
    background: var(--surface); margin-top: 56px;
}
/* The seal rule closes the page the same way it opened it. */
.site-footer::before {
    content: ''; position: absolute; inset-inline: 0; top: -1px; height: 2px;
    background: var(--seal-rule); opacity: .75;
}
.footer-inner {
    display: flex; justify-content: space-between; align-items: center; gap: 16px;
    flex-wrap: wrap; padding-block: 26px; color: var(--text-muted); font-size: .9rem;
}
.footer-brand { display: flex; align-items: center; gap: 10px; }
.footer-logo {
    width: 34px; height: 34px; border-radius: 50%; object-fit: contain;
    background: #fff; padding: 1px; flex: none;
    box-shadow: 0 0 0 1px var(--accent-line);
}
/* The tagline sits under the copyright, not beside it: on a phone the two
   would wrap into one run-on line. */
.footer-slogan { display: block; font-size: .84rem; opacity: .75; }
.footer-nav { display: flex; gap: 18px; }
.footer-nav a { font-weight: 600; }
.footer-nav a:hover { color: var(--accent); }

/* ==========================================================================
   LESSON LIST — search dialog, filter chips, pager, card anatomy.
   Prefixed `ll-` (list), so nothing here can collide with the generic
   .card / .chip rules the rest of the site shares.
   ========================================================================== */

.ll-head {
    display: flex; align-items: center; justify-content: space-between;
    gap: 14px; flex-wrap: wrap; margin-bottom: 16px;
}
.ll-head h1 { margin: 0; }

/* Filled, not outlined: it is the ONLY route to the filters, and an outlined
   pill here disappears into the page chrome. The trailing … is the
   conventional sign that a control opens something rather than acting. */
.ll-open {
    display: inline-flex; align-items: center; gap: 10px; cursor: pointer;
    border: none; border-radius: 999px;
    background: var(--seal); color: #fff;
    font: inherit; font-size: 16px; font-weight: 800; padding: 12px 22px;
    box-shadow: var(--shadow-brand), inset 0 1px 0 rgba(255, 255, 255, .22);
    transition: transform .14s ease, box-shadow .18s ease;
}
.ll-open:hover {
    transform: translateY(-1px);
    box-shadow: 0 10px 24px rgba(232, 0, 50, .34), inset 0 1px 0 rgba(255, 255, 255, .28);
}
.ll-open-dots { font-weight: 900; letter-spacing: .06em; opacity: .85; transform: translateY(-.18em); }

/* ── applied filters, each removable ───────────────────────── */
.ll-chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 18px; }
.ll-chip {
    display: inline-flex; align-items: center; gap: 8px;
    padding: 6px 10px 6px 14px; border-radius: 999px;
    background: var(--accent-soft); border: 1px solid var(--accent-line);
    color: var(--accent-dark); font-size: 14px; font-weight: 700;
    text-decoration: none; max-width: 100%; overflow-wrap: anywhere;
    transition: border-color .18s, background .18s;
}
.ll-chip:hover, .ll-chip:focus-visible { border-color: var(--accent); }
.ll-chip-x {
    display: inline-flex; align-items: center; justify-content: center;
    width: 18px; height: 18px; border-radius: 50%; flex: none;
    background: var(--accent); color: #fff; font-size: 11px; line-height: 1;
}
/* "Clear everything" is the destructive one and has to look different from the
   filters beside it — ink, not crimson, because crimson IS the brand here and
   would read as just another chip. */
.ll-chip-clear { background: var(--ink-soft); border-color: var(--border-strong); color: var(--text); }
.ll-chip-clear .ll-chip-x { background: transparent; color: var(--text-muted); font-size: 13px; }
.ll-chip-clear:hover { border-color: var(--text); }

/* ── empty result: never a dead end ────────────────────────── */
.ll-none { text-align: center; padding: 38px 8px 30px; }
/* The message is muted; the way OUT of it is not. Dimming both together is
   what made the button read as decoration. */
.ll-none-text { margin: 0 0 22px; color: var(--text-muted); font-size: 16px; }
.ll-clear-big {
    display: inline-flex; align-items: center; gap: 10px;
    padding: 14px 28px; border-radius: 999px;
    background: var(--seal); color: #fff; text-decoration: none;
    font-weight: 800; font-size: 17px;
    box-shadow: var(--shadow-brand), inset 0 1px 0 rgba(255, 255, 255, .22);
    transition: transform .14s ease, box-shadow .18s ease;
}
.ll-clear-big:hover { transform: translateY(-1px); box-shadow: 0 10px 24px rgba(232, 0, 50, .34); }
.ll-clear-ico {
    display: inline-flex; align-items: center; justify-content: center;
    width: 26px; height: 26px; border-radius: 50%; flex: none;
    background: rgba(255, 255, 255, .22); font-size: 15px; line-height: 1; padding-bottom: 1px;
}

/* ── pager, above and below the grid ──────────────────────── */
.ll-pager { display: flex; align-items: center; justify-content: center; gap: 8px; flex-wrap: wrap; margin: 18px 0; }
.ll-page {
    display: inline-flex; align-items: center; justify-content: center;
    min-width: 40px; height: 40px; padding: 0 12px;
    border: 1px solid var(--border); border-radius: var(--radius-sm);
    background: var(--surface); color: inherit;
    text-decoration: none; font-weight: 800; font-variant-numeric: tabular-nums;
    transition: border-color .18s, color .18s, background .18s;
}
.ll-page:hover, .ll-page:focus-visible { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }
.ll-step { font-size: 18px; }
/* A dead end is SHOWN, not removed: dropping it would shift the whole row
   sideways as you page, so the same button lands somewhere else. */
.ll-page.is-off { opacity: .3; pointer-events: none; }
.ll-page.is-current {
    background: var(--seal); border-color: transparent; color: #fff;
    box-shadow: var(--shadow-brand);
}
.ll-gap { opacity: .5; padding: 0 2px; user-select: none; }
/* "3/42" is a number pair, not prose — forced LTR so Arabic does not flip it. */
.ll-count {
    font-size: 14px; font-weight: 800; opacity: .8;
    font-variant-numeric: tabular-nums; direction: ltr; unicode-bidi: isolate;
}

/* ── the search dialog ──────────────────────────────────── */
.ll-modal {
    position: fixed; inset: 0; z-index: 1000;
    display: flex; align-items: flex-start; justify-content: center;
    padding: 16px; overflow: auto;
    /* Warm, not blue-black: the scrim is this ivory page dimmed, which is why
       the dialog above it still looks like it belongs to this site. */
    background: rgba(20, 17, 15, .55);
    backdrop-filter: blur(3px);
    -webkit-backdrop-filter: blur(3px);
}
/* `display:flex` above beats the browser's [hidden] rule, so state it —
   without this line the dialog is simply always open. */
.ll-modal[hidden] { display: none; }
.ll-form {
    position: relative; width: 100%; max-width: 620px;
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius-lg); box-shadow: var(--shadow-lg);
    padding: 26px; margin-top: 4vh; overflow: hidden;
}
.ll-form::before {
    content: ''; position: absolute; inset-inline: 0; top: 0; height: 3px;
    background: var(--seal-rule);
}
.ll-form-title { margin: 0 0 18px; font-size: 20px; }
.ll-x {
    position: absolute; inset-block-start: 14px; inset-inline-end: 14px;
    width: 34px; height: 34px; border-radius: 50%;
    border: 1px solid var(--border); background: var(--surface-2);
    color: inherit; font: inherit; cursor: pointer;
    transition: border-color .18s, color .18s, background .18s;
}
.ll-x:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }
.ll-input {
    width: 100%; height: 48px; padding: 0 16px;
    border: 1px solid var(--border); border-radius: var(--radius-sm);
    background: var(--surface-2); color: inherit; font: inherit; font-size: 16px;
    transition: border-color .18s, box-shadow .18s, background .18s;
}
.ll-input:focus {
    outline: none; border-color: var(--accent); background: var(--surface);
    box-shadow: 0 0 0 3px var(--accent-soft);
}
.ll-fields { display: flex; flex-wrap: wrap; gap: 12px; margin: 16px 0 20px; }
.ll-field { flex: 1 1 220px; min-width: 0; display: flex; flex-direction: column; gap: 5px; }
.ll-label { font-size: 13px; font-weight: 700; color: var(--text-muted); }
.ll-field select {
    width: 100%; height: 44px; padding: 0 12px;
    border: 1px solid var(--border); border-radius: var(--radius-sm);
    background: var(--surface-2); color: inherit; font: inherit; cursor: pointer;
    transition: border-color .18s, box-shadow .18s;
}
.ll-field select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.ll-actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }

/* ── contact form ──────────────────────────────────────────── */
.contact-h2 { margin: 0 0 14px; font-size: 1.15rem; }
.contact-wait {
    display: flex; align-items: center; gap: 8px; margin: 0;
    color: var(--text-muted); font-size: .92rem;
}
/* `display:flex` beats the browser's [hidden] rule, so say it — otherwise the
   countdown stays on screen after it finishes. */
.contact-wait[hidden] { display: none; }

/* ── the lesson grid ────────────────────────────────────────
   One column on phones so a card reads at full width, two from 600px, then
   auto-fit once the viewport can carry 280px+ cards. `align-items: start`
   keeps each card content-sized — no stretchy empty space when a neighbour is
   taller. */
.lesson-grid {
    display: grid; grid-template-columns: 1fr; gap: 12px;
    margin: 8px auto 0; align-items: start; justify-items: center;
    width: 100%; max-width: 720px; padding: 0 8px;
}
.lesson-grid > .lesson-card { width: 100%; max-width: 560px; min-width: 0; }
@media (min-width: 600px) { .lesson-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; } }
@media (min-width: 900px) { .lesson-grid { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); max-width: 1080px; } }

/* The card is a GRID, not a stack: a fixed badge column beside a content
   column. That is what keeps every title aligned with its badge however long
   it runs, and lets the description and meta rows span the full width
   underneath. */
.lesson-card {
    display: grid;
    grid-template-columns: 38px 1fr;
    column-gap: 12px; row-gap: 6px;
    align-items: center;
    position: relative; overflow: hidden;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 14px 16px;
    padding-inline-start: 20px;      /* room for the coloured leading strip */
    text-align: start; color: inherit; font: inherit;
    transition: border-color .18s ease, transform .16s ease, box-shadow .2s ease;
}
.lesson-card:hover {
    transform: translateY(-3px);
    border-color: var(--border-strong);
    box-shadow: var(--shadow-lg);
}
@media (min-width: 480px) {
    .lesson-card { padding: 16px 18px; padding-inline-start: 22px; grid-template-columns: 42px 1fr; }
}

/* TWO cues, not one: a strip on the leading edge — what you catch while
   scanning the column — and a faint wash of the same colour rising from the
   bottom, which says the whole card belongs to that type. Either alone was too
   quiet on a white grid; a fully tinted card was too loud. */
.lesson-card::before {
    content: ''; position: absolute; inset-inline-start: 0; top: 0; bottom: 0;
    width: 7px; background: var(--accent); pointer-events: none;
}
.lesson-card::after {
    content: ''; position: absolute; inset: 0; border-radius: inherit;
    pointer-events: none; opacity: .55;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0) 58%, var(--card-tint, transparent) 100%);
}

/* The four kinds, in the four colours of the seal. Recorded is the brand
   crimson, live is its lighter end, a worksheet is the black arc, and an
   interactive page is the emerald base — all four distinguishable at a glance
   and none of them imported from outside the logo. */
.lesson-type-video::before { background: var(--accent); }
.lesson-type-live::before  { background: var(--accent-lit); }
.lesson-type-work::before  { background: var(--ink); }
.lesson-type-html::before  { background: var(--emerald); }
.lesson-type-video { --card-tint: rgba(232, 0, 50, .10); }
.lesson-type-live  { --card-tint: rgba(255, 0, 55, .14); }
.lesson-type-work  { --card-tint: rgba(20, 17, 15, .07); }
.lesson-type-html  { --card-tint: rgba(0, 114, 42, .10); }

/* Badge and title share row 1; everything else spans both columns. */
.lesson-badge {
    grid-column: 1; grid-row: 1;
    display: inline-flex; align-items: center; justify-content: center;
    width: 38px; height: 38px; border-radius: var(--radius-sm);
    background: var(--seal); color: #fff;
    font-size: 16px; line-height: 1;
    box-shadow: 0 3px 8px rgba(43, 28, 20, .16);
}
@media (min-width: 480px) { .lesson-badge { width: 42px; height: 42px; font-size: 18px; } }
.lesson-type-work .lesson-badge { background: linear-gradient(135deg, #3A3330, var(--ink)); }
.lesson-type-html .lesson-badge { background: linear-gradient(135deg, #0B8A36, var(--emerald)); }
.lesson-type-live .lesson-badge { animation: lessonLivePulse 1.5s ease-in-out infinite; }
@keyframes lessonLivePulse {
    0%, 100% { box-shadow: 0 4px 10px rgba(232, 0, 50, .30), 0 0 0 0 rgba(232, 0, 50, .45); }
    50%      { box-shadow: 0 4px 10px rgba(232, 0, 50, .30), 0 0 0 9px rgba(232, 0, 50, 0); }
}

.lesson-title {
    grid-column: 2; grid-row: 1; margin: 0; min-width: 0;
    font-size: 15px; font-weight: 800; line-height: 1.35;
    color: var(--text); overflow-wrap: anywhere;
}
/* The title is the card's quiet primary link; the button below is the loud
   one. Both go to the same place, so the title does not need to shout. */
.lesson-title-link { color: inherit; text-decoration: none; }
.lesson-title-link:hover, .lesson-title-link:focus-visible {
    color: var(--accent); text-decoration: underline; text-underline-offset: 3px;
}
.lesson-desc {
    grid-column: 1 / -1; margin: 0;
    font-size: 13px; line-height: 1.6;
    color: var(--text-muted); overflow-wrap: anywhere;
}

.lesson-meta { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 6px 10px; margin-top: 2px; }
.lesson-meta-what { margin-top: 4px; margin-bottom: -2px; }
.lesson-meta-item {
    display: inline-flex; align-items: center; gap: 5px;
    font-size: 12px; line-height: 1.4; padding: 4px 11px; border-radius: 999px;
    background: var(--surface-2); color: var(--text-muted);
    max-width: 100%; overflow-wrap: anywhere;
}
.lesson-meta-subject { background: var(--accent-soft); color: var(--accent-dark); font-weight: 800; }
/* The unit is a subdivision of the subject: same row, less weight, no fill. */
.lesson-meta-unit { background: transparent; border: 1px solid var(--border); font-weight: 600; }
.lesson-meta-level { background: var(--emerald-soft); color: var(--emerald); font-weight: 700; }
.lesson-meta-teacher { background: var(--olive-soft); color: var(--olive); font-weight: 700; }
/* The teacher's photo, sized to the chip it sits in. */
.lesson-meta-avatar {
    width: 20px; height: 20px; border-radius: 50%; flex: none;
    object-fit: cover; background: rgba(65, 107, 57, .15);
}

/* بيانات الأستاذ — outlined, not filled: it is secondary to the two actions at
   the foot of the card, and three filled pills on one card would compete. */
.lesson-teacher-btn {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 4px 13px; border-radius: 999px;
    border: 1px solid var(--olive); background: transparent;
    color: var(--olive); font: inherit; font-size: 12px; font-weight: 800;
    cursor: pointer; line-height: 1.5;
    transition: background .18s, color .18s;
}
.lesson-teacher-btn:hover, .lesson-teacher-btn:focus-visible { background: var(--olive-soft); outline: none; }

/* The action names what it OPENS. Two actions share the row evenly; one fills
   it. */
.lesson-actions { grid-column: 1 / -1; display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.lesson-act {
    flex: 1 1 0; min-width: 112px;
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    padding: 11px 14px; border-radius: var(--radius-sm);
    font-size: 13px; font-weight: 800; line-height: 1.1; color: #fff;
    background: var(--seal); text-decoration: none;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .18);
    transition: filter .18s ease;
}
.lesson-type-work .lesson-act-lesson { background: linear-gradient(135deg, #3A3330, var(--ink)); }
.lesson-type-html .lesson-act-lesson { background: linear-gradient(135deg, #0B8A36, var(--emerald)); }

/* THE EXAM BUTTON IS OUTLINED, and this is the one rule here that is about
   shape rather than colour. Filling it emerald worked on a crimson card and
   failed completely on an interactive one, where the lesson button is already
   emerald: two identical pills side by side, naming two different acts. No
   single fill can be distinct from all four card types, so the exam stops
   competing on colour altogether.
   It is also the right hierarchy — opening the lesson is what the card is for;
   sitting the test is the second thing you might do. */
.lesson-act-quiz {
    background: transparent; color: var(--emerald);
    border: 1.5px solid var(--emerald); box-shadow: none;
    flex: 0 1 auto;
}
.lesson-act-quiz:hover, .lesson-act-quiz:focus-visible { background: var(--emerald-soft); }
.lesson-card:hover .lesson-act { filter: brightness(1.08); }
/* The filter above brightens a FILL; on the outlined pill it only washes the
   text out, so it is taken back. */
.lesson-card:hover .lesson-act-quiz { filter: none; }

/* ── teacher popup ─────────────────────────────────────────── */
/* The card can outgrow a phone screen once a CV is in it. */
.teacher-card { max-width: 460px; max-height: calc(100vh - 8vh); overflow-y: auto; }
.teacher-top { display: flex; align-items: center; gap: 14px; margin-bottom: 16px; }
.teacher-avatar {
    width: 68px; height: 68px; border-radius: 50%; flex: none;
    display: grid; place-items: center; overflow: hidden;
    background: var(--olive-soft); font-size: 28px;
    box-shadow: 0 0 0 1px var(--border), 0 4px 12px rgba(43, 28, 20, .10);
}
.teacher-avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.teacher-name { margin: 0; font-size: 1.12rem; font-weight: 900; }
.teacher-subject { margin: 2px 0 0; color: var(--text-muted); font-size: .9rem; }
/* Label / value pairs in two columns. An empty row is never emitted, so the
   list is only as long as there is something to say. */
.teacher-rows {
    display: grid; grid-template-columns: auto 1fr; gap: 8px 14px;
    margin: 0; padding-top: 14px; border-top: 1px solid var(--border);
}
.teacher-rows dt { color: var(--text-muted); font-size: .88rem; font-weight: 600; }
.teacher-rows dd { margin: 0; font-weight: 700; overflow-wrap: anywhere; }
.teacher-rows a { color: var(--accent); }
/* Phone → two real actions rather than a number to copy out by hand. */
.teacher-contact { margin: 0 0 14px; }
.teacher-phone {
    font-weight: 900; font-size: 1.05rem; letter-spacing: .02em;
    direction: ltr; unicode-bidi: isolate; margin-bottom: 8px; color: var(--accent);
}
.teacher-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.teacher-actions .btn { padding: 8px 16px; font-size: .9rem; }
/* The CV, as a list. It is typed as prose in the panel and reads as a wall
   otherwise. */
.teacher-bio { margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--border); }
.teacher-bio[hidden] { display: none; }
.teacher-bio-title { font-weight: 800; margin-bottom: 8px; }
.teacher-bio ul { margin: 0; padding-inline-start: 20px; color: var(--text-muted); }
.teacher-bio li { margin: 4px 0; }

/* ------------------------------------------------------------------ responsive */
@media (max-width: 860px) {
    .page-layout { grid-template-columns: 1fr; }
    .nav-toggle {
        display: grid; gap: 5px; margin-inline-start: auto; padding: 9px;
        background: transparent; border: 0; cursor: pointer;
    }
    .nav-toggle span { display: block; width: 22px; height: 2px; background: var(--text); border-radius: 2px; }
    .site-nav {
        display: none; position: absolute; inset-inline: 0; top: 100%;
        flex-direction: column; gap: 2px; padding: 14px 18px;
        background: var(--surface); border-bottom: 1px solid var(--border);
        box-shadow: var(--shadow-lg);
    }
    body.nav-open .site-nav { display: flex; }
    .header-inner { position: relative; flex-wrap: wrap; }
    .brand-logo { width: 40px; height: 40px; }
}
@media (max-width: 560px) {
    .ll-head { align-items: stretch; }
    .ll-open { width: 100%; justify-content: center; }
    .brand-name { font-size: .98rem; }
    .footer-inner { justify-content: center; text-align: center; }
}

/* ------------------------------------------------------------------ motion
   Every lift and every pulse in this sheet, switched off in one place for
   anyone who has asked the system for less movement. */
@media (prefers-reduced-motion: reduce) {
    .brand:hover .brand-logo,
    .card:hover,
    .lesson-card:hover,
    .btn-primary:hover,
    .ll-open:hover,
    .ll-clear-big:hover { transform: none; }
    .lesson-type-live .lesson-badge { animation: none; }
}

/* ------------------------------------------------------------------ print
   The seal, the words, and nothing else: no chrome, no shadows, no tints. */
@media print {
    .site-header, .site-footer, .ll-open, .ll-chips, .ll-pager,
    .ll-modal, .lesson-actions, .nav-toggle { display: none !important; }
    body { background: #fff; color: #000; }
    .card, .box, .lesson-card, .form { box-shadow: none; border: 1px solid #ccc; }
    .lesson-card::after { display: none; }
}
