/* Auth modal (login / registration / forgotten password) — same tokens as site.css / footer.css */
.auth-modal {
    --auth-ink: #26211d;
    --auth-muted: #574f48;
    --auth-line: #e4ddd5;
    --auth-field-border: #c4bbb2;
    --auth-surface-alt: #f4f2ef;
    --auth-accent: #730b09;
    --auth-accent-dark: #5a0807;
    --auth-accent-soft: #f6eceb;
    --auth-ring: rgba(115, 11, 9, .16);
    --auth-ok: #2f6b45;
    --auth-danger: #b42318;
    --auth-radius: 3px;
}

/* Open animation: short fade */
.auth-modal.fade {
    transition: opacity .15s linear;
}
.auth-modal.fade .modal-dialog {
    transform: translateY(8px);
    transition: transform .2s ease-out, max-width .2s ease;
}
.auth-modal.show .modal-dialog {
    transform: none;
}

/* Dialog width per pane */
@media (min-width: 576px) {
    .auth-modal .auth-dialog[data-size="sm"] {
        --bs-modal-width: 400px;
    }
    .auth-modal .auth-dialog[data-size="lg"] {
        --bs-modal-width: 720px;
    }
}

.auth-modal .auth-content {
    border: 0;
    border-top: 4px solid var(--auth-accent);
    border-radius: 8px;
    overflow: hidden;
    background: #fff;
    color: var(--auth-ink);
    box-shadow: 0 20px 50px rgba(38, 33, 29, .22);
}
.auth-modal :focus-visible {
    outline: 2px solid var(--auth-accent);
    outline-offset: 2px;
}

/* Panes */
.auth-modal .auth-pane {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-height: 0;
}
.auth-modal .auth-pane[hidden] {
    display: none;
}
.auth-modal .auth-pane.is-entering {
    animation: auth-pane-in .18s ease-out;
}
@keyframes auth-pane-in {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* Header */
.auth-modal .auth-header {
    align-items: center;
    gap: .75rem;
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--auth-line);
    background: #fff;
}
.auth-modal .auth-header-icon {
    flex: 0 0 auto;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    font-size: .9rem;
    color: var(--auth-accent);
    background: var(--auth-accent-soft);
}
.auth-modal .auth-header-text {
    flex: 1 1 auto;
    min-width: 0;
}
.auth-modal .auth-title {
    margin: 0 0 .1rem;
    font-family: var(--heading-font, "Raleway", sans-serif);
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--auth-ink);
}
.auth-modal .auth-subtitle {
    margin: 0;
    font-size: .82rem;
    line-height: 1.4;
    color: var(--auth-muted);
}
.auth-modal .auth-close {
    align-self: flex-start;
    margin: 0;
    flex: 0 0 auto;
    font-size: .8rem;
}

/* Form layout */
.auth-modal .auth-form {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-height: 0;
    overflow: hidden;
}
.auth-modal .auth-body {
    padding: 1.25rem 1.5rem;
}
.auth-modal .auth-body .row {
    --bs-gutter-x: .75rem;
    --bs-gutter-y: .75rem;
}
.auth-modal .auth-section + .auth-section {
    margin-top: 1.25rem;
}
.auth-modal .auth-section-title {
    margin: 0 0 .75rem;
    padding-bottom: .4rem;
    border-bottom: 1px solid var(--auth-line);
    font-family: inherit;
    font-size: .85rem;
    font-weight: 700;
    color: var(--auth-ink);
}

