/*
 * ctnlist application styles: a thin layer over Bootstrap 6. Prefer Bootstrap
 * classes in templates; add rules here only for the shared layout and for
 * patterns Bootstrap has no utility for.
 *
 * Bootstrap 6 keeps its CSS in cascade layers and its utilities are not
 * !important, so anything outside a layer would beat every utility class.
 * These rules therefore live in Bootstrap's own "custom" layer: above its
 * components, below its helpers and utilities.
 */

:root {
    --app-font-sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", "Noto Sans", "Liberation Sans", Arial, sans-serif;
    --bs-body-font-family: var(--app-font-sans);
}

@layer custom {

/* Header: the site navbar plus, for staff, the administration bar. */
.app-header .navbar-brand {
    font-weight: 600;
    letter-spacing: -0.01em;
}

.app-header .navbar-brand .bi {
    color: var(--bs-primary-fg);
}

.app-header .nav-link.active {
    font-weight: 600;
}

.app-navbar .nav-link.active {
    color: var(--bs-primary-fg);
}

/* The lg breakpoint, where the navigation leaves its drawer (Bootstrap 6: 1024px). */
@media (min-width: 1024px) {
    .app-navbar .navbar-nav > .nav-item > a.nav-link.active {
        box-shadow: inset 0 -2px 0 var(--bs-primary-base);
    }
}

.app-adminbar {
    font-size: 0.875rem;
}

/* The administration bar is a slim second row, not a second full-height navbar. */
.app-adminbar {
    --bs-navbar-min-height: 2.5rem;
    --bs-navbar-padding-y: 0.125rem;
}

/* Message boxes keep the space below them that Bootstrap 5 gave every alert. */
.app-content .alert {
    margin-bottom: var(--bs-spacer);
}

/* Page content. Forms are grouped in bordered fieldsets or cards. */
.app-content fieldset > legend {
    font-size: 1.25rem;
    font-weight: 600;
}

/* Data tables: compact, readable headings on a tinted row (Bootstrap 5's thead.table-light). */
.app-content .table {
    font-size: 0.9375rem;
}

.app-content .table > thead > tr > * {
    --bs-table-bg-type: var(--bs-bg-2);
}

/* Visually hidden headings (.visually-hidden is absolutely positioned) stay inside
   the scrolling wrapper instead of widening the page on narrow screens. */
.app-content .table-responsive {
    position: relative;
}

.app-content .table > thead th {
    font-weight: 600;
    white-space: nowrap;
}

/* Single-purpose forms (sign-in, consent, confirmations) stay readable on wide screens. */
.app-narrow {
    max-width: 40rem;
    margin-inline: auto;
}

/* The hidden trap field of the sign-in and subscribe forms (BotTrapType): off-screen, not display: none, which form bots skip. */
.app-trap {
    position: absolute;
    left: -10000px;
    width: 1px;
    height: 1px;
    overflow: hidden;
}

/* The acceptable use policy (rendered from docs/AUP.md): one readable column. */
.app-policy {
    max-width: 52rem;
    margin-inline: auto;
}
.app-policy h2 {
    margin-top: 2rem;
}
.app-policy li {
    margin-bottom: 0.25rem;
}

/* Tabs scroll sideways on narrow screens instead of wrapping (Settings). */
.app-tabs {
    scrollbar-width: thin;
}

.app-tabs .nav-link {
    white-space: nowrap;
}

.border-dashed {
    border-style: dashed !important;
}

.app-footer a {
    text-decoration: none;
}

.app-footer a:hover {
    text-decoration: underline;
}

/* Symfony forms: required fields (label.required, legend.required). */
.form-label.required::after,
.form-field > label.required::after {
    content: " *";
    color: var(--bs-danger-fg);
}

/* Help text written beside a control by hand (outside a .form-field, whose grid spaces it) keeps its small gap. */
:not(.form-field, .form-field-content, .form-group) > .form-text {
    margin-top: 0.25rem;
}

/* A menu of checkboxes under a select-like toggle (the message editor's lists): as wide as the toggle, scrolling when long. */
.app-checklist {
    min-width: 100%;
    max-width: min(32rem, 90vw);
    max-height: 18rem;
    overflow-y: auto;
    padding: 0.5rem 0.75rem;
}

.app-checklist > .form-field + .form-field {
    margin-top: 0.375rem;
}

/* Profile pictures: always round, always cropped to fill (the stored image is square). */
.app-avatar {
    width: 2rem;
    height: 2rem;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
    background-color: var(--bs-secondary-bg);
}

.app-avatar-lg {
    width: 8rem;
    height: 8rem;
}

/* The profile picture editor (assets/profile_image.js): a square stage with a round mask. */
.app-image-stage {
    position: relative;
    width: 100%;
    max-width: 20rem;
    aspect-ratio: 1;
    touch-action: none;
    cursor: grab;
    border-radius: var(--bs-radius-4);
    overflow: hidden;
    background-color: var(--bs-secondary-bg);
}

.app-image-stage.is-dragging {
    cursor: grabbing;
}

.app-image-stage canvas {
    display: block;
    width: 100%;
    height: 100%;
}

/* Darkens what falls outside the circle the navbar and profile show. */
.app-image-stage::after {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: 50%;
    box-shadow: 0 0 0 100vmax rgb(0 0 0 / 0.45);
    outline: 2px solid rgb(255 255 255 / 0.85);
    pointer-events: none;
}

.app-image-preview {
    width: 6rem;
    height: 6rem;
    border-radius: 50%;
}

/* htmx (templates/CLAUDE.md, "htmx"). An indicator shows only while its request runs, after a
   short pause so that a quick answer never flashes it. */
.htmx-indicator {
    opacity: 0;
    visibility: hidden;
}

.htmx-request .htmx-indicator,
.htmx-request.htmx-indicator {
    opacity: 1;
    visibility: visible;
    transition: opacity 200ms ease-in 300ms;
}

/* A value with its copy button (layout/_copy.html.twig). */
.app-copy {
    display: inline-flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .5rem;
    max-width: 100%;
}

.app-copy > code {
    overflow-wrap: anywhere;
}

/* Set up sending: the steps, one open at a time. */
.app-steps > li + li {
    margin-top: 1rem;
}

.app-steps .app-step-mark {
    flex: none;
    width: 2rem;
    height: 2rem;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
}

/* A region brought into view after a page turn stays clear of the sticky header. */
.app-region {
    scroll-margin-top: 8rem;
}

} /* @layer custom */
