/* Appeal to the Rector — scoped styles (prefix: .ra-).
   The same tokens as the University pages and the student survey: the brand
   blue (#0096db) and the Roboto Slab font come from base.html; error and
   success colours from the Bootstrap theme. The hero follows the About Us /
   Rector's Speech hero (about-university.css), the form the survey's
   (survey.css), the Rector's card the Rector's Speech page's. */

/* .ra-embed: the same form in a section of another page (the Rector's
   Speech), which brings its own holder, hero and section heading. */
.ra-page,
.ra-embed {
    --ra-primary: #0096db;
    --ra-primary-dark: #0987c2;
    --ra-primary-deep: #075e87;
    --ra-ink: #1e293b;
    --ra-muted: #64748b;
    --ra-line: #e2e8f0;
    --ra-bg-soft: #f4f8fb;
    --ra-tint: rgba(0, 150, 219, .12);
    --ra-radius: 16px;
    --ra-shadow: 0 10px 30px -12px rgba(2, 74, 110, .25);
    --ra-space: clamp(48px, 7vw, 96px);
    color: var(--ra-ink);
}

.ra-page {
    overflow-x: hidden;
}

.ra-page .container {
    max-width: 1200px;
}

/* the blocks the switches show and hide: `hidden` wins over their grid */
.ra-page [hidden],
.ra-embed [hidden] {
    display: none !important;
}

.ra-page a:focus-visible {
    outline: 3px solid var(--ra-primary);
    outline-offset: 3px;
    border-radius: 6px;
}

.ra-hero a:focus-visible {
    outline-color: #fff;
}

.ra-section {
    padding: var(--ra-space) 0;
    background: var(--ra-bg-soft);
}

/* ---------- Buttons ---------- */
.ra-btn {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 13px 24px;
    border-radius: 999px;
    font-weight: 600;
    font-size: 15px;
    line-height: 1.2;
    text-decoration: none;
    border: 2px solid transparent;
    transition: transform .15s ease, box-shadow .15s ease, background .15s ease, color .15s ease;
    cursor: pointer;
}

.ra-btn:hover {
    transform: translateY(-2px);
    text-decoration: none;
}

.ra-btn--primary {
    background: var(--ra-primary);
    color: #fff;
    box-shadow: 0 8px 20px -8px rgba(0, 150, 219, .8);
}

.ra-btn--primary:hover {
    background: var(--ra-primary-dark);
    color: #fff;
}

/* the second action on the white panel; the family's ghost button is for the blue hero */
.ra-btn--outline {
    background: #fff;
    color: var(--ra-primary-dark);
    border-color: var(--ra-primary);
}

.ra-btn--outline:hover {
    background: var(--ra-tint);
    color: var(--ra-primary-deep);
}

.ra-btn:focus-visible {
    outline: 3px solid var(--ra-primary);
    outline-offset: 3px;
}

.ra-btn:disabled,
.ra-btn[aria-disabled="true"] {
    cursor: progress;
    opacity: .7;
    transform: none;
}

/* ---------- Hero ---------- */
.ra-hero {
    position: relative;
    color: #fff;
    padding: clamp(48px, 8vw, 104px) 0 clamp(44px, 7vw, 84px);
    background:
        radial-gradient(120% 120% at 85% 0%, rgba(255, 255, 255, .16), transparent 55%),
        linear-gradient(135deg, var(--ra-primary) 0%, var(--ra-primary-dark) 45%, var(--ra-primary-deep) 100%);
    overflow: hidden;
}

/* the page's motif on the right; from 992px only: on a narrower hero it
   would sit behind the text */
.ra-hero__motif {
    display: none;
    position: absolute;
    right: max(24px, calc((100% - 1200px) / 2));
    top: 50%;
    width: min(36%, 400px);
    height: auto;
    transform: translateY(-50%);
    pointer-events: none;
}

.ra-hero__orbit {
    fill: none;
    stroke: rgba(255, 255, 255, .16);
    stroke-width: 1.5;
    stroke-dasharray: 4 8;
}

