/* Styles for the pages that Django renders.
 *
 * These are additions to the theme rather than changes to it: style.css is the
 * bought theme and is left alone, so a future theme update cannot be blocked by
 * edits made here.
 *
 * The gallery rules exist because the two gallery pages carried the class names
 * gallery-section, cover-image and imageModal while no stylesheet defined any
 * of them — the photographs rendered at their natural size, several thousand
 * pixels wide, inside a modal that had no overlay.
 */

/* --- One school's records, under its name ------------------------------ */

/* The gallery's albums and the staff list are both grouped by school, so the
 * heading that names each group is shared rather than written twice — two
 * copies of it is how the pages this project is replacing drifted apart. */

.school-group {
    margin-bottom: 30px;
}

.school-group-title {
    border-bottom: 2px solid #141313;
    padding-bottom: 8px;
    margin-bottom: 20px;
    font-size: 28px;
}

/* --- Gallery: the album grid ------------------------------------------- */

.gallery-section {
    margin-bottom: 30px;
    text-align: center;
}

.gallery-section h3 {
    font-size: 20px;
    margin-bottom: 12px;
}

.gallery-section .cover-image {
    display: block;
    width: 100%;
    height: 220px;
    object-fit: cover;
    margin-bottom: 12px;
}

.gallery-section p {
    min-height: 44px;
}

.gallery-button {
    margin-top: 8px;
}

/* --- Gallery: one album's photographs ---------------------------------- */

.gallery-photo {
    margin-bottom: 20px;
}

.gallery-photo img {
    display: block;
    width: 100%;
    height: 220px;
    object-fit: cover;
    cursor: zoom-in;
}

.gallery-caption,
.gallery-description,
.gallery-back,
.empty-note {
    font-size: 15px;
    color: #555;
}

/* --- Staff ------------------------------------------------------------- */

/* A card is the school's own record of a person, so it shows a photograph only
 * when one has been added — teachers.html filled the slot with stock portraits
 * of people who do not teach here. */

.staff-photo {
    display: block;
    width: 100%;
    height: 220px;
    object-fit: cover;
    margin-bottom: 12px;
}

.staff-role {
    margin-bottom: 4px;
}

/* The last line in the card, so its own margin would show as space above the
 * card's padding. */
.staff-subjects {
    margin-bottom: 0;
}

.gallery-caption {
    margin-top: 6px;
    min-height: 40px;
}

/* --- The lightbox ------------------------------------------------------ */

#imageModal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1050;
    background: rgba(0, 0, 0, 0.85);
    padding: 40px 60px;
    overflow: hidden;
    text-align: center;
}

#imageModal .modal-content {
    display: block;
    width: auto;
    max-width: 100%;
    max-height: 80vh;
    margin: 0 auto;
    border: 0;
    background: transparent;
    box-shadow: none;
}

#imageModal .close {
    position: absolute;
    top: 8px;
    right: 24px;
    color: #fff;
    font-size: 40px;
    line-height: 1;
    opacity: 0.85;
    cursor: pointer;
}

#imageModal .left-arrow,
#imageModal .right-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    color: #fff;
    font-size: 40px;
    line-height: 1;
    padding: 8px 14px;
    opacity: 0.85;
    cursor: pointer;
    user-select: none;
}

#imageModal .left-arrow {
    left: 8px;
}

#imageModal .right-arrow {
    right: 8px;
}

#imageModal .close:hover,
#imageModal .left-arrow:hover,
#imageModal .right-arrow:hover {
    opacity: 1;
}

#caption {
    color: #fff;
    margin-top: 14px;
    font-size: 15px;
}

@media (max-width: 767px) {
    #imageModal {
        padding: 50px 12px;
    }

    .gallery-section .cover-image,
    .gallery-photo img {
        height: 180px;
    }
}

/* --- The content card -------------------------------------------------- */

/* course-grid-2.html, course-grid-3.html, course-grid-4.html and sports.html
 * all carry the same three inline styles on the same card — a grey border, 20px
 * of padding and centred text — so it is defined once here. It matters that the
 * rule lives in a stylesheet rather than in style="": the school edits this
 * page's text in the admin, and a card whose appearance is welded to the markup
 * cannot be restyled without editing HTML. */

.service-item {
    border: 1px solid #ccc;
    padding: 20px;
    margin-bottom: 20px;
    text-align: center;
}

.service-item h4 {
    font-weight: bold;
    margin-bottom: 12px;
}

.service-item p,
.service-item li {
    color: #777;
}

.service-item ul {
    list-style-position: inside;
    padding-left: 0;
    margin-bottom: 15px;
}

/* --- A school's own page ----------------------------------------------- */

/* The facts strip: levels, boarding, examination boards and the numbers the
 * school publishes, each omitted when blank. */

.school-facts {
    display: flex;
    flex-wrap: wrap;
    gap: 14px 34px;
    justify-content: center;
    margin: 0 0 30px;
    padding: 16px 0;
    border-top: 1px solid #eee;
    border-bottom: 1px solid #eee;
}

.school-fact {
    margin: 0;
    text-align: center;
}

