/* ==========================================================================
   AiduRight — Modern healthcare design system
   Warm teal + soft coral, friendly typography, gentle motion.
   Mobile-first, high contrast, large touch targets.
   ========================================================================== */

/* ---------- Design tokens ---------- */
:root {
    /* Brand — warm teal */
    --teal: #0D9488;
    --teal-bright: #14B8A6;
    --teal-dark: #0F766E;
    --teal-deep: #115E59;
    --teal-tint: #F0FDFA;
    --teal-ring: rgba(13, 148, 136, 0.35);

    /* Secondary — soft coral */
    --coral: #F97316;
    --coral-dark: #EA580C;
    --coral-tint: #FFF7ED;

    /* Status */
    --success: #0F766E;
    --warning-bg: #FFF7ED;
    --warning-border: #FED7AA;
    --warning-text: #9A3412;

    /* Neutrals — warm grays */
    --ink: #1F2937;
    --ink-soft: #4B5563;
    --ink-faint: #6B7280;
    --line: #E7E5E4;
    --surface: #FFFFFF;
    --bg: #FAFAF9;

    /* Shape */
    --radius: 16px;
    --radius-sm: 12px;
    --radius-lg: 24px;
    --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.04), 0 2px 8px rgba(15, 23, 42, 0.06);
    --shadow-md: 0 4px 12px rgba(15, 23, 42, 0.06), 0 12px 28px rgba(15, 23, 42, 0.09);
    --shadow-lg: 0 10px 24px rgba(15, 23, 42, 0.08), 0 24px 48px rgba(15, 23, 42, 0.12);
    --tap: 52px; /* minimum touch target */
    --maxw: 640px;

    /* Type */
    --font-head: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --font-body: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;

    /* Motion */
    --ease: cubic-bezier(0.4, 0, 0.2, 1);
    --t: 0.3s var(--ease);
}

/* ---------- Reset ---------- */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    -webkit-text-size-adjust: 100%;
    scroll-behavior: smooth;
}

body {
    position: relative;
    font-family: var(--font-body);
    font-size: 18px;
    line-height: 1.6;
    color: var(--ink);
    background: var(--bg);
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
}

h1, h2, h3, h4 {
    font-family: var(--font-head);
    letter-spacing: -0.02em;
}

/* Subtle grain texture over the background */
body::before {
    content: '';
    position: fixed;
    inset: 0;
    z-index: -2;
    pointer-events: none;
    opacity: 0.035;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* ---------- Decorative blobs ---------- */
.bg-blobs {
    position: fixed;
    inset: 0;
    z-index: -1;
    pointer-events: none;
    overflow: hidden;
}
.blob {
    position: absolute;
    border-radius: 50%;
    filter: blur(60px);
    opacity: 0.5;
    will-change: transform;
}
.blob-1 {
    top: -120px;
    right: -100px;
    width: 340px;
    height: 340px;
    background: radial-gradient(circle at 30% 30%, var(--teal-bright), transparent 70%);
    animation: float 18s var(--ease) infinite;
}
.blob-2 {
    top: 40%;
    left: -140px;
    width: 300px;
    height: 300px;
    background: radial-gradient(circle at 30% 30%, var(--coral), transparent 70%);
    opacity: 0.28;
    animation: float 22s var(--ease) infinite reverse;
}
.blob-3 {
    bottom: -140px;
    right: -60px;
    width: 260px;
    height: 260px;
    background: radial-gradient(circle at 30% 30%, #38BDF8, transparent 70%);
    opacity: 0.3;
    animation: float 26s var(--ease) infinite;
}

@keyframes float {
    0%, 100% { transform: translate(0, 0) scale(1); }
    50% { transform: translate(20px, -30px) scale(1.08); }
}

/* ---------- Hero illustration ---------- */
.hero-illustration {
    display: block;
    width: 100%;
    max-width: 340px;
    height: auto;
    margin: 0 auto 0.75rem;
}
.hero-illustration .float-icon {
    animation: bob 4s var(--ease) infinite;
}
@keyframes bob {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-6px); }
}

/* ---------- Keyframes ---------- */
@keyframes fade-in-up {
    from { opacity: 0; transform: translateY(16px); }
    to { opacity: 1; transform: translateY(0); }
}
@keyframes slide-in-right {
    from { opacity: 0; transform: translateX(24px); }
    to { opacity: 1; transform: translateX(0); }
}
@keyframes slide-in-left {
    from { opacity: 0; transform: translateX(-24px); }
    to { opacity: 1; transform: translateX(0); }
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Respect reduced-motion preferences */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.001ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.001ms !important;
        scroll-behavior: auto !important;
    }
    /* Never let an AOS element stay hidden when animations are off,
       including cards injected after AOS init. */
    [data-aos] {
        opacity: 1 !important;
        transform: none !important;
    }
}

