/* ==========================================================
   Group 151 (INFO-EN) - timetable website
   Web Technologies lab project, part 1: HTML + CSS
   Plain CSS, no frameworks or libraries.

   Contents
   1. Variables and base styles
   2. Header, drop-down menu and theme switch
   3. Page layout and headings
   4. Timetable (grid, lessons, filters, legend)
   5. Notes and faculty links
   6. Teachers directory and students list
   7. Teacher page (profile, materials, PDF viewer)
   8. Footer
   9. Animation
   10. Responsive rules
   ========================================================== */


/* ---------- 1. Variables and base styles ---------- */

:root {
  --paper: #eef1f6;
  --surface: #ffffff;
  --ink: #14213d;
  --muted: #586179;
  --faded: #7a8296;   /* text of filtered-out lessons */
  --line: #d3d9e4;
  --link: #2440c8;
  --on-ink: #ffffff;  /* text on top of an --ink background */
  --on-tone: #14213d; /* text on top of a subject tone, in both themes */
  --on-edge: #ffffff; /* text on top of a subject edge colour */

  /* one colour pair per subject: a light tone and a dark edge */
  --algebra: #dcef6e;
  --algebra-edge: #5c6f00;
  --calculus: #bdf3ee;
  --calculus-edge: #0b7a70;
  --algorithms: #dccbff;
  --algorithms-edge: #5b32c4;
  --web: #ffc6e4;
  --web-edge: #b01f6c;
  --architecture: #bfdaff;
  --architecture-edge: #1a55b5;
  --tools: #ffd6a6;
  --tools-edge: #a04e00;

  --hour: 4rem; /* height of one hour in the timetable */
  --display: Bahnschrift, "DIN Alternate", "Roboto Condensed", "Arial Narrow", sans-serif;
  --text: "Segoe UI", system-ui, Roboto, Arial, sans-serif;
}

/* Dark theme. js/theme.js puts data-theme="dark" on the <html> element;
   then the same variables get dark values and the whole site follows.
   The lesson blocks stay bright, like paper notes on a dark board. */
html[data-theme="dark"] {
  color-scheme: dark;

  --paper: #121316;
  --surface: #1d1f24;
  --ink: #eceef2;
  --muted: #a6abb6;
  --faded: #7d838f;
  --line: #363a43;
  --link: #8ab4ff;
  --on-ink: #121316;

  --algebra: #c9dc5a;
  --calculus: #8fe0d6;
  --algorithms: #c3b0f7;
  --web: #f7a8cf;
  --architecture: #9cc3f7;
  --tools: #f7c088;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: 5rem;
}

body {
  margin: 0;
  font-family: var(--text);
  font-size: 1rem;
  line-height: 1.5;
  color: var(--ink);
  background: var(--paper);
}

h1,
h2,
h3 {
  margin: 0;
  font-family: var(--display);
  font-stretch: condensed;
  line-height: 1.1;
}

p {
  margin: 0 0 1rem;
}

a {
  color: var(--link);
}

a:focus-visible,
summary:focus-visible {
  outline: 3px solid var(--link);
  outline-offset: 2px;
}

/* generated content: links that leave the site get a small arrow */
a[href^="http"]::after {
  content: " \2197";
}

/* each subject class only sets two variables; components read them */
.algebra {
  --tone: var(--algebra);
  --edge: var(--algebra-edge);
}

.calculus {
  --tone: var(--calculus);
  --edge: var(--calculus-edge);
}

.algorithms {
  --tone: var(--algorithms);
  --edge: var(--algorithms-edge);
}

.web {
  --tone: var(--web);
  --edge: var(--web-edge);
}

.architecture {
  --tone: var(--architecture);
  --edge: var(--architecture-edge);
}

.tools {
  --tone: var(--tools);
  --edge: var(--tools-edge);
}


/* ---------- 2. Header and drop-down menu ---------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.6rem 4vw;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}

/* the logo looks like the number plate on a classroom door */
.plate {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  color: var(--ink);
  text-decoration: none;
}

