/* The teachers page, the teacher cabinet and a class page. Mobile first: a phone is where the students open
   the link, and a teacher may read the list on a phone too. Colours come from theme.css. */

.teacher-panel,
.class-intro,
.teachers-hero,
.teachers-section,
.teachers-cta {
    box-sizing: border-box; /* width 100% includes the side padding: on a phone the page no longer slides sideways */
    width: 100%;
    max-width: 1040px;
    margin: 0 auto;
    padding: 0 1rem;
}

.teacher-panel h1,
.class-intro h1,
.teachers-hero h1 {
    font-family: var(--font-serif);
    font-size: clamp(1.65rem, 5vw, 2.4rem);
    line-height: 1.2;
    margin: 0 0 0.75rem;
    color: var(--ink);
}

.teacher-lede,
.teachers-hero__lede {
    font-size: 1.05rem;
    line-height: 1.6;
    color: var(--ink-soft);
    margin: 0 0 1.5rem;
}

.teacher-hint {
    color: var(--ink-soft);
    font-size: 0.92rem;
    line-height: 1.5;
    margin: 0.4rem 0 1rem;
}

.teacher-back {
    margin: 0.75rem 0 1.25rem;
}

.teacher-back a {
    color: var(--teal);
    font-weight: 600;
    text-decoration: none;
}

.teacher-back a:hover,
.teacher-back a:focus-visible {
    text-decoration: underline;
}

/* Forms */

/* The fields themselves (.field-label, .text-input) come from theme.css: the same big white fields as the letter form. */
.teacher-form {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    box-sizing: border-box;
    max-width: 640px;
    background: var(--card);
    border: 1px solid var(--hairline);
    border-radius: var(--radius-lg);
    padding: 1.25rem;
    box-shadow: var(--shadow-soft);
}

.teacher-form .text-input,
.teacher-form select.text-input {
    margin-bottom: 0.75rem;
}

/* The assignment is written like a letter: the letter form's large serif field. */
.teacher-form textarea.text-input {
    min-height: 200px;
    font-family: var(--font-serif);
    font-size: 18px;
    line-height: 1.65;
    resize: vertical;
}

.teacher-form input[type="date"].text-input {
    max-width: 16rem;
}

@media (min-width: 640px) {
    .teacher-form {
        padding: 1.75rem;
    }
}

.teacher-form .button {
    align-self: flex-start;
    margin-top: 0.75rem;
}

.teacher-fieldset {
    border: 0;
    padding: 0;
    margin: 0.25rem 0 0.75rem;
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
}

.teacher-radio {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    color: var(--ink);
    font-size: 17px;
    line-height: 1.45;
    cursor: pointer;
}

.teacher-radio input {
    flex: 0 0 auto;
    width: 20px;
    height: 20px;
    margin: 0;
    accent-color: var(--terracotta);
}

.teacher-consent {
    display: flex;
    align-items: flex-start;
    gap: 0.6rem;
    margin: 0.5rem 0 1rem;
    color: var(--ink);
    line-height: 1.5;
    cursor: pointer;
}

.teacher-consent input {
    margin-top: 0.25rem;
    accent-color: var(--terracotta);
}

/* the question about the students' age: two long answers, the radio beside the first line */
.teacher-age {
    margin: 0.75rem 0 1rem;
}

.teacher-age .teacher-radio {
    align-items: flex-start;
}

.teacher-age input {
    margin-top: 0.2rem;
}

/* The class's delivery date: shown only with "one date for the whole class". */
.teacher-fixed-date {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.teacher-fixed-date[hidden] {
    display: none;
}

/* Our own message about a field, right above it (never over the next answer of a question). */
.field-check {
    margin: 0.1rem 0 0.2rem;
    color: #9a2b1f;
    font-size: 0.92rem;
    font-weight: 700;
    line-height: 1.4;
}

.field-check[hidden] {
    display: none;
}

.teacher-form [aria-invalid="true"] {
    border-color: #c0573f;
}

/* "The last step": above the create form for a teacher without classes yet. */
.teacher-step {
    display: inline-block;
    margin: 0 0 0.6rem;
    padding: 0.3rem 0.8rem;
    border-radius: 999px;
    background: var(--terracotta);
    color: #ffffff;
    font-weight: 700;
    font-size: 0.95rem;
}

.code-input--single {
    max-width: 14rem;
    font-size: 24px;
    letter-spacing: 0.35em;
    font-variant-numeric: tabular-nums;
}

.form-error,
.form-success {
    max-width: 640px;
    border-radius: var(--radius);
    padding: 0.75rem 0.9rem;
    line-height: 1.5;
    margin: 0 0 1rem;
}

.form-error {
    background: #fbe9e2;
    border: 1px solid #e5b9a8;
    color: #7a2f16;
}

.form-success {
    background: #e8f1ec;
    border: 1px solid #b9d4c5;
    color: #1e4f38;
}

/* Cabinet */

.teacher-head {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin: 1rem 0 1.5rem;
}

.teacher-signed {
    color: var(--ink-soft);
    margin: 0.2rem 0 0;
    overflow-wrap: anywhere;
}

.teacher-head__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
}

