/* Ellis the Eagle: civics interview coach. Relies on ../styles.css for nav, buttons and brand variables. */

body.civics {
    background: linear-gradient(180deg, #EAF6FD 0%, var(--gray-50) 45%, var(--white) 100%);
    min-height: 100vh;
}

.civics-main {
    padding: 96px 0 40px;
}

.civics-container {
    max-width: 880px;
}

[hidden] { display: none !important; }

/* === Stage === */
.stage {
    display: grid;
    grid-template-columns: 260px 1fr;
    gap: 20px;
    align-items: center;
    margin-bottom: 20px;
}

.eagle-wrap {
    width: 100%;
    max-width: 260px;
    justify-self: center;
}

.eagle {
    width: 100%;
    height: auto;
    overflow: visible;
    --mouth: 0;
    --level: 0;
}

.bubble {
    position: relative;
    background: var(--white);
    border: 2px solid var(--blue-dark);
    border-radius: 20px;
    padding: 20px 22px;
    box-shadow: 0 8px 24px rgba(14, 79, 131, 0.12);
    min-height: 110px;
}

.bubble::before {
    content: '';
    position: absolute;
    left: -14px;
    top: 50%;
    width: 24px;
    height: 24px;
    background: var(--white);
    border-left: 2px solid var(--blue-dark);
    border-bottom: 2px solid var(--blue-dark);
    transform: translateY(-50%) rotate(45deg);
}

.bubble-meta {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--gray-400);
    margin-bottom: 6px;
}

.bubble-meta:empty { display: none; }

.bubble-text {
    font-size: 1.25rem;
    font-weight: 600;
    line-height: 1.45;
    color: var(--gray-900);
}

.bubble-text.masked {
    color: transparent;
    text-shadow: 0 0 12px rgba(15, 23, 42, 0.35);
    user-select: none;
}

/* === Panels === */
.panel {
    background: var(--white);
    border-radius: 20px;
    padding: 28px;
    box-shadow: 0 4px 20px rgba(15, 23, 42, 0.06);
    position: relative;
}

.panel-title {
    font-size: 1.6rem;
    color: var(--gray-900);
    margin-bottom: 4px;
}

.panel-sub {
    color: var(--gray-600);
    margin-bottom: 20px;
    font-size: 0.95rem;
}

.mode-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 14px;
}

.mode-card {
    text-align: left;
    background: var(--gray-50);
    border: 2px solid var(--gray-200);
    border-radius: 16px;
    padding: 18px;
    cursor: pointer;
    font: inherit;
    color: inherit;
    transition: border-color 0.2s, transform 0.2s, box-shadow 0.2s;
}

.mode-card:hover:not(:disabled), .mode-card:focus-visible {
    border-color: var(--blue-dark);
    transform: translateY(-2px);
    box-shadow: 0 6px 18px rgba(14, 79, 131, 0.12);
    outline: none;
}

.mode-card:disabled {
    opacity: 0.5;
    cursor: default;
}

.mode-name {
    display: block;
    font-weight: 700;
    font-size: 1.1rem;
    color: var(--blue-dark);
    margin-bottom: 6px;
}

.mode-desc {
    display: block;
    font-size: 0.9rem;
    color: var(--gray-600);
    line-height: 1.5;
}

.settings {
    margin-top: 22px;
    border-top: 1px solid var(--gray-200);
    padding-top: 16px;
}

.settings summary {
    cursor: pointer;
    font-weight: 600;
    color: var(--gray-800);
}

.settings-grid {
    display: grid;
    gap: 10px;
    margin: 14px 0;
}

.check {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    font-size: 0.95rem;
    color: var(--gray-800);
    cursor: pointer;
}

.check input { margin-top: 4px; accent-color: var(--blue-dark); }

.local-answers {
    background: var(--gray-50);
    border-radius: 12px;
    padding: 14px;
    margin-bottom: 12px;
}

.local-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin: 10px 0;
}

.local-grid label {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--gray-600);
    display: grid;
    gap: 4px;
}

.local-grid input, .type-form input {
    font: inherit;
    font-size: 0.95rem;
    padding: 10px 12px;
    border: 1.5px solid var(--gray-200);
    border-radius: 10px;
    background: var(--white);
    color: var(--gray-900);
    width: 100%;
}

.local-grid input:focus, .type-form input:focus {
    outline: none;
    border-color: var(--blue-dark);
}

.hint {
    font-size: 0.85rem;
    color: var(--gray-600);
    line-height: 1.5;
    margin: 6px 0;
}

.status-line {
    margin-top: 14px;
    font-size: 0.82rem;
    color: var(--gray-400);
}

.link-btn {
    background: none;
    border: none;
    padding: 6px 0;
    font: inherit;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--blue-dark);
    cursor: pointer;
}