.plate-number {
  padding: 0.15rem 0.6rem;
  border-radius: 0.3rem;
  font-family: var(--display);
  font-size: 1.6rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  line-height: 1.2;
  color: var(--on-ink);
  background: var(--ink);
}

.plate-text {
  font-size: 0.9rem;
  color: var(--muted);
}

.site-header nav {
  margin-left: auto;
}

.menu {
  display: flex;
  gap: 0.25rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.menu > li {
  position: relative;
}

.menu > li > a {
  display: block;
  padding: 0.65rem 0.9rem;
  border-radius: 0.4rem;
  font-weight: 600;
  color: var(--ink);
  text-decoration: none;
}

.menu > li > a:hover,
.menu > li > a[aria-current="page"] {
  background: var(--paper);
}

.has-submenu > a::after {
  content: " \25BE";
}

/* drop-down: hidden until the parent item is hovered or focused */
.submenu {
  display: none;
  position: absolute;
  top: 100%;
  right: 0;
  width: 24rem;
  margin: 0;
  padding: 0.5rem;
  list-style: none;
  grid-template-columns: 1fr 1fr;
  gap: 0.15rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 0.5rem;
  box-shadow: 0 0.75rem 1.5rem rgba(20, 33, 61, 0.15);
}

.has-submenu:hover > .submenu,
.has-submenu:focus-within > .submenu {
  display: grid;
}

.submenu a {
  display: block;
  padding: 0.5rem 0.6rem;
  border-left: 0.25rem solid var(--edge);
  border-radius: 0.3rem;
  font-weight: 600;
  line-height: 1.25;
  color: var(--ink);
  text-decoration: none;
}

.submenu a:hover,
.submenu a:focus-visible,
.submenu a:hover span,
.submenu a:focus-visible span {
  color: var(--on-tone);
  background: var(--tone);
}

.submenu span {
  display: block;
  font-size: 0.8rem;
  font-weight: 400;
  color: var(--muted);
}


/* button that switches between the light and the dark theme */
.theme-switch {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  min-height: 2.75rem;
  padding: 0.4rem 0.9rem;
  border: 1px solid var(--line);
  border-radius: 2rem;
  font: inherit;
  font-weight: 600;
  color: var(--ink);
  background: var(--paper);
  cursor: pointer;
}

.theme-switch[hidden] {
  display: none;
}

.theme-switch:hover {
  border-color: var(--ink);
}

.theme-switch:focus-visible {
  outline: 3px solid var(--link);
  outline-offset: 2px;
}

/* generated icon: a moon in the light theme, a sun in the dark theme */
.theme-switch::before {
  content: "\263E";
  display: inline-block; /* needed so the icon can rotate */
}

/* Theme change animation. js/theme.js puts the class "theme-changing"
   on <html> for a moment: every colour then fades to its new value,
   and the icon on the button makes one turn. */
html.theme-changing *,
html.theme-changing *::before,
html.theme-changing *::after {
  transition: background-color 0.5s ease, color 0.5s ease, border-color 0.5s ease !important;
}

html.theme-changing .theme-switch::before {
  animation: turn 0.5s ease-out;
}

@keyframes turn {
  from {
    opacity: 0;
    transform: rotate(-180deg) scale(0.4);
  }

  to {
    opacity: 1;
    transform: rotate(0deg) scale(1);
  }
}

html[data-theme="dark"] .theme-switch::before {
  content: "\2600";
}

/* in the dark theme the thin subject lines use the bright tone,
   because the dark edge colour would not show on a dark surface */
html[data-theme="dark"] .submenu a {
  border-left-color: var(--tone);
}

html[data-theme="dark"] .subject-card,
html[data-theme="dark"] .profile {
  border-top-color: var(--tone);
}

html[data-theme="dark"] .photo,
html[data-theme="dark"] .legend a::before {
  border-color: var(--tone);
}


/* ---------- 3. Page layout and headings ---------- */

main {
  max-width: 76rem;
  margin: 0 auto;
  padding: 2.5rem 4vw 4rem;
}

h1 {
  font-size: clamp(2.2rem, 6vw, 3.8rem);
  letter-spacing: -0.01em;
}

h2 {
  margin-bottom: 1rem;
  font-size: 1.8rem;
}

.lead {
  max-width: 40rem;
  margin-top: 0.75rem;
  font-size: 1.15rem;
  color: var(--muted);
}

main > section {
  margin-bottom: 3.5rem;
}

/* "Now: week 8, even week" - filled in by js/week.js */
.week-now {
  display: inline-block;
  margin: 1rem 0 0;
  padding: 0.3rem 0.9rem;
  border-radius: 0.3rem;
  font-family: var(--display);
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--on-ink);
  background: var(--ink);
}

