/*
 * The pupil's own pages: their homework list, what they have handed in, and
 * how they are getting on.
 *
 * Deliberately thin. learn.css already owns the pupil-facing vocabulary — the
 * paper, the card, the buttons, the accessibility variables — and this loads
 * after it to add only what a list of assignments needs that a lesson player
 * did not. Anything defined here that could have been an .lp- class is a place
 * where the two pupil surfaces will drift apart.
 *
 * Every colour below comes from a --lp- token, so the tint and dyslexia
 * profiles in a11y-fonts.css keep working on this page without being taught
 * about it.
 */

/* ── The school's own look ────────────────────────────────────────────
 *
 * A pupil gets here from their school's site (public/css/tutoring-public.css)
 * and should not feel they have left it: the same flat warm ground, white
 * cards with a hairline, pill buttons in the school's colour, and its bar
 * across the top. learn.css's wash and gradient buttons belong to the lesson
 * player; here they are set back to that quieter vocabulary.
 *
 * Still only tokens. A reading tint overrides --q-paper and --q-card on <html>
 * (student.css), which outranks :root, so the pupil who chose yellow paper
 * keeps it.
 */
:root {
    --q-paper: #faf7f2;
    --q-card: #ffffff;
    --lp-line: #e8e2d8;
    --lp-radius: 14px;
    --lp-shadow: 0 1px 2px rgba(31, 29, 43, .04), 0 8px 24px rgba(31, 29, 43, .06);
    /* The school's colour, thinned: the hero, the icon tiles, the chips. */
    --pt-tint: color-mix(in srgb, var(--lp-accent) 9%, var(--q-card));
    --pt-tag: color-mix(in srgb, var(--lp-ink) 6%, var(--q-card));
}

html:not([data-tint]) body { background: var(--q-paper); }
html:not([data-tint]) body::before { content: none; }

/* One centred container, the school site's width, text left-aligned in it. */
.pt-wrap {
    width: 100%;
    max-width: 1080px;
    margin: 0 auto;
    padding-left: 20px;
    padding-right: 20px;
    box-sizing: border-box;
}

/* ── The bar ─────────────────────────────────────────────────────────── */

.pt-top { background: var(--q-card); border-bottom: 1px solid var(--lp-line); }
.pt-top-in {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding-top: 12px;
    padding-bottom: 12px;
}
.pt-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
    color: var(--lp-ink);
    text-decoration: none;
    font-weight: 800;
    font-size: 1.15rem;
}
.pt-logo { height: 38px; width: auto; max-width: 150px; object-fit: contain; }
.pt-top-nav { display: flex; align-items: center; gap: 4px; }
.pt-top-link {
    appearance: none;
    border: 0;
    background: none;
    padding: 8px 14px;
    border-radius: 999px;
    font: inherit;
    font-weight: 700;
    font-size: .95rem;
    color: var(--lp-muted);
    text-decoration: none;
    cursor: pointer;
    white-space: nowrap;
}
.pt-top-link:hover { color: var(--lp-ink); background: var(--pt-tag); }
.pt-top-link:focus-visible { outline: 3px solid var(--lp-accent); outline-offset: 2px; }

/* Display options sit in the bar with everything else, not pinned to the
   corner of the window over the top of it. The panel still drops from the
   button. */
.pt-top .a11y-bar { position: relative; top: auto; right: auto; margin-left: 6px; }
.pt-top .a11y-btn { box-shadow: none; border-radius: 999px; }

@media (max-width: 560px) {
    .pt-brand { font-size: 1rem; }
    .pt-top-link { padding: 8px 10px; }
    #school-site { display: none; }
}

.pt-footer {
    margin: 0 0 32px;
    padding-top: 20px;
    border-top: 1px solid var(--lp-line);
    color: var(--lp-muted);
    font-size: .82rem;
}

#loading-screen { max-width: 1080px; margin: 0 auto; padding: 40px 20px; color: var(--lp-muted); }

/* ── Buttons, in the school's shape ──────────────────────────────────── */

