/* ============================================================
   GATEWAY TO THE WORLD B1+ · INTERACTIVE PRACTICE
   style.css — Aesthetic stylesheet
   Palette: Coastal teal · Warm sand · Coral accent · Soft slate
   Fonts: Poppins (headings) + Inter (body)
   ============================================================ */

/* ---------- Google Fonts Import ---------- */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=Poppins:wght@500;600;700&display=swap');

/* ---------- CSS Custom Properties (Design Tokens) ---------- */
:root {
    /* Primary palette — deep coastal teal */
    --primary: #1a6b8a;
    --primary-dark: #0f4a61;
    --primary-light: #3a8fb0;
    --primary-soft: #e6f2f7;

    /* Secondary palette — warm sand */
    --sand: #d9a566;
    --sand-light: #f0d9b5;
    --sand-soft: #faf3e8;

    /* Accent — soft coral */
    --coral: #e76f51;
    --coral-soft: #fbe4dd;

    /* Neutrals */
    --ink: #1c2b38;
    --ink-soft: #3d5163;
    --ink-muted: #6b7f92;
    --line: #dde5ec;
    --line-soft: #eef3f7;

    /* Surfaces */
    --bg: #f5f8fb;
    --bg-alt: #eef3f8;
    --white: #ffffff;

    /* Feedback */
    --success: #2a9d6e;
    --success-soft: #e3f5ec;
    --success-deep: #0b4f2e;
    --error: #c94545;
    --error-soft: #fce9e9;
    --error-deep: #6b1e1e;

    /* Shadows */
    --shadow-sm: 0 2px 6px rgba(20, 40, 60, 0.05);
    --shadow-md: 0 6px 18px rgba(20, 40, 60, 0.07);
    --shadow-lg: 0 14px 34px rgba(20, 40, 60, 0.10);
    --shadow-focus: 0 0 0 3px rgba(26, 107, 138, 0.18);

    /* Radii */
    --radius-sm: 10px;
    --radius-md: 16px;
    --radius-lg: 24px;
    --radius-pill: 999px;

    /* Transitions */
    --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
    --transition: 0.2s var(--ease);
}

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

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', 'Segoe UI', Roboto, system-ui, -apple-system, sans-serif;
    font-size: 16px;
    line-height: 1.6;
    color: var(--ink);
    background:
        radial-gradient(circle at 0% 0%, rgba(58, 143, 176, 0.10), transparent 45%),
        radial-gradient(circle at 100% 0%, rgba(217, 165, 102, 0.10), transparent 45%),
        var(--bg);
    background-attachment: fixed;
    min-height: 100vh;
    padding: 2.5rem 1.25rem 3rem;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ---------- Layout Container ---------- */
.app {
    max-width: 1320px;
    margin: 0 auto;
}

/* ---------- Header ---------- */
h1 {
    font-family: 'Poppins', 'Inter', sans-serif;
    font-size: clamp(1.75rem, 3vw, 2.4rem);
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--primary-dark);
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.75rem;
    line-height: 1.15;
}

h1 span {
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    color: var(--white);
    font-family: 'Inter', sans-serif;
    font-size: 0.8rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    padding: 0.35rem 1rem;
    border-radius: var(--radius-pill);
    font-weight: 600;
    box-shadow: var(--shadow-sm);
}

.subhead {
    color: var(--ink-soft);
    margin-bottom: 2rem;
    font-size: 1.05rem;
    font-weight: 400;
    border-left: 4px solid var(--sand);
    padding: 0.15rem 0 0.15rem 1rem;
    letter-spacing: 0.005em;
}

/* ---------- Navigation Panel ---------- */
.nav-panel {
    display: flex;
    flex-wrap: wrap;
    gap: 1.25rem;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2.5rem;
    background: var(--white);
    padding: 1.1rem 1.5rem;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    border: 1px solid var(--line-soft);
    position: sticky;
    top: 1rem;
    z-index: 50;
    backdrop-filter: blur(8px);
    background-color: rgba(255, 255, 255, 0.94);
}

/* ---------- Unit Selector ---------- */
.unit-selector {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
}

.unit-btn {
    font-family: 'Inter', sans-serif;
    background: var(--bg-alt);
    border: 1.5px solid transparent;
    border-radius: var(--radius-pill);
    padding: 0.5rem 1.1rem;
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--ink-soft);
    cursor: pointer;
    transition: var(--transition);
    letter-spacing: 0.01em;
}

.unit-btn:hover {
    background: var(--primary-soft);
    color: var(--primary-dark);
    transform: translateY(-1px);
}

.unit-btn:focus-visible {
    outline: none;
    box-shadow: var(--shadow-focus);
}

.unit-btn.active {
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    color: var(--white);
    box-shadow: 0 6px 14px rgba(26, 107, 138, 0.30);
    border-color: var(--primary-dark);
}

/* ---------- Skill Filter ---------- */
.skill-filter {
    display: flex;
    gap: 0.4rem;
    flex-wrap: wrap;
}

