/* ════════════════════════════════════════════════════════════════════
 * Public pages: the student evaluation (evaluate.php, evaluate_form.php)
 * and the online enrollment portal (online_enroll.php). Students and
 * parents use these, signed out, often on a phone.
 *
 * Each page loads this file right after the site stack (head_css.php),
 * where its own <style> block used to be. The page sections come first
 * and the shared band and footer (includes/eval_header.php and
 * eval_footer.php) last, the order they had in the page. A rule on a
 * class two of the pages use differently is scoped to the page's body
 * class with :where(), which adds no specificity.
 * ════════════════════════════════════════════════════════════════════ */

/* ─── Student evaluation: the list of teachers (evaluate.php) ─── */
/* Page-specific only — everything else comes from the site stack, and
   the type scale and page width from includes/eval_header.php (shared
   with the online enrollment portal). */
body:where(.pg-evaluate) { background: var(--color-body-bg); min-height: 100vh; }
/* Softer than the staff card token on purpose — this is a public page. */
/* cards.css paints .card-body with its own square white background, which
   sits on top of the card's rounded corners and squares them off. Clip
   the card so the body cannot escape its shape, and round the body to
   match for browsers that paint the background before the clip. */
:where(.pg-evaluate) .eval-card {
    border: none;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 4px 24px rgba(0,0,0,0.08);
}
:where(.pg-evaluate) .eval-card > .card-body { border-radius: inherit; }
/* Two columns once there's room. A student has 8-12 of these, and a
   single column turned the list into a long scroll with a lot of empty
   space to the right of every name. */
/* minmax(0,1fr), not 1fr: a plain 1fr track is minmax(auto,1fr), and
   that auto floor is the item's min-content -- which text-truncate's
   nowrap makes the full untruncated string. The track then refuses to
   go narrower than the longest teacher name and pushes the page wider
   than the phone. Same trap as min-width:0 on a flex child. */
/* The track is a pill but Bootstrap leaves the fill square, so its
   leading edge cut a hard vertical line across a rounded shape. Round
   the fill to match, and warm the empty part off Bootstrap's cool grey
   so it sits with the page rather than against it. */
