/* ============================================================
   components.css — every reusable primitive in the system.
   ============================================================ */

/* ------------------------------------------------------------
   Buttons
   ------------------------------------------------------------ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    height: 48px;
    padding-inline: 28px;
    border-radius: var(--r-pill);
    font-size: var(--fs-sm);
    font-weight: var(--fw-semibold);
    line-height: 1;
    white-space: nowrap;
    border: 0;
    cursor: pointer;
    text-decoration: none;
    transition: background var(--t-base) var(--e-out),
                color var(--t-base) var(--e-out),
                border-color var(--t-base) var(--e-out),
                transform var(--t-base) var(--e-out),
                box-shadow var(--t-base) var(--e-out);
}
.btn:active { transform: translateY(0) scale(.98); }
.btn:disabled, .btn.is-disabled { opacity: .4; pointer-events: none; }

.btn__icon { display: inline-flex; transition: transform var(--t-base) var(--e-out); }
@media (hover: hover) {
    .btn:hover .btn__icon--trail { transform: translateX(3px); }
}

.btn--primary { background: var(--c-accent); color: var(--c-on-accent); }
@media (hover: hover) {
    .btn--primary:hover {
        background: var(--c-accent-strong);
        transform: translateY(-2px);
        box-shadow: var(--c-shadow-sm);
    }
}

.btn--secondary {
    background: transparent;
    color: var(--c-accent);
    border: 1.5px solid var(--c-accent);
}
@media (hover: hover) {
    .btn--secondary:hover { background: var(--c-accent); color: var(--c-on-accent); }
}

.btn--ghost {
    height: 44px;
    padding-inline: 20px;
    background: transparent;
    color: var(--c-text-soft);
    font-weight: var(--fw-medium);
}
@media (hover: hover) {
    .btn--ghost:hover { color: var(--c-accent); background: var(--c-accent-soft); }
}

.btn--invert { background: var(--c-white); color: var(--c-black); }
@media (hover: hover) {
    .btn--invert:hover { background: var(--c-grey-100); transform: translateY(-2px); }
}

.btn--sm { height: 36px; padding-inline: 18px; font-size: var(--fs-xs); }
.btn--lg { height: 56px; padding-inline: 34px; font-size: 16px; }
.btn--block { width: 100%; }

.btn--icon {
    width: 44px;
    height: 44px;
    padding: 0;
    border-radius: var(--r-circle);
    background: var(--c-white);
    color: var(--c-text);
    border: 1px solid var(--c-border);
    font-size: 16px;
}
@media (hover: hover) {
    .btn--icon:hover { background: var(--c-accent); color: var(--c-on-accent); border-color: var(--c-accent); }
}
.btn--icon.is-active { background: var(--c-accent); color: var(--c-on-accent); border-color: var(--c-accent); }
.btn--icon-sm { width: 36px; height: 36px; font-size: 14px; }

/* Glass icon button used over photography. */
.btn--glass {
    width: 48px;
    height: 48px;
    padding: 0;
    border-radius: var(--r-circle);
    background: rgba(255, 255, 255, .12);
    border: 1px solid var(--c-on-dark-line);
    color: var(--c-white);
    backdrop-filter: blur(8px);
    font-size: 16px;
}
@media (hover: hover) {
    .btn--glass:hover { background: rgba(255, 255, 255, .24); }
}

/* The small pill that closes every card. */
.btn--read {
    height: 36px;
    padding-inline: 16px;
    background: var(--c-accent);
    color: var(--c-on-accent);
    font-size: 12px;
    font-weight: var(--fw-semibold);
    border-radius: var(--r-pill);
    gap: 8px;
}
@media (hover: hover) { .btn--read:hover { background: var(--c-accent-strong); } }
.on-dark .btn--read, .card--overlay .btn--read { background: var(--c-white); color: var(--c-black); }