#portal-app .lp-btn { border-radius: 999px; font-weight: 800; }
#portal-app .lp-btn-primary { background: var(--lp-accent); box-shadow: none; }
#portal-app .lp-btn-primary:hover { background: var(--lp-accent-deep); box-shadow: none; }
#portal-app .lp-btn-quiet { background: var(--q-card); }
#portal-app .lp-btn-quiet:hover { background: var(--pt-tag); }
#portal-app .lp-card { box-shadow: var(--lp-shadow); }

/* ── Signing in ──────────────────────────────────────────────────────── */

.pt-title {
    font-size: clamp(1.7rem, 3.2vw, 2.3rem);
    line-height: 1.15;
    margin: 0 0 10px;
    font-weight: 800;
    letter-spacing: -.015em;
    color: var(--lp-ink);
}
.pt-lede { color: var(--lp-muted); font-size: 1.07rem; margin: 0; max-width: 34ch; }

/* The words on the left in the school's tint, the form on the right in white:
   one panel, so the page is a place and not a box floating on a blank sheet. */
.pt-signin {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 26rem);
    gap: 0;
    margin-top: 36px;
    margin-bottom: 56px;
}
.pt-signin-intro {
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 40px;
    background: var(--pt-tint);
    border-radius: 20px 0 0 20px;
}
#portal-app .pt-signin-card {
    margin: 0;
    max-width: none;
    padding: 32px;
    border-radius: 0 20px 20px 0;
    border-left: 0;
}
.pt-signin-card .lp-btn { width: 100%; }

@media (max-width: 760px) {
    .pt-signin { grid-template-columns: 1fr; margin-top: 20px; }
    .pt-signin-intro { padding: 24px; border-radius: 20px 20px 0 0; }
    #portal-app .pt-signin-card { border-radius: 0 0 20px 20px; border-left: 1px solid var(--lp-line); border-top: 0; padding: 24px; }
}

#password-screen, #error-screen { padding: 36px 20px 56px; }

/* ── The panel at the top of the pupil's own page ────────────────────── */

.pt-hero { padding-top: 24px; }
.pt-hero-panel {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.25fr);
    gap: 24px;
    /* Two things of about the same height, side by side: the greeting and
       the next lesson. Neither leaves a hole beside the other. */
    align-items: center;
    padding: 22px 24px;
    background: var(--pt-tint);
    border-radius: 20px;
}
.pt-hero-next[hidden] { display: none; }
.pt-hero-panel:has(.pt-hero-next[hidden]) { grid-template-columns: 1fr; }

.pt-greeting {
    font-size: clamp(1.3rem, 2.2vw, 1.6rem);
    line-height: 1.2;
    font-weight: 800;
    letter-spacing: -.01em;
    margin: 0;
    color: var(--lp-ink);
}
.pt-greeting:focus { outline: none; }

.pt-sub {
    margin: .3rem 0 0;
    color: var(--lp-muted);
    font-size: 1rem;
}

/* The three tabs as three numbers, each one the way to its tab. */
.pt-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.pt-chips:empty { display: none; }
.pt-chip {
    appearance: none;
    display: flex;
    align-items: baseline;
    gap: 7px;
    padding: 6px 14px;
    border: 1px solid color-mix(in srgb, var(--lp-accent) 16%, var(--q-card));
    border-radius: 999px;
    background: var(--q-card);
    color: var(--lp-muted);
    font: inherit;
    font-size: .92rem;
    font-weight: 700;
    cursor: pointer;
}
.pt-chip b { font-size: 1.05rem; font-weight: 800; color: var(--lp-ink); font-variant-numeric: tabular-nums; }
.pt-chip:hover { border-color: var(--lp-accent); color: var(--lp-ink); }
.pt-chip:focus-visible { outline: 3px solid var(--lp-accent); outline-offset: 2px; }

