/* Profile nudges: small, one-question pop-ups that fill a missing profile field
   in context (see js/profile-nudges.js). */

.pn-overlay {
    --pn-accent: #11a191;
    --pn-accent-hover: #0e8b7d;
    --pn-accent-soft: rgba(17, 161, 145, 0.1);
    --pn-ink: #0f172a;
    --pn-muted: #64748b;
    --pn-line: #e2e8f0;
    --pn-ease-out: cubic-bezier(0.16, 1, 0.3, 1);
    --pn-ease-in: cubic-bezier(0.4, 0, 1, 1);

    position: fixed;
    inset: 0;
    z-index: 100020; /* above the header (50000), sign-up/login (60000) and site dropdowns */
    display: flex;
    justify-content: center;
    padding: 24px;
    overflow-y: auto;
    background: rgba(15, 23, 42, 0.42);
    -webkit-backdrop-filter: blur(6px) saturate(120%);
    backdrop-filter: blur(6px) saturate(120%);
    opacity: 0;
    overscroll-behavior: contain;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    -webkit-font-smoothing: antialiased;
    /* !important: several pages ship a catch-all `body > *:not(#aiModal)... { transition: filter }`
       rule that would otherwise replace this fade. */
    transition: opacity 0.32s var(--pn-ease-out) !important;
}

.pn-overlay.is-open {
    opacity: 1;
}

.pn-overlay.is-closing {
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.22s var(--pn-ease-in) !important;
}

.pn-card {
    position: relative;
    /* Centred while it fits; scrolls with the overlay (instead of being cut off) when it doesn't */
    margin: auto 0;
    width: 100%;
    max-width: 400px;
    box-sizing: border-box;
    padding: 32px 28px 20px;
    background: #fff;
    border-radius: 20px;
    box-shadow:
        0 1px 2px rgba(15, 23, 42, 0.04),
        0 12px 24px -6px rgba(15, 23, 42, 0.12),
        0 32px 64px -12px rgba(15, 23, 42, 0.22);
    color: var(--pn-ink);
    text-align: center;
    opacity: 0;
    transform: translateY(14px) scale(0.965);
    transition:
        opacity 0.42s var(--pn-ease-out),
        transform 0.42s var(--pn-ease-out);
}

.pn-overlay.is-open .pn-card {
    opacity: 1;
    transform: none;
}

.pn-overlay.is-closing .pn-card {
    opacity: 0;
    transform: translateY(8px) scale(0.98);
    transition:
        opacity 0.2s var(--pn-ease-in),
        transform 0.2s var(--pn-ease-in);
}

.pn-card *,
.pn-card *::before,
.pn-card *::after {
    box-sizing: border-box;
}

.pn-close {
    position: absolute;
    top: 14px;
    right: 14px;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    border: none;
    border-radius: 50%;
    background: transparent;
    color: #94a3b8;
    cursor: pointer;
    transition: background-color 0.18s ease, color 0.18s ease;
}

.pn-close[hidden] {
    display: none;
}

.pn-close:hover {
    background: #f1f5f9;
    color: var(--pn-ink);
}

.pn-close svg {
    width: 16px;
    height: 16px;
}

/* Content swaps (form -> success) cross-fade inside the card */
.pn-view {
    transition: opacity 0.24s ease, transform 0.24s ease;
}

.pn-view.is-leaving {
    opacity: 0;
    transform: translateY(-4px);
}

.pn-view.is-entering {
    opacity: 0;
    transform: translateY(6px);
}

.pn-icon {
    width: 52px;
    height: 52px;
    margin: 0 auto 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 16px;
    background: var(--pn-accent-soft);
    color: var(--pn-accent);
}

.pn-icon svg {
    width: 26px;
    height: 26px;
}

.pn-title {
    margin: 0 0 8px;
    font-size: 19px;
    font-weight: 600;
    line-height: 1.3;
    letter-spacing: -0.01em;
    color: var(--pn-ink);
    text-wrap: balance;
}

.pn-text {
    margin: 0 auto;
    max-width: 310px;
    font-size: 14.5px;
    line-height: 1.55;
    color: var(--pn-muted);
    text-wrap: balance;
}

.pn-body {
    margin-top: 22px;
    text-align: left;
}

.pn-body:empty {
    display: none;
}

/* Form building blocks shared by every nudge */
.pn-field + .pn-field {
    margin-top: 10px;
}