/* Section-header "View all". */
.btn--viewall {
    height: 40px;
    padding-inline: 22px;
    background: var(--c-accent);
    color: var(--c-on-accent);
    font-size: var(--fs-xs);
    font-weight: var(--fw-semibold);
    flex-shrink: 0;
}
@media (hover: hover) { .btn--viewall:hover { background: var(--c-accent-strong); } }

/* Underline-grow text link. Catalogued in styleguide.html; inherits its
   colour, so it works on light and dark surfaces alike. */
.link-arrow {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: var(--fs-sm);
    font-weight: var(--fw-semibold);
    position: relative;
    padding-bottom: 4px;
}
.link-arrow::after {
    content: '';
    position: absolute;
    left: 0; bottom: 0;
    height: 1px;
    width: 0;
    background: currentColor;
    transition: width var(--t-base) var(--e-out);
}
@media (hover: hover) {
    .link-arrow:hover::after { width: 100%; }
    .link-arrow:hover .btn__icon { transform: translateX(4px); }
}
.link-arrow:focus-visible::after { width: 100%; }

/* Button loading state — a monochrome spinning ring. */
.btn.is-loading { pointer-events: none; position: relative; color: transparent; }
.btn.is-loading::after {
    content: '';
    position: absolute;
    width: 18px; height: 18px;
    border: 2px solid currentColor;
    border-radius: var(--r-circle);
    border-top-color: transparent;
    animation: btn-spin .7s linear infinite;
    color: var(--c-white);
}
.btn--secondary.is-loading::after { color: var(--c-accent); }
.btn--invert.is-loading::after { color: var(--c-black); }
@keyframes btn-spin { to { transform: rotate(360deg); } }

/* ------------------------------------------------------------
   Tags, chips, badges, ratings
   ------------------------------------------------------------ */
.tag {
    display: inline-flex;
    align-items: center;
    height: 26px;
    padding-inline: 12px;
    border-radius: var(--r-pill);
    background: var(--c-accent);
    color: var(--c-on-accent);
    font-size: var(--fs-2xs);
    font-weight: var(--fw-bold);
    letter-spacing: var(--ls-eyebrow);
    text-transform: uppercase;
    line-height: 1;
    white-space: nowrap;
}
.tag--overlay {
    background: rgba(255, 255, 255, .92);
    color: var(--c-black);
    backdrop-filter: blur(6px);
}
.tag--outline {
    background: transparent;
    color: var(--c-accent);
    border: 1px solid var(--c-accent);
}
.tag--invert { background: var(--c-white); color: var(--c-black); }

.chip {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    height: 38px;
    padding-inline: 20px;
    border-radius: var(--r-pill);
    border: 1px solid var(--c-border);
    background: var(--c-white);
    color: var(--c-grey-700);
    font-size: var(--fs-xs);
    font-weight: var(--fw-medium);
    cursor: pointer;
    transition: all var(--t-fast) var(--e-out);
}
@media (hover: hover) { .chip:hover { border-color: var(--c-accent); color: var(--c-accent); } }
.chip.is-active { background: var(--c-accent); color: var(--c-on-accent); border-color: var(--c-accent); }
.chip--removable { padding-right: 12px; }

.chips { display: flex; flex-wrap: wrap; gap: var(--s-2); }

.dot-badge {
    width: 6px; height: 6px;
    border-radius: var(--r-circle);
    background: var(--c-accent);
    display: inline-block;
}
.on-dark .dot-badge { background: var(--c-white); }

.rating { display: inline-flex; align-items: center; gap: 3px; font-size: 14px; }
.rating i { color: var(--c-accent); }
.rating i.is-empty { color: var(--c-grey-300); }
.rating__count { font-size: 12px; color: var(--c-text-meta); margin-left: 5px; }

/* ------------------------------------------------------------
   Meta row
   ------------------------------------------------------------ */