.school-fact dt {
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #999;
}

.school-fact dd {
    margin: 2px 0 0;
    font-size: 16px;
    color: #333;
}

/* The photograph strip. The source pages used images/ files at their natural
 * size, which on a phone is several screens wide; object-fit keeps the frame a
 * predictable height whatever shape the photograph is. */

.school-carousel {
    margin: 30px auto 50px;
}

.school-carousel img {
    display: block;
    width: 100%;
    height: 420px;
    object-fit: cover;
}

@media (max-width: 767px) {
    .school-carousel img {
        height: 220px;
    }
}

/* The picture above a card on a page the school writes. sports.html set
 * width:100%; height:450px; object-fit:cover inline on each of its four, so the
 * same frame is kept here and the inline styles go. */

.block-image {
    display: block;
    width: 100%;
    height: 450px;
    object-fit: cover;
    margin-bottom: 20px;
}

@media (max-width: 767px) {
    .block-image {
        height: 220px;
    }
}

/* --- The subjects each school teaches ---------------------------------- */

/* A column per level. course-grid-4.html centred the level's name and left the
 * list of subjects below it aligned to the left; a column of nineteen subject
 * names reads worse centred, so that shape is kept. */

.subject-level {
    text-align: left;
}

.subject-level h4 {
    text-align: center;
}

/* On a page whose own cards sit above the columns, the school's name needs
 * room to read as a new section rather than as part of the card above it. The
 * gallery and staff pages, which use .school-group too, start with it. */

.subject-group {
    margin-top: 30px;
}

/* --- News --------------------------------------------------------------- */

/* The theme defines blog-item, image-blog, meta-info-blog, blog-title and
 * blog-button, but not blog-desc — the class blog.html put the article's prose
 * in — so that one is here. The card's picture gets a fixed frame so a row of
 * cards lines up whatever shape the photographs are. */

.image-blog img {
    display: block;
    height: 220px;
    object-fit: cover;
}

.blog-item {
    margin-bottom: 30px;
}

.blog-desc p {
    color: #555;
}

.news-pages {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 20px;
}

.news-page-count {
    font-size: 14px;
    color: #777;
}

/* --- One post ----------------------------------------------------------- */

.post-meta {
    margin-bottom: 20px;
    text-transform: uppercase;
    font-size: 13px;
    color: #777;
}

.post-meta .post-date,
.post-meta .post-school {
    display: inline-block;
    margin-right: 18px;
}

.post-image {
    display: block;
    width: 100%;
    max-height: 460px;
    object-fit: cover;
    margin-bottom: 24px;
}

.post-body p,
.post-body li {
    font-size: 16px;
    line-height: 1.8;
    color: #555;
}

.post-body ul {
    list-style-position: inside;
    padding-left: 0;
}

.post-back {
    margin-top: 30px;
}

/* --- History: the timeline ---------------------------------------------- */

/* The theme gives the timeline card a white ground and white text, because the
 * text was meant to sit on a photograph: todo.html gave each item an img-bg-*
 * class that no stylesheet ever defined, so the page it was written for would
 * have shown white on white. Nothing on this timeline is a photograph, so the
 * text takes the card's own colour and the card keeps the theme's frame. */

.timeline {
    margin-top: 30px;
}

.timeline__content h2 {
    color: #141313;
}

.timeline__content p,
.timeline__content li {
    color: #555;
}

.timeline__content ul {
    list-style-position: inside;
    padding-left: 0;
    margin-bottom: 0;
}

/* The level a year's results were taken at — "O-Level", "A-Level". */
.timeline-level {
    margin: 14px 0 6px;
    font-size: 15px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .5px;
    color: #777;
}

.timeline-results li {
    font-size: 15px;
    line-height: 1.6;
}


/* --- Contact: the schools' details, and the form ------------------------ */

/* The invitation above the cards, which the school writes in the admin. The
 * block's paragraphs take the size the theme's own `p.lead` uses, so several
 * paragraphs read as a lead rather than only the first one. */
.contact-intro p {
    font-size: 18px;
    line-height: 1.7;
    color: #555;
}

.contact-card {
    margin-bottom: 30px;
}

.contact-card .card-text {
    margin-bottom: 6px;
    word-break: break-word;
}

.contact-form-wrap {
    margin-top: 20px;
}

.contact-form-wrap .row {
    /* A row per group of fields, so the gap belongs to the row and not to a
     * margin on every control. */
    margin-bottom: 15px;
}

/* Django prints a field's errors as `<ul class="errorlist">` above it, and an
 * error must be visible: the theme has no styling for it at all, so it would
 * otherwise render as a default bulleted list in link blue. */
.errorlist {
    list-style: none;
    margin: 6px 0 0;
    padding: 0;
    font-size: 14px;
    color: #b3261e;
}

.contact-form-wrap .is-invalid {
    border-color: #b3261e;
}

/* The band a view's message appears in — the contact form's thank-you. */
.page-messages {
    margin-top: 20px;
    margin-bottom: -10px;
}

.page-messages .alert:last-child {
    margin-bottom: 0;
}
