/* Study mode on the practice-set pages (practice/quiz-01.html, ...): see
   study-mode.js. Colors follow the site's: Tailwind's grays, with html.dark
   for dark mode. */

.study {
    --s-text: #111827; --s-body: #374151; --s-muted: #6b7280; --s-faint: #9ca3af;
    --s-line: #e5e7eb; --s-card: #ffffff; --s-chip: #f3f4f6; --s-accent: #2563eb;
    --s-green: #16a34a; --s-green-soft: #dcfce7; --s-amber: #d97706; --s-red: #dc2626;
    --s-red-soft: #fee2e2; --s-note-bg: #fff7ed; --s-note-text: #9a3412; --s-track: #e5e7eb;
}
html.dark .study {
    --s-text: #f3f4f6; --s-body: #d1d5db; --s-muted: #9ca3af; --s-faint: #6b7280;
    --s-line: #374151; --s-card: #1f2937; --s-chip: #374151; --s-accent: #60a5fa;
    --s-green: #4ade80; --s-green-soft: rgba(22, 163, 74, .22); --s-amber: #fbbf24; --s-red: #f87171;
    --s-red-soft: rgba(220, 38, 38, .22); --s-note-bg: rgba(234, 88, 12, .15); --s-note-text: #fdba74;
    --s-track: #374151;
}

