/*
 * Wizard Styles
 *
 * The postcard flow: You -> Friends -> Selfie -> Review & send -> Thank you.
 * Mobile-first: base rules target phones.
 */

/* ---------- Page shell ---------- */
.wizard-page {
    max-width: 560px;
    padding: 1.25rem var(--page-gutter) 2.5rem;
}

/* Room for the sticky Next bar so it never covers the footer */
body:has(.wizard-bottom-bar) {
    padding-bottom: 5.5rem;
}

/* ...and when tabbing, the browser scrolls the focused control above the bar, not behind it (WCAG 2.4.11) */
html:has(.wizard-bottom-bar) {
    scroll-padding-bottom: calc(6.5rem + env(safe-area-inset-bottom));
}

/* Step 1 welcome bubble, for visitors who skipped the homepage; the margin leaves room for the bubble's tail */
.wizard-welcome {
    margin-bottom: 1.25rem;
}

.wizard-welcome .chip {
    font-size: 1.1rem;
    line-height: 1.3;
    padding: 0.55rem 1rem;
    text-wrap: balance;
    max-width: 100%;
    white-space: normal; /* wraps onto two lines on narrow phones instead of running off the screen */
}

.wizard-step-heading {
    color: var(--color-primary);
    font-size: clamp(1.75rem, 7.5vw, 2.6rem);
    font-weight: var(--font-weight-heavy);
    margin-bottom: 0.5rem;
    text-transform: lowercase;   /* brand style; the words themselves are unchanged */
}

.wizard-lead {
    font-size: 1.05rem;
    margin-bottom: 1.25rem;
}

.wizard-subheading {
    font-size: 1.25rem;
    color: var(--color-primary);
    margin: 1.75rem 0 0.75rem;
}

.wizard-actions {
    display: grid;
    gap: 0.75rem;
}

.optional {
    font-weight: var(--font-weight-normal);
    color: var(--color-text-muted);
}

.wizard-privacy-note {
    margin: 1.5rem 0 0;
    font-size: 0.9rem;
    color: var(--color-text-muted);
    text-align: center;
}

.wizard-privacy-note + .wizard-privacy-note {
    margin-top: 0.5rem;
}

/* ---------- Progress (You · Friends · Selfie · Send) ---------- */
.wizard-progress {
    list-style: none;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.25rem;
    padding: 0;
    margin: 0 0 1.25rem;
    position: relative;
}

.wizard-progress::before {
    content: "";
    position: absolute;
    top: 0.95rem;
    left: 12.5%;
    right: 12.5%;
    height: 2px;
    background: var(--color-line);
    z-index: 0;
}

.wizard-progress li {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
    position: relative;
    z-index: 1;
}

.wizard-progress-dot {
    width: 1.9rem;
    height: 1.9rem;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--color-bg);
    border: 2px solid var(--color-line);
    color: var(--color-text-muted);
    font-family: var(--font-family-heading);
    font-weight: var(--font-weight-bold);
    font-size: 0.85rem;
}

.wizard-progress-label {
    font-size: 0.75rem;
    font-weight: var(--font-weight-semibold);
    color: var(--color-text-muted);
}

.wizard-progress .is-done .wizard-progress-dot {
    background: var(--color-primary);
    border-color: var(--color-primary);
    color: var(--color-accent);
}

.wizard-progress .is-current .wizard-progress-dot {
    background: var(--color-accent);
    border-color: var(--color-primary);
    color: var(--color-primary);
}

.wizard-progress .is-done .wizard-progress-label,
.wizard-progress .is-current .wizard-progress-label {
    color: var(--color-primary);
}

/* ---------- Voter search (You + Friends) ---------- */
.vs-status {
    margin: 1rem 0 0.5rem;
    font-size: 0.95rem;
    color: var(--color-text-muted);
    min-height: 1.5em;
}

.vs-status.is-busy::before {
    content: "";
    display: inline-block;
    width: 0.9em;
    height: 0.9em;
    margin-right: 0.4em;
    vertical-align: -0.1em;
    border: 2px solid var(--color-primary);
    border-right-color: transparent;
    border-radius: 50%;
    animation: vs-spin 0.7s linear infinite;
}

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