.teacher-head__actions form {
    margin: 0;
}

.teacher-empty {
    background: var(--card);
    border: 1px dashed var(--hairline);
    border-radius: var(--radius-lg);
    padding: 1.25rem;
    color: var(--ink-soft);
}

/* An empty cabinet right after signing in: one big, friendly step to the class link. */
.teacher-start {
    max-width: 640px;
    background: var(--card);
    border: 2px solid var(--terracotta);
    border-radius: var(--radius-lg);
    padding: 1.4rem 1.25rem;
    box-shadow: var(--shadow-soft);
}

.teacher-start h2 {
    font-family: var(--font-serif);
    font-size: clamp(1.4rem, 4.5vw, 1.9rem);
    line-height: 1.25;
    margin: 0 0 0.6rem;
    color: var(--ink);
}

.teacher-start p {
    margin: 0 0 1rem;
    font-size: 1.05rem;
    line-height: 1.6;
    color: var(--ink-soft);
}

.teacher-start p a {
    color: var(--terracotta-deep);
    font-weight: 700;
}

.teacher-start .button {
    font-size: 1.05rem;
}

/* A closed link: no copy button and no QR code, just what it means and how to open it again. */
.teacher-class__closed {
    background: #f3ece3;
    border-radius: var(--radius);
    padding: 0.75rem 0.9rem;
    margin: 0 0 1rem;
    line-height: 1.55;
    color: var(--ink-soft);
}

/* "Download the list" while the class has no letters: shown, but there is nothing to download yet. */
.button.is-disabled {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}

.teacher-class {
    background: var(--card);
    border: 1px solid var(--hairline);
    border-radius: var(--radius-lg);
    padding: 1.1rem;
    margin: 0 0 1.5rem;
    box-shadow: var(--shadow-soft);
}

.teacher-class__head {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    justify-content: space-between;
    gap: 0.4rem 0.9rem;
}

.teacher-class__head h2 {
    font-family: var(--font-serif);
    font-size: 1.35rem;
    margin: 0;
    overflow-wrap: anywhere;
}

.teacher-class__status {
    font-size: 0.85rem;
    font-weight: 700;
    border-radius: 999px;
    padding: 0.2rem 0.65rem;
    margin: 0;
}

.teacher-class__status.is-open {
    background: #e8f1ec;
    color: #1e4f38;
}

.teacher-class__status.is-closed {
    background: #f3ece3;
    color: var(--ink-soft);
}

.teacher-class__name {
    color: var(--ink-soft);
    margin: 0.35rem 0 1rem;
    overflow-wrap: anywhere;
}

.teacher-class__link {
    margin: 0 0 1rem;
}

.copy-row {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.copy-row .text-input {
    margin: 0;
    font-size: 0.9rem;
}

.teacher-qr {
    margin: 0.75rem 0 0;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.teacher-qr img {
    width: 132px;
    height: 132px;
    background: #ffffff;
    border: 1px solid var(--hairline);
    border-radius: 8px;
    padding: 4px;
}

.teacher-qr figcaption {
    color: var(--ink-soft);
    font-size: 0.9rem;
    max-width: 12rem;
}

.teacher-totals {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(8.5rem, 1fr));
    gap: 0.6rem;
    margin: 0 0 0.75rem;
}

.teacher-totals div {
    background: var(--paper);
    border: 1px solid var(--hairline);
    border-radius: var(--radius);
    padding: 0.6rem 0.75rem;
}

.teacher-totals dt {
    font-size: 0.82rem;
    color: var(--ink-soft);
}

.teacher-totals dd {
    margin: 0.2rem 0 0;
    font-size: 1.35rem;
    font-weight: 700;
    color: var(--ink);
}

.teacher-class h3 {
    font-size: 1.05rem;
    margin: 1rem 0 0.5rem;
}

.teacher-table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border: 1px solid var(--hairline);
    border-radius: var(--radius);
}

