/*
 * Linvoce look and feel. Loaded after every other stylesheet.
 *
 * The rules here give the whole app one consistent style:
 *   - a light page with white cards and 2px soft borders (no heavy shadows)
 *   - chunky "pressable" buttons: a solid darker edge under each button that
 *     sinks when it is pressed
 *   - one rounded, bold typeface (Nunito)
 *   - blue for actions and selection, green only for "right", red only for
 *     "wrong", yellow only for "needs attention"
 * Colours come from theme.css.
 */

/* ===================== BASE ===================== */

body {
    font-family: var(--font);
    font-weight: 600;
    background: var(--bg);
    color: var(--ink);
    -webkit-font-smoothing: antialiased;
}

button,
input,
select,
textarea {
    font-family: inherit;
}

h1,
h2,
h3,
h4,
.home-greeting {
    color: var(--deep);
    font-weight: 900;
    letter-spacing: -0.01em;
}

h3,
h4 {
    font-weight: 800;
}

a {
    color: var(--primary-ink);
}

::selection {
    background: var(--primary-tint);
}

:focus-visible {
    outline: 3px solid var(--primary);
    outline-offset: 2px;
}

/* ===================== TOP BAR ===================== */

.top-navbar {
    background: var(--surface);
    border-bottom: 2px solid var(--line);
    box-shadow: none;
}

.nav-brand h1,
.welcome-brand {
    color: var(--primary);
    font-weight: 900;
    letter-spacing: -0.02em;
}

.nav-brand,
.nav-brand h1,
.welcome-brand {
    white-space: nowrap;
}

.nav-links {
    gap: 4px;
}

.nav-links a {
    position: relative;
    padding: 8px 12px;
    border: 2px solid transparent;
    border-radius: 12px;
    color: var(--muted);
    font-weight: 800;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    white-space: nowrap;
}

.welcome-bar {
    border-bottom: 2px solid var(--line);
}

.welcome-login {
    color: var(--primary-ink);
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.nav-links a:hover {
    background: var(--surface-2);
    color: var(--ink);
}

.nav-links a.active {
    background: var(--primary-tint);
    border-color: rgba(18, 124, 181, 0.35);
    color: var(--primary-ink);
}

/* ===================== PAGES AND CARDS ===================== */

/* The page itself is no longer a big box: cards sit straight on the page */
.page-view {
    background: transparent;
    border-radius: 0;
}

.home-card,
.info-card,
.custom-panel,
.quiz-card,
.auth-card,
.controls-panel,
.conversation-panel {
    background: var(--surface);
    border: 2px solid var(--line);
    border-radius: var(--radius-lg);
    box-shadow: none;
}

.auth-screen {
    background: var(--bg);
}

.avatar-option {
    border: 2px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface);
    color: var(--ink-2);
    box-shadow: 0 3px 0 var(--line);
}

/* ===================== BUTTONS ===================== */

/* Main action: solid blue with a darker edge that sinks when pressed */
.landing-primary,
.auth-submit,
.quiz-submit,
.daily-go,
.convo-go.convo-speak,
#mic-button {
    position: relative;
    border: none;
    border-radius: var(--radius);
    background: var(--primary);
    color: var(--on-color);
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    box-shadow: 0 var(--edge) 0 var(--primary-edge);
    transform: translateY(0);
    transition: transform 0.08s, box-shadow 0.08s, filter 0.15s;
}

.landing-primary:hover,
.auth-submit:hover,
.quiz-submit:hover,
.daily-go:hover,
.convo-go.convo-speak:hover,
#mic-button:hover {
    color: var(--on-color);
    background: var(--primary);
    filter: brightness(1.08);
    transform: translateY(0);
}

.landing-primary:active,
.auth-submit:active,
.quiz-submit:active,
.daily-go:active,
.convo-go.convo-speak:active,
#mic-button:active {
    transform: translateY(var(--edge));
    box-shadow: 0 0 0 var(--primary-edge);
}

/* The microphone stays round: a big blue disc that sinks when pressed */
#mic-button {
    border-radius: 50%;
    font-size: 40px;
    text-transform: none;
    letter-spacing: 0;
    box-shadow: 0 6px 0 var(--primary-edge);
}

#mic-button:active {
    transform: translateY(6px);
}

#mic-button.active {
    background: var(--danger);
    box-shadow: 0 6px 0 var(--danger-edge);
}