/* ---------- Skip link ---------- */
.skip-link {
    position: absolute;
    left: -9999px;
    top: 0;
    background: var(--teal);
    color: #fff;
    padding: 0.75rem 1rem;
    border-radius: 0 0 var(--radius-sm) 0;
    z-index: 100;
    font-weight: 600;
}
.skip-link:focus { left: 0; }

/* ---------- Header ---------- */
header {
    position: relative;
    background: linear-gradient(135deg, var(--teal-bright) 0%, var(--teal) 45%, #0E7490 100%);
    color: #fff;
    padding: 1.15rem 1.25rem 2.6rem;
    box-shadow: var(--shadow-sm);
    animation: fade-in-up 0.5s var(--ease) both;
}

/* Clean one-row header: logo on the left, language switcher on the right */
.header-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    max-width: var(--maxw);
    margin: 0 auto;
}

/* Wavy bottom edge on the header */
.wave-header {
    position: absolute;
    left: 0;
    bottom: -1px;
    width: 100%;
    height: 40px;
    display: block;
}
.wave-header path { fill: var(--bg); }

/* Soft gradient wave above the footer */
.footer-wave {
    width: 100%;
    line-height: 0;
    margin-top: 1.5rem;
}
.footer-wave svg {
    display: block;
    width: 100%;
    height: 44px;
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-family: var(--font-head);
    font-size: 1.7rem;
    font-weight: 800;
    letter-spacing: -0.03em;
}
.brand-mark {
    font-size: 1.5rem;
    line-height: 1;
}
.tagline {
    font-size: 1rem;
    opacity: 0.95;
    margin-top: 0.35rem;
    font-weight: 500;
}

/* ---------- Layout ---------- */
main {
    width: 100%;
    max-width: var(--maxw);
    margin: 0 auto;
    padding: 1.5rem 1.25rem;
    flex: 1;
}

/* ---------- Screens (cards) ---------- */
.screen {
    display: none;
    background: var(--surface);
    border-radius: var(--radius-lg);
    padding: 1.75rem 1.5rem;
    box-shadow: var(--shadow-md);
    border: 1px solid rgba(231, 229, 228, 0.7);
}
.screen.active {
    display: block;
    animation: fade-in-up 0.45s var(--ease) both;
}

/* Staggered fade-in of intro content */
#intro.active > * {
    animation: fade-in-up 0.5s var(--ease) both;
}
#intro.active > *:nth-child(1) { animation-delay: 0.05s; }
#intro.active > *:nth-child(2) { animation-delay: 0.15s; }
#intro.active > *:nth-child(3) { animation-delay: 0.25s; }
#intro.active > *:nth-child(4) { animation-delay: 0.35s; }
#intro.active > *:nth-child(5) { animation-delay: 0.45s; }
#intro.active > *:nth-child(6) { animation-delay: 0.55s; }
#intro.active > *:nth-child(7) { animation-delay: 0.65s; }

/* ---------- Intro ---------- */
#intro {
    text-align: center;
    padding: 2.25rem 1.5rem;
}
.intro-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    background: var(--teal-tint);
    color: var(--teal-deep);
    font-size: 0.82rem;
    font-weight: 700;
    padding: 0.4rem 0.95rem;
    border-radius: 999px;
    margin-bottom: 1.35rem;
    border: 1px solid rgba(13, 148, 136, 0.18);
}
.intro-badge .lock { font-size: 0.85rem; }

#intro h2 {
    font-size: 1.75rem;
    line-height: 1.2;
    margin-bottom: 0.85rem;
}
#intro > p {
    color: var(--ink-soft);
    margin-bottom: 1.75rem;
    max-width: 34ch;
    margin-left: auto;
    margin-right: auto;
}

.trust-list {
    list-style: none;
    text-align: left;
    max-width: 20rem;
    margin: 0 auto 1.75rem;
    display: grid;
    gap: 0.7rem;
}
.trust-list li {
    display: flex;
    align-items: flex-start;
    gap: 0.65rem;
    font-size: 1rem;
    color: var(--ink);
}
.trust-list li::before {
    content: '✓';
    color: var(--teal);
    font-weight: 800;
    flex-shrink: 0;
}

