/* Grades (Features/Grades): the grade picker of the home page, the small grade select of the lesson map and the
   leaderboard, and the «الدروس جاية قريب» card of a grade without lessons. */

/* ---------- One-line grade select (GET form) ---------- */
.gr-pick { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 12px 0 4px; }
.gr-pick label { font-weight: 500; color: var(--text-muted); }
.gr-pick select {
    flex: 1 1 200px;
    min-width: 0;
    max-width: 320px;
    min-height: 44px;
    padding: 6px 12px;
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--surface-2);
    color: var(--text);
    font: inherit;
}
.gr-pick select:focus { outline: none; border-color: var(--primary); box-shadow: var(--focus-ring); }
.gr-pick .btn[type="submit"] { flex: none; width: auto; }

/* ---------- Home: pick your grade ---------- */
.gr-picker { padding: var(--space-5) 0 clamp(40px, 6vw, 64px); scroll-margin-top: 12px; }
.gr-intro { text-align: center; color: var(--text-muted); margin: 12px 0 24px; }
.gr-stages { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; border: 0; padding: 0; margin: 0; min-width: 0; }
.gr-stages legend { width: 100%; text-align: center; margin-bottom: 12px; font-family: var(--font-title); }
.gr-stage-input { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.gr-stage-option { display: flex; align-items: center; justify-content: center; min-height: 48px; padding: 10px 24px; border: 2px solid var(--border); border-radius: var(--radius-pill); background: var(--surface-2); color: var(--text); font-family: var(--font-title); cursor: pointer; }
.gr-stage-option:hover { border-color: var(--primary); }
.gr-stage-input:checked + .gr-stage-option { background: var(--primary); border-color: var(--primary); color: var(--navy); }
.gr-stage-input:focus-visible + .gr-stage-option { box-shadow: var(--focus-ring); }
.gr-stage-panels { flex-basis: 100%; min-width: 0; }
.gr-stage-hint { text-align: center; color: var(--text-muted); padding: 24px 12px; }
.gr-stage-panel { display: none; }
.gr-stages:has(.gr-stage-input:checked) .gr-stage-hint { display: none; }
#home-stage-0:checked ~ .gr-stage-panels [data-stage="0"],
#home-stage-1:checked ~ .gr-stage-panels [data-stage="1"],
#home-stage-2:checked ~ .gr-stage-panels [data-stage="2"] { display: block; }
.gr-stage-panel .gr-cards { grid-template-columns: 1fr; }
@media (min-width: 43.75em) { .gr-stage-panel .gr-cards { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 25em) { .gr-stage-option { flex: 1; padding-inline: 12px; } }
.gr-stage { margin: var(--space-4) 0 var(--space-3); color: var(--text-muted); font-size: var(--fs-md); }
.gr-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 150px), 1fr)); gap: var(--space-3); margin: 0; padding: 0; list-style: none; }
@media (min-width: 43.75em) { .gr-cards { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); } }
.gr-card { display: grid; align-content: start; justify-items: start; gap: 6px; height: 100%; padding: 12px 14px; }
.gr-card-name { font-family: var(--font-title); font-size: 1.1rem; line-height: 1.35; }
.gr-card-subject { color: var(--text-muted); font-size: var(--fs-sm); line-height: 1.5; }
.gr-card.is-open { border-color: color-mix(in srgb, var(--primary) 60%, var(--border)); }
.gr-card .chip { margin-top: 4px; }
/* Text links to the grade pages, under the cards. */
.gr-explain { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 0 16px; margin-top: 20px; color: var(--text-muted); font-size: var(--fs-sm); }
.gr-explain a { display: inline-flex; align-items: center; min-height: 44px; font-weight: 500; }

/* ---------- A grade without lessons ---------- */
.gr-soon {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    align-items: center;
    gap: var(--space-3) var(--space-4);
    margin-bottom: var(--space-4);
    padding: 22px 20px;
    scroll-margin-top: 12px;
}
.gr-soon-mascot { width: 88px; height: auto; }
.gr-soon-copy { display: grid; justify-items: start; gap: 8px; min-width: 0; }
.gr-soon-title { margin: 0; font-size: var(--fs-xl); }
.gr-soon-text { margin: 0; }
.gr-soon-form, .gr-soon-copy > .btn { justify-self: stretch; margin-top: 4px; }
.gr-soon-done {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 4px 0 0;
    padding: 10px 14px;
    border: 2px solid var(--success-edge);
    border-radius: var(--radius-sm);
    background: var(--success-soft);
    color: var(--text);
    font-weight: 500;
}
.gr-soon-done .icon { flex: none; color: var(--success); }
@media (max-width: 32.5em) {
    .gr-soon { grid-template-columns: minmax(0, 1fr); justify-items: center; text-align: center; }
    .gr-soon-copy { justify-items: center; }
}
@media (min-width: 56.25em) { .gr-soon-mascot { width: 112px; } }
