/* =====================================================================================================================
   Components — one block per component, BEM-like names (.block, .block__part, .block--variant).
   Every component is listed with its HTML in DESIGN.md § Components and rendered in index.html.
   ===================================================================================================================== */

/* Button ------------------------------------------------------------------------------------------------------------ */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    min-height: 2.75rem;
    padding: var(--space-2) var(--space-6);
    border: 1px solid transparent;
    border-radius: var(--radius);
    font: inherit;
    font-weight: var(--weight-medium);
    line-height: 1.2;
    white-space: nowrap;
    text-decoration: none;
    cursor: pointer;
    transition: background var(--duration) var(--ease), border-color var(--duration) var(--ease),
        transform var(--duration) var(--ease);
}

.btn svg {
    flex: none;
    width: 1.125rem;
    height: 1.125rem;
}

.btn:active {
    transform: translateY(1px);
}

.btn--primary {
    background: var(--accent);
    color: var(--accent-text);
}

.btn--primary:hover {
    background: var(--accent-hover);
    color: var(--accent-text);
}

.btn--secondary {
    background: var(--surface);
    border-color: var(--border);
    color: var(--text);
}

.btn--secondary:hover {
    background: var(--surface-hover);
    color: var(--text);
}

.btn--ghost {
    background: transparent;
    color: var(--accent);
}

.btn--ghost:hover {
    background: var(--accent-soft);
}

.btn--sm {
    min-height: 2.25rem;
    padding: var(--space-1) var(--space-4);
    font-size: var(--text-sm);
}

/* Badge ------------------------------------------------------------------------------------------------------------- */

.badge {
    display: inline-flex;
    align-items: center;
    gap: var(--space-1);
    padding: 0.15em 0.7em;
    border-radius: var(--radius-full);
    background: var(--accent-soft);
    color: var(--accent);
    font-size: var(--text-xs);
    font-weight: var(--weight-bold);
    letter-spacing: 0.02em;
}

.badge--success { background: color-mix(in srgb, var(--success) 14%, transparent); color: var(--success); }
.badge--warning { background: color-mix(in srgb, var(--warning) 14%, transparent); color: var(--warning); }
.badge--danger  { background: color-mix(in srgb, var(--danger) 14%, transparent);  color: var(--danger); }

/* Card -------------------------------------------------------------------------------------------------------------- */

.card {
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
    padding: var(--space-6);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    color: var(--text);
    text-decoration: none;
    transition: box-shadow var(--duration) var(--ease), transform var(--duration) var(--ease),
        border-color var(--duration) var(--ease);
}

.card > :last-child {
    margin-bottom: 0;
}

a.card:hover {
    border-color: var(--accent);
    box-shadow: var(--shadow);
    color: var(--text);
    transform: translateY(-2px);
}

.card__icon {
    display: grid;
    place-items: center;
    width: 2.75rem;
    height: 2.75rem;
    border-radius: var(--radius);
    background: var(--accent-soft);
    color: var(--accent);
}

.card__icon svg {
    width: 1.5rem;
    height: 1.5rem;
}

.card__title {
    margin: 0;
    font-family: var(--font-heading);
    font-size: var(--text-xl);
}

.card__text {
    margin: 0;
    color: var(--text-muted);
}

/* Site header ------------------------------------------------------------------------------------------------------- */

.site-header {
    position: sticky;
    top: 0;
    z-index: 10;
    border-bottom: 1px solid var(--border);
    background: color-mix(in srgb, var(--bg) 85%, transparent);
    backdrop-filter: blur(12px);
}

.site-header__inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-4);
    min-height: var(--header-height);
}

.site-header__logo {
    display: inline-flex;
    color: var(--text);
}

.site-header__logo img {
    height: 2.75rem;
    width: auto;
}

.nav {
    display: flex;
    align-items: center;
    gap: var(--space-3);
}

.nav__links {
    display: none;
    gap: var(--space-6);
    margin: 0;
    padding: 0;
    list-style: none;
}

.nav__links a {
    color: var(--text-muted);
    font-weight: var(--weight-medium);
    text-decoration: none;
}

.nav__links a:hover,
.nav__links a[aria-current="page"] {
    color: var(--text);
}

