/* ================================================================
   Wiem Douma site: design system (refactor)
   Loaded by every page that has been migrated. Old pages still use
   css/styles.css until they are moved over.
   Rules: logical properties (RTL-safe), mobile-first, no gradients,
   tone steps instead of lines or shadows, 16px body, 44px touch targets.
   ================================================================ */

/* Cairo is served from this site (assets/fonts/, SIL Open Font License): one
   variable file per script covers every weight, and the browser only downloads
   the scripts a page uses. Each page head preloads the Arabic file. */
@font-face {
    font-family: 'Cairo';
    font-style: normal;
    font-weight: 200 1000;
    font-display: swap;
    src: url('../assets/fonts/cairo-arabic.woff2') format('woff2');
    unicode-range: U+0600-06FF, U+0750-077F, U+0870-0891, U+0897-08E1, U+08E3-08FF, U+200C-200E, U+2010-2011, U+204F, U+2E41, U+FB50-FDFF, U+FE70-FE74, U+FE76-FEFC, U+102E0-102FB, U+10E60-10E7E, U+10EC2-10EC7, U+10EC9-10EEE, U+10EF0-10EFF, U+1EE00-1EE03, U+1EE05-1EE1F, U+1EE21-1EE22, U+1EE24, U+1EE27, U+1EE29-1EE32, U+1EE34-1EE37, U+1EE39, U+1EE3B, U+1EE42, U+1EE47, U+1EE49, U+1EE4B, U+1EE4D-1EE4F, U+1EE51-1EE52, U+1EE54, U+1EE57, U+1EE59, U+1EE5B, U+1EE5D, U+1EE5F, U+1EE61-1EE62, U+1EE64, U+1EE67-1EE6A, U+1EE6C-1EE72, U+1EE74-1EE77, U+1EE79-1EE7C, U+1EE7E, U+1EE80-1EE89, U+1EE8B-1EE9B, U+1EEA1-1EEA3, U+1EEA5-1EEA9, U+1EEAB-1EEBB, U+1EEF0-1EEF1;
}
@font-face {
    font-family: 'Cairo';
    font-style: normal;
    font-weight: 200 1000;
    font-display: swap;
    src: url('../assets/fonts/cairo-latin.woff2') format('woff2');
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
    font-family: 'Cairo';
    font-style: normal;
    font-weight: 200 1000;
    font-display: swap;
    src: url('../assets/fonts/cairo-latin-ext.woff2') format('woff2');
    unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

:root {
    --c-primary: #9C6644;
    --c-primary-dark: #7B4B32;
    --c-primary-darker: #664027;
    --c-secondary: #D6C0B3;
    --c-almond: #EADDCF;
    --c-cream: #F2E9E1;
    --c-bg: #F9F5F0;
    --c-surface: #FFFFFF;
    --c-border: #E6DCD3;
    --c-input-border: #CDBFB3;
    --c-text: #4B3621;
    --c-text-soft: #6D584C;

    --c-mint-bg: #DDEBE3;
    --c-mint-text: #2F5D46;
    --c-rose-bg: #F3DDD9;
    --c-rose-text: #8A3B35;
    --c-whatsapp: #2F5D46;
    --c-whatsapp-dark: #244a37;

    --radius: 14px;
    --radius-sm: 8px;
    --shadow-sm: 0 1px 2px rgba(75, 54, 33, 0.06);
    --gutter: 16px;
    --max: 1240px;
    --focus: 2px solid #7B4B32;
}

@media (min-width: 640px) { :root { --gutter: 24px; } }

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

/* Author rules like .field { display: grid } beat the browser's [hidden] rule,
   so hiding is declared once here and every toggle below can use el.hidden. */
[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; }

body {
    margin: 0;
    background: var(--c-bg);
    color: var(--c-text);
    font-family: 'Cairo', system-ui, sans-serif;
    font-size: 1rem;
    line-height: 1.8;
    min-height: 100svh;
}

h1, h2, h3, h4 {
    line-height: 1.5;
    font-weight: 700;
    margin: 0 0 0.5em;
}
h1 { font-size: clamp(1.75rem, 6vw, 3rem); font-weight: 800; }
/* Six sizes in all: display (hero name), h2, a middle step, a lead step, body, small. */
h2 { font-size: clamp(1.8rem, 3.6vw, 3rem); line-height: 1.3; }
h3 { font-size: 1.25rem; }

p { margin: 0 0 1em; }
a { color: var(--c-primary-dark); }
img { max-width: 100%; height: auto; display: block; }
/* <picture> only offers the AVIF copy of a photo; layout rules keep targeting the <img>. */
picture { display: contents; }

:focus-visible { outline: var(--focus); outline-offset: 2px; }

.skip-link {
    position: absolute;
    inset-inline-start: var(--gutter);
    top: -100px;
    background: var(--c-primary-dark);
    color: #fff;
    padding: 10px 16px;
    border-radius: var(--radius-sm);
    z-index: 100;
}
.skip-link:focus { top: 8px; }

.container {
    width: 100%;
    max-width: var(--max);
    margin-inline: auto;
    padding-inline: var(--gutter);
}
.container--narrow { max-width: 640px; }

.section { padding-block: 48px; }
.section--band { background: var(--c-cream); }
.section--almond { background: var(--c-almond); }
@media (min-width: 900px) { .section { padding-block: 72px; } }

.stack > * + * { margin-block-start: 16px; }

/* ---------- Header ---------- */
.site-header {
    background: var(--c-surface);
}
.site-header__inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    min-height: 64px;
}
.brand {
    color: var(--c-primary-dark);
    font-weight: 800;
    font-size: 1.25rem;
    text-decoration: none;
}
.nav-toggle {
    width: 44px; height: 44px;
    border: 0;
    background: var(--c-cream);
    border-radius: var(--radius-sm);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--c-text);
}
.nav {
    display: none;
    flex-direction: column;
    gap: 4px;
    padding-block: 12px 16px;
}
.nav.is-open { display: flex; }
.nav a {
    display: flex;
    align-items: center;
    min-height: 44px;
    padding-inline: 12px;
    border-radius: var(--radius-sm);
    color: var(--c-text);
    text-decoration: none;
    font-weight: 600;
}
.nav a[aria-current="page"], .nav a:hover { background: var(--c-cream); color: var(--c-primary-dark); }
.nav .nav__account { margin-block-start: 8px; color: var(--c-text-soft); }
.nav .nav__name { font-weight: 700; color: var(--c-primary-dark); }
.nav .nav__name, .nav .nav__logout {
    display: flex;
    align-items: center;
    min-height: 44px;
    padding-inline: 12px;
}
.nav .nav__logout {
    border: 0;
    border-radius: var(--radius-sm);
    background: none;
    color: var(--c-text-soft);
    font: inherit;
    font-weight: 600;
    text-align: start;
    cursor: pointer;
}
.nav .nav__logout:hover { background: var(--c-cream); color: var(--c-primary-dark); }
.nav .nav__logout[disabled] { opacity: .6; cursor: default; }
/* Keeps the account links direct flex children of the nav while letting
   the login check swap them in place. */