.vs-chips {
    display: grid;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}

.vs-chip-group {
    display: flex;
    gap: 0.4rem;
    overflow-x: auto;
    /* Room inside the scroll area for the focus outline, which it would otherwise cut off */
    padding: 6px;
    margin: -6px;
    scrollbar-width: none;
}

.vs-chip-group::-webkit-scrollbar {
    display: none;
}

.vs-chip {
    background: var(--color-bg);
    cursor: pointer;
    min-height: 36px;
}

.vs-chip[aria-pressed="true"] {
    background: var(--color-primary);
    color: var(--color-text-inverse);
}

.vs-results {
    list-style: none;
    padding: 0;
    margin: 0;
    display: grid;
    gap: 0.5rem;
}

.vs-card {
    display: flex;
    flex-wrap: wrap;   /* with large text, the button moves under the name instead of off the screen */
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.7rem 0.8rem 0.7rem 1rem;
    border: 2px solid var(--color-primary);
    border-radius: 14px;
    background: var(--color-bg);
    animation: vs-in 0.18s ease-out;
}

@keyframes vs-in {
    from { opacity: 0; transform: translateY(4px); }
}

.vs-card-info {
    flex: 1 1 10rem;
    min-width: 0;
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    column-gap: 0.5rem;
}

.vs-card-info strong {
    color: var(--color-primary);
}

.vs-card-info small {
    flex-basis: 100%;
    color: var(--color-text-muted);
    overflow-wrap: anywhere;
}

.vs-age {
    font-size: 0.85rem;
    color: var(--color-text-muted);
}

.vs-pick {
    flex: 0 0 auto;
    min-width: 5.5rem;
    margin-left: auto;
}

.vs-manual-link {
    margin: 1rem 0 0;
    font-size: 0.95rem;
    text-align: center;
}

.vs-manual-link.is-prominent {
    padding: 0.9rem 1rem;
    background: var(--color-bg-subtle);
    border-radius: 14px;
    font-weight: var(--font-weight-semibold);
}

.btn-link-inline {
    background: none;
    border: 0;
    padding: 0;
    color: var(--color-link);
    font-weight: var(--font-weight-bold);
    text-decoration: underline;
    text-underline-offset: 2px;
}

.vs-manual {
    margin-top: 0.5rem;
}

.vs-error {
    margin: 0.75rem 0 0;
    padding: 0.6rem 0.8rem;
    border-radius: 10px;
    background: var(--color-error-bg);
    color: var(--color-error);
    font-weight: var(--font-weight-semibold);
}

/* ---------- Friends step ---------- */
.friend-stack {
    margin-bottom: 1.25rem;
    padding: 0.9rem 1rem;
    background: var(--color-accent);
    border: 2px solid var(--color-primary);
    border-radius: var(--radius-card);
    color: var(--color-primary);
}

.friend-stack-count {
    margin: 0;
    font-weight: var(--font-weight-bold);
}

.friend-stack-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
}

.friend-stack-list:not(:empty) {
    margin-top: 0.6rem;
}

.friend-chip {
    background: var(--color-bg);
    padding-right: 0.3rem;
    animation: vs-in 0.2s ease-out;
}

.friend-chip-remove {
    border: 0;
    background: transparent;
    color: var(--color-primary);
    font-size: 1.2rem;
    line-height: 1;
    width: 1.75rem;
    height: 1.75rem;
    border-radius: 50%;
}

.friend-chip-remove:hover,
.friend-chip-remove:focus-visible {
    background: var(--color-bg-subtle);
}

.friend-inline-next {
    margin: 1.25rem 0 0;
}

.friend-max-note {
    padding: 0.9rem 1rem;
    background: var(--color-panel-fun);
    border-radius: 14px;
    font-weight: var(--font-weight-semibold);
    color: var(--color-primary);
}

.wizard-bottom-bar {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1020;
    padding: 0.75rem var(--page-gutter) calc(0.75rem + env(safe-area-inset-bottom));
    background: rgba(255, 255, 255, 0.96);
    border-top: 2px solid var(--color-line);
    backdrop-filter: blur(6px);
}