@media (min-width: 48rem) {
    .nav { gap: var(--space-6); }
    .nav__links { display: flex; }
}

/* Product logo — leaf + product name + "by MasterIT", for any MasterIT product site (templates/web/product/) ---------- */

.product-logo {
    align-items: center;
    gap: var(--space-2);
    text-decoration: none;
}

.site-header__logo.product-logo img {
    height: 2.25rem;
}

.product-logo__name {
    font-family: var(--font-heading);
    font-size: var(--text-xl);
    font-weight: var(--weight-bold);
}

.product-logo__by {
    padding-left: var(--space-2);
    border-left: 1px solid var(--border);
    color: var(--text-muted);
    font-size: var(--text-xs);
    white-space: nowrap;
}

.product-logo__by strong {
    color: var(--accent);
}

@media (max-width: 30rem) {
    .product-logo__by { display: none; }
}

/* Hero -------------------------------------------------------------------------------------------------------------- */

.hero {
    position: relative;
    overflow: hidden;
    padding-block: var(--space-16) var(--space-12);
}

/* Faded outline leaf behind the hero, as in the brand guide's pages (logo_estompe) */
.hero::before {
    content: "";
    position: absolute;
    top: 50%;
    right: -6rem;
    width: 26rem;
    aspect-ratio: 124 / 200;
    background: var(--brand-green);
    -webkit-mask: url("../assets/logo/leaf-outline.svg") center / contain no-repeat;
    mask: url("../assets/logo/leaf-outline.svg") center / contain no-repeat;
    opacity: 0.18;
    transform: translateY(-50%);
    pointer-events: none;
}

@media (min-width: 64rem) {
    .hero::before { right: -2rem; width: 28rem; opacity: 0.2; }
}

.hero__inner {
    position: relative;
    max-width: 48rem;
}

.hero__title {
    margin-bottom: var(--space-6);
}

.hero__actions {
    margin-top: var(--space-8);
}

@media (min-width: 48rem) {
    .hero { padding-block: var(--space-24) var(--space-16); }
}

/* Full-width photo behind the hero: decorative <img class="hero__bg" alt="">, darkened by a fixed overlay, so the
   text uses the on-image colors in both themes (no leaf watermark) */
.hero--image {
    --text: var(--on-brand);
    --text-muted: var(--on-image-muted);
    --gradient-text: var(--gradient-on-image);
    color: var(--text);
    background: var(--code-bg);
    overflow: clip;    /* not hidden: that would make the hero the scroller of the parallax's view() timeline */
}

.hero--image::before {
    display: none;
}

.hero--image::after {
    content: "";
    position: absolute;
    inset: 0;
    background: var(--overlay-image);
    pointer-events: none;
}