.privacy-note {
    margin-top: 1.15rem;
    font-size: 0.85rem;
    color: var(--ink-faint);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
}

/* ---------- Buttons ---------- */
.btn-primary,
.btn-secondary,
.btn-unlock {
    min-height: var(--tap);
    padding: 0.95rem 1.5rem;
    font-size: 1.05rem;
    font-weight: 700;
    font-family: var(--font-head);
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: transform 0.2s var(--ease), box-shadow 0.2s var(--ease), background 0.2s var(--ease);
}

.btn-primary,
.btn-unlock {
    width: 100%;
    color: #fff;
    background: linear-gradient(135deg, var(--teal-bright), var(--teal));
    box-shadow: var(--shadow-sm), 0 4px 14px rgba(13, 148, 136, 0.28);
}
.btn-primary:hover,
.btn-unlock:hover {
    transform: scale(1.02);
    box-shadow: var(--shadow-md), 0 8px 22px rgba(13, 148, 136, 0.34);
}
.btn-primary:active,
.btn-unlock:active { transform: scale(0.99); }

.btn-secondary {
    color: var(--ink-soft);
    background: var(--surface);
    border: 1.5px solid var(--line);
}
.btn-secondary:hover {
    background: #F5F5F4;
    transform: scale(1.02);
    box-shadow: var(--shadow-sm);
}

/* Visible keyboard focus everywhere */
:focus-visible {
    outline: 3px solid var(--teal-ring);
    outline-offset: 2px;
}

/* ---------- Progress ---------- */
.progress-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 0.5rem;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--ink-faint);
}
.progress-count { color: var(--teal); }

.progress-bar {
    height: 10px;
    background: var(--line);
    border-radius: 999px;
    margin-bottom: 1.75rem;
    overflow: hidden;
}
.progress {
    height: 100%;
    background: linear-gradient(90deg, var(--teal-bright), var(--teal));
    border-radius: 999px;
    width: 0%;
    transition: width 0.5s var(--ease);
}

/* ---------- Question ---------- */
#question-container {
    min-height: 180px;
    margin-bottom: 1.5rem;
}
#question-container.slide-in-right { animation: slide-in-right 0.32s var(--ease) both; }
#question-container.slide-in-left { animation: slide-in-left 0.32s var(--ease) both; }

#question-container h3 {
    font-size: 1.4rem;
    line-height: 1.3;
    margin-bottom: 1.25rem;
}
.hint {
    display: block;
    font-size: 0.9rem;
    font-weight: 400;
    color: var(--ink-faint);
    margin-top: 0.35rem;
    font-family: var(--font-body);
}

/* ---------- Options ---------- */
.options {
    display: flex;
    flex-direction: column;
    gap: 0.7rem;
}
.option {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    width: 100%;
    min-height: var(--tap);
    padding: 0.9rem 1rem;
    font-size: 1.05rem;
    font-family: var(--font-body);
    text-align: left;
    color: var(--ink);
    background: var(--surface);
    border: 2px solid var(--line);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: border-color 0.2s var(--ease), background 0.2s var(--ease), transform 0.12s var(--ease), box-shadow 0.2s var(--ease);
}
.option:hover {
    border-color: var(--teal-bright);
    background: var(--teal-tint);
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
}

.option .indicator {
    flex-shrink: 0;
    width: 24px;
    height: 24px;
    border: 2px solid #CBD5E1;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s var(--ease);
}
.option[data-multi="true"] .indicator { border-radius: 7px; }

.option.selected {
    border-color: var(--teal);
    background: var(--teal-tint);
    font-weight: 600;
}
.option.selected .indicator {
    border-color: var(--teal);
    background: var(--teal);
    color: #fff;
    transform: scale(1.05);
}
.option.selected .indicator::after {
    content: '✓';
    font-size: 0.85rem;
    font-weight: 800;
}

/* ---------- Inline validation ---------- */
.field-error {
    display: none;
    color: #B91C1C;
    font-size: 0.95rem;
    font-weight: 600;
    margin-top: 1rem;
}
.field-error.show {
    display: block;
    animation: fade-in-up 0.25s var(--ease) both;
}

/* ---------- Navigation ---------- */
.nav-buttons {
    display: flex;
    gap: 0.75rem;
}
.nav-buttons .btn-primary { flex: 1; }
.nav-buttons .btn-secondary { flex-shrink: 0; }

/* ---------- Loading ---------- */
#loading {
    text-align: center;
    padding: 3.5rem 1.5rem;
}
.spinner {
    width: 48px;
    height: 48px;
    margin: 0 auto 1.25rem;
    border: 4px solid var(--teal-tint);
    border-top-color: var(--teal);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}
