/* ==========================================================================
   Forms group: contact, applications, /form/{slug}, /enroll/{course}
   Builds on pages.css (pg-* tokens and components). Prefix: df- (dynamic
   form), fx- (page layouts).
   ========================================================================== */

[data-df-root] [hidden],
.fx-page [hidden] {
    display: none !important;
}

/* --------------------------------------------------------------------------
   Page layouts
   -------------------------------------------------------------------------- */
.fx-layout {
    display: grid;
    gap: clamp(1.25rem, 3vw, 2rem);
    align-items: start;
}

@media (min-width: 1024px) {
    .fx-layout {
        grid-template-columns: minmax(0, 1.65fr) minmax(18rem, 1fr);
    }

    .fx-layout--aside-first {
        grid-template-columns: minmax(17rem, 0.85fr) minmax(0, 1.75fr);
    }

    .fx-sticky {
        position: sticky;
        top: 6.5rem;
    }
}

.fx-panel {
    padding: clamp(1.25rem, 3.4vw, 2.25rem);
}

.fx-panel__head {
    margin-bottom: 1.5rem;
}

.fx-panel__head .pg-lede {
    font-size: 0.975rem;
}

.fx-stack {
    display: grid;
    gap: 1rem;
    min-width: 0;
}

/* Contact rows (address, phone, email, hours) */
.fx-info {
    display: grid;
    margin: 0;
    padding: 0;
    list-style: none;
}

.fx-info li {
    display: flex;
    gap: 0.9rem;
    align-items: flex-start;
    padding: 1rem 1.25rem;
    min-width: 0;
}

.fx-info li + li {
    border-top: 1px solid var(--pg-line);
}

.fx-info__label {
    margin: 0;
    color: var(--pg-muted);
    font-size: 0.8125rem;
    font-weight: 600;
}

.fx-info__value {
    margin: 0.15rem 0 0;
    color: var(--pg-ink);
    font-weight: 500;
    line-height: 1.5;
    overflow-wrap: anywhere;
}

a.fx-info__value {
    display: inline-block;
    text-decoration: none;
}

a.fx-info__value:hover {
    color: var(--pg-pink-ink);
}

.fx-info .pg-link {
    margin-top: 0.3rem;
    font-size: 0.875rem;
}

.fx-map {
    display: block;
    width: 100%;
    height: 260px;
    border: 0;
}

/* Quick contact list in the hero aside */
.fx-quick {
    padding: 1.15rem;
    background: rgba(255, 255, 255, 0.86);
    border: 1px solid var(--pg-line);
    border-radius: var(--pg-r-lg);
    box-shadow: var(--pg-shadow-sm);
}

.fx-quick__title {
    margin: 0;
    color: var(--pg-ink);
    font-weight: 650;
}

.fx-quick__text {
    margin: 0.2rem 0 0.85rem;
    color: var(--pg-muted);
    font-size: 0.875rem;
    line-height: 1.5;
}

.fx-quick__list {
    display: grid;
    gap: 0.5rem;
}

.fx-quick__item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    min-height: 3rem;
    padding: 0.5rem 0.75rem;
    border-radius: 14px;
    background: #fff;
    border: 1px solid var(--pg-line);
    color: var(--pg-ink);
    font-weight: 600;
    text-decoration: none;
    transition: border-color var(--motion-fast, 180ms), background-color var(--motion-fast, 180ms), transform var(--motion-fast, 180ms) var(--ease-ios, ease-out);
}

.fx-quick__item:hover {
    border-color: var(--pg-line-strong);
    background: #f8fafb;
}

.fx-quick__item:active {
    transform: scale(0.98);
}

.fx-quick__item:focus-visible {
    outline: none;
    box-shadow: var(--pg-focus);
}

.fx-quick__item .pg-icon {
    width: 2.25rem;
    height: 2.25rem;
    border-radius: 11px;
}