.wizard-bottom-bar .btn {
    max-width: 520px;
    margin: 0 auto;
    display: flex;
}

.btn.disabled,
.btn[aria-disabled="true"] {
    opacity: 0.45;
    box-shadow: none;
    pointer-events: auto;
    cursor: not-allowed;
}

/* ---------- Selfie step ---------- */
.wizard-preview {
    margin: 0.25rem 0 1rem;
}

.photo-cropper {
    margin-bottom: 1rem;
    text-align: center;
}

.photo-cropper-hint {
    font-size: 0.9rem;
    color: var(--color-text-muted);
    margin-bottom: 0.5rem;
}

.photo-cropper-stage {
    position: relative;
    max-width: 360px;
    margin: 0 auto;
}

/* "X" in the corner: throw the photo away and pick again */
.photo-cropper-cancel {
    position: absolute;
    top: -12px;
    right: -12px;
    z-index: 5;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 2px solid var(--color-primary);
    background: var(--color-bg);
    color: var(--color-primary);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    padding: 0;
}

.photo-cropper-cancel:hover,
.photo-cropper-cancel:focus-visible {
    background: var(--color-accent);
}

.photo-cropper-frame {
    width: 100%;
    max-width: 360px;
    aspect-ratio: 1 / 1;
    margin: 0 auto;
    border: 2px solid var(--color-primary);
    border-radius: 14px;
    overflow: hidden;
    background: var(--color-bg-subtle);
}

.photo-cropper-frame img {
    display: block;
    max-width: 100%;
}

/* Move (arrows) and zoom buttons under the photo: framing without dragging (WCAG 2.1.1, 2.5.7) */
.photo-cropper-controls {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.5rem 1rem;
    margin-top: 0.6rem;
}

.photo-cropper-buttons {
    display: flex;
    gap: 0.4rem;
}

.photo-cropper-buttons .btn {
    width: 48px;
    padding: 0;
}

/* Computers: live webcam view, same square as the framing step, mirrored like a mirror */
.photo-camera {
    margin-bottom: 1rem;
    text-align: center;
}

.photo-camera-frame {
    position: relative;
    background: var(--color-primary);
}

.photo-camera-frame video {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transform: scaleX(-1);
}

.photo-camera-count {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-family-heading);
    font-weight: var(--font-weight-heavy);
    font-size: 4rem;
    line-height: 1;
    color: var(--color-accent);
}

/* Flat brand look (no shadows): the number sits on a solid blue circle so it reads on any background */
.photo-camera-count::before {
    content: "";
    position: absolute;
    width: 6.5rem;
    height: 6.5rem;
    border-radius: 50%;
    background: var(--color-primary);
    z-index: -1;
}

.photo-camera-count {
    z-index: 1;
    isolation: isolate;
}

.photo-camera-count[hidden] {
    display: none;
}

/* The square is the whole frame, so Cropper's dimmed "outside" layer isn't needed. The photo always
   covers the square; white only shows for a moment while a photo loads */
.photo-cropper .cropper-modal {
    display: none;
}

.photo-cropper .photo-cropper-frame {
    background: #fff;
}

.photo-cropper .cropper-view-box {
    outline: 3px solid var(--color-accent);
    outline-color: var(--color-accent);
}

.wizard-tips {
    list-style: none;
    padding: 1rem 1.1rem;
    margin: 0;
    background: var(--color-bg-subtle);
    border-radius: var(--radius-card);
    display: grid;
    gap: 0.6rem;
    font-size: 0.95rem;
}

.wizard-tips li {
    display: flex;
    align-items: flex-start;
    gap: 0.6rem;
}

.wizard-tip-emoji {
    flex: 0 0 auto;
    font-size: 1.35rem;
    line-height: 1.2;
}

/* ---------- Review step ---------- */
/* "Change photo" under the review card: a small outline button, so it reads as clickable */
.review-photo-link {
    text-align: center;
    margin-top: 0.75rem;
}

.review-photo-link .btn {
    padding: 0.4rem 1rem;
    font-size: 0.95rem;
}

.wizard-recipients {
    border-radius: var(--radius-card);
    border: 2px solid var(--color-primary);
    overflow: hidden;
}