#loading p {
    font-size: 1.15rem;
    color: var(--ink-soft);
    font-weight: 600;
}

/* ---------- Results ---------- */
.results-head {
    text-align: center;
    padding: 0.5rem 0 1.25rem;
}
.results-count {
    font-family: var(--font-head);
    font-size: 3rem;
    font-weight: 800;
    line-height: 1;
    background: linear-gradient(135deg, var(--teal), var(--coral));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}
.results-head h2 {
    font-size: 1.4rem;
    margin: 0.5rem 0 0.35rem;
}
.results-head p {
    color: var(--ink-soft);
    font-size: 1rem;
}

.disclaimer-box {
    display: flex;
    gap: 0.6rem;
    background: var(--warning-bg);
    border: 1px solid var(--warning-border);
    border-radius: var(--radius-sm);
    padding: 0.9rem 1rem;
    margin-bottom: 1.5rem;
    font-size: 0.9rem;
    color: var(--warning-text);
    line-height: 1.45;
}

.category-heading {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--ink);
    margin: 1.75rem 0 0.85rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--line);
}
.category-heading .cat-icon {
    font-size: 1.25rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.2rem;
    height: 2.2rem;
    background: #fff;
    border: 1.5px solid rgba(13, 148, 136, 0.2);
    border-radius: 11px;
    box-shadow: var(--shadow-sm);
}

/* Cards — fade-up on scroll via AOS (data-aos), hover-lift via transition */
.result-card {
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 1.35rem;
    margin-bottom: 0.9rem;
    background: var(--surface);
    box-shadow: var(--shadow-sm);
    transition: box-shadow 0.25s var(--ease), transform 0.25s var(--ease);
}
.result-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-3px);
}
/* Card header: category icon chip + title */
.card-head {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    margin-bottom: 0.55rem;
}
.card-icon {
    flex-shrink: 0;
    width: 2.5rem;
    height: 2.5rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
    background: #fff;
    border: 1.5px solid rgba(13, 148, 136, 0.22);
    border-radius: 12px;
    box-shadow: var(--shadow-sm);
}

.result-card h4 {
    font-size: 1.2rem;
    color: var(--ink);
    margin-bottom: 0;
}
.result-card .card-desc {
    color: var(--ink-soft);
    font-size: 0.98rem;
    margin-bottom: 1rem;
}

/* Expandable "how to apply" */
.apply-details {
    border-top: 1px solid var(--line);
    margin-top: 0.25rem;
}
.apply-details summary {
    list-style: none;
    cursor: pointer;
    padding: 0.85rem 0 0.25rem;
    font-weight: 700;
    color: var(--teal);
    display: flex;
    align-items: center;
    gap: 0.4rem;
    min-height: 44px;
}
.apply-details summary::-webkit-details-marker { display: none; }
.apply-details summary .chevron {
    transition: transform 0.25s var(--ease);
    font-size: 0.8rem;
}
.apply-details[open] summary .chevron { transform: rotate(90deg); }
.apply-steps {
    list-style: none;
    counter-reset: step;
    padding: 0.5rem 0 0.75rem;
    display: grid;
    gap: 0.6rem;
}
.apply-steps li {
    counter-increment: step;
    display: flex;
    gap: 0.65rem;
    font-size: 0.95rem;
    color: var(--ink-soft);
    align-items: flex-start;
}
.apply-steps li::before {
    content: counter(step);
    flex-shrink: 0;
    width: 24px;
    height: 24px;
    background: var(--teal-tint);
    color: var(--teal-deep);
    font-weight: 800;
    font-size: 0.8rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}
.card-link {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    color: var(--teal);
    text-decoration: none;
    font-weight: 700;
    font-size: 0.98rem;
    min-height: 44px;
    transition: gap 0.2s var(--ease);
}
.card-link:hover { text-decoration: underline; gap: 0.55rem; }

/* Empty state */
.empty-state {
    text-align: center;
    padding: 1.5rem 1rem;
    color: var(--ink-soft);
}
.empty-state .phone {
    display: inline-block;
    margin-top: 0.75rem;
    font-size: 1.3rem;
    font-weight: 800;
    color: var(--teal);
}