.meta {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: var(--s-2);
    font-size: var(--fs-xs);
    font-weight: var(--fw-medium);
    color: var(--c-text-meta);
    line-height: 1.4;
}
.meta__item { display: inline-flex; align-items: center; gap: 6px; }
.meta__item + .meta__item::before {
    content: '';
    width: 3px; height: 3px;
    border-radius: var(--r-circle);
    background: var(--c-grey-300);
    margin-right: 2px;
}
.meta--on-dark { color: var(--c-on-dark-soft); }
.meta--on-dark .meta__item + .meta__item::before { background: var(--c-on-dark-line); }

/* ------------------------------------------------------------
   Cards — one system, seven shapes
   ------------------------------------------------------------ */
.card {
    position: relative;
    display: flex;
    flex-direction: column;
    background: var(--c-white);
    border: 1px solid var(--c-border);
    border-radius: var(--r-lg);
    overflow: hidden;
    box-shadow: var(--c-shadow-xs);
    transition: transform var(--t-base) var(--e-out),
                box-shadow var(--t-base) var(--e-out),
                border-color var(--t-base) var(--e-out);
}
@media (hover: hover) {
    .card:hover {
        transform: translateY(-4px);
        box-shadow: var(--c-shadow-md);
        border-color: var(--c-grey-300);
    }
    .card:hover .photo { transform: scale(var(--img-zoom-hover)); }
}
.card:focus-within { box-shadow: var(--c-shadow-md); }
.card:focus-within .photo { transform: scale(var(--img-zoom-hover)); }

.card__media { position: relative; overflow: hidden; background: var(--c-grey-100); }
.card__media .tag { position: absolute; top: 16px; left: 16px; z-index: 2; }
/* In-body tags sit in a column flex context, which would stretch them to
   the full card width — keep them pill-width instead. */
.card__body > .tag { align-self: flex-start; max-width: 100%; }
.card__body { display: flex; flex-direction: column; gap: var(--s-3); padding: var(--s-5); flex: 1; }
.card__title {
    font-size: var(--fs-h6);
    line-height: var(--lh-h6);
    font-weight: var(--fw-semibold);
    color: var(--c-heading);
}
@media (hover: hover) {
    .card:hover .card__title { color: var(--c-accent); }
}
.card__title a { position: static; }
.card__excerpt { font-size: var(--fs-sm); color: var(--c-text-soft); line-height: 1.65; margin: 0; }
.card__foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--s-3);
    margin-top: auto;
    padding-top: var(--s-2);
}

/* A — Feature card */
.card--feature .card__body { padding: var(--s-6); gap: var(--s-3); }
.card--feature .card__title { font-size: var(--fs-h4); line-height: var(--lh-h4); letter-spacing: var(--ls-h4); }

/* B — Standard card */
.card--standard { min-height: 420px; }
.card--standard .card__media { margin: 8px; border-radius: var(--r-md); }
.card--standard .card__body { padding: var(--s-5); padding-top: var(--s-3); }

/* C — Horizontal card */
.card--horizontal {
    flex-direction: row;
    align-items: stretch;
    gap: var(--s-5);
    padding: var(--s-4);
}
.card--horizontal .card__media {
    flex: 0 0 220px;
    width: 220px;
    height: 150px;
    border-radius: var(--r-md);
    align-self: center;
}
.card--horizontal .card__body { padding: 0; gap: var(--s-2); justify-content: center; }
.card--horizontal .card__excerpt { -webkit-line-clamp: 1; line-clamp: 1; }

/* D — Compact list item */
.card--compact {
    flex-direction: row;
    align-items: center;
    gap: 14px;
    padding: var(--s-4) 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
    border-bottom: 1px solid var(--c-border);
}
.card--compact:last-child { border-bottom: 0; }
@media (hover: hover) { .card--compact:hover { transform: none; box-shadow: none; } }
.card--compact .card__media {
    flex: 0 0 72px;
    width: 72px; height: 72px;
    border-radius: var(--r-sm);
}
.card--compact .card__body { padding: 0; gap: 6px; }
.card--compact .card__title { font-size: var(--fs-sm); font-weight: var(--fw-semibold); line-height: 1.45; }
.card--compact.card--reverse { flex-direction: row-reverse; }
.card--compact .card__body > .tag { height: 22px; padding-inline: 10px; }