.wizard-recipients .list-group-item {
    border-color: var(--color-line);
    gap: 0.75rem;
}

.wizard-recipients strong {
    color: var(--color-primary);
}

.you-tag {
    display: inline-block;
    margin-left: 0.25rem;
    padding: 0 0.45rem;
    border-radius: var(--radius-chip);
    background: var(--color-accent);
    color: var(--color-primary);
    font-size: 0.75rem;
    font-weight: var(--font-weight-bold);
    vertical-align: 0.1em;
}

/* ---------- Thank-you page ---------- */
.complete-emoji {
    font-size: 3rem;
    text-align: center;
    margin-bottom: 0.25rem;
}

.complete-names {
    list-style: none;
    padding: 0;
    margin: 1rem 0 1.25rem;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.5rem;
}

.complete-sweeps {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    margin: 1.25rem 0 2rem;
    padding: 1rem 1.1rem;
    background: var(--color-panel-fun);
    color: var(--color-primary);
    border: 2px solid var(--color-primary);
    border-radius: var(--radius-card);
    text-align: center;
}

.wizard-survey-iframe {
    border-radius: var(--radius-card);
    min-width: 100%;
    max-width: 100%;
    height: 539px;
    border: none;
}

/* Full-screen overlay used by the intro controller (currently only the disabled opt-in dialog) */
#intro-overlay {
    position: fixed;
    inset: 0;
    transform: translateY(0);
    transition: transform 0.5s ease-in-out;
    z-index: 1050;
    background-color: var(--color-bg);
    overflow-y: auto;
}

#intro-overlay.slide-out {
    transform: translateY(100%);
}

/* ---------- Share to your story (thank-you page) ---------- */
.share-card {
    margin: 1.5rem 0;
    padding: 1.25rem 1.1rem 1.1rem;
    border: 2px solid var(--color-primary);
    border-radius: var(--radius-card);
    background: var(--color-bg-subtle);
}

.share-title {
    font-size: 1.4rem;
    color: var(--color-primary);
    margin-bottom: 0.4rem;
}

.share-text {
    margin-bottom: 1rem;
}

.share-preview {
    position: relative;
    width: 62%;
    max-width: 260px;
    aspect-ratio: 9 / 16;
    margin: 0 auto 0.5rem;
    border-radius: 14px;
    overflow: hidden;
    border: 2px solid var(--color-primary);
    background: var(--color-primary);
}

.share-preview img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.share-card.is-ready .share-preview img {
    opacity: 1;
}

.share-preview-loading {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    color: var(--color-text-inverse);
    font-weight: var(--font-weight-semibold);
    text-align: center;
}

.share-card.is-ready .share-preview-loading {
    display: none;
}

.share-hint {
    text-align: center;
    font-size: 0.85rem;
    color: var(--color-text-muted);
    margin-bottom: 1rem;
}

.share-caption {
    font-size: 0.95rem;
    resize: none;
}

.share-status {
    margin: 0.5rem 0 0;
    font-weight: var(--font-weight-semibold);
    color: var(--color-primary);
}

/* Donation ask, below the survey */
.complete-donate {
    margin-top: 2rem;
    text-align: center;
}

.complete-donate-title {
    font-size: 1.4rem;
    color: var(--color-primary);
    margin-bottom: 0.4rem;
}

.complete-survey summary {
    text-align: left;
}

.complete-survey .wizard-survey-iframe {
    padding: 0.5rem;
}

.closed-note {
    padding: 1rem 1.1rem;
    border-radius: var(--radius-card);
    background: rgba(255, 255, 255, 0.12);
    border: 2px solid rgba(255, 255, 255, 0.4);
}

/* ---------- Sweepstakes box (review step) ---------- */
.sweeps-box {
    margin-top: 1.75rem;
    padding: 1rem 1.1rem;
    background: var(--color-panel-fun);
    border: 2px solid var(--color-primary);
    border-radius: var(--radius-card);
}

.sweeps-box-text {
    margin: 0.2rem 0 0.35rem;
    font-size: 0.95rem;
}

.sweeps-box-ask {
    margin: 0 0 0.5rem;
    font-size: 0.95rem;
    font-weight: var(--font-weight-bold);
}