.ra-hero__shape {
    fill: rgba(255, 255, 255, .16);
    stroke: #fff;
    stroke-width: 4;
    stroke-linejoin: round;
}

.ra-hero__line {
    fill: none;
    stroke: rgba(255, 255, 255, .8);
    stroke-width: 6;
    stroke-linecap: round;
    stroke-linejoin: round;
}

/* the paper plane's trail */
.ra-hero__route {
    fill: none;
    stroke: rgba(255, 255, 255, .55);
    stroke-width: 4;
    stroke-linecap: round;
    stroke-dasharray: 2 12;
}

.ra-hero__dot {
    fill: #fff;
}

@media (prefers-reduced-motion: no-preference) {
    /* the lines are drawn once; every line has pathLength="100" */
    .ra-hero__line {
        stroke-dasharray: 100;
        stroke-dashoffset: 100;
        animation: ra-draw .9s ease-out .2s forwards;
    }
}

@keyframes ra-draw {
    to {
        stroke-dashoffset: 0;
    }
}

.ra-hero__inner {
    position: relative;
    z-index: 1;
}

.ra-breadcrumb .breadcrumb {
    background: transparent;
    padding: 0;
    font-size: 14px;
    flex-wrap: wrap;
}

.ra-breadcrumb .breadcrumb-item,
.ra-breadcrumb .breadcrumb-item a,
.ra-breadcrumb .breadcrumb-item.active {
    color: rgba(255, 255, 255, .85);
}

.ra-breadcrumb .breadcrumb-item + .breadcrumb-item::before {
    color: rgba(255, 255, 255, .55);
}

.ra-hero__eyebrow {
    text-transform: uppercase;
    letter-spacing: .16em;
    font-size: 13px;
    font-weight: 600;
    opacity: .85;
    margin: 18px 0 10px;
}

.ra-hero__title {
    max-width: 680px;
    font-size: clamp(30px, 5vw, 54px);
    font-weight: 800;
    line-height: 1.12;
    margin: 0 0 20px;
    color: #fff;
}

.ra-hero__lead {
    color: rgba(255, 255, 255, .92);
    font-size: clamp(15px, 1.6vw, 18px);
    line-height: 1.7;
    max-width: 640px;
    margin: 0;
}

/* ---------- Layout: the form, with the Rector's card and the steps beside it ---------- */
.ra-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas:
        "rector"
        "form"
        "info";
    gap: 24px;
    max-width: 1100px;
    margin: 0 auto;
}

.ra-rector {
    grid-area: rector;
}

/* as tall as its fields, not as the column beside it */
.ra-form {
    grid-area: form;
    align-self: start;
}

.ra-info {
    grid-area: info;
}

/* in another page's section: the form and the steps, without the Rector's card */
.ra-layout--embedded {
    grid-template-areas:
        "form"
        "info";
}

/* ---------- Panels ---------- */
.ra-panel,
.ra-rector,
.ra-info {
    background: #fff;
    border: 1px solid var(--ra-line);
    border-radius: var(--ra-radius);
    box-shadow: var(--ra-shadow);
}

.ra-panel {
    padding: clamp(24px, 4vw, 40px);
}

.ra-panel__title {
    font-size: clamp(20px, 2.4vw, 26px);
    font-weight: 700;
    margin: 0 0 12px;
    color: var(--ra-ink);
}

/* ---------- The Rector's card ---------- */
/* on phones and tablets a strip above the form: the photo beside the name */
.ra-rector {
    display: flex;
    align-items: center;
    gap: 18px;
    padding: 16px;
    overflow: hidden;
}

/* the photo whole: the Staff photos are square */
.ra-rector__photo {
    flex: none;
    width: 88px;
    aspect-ratio: 1 / 1;
    border-radius: 12px;
    overflow: hidden;
    background: var(--ra-bg-soft);
}