/* E — Overlay card */
.card--overlay {
    min-height: 420px;
    justify-content: flex-end;
    border: 0;
    box-shadow: none;
    color: var(--c-white);
    isolation: isolate;
}
.card--overlay .card__media { position: absolute; inset: 0; margin: 0; border-radius: 0; z-index: -2; }
.card--overlay::before {
    content: '';
    position: absolute;
    inset: 0;
    z-index: -1;
    background: linear-gradient(180deg, transparent 30%, rgba(0, 0, 0, .85) 100%);
}
.card--overlay .card__body { padding: var(--s-7); gap: var(--s-4); flex: 0; }
.card--overlay .card__title { font-size: var(--fs-h3); line-height: var(--lh-h3); letter-spacing: var(--ls-h3); color: var(--c-white); }
.card--overlay .card__excerpt { color: var(--c-on-dark-soft); }
.card--overlay .meta { color: var(--c-on-dark-soft); }
.card--overlay .meta__item + .meta__item::before { background: var(--c-on-dark-line); }

/* F — Poster card */
.card--poster {
    border: 0;
    background: var(--c-white);
    border-radius: var(--r-md);
    padding: 12px;
    box-shadow: var(--c-shadow-md);
    text-align: center;
    gap: var(--s-3);
}
.card--poster .card__media { border-radius: var(--r-md); }
.card--poster .card__body { padding: var(--s-3) var(--s-2) var(--s-2); gap: 6px; align-items: center; }
.card--poster .card__title { font-size: var(--fs-sm); font-weight: var(--fw-semibold); }

/* G — Text-only list row */
.card--text {
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
    padding: 18px 0;
    border-bottom: 1px solid var(--c-border);
    gap: var(--s-2);
}
.card--text:last-child { border-bottom: 0; }
@media (hover: hover) { .card--text:hover { transform: none; box-shadow: none; } }
.card--text .card__body { padding: 0; gap: var(--s-2); }
.card--text .card__title { font-size: 15px; font-weight: var(--fw-semibold); line-height: 1.45; }

/* Bookmark control that sits above the stretched link. */
.card__bookmark { position: relative; z-index: 2; }

/* ------------------------------------------------------------
   Forms
   ------------------------------------------------------------ */
.field { display: block; }
.field + .field { margin-top: var(--s-5); }

.label {
    display: block;
    font-size: var(--fs-xs);
    font-weight: var(--fw-semibold);
    color: var(--c-ink);
    margin-bottom: var(--s-2);
}

.input, .select, .textarea {
    width: 100%;
    height: 52px;
    padding: 0 18px;
    background: var(--c-grey-50);
    border: var(--border-w, 1px) solid var(--c-grey-200);
    border-radius: var(--r-sm);
    font-size: 15px;
    line-height: 1.4;
    color: var(--c-ink);
    transition: border-color var(--t-fast) var(--e-out), box-shadow var(--t-fast) var(--e-out);
}
.textarea { height: auto; min-height: 140px; padding: 16px 18px; resize: vertical; }
.input::placeholder, .textarea::placeholder { color: var(--c-grey-400); }

.input:focus, .select:focus, .textarea:focus {
    background: var(--c-white);
    outline: none;
    border-color: var(--c-accent);
    box-shadow: 0 0 0 3px var(--c-accent-soft);
}

.input[aria-invalid="true"], .textarea[aria-invalid="true"], .select[aria-invalid="true"] {
    border-width: 1.5px;
    border-color: var(--c-accent);
}

.field__error {
    display: none;
    align-items: center;
    gap: 6px;
    margin-top: var(--s-2);
    font-size: var(--fs-xs);
    font-weight: var(--fw-medium);
    color: var(--c-text);
}
.field__error.is-visible { display: flex; }

/* A scrollable tick-list, for picking several of something without the
   hidden-options problem a multiple <select> has. It caps its own height
   so a site with forty sections cannot push the rest of the form off
   the screen. */