.week-now[hidden] {
  display: none;
}


/* ---------- 4. Timetable ---------- */

/* The radio buttons are kept in the page (so the keyboard still
   reaches them) but they are invisible; their labels are the buttons. */
.switch {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 2.5rem;
  margin: 1.5rem 0 1rem;
}

.filter {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem;
  margin: 0;
}

.filter-name {
  margin-right: 0.25rem;
  font-weight: 600;
}

.filter label {
  display: inline-flex;
  align-items: center;
  min-height: 2.75rem;
  padding: 0.4rem 1rem;
  border: 1px solid var(--line);
  border-radius: 2rem;
  background: var(--surface);
  cursor: pointer;
}

.filter label:hover {
  border-color: var(--ink);
}

/* the label of the checked radio button is filled in */
#sub-all:checked ~ .filters label[for="sub-all"],
#sub-1:checked ~ .filters label[for="sub-1"],
#sub-2:checked ~ .filters label[for="sub-2"],
#show-all:checked ~ .filters label[for="show-all"],
#show-course:checked ~ .filters label[for="show-course"],
#show-seminar:checked ~ .filters label[for="show-seminar"],
#show-lab:checked ~ .filters label[for="show-lab"] {
  border-color: var(--ink);
  color: var(--on-ink);
  background: var(--ink);
}

#sub-all:focus-visible ~ .filters label[for="sub-all"],
#sub-1:focus-visible ~ .filters label[for="sub-1"],
#sub-2:focus-visible ~ .filters label[for="sub-2"],
#show-all:focus-visible ~ .filters label[for="show-all"],
#show-course:focus-visible ~ .filters label[for="show-course"],
#show-seminar:focus-visible ~ .filters label[for="show-seminar"],
#show-lab:focus-visible ~ .filters label[for="show-lab"] {
  outline: 3px solid var(--link);
  outline-offset: 2px;
}

.board {
  padding: 1rem 1rem 1.25rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 0.75rem;
}

/* one narrow column for the hours, five equal columns for the days */
.week {
  display: grid;
  grid-template-columns: 3.25rem repeat(5, minmax(0, 1fr));
  gap: 0 0.5rem;
}

.hours,
.day ul {
  display: grid;
  grid-template-rows: repeat(9, var(--hour));
  margin: 0;
  padding: 0;
  list-style: none;
}

.hours {
  margin-top: 2.5rem; /* same height as the day names */
}

.hours li {
  position: relative;
  top: -0.6em;
  padding-right: 0.25rem;
  font-size: 0.8rem;
  line-height: 1.2;
  text-align: right;
  color: var(--muted);
}

.day h2 {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 2.5rem;
  margin: 0;
  font-size: 1.15rem;
}

/* thin line at the top of every hour */
.day ul {
  border-bottom: 1px solid var(--line);
  background-image: linear-gradient(to bottom, var(--line) 1px, transparent 1px);
  background-size: 100% var(--hour);
}

/* where a lesson starts and how long it is */
.from-10 {
  grid-row-start: 1;
}

.from-12 {
  grid-row-start: 3;
}

.from-14 {
  grid-row-start: 5;
}

.from-16 {
  grid-row-start: 7;
}

.from-17 {
  grid-row-start: 8;
}

.hours-2 {
  grid-row-end: span 2;
}

.hours-3 {
  grid-row-end: span 3;
}

.lesson {
  min-width: 0;
  padding: 2px 0 1px;
}