.hero__bg {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Parallax: the photo scrolls at 70% of the page speed while the hero leaves the screen. CSS only (scroll-driven
   animation) — browsers without it, and users asking for reduced motion, get a still photo. Moving the photo down
   only uncovers what is already scrolled out of view, so it needs no extra height. */
@media (prefers-reduced-motion: no-preference) {
    @supports (animation-timeline: view()) {
        .hero__bg {
            animation: hero-parallax linear both;
            animation-timeline: view();
            animation-range: exit;
            will-change: transform;
        }
    }
}

@keyframes hero-parallax {
    to { transform: translateY(30%); }
}

.hero--image .container {
    position: relative;
    z-index: 1;
}

.hero--image .btn--secondary {
    background: transparent;
    border-color: var(--on-image-muted);
    color: var(--on-brand);
}

.hero--image .btn--secondary:hover {
    background: var(--on-brand);
    color: var(--brand-graphite);
}

.hero__credit {
    position: absolute;
    right: var(--space-4);
    bottom: var(--space-2);
    z-index: 1;
    color: var(--text-muted);
    font-size: var(--text-xs);
}

.hero__credit a {
    color: inherit;
}

@media (min-width: 48rem) {
    .hero--image::after { background: var(--overlay-image-wide); }
}

/* Stat -------------------------------------------------------------------------------------------------------------- */

.stat {
    display: flex;
    flex-direction: column;
    gap: var(--space-1);
}

.stat__value {
    font-size: var(--text-3xl);
    font-weight: var(--weight-bold);
    line-height: var(--leading-tight);
    font-family: var(--font-heading);
    letter-spacing: -0.01em;
}

.stat__label {
    color: var(--text-muted);
    font-size: var(--text-sm);
}

/* Call to action band ----------------------------------------------------------------------------------------------- */

.cta {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: var(--space-6);
    padding: var(--space-12) var(--space-8);
    border-radius: var(--radius-lg);
    background: var(--gradient-brand);
}

/* The gradient is brand-fixed (dark enough in both themes): its text stays --on-brand. */
.cta,
.cta h2,
.cta p {
    color: var(--on-brand);
}

.cta p {
    margin: 0;
    opacity: 0.9;
}

.cta .btn--primary {
    background: var(--on-brand);
    color: var(--brand-green-deep);
}

.cta .btn--primary:hover {
    background: var(--brand-mint);
    color: var(--brand-green-deep);
}

@media (min-width: 48rem) {
    .cta {
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
        padding: var(--space-12);
    }
}

/* Form -------------------------------------------------------------------------------------------------------------- */

.field {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
}

.field__label {
    font-size: var(--text-sm);
    font-weight: var(--weight-medium);
}

.field__hint {
    color: var(--text-muted);
    font-size: var(--text-sm);
}

.input {
    width: 100%;
    min-height: 2.75rem;
    padding: var(--space-2) var(--space-3);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    color: var(--text);
    font: inherit;
}

textarea.input {
    min-height: 7rem;
    resize: vertical;
}

.input:focus-visible {
    border-color: var(--accent);
    outline-offset: 0;
}

/* Footer ------------------------------------------------------------------------------------------------------------ */

.site-footer {
    padding-block: var(--space-12);
    border-top: 1px solid var(--border);
    color: var(--text-muted);
    font-size: var(--text-sm);
}

.site-footer__inner {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-6);
}

.site-footer a {
    color: inherit;
}

.site-footer a:hover {
    color: var(--text);
}

/* Icon button (theme toggle, menu…) — always give it an aria-label --------------------------------------------------- */

.icon-btn {
    display: inline-grid;
    place-items: center;
    width: 2.5rem;
    height: 2.5rem;
    padding: 0;
    border: 1px solid var(--border);
    border-radius: var(--radius-full);
    background: var(--surface);
    color: var(--text-muted);
    cursor: pointer;
    transition: color var(--duration) var(--ease), background var(--duration) var(--ease);
}

.icon-btn:hover {
    background: var(--surface-hover);
    color: var(--text);
}

.icon-btn svg {
    width: 1.25rem;
    height: 1.25rem;
}

/* =====================================================================================================================
   Technical & app components — used by templates/web/product/ and templates/web/app/, fine on any page
   ===================================================================================================================== */

/* Badge — extra variants ---------------------------------------------------------------------------------------- */

.badge--neutral { background: var(--surface-sunken); color: var(--text-muted); }
.badge--info    { background: color-mix(in srgb, var(--info) 14%, transparent); color: var(--info); }
.badge--violet  { background: color-mix(in srgb, var(--accent-2) 14%, transparent); color: var(--accent-2); }

/* Status — a colored dot + label (Orbit task statuses) ------------------------------------------------------------- */

.status {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    font-size: var(--text-sm);
    white-space: nowrap;
}

.status::before {
    content: "";
    width: 0.55rem;
    height: 0.55rem;
    border-radius: var(--radius-full);
    background: var(--text-muted);
}

.status--todo::before     { background: var(--info); }
.status--progress::before { background: var(--accent); }
.status--blocked::before  { background: var(--danger); }
.status--done::before     { background: var(--success); }
.status--cancelled        { color: var(--text-muted); text-decoration: line-through; }

/* Breadcrumbs ------------------------------------------------------------------------------------------------------- */

.breadcrumbs ol {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2);
    margin: 0;
    padding: 0;
    list-style: none;
    color: var(--text-muted);
    font-size: var(--text-sm);
}

.breadcrumbs li + li::before {
    content: "/";
    margin-right: var(--space-2);
    opacity: 0.6;
}

.breadcrumbs a {
    color: inherit;
    text-decoration: none;
}

.breadcrumbs a:hover {
    color: var(--text);
}

/* Tabs — a nav of links; the current one has aria-current="page" ---------------------------------------------------- */