.checkbox-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: var(--s-2) var(--s-4);
    max-height: 190px;
    overflow-y: auto;
    margin-top: var(--s-3);
    padding: var(--s-3) var(--s-4);
    border: 1px solid var(--c-border);
    border-radius: var(--r-sm);
    background: var(--c-white);
}
.checkbox-grid__item {
    display: flex;
    align-items: center;
    gap: var(--s-2);
    min-width: 0;
    font-size: var(--fs-xs);
    line-height: 1.4;
    color: var(--c-text-soft);
    cursor: pointer;
}
.checkbox-grid__item input { flex: 0 0 auto; accent-color: var(--c-accent); cursor: pointer; }
.checkbox-grid__item span { min-width: 0; overflow-wrap: anywhere; }
.checkbox-grid__item:hover { color: var(--c-text); }
.checkbox-grid:focus-within { border-color: var(--c-accent-line); }

.select-wrap { position: relative; }
.select-wrap .select { appearance: none; padding-right: 44px; cursor: pointer; }
.select-wrap__chevron {
    position: absolute;
    right: 16px;
    top: 50%;
    transform: translateY(-50%);
    pointer-events: none;
    font-size: 14px;
    color: var(--c-grey-600);
}

/* Search field — the tall pill */
.search-field { position: relative; }
.search-field .input {
    height: 64px;
    padding-left: 56px;
    padding-right: 130px;
    border-radius: var(--r-pill);
    font-size: 16px;
}
.search-field__icon {
    position: absolute;
    left: 24px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 20px;
    color: var(--c-grey-500);
    pointer-events: none;
}
.search-field__submit {
    position: absolute;
    right: 6px;
    top: 6px;
    bottom: 6px;
    height: auto;
}
.search-field--sm .input { height: 56px; padding-left: 50px; padding-right: 118px; }
.search-field--sm .search-field__icon { left: 20px; font-size: 18px; }

/* Checkbox / radio */
.check {
    display: inline-flex;
    align-items: flex-start;
    gap: 10px;
    font-size: var(--fs-xs);
    font-weight: var(--fw-medium);
    color: var(--c-text-soft);
    cursor: pointer;
    line-height: 1.5;
}
.check input { position: absolute; opacity: 0; width: 0; height: 0; }
.check__box {
    flex: 0 0 20px;
    width: 20px; height: 20px;
    border: 1.5px solid var(--c-grey-300);
    border-radius: var(--r-xs);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: transparent;
    font-size: 12px;
    transition: all var(--t-fast) var(--e-out);
}
.check--radio .check__box { border-radius: var(--r-circle); }
.check input:checked + .check__box {
    background: var(--c-accent);
    border-color: var(--c-accent);
    color: var(--c-on-accent);
}
.check input:focus-visible + .check__box { outline: 2px solid var(--c-accent); outline-offset: 3px; }

/* Toggle */
.toggle { display: inline-flex; align-items: center; gap: 12px; cursor: pointer; }
.toggle input { position: absolute; opacity: 0; width: 0; height: 0; }
.toggle__track {
    width: 44px; height: 24px;
    border-radius: var(--r-pill);
    background: var(--c-grey-300);
    position: relative;
    transition: background var(--t-fast) var(--e-out);
}
.toggle__track::after {
    content: '';
    position: absolute;
    top: 3px; left: 3px;
    width: 18px; height: 18px;
    border-radius: var(--r-circle);
    background: var(--c-white);
    transition: transform var(--t-fast) var(--e-out);
}
.toggle input:checked + .toggle__track { background: var(--c-accent); }
.toggle input:checked + .toggle__track::after { transform: translateX(20px); }
.toggle input:focus-visible + .toggle__track { outline: 2px solid var(--c-accent); outline-offset: 3px; }

/* ------------------------------------------------------------
   Pagination, breadcrumb, avatar, divider
   ------------------------------------------------------------ */