/* the whole block is one big link to the teacher's page */
.lesson a {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  height: 100%;
  padding: 0.45rem 0.6rem;
  overflow: hidden;
  border-left: 0.3rem solid var(--edge);
  border-radius: 0.4rem;
  font-size: 0.8rem;
  line-height: 1.25;
  color: var(--on-tone);
  text-decoration: none;
  background-color: var(--tone);
  /* several properties, each with its own duration and delay */
  transition: transform 0.15s ease-out,
              box-shadow 0.3s ease-out 0.05s,
              background-color 0.25s linear,
              color 0.25s linear;
}

.lesson a:hover,
.lesson a:focus-visible {
  transform: translateY(-3px);
  box-shadow: 0 0.5rem 1rem rgba(20, 33, 61, 0.25);
  color: var(--on-edge);
  background-color: var(--edge);
}

.lesson .row {
  display: flex;
  justify-content: space-between;
  gap: 0.4rem;
}

.lesson .kind {
  font-weight: 700;
}

.lesson .when {
  white-space: nowrap;
}

.lesson .subject {
  font-family: var(--display);
  font-size: 1.1rem;
  font-stretch: condensed;
  line-height: 1.1;
}

.lesson .note {
  align-self: flex-start;
  padding: 0 0.4rem;
  border: 1px solid currentColor;
  border-radius: 1rem;
  font-size: 0.72rem;
}

.lesson .foot {
  margin-top: auto;
}

.lesson .where {
  font-weight: 700;
  white-space: nowrap;
}

/* Filters: a lesson that does not match the chosen subgroup
   or the chosen kind of class is faded to an outline. */
#sub-1:checked ~ .board .sub-2 a,
#sub-2:checked ~ .board .sub-1 a,
#show-course:checked ~ .board .lesson:not(.is-course) a,
#show-seminar:checked ~ .board .lesson:not(.is-seminar) a,
#show-lab:checked ~ .board .lesson:not(.is-lab) a {
  border-left-color: var(--line);
  outline: 1px dashed var(--line);
  outline-offset: -1px;
  box-shadow: none;
  color: var(--faded);
  background-color: var(--surface);
}

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1.5rem;
  margin: 1.25rem 0 0;
  padding: 0;
  list-style: none;
}

.legend a {
  display: inline-block;
  padding: 0.5rem 0;
  color: var(--ink);
}

/* colour square in front of every subject name */
.legend a::before {
  content: "";
  display: inline-block;
  width: 0.9rem;
  height: 0.9rem;
  margin-right: 0.45rem;
  border: 1px solid var(--edge);
  border-radius: 0.2rem;
  vertical-align: -0.1em;
  background: var(--tone);
}


/* ---------- 5. Notes and faculty links ---------- */

.notes {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
}

.notes article {
  padding: 1.1rem 1.25rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 0.5rem;
}

.notes h3 {
  margin-bottom: 0.4rem;
  font-size: 1.2rem;
}

.notes p {
  margin: 0;
  color: var(--muted);
}

/* the list of links flows into two newspaper-style columns */
.link-columns {
  margin: 0;
  padding: 0;
  list-style: none;
  columns: 2 18rem;
  column-gap: 3rem;
}

.link-columns li {
  padding: 0.7rem 0;
  border-top: 1px solid var(--line);
  break-inside: avoid;
}

.link-columns a {
  font-weight: 600;
}

.link-columns span {
  display: block;
  color: var(--muted);
}


/* ---------- 6. Teachers directory ---------- */

.subjects {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(19rem, 1fr));
  gap: 1rem;
  margin-top: 2rem;
}

.subject-card {
  padding: 1.1rem 1.25rem 0.5rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-top: 0.45rem solid var(--edge);
  border-radius: 0.5rem;
}

.subject-card h2 {
  margin-bottom: 0.2rem;
  font-size: 1.5rem;
}

.subject-card .code {
  margin-bottom: 0.75rem;
  font-size: 0.9rem;
  color: var(--muted);
}

.people {
  margin: 0;
  padding: 0;
  list-style: none;
}