.tabs {
    display: flex;
    gap: var(--space-1);
    overflow-x: auto;
    border-bottom: 1px solid var(--border);
}

.tabs a {
    padding: var(--space-3) var(--space-4);
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    color: var(--text-muted);
    font-weight: var(--weight-medium);
    text-decoration: none;
    white-space: nowrap;
}

.tabs a:hover {
    color: var(--text);
}

.tabs a[aria-current="page"] {
    border-bottom-color: var(--accent);
    color: var(--text);
}

/* Table — wrap it in .table-wrap so it scrolls inside itself on a phone -------------------------------------------- */

.table-wrap {
    overflow-x: auto;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    background: var(--surface);
}

.table {
    width: 100%;
    border-collapse: collapse;
    font-size: var(--text-sm);
}

.table th,
.table td {
    padding: var(--space-3) var(--space-4);
    border-bottom: 1px solid var(--border);
    text-align: left;
    vertical-align: middle;
}

.table th {
    color: var(--text-muted);
    font-size: var(--text-xs);
    font-weight: var(--weight-bold);
    letter-spacing: 0.06em;
    text-transform: uppercase;
    white-space: nowrap;
}

.table tbody tr:last-child td {
    border-bottom: 0;
}

.table tbody tr:hover {
    background: var(--surface-hover);
}

.table a {
    color: var(--text);
    font-weight: var(--weight-medium);
    text-decoration: none;
}

.table a:hover {
    color: var(--accent);
}

.table__ref {
    color: var(--text-muted);
    font-family: var(--font-mono);
    font-size: var(--text-xs);
}

/* Progress — set the value with style="--value: 62%" -------------------------------------------------------------- */

.progress {
    height: 0.5rem;
    overflow: hidden;
    border-radius: var(--radius-full);
    background: var(--surface-sunken);
}

.progress::before {
    content: "";
    display: block;
    width: var(--value, 0%);
    height: 100%;
    border-radius: inherit;
    background: var(--brand-green);
}

/* Avatar — initials in a circle; .avatar-group overlaps them -------------------------------------------------------- */

.avatar {
    display: inline-grid;
    place-items: center;
    flex: none;
    width: 2rem;
    height: 2rem;
    border-radius: var(--radius-full);
    background: var(--accent-soft);
    color: var(--accent);
    font-size: var(--text-xs);
    font-weight: var(--weight-bold);
}

.avatar--sm { width: 1.5rem; height: 1.5rem; font-size: 0.625rem; }
.avatar--sand { background: color-mix(in srgb, var(--brand-sand) 45%, transparent); color: var(--text); }
.avatar--violet { background: color-mix(in srgb, var(--brand-violet) 30%, transparent); color: var(--accent-2); }

.avatar-group {
    display: inline-flex;
}

.avatar-group .avatar + .avatar {
    margin-left: -0.3rem;
    box-shadow: 0 0 0 2px var(--surface);
}

/* Alert / callout --------------------------------------------------------------------------------------------------- */

.alert {
    display: flex;
    gap: var(--space-3);
    padding: var(--space-4);
    border: 1px solid color-mix(in srgb, var(--info) 35%, transparent);
    border-left-width: 4px;
    border-radius: var(--radius);
    background: color-mix(in srgb, var(--info) 8%, var(--surface));
}

.alert > svg { flex: none; width: 1.25rem; height: 1.25rem; margin-top: 0.15rem; color: var(--info); }
.alert p:last-child { margin-bottom: 0; }

.alert--success { border-color: color-mix(in srgb, var(--success) 35%, transparent); background: color-mix(in srgb, var(--success) 8%, var(--surface)); }
.alert--success > svg { color: var(--success); }
.alert--warning { border-color: color-mix(in srgb, var(--warning) 35%, transparent); background: color-mix(in srgb, var(--warning) 8%, var(--surface)); }
.alert--warning > svg { color: var(--warning); }
.alert--danger { border-color: color-mix(in srgb, var(--danger) 35%, transparent); background: color-mix(in srgb, var(--danger) 8%, var(--surface)); }
.alert--danger > svg { color: var(--danger); }

/* Code block & terminal — dark in both themes; tokens .tok-* for light syntax colors -------------------------------- */