/* The next lesson: a white card standing in the tinted panel. */
.pt-next {
    padding: 16px;
    background: var(--q-card);
    border: 1px solid var(--lp-line);
    border-radius: var(--lp-radius);
    box-shadow: var(--lp-shadow);
}
.pt-next-kicker {
    margin: 0 0 10px;
    font-size: .78rem;
    font-weight: 800;
    letter-spacing: .06em;
    text-transform: uppercase;
    color: var(--lp-accent);
}
.pt-next-row { display: flex; align-items: center; gap: 14px; }
.pt-next-body { flex: 1; min-width: 0; }
/* A page off a calendar: the day is the thing a child looks for. */
.pt-next-date {
    flex: none;
    display: grid;
    justify-items: center;
    width: 56px;
    padding: 7px 0 8px;
    border-radius: 12px;
    background: var(--pt-tint);
    color: var(--lp-accent);
    font-size: .68rem;
    font-weight: 800;
    letter-spacing: .05em;
    text-transform: uppercase;
    line-height: 1.15;
}
.pt-next-date b { font-size: 1.45rem; letter-spacing: 0; color: var(--lp-ink); line-height: 1.1; }
/* The way in sits on the same line as the lesson it belongs to. */
#portal-app .pt-next-row > .lp-btn { flex: none; margin-top: 0; }
@media (max-width: 560px) {
    .pt-next-row { flex-wrap: wrap; }
    #portal-app .pt-next-row > .lp-btn { width: 100%; }
}

@media (max-width: 820px) {
    .pt-hero-panel { grid-template-columns: 1fr; padding: 18px; gap: 16px; }
}

/* ── Moving between the views ────────────────────────────────────────── */

/* Pills, like the links in the school's bar: the one you are on is tinted. */
.pt-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    max-width: 1080px;
    margin: 0 auto;
    padding: 24px 20px 0;
    box-sizing: border-box;
}

.pt-tab {
    appearance: none;
    background: none;
    border: 0;
    border-radius: 999px;
    padding: 8px 16px;
    font: inherit;
    font-weight: 700;
    font-size: .95rem;
    color: var(--lp-muted);
    cursor: pointer;
}

.pt-tab[aria-selected="true"] { color: var(--lp-accent); background: var(--pt-tint); }
.pt-tab:hover { color: var(--lp-ink); background: var(--pt-tag); }
.pt-tab[aria-selected="true"]:hover { color: var(--lp-accent); background: var(--pt-tint); }
.pt-tab:focus-visible { outline: 3px solid var(--lp-accent); outline-offset: 2px; }

.pt-main {
    max-width: 1080px;
    margin: 0 auto;
    padding: 16px 20px 56px;
    box-sizing: border-box;
}

/* Work is a set of cards, two across where there is room — the school site
   lays its tutors out the same way. Lessons and one piece of marked work are
   reading, and stay a single column. */
#tab-todo, #tab-done {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 420px), 1fr));
    gap: 14px;
}
#tab-todo[hidden], #tab-done[hidden] { display: none; }
#tab-todo > .pt-item, #tab-done > .pt-item { margin-bottom: 0; }
#tab-todo > :not(.pt-item), #tab-done > :not(.pt-item) { grid-column: 1 / -1; }
#tab-lessons, #tab-progress, #work-body { max-width: 760px; }

/* The header of one piece of marked work (the home page uses the hero). */
.pt-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    max-width: 1080px;
    margin: 0 auto;
    padding: 28px 20px 0;
    box-sizing: border-box;
}

/* ── One piece of work ───────────────────────────────────────────────── */

.pt-item {
    display: flex;
    align-items: center;
    gap: .9rem;
    background: var(--q-card);
    border: 1px solid var(--lp-line);
    border-radius: var(--lp-radius);
    box-shadow: var(--lp-shadow);
    padding: 1rem 1.1rem;
    margin-bottom: .75rem;
}

.pt-item-body { flex: 1; min-width: 0; }

/* What kind of thing it is, as a small tile: tinted by kind, so a list reads
   as different things at a glance. The word is still in the line beside it. */