.people a {
  display: block;
  padding: 0.7rem 0;
  border-top: 1px solid var(--line);
  color: var(--ink);
  text-decoration: none;
}

.people strong {
  display: block;
  color: var(--link);
  text-decoration: underline;
}

.people a:hover strong {
  text-decoration-thickness: 2px;
}

.people span {
  font-size: 0.9rem;
  color: var(--muted);
}


/* the students list flows into up to three columns */
.students {
  margin: 2rem 0 0;
  padding: 1.25rem 1.5rem 1.25rem 3.5rem;
  columns: 3 15rem;
  column-gap: 4rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 0.75rem;
}

.students li {
  padding: 0.45rem 0 0.45rem 0.25rem;
  break-inside: avoid;
}

.students .family {
  font-weight: 600;
}

.students .badge {
  display: inline-block;
  margin-left: 0.4rem;
  padding: 0 0.6rem;
  border-radius: 1rem;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--on-ink);
  background: var(--ink);
}


/* ---------- 7. Teacher page ---------- */

.back {
  display: inline-block;
  margin-bottom: 1.5rem;
  padding: 0.5rem 0;
  font-weight: 600;
}

/* two columns: profile on the left, materials on the right */
.teacher {
  display: grid;
  grid-template-columns: 19rem minmax(0, 1fr);
  gap: 3rem;
  align-items: start;
}

.profile {
  position: sticky;
  top: 5.5rem;
  padding: 1.5rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-top: 0.45rem solid var(--edge);
  border-radius: 0.5rem;
}

/* Photo slot. The <object> shows photos/NAME.jpg when that file exists;
   when it does not, the browser shows what is inside it: the initials. */
.photo {
  display: block;
  width: 7rem;
  height: 7rem;
  margin: 0 0 1rem;
  overflow: hidden;
  border: 2px solid var(--edge);
  border-radius: 50%;
  object-fit: cover;
  object-position: 50% 25%; /* faces are usually in the upper part */
  background: var(--tone);
}

.monogram {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  font-family: var(--display);
  font-size: 2.2rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--on-tone);
}

.profile h1 {
  font-size: 2.2rem;
}

.profile .position {
  margin: 0.3rem 0 0;
  color: var(--muted);
}

.profile .subject-tag {
  display: inline-block;
  margin: 1rem 0;
  padding: 0.2rem 0.7rem;
  border-radius: 0.3rem;
  font-weight: 600;
  color: var(--on-tone);
  background: var(--tone);
}

.profile h2 {
  margin: 1.25rem 0 0.4rem;
  font-size: 1.15rem;
}

.profile address {
  font-style: normal;
  overflow-wrap: anywhere;
}

.profile address p {
  margin: 0 0 0.4rem;
}

.classes {
  margin: 0;
  padding: 0;
  list-style: none;
}

.classes li {
  padding: 0.5rem 0;
  border-top: 1px solid var(--line);
}

.classes li:nth-of-type(1) {
  border-top: 0;
}

.classes strong,
.classes span {
  display: block;
}

.classes span {
  color: var(--muted);
}

.materials section {
  margin-bottom: 2.5rem;
}

.materials .intro {
  max-width: 42rem;
  color: var(--muted);
}

.resources {
  margin: 0;
  padding: 0;
  list-style: none;
}

.resources li {
  padding: 0.7rem 0;
  border-top: 1px solid var(--line);
}

.resources a {
  font-weight: 600;
}

.resources span {
  display: block;
  color: var(--muted);
}

/* one PDF = one <details> box; the viewer loads only when it is opened */
.doc {
  margin-bottom: 0.5rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 0.5rem;
}

/* the summary has rounded corners too, so its hover background
   does not cover the rounded border of the box */
.doc summary {
  padding: 0.85rem 1rem;
  border-radius: 0.4rem;
  cursor: pointer;
}

.doc summary:hover {
  background: var(--paper);
}

.doc-title {
  font-weight: 600;
}

.doc-meta {
  margin-left: 0.5rem;
  font-size: 0.9rem;
  color: var(--muted);
}

.doc[open] {
  border-color: var(--ink);
}