.code-block {
    overflow: hidden;
    border-radius: var(--radius-lg);
    background: var(--code-bg);
    color: var(--code-text);
    box-shadow: var(--shadow);
}

.code-block__head {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-2) var(--space-4);
    background: var(--code-header);
    color: var(--code-muted);
    font-family: var(--font-mono);
    font-size: var(--text-xs);
}

/* Three window dots for a terminal look */
.code-block--terminal .code-block__head::before {
    content: "";
    flex: none;
    width: 0.6rem;
    height: 0.6rem;
    margin-right: calc(2rem + var(--space-3));
    border-radius: var(--radius-full);
    background: var(--code-muted);
    box-shadow: 1rem 0 0 var(--code-muted), 2rem 0 0 var(--code-muted);
    opacity: 0.6;
}

.code-block--terminal .code-block__head {
    padding-left: var(--space-4);
}

.code-block pre {
    margin: 0;
    padding: var(--space-4);
    overflow-x: auto;
    font-size: var(--text-sm);
    line-height: 1.7;
}

.code-block code {
    padding: 0;
    background: none;
    font-size: inherit;
}

.tok-com { color: var(--code-muted); }
.tok-key { color: var(--code-violet); }
.tok-str { color: var(--code-green); }
.tok-val { color: var(--code-sand); }

kbd {
    padding: 0.1em 0.45em;
    border: 1px solid var(--border);
    border-bottom-width: 2px;
    border-radius: var(--radius-sm);
    background: var(--surface);
    font-size: 0.8em;
}

/* Timeline — activity feed ------------------------------------------------------------------------------------------ */

.timeline {
    margin: 0;
    padding: 0;
    list-style: none;
}

.timeline li {
    position: relative;
    display: flex;
    gap: var(--space-3);
    padding-bottom: var(--space-4);
    font-size: var(--text-sm);
}

/* Line joining the avatars */
.timeline li:not(:last-child)::before {
    content: "";
    position: absolute;
    top: 1.75rem;
    bottom: 0.25rem;
    left: 0.75rem;
    width: 1px;
    background: var(--border);
}

.timeline__time {
    display: block;
    color: var(--text-muted);
    font-size: var(--text-xs);
}

/* Meta list — label / value pairs (task sidebar, settings) --------------------------------------------------------- */

.meta {
    display: grid;
    grid-template-columns: max-content 1fr;
    gap: var(--space-3) var(--space-4);
    margin: 0;
    font-size: var(--text-sm);
}

.meta dt {
    color: var(--text-muted);
}

.meta dd {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--space-2);
    margin: 0;
}

/* Prose — long-form text (docs, articles, task descriptions) ------------------------------------------------------ */

.prose {
    max-width: 46rem;
}

.prose h2 {
    margin-top: var(--space-12);
    padding-top: var(--space-6);
    border-top: 1px solid var(--border);
    font-size: var(--text-2xl);
}

.prose h3 {
    margin-top: var(--space-8);
}

.prose > ul,
.prose > ol {
    margin: 0 0 var(--space-4);
    padding-left: var(--space-6);
}

.prose > ul > li + li,
.prose > ol > li + li {
    margin-top: var(--space-1);
}

.prose .code-block,
.prose .alert,
.prose .table-wrap {
    margin-block: var(--space-6);
}

/* Select — a native <select class="input select"> with a drawn chevron --------------------------------------------- */

.select {
    appearance: none;
    padding-right: var(--space-8);
    background-image: linear-gradient(45deg, transparent 50%, var(--text-muted) 50%),
        linear-gradient(-45deg, transparent 50%, var(--text-muted) 50%);
    background-position: right 1.1rem center, right 0.8rem center;
    background-size: 0.3rem 0.3rem;
    background-repeat: no-repeat;
}

/* Multi-select — a .select-looking trigger opening a checkbox list; js/multiselect.js (or the app) drives it ------- */

.multiselect {
    position: relative;
}

.multiselect__trigger {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    text-align: left;
    cursor: pointer;
}