.fx-quick__item small {
    display: block;
    color: var(--pg-muted);
    font-size: 0.78rem;
    font-weight: 500;
}

.fx-quick__item > span:last-child {
    min-width: 0;
    overflow-wrap: anywhere;
}

/* Applications: process steps (a real sequence, so numbered) */
.fx-steps {
    display: grid;
    gap: 0;
    margin: 0;
    padding: 0;
    list-style: none;
    counter-reset: fxstep;
}

.fx-steps li {
    position: relative;
    display: flex;
    gap: 0.85rem;
    align-items: flex-start;
    padding-bottom: 1rem;
    color: var(--pg-text);
    font-size: 0.9375rem;
    line-height: 1.5;
}

.fx-steps li:last-child {
    padding-bottom: 0;
}

.fx-steps li:not(:last-child)::after {
    content: "";
    position: absolute;
    left: 0.875rem;
    top: 2rem;
    bottom: 0.25rem;
    width: 1px;
    background: var(--pg-line-strong);
}

.fx-steps__num {
    display: inline-grid;
    place-items: center;
    flex-shrink: 0;
    width: 1.75rem;
    height: 1.75rem;
    border-radius: 999px;
    background: var(--pg-sun-soft);
    color: var(--pg-sun-ink);
    font-size: 0.8125rem;
    font-weight: 700;
}

.fx-steps li > span:last-child {
    padding-top: 0.15rem;
}

/* --------------------------------------------------------------------------
   Dynamic form
   -------------------------------------------------------------------------- */
.df-grid {
    display: grid;
    gap: 1.15rem 1rem;
}

@media (min-width: 768px) {
    .df-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .df-span-2 {
        grid-column: 1 / -1;
    }
}

.df-heading {
    padding-top: 0.5rem;
}

.df-required-note {
    margin-top: -0.35rem;
}

.df-hp {
    position: absolute;
    left: -9999px;
    top: -9999px;
    width: 1px;
    height: 1px;
    overflow: hidden;
}

.df-group {
    display: grid;
    gap: 0.4rem;
    margin: 0;
    padding: 0;
    border: 0;
    min-width: 0;
}

.df-group legend {
    padding: 0;
    margin-bottom: 0.4rem;
}

.df-options {
    display: grid;
    gap: 0.5rem;
}

.df-option {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    min-height: 3rem;
    padding: 0.6rem 0.9rem;
    border: 1px solid var(--pg-line-strong);
    border-radius: 12px;
    background: #fff;
    color: var(--pg-ink);
    cursor: pointer;
    transition: border-color var(--motion-fast, 180ms), background-color var(--motion-fast, 180ms);
}

.df-option:hover {
    border-color: #b4c3cd;
}

.df-option:has(input:checked) {
    border-color: rgba(233, 30, 140, 0.45);
    background: var(--pg-pink-soft);
}

.df-option:has(input:focus-visible) {
    box-shadow: var(--pg-focus);
}

.df-option input {
    width: 1.15rem;
    height: 1.15rem;
    flex-shrink: 0;
    margin: 0;
    accent-color: var(--pg-pink);
}

.pg-field.is-invalid .df-option {
    border-color: rgba(192, 38, 61, 0.55);
}

/* File dropzone */
.df-drop {
    display: grid;
    justify-items: center;
    gap: 0.35rem;
    padding: 1.25rem 1rem;
    border: 1.5px dashed var(--pg-line-strong);
    border-radius: var(--pg-r-md);
    background: #fbfcfd;
    text-align: center;
    cursor: pointer;
    transition: border-color var(--motion-fast, 180ms), background-color var(--motion-fast, 180ms);
}

.df-drop:hover,
.df-drop.is-drag {
    border-color: var(--pg-sky-ink);
    background: var(--pg-sky-soft);
}

.df-drop.is-selected {
    border-style: solid;
    border-color: rgba(21, 128, 61, 0.45);
    background: var(--pg-ok-soft);
}

.df-drop.is-invalid {
    border-color: var(--pg-bad);
    background: #fffafb;
}