.teacher-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.92rem;
}

.teacher-table th,
.teacher-table td {
    text-align: left;
    padding: 0.55rem 0.7rem;
    border-bottom: 1px solid var(--hairline);
    white-space: nowrap;
}

.teacher-table th {
    background: var(--paper);
    color: var(--ink-soft);
    font-weight: 700;
}

.teacher-table tbody tr:last-child td {
    border-bottom: 0;
}

/* The teacher's own letter in the list: shown, marked "you", not counted. */
.teacher-table tr.is-teacher td {
    color: var(--ink-soft);
    font-style: italic;
}

.teacher-table__you {
    font-weight: 700;
    font-style: normal;
}

.teacher-table__email {
    max-width: 18rem;
    overflow-wrap: anywhere;
    white-space: normal;
}

.teacher-class__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
    margin-top: 1rem;
}

.teacher-class__actions form {
    margin: 0;
}

/* A class page */

.class-intro {
    padding-top: 1.25rem;
}

.class-eyebrow {
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--terracotta);
    margin: 0 0 0.4rem;
}

.class-assignment {
    white-space: pre-line;
    background: var(--card);
    border-left: 4px solid var(--gold);
    border-radius: var(--radius);
    padding: 0.9rem 1rem;
    margin: 0 0 1rem;
    line-height: 1.65;
    color: var(--ink);
    overflow-wrap: anywhere;
}

.class-notice {
    background: #eef4f2;
    border: 1px solid #c4d8d2;
    border-radius: var(--radius);
    padding: 0.8rem 0.95rem;
    line-height: 1.55;
    color: #1d4a45;
    margin: 0 0 1rem;
}

.class-delivery {
    font-weight: 600;
    color: var(--ink);
    margin: 0 0 1.25rem;
}

.class-message {
    padding-top: 2rem;
    padding-bottom: 2rem;
}

.class-message p {
    max-width: 36rem;
    line-height: 1.6;
    color: var(--ink-soft);
}

/* The public teachers page */

.teachers-hero {
    padding-top: 1.5rem;
    padding-bottom: 0.5rem;
}

.teachers-section {
    padding-top: 0.5rem;
    padding-bottom: 0.75rem;
}

.teachers-section h2 {
    font-family: var(--font-serif);
    font-size: 1.4rem;
    margin: 1.4rem 0 0.6rem;
}

.teachers-section p,
.teachers-cta p {
    max-width: 44rem;
    line-height: 1.65;
    color: var(--ink-soft);
}

.teachers-steps {
    list-style: none;
    padding: 0;
    margin: 0.5rem 0 0;
    display: grid;
    gap: 0.9rem;
}

.teachers-steps li {
    background: var(--card);
    border: 1px solid var(--hairline);
    border-radius: var(--radius-lg);
    padding: 1rem;
}

.teachers-step__num {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    border-radius: 50%;
    background: var(--terracotta);
    color: #ffffff;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.teachers-steps h3 {
    margin: 0 0 0.35rem;
    font-size: 1.05rem;
}

.teachers-steps p {
    margin: 0;
    line-height: 1.55;
    color: var(--ink-soft);
}

.teachers-privacy {
    margin-top: 0.5rem;
}

.teachers-cta {
    padding-top: 1rem;
    padding-bottom: 2.5rem;
}

.teachers-cta .button {
    margin-top: 0.5rem;
}

/* "Create a class link" and, beside it, the way back to "My classes" for a teacher who has one already. */
.teachers-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
    margin: 0.5rem 0 0;
}

.teachers-actions .button {
    margin-top: 0;
}

@media (min-width: 640px) {
    .copy-row {
        flex-direction: row;
        align-items: center;
    }

    .copy-row .text-input {
        flex: 1 1 auto;
    }

    .copy-row .button {
        flex: 0 0 auto;
    }

    .teacher-qr img {
        width: 180px;
        height: 180px;
    }

    .teachers-steps {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (min-width: 900px) {
    .teacher-head {
        flex-direction: row;
        align-items: flex-start;
        justify-content: space-between;
    }

    .teacher-panel,
    .class-intro,
    .teachers-hero,
    .teachers-section,
    .teachers-cta {
        padding-left: 0;
        padding-right: 0;
    }
}