/* ---------- "Find more" card ---------- */
.unlock-more-card {
    background: linear-gradient(135deg, var(--teal-tint), var(--coral-tint));
    border: 1.5px solid rgba(13, 148, 136, 0.18);
    border-radius: var(--radius);
    padding: 1.6rem;
    margin: 1.75rem 0;
    text-align: center;
    animation: fade-in-up 0.5s var(--ease) both;
}
.unlock-icon {
    font-size: 2rem;
    margin-bottom: 0.5rem;
}
.unlock-more-card h3 {
    font-size: 1.25rem;
    color: var(--teal-deep);
    margin-bottom: 0.5rem;
}
.unlock-more-card p {
    color: var(--ink-soft);
    font-size: 0.95rem;
    margin-bottom: 1.15rem;
}

.restart-btn {
    width: 100%;
    margin-top: 1.5rem;
}

/* ---------- Footer ---------- */
footer {
    text-align: center;
    padding: 1.75rem 1.5rem;
    color: var(--ink-faint);
    font-size: 0.82rem;
    line-height: 1.55;
    max-width: var(--maxw);
    margin: 0 auto;
}
.footer-privacy {
    color: var(--teal-deep);
    font-weight: 600;
    margin-bottom: 0.6rem;
}

/* ---------- Larger screens ---------- */
@media (min-width: 768px) {
    main { padding: 2.5rem 1.5rem; }
    .screen { padding: 2.5rem; }
    #intro { padding: 3rem 2.5rem; }
    #intro h2 { font-size: 2rem; }
}

/* ==========================================================================
   i18n language switcher, results actions, and print styles
   ========================================================================== */

/* ---------- Language switcher ---------- */
.lang-switcher {
    flex-shrink: 0;
    display: inline-flex;
    gap: 0.15rem;
    background: rgba(255, 255, 255, 0.16);
    border-radius: 999px;
    padding: 0.2rem;
    backdrop-filter: blur(4px);
}
.lang-switcher button {
    border: none;
    background: transparent;
    color: #fff;
    font-family: var(--font-head);
    font-weight: 700;
    font-size: 0.8rem;
    line-height: 1;
    padding: 0.45rem 0.6rem;
    min-height: 40px;
    border-radius: 999px;
    cursor: pointer;
    transition: background 0.15s var(--ease), color 0.15s var(--ease);
}
.lang-switcher button:hover { background: rgba(255, 255, 255, 0.18); }
.lang-switcher button.active {
    background: #fff;
    color: var(--teal-dark);
}

/* ---------- Results save / print / share ---------- */
.results-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
    margin: 1.75rem 0 0.25rem;
}
.btn-action {
    flex: 1 1 8rem;
    min-height: var(--tap);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    padding: 0.75rem 1rem;
    font-family: var(--font-head);
    font-weight: 700;
    font-size: 0.98rem;
    color: var(--teal-dark);
    background: var(--teal-tint);
    border: 1.5px solid rgba(13, 148, 136, 0.25);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: background 0.15s var(--ease), transform 0.15s var(--ease), box-shadow 0.15s var(--ease);
}
.btn-action:hover {
    background: #fff;
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
}
.btn-action:active { transform: translateY(0); }

/* Machine-translation note reuses the disclaimer box in teal */
.disclaimer-box.trans-note {
    background: var(--teal-tint);
    border-color: rgba(13, 148, 136, 0.25);
    color: var(--teal-deep);
}

/* ---------- Print / Save as PDF ---------- */
@media print {
    .bg-blobs, .wave-header, .footer-wave, .lang-switcher, .hero-illustration,
    .nav-buttons, .results-actions, .unlock-more-card, .restart-btn, .skip-link,
    .progress-bar, .progress-header, #loading, .spinner {
        display: none !important;
    }
    body { background: #fff; color: #000; font-size: 12pt; }
    header {
        background: none !important;
        color: var(--ink);
        box-shadow: none;
        padding: 0.25rem 0 0.5rem;
    }
    .brand { color: var(--teal-dark); }
    .tagline { color: var(--ink-soft); }
    main { padding: 0; max-width: 100%; }
    .screen { box-shadow: none; border: none; padding: 0; animation: none; }
    .result-card {
        break-inside: avoid;
        box-shadow: none;
        border: 1px solid #ccc;
        opacity: 1 !important;
        transform: none !important;
    }
    /* Show the "how to apply" steps even when the accordion is collapsed */
    details.apply-details:not([open]) > *:not(summary) { display: block !important; }
    .apply-details summary .chevron { display: none; }
    /* Print the real URL next to each link (useful on paper) */
    .card-link span { display: none; }
    .card-link::after {
        content: " — " attr(href);
        font-weight: 400;
        color: #555;
        word-break: break-all;
    }
}

