/*
 * The home page of a site whose plan says 'theme:': the sessions as white
 * cards on the paper of the theme. Colours and fonts come from base.css and
 * the theme (graphite.css).
 */

.home {
  margin: 0;
  color: var(--fg);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* The page: the sessions and, on their right, a column that stays in view
   when the page scrolls: the presentation of the course, the teachers, the
   logo of the university. */
.home-page {
  max-width: 1124px;
  margin: 0 auto;
  padding: 0 16px;
}

.home-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 280px;
  gap: 24px;
  align-items: start;
}

.home-sessions {
  grid-column: 1;
  grid-row: 1;
}

/* (top: set by the page when the column is taller than the window.) */
.home-aside {
  grid-column: 2;
  grid-row: 1;
  padding-top: 10px;         /* its first title at mid-height of the first tab */
  position: sticky;
  top: 16px;
}

/* The title of the page, at the top of the column once the one of the
   header has left the window (set by the page): it opens and closes. */
.home-aside-title {
  display: grid;
  grid-template-rows: 0fr;
  margin: 0;
  opacity: 0;
  font-family: var(--font-heading);
  font-size: 24px;
  font-weight: var(--heading-weight);
  letter-spacing: var(--heading-tracking);
  line-height: 1.1;
  color: var(--heading);
  text-wrap: balance;
  transition: grid-template-rows 0.2s, opacity 0.2s;
}

.home-aside-title.shown {
  grid-template-rows: 1fr;
  opacity: 1;
}

.home-aside-title > span {
  min-height: 0;
  overflow: hidden;
}

/* (The room under the title closes with it.) */
.home-aside-title > span::after {
  content: "";
  display: block;
  height: 28px;
}

.home-aside-title .home-mark {
  margin-left: 0;
}

/* In the column, no card: the text is on the paper, under a title in small
   capitals (as "Sommaire") that a thin line carries to the edge. */