.nav__account-slot { display: contents; }
.nav .nav__cta { background: var(--c-primary-dark); color: #fff; justify-content: center; margin-block-start: 8px; }
.nav .nav__cta:hover, .nav .nav__cta[aria-current="page"] { background: var(--c-primary-darker); color: #fff; }

.social {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-block-start: 12px;
}
.social a {
    width: 44px; height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    color: var(--c-primary-dark);
    background: var(--c-cream);
    transition: transform .2s ease, background-color .2s ease;
}
.social a:hover { background: var(--c-secondary); transform: translateY(-2px); }
.social svg { width: 20px; height: 20px; fill: currentColor; }

@media (min-width: 900px) {
    .nav-toggle { display: none; }
    .nav {
        display: flex;
        flex-direction: row;
        align-items: center;
        gap: 4px;
        padding: 0;
    }
    .nav a { min-height: 40px; }
    .nav .nav__name, .nav .nav__logout { min-height: 40px; }
    .nav .nav__account { margin: 0; }
    .nav .nav__cta { margin: 0; margin-inline-start: 8px; }
    .site-header__inner { flex-wrap: wrap; }
}

/* ---------- Hero: the name is the headline, the arched photo fills the other half ---------- */
.hero {
    display: grid;
    gap: 32px;
    padding-block: 32px 56px;
}
.hero__text { display: flex; flex-direction: column; gap: 20px; align-items: flex-start; }
.hero__text h1 {
    font-size: clamp(2.6rem, 7.4vw, 6.4rem);
    line-height: 1.15;
    letter-spacing: -0.01em;
    margin: 0;
}
.hero__text .lede { font-size: 1.25rem; color: var(--c-text); max-width: 34ch; margin: 0; }
.hero__actions { display: flex; flex-wrap: wrap; gap: 12px; }
.hero__media { overflow: hidden; border-radius: 999px 999px var(--radius) var(--radius); }   /* the arch: the site's signature shape */
.hero__media img { aspect-ratio: 4 / 5; object-fit: cover; width: 100%; height: 100%; }
@media (min-width: 900px) {
    .hero {
        grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
        gap: 64px;
        align-items: center;
        min-height: calc(100svh - 64px);
        padding-block: 40px;
    }
    .hero__media { height: min(80svh, 780px); }
}

/* ---------- Buttons ---------- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 48px;
    padding: 10px 22px;
    border-radius: var(--radius-sm);
    border: 1px solid transparent;
    font: inherit;
    font-weight: 700;
    text-decoration: none;
    cursor: pointer;
    background: var(--c-primary-dark);
    color: #fff;
}
.btn { transition: transform .2s ease, background-color .2s ease; }
.btn:hover { background: var(--c-primary-darker); color: #fff; transform: translateY(-2px); }
.btn:active { transform: translateY(0) scale(.98); }
.btn--ghost { background: transparent; color: var(--c-primary-dark); border-color: var(--c-primary-dark); }
.btn--ghost:hover { background: var(--c-cream); color: var(--c-primary-dark); }
.btn--wide { width: 100%; }
.btn[disabled] { opacity: 0.6; cursor: wait; }
.btn--whatsapp { background: var(--c-whatsapp); }
.btn--whatsapp:hover { background: var(--c-whatsapp-dark); }

/* ---------- Cards ---------- */
.grid { display: grid; gap: 20px; }
.grid--1 { grid-template-columns: 1fr; }
.grid--spaced { margin-block-start: 24px; }
@media (min-width: 720px) { .grid--2 { grid-template-columns: repeat(2, 1fr); } }
.grid--courses { grid-template-columns: repeat(auto-fill, minmax(min(100%, 280px), 1fr)); }

.card {
    background: var(--c-surface);
    border-radius: var(--radius);
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.card__image { aspect-ratio: 4 / 3; object-fit: cover; border-radius: var(--radius-sm); width: 100%; }
.card--start { align-self: start; }

.video { position: relative; aspect-ratio: 16 / 9; border-radius: var(--radius-sm); overflow: hidden; background: #000; }
.video iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }

/* Instagram reels on the home page: 9:16 thumbnails that open the reel on Instagram. */
.reels { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.reels[hidden] { display: none; }
.reels a { position: relative; display: block; aspect-ratio: 9 / 16; border-radius: var(--radius-sm); overflow: hidden; background: var(--c-cream); }
.reels img { width: 100%; height: 100%; object-fit: cover; }
.reels a[data-video]::after {
    content: ""; position: absolute; inset-block-start: 8px; inset-inline-end: 8px;
    border-style: solid; border-width: 7px 0 7px 12px; border-color: transparent transparent transparent #fff;
}
.card__meta { color: var(--c-text-soft); font-size: 0.95rem; display: flex; gap: 12px; flex-wrap: wrap; }
.card__footer { margin-block-start: auto; display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }

/* ---------- Course rows (home and courses page): picture beside the text, no box ---------- */
.course-list { display: grid; gap: 56px; }
.course-row { display: grid; gap: 20px; align-items: center; }
.course-row__media { display: block; overflow: hidden; border-radius: var(--radius); background: var(--c-almond); }
/* Every course picture gets the same 16:9 frame, the shape of the course banners, so the
   rows line up and a banner shows whole. A picture of another shape is cropped to fit. */
.course-row__media img { aspect-ratio: 16 / 9; object-fit: cover; width: 100%; transition: transform .6s ease; }
.course-row:hover .course-row__media img { transform: scale(1.04); }
.course-row__text { display: flex; flex-direction: column; align-items: flex-start; gap: 12px; }
.course-row__text h3 { font-size: 1.625rem; line-height: 1.45; margin: 0; }
.course-row__meta { font-weight: 700; color: var(--c-primary-dark); margin: 0; }
.course-row__text p { max-width: 52ch; margin: 0; }
@media (min-width: 820px) {
    .course-row { grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); gap: 48px; }
}

/* ---------- Section heading row: heading on one side, a link on the other ---------- */
.section-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 8px 24px; margin-block-end: 32px; }
.section-head h1 { margin: 0; }
.section-head h2 { margin: 0; }

/* ---------- Wiem on the home page: portrait and credentials ---------- */
.intro { display: grid; gap: 32px; align-items: center; }
.intro__media img { aspect-ratio: 4 / 5; object-fit: cover; width: 100%; border-radius: var(--radius); }
.intro__text { display: flex; flex-direction: column; align-items: flex-start; gap: 16px; }
.intro__text h2 { margin: 0; }
.intro__text .statement { font-size: 1.25rem; line-height: 1.6; max-width: 32ch; margin: 0; }
.facts { list-style: none; padding: 0; margin: 0; display: grid; gap: 4px 32px; }
.facts li { padding-block: 6px; font-weight: 600; }
@media (min-width: 720px) { .facts { grid-template-columns: 1fr 1fr; } }
@media (min-width: 900px) {
    .intro { grid-template-columns: minmax(0, 0.8fr) minmax(0, 1fr); gap: 64px; }
    .intro__text .statement { font-size: 1.625rem; }
}

/* ---------- Podcast: one main player, the episodes as a list that switches it ---------- */
.pod { display: grid; gap: 24px; }
.pod__main h3 { margin: 16px 0 0; font-size: 1.625rem; }
.pod__main p { margin: 0; color: var(--c-text-soft); }
.pod__list { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; align-content: start; }
.pod__item {
    display: grid; grid-template-columns: 132px 1fr; gap: 14px; align-items: center;
    width: 100%; padding: 10px; border: 0; border-radius: var(--radius-sm);
    background: transparent; color: inherit; font: inherit; text-align: start; cursor: pointer;
    transition: background-color .2s ease;
}
.pod__item img { aspect-ratio: 16 / 9; object-fit: cover; width: 100%; border-radius: 6px; }
.pod__item strong { display: block; line-height: 1.5; }
.pod__item span { font-size: 0.9rem; color: var(--c-text-soft); }
.pod__item:hover, .pod__item[aria-current="true"] { background: var(--c-surface); }
@media (min-width: 900px) { .pod { grid-template-columns: minmax(0, 1.7fr) minmax(0, 1fr); gap: 40px; } }

/* ---------- Instagram band ---------- */
.ig { display: grid; gap: 24px; }
.ig__text { display: flex; flex-direction: column; align-items: flex-start; gap: 12px; }
.ig__text h2 { margin: 0; }
.ig__text p { margin: 0; }
@media (min-width: 900px) {
    .ig { grid-template-columns: minmax(0, 1fr) minmax(0, 2fr); align-items: center; gap: 48px; }
    .reels { grid-template-columns: repeat(6, 1fr); }
    .ig:has(> .reels[hidden]) { grid-template-columns: 1fr; }   /* no reels yet: the text takes the row */
}

/* ---------- Plain points (About: method), no boxes ---------- */
.points { display: grid; gap: 28px 40px; margin-block-start: 32px; }
.points h3 { font-size: 1.25rem; margin: 0 0 6px; color: var(--c-primary-dark); }
.points p { margin: 0; }
@media (min-width: 720px) { .points { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1080px) { .points { grid-template-columns: repeat(4, 1fr); } }

/* ---------- Closing band: words on one side, actions on the other ---------- */
.close { display: grid; gap: 24px; align-items: center; }
.close h2 { margin: 0 0 8px; }
.close p { margin: 0; max-width: 52ch; }
.close__actions { display: flex; flex-wrap: wrap; gap: 12px; }
@media (min-width: 900px) { .close { grid-template-columns: 1.4fr 1fr; } .close__actions { justify-content: flex-end; } }

.measure { max-width: 64ch; }

/* ---------- Photos with captions ---------- */
.photo { margin: 0; }
.photo img { width: 100%; object-fit: cover; border-radius: var(--radius); }
.photo figcaption { font-size: 0.9rem; color: var(--c-text-soft); margin-block-start: 10px; }

/* Three photos side by side (About: workshops and talks) */
.gallery { display: grid; gap: 20px; margin-block-start: 32px; }
.gallery img { aspect-ratio: 4 / 5; }
@media (min-width: 720px) { .gallery { grid-template-columns: repeat(3, 1fr); } }

/* Page heading beside a photo (media, events, booking) */
.page-head { display: grid; gap: 32px; align-items: center; }
.page-head h1 { margin: 0 0 12px; }
.page-head .photo img { aspect-ratio: 3 / 4; max-height: 85svh; }
@media (min-width: 900px) { .page-head { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 64px; } }

/* Booking: the photo beside the form, the form keeps a comfortable width */
.booking { display: grid; gap: 32px; align-items: start; }
.booking__form { max-width: 640px; }
.booking__photo img { aspect-ratio: 4 / 5; }
@media (max-width: 899px) { .booking__photo { display: none; } }   /* on phones the form comes first and alone */
@media (min-width: 900px) { .booking { grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.2fr); gap: 64px; } .booking__photo { position: sticky; top: 24px; } }

/* ---------- Testimonials: quotes set as text, no boxes ---------- */
.quotes { columns: 1; column-gap: 48px; }
@media (min-width: 720px) { .quotes { columns: 2; } }
@media (min-width: 1080px) { .quotes { columns: 3; } }
.quote { break-inside: avoid; margin: 0 0 40px; }
.quote p { font-size: 1.25rem; line-height: 1.7; margin: 0 0 8px; }
.quote cite { font-style: normal; font-size: 0.9rem; color: var(--c-text-soft); }

/* Photo beside a column of quotes (home, courses, course page) */
.proof { display: grid; gap: 32px; align-items: start; }
.proof .photo img { aspect-ratio: 16 / 10; }
.proof__quotes .quote:first-child p { line-height: 1.6; }
@media (min-width: 900px) {
    .proof { grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); gap: 56px; }
    .proof__quotes .quote:first-child p { font-size: 1.625rem; }
}

.chip {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 0.875rem;
    font-weight: 700;
    background: var(--c-cream);
    color: var(--c-primary-dark);
}
.chip--ok { background: var(--c-mint-bg); color: var(--c-mint-text); }
.chip--warn { background: var(--c-almond); color: var(--c-text); }
.chip--bad { background: var(--c-rose-bg); color: var(--c-rose-text); }

/* ---------- Steps: the enrollment path made visible (pending page) ---------- */
.steps { list-style: none; padding: 0; margin: 0; }
.steps li {
    position: relative;
    display: grid;
    grid-template-columns: 32px 1fr;
    gap: 12px;
    align-items: start;
    padding-block: 8px 20px;
}
.steps li:not(:last-child)::before {
    content: "";
    position: absolute;
    inset-block-start: 44px;
    inset-inline-start: 15px;
    inline-size: 2px;
    block-size: calc(100% - 40px);
    background: var(--c-border);
}
.steps .dot {
    inline-size: 32px; block-size: 32px;
    border-radius: 50%;
    display: grid; place-items: center;
    background: var(--c-cream);
    color: var(--c-text-soft);
    font-size: 0.9rem; font-weight: 700;
}
.steps li strong { display: block; }
.steps li p { margin: 0; color: var(--c-text-soft); font-size: 0.95rem; }
.steps li[data-state="done"] .dot { background: var(--c-mint-bg); color: var(--c-mint-text); }
.steps li[data-state="current"] .dot { background: var(--c-primary-dark); color: #fff; }
.steps li[data-state="current"] strong { color: var(--c-primary-dark); }

/* ---------- Alerts (text + icon, not color alone) ---------- */
.alert {
    border-radius: var(--radius-sm);
    padding: 12px 16px;
    margin-block: 12px;
}
.alert--ok { background: var(--c-mint-bg); color: var(--c-mint-text); }
.alert--error { background: var(--c-rose-bg); color: var(--c-rose-text); }
.alert[hidden] { display: none; }

/* ---------- Forms ---------- */
.form { display: grid; gap: 16px; }
.field { display: grid; gap: 6px; }
.field label { font-weight: 600; }
.field input, .field select, .field textarea {
    font: inherit;
    font-size: 16px;               /* 16px stops iOS zoom on focus */
    min-height: 48px;
    padding: 10px 14px;
    border: 1px solid var(--c-input-border);
    border-radius: var(--radius-sm);
    background: var(--c-surface);
    color: var(--c-text);
    width: 100%;
}
.field textarea { min-height: 120px; }
.field .hint { font-size: 0.9rem; color: var(--c-text-soft); }
.field [aria-invalid="true"] { border-color: var(--c-rose-text); }
.error-text { color: var(--c-rose-text); font-size: 0.9rem; }

.privacy-note { font-size: 0.9rem; color: var(--c-text-soft); }
.section__note { color: var(--c-text-soft); margin-block-start: 16px; }

/* ---------- Mobile action bar: booking is the goal on every page ---------- */
.mobile-bar {
    position: fixed;
    inset-inline: 0;
    inset-block-end: 0;
    z-index: 50;
    display: flex;
    gap: 8px;
    padding: 8px var(--gutter) calc(8px + env(safe-area-inset-bottom));
    background: var(--c-surface);
    border-block-start: 1px solid var(--c-border);
}
.mobile-bar .btn { flex: 1; min-height: 44px; }
@media (min-width: 900px) { .mobile-bar { display: none; } }
@media print { .mobile-bar { display: none; } }
body.has-mobile-bar { padding-block-end: 72px; }

/* ---------- Lesson layout ---------- */
.learn { display: grid; gap: 24px; min-height: 100dvh; padding-block: 24px 48px; }
@media (min-width: 900px) { .learn { grid-template-columns: 1fr 320px; } }
.learn__aside { order: 2; }
@media (min-width: 900px) { .learn__aside { order: 0; } }
.learn__main .video { position: relative; aspect-ratio: 16 / 9; border-radius: var(--radius); overflow: hidden; background: #000; }
.learn__main .video iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }

.lesson-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 6px; }
.lesson-list a, .lesson-list span {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 44px;
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    text-decoration: none;
    color: var(--c-text);
}
.lesson-list a:hover { background: var(--c-cream); }
.lesson-list [aria-current="step"] { background: var(--c-almond); font-weight: 700; }
.lesson-list .is-locked { color: var(--c-text-soft); }

/* Native <progress>, fully restyled. The two fill rules cannot share a selector
   list: a browser drops the whole rule when it meets the other engine's pseudo-element. */
.progress {
    appearance: none;
    display: block;
    inline-size: 100%;
    block-size: 10px;
    border: 0 solid;
    border-radius: 999px;
    overflow: clip;
    background: var(--c-almond);
}
.progress::-webkit-progress-bar { background: transparent; }
.progress::-webkit-progress-value { background: var(--c-primary); border-radius: 999px; transition: inline-size .3s; }
.progress::-moz-progress-bar { background: var(--c-primary); border-radius: 999px; }

fieldset.quiz { border: 1px solid var(--c-border); border-radius: var(--radius); padding: 16px; background: var(--c-surface); }
fieldset.quiz legend { font-weight: 700; padding-inline: 6px; }
.quiz-option {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 48px;
    padding: 10px 12px;
    border: 1px solid var(--c-border);
    border-radius: var(--radius-sm);
    margin-block: 8px;
    cursor: pointer;
}
.quiz-option:has(input:checked) { border-color: var(--c-primary-dark); background: var(--c-cream); }

/* ---------- Admin table (stacks on mobile) ---------- */
.table-wrap { overflow-x: auto; }
.admin-table { width: 100%; border-collapse: collapse; background: var(--c-surface); }
.admin-table th, .admin-table td { text-align: start; padding: 10px 12px; border-block-end: 1px solid var(--c-border); vertical-align: top; }
.admin-table th { font-size: 0.9rem; color: var(--c-text-soft); }
.admin-table tr.row--new td { background: var(--c-cream); }
@media (max-width: 719px) {
    .admin-table thead { display: none; }
    .admin-table tr { display: block; border: 1px solid var(--c-border); border-radius: var(--radius-sm); margin-block-end: 12px; background: var(--c-surface); }
    .admin-table td { display: grid; grid-template-columns: 1fr 2fr; gap: 8px; border: 0; }
    .admin-table td::before { content: attr(data-label); color: var(--c-text-soft); font-weight: 600; }
}
.toolbar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.toolbar .btn { min-height: 40px; }
.btn--sm { min-height: 38px; padding: 6px 14px; font-size: 0.95rem; }

/* ---------- Course builder (admin): units, lesson rows, lesson drawer ---------- */
.stats { display: flex; flex-wrap: wrap; gap: 8px; }
.stat {
    display: inline-flex; align-items: baseline; gap: 6px;
    background: var(--c-surface); border-radius: var(--radius-sm);
    padding: 6px 14px;
}
.stat b { font-size: 1.25rem; font-weight: 800; color: var(--c-primary-dark); }
.stat span { font-size: 0.9rem; color: var(--c-text-soft); }

/* Monthly counts in the admin statistics tab, drawn without a chart library. */
.bars { display: grid; gap: 14px; margin-block: 12px 24px; }
.bar-row { display: grid; grid-template-columns: 76px 1fr; gap: 10px; align-items: center; }
.bar-row__label { font-size: 0.9rem; color: var(--c-text-soft); }
.bar-stack { display: grid; gap: 4px; }
.bar-line { display: grid; grid-template-columns: 1fr 90px; gap: 8px; align-items: center; }
.bar-track { display: block; block-size: 10px; border-radius: 999px; background: var(--c-cream); overflow: hidden; }
.bar-fill { display: block; block-size: 100%; background: var(--c-primary); }
.bar-fill--alt { background: var(--c-primary-dark); }
.bar-num { font-size: 0.85rem; color: var(--c-text-soft); }

.ico { inline-size: 20px; block-size: 20px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }

.iconbtn {
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    min-inline-size: 40px; min-block-size: 40px; padding: 6px;
    border: 1px solid transparent; border-radius: var(--radius-sm);
    background: transparent; color: var(--c-primary-dark);
    font: inherit; text-decoration: none; cursor: pointer;
    transition: background-color .2s ease, border-color .2s ease;
}
.iconbtn:hover { background: var(--c-cream); border-color: var(--c-border); }
.iconbtn[disabled] { color: var(--c-text-soft); opacity: .4; cursor: default; }
.iconbtn[disabled]:hover { background: transparent; border-color: transparent; }

.lms-empty {
    display: grid; gap: 10px; justify-items: center; text-align: center;
    background: var(--c-cream); border-radius: var(--radius); padding: 32px 20px;
    color: var(--c-text-soft);
}
.lms-empty .ico { inline-size: 32px; block-size: 32px; }

.lms-mod {
    background: var(--c-surface); border-radius: var(--radius);
    padding: 14px 16px; display: flex; flex-direction: column; gap: 10px;
}
.lms-mod__head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.lms-mod__num { background: var(--c-cream); }
.lms-mod__num[aria-expanded="false"] .ico { transform: rotate(-90deg); }
.lms-mod__idx {
    inline-size: 26px; block-size: 26px; border-radius: 50%;
    display: grid; place-items: center; flex: none;
    background: var(--c-almond); color: var(--c-text); font-size: .85rem; font-weight: 800;
}
.lms-mod__title {
    flex: 1 1 220px; min-inline-size: 0;
    font: inherit; font-weight: 700; font-size: 1.05rem; color: var(--c-text);
    background: transparent; border: 1px solid transparent; border-radius: var(--radius-sm);
    padding: 8px 10px;
}
.lms-mod__title:hover { border-color: var(--c-border); }
.lms-mod__title:focus-visible { background: var(--c-surface); border-color: var(--c-input-border); }

.lms-lessons { list-style: none; padding: 0; margin: 0; display: grid; gap: 6px; }
.lms-lesson {
    display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
    background: var(--c-bg); border-radius: var(--radius-sm); padding: 6px 10px;
}
.lms-lesson__type { color: var(--c-primary-dark); display: inline-flex; }
.lms-lesson__name { flex: 1 1 200px; display: flex; align-items: center; gap: 8px; min-width: 0; flex-wrap: wrap; }
.lms-lesson__title { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-inline-size: 34ch; }
.lms-actions { display: flex; gap: 2px; flex-wrap: wrap; margin-inline-start: auto; }
.lms-lessons__add { list-style: none; }

.hint { font-size: .9rem; color: var(--c-text-soft); }

/* ---------- Dialogs ----------
   Both are native <dialog> opened with showModal(): the browser keeps focus inside,
   closes on Esc, hands focus back to the button that opened it, and makes the page
   behind inert. These two rules stop a scroll gesture leaking to that page. */
dialog:modal { overscroll-behavior: contain; }
dialog::backdrop { background: rgba(75, 54, 33, .35); overflow: hidden; overscroll-behavior: contain; }

/* Lesson drawer: a slide-over so the unit list stays where it was */
.drawer {
    position: fixed; inset-block: 0; inset-inline: auto 0; margin: 0;
    inline-size: min(640px, 100%); max-inline-size: none;
    block-size: 100dvh; max-block-size: none; overflow-y: auto;
    background: var(--c-bg); color: var(--c-text);
    border: 0; border-inline-start: 1px solid var(--c-border);
    padding: 20px var(--gutter) 40px;
}
/* Slides in from its own edge. Where @starting-style or allow-discrete are
   missing it simply opens and closes at once. */
@media (prefers-reduced-motion: no-preference) {
    .drawer {
        transform: translateX(-100%);
        transition: transform .28s cubic-bezier(.2, .7, .2, 1), display .28s allow-discrete, overlay .28s allow-discrete;
    }
    html[dir="ltr"] .drawer { transform: translateX(100%); }
    .drawer[open] { transform: none; }
    @starting-style {
        .drawer[open] { transform: translateX(-100%); }
        html[dir="ltr"] .drawer[open] { transform: translateX(100%); }
    }
}
.drawer__head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-block-end: 16px; }
.drawer__foot { display: flex; gap: 8px; flex-wrap: wrap; margin-block-start: 20px; padding-block-start: 16px; border-block-start: 1px solid var(--c-border); }