/* Keep the language switcher from crowding the logo on small screens */
@media (max-width: 480px) {
    .logo { font-size: 1.7rem; }
    .lang-switcher button { padding: 0.4rem 0.5rem; font-size: 0.75rem; min-height: 38px; }
}

/* ==========================================================================
   Document checklist
   ========================================================================== */
.doc-checklist {
    background: var(--coral-tint);
    border: 1.5px solid rgba(249, 115, 22, 0.2);
    border-radius: var(--radius);
    padding: 1.4rem 1.35rem;
    margin: 1.5rem 0;
}
.doc-checklist h3 {
    font-size: 1.15rem;
    color: var(--coral-dark);
    margin-bottom: 0.35rem;
    display: flex;
    align-items: center;
    gap: 0.45rem;
}
.doc-checklist > p {
    color: var(--ink-soft);
    font-size: 0.95rem;
    margin-bottom: 1rem;
}
.doc-check-list {
    list-style: none;
    display: grid;
    gap: 0.55rem;
}
.doc-item {
    display: flex;
    align-items: flex-start;
    gap: 0.7rem;
    min-height: 44px;
    padding: 0.6rem 0.75rem;
    background: var(--surface);
    border: 1.5px solid var(--line);
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 0.98rem;
    line-height: 1.4;
    transition: border-color 0.15s var(--ease), background 0.15s var(--ease);
}
.doc-item:hover { border-color: var(--coral); }
.doc-item input {
    flex-shrink: 0;
    width: 22px;
    height: 22px;
    margin-top: 1px;
    accent-color: var(--teal);
    cursor: pointer;
}
.doc-item:has(input:checked) {
    background: var(--teal-tint);
    border-color: var(--teal);
}
.doc-item:has(input:checked) span {
    color: var(--ink-faint);
    text-decoration: line-through;
}

/* Per-card "documents to prepare" */
.card-docs {
    margin-top: 0.6rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--line);
}
.card-docs-title {
    display: block;
    font-weight: 700;
    font-size: 0.9rem;
    color: var(--ink);
    margin-bottom: 0.4rem;
}
.card-docs ul {
    list-style: none;
    display: grid;
    gap: 0.3rem;
}
.card-docs li {
    position: relative;
    padding-left: 1.35rem;
    font-size: 0.92rem;
    color: var(--ink-soft);
}
.card-docs li::before {
    content: '📄';
    position: absolute;
    left: 0;
    font-size: 0.82rem;
}