.ra-rector__photo img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* without a photo, the initials stand in its place */
.ra-rector__placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    font-size: 28px;
    font-weight: 800;
    letter-spacing: .04em;
    color: rgba(0, 150, 219, .35);
    background:
        radial-gradient(circle at 50% 38%, rgba(0, 150, 219, .14), transparent 60%),
        var(--ra-bg-soft);
}

.ra-rector__body {
    min-width: 0;
}

.ra-rector__badge {
    display: inline-block;
    margin-bottom: 8px;
    padding: 4px 12px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: #fff;
    background: linear-gradient(135deg, var(--ra-primary), var(--ra-primary-deep));
}

.ra-rector__name {
    margin: 0 0 4px;
    font-size: clamp(17px, 2.2vw, 22px);
    font-weight: 700;
    line-height: 1.35;
    color: var(--ra-ink);
}

.ra-rector__role {
    margin: 0;
    font-size: 14px;
    line-height: 1.55;
    color: var(--ra-muted);
}

.ra-rector__link {
    display: inline-block;
    margin-top: 10px;
    font-size: 14px;
    font-weight: 600;
    color: var(--ra-primary-dark);
    text-decoration: none;
}

.ra-rector__link:hover {
    color: var(--ra-primary-deep);
    text-decoration: underline;
}

/* inline, after a no-break space: the arrow stays with the last word when the title wraps */
.ra-rector__link i {
    display: inline;
    margin-left: 2px;
    font-size: 12px;
}

/* ---------- Form ---------- */
.ra-form__note {
    color: var(--ra-muted);
    font-size: 15px;
    margin: 0 0 24px;
}

.ra-form__row {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0 20px;
}

/* the student's year, programme and group: the year is short */
.ra-form__row--three {
    grid-template-columns: minmax(0, .7fr) minmax(0, 1.5fr) minmax(0, 1fr);
}

.ra-fieldset {
    margin: 0 0 8px;
    padding: 0;
    border: 0;
    min-width: 0;
}

.ra-fieldset__legend {
    float: none;
    width: auto;
    margin: 0 0 16px;
    padding: 0;
    font-size: 13px;
    font-weight: 700;
    line-height: 1.4;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: var(--ra-muted);
}

.ra-field {
    margin-bottom: 20px;
}

.ra-field__head {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 16px;
}

.ra-field__label {
    display: block;
    font-size: 15px;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--ra-ink);
}

.ra-field__required {
    color: var(--bs-danger);
    margin-left: 4px;
}

.ra-field__input {
    display: block;
    width: 100%;
    padding: 12px 16px;
    border: 1px solid var(--ra-line);
    border-radius: 12px;
    font-size: 15px;
    line-height: 1.5;
    background: #fff;
    color: var(--ra-ink);
    transition: border-color .15s ease, box-shadow .15s ease;
}

/* the muted token, lighter: an example must not read as a value already typed */
.ra-field__input::placeholder {
    color: var(--ra-muted);
    opacity: .7;
}

textarea.ra-field__input {
    min-height: 180px;
    resize: vertical;
}

.ra-field__input:focus {
    outline: none;
    border-color: var(--ra-primary);
    box-shadow: 0 0 0 3px rgba(0, 150, 219, .18);
}

.ra-field--invalid .ra-field__input {
    border-color: var(--bs-danger);
}

.ra-field--invalid .ra-field__input:focus {
    box-shadow: 0 0 0 3px rgba(var(--bs-danger-rgb), .18);
}