.home-aside h2 {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 12px;
  font-family: var(--font-heading);
  font-size: 12.5px;
  font-weight: 600;
  line-height: 1.25;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.home-aside h2::after {
  content: "";
  flex: 1;
  height: 1px;
  background: #c9ccd1;       /* a little darker than the dots of the paper */
}

.home-aside > .home-about + .home-teachers {
  margin-top: 32px;
}

/* The logo of the university (static/images/), a link to its site. */
.home-logo {
  display: block;
  margin-top: 32px;          /* as between the course and the teachers */
  padding: 0 4px;
}

.home-logo img {
  display: block;
  width: 100%;
  height: auto;
}

.home-logo:hover img {
  opacity: 0.8;
}

.home-header {
  padding-top: 56px;
  padding-bottom: 36px;
}

/* (Room under it: the search button, on its right, is taller than it.) */
.home-kicker {
  margin: 0 0 22px;
  font-family: var(--font-heading);
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.home h1 {
  margin: 0;
  font-family: var(--font-heading);
  font-size: clamp(38px, 7vw, 72px);
  font-weight: var(--heading-weight);
  letter-spacing: var(--heading-tracking);
  line-height: 0.98;
  color: var(--heading);
  text-wrap: balance;
}

/* The mark left of the title: as tall as its capitals, crisp pixels. */
.home-mark {
  height: 0.9em;
  width: auto;
  margin: 0 0.12em 0 -0.12em;
  vertical-align: -0.12em;
  image-rendering: pixelated;
}

.home h1::after {
  content: "";
  display: block;
  width: 1.2em;
  height: 0.08em;
  margin-top: 0.3em;
  background: var(--accent);
}

/* -------------------------------------------------------------- sessions */

/* One session under the other, in the order of the plan. */
.home-sessions {
  display: grid;
  grid-template-columns: 1fr;
  gap: 22px;
  padding-bottom: 64px;
}

.home-sessions:has(> .home-lemur) {
  position: relative;
  isolation: isolate;
}

.home-lemur {
  position: absolute;
  top: 0;
  left: 0;
  z-index: 2;
  width: 86px;
  aspect-ratio: 1;
  overflow: hidden;
  pointer-events: none;
}

/* Each image is a horizontal strip of square cells, one sprite-width apart. */
.home-lemur img {
  display: none;
  position: absolute;
  top: 0;
  left: calc(var(--lemur-frame, 0) * -100%);
  width: auto;
  height: 100%;
  max-width: none;
  image-rendering: pixelated;
}

.home-lemur[data-pose="climb"] [data-sheet="climb"],
.home-lemur[data-pose="leap"] [data-sheet="leap"],
.home-lemur[data-pose="rise"] [data-sheet="rise"],
.home-lemur[data-pose="look"] [data-sheet="look"],
.home-lemur[data-pose="burrow"] [data-sheet="burrow"] {
  display: block;
}

@media print, (prefers-reduced-motion: reduce) {
  .home-lemur:not([hidden]) {
    display: none;
  }
}

/* -------------------------------------------------------------- teachers */

/* The presentation of the course, above the teachers. */
.home-about p {
  margin: 0 0 10px;
  font-size: 14.5px;
  line-height: 1.55;
  color: var(--fg);
}

.home-about > :last-child {
  margin-bottom: 0;
}

.home-about strong {
  font-weight: 650;
  color: var(--heading);
}

.home-about code {
  padding: 0.06em 0.3em;
  border-radius: 4px;
  background: var(--inline-code-bg);
  font-family: var(--font-mono);
  font-size: 0.86em;
}

.home-teachers ul {
  margin: 0;
  padding: 0;
  list-style: none;
}

.home-teachers li {
  padding: 4px 0;
  color: var(--heading);
}

/* No violet: the text colour, underlined on hover. */
.home-teachers a {
  color: var(--heading);
  text-decoration: none;
  text-underline-offset: 0.18em;
}

.home-teachers a:hover {
  text-decoration: underline;
  text-decoration-thickness: 1px;
}

/* A session is a card: its title is a dark tab on its top-left corner, as
   the tab of the exercise shown on a TD. */
.home-session {
  position: relative;
  margin-top: 36px;
  padding: 12px 22px 12px;
  background: #ffffff;
  border: 1px solid var(--rule);
  border-radius: 0 10px 10px 10px;
}

.home-session h2 {
  position: absolute;
  bottom: 100%;
  left: -1px;
  margin: 0;
  padding: 8px 18px 7px;
  border-radius: 8px 8px 0 0;
  background: var(--accent);
  font-family: var(--font-heading);
  font-size: 17px;
  font-weight: 600;
  line-height: 1.25;
  letter-spacing: -0.01em;
  color: #ffffff;
  white-space: nowrap;
}

.home-session ul {
  margin: 0;
  padding: 0;
  list-style: none;
}

/* The tag in a column of its own: the titles line up, with or without one. */
.home-session a {
  display: grid;
  grid-template-columns: 78px 1fr;
  column-gap: 12px;
  align-items: baseline;
  padding: 6px 0;
  color: var(--fg);
  text-decoration: none;
}

/* Here every line is a link: in the colour of the text (the violet is for
   the links inside the pages), underlined on hover. */
.home-text {
  grid-column: 2;
  color: var(--heading);
  text-underline-offset: 0.18em;
}

.home-session a:hover .home-text {
  text-decoration: underline;
  text-decoration-thickness: 1px;
}

/* Cours, TD, EXAM: the tags of base.css (.home-label). */

/* On the link under the pointer, the tag fills with its colour. */
.home-session a:hover .home-label,
.home-session a:focus-visible .home-label {
  background: var(--tag);
  color: #ffffff;
}

@media (max-width: 720px) {
  .home-header {
    padding-top: 32px;
    padding-bottom: 24px;
  }

  /* On a phone: the teachers and the logo above the sessions, not floating. */
  .home-layout {
    grid-template-columns: minmax(0, 1fr);
  }

  .home-aside {
    grid-column: 1;
    grid-row: 1;
    position: static;
  }

  .home-aside-title {
    display: none;
  }

  .home-sessions {
    grid-row: 2;
  }

  .home-logo {
    max-width: 220px;
  }
}
