/*
 * One look for every section — grammar, vocabulary, reading, listening,
 * writing, speaking and tests. Each section keeps its own layout, but the
 * shared pieces (hero, level picker, filters, cards, step blocks, page
 * headers) are drawn the same way. Loaded after the section stylesheets.
 */

/* ---------- Hero ---------- */
.hero,
.vc-hero,
.ls-hero {
    position: relative;
    padding-top: 64px;
    padding-bottom: 56px;
}

.quiz-hero { position: relative; padding-top: 56px; }

.hero::before,
.vc-hero::before,
.ls-hero::before,
.quiz-hero::before {
    content: "";
    position: absolute;
    inset: -40px 0 auto auto;
    z-index: -1;
    width: min(720px, 70vw);
    height: 520px;
    background:
        radial-gradient(closest-side at 30% 40%, color-mix(in srgb, #5f43b2 16%, transparent), transparent),
        radial-gradient(closest-side at 70% 60%, color-mix(in srgb, var(--accent) 18%, transparent), transparent);
    filter: blur(20px);
    pointer-events: none;
}

.quiz-hero::before { inset: -60px 0 auto 0; margin: 0 auto; }

.hero h1,
.vc-hero h1,
.ls-hero h1,
.quiz-hero h1 {
    margin: 0 0 20px;
    font-family: var(--serif);
    font-size: clamp(36px, 5.2vw, 64px);
    font-weight: 600;
    line-height: 1.05;
    letter-spacing: -0.02em;
}

.hero h1 em,
.vc-hero h1 em,
.ls-hero h1 em,
.quiz-hero h1 em {
    background: linear-gradient(100deg, var(--accent), #5f43b2 80%);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    font-style: italic;
}

:root[data-theme="dark"] .hero h1 em,
:root[data-theme="dark"] .vc-hero h1 em,
:root[data-theme="dark"] .ls-hero h1 em,
:root[data-theme="dark"] .quiz-hero h1 em { background-image: linear-gradient(100deg, var(--accent), #b5a0f5 80%); }

.hero .hero-lead,
.vc-hero .hero-lead,
.ls-hero .hero-lead { max-width: 56ch; font-size: 18.5px; }

.hero-stats,
.vc-stats,
.ls-stats {
    display: flex;
    flex-wrap: wrap;
    gap: 14px 40px;
    margin: 36px 0 0;
}

.hero-stats div,
.vc-stats div,
.ls-stats div { display: flex; flex-direction: column-reverse; }

.hero-stats dt,
.vc-stats dt,
.ls-stats dt { color: var(--muted); font-size: 15px; }

.hero-stats dd,
.vc-stats dd,
.ls-stats dd {
    margin: 0;
    font-family: var(--serif);
    font-size: 34px;
    font-weight: 600;
    line-height: 1.15;
}

/* ---------- Section headings ---------- */
.section-heading h2,
.level-header h2,
.sp-part-head h2 {
    font-family: var(--serif);
    font-weight: 600;
    letter-spacing: -0.01em;
}

.section-heading h2 { font-size: clamp(28px, 3vw, 36px); }

.level-header .level-code {
    min-width: 52px;
    padding: 7px 10px;
    border-radius: 12px;
    font-size: 19px;
}

/* ---------- Level picker (tabs or anchors) ---------- */
.level-cards,
.vc-levels,
.ls-level-cards {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 12px;
}

.level-card,
.vc-level,
.ls-level-card {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
    padding: 18px;
    border: 1px solid var(--line);
    border-radius: 18px;
    background: var(--surface);
    color: var(--ink);
    line-height: 1.35;
    text-decoration: none;
    transition: transform .15s, box-shadow .15s, border-color .15s;
}

.level-card:hover,
.vc-level:hover,
.ls-level-card:hover { border-color: var(--level); box-shadow: var(--shadow); transform: translateY(-2px); }

.level-card strong,
.vc-level strong,
.ls-level-card strong { margin-top: 6px; font-size: 16px; font-weight: 700; }

.level-card-count,
.level-card small,
.vc-level small,
.ls-level-card small { color: var(--muted); font-size: 14px; }

.level-card.is-active,
.vc-level.is-active,
.ls-level-card.is-active {
    border-color: var(--level);
    background: color-mix(in srgb, var(--level) 8%, var(--surface));
    box-shadow: var(--shadow), 0 0 0 1px var(--level);
}

/* ---------- Filter bar ---------- */
.vc-filters,
.ls-filters {
    gap: 12px 18px;
    margin: 16px 0 22px;
    padding: 10px 12px;
    border: 1px solid var(--line);
    border-radius: 18px;
}

.vc-chips,
.ls-chips { display: flex; flex-wrap: wrap; gap: 6px; }

.vc-chips button,
.ls-chips button {
    padding: 6px 12px;
    border: 1px solid var(--line);
    border-radius: 99px;
    background: var(--surface);
    color: var(--muted);
    font-size: 13.5px;
    font-weight: 600;
}

.vc-chips button[aria-pressed="true"],
.ls-chips button[aria-pressed="true"] { border-color: var(--accent); background: var(--accent); color: var(--on-accent); }

.vc-filter-search,
.ls-search {
    flex: 1 1 220px;
    margin-left: 0;
    border-radius: 12px;
    background: var(--bg);
}

.vc-filter-search input,
.ls-search input { height: 40px; font-size: 15px; }

/* ---------- Cards: one shape, a level-coloured top edge ---------- */
.ls-card,
.vc-set-card,
.wr-card,
.lesson-card {
    position: relative;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 20px;
    background: var(--surface);
    color: var(--ink);
    transition: transform .2s, box-shadow .2s, border-color .2s;
}

.ls-card::before,
.vc-set-card::before,
.wr-card::before,
.lesson-card::before {
    content: "";
    position: absolute;
    inset: 0 0 auto;
    width: auto;
    height: 4px;
    background: var(--level, var(--accent));
    opacity: .85;
}

.ls-card:hover,
.vc-set-card:hover,
.wr-card:hover,
.lesson-card:hover {
    border-color: color-mix(in srgb, var(--level, var(--accent)) 60%, var(--line));
    box-shadow: var(--shadow), 0 18px 40px -24px color-mix(in srgb, var(--level, var(--accent)) 60%, transparent);
    transform: translateY(-3px);
}

.vc-set-card,
.wr-grid .wr-card,
.wr-card { padding: 20px 20px 18px; }

.lesson-card { padding: 16px 16px 14px; border-radius: 16px; }

.lesson-card::before { height: 3px; }

/* Titles and subtitles read the same in every card */
.ls-card-title strong,
.vc-set-card strong,
.wr-card h3,
.wr-grid .wr-card h3 { font-family: var(--serif); font-size: 21px; font-weight: 600; line-height: 1.2; }

.ls-card-uzbek,
.vc-set-uzbek,
.wr-card-uzbek {
    margin-top: 4px;
    color: var(--muted);
    font-size: 15px;
    font-weight: 400;
}

.ls-card-summary,
.wr-card-summary,
.wr-grid .wr-card-summary { color: var(--muted); font-size: 14px; line-height: 1.5; }

/* Small kind chips at the top of cards */
.ls-format,
.vc-kind,
.wr-exam {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 3px 10px;
    border-radius: 99px;
    font-size: 12.5px;
    font-weight: 700;
    white-space: nowrap;
}

.wr-exam { background: color-mix(in srgb, var(--level, var(--accent)) 11%, transparent); color: var(--level, var(--accent)); }

/* ---------- "How it works" blocks ---------- */
.ls-steps li,
.vc-step,
.wr-mode {
    padding: 22px 20px 20px;
    border: 1px solid var(--line);
    border-radius: 20px;
    background: var(--surface);
}

.wr-mode-exam { background: var(--surface); }

.vc-step { display: block; }

.vc-step > span,
.wr-mode-icon,
.ls-step-icon {
    display: grid;
    place-items: center;
    width: 44px;
    height: 44px;
    margin-bottom: 16px;
    border-radius: 14px;
    background: color-mix(in srgb, var(--accent) 12%, transparent);
    color: var(--accent);
    font-family: var(--serif);
    font-size: 19px;
    font-weight: 600;
}

.wr-mode-exam .wr-mode-icon { background: color-mix(in srgb, var(--accent) 12%, transparent); color: var(--accent); }

.vc-step strong,
.ls-steps strong { display: block; margin-bottom: 4px; font-size: 18px; }

.wr-mode h3 { margin: 0 0 10px; font-family: var(--sans); font-size: 18px; font-weight: 700; }

.vc-step p,
.ls-steps p { color: var(--muted); font-size: 15px; line-height: 1.5; }

.vc-method { padding-top: 8px; padding-bottom: 24px; }

/* ---------- Detail page headers ---------- */
.vc-page-uzbek,
.ls-lesson-uzbek,
.lesson-header .lesson-subtitle { margin: 8px 0 0; color: var(--muted); font-size: 19px; font-weight: 400; }

.vc-page h1,
.ls-lesson h1,
.lesson-header h1 {
    font-family: var(--serif);
    font-size: clamp(34px, 4.4vw, 50px);
    font-weight: 600;
    letter-spacing: -0.02em;
    line-height: 1.08;
}

.ls-lesson .breadcrumb,
.vc-page .breadcrumb,
.lesson .breadcrumb { margin: 0 0 18px; color: var(--muted); font-size: 15px; }

.lesson .breadcrumb a { color: var(--muted); text-decoration: none; }

/* Mode tabs on vocabulary pages look like the step bar of the other sections */
.vc-modes {
    padding: 5px;
    border: 1px solid var(--line);
    border-radius: 18px;
    background: var(--surface);
    box-shadow: var(--shadow);
}

/* ---------- Tips ---------- */
.ls-tip {
    padding: 20px;
    border: 1px solid var(--line);
    border-radius: 20px;
    background: var(--surface);
}

@media (max-width: 900px) {
    .level-cards,
    .vc-levels,
    .ls-level-cards { grid-template-columns: repeat(5, minmax(130px, 1fr)); overflow-x: auto; padding-bottom: 4px; scroll-snap-type: x mandatory; }

    .level-card,
    .vc-level,
    .ls-level-card { scroll-snap-align: start; }

    .hero,
    .vc-hero,
    .ls-hero { padding-top: 40px; }
}

/* ---------- Hero demo cards: one frame, one motion for every skill ---------- */
.anatomy,
.vc-due,
.vc-wotd,
.rd-demo,
.ls-demo,
.wr-demo,
.sp-demo {
    padding: 28px 28px 24px;
    border: 1px solid var(--line);
    border-radius: 28px;
    background: var(--surface);
    box-shadow: var(--shadow), 0 30px 60px -30px color-mix(in srgb, var(--accent) 40%, transparent);
    transition: transform .4s cubic-bezier(.2, .8, .2, 1);
    animation: skill-demo-in .7s cubic-bezier(.2, .8, .2, 1) both;
}

.anatomy,
.rd-demo,
.wr-demo,
.vc-wotd { transform: rotate(1.2deg); }

.vc-due { transform: rotate(-.6deg); }

.vc-wotd { animation-delay: .12s; }

.ls-demo,
.sp-demo { transform: rotate(-1.2deg); }

.anatomy:hover,
.vc-due:hover,
.vc-wotd:hover,
.rd-demo:hover,
.ls-demo:hover,
.wr-demo:hover,
.sp-demo:hover { transform: rotate(0); }

.wr-demo-bar,
.rd-demo-top { margin-bottom: 18px; }

.sp-demo .sp-demo-head { margin-bottom: 14px; }

.wr-demo-caret {
    display: inline-block;
    width: 2px;
    height: 1.1em;
    margin-left: 3px;
    vertical-align: -3px;
    background: var(--accent);
    animation: skill-caret 1s steps(1) infinite;
}

.wr-demo-meter span { animation: skill-meter 3.2s ease-in-out infinite alternate; }

@keyframes skill-demo-in {
    from { opacity: 0; translate: 0 18px; }
    to { opacity: 1; translate: 0 0; }
}

@keyframes skill-caret { 50% { opacity: 0; } }

@keyframes skill-meter { from { width: 74%; } to { width: 88%; } }

/* ---------- Method steps: 4-step variant ---------- */
@media (min-width: 621px) {
    .ls-steps-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

/* ---------- Notes under the method (exam mode, privacy) ---------- */
.skill-notes {
    max-width: var(--wide, 1360px);
    margin: 0 auto;
    padding-left: var(--gutter);
    padding-right: var(--gutter);
    display: flex;
    flex-wrap: wrap;
    gap: 10px 28px;
    padding-top: 4px;
    padding-bottom: 8px;
}

.skill-note {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin: 0;
    color: var(--muted);
    font-size: 14.5px;
    line-height: 1.5;
}

.skill-note b { color: var(--ink); }

.skill-note svg {
    width: 18px;
    height: 18px;
    flex: none;
    margin-top: 2px;
    fill: none;
    stroke: var(--accent);
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

/* ---------- Skill cards: quick exam link and skill-specific decoration ---------- */
.skill-item { position: relative; }

.skill-exam {
    position: absolute;
    top: 18px;
    right: 18px;
    z-index: 2;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 10px 3px 8px;
    border: 1px solid var(--line);
    border-radius: 99px;
    background: var(--surface);
    color: var(--muted);
    font-size: 12.5px;
    font-weight: 700;
    text-decoration: none;
    transition: border-color .15s, color .15s;
}

.skill-exam:hover { border-color: var(--level, var(--accent)); color: var(--level, var(--accent)); }

.skill-exam svg {
    width: 14px;
    height: 14px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
}

.ls-card .ls-format svg {
    width: 14px;
    height: 14px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

/* Writing: handwritten lines of different lengths */
.wr-card-lines {
    position: absolute;
    right: 18px;
    bottom: 52px;
    z-index: -1;
    width: 80px;
    height: 34px;
    background:
        linear-gradient(var(--level), var(--level)) 0 0 / 100% 3px no-repeat,
        linear-gradient(var(--level), var(--level)) 0 10px / 86% 3px no-repeat,
        linear-gradient(var(--level), var(--level)) 0 20px / 94% 3px no-repeat,
        linear-gradient(var(--level), var(--level)) 0 30px / 48% 3px no-repeat;
    border-radius: 2px;
    opacity: .15;
    transition: opacity .2s;
}

.wr-card-lines::after {
    content: "";
    position: absolute;
    left: 46%;
    bottom: -2px;
    width: 3px;
    height: 12px;
    border-radius: 2px;
    background: var(--level);
}

.ls-card:hover .wr-card-lines { opacity: .35; }

.ls-card:hover .wr-card-lines::after { animation: skill-caret 1s steps(1) infinite; }

/* Speaking: two chat bubbles */
.sp-card-chat {
    position: absolute;
    right: 18px;
    bottom: 50px;
    z-index: -1;
    width: 80px;
    height: 38px;
    opacity: .15;
    transition: opacity .2s;
}

.sp-card-chat i {
    position: absolute;
    height: 14px;
    border-radius: 9px;
    background: var(--level);
}

.sp-card-chat i:first-child { top: 0; left: 0; width: 56px; border-bottom-left-radius: 3px; }

.sp-card-chat i:last-child { right: 0; bottom: 0; width: 46px; border-bottom-right-radius: 3px; }

.ls-card:hover .sp-card-chat { opacity: .35; }

.ls-card:hover .sp-card-chat i:last-child { animation: ls-pulse 1s ease-in-out infinite alternate; transform-origin: right; }

@media (max-width: 900px) {
    .anatomy,
    .vc-due,
    .vc-wotd,
    .rd-demo,
    .ls-demo,
    .wr-demo,
    .sp-demo { transform: none; }
}

@media (max-width: 620px) {
    .anatomy,
    .rd-demo,
    .ls-demo,
    .wr-demo,
    .sp-demo { padding: 20px; border-radius: 22px; }

    .skill-notes { gap: 8px; padding-top: 0; padding-left: 16px; padding-right: 16px; }
}

@media (prefers-reduced-motion: reduce) {
    .anatomy,
    .vc-due,
    .vc-wotd,
    .rd-demo,
    .ls-demo,
    .wr-demo,
    .sp-demo,
    .wr-demo-caret,
    .wr-demo-meter span { animation: none; }
}

/* ---------- Lesson steppers stretch across the full width ---------- */
.wr-stepper { grid-template-columns: repeat(5, minmax(0, 1fr)); }

.sp-stepper { grid-template-columns: repeat(4, minmax(0, 1fr)); }

.ls-lesson-tags .ls-format svg {
    width: 14px;
    height: 14px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

@media (min-width: 621px) {
    .ls-steps-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 620px) {
    .skill-note-extra { display: none; }
}

.vc-method.ls-method { display: block; padding-top: 24px; padding-bottom: 24px; }