:where(.pg-evaluate) .progress { background-color: var(--color-surface-2, #ece7df); }
:where(.pg-evaluate) .progress-bar { border-radius: 999px; transition: width .3s ease; }

.target-grid { display: grid; gap: .5rem; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 992px) { .target-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

.target-row {
    border: 1px solid var(--color-border, #e2e8f0);
    border-radius: 12px;
    padding: .7rem .9rem;
    background: var(--color-surface, #fff);
    transition: border-color .15s, box-shadow .15s, transform .15s;
}
.target-row:hover {
    border-color: var(--color-primary);
    box-shadow: 0 2px 10px rgba(0,0,0,.07);
    transform: translateY(-1px);
}
.target-row .go { color: var(--color-text-muted, #94a3b8); transition: color .15s; }
.target-row:hover .go { color: var(--color-primary); }

/* Done rows recede: the point of the list is what's still left to do. */
.target-row.done { background: #f6fdf8; border-color: #bbf7d0; }
.target-row.done .target-name { color: var(--color-text-muted, #64748b); }
.target-row.done .target-photo { opacity: .65; }

.target-name { font-weight: 600; line-height: 1.3; }
.target-sub { font-size: var(--text-sm); line-height: 1.35; color: var(--color-text-muted, #64748b); }
/* A face is how a student actually identifies their teacher. */
.target-photo {
    width: 44px; height: 44px; flex-shrink: 0;
    border-radius: 50%;
    background-size: cover; background-position: top center;
    background-color: var(--color-surface-2, #eef2f7);
}
.target-initials {
    display: flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: .85rem; color: var(--color-primary, #1e3a8a);
}

/* ─── Student evaluation: the form (evaluate_form.php) ─── */
/* Page-specific only — everything else comes from the site stack, and
   the type scale and page width from includes/eval_header.php (shared
   with the online enrollment portal). Sizes are type tokens, not rem,
   so they follow that scale. */
body:where(.pg-evaluate-form) { background: var(--color-body-bg); }
/* Same square-corner trap as the list page: cards.css gives .card-body
   its own square white background over the card's rounded corners. */
/* NO overflow:hidden here. position:sticky cannot escape an ancestor
   that clips, so clipping the card pinned the scale header inside it
   and it stopped following the scroll. Rounding the body instead gets
   the same corners -- it is the body's own square white background
   (cards.css) that squares them off -- without trapping the header. */
:where(.pg-evaluate-form) .eval-card {
    border: none;
    border-radius: 16px;
    box-shadow: 0 4px 24px rgba(0,0,0,0.08);
}
:where(.pg-evaluate-form) .eval-card > .card-body { border-radius: inherit; }
.q-block { border-bottom: 1px solid var(--color-border, #e9eef5); padding: 1.4rem 0; }
.q-block:last-child { border-bottom: 0; }
.q-block.missing { background: #fff5f5; border-radius: 8px; padding-left: .75rem; padding-right: .75rem; }

/* The statement is the thing being judged, so it gets read first:
   full-size text, generous leading, and a hanging number so a wrapped
   second line stays aligned with the first instead of tucking under
   the numeral. */
.q-text {
    display: flex;
    gap: .65rem;
    font-size: var(--text-lg);
    line-height: 1.65;
    color: var(--color-text, #1e293b);
}
.q-num {
    flex-shrink: 0;
    min-width: 1.4rem;
    font-weight: 700;
    color: var(--color-primary, #1e3a8a);
}

/* Desktop: a rating matrix like the paper form — a header row of scale
   labels sitting over a row of number buttons. Mobile: stacked pills
   carrying their own label, because a 4-column radio grid is unusable
   at phone width.

   .scale-head owns its own show/hide instead of Bootstrap's
   .d-none.d-md-block: that utility resolves to display:block !important,
   which outranks the grid below and drops all four labels into one
   column above the buttons. */
/* The person being evaluated, in a band under the school branding.
   Surface-coloured rather than part of the gradient, so the header
   stays "which school / which module" and this stays "who". */
.eval-target-bar {
    background: var(--color-surface, #fff);
    border-bottom: 1px solid var(--color-border, #e2e8f0);
    padding: .5rem 0;
}

/* The person being evaluated. Sized up deliberately: this is the one
   thing on the page the student has to be sure of before answering. */
.eval-target-photo {
    width: 56px; height: 56px; flex-shrink: 0;
    border-radius: 50%;
    background-size: cover; background-position: top center;
    background-color: #fff; border: 2px solid var(--color-border, #e2e8f0);
}
.eval-target-name { font-size: var(--text-3xl); line-height: 1.25; }
.eval-target-kicker { font-size: var(--text-2xs); letter-spacing: .06em; }
.rating-grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (max-width: 575.98px) {
    .eval-target-photo { width: 48px; height: 48px; }
    .eval-target-name { font-size: var(--text-xl); }
}
.eval-target-initials {
    display: flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: 1.5rem; color: var(--color-primary, #1e3a8a);
}

/* Hidden on phones: there the pills carry their own labels, so a
   four-column header would be unreadable and pointless. */
.scale-head { display: none; }

/* Phones: one option per row, each carrying its own label. Desktop
   turns this into the paper form's matrix (see the media query). */
.rating-grid { display: grid; gap: .5rem; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 768px) {
    .scale-head {
        display: grid;
        grid-template-columns: repeat(var(--cols, 4), minmax(0, 1fr));
        gap: .5rem;
        position: sticky;
        top: 0;
        z-index: 5;
        padding: .6rem 0;
        margin-bottom: .25rem;
        background: var(--color-surface, #fff);
        border-bottom: 1px solid var(--color-border, #e2e8f0);
        font-size: var(--text-xs);
        font-weight: 700;
        letter-spacing: .02em;
        text-transform: uppercase;
        text-align: center;
        line-height: 1.2;
        color: var(--color-text-muted, #64748b);
    }
    .rating-grid { grid-template-columns: repeat(var(--cols, 4), minmax(0, 1fr)); }
    .rating-opt .lbl { display: none; }

    /* Capped and right-aligned so the scale reads as a column block
       beside the statement — the shape of the paper form — instead of
       four very wide boxes holding a single digit each. */
    .scale-head, .rating-grid { max-width: 620px; margin-left: auto; }
}
.rating-opt {
    border: 1px solid var(--color-border, #dbe3ec);
    border-radius: 8px;
    padding: .65rem .5rem;
    text-align: center;
    cursor: pointer;
    background: var(--color-surface, #fff);
    font-size: var(--text-base);
    transition: border-color .15s, background .15s, box-shadow .15s;
}
.rating-opt:hover { box-shadow: 0 1px 6px rgba(0,0,0,.06); }
.rating-opt:hover { border-color: var(--color-primary, #1e3a8a); }
.rating-opt input { display: none; }
.rating-opt.selected {
    background: var(--color-primary, #1e3a8a);
    color: #fff;
    border-color: var(--color-primary, #1e3a8a);
}
.rating-opt .val { font-weight: 700; display: block; }
.rating-opt .lbl { font-size: var(--text-xs); opacity: .85; }

/* ─── Online enrollment (online_enroll.php) ─── */
/* Page-specific only — font, buttons, forms and alerts come from the
   site stack, and the type scale, page width and phone-sized inputs
   from includes/eval_header.php, the same as the student evaluation. */
body:where(.pg-online-enroll) { background: var(--color-body-bg); }
/* Softer than the staff card, matching the other public pages. */
.enroll-card { border: none; border-radius: 16px; overflow: hidden; box-shadow: 0 4px 24px rgba(0,0,0,0.08); }
.choice-card { border: 2px solid var(--color-border); border-radius: 16px; padding: 2rem 1.5rem; text-align: center; cursor: pointer; background: var(--color-surface); transition: border-color .15s, background .15s, box-shadow .15s, transform .15s; }
.choice-card:hover { border-color: var(--color-primary); background: color-mix(in srgb, var(--color-primary) 5%, var(--color-surface)); transform: translateY(-2px); box-shadow: var(--shadow-md); }
.choice-icon { font-size: 2.75rem; color: var(--color-primary); margin-bottom: 1rem; }
.step-bar { display: flex; gap: 6px; align-items: center; margin-bottom: 1.5rem; }
.step-pip { height: 6px; border-radius: 999px; flex: 1; background: var(--color-border); transition: background .3s; }
.step-pip.active { background: var(--color-primary); }
.step-pip.done { background: var(--color-success); }
.student-result-card { border: 2px solid var(--color-border); border-radius: 12px; padding: 1rem 1.25rem; cursor: pointer; transition: border-color .15s, background .15s; display: flex; align-items: center; gap: 1rem; margin-bottom: .75rem; }
.student-result-card:hover, .student-result-card.selected { border-color: var(--color-primary); background: color-mix(in srgb, var(--color-primary) 5%, var(--color-surface)); }
.s-photo { width: 56px; height: 56px; border-radius: 10px; object-fit: cover; flex-shrink: 0; }
.s-initials { width: 56px; height: 56px; border-radius: 10px; display: flex; align-items: center; justify-content: center; font-size: 1.2rem; font-weight: 700; color: var(--color-white); background: var(--gradient-primary); flex-shrink: 0; }
.track-card { border: 2px solid var(--color-border); border-radius: 10px; padding: .75rem; text-align: center; cursor: pointer; transition: border-color .15s, background .15s; }
.track-card:hover, .track-card.selected { border-color: var(--color-primary); background: color-mix(in srgb, var(--color-primary) 8%, var(--color-surface)); }
.info-box { background: var(--color-surface-alt); border: 1px solid var(--color-border); border-radius: 10px; padding: 1rem; }
:where(.pg-online-enroll) .info-label { font-size: var(--text-sm); font-weight: var(--font-bold); text-transform: uppercase; letter-spacing: .5px; color: var(--color-text-muted); margin-bottom: 2px; }
:where(.pg-online-enroll) .info-value { font-size: var(--text-lg); font-weight: var(--font-semibold); color: var(--color-text); }
:where(.pg-online-enroll) .success-icon { font-size: 4rem; color: var(--color-success); }
:where(.pg-online-enroll) .section-divider { border: none; border-top: 2px dashed var(--color-border); margin: 1.25rem 0; opacity: 1; }
:where(.pg-online-enroll) section[id^="step-"] { display: none; }
:where(.pg-online-enroll) section.active { display: block; }
:where(.pg-online-enroll) .back-btn { background: none; border: none; padding: 0; color: var(--color-text-muted); font-size: 1.2rem; cursor: pointer; line-height: 1; }
:where(.pg-online-enroll) .back-btn:hover { color: var(--color-primary); }
.review-table td:first-child { width: 38%; font-weight: var(--font-semibold); color: var(--color-text-muted); }
.enroll-spinner { color: var(--color-primary); }
/* A field to fix: red border, a light red tint, and its label in red.
   Not Bootstrap's .is-invalid -- its warning icon crowds the narrow
   birthday dropdowns. Cleared as soon as the field is changed. */
.form-control.field-error, .form-select.field-error, .form-check-input.field-error {
    border-color: var(--color-danger) !important;
    background-color: color-mix(in srgb, var(--color-danger) 6%, var(--color-surface));
    box-shadow: 0 0 0 .2rem color-mix(in srgb, var(--color-danger) 18%, transparent);
}
.label-error, .form-check-input.field-error ~ .form-check-label { color: var(--color-danger) !important; }
/* What to type in a field (field_hint() in online_enroll.php): stays in view
   while typing, where a placeholder vanished. Under the label on phones --
   the keyboard covers what is below the field being typed in. From md up,
   moved under the field so the fields in a row stay in line -- every field
   column is a flex column there, hinted or not, so their labels lay out
   alike (a flex item's label is a block; an inline one sat 1px lower). */
:where(.pg-online-enroll) .field-hint { font-size: var(--text-sm); line-height: 1.35; color: var(--color-text-muted); margin: -.125rem 0 .375rem; }
@media (min-width: 768px) {
    :where(.pg-online-enroll) .row > :has(> .form-label) { display: flex; flex-direction: column; }
    :where(.pg-online-enroll) .row > * > .field-hint { order: 1; margin: .25rem 0 0; }
}
/* Month / Day / Year on one line, sized 5:3:4. A flex row rather than a
   nested .row: the gutter margins on that sat the selects 4px lower
   than the LRN box beside them. min-width:0 lets a select shrink below
   its longest option on a phone instead of pushing the page wider. */
/* The consent policy: long, so it scrolls in its own box; its line
   breaks are kept as written (it is plain text from Settings). */
.consent-box { max-height: 220px; overflow-y: auto; white-space: pre-line; font-size: var(--text-sm); line-height: 1.5; background: var(--color-surface-alt); border: 1px solid var(--color-border); border-radius: 10px; padding: .75rem 1rem; }
.bday-selects { display: flex; gap: .5rem; }
.bday-selects .form-select { min-width: 0; }
.bday-selects .bday-month { flex: 5 1 0; }
.bday-selects .bday-day   { flex: 3 1 0; }
.bday-selects .bday-year  { flex: 4 1 0; }
:where(.pg-online-enroll) .form-control.uppercase, :where(.pg-online-enroll) textarea.uppercase { text-transform: uppercase; }
:where(.pg-online-enroll) .form-control.uppercase::placeholder, :where(.pg-online-enroll) textarea.uppercase::placeholder { text-transform: none; }

/* ─── The band at the top of every public page (includes/eval_header.php) (includes/eval_header.php) ─── */
/* Bigger type than the staff screens: students and parents read these
   pages once, on a phone or a 1080p monitor, not staff all day at 12px. The
   site's type tokens are scaled here, so every component follows. */
:root {
    --text-2xs: 11px; --text-xs: 12px; --text-sm: 13px; --text-base: 14px; --text-md: 15px;
    --text-lg: 16px;  --text-xl: 17px; --text-2xl: 18px; --text-3xl: 20px; --text-4xl: 22px;
}
@media (min-width: 1200px) {
    :root { --text-xs: 13px; --text-sm: 14px; --text-base: 15px; --text-md: 16px; --text-lg: 17px; --text-xl: 18px; }
}
/* iPhones zoom into any field under 16px; keep them at 16 on phones. */
@media (max-width: 575.98px) {
    .form-control, .form-select { font-size: 16px; }
}
/* The page column. Wider on desktops: at 720px three-across rows wrapped
   their labels and pushed the fields out of line. */
.public-container { max-width: 720px; }
@media (min-width: 992px)  { .public-container { max-width: 800px; } }
@media (min-width: 1200px) { .public-container { max-width: 880px; } }
.form-label.req::after { content: ' *'; color: var(--color-danger); }

/* .min-w-0 (text-truncate inside a flex row) comes from 6-utilities.css. */

/* Nothing in this flow is allowed to force a horizontal scrollbar. The
   clip itself now lives on <html> in 2-base.css -- on <body> it made body
   a scroll container and broke every sticky header in the system. */
html, body { max-width: 100%; }

/* Reserve the vertical scrollbar's width even when the page doesn't need
   one. The sign-in card fits the viewport and the teacher list doesn't, so
   without this the scrollbar appears on sign-in, takes ~6px off the width,
   and the whole header nudges sideways. Ignored by older browsers, which
   simply keeps today's behaviour. */
html { scrollbar-gutter: stable; }

/* The band itself lives here too. It was declared separately in each page
   and had drifted -- 1.5rem of padding on the list, 1.25rem on the form --
   so the header jumped 8px and the logo shifted whenever a student moved
   between them. */
.eval-header {
    background: var(--isms-gradient-primary, linear-gradient(135deg, #1e3a8a, #0ea5e9));
    color: #fff;
    padding: 1.5rem 0;
}

.eval-logo { height: 64px; width: 64px; background-size: contain; background-position: center; background-repeat: no-repeat; }

/* The student chip. Styles live here with the markup: they used to be
   copy-pasted into both pages and had already drifted (38px on the list,
   34px on the form, different padding). */
.eval-student { background: rgba(255,255,255,.15); border-radius: 999px; padding: .3rem .95rem .3rem .3rem; }
.eval-student .eval-photo, .eval-student .eval-initials {
    width: 52px; height: 52px; border-radius: 50%;
    background-size: cover; background-position: top center; background-color: #fff;
}

/* People's photos are painted as backgrounds, not <img> elements, so the
   browser offers no "Save image" or "Open image in new tab" on them, and
   nothing can be dragged out. pointer-events:none also lets a tap fall
   through to the row link behind it, and kills the long-press menu on iOS.
   This is a deterrent, not protection -- the URL is still in the markup. */
.no-save {
    -webkit-user-drag: none;
    -webkit-touch-callout: none;
    user-select: none;
    pointer-events: none;
}
.eval-initials {
    display: flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: 1.05rem; color: var(--color-primary);
}
.eval-student-name { font-size: 1rem; font-weight: 600; line-height: 1.25; }

/* Year badge and motto, echoing the staff header's sy-badge / school-motto. */
.eval-sy {
    font-size: .7rem; font-weight: 600; letter-spacing: .02em;
    padding: .15rem .5rem; border-radius: 999px;
    background: rgba(255,255,255,.2); white-space: nowrap;
}
.eval-motto { opacity: .85; font-style: italic; margin-left: .5rem; }
.eval-motto .bi-quote { margin-right: .15rem; }

@media (max-width: 575.98px) {
    /* Trim the band itself. The crest is already 48px here and the motto is
       already hidden, so padding is the only thing left that costs real
       height on a phone. */
    .eval-header { padding: 1rem 0; }
    .eval-logo { height: 44px; width: 44px; }
    .eval-student .eval-photo, .eval-student .eval-initials { width: 40px; height: 40px; }
    .eval-header .container { gap: .6rem !important; }
    .eval-student { padding: .25rem .5rem .25rem .25rem; }
}

/* ─── The credit at the foot of every public page (includes/eval_footer.php) (includes/eval_footer.php) ─── */
/* Sticky footer: on a short page (the identity gate is one card) the credit
   would otherwise float halfway up the screen. Body becomes a column and
   the footer takes the leftover space above it via margin-top:auto.
   body > .container keeps its full width — a flex item with auto side
   margins stops stretching, which would shrink Bootstrap containers to
   their content. */
body { display: flex; flex-direction: column; min-height: 100vh; }
body > * { flex-shrink: 0; }
body > .container { width: 100%; }

.eval-footer {
    margin-top: auto;
    width: 100%;
    /* Horizontal padding matters here: with none, the credit ran straight
       into both screen edges on a phone. */
    padding: 1rem 1.25rem;
    text-align: center;
    font-size: .8rem;
    line-height: 1.6;
    color: var(--color-text-muted, #64748b);
}
.eval-footer strong { font-weight: 600; }

/* Each half wraps as a unit, so a narrow screen breaks between them
   rather than mid-credit. */
.eval-footer .foot-part { display: inline-block; white-space: nowrap; }
.eval-footer .foot-sep { padding: 0 .5rem; }
@media (max-width: 400px) {
    /* Too narrow for one line: drop the separator and let them stack. */
    .eval-footer .foot-sep { display: none; }
    .eval-footer .foot-part { display: block; }
}