/* Fields */
.auth-modal .auth-label {
    display: flex;
    align-items: center;
    gap: .5rem;
    margin-bottom: .2rem;
    font-size: .76rem;
    font-weight: 600;
    letter-spacing: .01em;
    color: var(--auth-muted);
}
.auth-modal .auth-optional {
    font-size: .78rem;
    font-weight: 400;
    color: var(--auth-muted);
}
.auth-modal .auth-optional::before {
    content: "(";
}
.auth-modal .auth-optional::after {
    content: ")";
}
.auth-modal .auth-input-wrap {
    position: relative;
}
.auth-modal .auth-input {
    height: 32px;
    padding: 0 .6rem;
    border: 1px solid var(--auth-field-border);
    border-radius: 2px;
    background-color: #fff;
    color: var(--auth-ink);
    font-size: .85rem;
    line-height: 1.2;
    box-shadow: inset 0 1px 1px rgba(38, 33, 29, .04);
    transition: border-color .15s ease, box-shadow .15s ease;
}
.auth-modal select.auth-input {
    padding-right: 2rem;
    background-position: right .6rem center;
    background-size: 12px 9px;
}
.auth-modal .auth-input--password {
    padding-right: 2.1rem;
}
.auth-modal .auth-input:hover {
    border-color: #8f857b;
}
.auth-modal .auth-input:focus {
    border-color: var(--auth-accent);
    box-shadow: 0 0 0 1px var(--auth-accent);
    outline: 0;
}
.auth-modal .auth-input.is-invalid,
.auth-modal .auth-input-wrap.is-invalid .auth-input {
    border-color: var(--auth-danger);
    box-shadow: 0 0 0 1px var(--auth-danger);
    background-image: none;
}
.auth-modal select.auth-input.is-invalid,
.auth-modal .auth-input-wrap.is-invalid select.auth-input {
    background-image: var(--bs-form-select-bg-img);
}
.auth-modal .auth-input.is-invalid:focus {
    box-shadow: 0 0 0 1px var(--auth-danger);
}
.auth-modal .auth-eye {
    position: absolute;
    right: .2rem;
    top: 50%;
    transform: translateY(-50%);
    width: 26px;
    height: 26px;
    font-size: .78rem;
    border: 0;
    border-radius: 2px;
    background: transparent;
    color: var(--auth-muted);
}
.auth-modal .auth-eye:hover {
    background: var(--auth-surface-alt);
    color: var(--auth-ink);
}
.auth-modal .auth-error {
    margin-top: .25rem;
    font-size: .78rem;
    font-weight: 600;
    color: var(--auth-danger);
}

/* Checkboxes */
.auth-modal .auth-check {
    flex: 0 0 auto;
    width: 1rem;
    height: 1rem;
    margin: .1rem 0 0;
    border: 1px solid var(--auth-field-border);
    border-radius: 2px;
    cursor: pointer;
}
.auth-modal .auth-check:checked {
    background-color: var(--auth-accent);
    border-color: var(--auth-accent);
}
.auth-modal .auth-check:focus {
    border-color: var(--auth-accent);
    box-shadow: 0 0 0 3px var(--auth-ring);
}
.auth-modal .auth-inline-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: .5rem 1rem;
}
.auth-modal .auth-remember {
    display: flex;
    align-items: center;
    gap: .45rem;
    font-size: .82rem;
    color: var(--auth-ink);
    cursor: pointer;
}
.auth-modal .auth-remember .auth-check {
    margin: 0;
}

/* Links */
.auth-modal .auth-link {
    color: var(--auth-accent);
    font-weight: 600;
    text-decoration: none;
}
.auth-modal .auth-link:hover {
    color: var(--auth-accent-dark);
    text-decoration: underline;
    text-underline-offset: 2px;
}
.auth-modal .auth-link--muted {
    font-size: .82rem;
}

/* Password rules */
.auth-modal .auth-rules {
    list-style: none;
    margin: 0;
    padding: .6rem .8rem;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: .25rem 1rem;
    border-radius: var(--auth-radius);
    background: var(--auth-surface-alt);
}
.auth-modal .auth-rules li {
    display: flex;
    align-items: flex-start;
    gap: .4rem;
    font-size: .76rem;
    line-height: 1.4;
    color: var(--auth-muted);
}
.auth-modal .auth-rules li i {
    margin-top: .12rem;
    color: #c4bab0;
}
.auth-modal .auth-rules li.is-met,
.auth-modal .auth-rules li.is-met i {
    color: var(--auth-ok);
}