/* "Stop tutor": appears under the microphone while the tutor talks */
.tutor-skip {
    display: block;
    margin: -14px auto 24px;
    padding: 10px 18px;
    font-size: 14px;
}

.tutor-skip.is-hidden {
    display: none;
}

/* Second choice: white with a grey edge */
.landing-secondary,
.setting-btn,
.convo-go,
.reset-btn,
.write-back,
.verify-btn,
.level-btn,
.practice-btn {
    border: 2px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface);
    color: var(--ink-2);
    font-weight: 800;
    box-shadow: 0 3px 0 var(--line);
    transform: translateY(0);
    transition: transform 0.08s, box-shadow 0.08s, background-color 0.15s, border-color 0.15s;
}

.landing-secondary:hover,
.setting-btn:hover,
.convo-go:hover,
.reset-btn:hover,
.write-back:hover,
.verify-btn:hover,
.level-btn:hover,
.practice-btn:hover {
    background: var(--surface-2);
    border-color: var(--line);
    color: var(--ink);
}

.landing-secondary:active,
.setting-btn:active,
.convo-go:active,
.reset-btn:active,
.write-back:active,
.verify-btn:active,
.level-btn:active,
.practice-btn:active {
    transform: translateY(3px);
    box-shadow: 0 0 0 var(--line);
}

/* Chosen option (quiz type, mode, level...): light blue */
.setting-btn.active,
.level-btn.active,
.practice-btn.active,
.avatar-option.active,
.channel-btn.active {
    background: var(--primary-tint);
    border-color: var(--primary);
    color: var(--primary-ink);
    box-shadow: 0 3px 0 var(--primary);
}

.setting-btn.active *,
.practice-btn.active *,
.practice-btn.active .practice-desc {
    color: inherit;
}

/* Small buttons inside lists keep the same shape, just smaller */
.convo-go {
    padding: 9px 16px;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

button:disabled,
button[disabled] {
    filter: grayscale(0.4);
    opacity: 0.55;
    cursor: not-allowed;
    transform: none !important;
}

.home-go {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 14px 24px;
    font-size: 15px;
}

/* Two-way switches (Speak / Write, Log in / Create account) */
.channel-toggle {
    padding: 4px;
    gap: 4px;
    border: 2px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface-2);
}

.channel-btn {
    border: 2px solid transparent;
    border-radius: 10px;
    background: transparent;
    color: var(--muted);
    font-weight: 800;
}

.channel-btn.active {
    box-shadow: none;
}

/* ===================== FORMS ===================== */

input[type="text"],
input[type="email"],
input[type="password"],
input[type="search"],
input[type="number"],
input:not([type]),
textarea,
select {
    border: 2px solid var(--line);
    border-radius: 12px;
    background: var(--surface-2);
    color: var(--ink);
    font-weight: 600;
    transition: border-color 0.15s, background-color 0.15s;
}

input:focus,
textarea:focus,
select:focus {
    border-color: var(--primary);
    background: var(--surface);
    outline: none;
}

::placeholder {
    color: var(--faint);
    font-weight: 600;
}

input[type="checkbox"],
input[type="radio"] {
    accent-color: var(--primary);
}

/* ===================== PROGRESS ===================== */

.quiz-progress,
.home-today-bar {
    height: 16px;
    border-radius: 99px;
    background: var(--track);
    overflow: hidden;
}

.quiz-progress-bar,
.home-today-bar > div {
    position: relative;
    height: 100%;
    border-radius: 99px;
    background: var(--success);
}

/* A soft highlight along the top of every filled bar */
.quiz-progress-bar::after,
.home-today-bar > div::after {
    content: "";
    position: absolute;
    top: 3px;
    left: 8px;
    right: 8px;
    height: 4px;
    border-radius: 99px;
    background: rgba(255, 255, 255, 0.35);
}

/* Week chart on the home page */
.home-bar-fill {
    min-height: 6px;
    border-radius: 8px;
    background: var(--track);
}

.home-bar.is-today .home-bar-fill {
    background: var(--primary);
}

.home-bar.is-today .home-bar-day {
    color: var(--primary-ink);
    font-weight: 900;
}

.home-numbers b {
    color: var(--deep);
    font-weight: 900;
}

/* ===================== BANNERS ===================== */