.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--s-2);
    flex-wrap: wrap;
}
.pagination__item {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 44px;
    height: 44px;
    padding-inline: 12px;
    border: 1px solid var(--c-border);
    border-radius: var(--r-sm);
    font-size: var(--fs-sm);
    font-weight: var(--fw-semibold);
    background: var(--c-white);
    transition: all var(--t-fast) var(--e-out);
}
@media (hover: hover) { .pagination__item:hover { border-color: var(--c-accent); color: var(--c-accent); } }
.pagination__item.is-active { background: var(--c-accent); color: var(--c-on-accent); border-color: var(--c-accent); }
.pagination__gap { color: var(--c-grey-400); padding-inline: 6px; }

.breadcrumb {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    font-size: var(--fs-xs);
    font-weight: var(--fw-medium);
    color: var(--c-grey-500);
}
.breadcrumb__sep { font-size: 12px; opacity: .7; }
.breadcrumb__current { color: var(--c-accent); font-weight: var(--fw-bold); }
.breadcrumb--on-dark { color: var(--c-on-dark-soft); }
.breadcrumb--on-dark .breadcrumb__current { color: var(--c-white); }

.avatar {
    border-radius: var(--r-circle);
    overflow: hidden;
    background: var(--c-grey-100);
    border: 1px solid var(--c-grey-200);
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--c-grey-500);
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar--32 { width: 32px; height: 32px; }
.avatar--40 { width: 40px; height: 40px; }
.avatar--48 { width: 48px; height: 48px; }
.avatar--64 { width: 64px; height: 64px; }
.avatar--80 { width: 80px; height: 80px; }
.avatar--96 { width: 96px; height: 96px; }
.avatar--120 { width: 120px; height: 120px; }

.author-line { display: inline-flex; align-items: center; gap: 10px; }
.author-line__name { font-size: var(--fs-sm); font-weight: var(--fw-semibold); line-height: 1.3; }
.author-line__role { font-size: 12px; color: var(--c-text-meta); line-height: 1.3; }

.divider { height: 1px; background: var(--c-border); border: 0; margin: 0; }
.divider--strong { height: 2px; width: 64px; background: var(--c-accent); }

/* ------------------------------------------------------------
   Dropdown
   ------------------------------------------------------------ */
.dropdown { position: relative; }
.dropdown__panel {
    position: absolute;
    top: calc(100% + 10px);
    /* an edge, so the panel does not melt into a white page below it */
    right: 0;
    min-width: 200px;
    padding: 8px;
    background: var(--c-white);
    border: 1px solid var(--c-border);
    border-radius: var(--r-md);
    box-shadow: var(--c-shadow-md);
    z-index: var(--z-dropdown);
    display: none;
}
.dropdown__panel.is-open { display: block; }
.dropdown__item {
    display: flex;
    align-items: center;
    gap: 10px;
    height: 40px;
    padding-inline: 12px;
    border-radius: var(--r-xs);
    font-size: var(--fs-sm);
    color: var(--c-text);
    width: 100%;
    text-align: left;
}
@media (hover: hover) { .dropdown__item:hover { background: var(--c-accent-soft); color: var(--c-accent); } }

/* ------------------------------------------------------------
   Modal / dialog
   ------------------------------------------------------------ */
.modal {
    border: 0;
    padding: 0;
    background: transparent;
    max-width: 100%;
    max-height: 100%;
    overflow: visible;
}
.modal::backdrop { background: var(--c-overlay); backdrop-filter: blur(4px); }
.modal__box {
    width: min(100vw - 32px, 460px);
    background: var(--c-white);
    border-radius: var(--r-xl);
    padding: var(--s-7);
    box-shadow: var(--c-shadow-modal);
    max-height: calc(100vh - 48px);
    overflow-y: auto;
    animation: modal-in var(--t-base) var(--e-out);
}
.modal--wide .modal__box { width: min(100vw - 32px, 640px); }
@keyframes modal-in {
    from { opacity: 0; transform: translateY(16px); }
    to { opacity: 1; transform: translateY(0); }
}
.modal__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--s-4);
    margin-bottom: var(--s-6);
}
.modal__title { font-size: var(--fs-h5); font-weight: var(--fw-semibold); }
.modal__close { width: 40px; height: 40px; }