.ra-field__counter {
    color: var(--ra-muted);
    font-size: 13px;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.ra-field__counter--full {
    color: var(--bs-danger);
    font-weight: 600;
}

.ra-field__hint {
    color: var(--ra-muted);
    font-size: 13px;
    margin: 8px 0 0;
}

.ra-field__error {
    color: var(--bs-danger);
    font-size: 14px;
    margin: 8px 0 0;
}

/* ---------- Switches (Bootstrap's .form-switch, in the page's colours) ---------- */
.ra-switch {
    margin: 0 0 20px;
}

.ra-switch .form-check-input,
.ra-consent .form-check-input {
    cursor: pointer;
}

.ra-switch .form-check-input:checked,
.ra-consent .form-check-input:checked {
    background-color: var(--ra-primary);
    border-color: var(--ra-primary);
}

.ra-switch .form-check-input:focus,
.ra-consent .form-check-input:focus {
    border-color: var(--ra-primary);
    box-shadow: 0 0 0 3px rgba(0, 150, 219, .18);
}

.ra-switch .form-check-label {
    font-size: 15px;
    font-weight: 600;
    color: var(--ra-ink);
    cursor: pointer;
}

/* the anonymous switch: set apart, above everything it hides */
.ra-anon {
    margin: 0 0 28px;
    padding: 16px 20px;
    border: 1px solid var(--ra-line);
    border-radius: 12px;
    background: #fff;
}

.ra-anon .ra-switch {
    margin-bottom: 8px;
}

.ra-anon__hint {
    display: flex;
    gap: 8px;
    align-items: baseline;
}

.ra-student {
    margin: 4px 0 0;
}

.ra-consent {
    margin: 0 0 24px;
}

.ra-consent .form-check-label {
    font-size: 14px;
    line-height: 1.55;
    color: var(--ra-ink);
    cursor: pointer;
}

.ra-consent.ra-field--invalid .form-check-input {
    border-color: var(--bs-danger);
}

/* ---------- Errors ---------- */
.ra-alert {
    display: flex;
    gap: 12px;
    align-items: flex-start;
    padding: 16px 20px;
    margin-bottom: 24px;
    border: 1px solid rgba(var(--bs-danger-rgb), .35);
    border-radius: 12px;
    background: rgba(var(--bs-danger-rgb), .06);
    color: var(--ra-ink);
    font-size: 15px;
    line-height: 1.6;
}

.ra-alert__icon {
    color: var(--bs-danger);
    font-size: 18px;
    line-height: 1.5;
}

.ra-alert__body p {
    margin: 0;
}

/* ---------- Actions ---------- */
.ra-form__actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 14px 24px;
    margin-top: 8px;
}

.ra-form__privacy {
    display: flex;
    gap: 8px;
    align-items: baseline;
    color: var(--ra-muted);
    font-size: 13px;
    line-height: 1.5;
    margin: 0;
    flex: 1 1 240px;
}

/* Kept out of sight and out of the tab order; only bots fill it in. */
.ra-hp {
    position: absolute;
    left: -10000px;
    width: 1px;
    height: 1px;
    overflow: hidden;
}

/* ---------- How it works ---------- */
.ra-info {
    padding: 24px;
}

.ra-info__title {
    font-size: 18px;
    font-weight: 700;
    margin: 0 0 18px;
    color: var(--ra-ink);
}

.ra-steps {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: 16px;
}

.ra-step {
    display: flex;
    align-items: center;
    gap: 14px;
}

.ra-step__icon {
    flex: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 12px;
    font-size: 16px;
    color: var(--ra-primary-dark);
    background: var(--ra-tint);
}

.ra-step__text {
    margin: 0;
    font-size: 14px;
    line-height: 1.55;
    color: var(--ra-ink);
}

/* ---------- Sent / closed ---------- */
.ra-state {
    max-width: 820px;
    margin: 0 auto;
    text-align: center;
}

.ra-state__icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 56px;
    height: 56px;
    border-radius: 14px;
    font-size: 22px;
    color: #fff;
    margin-bottom: 18px;
}

.ra-state__icon--success {
    background: var(--bs-success);
}

.ra-state__icon--muted {
    background: var(--ra-muted);
}

.ra-state__number {
    display: inline-block;
    margin: 0 0 16px;
    padding: 6px 16px;
    border-radius: 999px;
    font-size: 15px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    color: var(--ra-primary-deep);
    background: var(--ra-tint);
}