.skill-btn {
    font-family: 'Inter', sans-serif;
    background: transparent;
    border: 1.5px solid var(--line);
    border-radius: var(--radius-pill);
    padding: 0.45rem 1rem;
    font-size: 0.8rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    color: var(--ink-soft);
    cursor: pointer;
    transition: var(--transition);
}

.skill-btn:hover {
    border-color: var(--primary-light);
    color: var(--primary-dark);
    background: var(--primary-soft);
}

.skill-btn:focus-visible {
    outline: none;
    box-shadow: var(--shadow-focus);
}

.skill-btn.active {
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    border-color: var(--primary-dark);
    color: var(--white);
    box-shadow: 0 4px 10px rgba(26, 107, 138, 0.25);
}

/* ---------- Exercise Grid ---------- */
.exercise-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
    gap: 1.75rem;
}

/* ---------- Card ---------- */
.card {
    background: var(--white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    padding: 1.6rem 1.4rem 1.4rem;
    display: flex;
    flex-direction: column;
    transition: transform 0.25s var(--ease), box-shadow 0.25s var(--ease);
    border: 1px solid var(--line-soft);
    position: relative;
    overflow: hidden;
}

.card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--primary), var(--sand), var(--coral));
    opacity: 0;
    transition: opacity 0.25s var(--ease);
}

.card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-lg);
    border-color: var(--line);
}

.card:hover::before {
    opacity: 1;
}

/* ---------- Card Header & Badges ---------- */
.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.9rem;
    gap: 0.5rem;
}

.badge {
    font-family: 'Inter', sans-serif;
    background: var(--bg-alt);
    font-size: 0.68rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-weight: 700;
    padding: 0.3rem 0.85rem;
    border-radius: var(--radius-pill);
    color: var(--ink-soft);
    white-space: nowrap;
    border: 1px solid transparent;
}

/* Skill-specific badge colours */
.badge.grammar {
    background: #e0ecf7;
    color: #0a4d7a;
    border-color: #c4dcf0;
}

.badge.vocab {
    background: #f7ecd9;
    color: #7a5410;
    border-color: #efd9b0;
}

.badge.reading {
    background: #def3e8;
    color: #0e6b45;
    border-color: #bde3d1;
}

.badge.writing {
    background: #f7dfec;
    color: #7a1852;
    border-color: #efc3da;
}

.badge.listening {
    background: #e8def7;
    color: #4a147a;
    border-color: #d3c1ef;
}

.badge.speaking {
    background: #f7e6d9;
    color: #7a4510;
    border-color: #efd0b0;
}

/* ---------- Card Typography ---------- */
.card h3 {
    font-family: 'Poppins', sans-serif;
    font-size: 1.2rem;
    font-weight: 600;
    letter-spacing: -0.01em;
    margin: 0.35rem 0 0.5rem;
    color: var(--primary-dark);
    line-height: 1.3;
}

.card p.prompt {
    font-size: 0.93rem;
    color: var(--ink-soft);
    margin-bottom: 1rem;
    line-height: 1.55;
}

/* ---------- Exercise Area ---------- */
.exercise-area {
    margin-top: auto;
    display: flex;
    flex-direction: column;
    gap: 0.7rem;
}

/* ---------- Option Group (Radio / Checkbox) ---------- */
.option-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.option-item {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    background: var(--bg-alt);
    padding: 0.65rem 1rem;
    border-radius: var(--radius-pill);
    border: 1.5px solid transparent;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--ink);
    transition: var(--transition);
    user-select: none;
}

.option-item:hover {
    background: var(--primary-soft);
    border-color: var(--primary-light);
}

.option-item:has(input:checked) {
    background: var(--primary-soft);
    border-color: var(--primary);
    color: var(--primary-dark);
    font-weight: 600;
    box-shadow: 0 2px 8px rgba(26, 107, 138, 0.12);
}

.option-item input[type="radio"],
.option-item input[type="checkbox"] {
    accent-color: var(--primary);
    width: 1.05rem;
    height: 1.05rem;
    cursor: pointer;
    flex-shrink: 0;
}

/* ---------- Text Inputs & Textareas ---------- */
.text-input {
    width: 100%;
    padding: 0.75rem 1.1rem;
    border: 1.5px solid var(--line);
    border-radius: var(--radius-pill);
    font-size: 0.95rem;
    font-family: 'Inter', sans-serif;
    color: var(--ink);
    background: var(--bg-alt);
    transition: var(--transition);
}

.text-input::placeholder {
    color: var(--ink-muted);
    font-style: italic;
}

.text-input:hover {
    border-color: var(--primary-light);
    background: var(--white);
}

.text-input:focus {
    outline: none;
    border-color: var(--primary);
    background: var(--white);
    box-shadow: var(--shadow-focus);
}

textarea.text-input {
    border-radius: var(--radius-md);
    resize: vertical;
    min-height: 90px;
    line-height: 1.55;
    font-family: 'Inter', sans-serif;
}