.verify-banner {
    border: 2px solid rgba(245, 180, 0, 0.45);
    border-radius: var(--radius);
    background: var(--warning-tint);
    color: var(--warning-ink);
}

.verify-banner strong {
    color: var(--ink);
}

/* ===================== LAYOUT FIXES AFTER THE REDESIGN ===================== */

/* "Log out" stays on one line in the top bar */
.nav-logout,
.nav-profile {
    white-space: nowrap;
}

/* Buttons keep normal capitals, like the buttons next to them */
.landing-primary,
.auth-submit,
.quiz-submit,
.daily-go,
.convo-go,
.convo-go.convo-speak,
.welcome-login {
    text-transform: none;
    letter-spacing: 0.01em;
}

/* Speak / Write buttons on the home page: label centred when full width */
.home-go {
    justify-content: center;
}

/* Lesson search: one box, not an input box inside the search box */
.lesson-search {
    border: 2px solid var(--line);
    border-radius: 12px;
    background: var(--surface-2);
}

.lesson-search:focus-within {
    border-color: var(--primary);
    background: var(--surface);
}

.lesson-search input[type="search"] {
    padding: 14px 0;
    border: none;
    border-radius: 0;
    background: none;
}

/* Progress page "Last 7 days": the empty part of each bar shows again */
.week-track {
    background: var(--track);
}

/* Quiz question types fit on one row again */
.setting-btn[data-quiz-type] {
    padding: 9px 12px;
    font-size: 13.5px;
}

/* Top bar fits the window: slightly smaller nav buttons, and on narrow
   laptop screens the links scroll sideways instead of widening the page */
.top-navbar {
    gap: 16px;
}

.nav-links {
    flex: 0 1 auto;
    min-width: 0;
    overflow-x: auto;
    scrollbar-width: none;
}

.nav-links::-webkit-scrollbar {
    display: none;
}

.nav-links a {
    padding: 7px 9px;
    font-size: 12.5px;
    letter-spacing: 0.02em;
    flex: none;
}

/* On wide screens the links fill the bar and share the spare room evenly,
   so the space between headings matches the space before the language
   picker. Auto margins (not space-evenly) so nothing is cut off when the
   links overflow and scroll. */
@media (min-width: 801px) {
    .nav-links {
        flex: 1 1 auto;
    }

    .nav-links > a {
        margin-left: auto;
    }

    .nav-links::after {
        content: "";
        margin-left: auto;
    }
}

.nav-brand,
.nav-user {
    flex: none;
}

.nav-user {
    gap: 10px;
}

/* Speak page sidebar: items keep their size and the panel scrolls instead,
   so the Speak / Write switch is never squashed and cut off */
.controls-panel > * {
    flex-shrink: 0;
}

/* ===================== PHONES AND TABLETS ===================== */

/* iPhone and iPad zoom the whole page into any text box smaller than 16px
   (and don't zoom back out), so text boxes on touch screens are 16px */
@media (pointer: coarse) {
    input[type="text"],
    input[type="email"],
    input[type="password"],
    input[type="search"],
    input[type="number"],
    input:not([type]),
    textarea,
    select {
        font-size: 16px !important;
    }
}

/* ===================== ACCESSIBILITY ===================== */

/* Keyboard focus is always visible. Some fields above switch the outline
   off and only recolour a thin border, which is too faint to follow
   (WCAG 2.4.7). The outline is the primary blue: 4.5:1 on cards in both
   themes. */
:is(input, textarea, select, button, a, summary, [tabindex]:not([tabindex="-1"])):focus-visible {
    outline: 3px solid var(--primary) !important;
    outline-offset: 2px;
}

/* "Skip to content": the first thing a keyboard reaches, hidden until then */
.skip-link {
    position: fixed;
    top: 8px;
    left: 8px;
    z-index: 2000;
    padding: 10px 16px;
    border-radius: var(--radius-sm);
    background: var(--primary);
    color: var(--on-color);
    font-weight: bold;
    text-decoration: none;
    transform: translateY(-200%);
}

.skip-link:focus {
    transform: none;
}

/* Text only screen readers read (labels for icon-only controls) */
.sr-only {
    position: absolute !important;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* People who turn animations off in their system settings: no movement
   anywhere, not only in the places that already had a rule */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

/* A page that receives focus when it opens (so screen readers start
   there) is not itself something to click: no outline around it */
[tabindex="-1"]:focus {
    outline: none;
}