.ra-state__text {
    color: var(--ra-muted);
    font-size: 16px;
    line-height: 1.75;
    max-width: 560px;
    margin: 0 auto;
}

.ra-state__actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 12px;
    margin-top: 28px;
}

/* ---------- An appeal's private page ---------- */
.ra-status {
    max-width: 820px;
    margin: 0 auto;
}

/* how far the appeal has come: the "How it works" steps, side by side where they fit */
.ra-track {
    margin: 24px 0 32px;
}

.ra-track .ra-step__icon {
    color: var(--ra-muted);
    background: var(--ra-bg-soft);
}

.ra-track .ra-step__text {
    color: var(--ra-muted);
}

.ra-track .ra-step--done .ra-step__icon {
    color: #fff;
    background: var(--ra-primary);
}

.ra-track .ra-step--done .ra-step__text {
    color: var(--ra-ink);
    font-weight: 600;
}

.ra-answer {
    margin: 0 0 18px;
    padding: 2px 0 2px 18px;
    border-left: 3px solid var(--ra-primary);
}

.ra-answer__date {
    display: block;
    margin-bottom: 8px;
    font-size: 13px;
    color: var(--ra-muted);
}

/* the answer as it was written: its own line breaks */
.ra-answer__text {
    margin: 0;
    font-size: 15px;
    line-height: 1.7;
    color: var(--ra-ink);
    white-space: pre-line;
    overflow-wrap: anywhere;
}

.ra-status__empty {
    margin: 0 0 14px;
    color: var(--ra-muted);
    font-size: 15px;
    line-height: 1.7;
}

.ra-status__telegram {
    margin: 24px 0 0;
}

.ra-status__connected {
    display: flex;
    gap: 8px;
    align-items: baseline;
    margin: 24px 0 0;
    font-size: 14px;
    color: var(--ra-ink);
}

.ra-status__private {
    margin: 24px 0 0;
    padding-top: 16px;
    border-top: 1px solid var(--ra-line);
}

/* ---------- Columns ---------- */
@media (min-width: 992px) {
    .ra-hero__motif {
        display: block;
    }

    /* the form on the left; the Rector's card and the steps beside it */
    .ra-layout {
        grid-template-columns: minmax(0, 1fr) 300px;
        grid-template-rows: auto 1fr;
        grid-template-areas:
            "form rector"
            "form info";
        gap: 24px 32px;
    }

    .ra-info {
        align-self: start;
    }

    .ra-track {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }

    .ra-layout--embedded {
        grid-template-rows: auto;
        grid-template-areas: "form info";
    }

    .ra-rector {
        display: block;
        padding: 0;
    }

    .ra-rector__photo {
        width: 100%;
        border-radius: 0;
    }

    .ra-rector__placeholder {
        font-size: 72px;
    }

    .ra-rector__body {
        padding: 22px 22px 24px;
    }

    .ra-rector__badge {
        margin-bottom: 12px;
        padding: 6px 16px;
        font-size: 13px;
    }

    .ra-rector__name {
        margin-bottom: 6px;
        font-size: clamp(20px, 2.2vw, 22px);
    }
}

/* ---------- Responsive ---------- */
@media (max-width: 767px) {
    .ra-form__row--three {
        grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    }

    .ra-form__row--three > :nth-child(2) {
        grid-column: 1 / -1;
        grid-row: 2;
    }
}

@media (max-width: 575px) {
    .ra-form__row,
    .ra-form__row--three {
        grid-template-columns: 1fr;
    }

    .ra-form__row--three > :nth-child(2) {
        grid-column: auto;
        grid-row: auto;
    }

    .ra-rector__photo {
        width: 72px;
    }
}

@media (max-width: 400px) {
    .ra-page .container {
        padding-left: 16px;
        padding-right: 16px;
    }

    .ra-btn {
        width: 100%;
        justify-content: center;
    }
}

@media (prefers-reduced-motion: reduce) {
    .ra-btn {
        transition: none;
    }

    .ra-btn:hover {
        transform: none;
    }
}