/* Optional "Can we feature you?" checkboxes on the thank-you page */
/* "Remind your neighbors too?" (thank-you page, right under the share card) */
.complete-neighbors {
    margin: 0 0 1.5rem;
    padding: 1rem 1.1rem;
    border: 2px solid var(--color-primary);
    border-radius: var(--radius-card);
    background: var(--color-bg-subtle);
    text-align: left;
}

.complete-neighbors fieldset {
    margin: 0;
    padding: 0;
    border: 0;
}

.complete-neighbors-title {
    font-size: 1.1rem;
    font-weight: var(--font-weight-bold);
    margin-bottom: 0.5rem;
}

.complete-neighbors-note {
    margin: 0.6rem 0 0;
    font-size: 0.85rem;
    color: var(--color-text-muted);
}

/* "Who sent you our way?" (thank-you page, under the share card; only for visitors no creator is credited for) */
.heard-from {
    margin: 0 0 1.5rem;
    padding: 1rem 1.1rem;
    border: 2px solid var(--color-primary);
    border-radius: var(--radius-card);
    text-align: left;
}

.heard-from-title {
    font-size: 1.1rem;
    margin: 0 0 0.75rem;
}

.heard-from-choices {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.heard-from-which {
    margin-top: 1rem;
}

.heard-from-results {
    list-style: none;
    margin: 0.4rem 0 0.6rem;
    padding: 0;
}

.heard-from-results:empty {
    display: none;
}

.heard-from-result {
    display: block;
    width: 100%;
    min-height: 44px;
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--color-border);
    border-top-width: 0;
    background: var(--color-bg);
    color: inherit;
    text-align: left;
}

.heard-from-results li:first-child .heard-from-result {
    border-top-width: 1px;
    border-radius: 8px 8px 0 0;
}

.heard-from-results li:last-child .heard-from-result {
    border-radius: 0 0 8px 8px;
}

.heard-from-results li:only-child .heard-from-result {
    border-radius: 8px;
}

.heard-from-thanks {
    margin: 0;
    font-weight: var(--font-weight-bold);
}

.complete-feature {
    margin: 0 0 2rem;
    text-align: left;
    font-size: 0.9rem;
    line-height: 1.45;
}

.complete-feature fieldset {
    margin: 0;
    padding: 0;
    border: 0;
}

.complete-feature-title {
    font-size: 1rem;
    font-weight: var(--font-weight-bold);
    margin-bottom: 0.5rem;
}

.complete-feature .form-check + .form-check {
    margin-top: 0.6rem;
}

.complete-feature-status {
    margin: 0.4rem 0 0;
}

.complete-feature-status:empty {
    display: none;
}

/* ---------- Volunteer agreement fine print (step 1, under the search and the typed-address form) ---------- */
.vs-agree {
    color: var(--color-text-muted);
    font-size: 0.8rem;
    line-height: 1.45;
    margin: 0.85rem 0 0;
}

.vs-agree-lead {
    margin: 0 0 0.25rem;
}

.vs-agree-list {
    margin: 0;
    padding-left: 1.1rem;
}

.vs-agree-list li + li {
    margin-top: 0.15rem;
}

/* Thank-you page: "Send to more friends" (same name and photo, new batch) */
.complete-more {
    margin: 1.25rem 0 0.5rem;
    text-align: center;
}

.complete-more-title {
    font-weight: var(--font-weight-bold);
    color: var(--color-primary);
    margin-bottom: 0.5rem;
}

/* Digital postcards: the Send step after mailing closed (wizard/review.html.twig, digital_card_controller.js) */
.digital-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
}
.digital-row .btn { flex-shrink: 0; }
.digital-row.is-sent .btn { background: transparent; box-shadow: none; border-color: transparent; text-decoration: underline; }
.digital-row.is-sent .bi-check-circle-fill { color: #1a7f44; }
.digital-count { font-size: 0.92rem; margin: -0.25rem 0 0.5rem; }
.digital-count:empty { display: none; }
.digital-share-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
}
.digital-share-grid > :last-child:nth-child(odd) { grid-column: 1 / -1; }
.digital-share-grid > [hidden] ~ * { grid-column: 1 / -1; }