/* ------------------------------------------------------------
   Drawer + overlay
   ------------------------------------------------------------ */
.overlay {
    position: fixed;
    inset: 0;
    background: var(--c-overlay);
    backdrop-filter: blur(4px);
    z-index: var(--z-overlay);
    opacity: 0;
    visibility: hidden;
    transition: opacity var(--t-base) var(--e-out), visibility var(--t-base);
}
.overlay.is-open { opacity: 1; visibility: visible; }

.drawer {
    position: fixed;
    top: 0; bottom: 0;
    left: 0;
    width: 340px;
    max-width: 100vw;
    background: var(--c-white);
    z-index: var(--z-drawer);
    transform: translateX(-100%);
    transition: transform var(--t-base) var(--e-out);
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    overscroll-behavior: contain;
    padding-bottom: env(safe-area-inset-bottom);
}
.drawer.is-open { transform: translateX(0); }
.drawer--right { left: auto; right: 0; transform: translateX(100%); }
.drawer--right.is-open { transform: translateX(0); }

/* Mobile bottom sheet (filters) */
.sheet {
    position: fixed;
    left: 0; right: 0; bottom: 0;
    max-height: 88vh;
    background: var(--c-white);
    border-radius: var(--r-xl) var(--r-xl) 0 0;
    z-index: var(--z-drawer);
    transform: translateY(100%);
    transition: transform var(--t-base) var(--e-out);
    display: flex;
    flex-direction: column;
    padding-bottom: env(safe-area-inset-bottom);
}
.sheet.is-open { transform: translateY(0); }
.sheet__handle {
    width: 40px; height: 4px;
    border-radius: var(--r-pill);
    background: var(--c-grey-300);
    margin: 12px auto;
    flex-shrink: 0;
}

/* ------------------------------------------------------------
   Toast
   ------------------------------------------------------------ */
.toast-stack {
    position: fixed;
    right: var(--s-7);
    bottom: var(--s-7);
    z-index: var(--z-toast);
    display: flex;
    flex-direction: column;
    gap: var(--s-2);
    pointer-events: none;
}
.toast {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 22px;
    background: var(--c-accent);
    color: var(--c-on-accent);
    border-radius: var(--r-pill);
    font-size: var(--fs-sm);
    font-weight: var(--fw-medium);
    box-shadow: var(--c-shadow-md);
    animation: toast-in var(--t-base) var(--e-out);
}
.toast.is-leaving { animation: toast-out var(--t-base) var(--e-out) forwards; }
@keyframes toast-in { from { opacity: 0; transform: translateY(12px); } }
@keyframes toast-out { to { opacity: 0; transform: translateY(12px); } }

/* ------------------------------------------------------------
   Skeleton
   ------------------------------------------------------------ */
.skeleton {
    position: relative;
    overflow: hidden;
    background: var(--c-grey-100);
    border-radius: var(--r-xs);
}
.skeleton::after {
    content: '';
    position: absolute;
    inset: 0;
    transform: translateX(-100%);
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .85), transparent);
    animation: skeleton-sweep 1.4s linear infinite;
}
@keyframes skeleton-sweep { to { transform: translateX(100%); } }
.skeleton--line { height: 12px; margin-bottom: 10px; }
.skeleton--title { height: 18px; width: 80%; margin-bottom: 14px; }
.skeleton--media { aspect-ratio: 16 / 10; border-radius: var(--r-md); }

.skeleton-card {
    border: 1px solid var(--c-border);
    border-radius: var(--r-lg);
    padding: 8px 8px 20px;
    background: var(--c-white);
}
.skeleton-card__body { padding: 16px 12px 0; }

/* ------------------------------------------------------------
   Empty state
   ------------------------------------------------------------ */