.doc[open] summary {
  border-bottom: 1px solid var(--line);
  border-radius: 0.4rem 0.4rem 0 0;
}

.doc-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 1.25rem;
  margin: 0;
  padding: 0.75rem 1rem;
}

.button {
  display: inline-block;
  padding: 0.6rem 1.1rem;
  border-radius: 0.4rem;
  font-weight: 600;
  color: var(--on-ink);
  text-decoration: none;
  background: var(--ink);
}

.button:hover {
  background: var(--link);
}

.doc iframe {
  display: block;
  width: 100%;
  height: 75vh;
  border: 0;
  border-radius: 0 0 0.5rem 0.5rem;
}


/* ---------- 8. Footer ---------- */

.site-footer {
  padding: 1.5rem 4vw 2.5rem;
  border-top: 1px solid var(--line);
  font-size: 0.9rem;
  text-align: center;
  color: var(--muted);
}

.site-footer p {
  margin: 0 0 0.25rem;
}


/* ---------- 9. Animation ---------- */

/* lessons are "pinned" onto the board when the page opens:
   opacity and transform change together on the same element */
@keyframes pin {
  from {
    opacity: 0;
    transform: translateY(0.75rem) scale(0.95);
  }

  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.lesson {
  animation: pin 0.45s ease-out both;
}

/* one day after the other, Monday first */
.day:nth-of-type(2) .lesson {
  animation-delay: 0.07s;
}

.day:nth-of-type(3) .lesson {
  animation-delay: 0.14s;
}

.day:nth-of-type(4) .lesson {
  animation-delay: 0.21s;
}

.day:nth-of-type(5) .lesson {
  animation-delay: 0.28s;
}

/* people who switched animations off in their system get none */
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  .lesson {
    animation: none;
  }

  .lesson a {
    transition: none;
  }

  html.theme-changing *,
  html.theme-changing *::before,
  html.theme-changing *::after {
    transition: none !important;
  }

  html.theme-changing .theme-switch::before {
    animation: none;
  }
}


/* ---------- 10. Responsive rules ---------- */

/* tablets and phones: the grid becomes one list per day */
@media (max-width: 58rem) {
  .week {
    display: block;
  }

  .hours {
    display: none;
  }

  .day h2 {
    justify-content: flex-start;
    height: auto;
    margin: 1.25rem 0 0.5rem;
  }

  .day:nth-of-type(1) h2 {
    margin-top: 0;
  }

  .day ul {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    border-bottom: 0;
    background-image: none;
  }

  .lesson {
    padding: 0;
  }

  .lesson a {
    height: auto;
    padding: 0.7rem 0.8rem;
    font-size: 0.9rem;
  }

  .notes {
    grid-template-columns: 1fr;
  }

  .teacher {
    grid-template-columns: 1fr;
    gap: 2rem;
  }

  .profile {
    position: static;
  }
}

/* phones */
@media (max-width: 40rem) {
  .plate-text {
    display: none;
  }

  /* the menu drops under the logo when the screen is too narrow */
  .site-header {
    flex-wrap: wrap;
    gap: 0 0.5rem;
    padding: 0.5rem 3vw;
  }

  .plate-number {
    font-size: 1.3rem;
  }

  /* first row: logo and theme button; second row: the menu */
  .theme-switch {
    order: 2;
    min-height: 2.25rem;
    margin-left: auto;
    padding: 0.2rem 0.8rem;
  }

  .site-header nav {
    order: 3;
    width: 100%;
    margin-left: 0;
  }

  .menu {
    gap: 0;
  }

  .menu > li > a {
    padding: 0.65rem 0.45rem;
    font-size: 0.92rem;
  }

  /* no hover on phones: "Teachers" simply opens the directory page */
  .has-submenu:hover > .submenu,
  .has-submenu:focus-within > .submenu {
    display: none;
  }

  .has-submenu > a::after {
    content: "";
  }

  main {
    padding-top: 1.5rem;
  }

  .board {
    padding: 0.75rem;
  }

  .doc-meta {
    display: block;
    margin-left: 0;
  }

  .doc iframe {
    height: 60vh;
  }
}