/* ---------- Buttons ---------- */
.btn {
    font-family: 'Inter', sans-serif;
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    border: none;
    color: var(--white);
    font-weight: 600;
    font-size: 0.85rem;
    letter-spacing: 0.02em;
    padding: 0.65rem 1.4rem;
    border-radius: var(--radius-pill);
    cursor: pointer;
    transition: var(--transition);
    align-self: flex-start;
    margin-top: 0.4rem;
    box-shadow: 0 6px 14px rgba(26, 107, 138, 0.25);
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
}

.btn:hover {
    background: linear-gradient(135deg, var(--primary-dark), var(--primary));
    transform: translateY(-1px);
    box-shadow: 0 8px 18px rgba(26, 107, 138, 0.32);
}

.btn:active {
    transform: translateY(0);
    box-shadow: 0 3px 8px rgba(26, 107, 138, 0.25);
}

.btn:focus-visible {
    outline: none;
    box-shadow: var(--shadow-focus), 0 6px 14px rgba(26, 107, 138, 0.25);
}

.btn.secondary {
    background: var(--bg-alt);
    color: var(--primary-dark);
    box-shadow: none;
    border: 1.5px solid var(--line);
}

.btn.secondary:hover {
    background: var(--primary-soft);
    border-color: var(--primary-light);
    box-shadow: 0 4px 10px rgba(26, 107, 138, 0.15);
}

/* ---------- Feedback Messages ---------- */
.feedback {
    margin-top: 0.6rem;
    font-size: 0.88rem;
    font-weight: 500;
    padding: 0.65rem 1rem;
    border-radius: var(--radius-md);
    background: var(--primary-soft);
    color: var(--primary-dark);
    border-left: 4px solid var(--primary);
    line-height: 1.5;
    animation: fadeIn 0.3s var(--ease);
}

.feedback.correct {
    background: var(--success-soft);
    border-left-color: var(--success);
    color: var(--success-deep);
}

.feedback.incorrect {
    background: var(--error-soft);
    border-left-color: var(--error);
    color: var(--error-deep);
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-3px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ---------- Word Bank / Chips (optional use) ---------- */
.word-bank {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin: 0.5rem 0;
}

.word-chip {
    background: var(--bg-alt);
    padding: 0.35rem 0.9rem;
    border-radius: var(--radius-pill);
    font-size: 0.82rem;
    font-weight: 500;
    color: var(--ink-soft);
    border: 1px solid var(--line);
    transition: var(--transition);
}

.word-chip:hover {
    background: var(--primary-soft);
    border-color: var(--primary-light);
    color: var(--primary-dark);
}

/* ---------- Inline Code ---------- */
.inline-code {
    background: var(--bg-alt);
    padding: 0.2rem 0.55rem;
    border-radius: var(--radius-sm);
    font-family: 'JetBrains Mono', 'Courier New', monospace;
    font-size: 0.88rem;
    color: var(--primary-dark);
    border: 1px solid var(--line);
}

/* ---------- No Results ---------- */
.no-results {
    grid-column: 1 / -1;
    text-align: center;
    padding: 4rem 2rem;
    background: var(--white);
    border-radius: var(--radius-lg);
    color: var(--ink-muted);
    font-size: 1.05rem;
    font-weight: 500;
    box-shadow: var(--shadow-sm);
    border: 1px dashed var(--line);
}

.no-results::before {
    content: '🔍';
    display: block;
    font-size: 2.5rem;
    margin-bottom: 0.75rem;
    opacity: 0.5;
}

/* ---------- Footer ---------- */
.footer-note {
    margin-top: 3.5rem;
    text-align: center;
    font-size: 0.82rem;
    color: var(--ink-muted);
    border-top: 1px solid var(--line-soft);
    padding-top: 1.75rem;
    letter-spacing: 0.01em;
}

/* ---------- Scrollbar Styling (Webkit) ---------- */
::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

::-webkit-scrollbar-track {
    background: var(--bg-alt);
}

::-webkit-scrollbar-thumb {
    background: var(--line);
    border-radius: var(--radius-pill);
    border: 2px solid var(--bg-alt);
}

::-webkit-scrollbar-thumb:hover {
    background: var(--primary-light);
}

/* ---------- Responsive Breakpoints ---------- */
@media (max-width: 900px) {
    body {
        padding: 1.5rem 0.9rem 2rem;
    }

    .nav-panel {
        position: static;
        padding: 1rem;
        border-radius: var(--radius-md);
    }

    .unit-selector,
    .skill-filter {
        width: 100%;
        justify-content: flex-start;
    }

    .exercise-grid {
        grid-template-columns: 1fr;
        gap: 1.25rem;
    }
}

@media (max-width: 520px) {
    h1 {
        font-size: 1.55rem;
    }

    h1 span {
        font-size: 0.7rem;
        padding: 0.25rem 0.7rem;
    }

    .subhead {
        font-size: 0.95rem;
    }

    .unit-btn,
    .skill-btn {
        font-size: 0.78rem;
        padding: 0.4rem 0.85rem;
    }

    .card {
        padding: 1.25rem 1rem 1rem;
        border-radius: var(--radius-md);
    }

    .card h3 {
        font-size: 1.05rem;
    }

    .btn {
        width: 100%;
        justify-content: center;
    }
}

/* ---------- Reduced Motion Accessibility ---------- */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}