.pn-label {
    display: block;
    margin-bottom: 6px;
    font-size: 12.5px;
    font-weight: 500;
    color: var(--pn-muted);
}

.pn-input {
    width: 100%;
    height: 46px;
    padding: 0 14px;
    border: 1px solid var(--pn-line);
    border-radius: 12px;
    background: #fff;
    font: inherit;
    font-size: 15px;
    color: var(--pn-ink);
    outline: none;
    transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

.pn-input::placeholder {
    color: #a3aebd;
}

.pn-input:focus {
    border-color: var(--pn-accent);
    box-shadow: 0 0 0 4px var(--pn-accent-soft);
}

.pn-input[aria-invalid="true"] {
    border-color: #ef4444;
    box-shadow: 0 0 0 4px rgba(239, 68, 68, 0.1);
}

.pn-textarea {
    display: block;
    height: auto;
    min-height: 100px;
    padding: 12px 14px;
    line-height: 1.45;
    resize: none;
}

/* Under a field: a helper link on the left, a character count on the right */
.pn-field-meta {
    display: flex;
    align-items: center;
    min-height: 28px;
    margin-top: 6px;
}

.pn-field-meta .pn-text-button {
    margin-left: -10px;
}

.pn-counter {
    margin-left: auto;
    font-size: 12px;
    color: #94a3b8;
    font-variant-numeric: tabular-nums;
    transition: color 0.18s ease;
}

.pn-counter.is-near-limit {
    color: #b45309;
}

/* Social link: the leading icon becomes the recognized service's logo */
/* Specific enough to beat the focused-field icon color */
.pn-combo .pn-input-icon.pn-social-icon[data-kind="linkedin"] { color: #0a66c2; }
.pn-combo .pn-input-icon.pn-social-icon[data-kind="scholar"] { color: #4285f4; }
.pn-combo .pn-input-icon.pn-social-icon[data-kind="x"] { color: #0f172a; }
.pn-combo .pn-input-icon.pn-social-icon[data-kind="website"] { color: var(--pn-accent); }

.pn-social-icon svg {
    animation: pn-icon-swap 0.32s var(--pn-ease-out);
}

@keyframes pn-icon-swap {
    from { transform: scale(0.6); opacity: 0; }
    to { transform: none; opacity: 1; }
}

.pn-detected {
    font-size: 12.5px;
    color: #94a3b8;
    transition: color 0.2s ease;
}

.pn-detected.is-recognized {
    font-weight: 500;
    color: var(--pn-accent);
}

.pn-text-button {
    padding: 4px 10px;
    border: none;
    border-radius: 8px;
    background: transparent;
    color: var(--pn-accent);
    font: inherit;
    font-size: 13.5px;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.16s ease;
}

.pn-text-button:hover {
    background: var(--pn-accent-soft);
}

.pn-text-button[hidden] {
    display: none;
}

/* Field label with a quiet action on the right (e.g. "Change field" above topic chips) */
.pn-label-row {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 6px;
}

.pn-label-row .pn-label {
    margin-bottom: 0;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.pn-label-action {
    flex-shrink: 0;
    margin: -4px -10px -4px 0;
    font-size: 12.5px;
}

/* Content swapped inside an open card settles in instead of popping */
.pn-field.is-swapped > :not(.pn-options) {
    animation: pn-settle 0.34s var(--pn-ease-out);
}

@keyframes pn-settle {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* Input with a leading icon and a type-ahead list (e.g. the city search) */
.pn-combo {
    position: relative;
}

.pn-input--icon {
    padding-left: 42px;
    padding-right: 40px;
}

.pn-input-icon {
    position: absolute;
    top: 23px;
    left: 14px;
    width: 18px;
    height: 18px;
    margin-top: -9px;
    color: #94a3b8;
    pointer-events: none;
    transition: color 0.18s ease;
}

.pn-input-icon svg {
    width: 18px;
    height: 18px;
}

.pn-combo:focus-within .pn-input-icon {
    color: var(--pn-accent);
}

.pn-input-spinner {
    position: absolute;
    top: 23px;
    right: 14px;
    width: 16px;
    height: 16px;
    margin-top: -8px;
    border: 2px solid #e2e8f0;
    border-top-color: var(--pn-accent);
    border-radius: 50%;
    opacity: 0;
    transition: opacity 0.15s ease;
    animation: pn-spin 0.7s linear infinite;
    pointer-events: none;
}

.pn-combo.is-loading .pn-input-spinner {
    opacity: 1;
}

.pn-options {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    right: 0;
    z-index: 2;
    max-height: 264px;
    margin: 0;
    padding: 6px;
    overflow-y: auto;
    list-style: none;
    background: #fff;
    border: 1px solid var(--pn-line);
    border-radius: 14px;
    box-shadow: 0 12px 32px -8px rgba(15, 23, 42, 0.18), 0 2px 6px rgba(15, 23, 42, 0.05);
    animation: pn-drop 0.16s var(--pn-ease-out);
}

.pn-options[hidden] {
    display: none;
}

.pn-option {
    display: flex;
    flex-direction: column;
    gap: 1px;
    padding: 9px 12px;
    border-radius: 10px;
    cursor: pointer;
    transition: background-color 0.12s ease;
}

.pn-option.is-active {
    background: #f1f5f9;
}

.pn-option-main {
    font-size: 14.5px;
    font-weight: 500;
    color: var(--pn-ink);
}

.pn-option-sub {
    font-size: 12.5px;
    color: var(--pn-muted);
}

.pn-option-empty {
    padding: 12px;
    font-size: 13.5px;
    color: var(--pn-muted);
    text-align: center;
}

/* Tappable topic chips */
.pn-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
}

.pn-chip {
    height: 32px;
    padding: 0 12px;
    border: 1px solid var(--pn-line);
    border-radius: 999px;
    background: #fff;
    color: #334155;
    font: inherit;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    transition: background-color 0.16s ease, border-color 0.16s ease, color 0.16s ease, transform 0.12s ease;
}

.pn-chip:hover {
    border-color: #cbd5e1;
    background: #f8fafc;
}

.pn-chip:active {
    transform: scale(0.96);
}

.pn-chip.is-selected {
    border-color: var(--pn-accent);
    background: var(--pn-accent);
    color: #fff;
}

.pn-chip:focus-visible {
    outline: 2px solid var(--pn-accent);
    outline-offset: 2px;
}

/* Round photo picker */
.pn-photo-field {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.pn-photo {
    position: relative;
    width: 112px;
    height: 112px;
    padding: 0;
    border: 2px dashed #cbd5e1;
    border-radius: 50%;
    background: #f8fafc;
    cursor: pointer;
    transition: border-color 0.18s ease, background-color 0.18s ease, transform 0.18s var(--pn-ease-out), box-shadow 0.18s ease;
}

.pn-photo:hover,
.pn-photo.is-dragging {
    border-color: var(--pn-accent);
    background: var(--pn-accent-soft);
}

.pn-photo.is-dragging {
    transform: scale(1.04);
}

.pn-photo:focus-visible {
    outline: 2px solid var(--pn-accent);
    outline-offset: 3px;
}

.pn-photo-placeholder {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    overflow: hidden;
    border-radius: 50%;
    color: #cbd5e1;
    transition: opacity 0.2s ease;
}

.pn-photo-placeholder svg {
    width: 84px;
    height: 84px;
}

.pn-photo-image {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
    opacity: 0;
    transform: scale(0.94);
    transition: opacity 0.3s ease, transform 0.36s var(--pn-ease-out);
}

.pn-photo.has-photo {
    border: 3px solid #fff;
    box-shadow: 0 0 0 1px var(--pn-line), 0 10px 24px -8px rgba(15, 23, 42, 0.3);
}

.pn-photo.has-photo .pn-photo-image {
    opacity: 1;
    transform: none;
}

.pn-photo.has-photo .pn-photo-placeholder,
.pn-photo.is-loading .pn-photo-placeholder {
    opacity: 0;
}

.pn-photo-badge {
    position: absolute;
    right: 0;
    bottom: 2px;
    width: 34px;
    height: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 3px solid #fff;
    border-radius: 50%;
    background: var(--pn-accent);
    color: #fff;
    box-shadow: 0 2px 6px rgba(15, 23, 42, 0.18);
}

.pn-photo-badge svg {
    width: 15px;
    height: 15px;
}

.pn-photo.is-loading .pn-photo-badge svg {
    display: none;
}

.pn-photo.is-loading .pn-photo-badge::after {
    content: '';
    width: 12px;
    height: 12px;
    border: 2px solid rgba(255, 255, 255, 0.4);
    border-top-color: #fff;
    border-radius: 50%;
    animation: pn-spin 0.7s linear infinite;
}

.pn-photo-links {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 4px;
}

.pn-photo-links:not(:has(> :not([hidden]))) {
    display: none;
}

.pn-camera-button {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.pn-camera-button svg {
    width: 17px;
    height: 17px;
}

.pn-file {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
    pointer-events: none;
}

.pn-error {
    min-height: 0;
    margin: 0;
    font-size: 13px;
    line-height: 1.4;
    color: #dc2626;
    text-align: center;
    overflow: hidden;
    max-height: 0;
    opacity: 0;
    transition: max-height 0.2s ease, opacity 0.2s ease, margin 0.2s ease;
}

.pn-error.is-visible {
    max-height: 60px;
    margin-top: 12px;
    opacity: 1;
}

.pn-actions {
    margin-top: 24px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.pn-primary {
    position: relative;
    width: 100%;
    height: 48px;
    border: none;
    border-radius: 12px;
    background: var(--pn-accent);
    color: #fff;
    font: inherit;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.18s ease, transform 0.12s ease, box-shadow 0.18s ease, opacity 0.18s ease;
    box-shadow: 0 1px 2px rgba(17, 161, 145, 0.25), 0 6px 16px -4px rgba(17, 161, 145, 0.35);
}

.pn-primary:hover:not(:disabled) {
    background: var(--pn-accent-hover);
}

.pn-primary:active:not(:disabled) {
    transform: scale(0.985);
}

.pn-primary:disabled {
    cursor: default;
    opacity: 0.55;
    box-shadow: none;
}

.pn-primary.is-busy {
    color: transparent;
    opacity: 1;
}

.pn-primary.is-busy::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 18px;
    height: 18px;
    margin: -9px 0 0 -9px;
    border: 2px solid rgba(255, 255, 255, 0.4);
    border-top-color: #fff;
    border-radius: 50%;
    animation: pn-spin 0.7s linear infinite;
}

.pn-secondary {
    width: 100%;
    height: 40px;
    border: none;
    border-radius: 10px;
    background: transparent;
    color: var(--pn-muted);
    font: inherit;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: color 0.18s ease, background-color 0.18s ease;
}

.pn-secondary:hover {
    color: var(--pn-ink);
    background: #f8fafc;
}

.pn-primary:focus-visible,
.pn-secondary:focus-visible,
.pn-close:focus-visible {
    outline: 2px solid var(--pn-accent);
    outline-offset: 2px;
}

.pn-footnote {
    margin: 14px 0 0;
    font-size: 12px;
    color: #94a3b8;
}

/* Success view */
.pn-success {
    padding: 8px 0 12px;
}

.pn-check {
    width: 56px;
    height: 56px;
    margin: 0 auto 16px;
    border-radius: 50%;
    background: var(--pn-accent);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    transform: scale(0.6);
    opacity: 0;
    animation: pn-pop 0.5s var(--pn-ease-out) 0.05s forwards;
}

.pn-check svg {
    width: 26px;
    height: 26px;
}

.pn-check path {
    stroke-dasharray: 24;
    stroke-dashoffset: 24;
    animation: pn-draw 0.36s ease-out 0.28s forwards;
}

.pn-strength {
    margin: 22px auto 0;
    max-width: 260px;
    text-align: left;
}

.pn-strength-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 8px;
    font-size: 12.5px;
    color: var(--pn-muted);
}

.pn-strength-value {
    font-weight: 600;
    color: var(--pn-ink);
    font-variant-numeric: tabular-nums;
}

.pn-strength-track {
    height: 6px;
    border-radius: 999px;
    background: #eef2f6;
    overflow: hidden;
}

.pn-strength-fill {
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, #11a191, #2bc4b1);
    transition: width 0.9s var(--pn-ease-out) 0.35s;
}

.pn-overlay.is-open .pn-card.is-resizing {
    overflow: hidden;
    transition:
        height 0.38s var(--pn-ease-out),
        opacity 0.42s var(--pn-ease-out),
        transform 0.42s var(--pn-ease-out);
}

@keyframes pn-spin {
    to { transform: rotate(360deg); }
}

@keyframes pn-drop {
    from { opacity: 0; transform: translateY(-4px); }
    to { opacity: 1; transform: none; }
}

@keyframes pn-pop {
    to { transform: scale(1); opacity: 1; }
}

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

/* Phones: a bottom sheet that slides up */
@media (max-width: 560px) {
    .pn-overlay {
        padding: 0;
    }

    .pn-card {
        margin: auto 0 0;
        max-width: none;
        max-height: 100%;
        overflow-y: auto;
        overscroll-behavior: contain;
        scroll-padding-bottom: 120px; /* focused chips and fields stay clear of the sticky buttons */
        padding: 30px 22px calc(18px + env(safe-area-inset-bottom, 0px));
        border-radius: 22px 22px 0 0;
        transform: translateY(100%);
        transition: transform 0.46s var(--pn-ease-out), opacity 0.2s ease;
    }

    .pn-card::before {
        content: '';
        position: absolute;
        top: 8px;
        left: 50%;
        width: 36px;
        height: 4px;
        margin-left: -18px;
        border-radius: 999px;
        background: #e2e8f0;
    }

    .pn-overlay.is-closing .pn-card {
        opacity: 1;
        transform: translateY(100%);
        transition: transform 0.26s var(--pn-ease-in);
    }

    .pn-input {
        font-size: 16px; /* prevents iOS zoom on focus */
    }

    /* In the flow on phones, so the list never hangs below the screen edge */
    .pn-options {
        position: static;
        max-height: 196px;
        margin-top: 8px;
        box-shadow: none;
    }

    /* When the sheet has to scroll, the buttons stay in reach; content fades under them.
       The padding / negative margin pair lets the bar's white cover the sheet's bottom
       padding (where content would otherwise show through) without moving anything. */
    .pn-actions {
        --pn-sheet-bottom: calc(18px + env(safe-area-inset-bottom, 0px));
        position: sticky;
        bottom: calc(-1 * var(--pn-sheet-bottom));
        z-index: 1;
        padding-bottom: var(--pn-sheet-bottom);
        margin-bottom: calc(-1 * var(--pn-sheet-bottom));
        background: #fff;
    }

    .pn-footnote {
        position: relative;
        z-index: 2;
    }

    .pn-actions::before {
        content: '';
        position: absolute;
        left: 0;
        right: 0;
        bottom: 100%;
        height: 16px;
        background: linear-gradient(rgba(255, 255, 255, 0), #fff);
        pointer-events: none;
    }

    /* Finger-sized targets */
    .pn-close {
        top: 10px;
        right: 10px;
        width: 40px;
        height: 40px;
    }

    .pn-chip {
        height: 36px;
    }

    .pn-label-action {
        padding: 9px 10px;
        margin: -9px -10px -9px 0;
    }

    /* Short visible area (the keyboard is open): fold away the icon, description and
       footnote so the field, its suggestions and the main button stay in view */
    .pn-icon,
    .pn-text,
    .pn-footnote {
        overflow: hidden;
        transition: height 0.28s var(--pn-ease-out), max-height 0.28s var(--pn-ease-out), margin 0.28s var(--pn-ease-out), opacity 0.2s ease;
    }

    .pn-text,
    .pn-footnote {
        max-height: 120px;
    }

    .pn-overlay.is-compact .pn-card {
        padding-top: 24px;
    }

    .pn-overlay.is-compact .pn-icon {
        height: 0;
        margin-bottom: 0;
        opacity: 0;
    }

    .pn-overlay.is-compact .pn-view:not(.pn-success) .pn-text,
    .pn-overlay.is-compact .pn-footnote {
        max-height: 0;
        margin-top: 0;
        opacity: 0;
    }

    .pn-overlay.is-compact .pn-title {
        margin-bottom: 0;
        padding: 0 30px;
    }

    .pn-overlay.is-compact .pn-body {
        margin-top: 16px;
    }

    .pn-overlay.is-compact .pn-actions {
        margin-top: 16px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .pn-overlay,
    .pn-overlay.is-closing,
    .pn-card,
    .pn-overlay.is-closing .pn-card,
    .pn-view,
    .pn-strength-fill {
        transition-duration: 0.01ms !important;
        transition-delay: 0s !important;
    }

    .pn-card,
    .pn-overlay.is-closing .pn-card {
        transform: none !important;
    }

    .pn-check,
    .pn-check path {
        animation-duration: 0.01ms;
        animation-delay: 0s;
    }
}