.empty {
    text-align: center;
    padding: var(--s-12) var(--s-5);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--s-4);
}
.empty__icon {
    width: 96px; height: 96px;
    border-radius: var(--r-circle);
    background: var(--c-grey-50);
    display: grid;
    place-items: center;
    font-size: 36px;
    color: var(--c-grey-500);
    margin-bottom: var(--s-2);
}
.empty__title { font-size: var(--fs-h4); }
.empty__text { font-size: var(--fs-sm); color: var(--c-text-soft); max-width: 420px; }

/* ------------------------------------------------------------
   Back to top
   ------------------------------------------------------------ */
.back-to-top {
    position: fixed;
    right: var(--s-7);
    bottom: var(--s-7);
    width: 48px; height: 48px;
    border-radius: var(--r-circle);
    background: var(--c-accent);
    color: var(--c-on-accent);
    display: grid;
    place-items: center;
    font-size: 16px;
    z-index: var(--z-sticky);
    opacity: 0;
    transform: translateY(16px);
    pointer-events: none;
    transition: opacity var(--t-base) var(--e-out), transform var(--t-base) var(--e-out);
    box-shadow: var(--c-shadow-md);
}
.back-to-top.is-visible { opacity: 1; transform: translateY(0); pointer-events: auto; }

/* ------------------------------------------------------------
   Carousel scaffolding (shared by hero, banner, posters)
   ------------------------------------------------------------ */
.carousel { position: relative; }
.carousel__viewport { overflow: hidden; }
.carousel__btn { position: absolute; top: 50%; transform: translateY(-50%); z-index: 3; }
.carousel__btn--prev { left: var(--s-5); }
.carousel__btn--next { right: var(--s-5); }
.carousel__dots { display: flex; align-items: center; justify-content: center; gap: 8px; }
.carousel__dot {
    width: 8px; height: 8px;
    border-radius: var(--r-pill);
    background: var(--c-grey-300);
    transition: all var(--t-base) var(--e-out);
    cursor: pointer;
}
.carousel__dot.is-active { width: 24px; background: var(--c-accent); }
.carousel__dots--on-dark .carousel__dot { background: var(--c-on-dark-line); }
.carousel__dots--on-dark .carousel__dot.is-active { background: var(--c-white); }

.carousel__progress {
    position: absolute;
    left: 0; right: 0; bottom: 0;
    height: 3px;
    background: rgba(255, 255, 255, .24);
    z-index: 3;
}
.carousel__progress-bar {
    height: 100%;
    width: 0;
    background: var(--c-white);
}

/* Cross-fading slides */
.slides { position: relative; }
.slide {
    position: absolute;
    inset: 0;
    opacity: 0;
    visibility: hidden;
    transition: opacity 500ms var(--e-out), visibility 500ms;
}
.slide.is-active { opacity: 1; visibility: visible; position: relative; }

/* Horizontal scroll-snap track (mobile card rails, poster rail) */
.rail {
    display: grid;
    grid-auto-flow: column;
    gap: var(--grid-gap);
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    overscroll-behavior-x: contain;
    scrollbar-width: none;
    padding-bottom: 4px;
}
.rail::-webkit-scrollbar { display: none; }
.rail > * { scroll-snap-align: start; }

/* ---- Password field with the show/hide eye ---- */
/* Every password box on the public site is built from
   app/views/frontend/partials/password-field.php, so the eye is never
   present on some and missing from others. */
.pw { position: relative; }
.pw__input { padding-right: 52px; }
.pw__toggle {
    position: absolute;
    right: 6px;
    top: 50%;
    transform: translateY(-50%);
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 0;
    border-radius: var(--r-sm);
    background: none;
    color: var(--c-grey-400);
    font-size: 16px;
    cursor: pointer;
    transition: color var(--t-fast) var(--e-out), background var(--t-fast) var(--e-out);
}
@media (hover: hover) {
    .pw__toggle:hover { color: var(--c-ink); background: var(--c-grey-100); }
}
.pw__toggle:focus-visible {
    outline: 2px solid var(--c-accent);
    outline-offset: 2px;
    color: var(--c-ink);
}