/* Browse | Study: tabs above the hardest-problems switch */
.study-tabs {
    display: flex; gap: 1.4rem; margin: 1.6rem 0 0;
    border-bottom: 1px solid #e5e7eb;
}
html.dark .study-tabs { border-bottom-color: #374151; }
.study-tabs button {
    font: inherit; font-size: .95rem; font-weight: 600; margin: 0 0 -1px; padding: .45rem .1rem;
    border: 0; border-bottom: 2px solid transparent; background: none; cursor: pointer; color: #6b7280;
}
.study-tabs button[aria-selected="true"] { color: #111827; border-bottom-color: #111827; }
html.dark .study-tabs button { color: #9ca3af; }
html.dark .study-tabs button[aria-selected="true"] { color: #f9fafb; border-bottom-color: #f9fafb; }
.study-tabs button:focus-visible { outline: 2px solid #3b82f6; outline-offset: 2px; }
.prose .study-tabs + .practicebank-filter { margin-top: 1.25rem; }

/* in study mode, the list of problems is hidden; the problem being asked is
   moved out of it into the study card */
.practicebank-problems.study-hidden { display: none !important; }
/* and so is the hardest-problems switch (practicebank sets its hidden
   attribute itself, so this is a class) */
.practicebank-filter.study-hidden { display: none !important; }
/* the card holds its problem in a .practicebank-problems of its own (for the
   site's styles), so the Browse filters' hiding (the hardest-problems switch,
   the topics) would reach it; study ignores them */
.practicebank-problems.study-problem .problem-outer.practicebank-filtered-out,
.practicebank-problems.study-problem .problem-outer.topic-filtered-out { display: block !important; }
.prose .study { margin-top: 1.25rem; }

.study { color: var(--s-body); }
.study[hidden] { display: none; }
.study p { margin: 0; }
.study button { font: inherit; cursor: pointer; }
.study button:focus-visible { outline: 2px solid var(--s-accent); outline-offset: 2px; }

.study-head {
    display: flex; align-items: center; gap: .75rem; flex-wrap: wrap;
    margin: 0 0 .9rem; font-size: .88rem; color: var(--s-muted);
}
.study-tally { display: inline-flex; gap: .8rem; flex-wrap: wrap; }
.study-tally b { color: var(--s-text); font-variant-numeric: tabular-nums; }
.study-dot { display: inline-block; width: .55rem; height: .55rem; border-radius: 50%; margin-right: .3rem; }
.study-head .study-spacer { flex: 1; }
.study-ghost {
    font-size: .85rem !important; font-weight: 600; padding: .25rem .8rem; border-radius: 999px;
    border: 1px solid var(--s-line); background: var(--s-card); color: var(--s-body);
}

/* the skills panel */
.study-skills {
    margin: 0 0 1.1rem; padding: .9rem 1rem; border: 1px solid var(--s-line);
    border-radius: 12px; background: var(--s-card);
}
.study-skills[hidden] { display: none; }
.study-skills h3 { margin: 0 0 .15rem !important; font-size: 1rem; color: var(--s-text); }
.study-skills .study-hint { margin: 0 0 .6rem; font-size: .82rem; color: var(--s-muted); }
/* the theme gives every <details> a box (border, padding, a summary with
   negative margins); the topics are plain rows */
.study .study-topic {
    margin: 0 !important; padding: 0 !important; background: none !important;
    border: 0 !important; border-top: 1px solid var(--s-line) !important; border-radius: 0 !important;
}
.study .study-topic:first-of-type { border-top: 0 !important; }
.study .study-topic > summary {
    list-style: none; display: grid !important; grid-template-columns: 1fr 6.5rem 6rem; gap: .8rem;
    align-items: center; margin: 0 !important; padding: .45rem 0 !important; border: 0 !important;
    background: none !important; cursor: pointer; font-size: .9rem; font-weight: 400;
}
/* the whole set, above the topics, laid out like a topic's row */
.study-overall {
    display: grid; grid-template-columns: 1fr 6.5rem 6rem; gap: .8rem; align-items: center;
    padding: .45rem 0 .7rem; margin-bottom: .2rem; border-bottom: 2px solid var(--s-line);
    font-size: .9rem;
}
.study-overall .study-name { color: var(--s-text); font-weight: 700; padding-left: 1rem; }
@media (max-width: 36rem) {
    .study-overall { grid-template-columns: 1fr 4.5rem; }
    .study-overall .study-state { display: none; }
}
.study-topic > summary::-webkit-details-marker { display: none; }
.study-topic > summary::marker { content: ""; }
.study-topic .study-name { color: var(--s-text); font-weight: 600; }
.study-topic .study-name::before {
    content: "▸"; display: inline-block; width: 1rem; color: var(--s-faint); transition: transform .15s;
}
.study-topic[open] .study-name::before { transform: rotate(90deg); }
.study-bar { height: .45rem; border-radius: 999px; background: var(--s-track); overflow: hidden; }
.study-bar i { display: block; height: 100%; border-radius: inherit; }
/* a topic's bar: a segment per skill, with a hairline between them */
.study-segments { display: flex; }
.study-segments i { flex: none; border-radius: 0; box-shadow: inset -1px 0 0 var(--s-card); }
.study-state { font-size: .75rem; font-weight: 600; text-align: right; }
/* "3 of 6 right": beside a skill's status, and under a topic's */
.study-count { font-weight: 400; color: var(--s-muted); white-space: nowrap; }
/* a topic's (or Overall's) "2 of 5 skills strong", under its name, in line
   with the name's text (past the topic's arrow) */
.study-name .study-count { display: block; margin-top: .1rem; padding-left: 1rem; font-size: .75rem; }
.study-overall .study-name .study-count { padding-left: 0; }
.study-skill-list { list-style: none; margin: 0 0 .5rem 1rem !important; padding: 0 !important; font-size: .84rem; }
/* each skill: its description, and under it a line with the skill's own bar
   and status, its lecture and "Practice"; skills separated by thin lines */
.study-skill-list li {
    margin: 0 !important; padding: .65rem 0 !important;
    border-top: 1px solid var(--s-line);
}
.study-skill-list li:first-child { border-top: 0; padding-top: .2rem !important; }
.study-skill-list li::before { display: none !important; }
.study .study-skill-desc { margin: 0 0 .35rem; color: var(--s-body); line-height: 1.5; }
.study-skill-meta {
    display: flex; align-items: center; gap: .7rem; flex-wrap: wrap;
    font-size: .75rem; color: var(--s-muted);
}
.study-skill-meta .study-bar { width: 5rem; flex: none; }
.study-skill-state { font-weight: 600; }
.study-skill-list a { font-size: .75rem; font-weight: 600; white-space: nowrap; }
.study-practice {
    margin-left: auto; border: 0; background: none; padding: 0; font-size: .78rem !important;
    font-weight: 600; color: var(--s-accent);
}
@media (max-width: 36rem) {
    .study .study-topic > summary { grid-template-columns: 1fr 4.5rem; }
    .study-topic > summary .study-state { display: none; }
}

/* the introduction, for a student with no progress yet */
.study-intro {
    margin: 0 0 .9rem; padding: .8rem 1rem; border-radius: 10px; font-size: .92rem;
    background: var(--s-chip); color: var(--s-body);
}
.study-intro[hidden] { display: none; }
/* (.study p would zero its margin) the same space below it as above */
.study .study-intro { margin: 0 0 1.25rem; }

/* after an answer: the skills the problem tested, and their progress */
.study .study-feedback {
    margin: 1rem 0 0; padding: .75rem .9rem .5rem; border-radius: 10px;
    background: var(--s-chip);
}
.study .study-feedback h4 {
    margin: 0 0 .4rem; font-size: .75rem; font-weight: 600; letter-spacing: .06em;
    text-transform: uppercase; color: var(--s-muted);
}
.study .study-feedback .study-skill-list { margin: 0 !important; }
.study .study-feedback .study-skill-list li { border-top-color: rgba(0, 0, 0, .08); }
html.dark .study .study-feedback .study-skill-list li { border-top-color: rgba(255, 255, 255, .1); }
.study .study-feedback .study-supporting .study-skill-desc { color: var(--s-muted); }
/* a feedback bar changing from before the answer to now */
.study-grow { transition: width 1.1s cubic-bezier(.3, .7, .3, 1), background-color 1.1s ease; }
.study .study-cheer { margin: .45rem 0 .25rem; font-weight: 600; color: var(--s-green); }

/* why this problem was chosen */
.study-why {
    display: flex; gap: .6rem; align-items: baseline; flex-wrap: wrap;
    margin: 0 0 .6rem; padding: .45rem .75rem; border-radius: 8px; font-size: .85rem;
    background: var(--s-note-bg); color: var(--s-note-text);
}
/* (.study p would zero its margin) a gap between it and the card */
.study .study-why { margin: 0 0 .75rem; }
.study-why button {
    border: 0; background: none; padding: 0; font-size: .82rem !important; font-weight: 600;
    color: inherit; text-decoration: underline;
}

/* the card holding the problem being asked */
.study-card {
    padding: 1.2rem 1.3rem 1.3rem; border: 1px solid var(--s-line);
    border-radius: 14px; background: var(--s-card);
}
.study-card .practicebank-problems .problem-outer { margin: 0 !important; padding: 0 !important; border: 0 !important; }
.study-card.study-unrevealed .problem-outer details { display: none !important; }
.study-card .choice.study-right label { border-radius: 8px; background: var(--s-green-soft); }
.study-card .choice.study-wrong label { border-radius: 8px; background: var(--s-red-soft); }
/* padded inside the highlight, and pulled left by as much, so the radio stays
   in line with the other choices (.practicebank-problems in the selector:
   the site's choice padding in head-custom.html is as specific, and later) */
.study-card .practicebank-problems .choice.study-right label,
.study-card .practicebank-problems .choice.study-wrong label { padding: .2rem .6rem; margin-left: -.6rem; margin-right: -.6rem; }
.study-card .choice.study-right label::after { content: "✓"; margin-left: auto; padding-left: .6rem; font-weight: 700; color: var(--s-green); }
.study-card .choice.study-wrong label::after { content: "✗"; margin-left: auto; padding-left: .6rem; font-weight: 700; color: var(--s-red); }
.study-prompt { margin: 1rem 0 0 !important; font-size: .9rem; color: var(--s-muted); }
.study-actions { display: flex; gap: .55rem; flex-wrap: wrap; align-items: center; margin-top: 1rem; }
.study-btn {
    font-size: .9rem !important; font-weight: 600; padding: .4rem 1rem; border-radius: 999px;
    border: 1px solid var(--s-line); background: var(--s-card); color: var(--s-body);
}
.study-btn.study-primary { background: var(--s-text); border-color: var(--s-text); color: var(--s-card); }
.study-btn:disabled { opacity: .45; cursor: default; }
.study-btn.study-got { border-color: var(--s-green); color: var(--s-green); }
.study-btn.study-part { border-color: var(--s-amber); color: var(--s-amber); }
.study-btn.study-miss { border-color: var(--s-red); color: var(--s-red); }
/* hovering a grade fills it with its color */
.study-btn { transition: background-color .12s, color .12s; }
.study-btn.study-got:hover { background: var(--s-green); color: var(--s-card); }
.study-btn.study-part:hover { background: var(--s-amber); color: var(--s-card); }
.study-btn.study-miss:hover { background: var(--s-red); color: var(--s-card); }
.study-btn.study-primary:hover { opacity: .85; }
.study-skip { border: 0; background: none; padding: 0; font-size: .85rem !important; color: var(--s-muted); }
.study-verdict { margin-top: 1rem !important; font-weight: 700; }
.study-verdict.study-ok { color: var(--s-green); }
.study-verdict.study-no { color: var(--s-red); }
.study-grade { margin-top: 1.1rem; padding-top: .9rem; border-top: 1px dashed var(--s-line); }
.study-grade > p { font-weight: 600; color: var(--s-text); font-size: .95rem; }
.study-foot { margin-top: 1.2rem !important; font-size: .8rem; color: var(--s-faint); }
.study-foot button { border: 0; background: none; padding: 0; font-size: .8rem !important; color: var(--s-muted); text-decoration: underline; }
.study-empty { padding: 1rem 1.2rem; border: 1px dashed var(--s-line); border-radius: 12px; color: var(--s-muted); }
.study-segments.study-many i { box-shadow: none; }