@media print {
    .doc-checklist, .card-docs { break-inside: avoid; }
    .doc-checklist { background: none; border: 1px solid #ccc; }
}

/* ==========================================================================
   AiduRight wordmark logo (house-A with heart)
   ========================================================================== */
.brand {
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.logo {
    display: inline-flex;
    align-items: center;
    font-family: 'Nunito', var(--font-head);
    font-weight: 800;
    font-size: 1.95rem;
    line-height: 1;
    letter-spacing: -0.01em;
}
.logo-a {
    width: 1.12em;            /* explicit size — avoids mobile Safari width:auto bug */
    height: 1.06em;
    flex-shrink: 0;
    color: #fff;              /* house stroke via currentColor */
    margin-right: 0.05em;
    transform: translateY(0.03em);
}
.logo-heart { fill: #FA8072; }
.logo-idu   { color: #fff; }
.logo-right { color: #FA8072; }

/* Keep the logo legible when printed on white */
@media print {
    .logo-a, .logo-idu { color: var(--teal-dark); }
    .logo-right { color: #FA8072; }
}

/* ---------- Image logo (extracted brand asset) ---------- */
.logo-img {
    height: 2.3rem;
    width: auto;
    display: block;
}
.logo-print { display: none; }
@media (max-width: 480px) {
    .logo-img { height: 2rem; }
}
@media print {
    .logo-img { display: none; }
    .logo-print {
        display: inline;
        font-family: 'Nunito', var(--font-head);
        font-weight: 800;
        font-size: 1.6rem;
        color: var(--teal-dark);
    }
}

/* ==========================================================================
   AI assistant — "Ask AI" link + chat modal
   ========================================================================== */

/* Visually hidden but available to screen readers. */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* ---------- The per-question trigger ---------- */
.ask-ai-link {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    margin-top: 1rem;
    padding: 0.5rem 0.85rem 0.5rem 0.6rem;
    font-family: var(--font-body);
    font-size: 0.92rem;
    font-weight: 600;
    color: var(--teal-dark);
    background: var(--teal-tint);
    border: 1px solid rgba(13, 148, 136, 0.18);
    border-radius: 999px;
    cursor: pointer;
    transition: background var(--t), border-color var(--t), transform var(--t);
}
.ask-ai-link:hover {
    background: #E1FBF6;
    border-color: rgba(13, 148, 136, 0.35);
}
.ask-ai-link:active { transform: scale(0.98); }
.ask-ai-link:focus-visible {
    outline: 3px solid var(--teal-ring);
    outline-offset: 2px;
}
.ask-ai-icon { font-size: 1rem; line-height: 1; }

/* ---------- Modal shell ---------- */
.ai-modal[hidden] { display: none; }
.ai-modal {
    position: fixed;
    inset: 0;
    z-index: 200;
    display: flex;
    align-items: flex-end;
    justify-content: center;
}
body.ai-open { overflow: hidden; }

.ai-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(17, 94, 89, 0.42);
    backdrop-filter: blur(2px);
    animation: ai-fade 0.25s var(--ease) both;
}

.ai-panel {
    position: relative;
    display: flex;
    flex-direction: column;
    width: 100%;
    max-width: var(--maxw);
    /* Sits above the mobile browser chrome and never taller than the viewport. */
    max-height: min(88vh, 720px);
    background: var(--surface);
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    box-shadow: var(--shadow-lg);
    animation: ai-rise 0.3s var(--ease) both;
    overflow: hidden;
}

@keyframes ai-fade {
    from { opacity: 0; }
    to { opacity: 1; }
}
@keyframes ai-rise {
    from { opacity: 0; transform: translateY(28px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ---------- Header ---------- */
.ai-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1.1rem 1.25rem;
    color: #fff;
    background: linear-gradient(135deg, var(--teal-bright), var(--teal));
    flex-shrink: 0;
}
.ai-header h2 {
    flex: 1;
    font-family: var(--font-head);
    font-size: 1.1rem;
    font-weight: 800;
    line-height: 1.25;
}
.ai-close {
    display: grid;
    place-items: center;
    width: 40px;
    height: 40px;
    flex-shrink: 0;
    color: #fff;
    background: rgba(255, 255, 255, 0.16);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    transition: background var(--t);
}
.ai-close:hover { background: rgba(255, 255, 255, 0.3); }
.ai-close:focus-visible {
    outline: 3px solid #fff;
    outline-offset: 2px;
}
.ai-close svg { width: 18px; height: 18px; }

/* ---------- Privacy notice ---------- */
.ai-privacy {
    display: flex;
    gap: 0.5rem;
    padding: 0.8rem 1.25rem;
    font-size: 0.84rem;
    line-height: 1.45;
    color: var(--warning-text);
    background: var(--warning-bg);
    border-bottom: 1px solid var(--warning-border);
    flex-shrink: 0;
}

/* ---------- Transcript ---------- */
.ai-log {
    flex: 1;
    min-height: 140px;
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: 1.1rem 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 0.7rem;
}

.ai-msg {
    max-width: 88%;
    padding: 0.7rem 0.95rem;
    font-size: 0.96rem;
    line-height: 1.55;
    border-radius: var(--radius);
    /* Renders the model's newlines and "- " bullets without any markup. */
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}
.ai-msg-assistant {
    align-self: flex-start;
    color: var(--ink);
    background: var(--bg);
    border: 1px solid var(--line);
    border-bottom-left-radius: 6px;
}
.ai-msg-user {
    align-self: flex-end;
    color: #fff;
    background: linear-gradient(135deg, var(--teal-bright), var(--teal));
    border-bottom-right-radius: 6px;
}
/* Dimmed while the reply is still arriving (covers the "Thinking…" placeholder). */
.ai-msg.is-streaming { color: var(--ink-soft); }

.ai-notice {
    align-self: flex-start;
    max-width: 88%;
    padding: 0.65rem 0.9rem;
    font-size: 0.9rem;
    line-height: 1.5;
    color: var(--warning-text);
    background: var(--warning-bg);
    border: 1px solid var(--warning-border);
    border-radius: var(--radius-sm);
}

/* ---------- Composer ---------- */
/* Photos staged for the next message, above the composer. */
.ai-attachments {
    display: flex;
    flex-wrap: wrap;
    gap: 0.55rem;
    padding: 0.75rem 1.25rem 0;
    flex-shrink: 0;
}
.ai-thumb {
    position: relative;
    width: 68px;
    height: 68px;
    border-radius: var(--radius-sm);
    overflow: hidden;
    border: 1.5px solid var(--line);
    background: var(--bg);
}
.ai-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.ai-thumb button {
    position: absolute;
    top: 2px;
    right: 2px;
    display: grid;
    place-items: center;
    width: 22px;
    height: 22px;
    padding: 0;
    color: #fff;
    background: rgba(0, 0, 0, 0.6);
    border: none;
    border-radius: 50%;
    font-size: 0.9rem;
    line-height: 1;
    cursor: pointer;
}
.ai-thumb button:hover { background: rgba(0, 0, 0, 0.8); }
.ai-thumb button:focus-visible { outline: 2px solid #fff; outline-offset: -2px; }

/* Sits with the thumbnails, so the SSN warning is in view exactly when a
   photo is staged — not only in the header the user scrolled past. */
.ai-photo-reminder {
    width: 100%;
    margin: 0;
    font-size: 0.78rem;
    line-height: 1.45;
    color: var(--ink-soft);
}

.ai-form {
    display: flex;
    align-items: flex-end;
    gap: 0.6rem;
    padding: 0.85rem 1.25rem;
    border-top: 1px solid var(--line);
    background: var(--surface);
    flex-shrink: 0;
}
.ai-form textarea {
    flex: 1;
    max-height: 120px;
    padding: 0.75rem 0.9rem;
    font-family: var(--font-body);
    font-size: 1rem;
    line-height: 1.45;
    color: var(--ink);
    background: var(--bg);
    border: 1.5px solid var(--line);
    border-radius: var(--radius-sm);
    resize: none;
    transition: border-color var(--t), box-shadow var(--t);
}
.ai-form textarea::placeholder { color: var(--ink-faint); }
.ai-form textarea:focus {
    outline: none;
    border-color: var(--teal);
    box-shadow: 0 0 0 3px var(--teal-ring);
}
.ai-form textarea:disabled { opacity: 0.6; }

.ai-attach {
    display: grid;
    place-items: center;
    width: 42px;
    height: 42px;
    flex-shrink: 0;
    margin-bottom: 2px;
    color: var(--ink-soft);
    background: transparent;
    border: 1.5px solid var(--line);
    border-radius: 50%;
    cursor: pointer;
    transition: color var(--t), border-color var(--t), background var(--t);
}
.ai-attach:hover:not(:disabled) {
    color: var(--teal);
    border-color: var(--teal);
    background: var(--teal-ring);
}
.ai-attach:focus-visible {
    outline: 3px solid var(--teal-ring);
    outline-offset: 2px;
}
.ai-attach:disabled { opacity: 0.45; cursor: default; }
.ai-attach svg { width: 21px; height: 21px; }

/* Photos already sent, inside the user's own bubble. */
.ai-msg-images {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin-bottom: 0.45rem;
}
.ai-msg-images img {
    width: 116px;
    max-height: 150px;
    object-fit: cover;
    border-radius: var(--radius-sm);
    display: block;
}

.ai-send {
    display: grid;
    place-items: center;
    width: 46px;
    height: 46px;
    flex-shrink: 0;
    color: #fff;
    background: linear-gradient(135deg, var(--teal-bright), var(--teal));
    border: none;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: var(--shadow-sm);
    transition: transform var(--t), opacity var(--t);
}
.ai-send:hover:not(:disabled) { transform: scale(1.05); }
.ai-send:active:not(:disabled) { transform: scale(0.96); }
.ai-send:focus-visible {
    outline: 3px solid var(--teal-ring);
    outline-offset: 2px;
}
.ai-send:disabled { opacity: 0.45; cursor: default; }
.ai-send svg { width: 20px; height: 20px; margin-left: -2px; }

.ai-disclaimer {
    padding: 0 1.25rem 0.9rem;
    font-size: 0.78rem;
    line-height: 1.45;
    color: var(--ink-faint);
    text-align: center;
    flex-shrink: 0;
}

/* Centered dialog once there's room for one. */
@media (min-width: 768px) {
    .ai-modal { align-items: center; }
    .ai-panel {
        border-radius: var(--radius-lg);
        max-height: min(80vh, 720px);
    }
}

@media (max-width: 480px) {
    .ai-header, .ai-privacy, .ai-log, .ai-form, .ai-attachments { padding-left: 1rem; padding-right: 1rem; }
    .ai-disclaimer { padding-left: 1rem; padding-right: 1rem; }
    .ai-msg { max-width: 92%; }
}

/* The chat is a live interaction; there is nothing to put on paper. */
@media print {
    .ai-modal, .ask-ai-link { display: none !important; }
}