.df-drop:focus-within {
    box-shadow: var(--pg-focus);
}

.df-drop__icon {
    display: inline-grid;
    place-items: center;
    width: 2.75rem;
    height: 2.75rem;
    border-radius: 14px;
    background: #fff;
    border: 1px solid var(--pg-line);
    color: var(--pg-pink-ink);
}

.df-drop.is-selected .df-drop__icon {
    color: var(--pg-ok);
}

.df-drop__icon svg {
    width: 1.35rem;
    height: 1.35rem;
}

.df-drop__title {
    margin: 0.25rem 0 0;
    color: var(--pg-ink);
    font-weight: 600;
    font-size: 0.9375rem;
}

.df-drop__or,
.df-drop__count {
    margin: 0;
    color: var(--pg-muted);
    font-size: 0.8125rem;
}

.df-drop__browse {
    min-height: 2.5rem;
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
}

.df-drop__selected {
    margin: 0;
    max-width: 100%;
    color: var(--pg-text);
    font-size: 0.8125rem;
    overflow-wrap: anywhere;
}

/* Step progress */
.df-progress {
    display: grid;
    gap: 0.75rem;
    margin-bottom: 0.5rem;
}

.df-progress__count {
    color: var(--pg-muted);
    font-size: 0.8125rem;
    font-weight: 600;
}

.df-progress__track {
    height: 6px;
    border-radius: 999px;
    background: #edf1f4;
    overflow: hidden;
}

.df-progress__fill {
    display: block;
    height: 100%;
    border-radius: inherit;
    background: var(--pg-pink);
    transform-origin: 0 50%;
    transition: transform var(--motion-slow, 640ms) var(--ease-ios, ease-out);
}

.df-progress__steps {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem 1.25rem;
    margin: 0;
    padding: 0;
    list-style: none;
}

.df-progress__step {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--pg-muted);
    font-size: 0.875rem;
    font-weight: 500;
}

.df-progress__dot {
    position: relative;
    display: inline-grid;
    place-items: center;
    width: 1.6rem;
    height: 1.6rem;
    border-radius: 999px;
    border: 1px solid var(--pg-line-strong);
    background: #fff;
    font-size: 0.75rem;
    font-weight: 700;
    transition: background-color var(--motion-base, 360ms), border-color var(--motion-base, 360ms), color var(--motion-base, 360ms);
}

.df-progress__dot svg,
.df-progress__dot [data-lucide] {
    position: absolute;
    width: 0.85rem;
    height: 0.85rem;
    opacity: 0;
    transform: scale(0.6);
    transition: opacity var(--motion-fast, 180ms), transform var(--motion-base, 360ms) var(--ease-springy, ease-out);
}

.df-progress__step.is-current {
    color: var(--pg-ink);
    font-weight: 600;
}

.df-progress__step.is-current .df-progress__dot {
    border-color: var(--pg-pink);
    background: var(--pg-pink);
    color: #fff;
}

.df-progress__step.is-done .df-progress__dot {
    border-color: transparent;
    background: var(--pg-ok-soft);
    color: var(--pg-ok);
}

.df-progress__step.is-done .df-progress__dot > span {
    opacity: 0;
}

.df-progress__step.is-done .df-progress__dot svg,
.df-progress__step.is-done .df-progress__dot [data-lucide] {
    opacity: 1;
    transform: none;
}

@media (max-width: 639.98px) {
    .df-progress__step:not(.is-current) .df-progress__label {
        position: absolute;
        width: 1px;
        height: 1px;
        overflow: hidden;
        clip: rect(0 0 0 0);
        white-space: nowrap;
    }
}

.df-panel {
    min-width: 0;
    margin: 0;
    padding: 0;
    border: 0;
}

.df-panel__title {
    margin-bottom: 1rem;
    padding: 0;
    color: var(--pg-ink);
    font-size: 1.125rem;
    font-weight: 700;
}