/* Consents */
.auth-modal .auth-consent {
    display: flex;
    gap: .6rem;
    padding: .65rem .8rem;
    border: 1px solid var(--auth-line);
    border-radius: var(--auth-radius);
    background: var(--auth-surface-alt);
}
.auth-modal .auth-consent:has(.auth-check:checked) {
    border-color: var(--auth-accent);
    background: var(--auth-accent-soft);
}
.auth-modal .auth-consent.is-invalid {
    border-color: var(--auth-danger);
}
.auth-modal .auth-consent-text {
    font-size: .78rem;
    line-height: 1.5;
    color: var(--auth-ink);
    cursor: pointer;
}
.auth-modal .auth-consent-text--long {
    max-height: 7rem;
    overflow-y: auto;
    padding-right: .5rem;
}
.auth-modal .auth-consent-text a {
    color: var(--auth-accent);
    font-weight: 600;
    word-break: break-word;
}

/* Footer */
.auth-modal .auth-footer {
    justify-content: space-between;
    gap: .75rem;
    padding: .75rem 1.5rem;
    border-top: 1px solid var(--auth-line);
    background: var(--auth-surface-alt);
}
.auth-modal .auth-footer > * {
    margin: 0;
}
.auth-modal .auth-footer--stacked {
    flex-direction: column;
    align-items: stretch;
    text-align: center;
}
.auth-modal .auth-footer-text {
    font-size: .82rem;
    color: var(--auth-muted);
}
.auth-modal .auth-submit,
.auth-modal .auth-submit:focus {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .45rem;
    min-height: 34px;
    padding: 0 1.25rem;
    border: 0;
    border-radius: var(--auth-radius);
    font-size: .88rem;
    font-weight: 600;
    color: #fff;
    background: var(--auth-accent);
    transition: background-color .15s ease;
}
.auth-modal .auth-submit:hover,
.auth-modal .auth-submit:active {
    color: #fff;
    background: var(--auth-accent-dark);
}
.auth-modal .auth-secondary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 34px;
    padding: 0 1rem;
    border: 1px solid var(--auth-field-border);
    border-radius: var(--auth-radius);
    background: #fff;
    color: var(--auth-ink);
    font-size: .88rem;
    font-weight: 600;
}
.auth-modal .auth-secondary:hover {
    background: var(--auth-surface-alt);
    color: var(--auth-ink);
}

/* Standalone auth page (password reset) — the modal card rendered in the page flow */
.auth-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: calc(100vh - var(--site-header-h, 80px));
    padding: 3rem 1rem;
    background: #f4f2ef;
}
.auth-modal.auth-page-card {
    width: 100%;
    max-width: 420px;
}
.auth-modal.auth-page-card .auth-header,
.auth-modal.auth-page-card .auth-footer {
    display: flex;
}
.auth-modal .auth-header-icon--warning {
    color: var(--auth-danger);
    background: #fdecea;
}
.auth-modal .auth-text {
    margin: 0;
    font-size: .88rem;
    line-height: 1.55;
    color: var(--auth-ink);
}
.auth-modal .auth-account {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: .25rem .5rem;
    margin-bottom: 1rem;
    padding: .55rem .8rem;
    border: 1px solid var(--auth-line);
    border-radius: var(--auth-radius);
    background: var(--auth-surface-alt);
    font-size: .82rem;
}
.auth-modal .auth-account i {
    color: var(--auth-muted);
}
.auth-modal .auth-account-label {
    color: var(--auth-muted);
}
.auth-modal .auth-account-email {
    min-width: 0;
    color: var(--auth-ink);
    overflow-wrap: anywhere;
}
.auth-modal .auth-rules--stacked {
    grid-template-columns: 1fr;
}

@media (max-width: 575.98px) {
    .auth-modal .auth-content {
        border-radius: 0;
    }
    .auth-page {
        align-items: flex-start;
        padding: 1.5rem 1rem;
    }
    .auth-modal.auth-page-card .auth-content {
        border-radius: 8px;
    }
    .auth-modal .auth-header,
    .auth-modal .auth-body,
    .auth-modal .auth-footer {
        padding-left: 1rem;
        padding-right: 1rem;
    }
    .auth-modal .auth-footer {
        flex-direction: column-reverse;
        align-items: stretch;
        text-align: center;
    }
    .auth-modal .auth-footer--stacked {
        flex-direction: column;
    }
}

@media (prefers-reduced-motion: reduce) {
    .auth-modal.fade,
    .auth-modal.fade .modal-dialog,
    .auth-modal .auth-pane.is-entering {
        transition: none;
        animation: none;
    }
}