.pt-icon {
    --tone: var(--lp-accent);
    flex: none;
    display: grid;
    place-items: center;
    width: 42px;
    height: 42px;
    border-radius: 12px;
    background: color-mix(in srgb, var(--tone) 12%, var(--q-card));
    color: var(--tone);
}
.pt-icon-quiz { --tone: #b7791f; }
.pt-icon-lesson { --tone: #7c4dcc; }
.pt-icon-worksheet { --tone: #1c7a4a; }
.pt-icon-booklet { --tone: #c2477a; }
.pt-icon-marking { --tone: #1c7a4a; }

/* .lp-btn carries a top margin for the stacked forms it was made for. In a
   row it only pushes the button below the middle of the card. */
.pt-item .lp-btn { margin-top: 0; flex: none; }

.pt-item-title {
    font-weight: 700;
    color: var(--lp-ink);
    margin: 0;
    /* One line, cut short with an ellipsis: a long title wrapping to two
       made its card taller than its neighbours. The whole title is on hover. */
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.pt-item-meta {
    margin: .2rem 0 0;
    color: var(--lp-muted);
    font-size: .9rem;
}

/* The mark, where there is one to show. Tabular figures so a column of
   scores lines up rather than shimmying by digit width. */
.pt-item-mark {
    font-variant-numeric: tabular-nums;
    font-weight: 800;
    font-size: 1.1rem;
    color: var(--lp-ink);
    white-space: nowrap;
}

/* ── Due dates ───────────────────────────────────────────────────────── */
/*
 * Overdue is stated in words as well as in colour ("Late" in the meta line),
 * because a red tint is not information to a pupil who cannot see it, and this
 * is the one status on the page with a consequence attached.
 */

.pt-due-soon { color: var(--lp-partial); font-weight: 700; }
.pt-due-late { color: var(--lp-wrong); font-weight: 700; }

.pt-badge {
    display: inline-block;
    border-radius: 999px;
    padding: .15rem .55rem;
    font-size: .78rem;
    font-weight: 800;
    background: var(--lp-accent-soft);
    color: var(--lp-accent-deep);
}

.pt-badge-late { background: var(--lp-wrong-soft); color: var(--lp-wrong); }
.pt-badge-done { background: var(--lp-correct-soft); color: var(--lp-correct); }
.pt-badge-waiting { background: var(--lp-partial-soft); color: var(--lp-partial); }

/* ── Progress ────────────────────────────────────────────────────────── */

.pt-stats {
    display: flex;
    flex-wrap: wrap;
    gap: .75rem;
    margin-bottom: 1.25rem;
}

.pt-stat {
    flex: 1 1 8rem;
    background: var(--q-card);
    border: 1px solid var(--lp-line);
    border-radius: var(--lp-radius);
    padding: .9rem 1rem;
}

.pt-stat-value {
    font-size: 1.6rem;
    font-weight: 800;
    font-variant-numeric: tabular-nums;
    color: var(--lp-ink);
}

.pt-stat-label {
    color: var(--lp-muted);
    font-size: .85rem;
}

.pt-trend-improving { color: var(--lp-correct); }
.pt-trend-slipping { color: var(--lp-wrong); }
.pt-trend-steady { color: var(--lp-muted); }

/* ── Empty states ────────────────────────────────────────────────────── */
/*
 * A pupil with nothing set has done nothing wrong, and the page should not
 * read as an error or as an accusation. See the copy in portal.js.
 */

.pt-empty {
    text-align: center;
    color: var(--lp-muted);
    padding: 3rem 1rem;
}

.pt-empty-title {
    font-weight: 700;
    color: var(--lp-ink);
    margin: 0 0 .25rem;
}

/* ── Sign-in and password forms ──────────────────────────────────────── */

.pt-field-label {
    font-weight: 700;
    margin: .9rem 0 .3rem;
    color: var(--lp-ink);
}

.pt-hint,
.pt-help {
    color: var(--lp-muted);
    font-size: .88rem;
}

.pt-hint { margin: .35rem 0 0; }
.pt-help { margin: 1.25rem 0 0; }

@media (max-width: 30rem) {
    .pt-header { flex-direction: column; }
    .pt-item { flex-wrap: wrap; }
}

/* An error raised by an action rather than by the page load — a lesson that
   would not open. Sits above the list it belongs to instead of replacing it,
   so the pupil can still see and try their other work. */
.pt-todo-error { margin-bottom: 1rem; }

/* ── A piece of marked work, handed back ─────────────────────────────── */

.pt-question {
    background: var(--q-card);
    border: 1px solid var(--lp-line);
    border-left: 3px solid var(--lp-line);
    border-radius: var(--lp-radius);
    padding: .9rem 1.1rem;
    margin-bottom: .75rem;
}

.pt-question-text { margin: 0 0 .5rem; color: var(--lp-ink); }

.pt-answer { margin: .3rem 0; }

.pt-answer-label {
    display: inline-block;
    font-weight: 700;
    font-size: .8rem;
    text-transform: uppercase;
    letter-spacing: .03em;
    color: var(--lp-muted);
    margin-right: .4rem;
}

/* A pupil's own extended writing, shown back to them. pre-wrap because they
   wrote it in paragraphs and it should come back in paragraphs. */
.pt-longanswer {
    white-space: pre-wrap;
    margin: .3rem 0 0;
    color: var(--lp-ink);
}

.pt-criterion { margin: .35rem 0; }

.pt-verdict {
    margin: .5rem 0 0;
    font-weight: 700;
    font-size: .9rem;
}

/*
 * The left border carries the verdict, and the word carries it too — colour is
 * never the only thing saying whether a child got a question right.
 */
.pt-verdict-correct { border-left-color: var(--lp-correct); }
.pt-verdict-correct .pt-verdict { color: var(--lp-correct); }
.pt-verdict-incorrect { border-left-color: var(--lp-wrong); }
.pt-verdict-incorrect .pt-verdict { color: var(--lp-wrong); }
.pt-verdict-partial { border-left-color: var(--lp-partial); }
.pt-verdict-partial .pt-verdict { color: var(--lp-partial); }
.pt-verdict-unmarked .pt-verdict { color: var(--lp-muted); }

p.pt-criterion.pt-verdict-correct { border: 0; color: var(--lp-correct); }
p.pt-criterion.pt-verdict-incorrect { border: 0; color: var(--lp-muted); }

/* Opening something to read is a link, not a button — it goes to a page, and a
   pupil should be able to open it in a new tab like any other link. It still
   has to look like the button beside it. */
.pt-open-read {
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

/* ── Tutoring lessons ────────────────────────────────────────────────── */

.pt-section-title {
    font-size: 1rem;
    font-weight: 700;
    color: var(--lp-ink);
    margin: 1.25rem 0 .6rem;
}
.pt-section-title:first-child { margin-top: 0; }

/* A lesson is a card with a heading line and, under it, whatever belongs to
   the lesson — so it stacks, where a piece of work is a single row. */
.pt-lesson { display: block; }
.pt-lesson-head { display: flex; align-items: center; gap: .9rem; }

.pt-lesson-report {
    margin-top: .9rem;
    padding-top: .9rem;
    border-top: 1px solid var(--lp-line);
    color: var(--lp-ink);
    line-height: 1.6;
}

.pt-lesson-hw { margin: .6rem 0 0; }

/* Work made for the lesson: a ruled list the width of the card, each row a
   small tile, the name over its kind, and a compact button at the card's
   right edge, in line with the lesson's own button above. */
.pt-lesson-work {
    list-style: none;
    margin: .9rem 0 0;
    padding: 0;
    border-top: 1px solid var(--lp-line);
}
.pt-lesson-work li {
    display: flex;
    align-items: center;
    gap: .75rem;
    padding: .6rem 0;
    border-bottom: 1px solid var(--lp-line);
}
.pt-lesson-work li:last-child { border-bottom: 0; padding-bottom: 0; }
.pt-lesson-work .pt-icon { width: 34px; height: 34px; border-radius: 10px; }
.pt-lesson-work .pt-icon svg { width: 17px; height: 17px; }
.pt-lesson-work-name { flex: 1; min-width: 0; font-weight: 600; color: var(--lp-ink); line-height: 1.3; }
.pt-lesson-work-name .pt-item-meta { display: block; margin: .1rem 0 0; font-weight: 400; font-size: .85rem; }
#portal-app .pt-lesson-work .lp-btn { min-height: 36px; padding: .3rem 1rem; font-size: .9rem; }