.multiselect__value {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Number of checked values; hidden while nothing is checked */
.multiselect__count {
    flex: none;
    min-width: 1.5rem;
    padding: 0.1em 0.5em;
    border-radius: var(--radius-full);
    background: var(--accent-soft);
    color: var(--accent);
    font-size: var(--text-xs);
    font-weight: var(--weight-bold);
    text-align: center;
}

.multiselect__count:empty {
    display: none;
}

.multiselect__trigger[aria-expanded="true"] {
    border-color: var(--accent);
}

.multiselect__panel {
    position: absolute;
    top: calc(100% + var(--space-1));
    left: 0;
    z-index: 20;
    min-width: 100%;
    max-width: min(20rem, calc(100vw - 2 * var(--space-4)));
    max-height: 18rem;
    overflow-y: auto;
    margin: 0;
    padding: var(--space-1);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: var(--shadow);
}

.multiselect__panel[hidden] {
    display: none;
}

.multiselect__option {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    min-height: 2.75rem;
    padding: var(--space-2) var(--space-3);
    border-radius: var(--radius-sm);
    font-size: var(--text-sm);
    cursor: pointer;
}

.multiselect__option:hover,
.multiselect__option:focus-within {
    background: var(--surface-hover);
}

.multiselect__option input {
    flex: none;
    width: 1.1rem;
    height: 1.1rem;
    margin: 0;
    accent-color: var(--accent);
}

/* Choice — radio / checkbox answers drawn as pills: fieldset.choice > legend + label.choice__option > input + span.
   --ok / --ko tint the checked pill with the status colors (test verdicts). ---------------------------------------- */

.choice {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2);
    min-width: 0;
    margin: 0;
    padding: 0;
    border: 0;
}

.choice__legend {
    width: 100%;
    margin-bottom: var(--space-1);
    padding: 0;
    font-size: var(--text-sm);
    font-weight: var(--weight-medium);
}

.choice__option {
    position: relative;
    display: inline-flex;
}

.choice__option input {
    position: absolute;
    inset: 0;
    margin: 0;
    opacity: 0;
    cursor: pointer;
}

.choice__option span {
    display: inline-flex;
    align-items: center;
    min-height: 2.75rem;
    padding: 0 var(--space-4);
    border: 1px solid var(--border);
    border-radius: var(--radius-full);
    background: var(--bg);
    font-size: var(--text-sm);
    cursor: pointer;
    transition: background var(--duration) var(--ease), border-color var(--duration) var(--ease);
}

.choice__option:hover span { border-color: var(--accent); }
.choice__option input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
.choice__option input:checked + span { border-color: var(--accent); background: var(--accent-soft); font-weight: var(--weight-bold); }
.choice__option--ok input:checked + span { border-color: var(--success); background: color-mix(in srgb, var(--success) 14%, var(--bg)); }
.choice__option--ko input:checked + span { border-color: var(--danger); background: color-mix(in srgb, var(--danger) 12%, var(--bg)); }

/* Question — one card per survey question or test step: __head (__id + __title) · __steps (what to do) · __expect
   (expected result) · a .choice · fields · __solution (<details>). data-state="ok|ko" is set by js/survey.js. ----- */

.question {
    display: grid;
    gap: var(--space-3);
    min-width: 0;
    padding: var(--space-4);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    background: var(--surface);
}

.question[data-state="ok"] { border-color: color-mix(in srgb, var(--success) 45%, var(--border)); }
.question[data-state="ko"] { border-color: color-mix(in srgb, var(--danger) 55%, var(--border)); }
.question p { margin: 0; }

.question__head {
    display: flex;
    align-items: baseline;
    gap: var(--space-3);
}

.question__id {
    flex: none;
    color: var(--text-muted);
    font-family: var(--font-mono);
    font-size: var(--text-sm);
}

.question__title {
    margin: 0;
    font-size: var(--text-lg);
}

.question__steps {
    display: grid;
    gap: var(--space-1);
    margin: 0;
    padding-left: 1.25rem;
}

.question__expect {
    display: flex;
    gap: var(--space-2);
    padding: var(--space-2) var(--space-3);
    border-radius: var(--radius);
    background: var(--accent-soft);
    font-size: var(--text-sm);
}

.question__expect strong {
    flex: none;
    color: var(--accent);
}

.question__solution {
    padding-top: var(--space-2);
    border-top: 1px dashed var(--border);
    font-size: var(--text-sm);
}

.question__solution summary {
    display: flex;
    align-items: center;
    min-height: 2.75rem;
    color: var(--text-muted);
    cursor: pointer;
}