.link-btn:hover { text-decoration: underline; }
.link-btn.danger { color: #B91C1C; }

.btn-small { padding: 10px 18px; font-size: 0.95rem; }

.btn-outline-dark {
    background: transparent;
    color: var(--blue-dark);
    border: 2px solid var(--blue-dark);
}

.btn-outline-dark:hover { background: var(--blue-dark); color: var(--white); }

/* === Quiz === */
.scorebar {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 22px;
}

.score-chip {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: 999px;
    font-weight: 700;
    font-size: 1rem;
    white-space: nowrap;
}

.score-chip.ok { background: #DCFCE7; color: #166534; }
.score-chip.bad { background: #FEE2E2; color: #991B1B; }

.dots {
    flex: 1;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    justify-content: center;
}

.dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--gray-200);
    transition: background 0.3s, transform 0.3s;
}

.dot.current { background: var(--blue-light); transform: scale(1.3); }
.dot.ok { background: #22C55E; }
.dot.bad { background: #EF4444; }
.dot.goal { box-shadow: 0 0 0 2px var(--orange); }

.answer-zone {
    display: grid;
    justify-items: center;
    gap: 10px;
}

.mic {
    position: relative;
    width: 108px;
    height: 108px;
    border-radius: 50%;
    border: none;
    cursor: pointer;
    color: var(--white);
    background: linear-gradient(135deg, var(--blue-dark), #1A6BAE);
    box-shadow: 0 10px 24px rgba(14, 79, 131, 0.35);
    display: grid;
    place-items: center;
    transition: transform 0.15s, background 0.2s;
    -webkit-tap-highlight-color: transparent;
}

.mic:active { transform: scale(0.96); }
.mic:disabled { opacity: 0.45; cursor: default; box-shadow: none; }

.mic svg { position: relative; z-index: 1; }

.mic-ring {
    position: absolute;
    inset: -8px;
    border-radius: 50%;
    border: 4px solid var(--orange);
    opacity: 0;
    transform: scale(calc(1 + var(--level, 0) * 0.35));
    transition: transform 0.08s linear, opacity 0.2s;
}

.mic.recording {
    background: linear-gradient(135deg, #DC2626, var(--orange));
}

.mic.recording .mic-ring { opacity: 1; }

.mic.busy .mic-ring {
    opacity: 1;
    border-color: var(--blue-light);
    border-top-color: transparent;
    animation: spin 0.9s linear infinite;
}

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

.mic-label {
    font-weight: 600;
    color: var(--gray-600);
    min-height: 1.5em;
}

.type-form {
    display: flex;
    gap: 8px;
    width: 100%;
    max-width: 460px;
}

.result {
    border-radius: 16px;
    padding: 20px;
    margin-top: 4px;
    animation: rise 0.3s ease;
}

.result.ok { background: #F0FDF4; border: 2px solid #86EFAC; }
.result.bad { background: #FEF2F2; border: 2px solid #FCA5A5; }

@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.result-head {
    font-size: 1.3rem;
    font-weight: 700;
    margin-bottom: 8px;
}

.result.ok .result-head { color: #166534; }
.result.bad .result-head { color: #991B1B; }

.result-heard {
    color: var(--gray-600);
    font-style: italic;
    margin-bottom: 6px;
}

.result-note {
    color: var(--gray-800);
    margin-bottom: 10px;
}

.result-answers summary {
    cursor: pointer;
    font-weight: 600;
    color: var(--blue-dark);
    font-size: 0.9rem;
}

.result-answers ul {
    margin: 8px 0 0 20px;
    color: var(--gray-800);
    font-size: 0.95rem;
}

.result-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin-top: 14px;
    flex-wrap: wrap;
}

.quit {
    display: block;
    margin: 18px auto 0;
    color: var(--gray-400);
}

/* === Summary === */
.end-title {
    font-size: 1.8rem;
    margin-bottom: 4px;
}

.end-title.pass { color: #166534; }
.end-title.fail { color: #991B1B; }

.end-sub { color: var(--gray-600); margin-bottom: 18px; }

.review {
    margin: 0 0 20px 22px;
    display: grid;
    gap: 10px;
}

.review li { color: var(--gray-800); }
.review li.ok::marker { color: #16A34A; }
.review li.bad::marker { color: #DC2626; }
.review .rv-q { font-weight: 600; }
.review .rv-a { display: block; font-size: 0.9rem; color: var(--gray-600); }

.end-actions { display: flex; gap: 12px; flex-wrap: wrap; }

.disclaimer {
    margin-top: 18px;
    font-size: 0.78rem;
    color: var(--gray-400);
    text-align: center;
    line-height: 1.5;
}

/* === Eagle animation === */
.eagle .bird, .eagle .head, .eagle .wing, .eagle .mandible, .eagle .mouth-inside,
.eagle .brow, .eagle .lid, .eagle .pupil, .eagle .waves, .eagle .thinking-dots {
    transform-box: fill-box;
    transition: transform 0.25s ease, opacity 0.25s ease;
}

.eagle .bird { transform-origin: 50% 100%; animation: breathe 3.6s ease-in-out infinite; }
.eagle .head { transform-origin: 50% 90%; }
.eagle .wing-left { transform-origin: 80% 10%; }
.eagle .wing-right { transform-origin: 20% 10%; }

.eagle .lid { transform-origin: 50% 0%; transform: scaleY(0); animation: blink 5s infinite; }
.eagle .eye-right .lid { animation-delay: 0.04s; }

.eagle .mandible { transition: none; transform: translateY(calc(var(--mouth) * 11px)); }
.eagle .mouth-inside { transition: none; transform-origin: 50% 0%; transform: scaleY(calc(0.2 + var(--mouth) * 1.2)); opacity: calc(var(--mouth) * 3); }

.eagle .happy-eyes { opacity: 0; transition: opacity 0.2s; }
.eagle .waves { opacity: 0; transform-origin: 0% 50%; }
.eagle .thinking-dots { opacity: 0; }
.eagle .shadow { transform-box: fill-box; transform-origin: center; }

@keyframes breathe { 0%, 100% { transform: scaleY(1); } 50% { transform: scaleY(1.012); } }
@keyframes blink { 0%, 94%, 100% { transform: scaleY(0); } 96% { transform: scaleY(1); } }

/* listening: head tilts toward the user, sound waves track mic level */
.eagle.listening .head { transform: rotate(-7deg) translateX(-4px); }
.eagle.listening .waves { opacity: 1; transform: scale(calc(0.85 + var(--level) * 0.6)); }
.eagle.listening .brow-left { transform: translateY(-5px); }
.eagle.listening .brow-right { transform: translateY(-5px); }

/* thinking: eyes up, dots pulse */
.eagle.thinking .pupil { transform: translate(3px, -4px); }
.eagle.thinking .head { transform: rotate(4deg); }
.eagle.thinking .thinking-dots { opacity: 1; }
.eagle.thinking .thinking-dots circle { animation: dot 1.2s infinite; }
.eagle.thinking .thinking-dots circle:nth-child(2) { animation-delay: 0.2s; }
.eagle.thinking .thinking-dots circle:nth-child(3) { animation-delay: 0.4s; }
@keyframes dot { 0%, 100% { opacity: 0.25; } 50% { opacity: 1; } }

/* happy: hop, wings out, smiling eyes */
.eagle.happy .bird { animation: hop 0.6s ease 2; }
.eagle.happy .wing-left { transform: rotate(-24deg); }
.eagle.happy .wing-right { transform: rotate(24deg); }
.eagle.happy .eyes { opacity: 0; }
.eagle.happy .happy-eyes { opacity: 1; }
.eagle.happy .brow { transform: translateY(-6px); }
@keyframes hop { 0%, 100% { transform: translateY(0); } 40% { transform: translateY(-16px); } }

/* sad: brows tilt, head droops */
.eagle.sad .head { transform: translateY(5px) rotate(2deg); }
.eagle.sad .brow-left { transform: rotate(-14deg) translateY(2px); }
.eagle.sad .brow-right { transform: rotate(14deg) translateY(2px); }
.eagle.sad .pupil { transform: translateY(3px); }

/* celebrate: big finish */
.eagle.celebrate .bird { animation: hop 0.6s ease infinite; }
.eagle.celebrate .wing-left { animation: flapL 0.3s ease-in-out infinite alternate; }
.eagle.celebrate .wing-right { animation: flapR 0.3s ease-in-out infinite alternate; }
.eagle.celebrate .eyes { opacity: 0; }
.eagle.celebrate .happy-eyes { opacity: 1; }
@keyframes flapL { from { transform: rotate(0); } to { transform: rotate(-35deg); } }
@keyframes flapR { from { transform: rotate(0); } to { transform: rotate(35deg); } }

@media (prefers-reduced-motion: reduce) {
    .eagle * { animation: none !important; }
}

/* === Responsive === */
@media (max-width: 720px) {
    .civics-main { padding-top: 84px; }
    .stage { grid-template-columns: 1fr; gap: 14px; }
    .eagle-wrap { max-width: 150px; }
    .bubble { padding: 16px 18px; min-height: 0; }
    .dots { gap: 4px; }
    .dot { width: 10px; height: 10px; }
    .mic { width: 96px; height: 96px; }
    .bubble::before {
        left: 50%;
        top: -14px;
        transform: translateX(-50%) rotate(135deg);
    }
    .bubble-text { font-size: 1.1rem; }
    .mode-grid { grid-template-columns: 1fr; }
    .local-grid { grid-template-columns: 1fr; }
    .panel { padding: 20px; }
}

@media (max-width: 768px) {
    /* the site nav collapses at this width; keep the hamburger dark on this always-light page */
    .civics .nav-links { background: var(--white); }
}