.df-panel.is-entering {
    animation: dfPanelIn var(--motion-base, 360ms) var(--ease-out-soft, ease-out) both;
}

.df-panel.is-entering-back {
    animation: dfPanelBack var(--motion-base, 360ms) var(--ease-out-soft, ease-out) both;
}

@keyframes dfPanelIn {
    from { opacity: 0; transform: translateX(14px); }
    to { opacity: 1; transform: none; }
}

@keyframes dfPanelBack {
    from { opacity: 0; transform: translateX(-14px); }
    to { opacity: 1; transform: none; }
}

.df-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    margin-top: 1.5rem;
    padding-top: 1.25rem;
    border-top: 1px solid var(--pg-line);
}

.df-actions--end {
    justify-content: flex-start;
}

@media (max-width: 767.98px) {
    .df-actions {
        border-top: 0;
        padding-top: 0.75rem;
    }

    .df-actions .pg-btn {
        flex: 1 1 auto;
    }

    .df-actions > span:empty {
        display: none;
    }
}

.df-privacy {
    display: flex;
    align-items: flex-start;
    gap: 0.45rem;
}

.df-privacy svg {
    width: 1rem;
    height: 1rem;
    flex-shrink: 0;
    margin-top: 0.1rem;
    color: var(--pg-ok);
}

.df-success:focus {
    outline: none;
}

/* --------------------------------------------------------------------------
   Enrolment form (/enroll/{course})
   -------------------------------------------------------------------------- */
/* overflow:hidden would make the card the sticky container and the mobile
   sticky submit bar would never stick. clip keeps the rounded corners. */
.fx-page .pg-card {
    overflow: clip;
}

@media (max-width: 767.98px) {
    .fx-submit-row.pg-sticky-submit {
        margin-inline: 0;
    }
}

.fx-section {
    min-width: 0;
    margin: 0;
    border: 0;
    display: grid;
    gap: 1.15rem;
    padding: clamp(1.25rem, 3vw, 1.85rem);
}

.fx-section + .fx-section {
    border-top: 1px solid var(--pg-line);
}

.fx-section__head {
    display: flex;
    gap: 0.85rem;
    align-items: flex-start;
}

.fx-section__num {
    display: inline-grid;
    place-items: center;
    flex-shrink: 0;
    width: 2rem;
    height: 2rem;
    border-radius: 999px;
    background: var(--pg-pink-soft);
    color: var(--pg-pink-ink);
    font-size: 0.875rem;
    font-weight: 700;
}

.fx-section__head .pg-hint {
    margin-top: 0.15rem;
}

.fx-facts {
    display: grid;
    margin: 0;
}

.fx-facts > div {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.75rem 0;
    border-top: 1px solid var(--pg-line);
}

.fx-facts > div:first-child {
    border-top: 0;
    padding-top: 0;
}

.fx-facts dt {
    color: var(--pg-muted);
    font-size: 0.875rem;
}

.fx-facts dd {
    margin: 0;
    color: var(--pg-ink);
    font-weight: 600;
    text-align: right;
    overflow-wrap: anywhere;
}

.fx-submit-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem 1.25rem;
    padding: clamp(1.1rem, 3vw, 1.5rem) clamp(1.25rem, 3vw, 1.85rem);
    border-top: 1px solid var(--pg-line);
    background: #fbfcfd;
}

@media (max-width: 767.98px) {
    .fx-submit-row {
        border-top: 0;
        background: transparent;
    }

    .fx-submit-row .pg-btn {
        width: 100%;
    }
}

.fx-draft-note {
    margin: 0 0 1rem;
}

@media (prefers-reduced-motion: reduce) {
    .df-panel.is-entering,
    .df-panel.is-entering-back {
        animation: none !important;
    }

    .df-progress__fill,
    .df-progress__dot,
    .df-progress__dot svg,
    .df-option,
    .df-drop,
    .fx-quick__item {
        transition: none !important;
    }
}