.question__solution > :not(summary) { margin-top: var(--space-2); }
.question__solution ol { padding-left: 1.25rem; }

.question-list {
    display: grid;
    gap: var(--space-4);
    margin: 0;
    padding: 0;
    list-style: none;
}

@media (min-width: 48rem) {
    .question { padding: var(--space-4) var(--space-6); }
}

/* Survey bar — sticky progress under the site header: __inner (.container) · .progress · __label ---------------- */

.survey-bar {
    position: sticky;
    top: var(--header-height);
    z-index: 9;
    border-bottom: 1px solid var(--border);
    background: color-mix(in srgb, var(--bg) 85%, transparent);
    backdrop-filter: blur(12px);
}

.survey-bar__inner {
    display: grid;
    gap: var(--space-1);
    padding-block: var(--space-2);
}

.survey-bar__label {
    color: var(--text-muted);
    font-size: var(--text-xs);
    font-variant-numeric: tabular-nums;
}

/* Timer — a stopwatch in a question: a button + __value (js/survey.js) -------------------------------------------- */

.timer {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--space-3);
}

.timer__value {
    min-width: 4.5rem;
    font-family: var(--font-mono);
    font-size: var(--text-lg);
    font-variant-numeric: tabular-nums;
}

/* Gallery bar — « ← Modèles » above each template of this repo, back to index.html. Gallery chrome only: delete it when
   a template is copied into a site. Hidden on paper; shown by a screen block that Paged.js (A4 preview) keeps too. --- */

.gallery-bar {
    display: none;
}

@media screen, pagedjs-ignore {
    .gallery-bar {
        display: flex;
        align-items: center;
        grid-column: 1 / -1;
        place-self: start stretch;
        padding: 0 var(--space-4);
        border-bottom: 1px solid var(--border);
        background: var(--surface-sunken);
        font-size: var(--text-sm);
    }
}

.gallery-bar__link {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    min-height: 2.75rem;
    color: var(--text-muted);
    text-decoration: none;
}

.gallery-bar__link:hover {
    color: var(--accent);
}

.gallery-bar__link svg {
    width: 1rem;
    height: 1rem;
}

/* Full-height grid layouts (.app, .auth): the bar is a first row of its own, the page keeps the rest */
.app:has(> .gallery-bar),
.auth:has(> .gallery-bar) {
    grid-template-rows: auto 1fr;
}

.auth:has(> .gallery-bar) {
    gap: var(--space-6);
}

.auth > .gallery-bar {
    margin: calc(-1 * var(--space-6)) calc(-1 * var(--space-4)) 0;   /* full width, over .auth's padding */
}

/* Motion — the hero comes in on load, then blocks rise into view as you scroll. CSS only, screen only, off with
   reduced motion. Scroll reveal uses scroll-driven animations (view() timeline): a browser without them shows the
   page still, and nothing ever waits on JS to appear. A block inside an overflow: hidden ancestor won't reveal
   (that ancestor becomes the timeline's scroller): use overflow: clip there, as .hero--image does. -------------- */

@media screen and (prefers-reduced-motion: no-preference) {
    /* Hero: its children rise one after the other on load (badge, title, lead, actions) */
    .hero__inner > * {
        animation: rise var(--duration-slow) var(--ease-out) both;
    }

    .hero__inner > :nth-child(2) { animation-delay: 80ms; }
    .hero__inner > :nth-child(3) { animation-delay: 160ms; }
    .hero__inner > :nth-child(n + 4) { animation-delay: 240ms; }

    /* .reveal: the block rises as it enters the screen · .reveal-group: each child does, a step after the previous */
    @supports (animation-timeline: view()) {
        .reveal,
        .reveal-group > * {
            animation: rise linear both;
            animation-timeline: view();
            animation-range: entry 0% entry 80%;
        }

        .reveal-group > :nth-child(3n + 2) { animation-range: entry 10% entry 90%; }
        .reveal-group > :nth-child(3n + 3) { animation-range: entry 20% entry 100%; }
    }
}

/* translate, not transform: the hover lift of cards and buttons (transform) keeps its transition */
@keyframes rise {
    from {
        opacity: 0;
        translate: 0 var(--reveal-distance);
    }
}