/* Small question box: confirm a delete, or name a new unit (js/site.js askConfirm / askText) */
.ask {
    inline-size: min(440px, calc(100% - 2 * var(--gutter)));
    border: 0; border-radius: var(--radius); padding: 24px;
    background: var(--c-surface); color: var(--c-text);
}
.ask h2 { font-size: 1.25rem; line-height: 1.6; margin: 0 0 16px; }
.ask .field { margin-block-end: 16px; }
.ask__actions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; }
.btn--danger { background: var(--c-rose-text); }
.btn--danger:hover { background: #6f2e29; }

/* Type picker: one segmented row of radios, visually hidden but keyboard reachable */
.seg { border: 0; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.seg legend { font-weight: 600; padding: 0; margin-block-end: 6px; }
.seg label {
    display: inline-flex; align-items: center; gap: 8px;
    min-height: 44px; padding: 8px 18px; cursor: pointer; font-weight: 600;
    border: 1px solid var(--c-input-border); border-radius: 999px; background: var(--c-surface);
    transition: background-color .2s ease, color .2s ease;
}
.seg input { position: absolute; inline-size: 1px; block-size: 1px; opacity: 0; }
.seg label:has(input:checked) { background: var(--c-primary-dark); color: #fff; border-color: var(--c-primary-dark); }
.seg label:has(input:focus-visible) { outline: var(--focus); outline-offset: 2px; }

/* Attachments */
.files-block { background: var(--c-surface); border-radius: var(--radius); padding: 16px; display: grid; gap: 10px; }
.files-block h3 { margin: 0; font-size: 1.05rem; }
.file-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; background: var(--c-bg); border-radius: var(--radius-sm); padding: 6px 10px; color: var(--c-primary-dark); }
.file-row__title {
    flex: 1 1 180px; min-inline-size: 0; font: inherit; color: var(--c-text);
    background: transparent; border: 1px solid transparent; border-radius: var(--radius-sm); padding: 6px 8px;
}
.file-row__title:hover { border-color: var(--c-border); }
.file-row__title:focus-visible { background: var(--c-surface); border-color: var(--c-input-border); }

/* Quiz blocks: a card per question, the correct answer picked with a radio */
.qblock { background: var(--c-surface); border-radius: var(--radius-sm); padding: 12px; display: grid; gap: 8px; }
.qblock__top { display: flex; gap: 8px; align-items: center; }
.qblock__opts { display: grid; gap: 6px; }
.qopt { display: flex; gap: 8px; align-items: center; }
.qopt input[type="radio"] { inline-size: 24px; block-size: 24px; flex: none; accent-color: var(--c-primary-dark); }
.qblock input[type="text"], .qopt input[type="text"] {
    flex: 1; min-inline-size: 0; font: inherit; font-size: 16px; min-height: 44px; padding: 8px 12px;
    border: 1px solid var(--c-input-border); border-radius: var(--radius-sm); background: var(--c-surface); color: var(--c-text);
}

/* ---------- Files and exercises on the lesson page ---------- */
.files { display: grid; gap: 8px; }
.file-link {
    display: flex; align-items: center; gap: 10px; min-height: 52px;
    padding: 8px 14px; background: var(--c-surface); border-radius: var(--radius-sm);
    color: var(--c-text); text-decoration: none;
}
.file-link:hover { background: var(--c-cream); color: var(--c-primary-dark); }
.file-link__name { flex: 1; font-weight: 600; }
.file-link__size { font-size: .85rem; color: var(--c-text-soft); }
.lesson-type-ico { color: var(--c-primary-dark); display: inline-flex; }

/* ---------- Course banner, pictures in lessons ---------- */
.course-banner { display: block; inline-size: 100%; aspect-ratio: 21 / 9; object-fit: cover; border-radius: var(--radius); background: var(--c-almond); }
.lesson-figure { margin: 0; }
.lesson-figure img, .learn__main .card img { display: block; max-inline-size: 100%; block-size: auto; border-radius: var(--radius-sm); margin-inline: auto; }
.learn__main .card figure { margin: 16px 0; }
.lesson-image-preview { display: block; max-inline-size: 100%; max-block-size: 240px; border-radius: var(--radius-sm); }

/* ---------- Lesson list grouped by unit ---------- */
.unit-list { display: grid; gap: 16px; }
.unit__title { font-size: 1rem; margin: 0 0 6px; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.unit__title small { font-weight: 400; color: var(--c-text-soft); margin-inline-start: auto; }
/* The closing step sits under the last unit, set apart by a rule. */
.unit--closing { padding-block-start: 16px; border-block-start: 1px solid var(--c-border); }
.unit__check {
    display: inline-grid; place-items: center; inline-size: 22px; block-size: 22px; flex: none;
    border-radius: 50%; background: var(--c-mint-bg); color: var(--c-mint-text); font-size: .85rem;
}
.visually-hidden { position: absolute; inline-size: 1px; block-size: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

/* ---------- Stars, encouragement and the end of the course ---------- */
/* A radio group: the inputs are hidden, their labels are the stars. An empty star is an
   outline and a chosen one is filled, so the rating does not depend on colour alone. */
.stars { display: inline-flex; gap: 2px; position: relative; border: 0; padding: 0; margin: 0; min-inline-size: 0; }
.star {
    display: inline-grid; place-items: center;
    inline-size: 44px; block-size: 44px; padding: 0; border: 0; background: transparent; cursor: pointer;
    font-size: 2rem; line-height: 1; color: var(--c-input-border); border-radius: var(--radius-sm);
    transition: color .15s ease, transform .15s ease;
}
.star::before { content: '☆'; content: '☆' / ''; }
.star.is-on { color: #C8862B; }
.star.is-on::before { content: '★'; content: '★' / ''; }
.star:hover { transform: scale(1.12); }
.stars input:focus-visible + .star { outline: var(--focus); outline-offset: 2px; }
.form-error { margin: 0; }
.finish [aria-invalid="true"] { border-color: var(--c-rose-text); }
.upload-progress { inline-size: 160px; max-inline-size: 100%; accent-color: var(--c-primary); }
.stars-label { font-weight: 600; margin-block-end: 0; }
.stars-note { min-block-size: 1.4em; margin: 0; }
.cheer {
    background: var(--c-mint-bg); color: var(--c-mint-text); font-weight: 600;
    border-radius: var(--radius); padding: 14px 18px; margin: 0;
}
.unit-done { background: var(--c-cream); }
.unit-done h2, .finish h2 { font-size: 1.35rem; margin: 0; }
.finish { border: 2px solid var(--c-secondary); }
.finish h3 { font-size: 1.1rem; margin: 0; }
.finish #cert-box { padding-block-start: 16px; border-block-start: 1px solid var(--c-border); }

/* ---------- Footer: her name as the close, then the small print ---------- */
.site-footer {
    background: var(--c-almond);
    padding-block: 64px 24px;
}
.site-footer__close { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 24px; margin-block-end: 48px; }
.site-footer__name { font-size: clamp(2.6rem, 7.4vw, 6.4rem); font-weight: 800; line-height: 1.2; color: var(--c-primary-dark); margin: 0; }
.site-footer__close p { margin: 8px 0 0; max-width: 46ch; }
.site-footer__grid { display: grid; gap: 24px; }
@media (min-width: 720px) { .site-footer__grid { grid-template-columns: 2fr 1fr 1fr; } }
.site-footer h3 { font-size: 1rem; margin-block-end: 8px; }
.site-footer__grid p { margin: 0 0 6px; }
.site-footer .social { margin-block-start: 0; }
.site-footer a:not(.btn) { color: var(--c-text); }
.site-footer__copy { font-size: 0.9rem; color: var(--c-text-soft); margin-block-start: 32px; }

/* ---------- Motion ----------
   The parts of each section rise in one after another as it enters (js/site.js adds .rise
   and .is-in). Only parts below the first screen get .rise: what is visible on arrival is
   never hidden, so the page does not flash and its main content paints at once. */
.js .rise { opacity: 0; transform: translateY(24px); transition: opacity .7s ease, transform .7s cubic-bezier(.2, .7, .2, 1); transition-delay: var(--d, 0ms); }
.js .rise.is-in { opacity: 1; transform: none; }
/* Content must never stay hidden: print and saved snapshots show everything. */
@media print {
    .js .rise { opacity: 1 !important; transform: none !important; }
    .hero__media img { animation: none; }
}
/* The hero photo is the largest thing on the page: it only eases in scale and is
   never hidden, so it counts as painted the moment it arrives. */
.hero__media img { animation: settle 1.8s cubic-bezier(.2, .7, .2, 1) both; }
@keyframes settle { from { transform: scale(1.08); } to { transform: none; } }

@media (prefers-reduced-motion: reduce) {
    * { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
    .js .rise { opacity: 1; transform: none; }
}
