/* Shared styles for every page of the site.
   Each series sets its own colour with --accent, on its <body> tag and on its
   entry in the home page list. Use a dark colour: white text sits on it. */

@font-face {
  font-family: "Figtree";
  src: url("fonts/figtree.woff2") format("woff2");
  font-weight: 300 900;
  font-style: normal;
  font-display: swap;
}

:root {
  --accent: #15803d;
  --ink: #14161a;
  --muted: #5a606b;
  --line: #e4e6ea;
  --tint: #f4f5f7;
  --page: #ffffff;

  --sans: "Figtree", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;

  --width: 68rem;
  --gutter: clamp(1.25rem, 5vw, 3rem);
}

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

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--page);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 1.125rem;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

a {
  color: inherit;
}

a:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 3px;
  border-radius: 4px;
}

/* Page header: plain on the home page, the series colour on a series page */

.cover {
  background: var(--accent);
  color: #fff;
}

.cover a:focus-visible {
  outline-color: #fff;
}

.cover-inner {
  max-width: var(--width);
  margin: 0 auto;
  padding: clamp(1.5rem, 4vw, 2.25rem) var(--gutter) clamp(2.5rem, 7vw, 4.5rem);
}

.cover h1 {
  margin: 0;
  font-size: clamp(3rem, 11vw, 6.5rem);
  font-weight: 800;
  line-height: 1;
  letter-spacing: -0.035em;
}

.cover p {
  max-width: 38em;
  margin: 1.25rem 0 0;
  font-size: clamp(1.125rem, 2.2vw, 1.3125rem);
  line-height: 1.45;
  text-wrap: pretty;
}

.cover .back {
  margin: 0 0 clamp(2.5rem, 7vw, 4.5rem);
  font-size: 1rem;
  font-weight: 600;
}

.cover .back a {
  text-decoration: none;
}

.cover .back a:hover {
  text-decoration: underline;
}

.cover-home {
  background: none;
  color: var(--ink);
}

.cover-home .cover-inner {
  padding-top: clamp(3rem, 9vw, 6rem);
  padding-bottom: clamp(2rem, 5vw, 3rem);
}

.cover-home p {
  color: var(--muted);
}

/* Page body */

main {
  max-width: var(--width);
  margin: 0 auto;
  padding: 0 var(--gutter) 5rem;
}

.series-list,
.lessons {
  margin: 0;
  padding: 0;
  list-style: none;
}

/* Series tiles on the home page. The whole tile is the link. */

.series-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 22rem), 1fr));
  gap: 1.25rem;
}

.series {
  position: relative;
  display: flex;
  flex-direction: column;
  padding: 1.75rem;
  border-radius: 1.25rem;
  background: var(--accent);
  color: #fff;
  transition: transform 0.15s ease;
}

.series:hover {
  transform: translateY(-3px);
}

.series:focus-within {
  outline: 3px solid var(--accent);
  outline-offset: 3px;
}

.series h2 {
  order: 2;
  margin: 4.5rem 0 0;
  font-size: clamp(2.75rem, 6vw, 3.75rem);
  font-weight: 800;
  line-height: 1.05;
  letter-spacing: -0.03em;
}

.series h2 a {
  text-decoration: none;
}

.series h2 a::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
}

.series h2 a:focus-visible {
  outline: none;
}

.series p {
  margin: 0;
}

.series .facts {
  order: 1;
  font-weight: 600;
}

.series .summary {
  order: 3;
  margin-top: 0.75rem;
  line-height: 1.45;
}

/* Lessons on a series page */

.lesson {
  display: grid;
  grid-template-columns: 4.5rem minmax(0, 1fr) auto;
  column-gap: 1.5rem;
  align-items: start;
  padding: 2rem 0;
  border-bottom: 1px solid var(--line);
}

.lesson:last-child {
  border-bottom: 0;
}

.lesson-number {
  color: var(--accent);
  font-size: 2.75rem;
  font-weight: 800;
  line-height: 1;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
}

/* Lets the document links sit in the third column of the lesson's grid. */
.lesson-body {
  display: contents;
}

.lesson-text {
  max-width: 38em;
}

.lesson h2 {
  margin: 0;
  font-size: 1.5rem;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.015em;
}

.lesson .passage {
  margin: 0.3rem 0 0;
  color: var(--accent);
  font-size: 1rem;
  font-weight: 600;
}

.lesson .aim {
  margin: 0.6rem 0 0;
  color: var(--muted);
}

.documents {
  display: grid;
  gap: 0.5rem;
  width: 15rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.documents a {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
  padding: 0.6rem 0.9rem;
  border-radius: 0.6rem;
  background: var(--tint);
  font-weight: 600;
  text-decoration: none;
  transition: background-color 0.15s ease, color 0.15s ease;
}

.documents a:hover {
  background: var(--accent);
  color: #fff;
}

.documents small {
  font-size: 0.875rem;
  font-weight: 400;
  white-space: nowrap;
}

@media (max-width: 52rem) {
  .lesson {
    grid-template-columns: 3.25rem minmax(0, 1fr);
    column-gap: 0.75rem;
  }

  .lesson-number {
    font-size: 2rem;
  }

  .documents {
    grid-column: 2;
    width: 100%;
    max-width: 24rem;
    margin-top: 1rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .series,
  .documents a {
    transition: none;
  }

  .series:hover {
    transform: none;
  }
}

@media print {
  .cover {
    background: none;
    color: inherit;
  }

  .back,
  .documents {
    display: none;
  }

  .lesson {
    break-inside: avoid;
  }
}
