/*
 * Card layout for the week pages and the course overview.
 * Markup comes from _includes/cards-week.html and _includes/cards-overview.html.
 * To undo: remove the includes from _layouts/post.html and this file's <link> in head.html.
 */

/* Light grey ground behind the cards, so the white cards read as separate objects. */
.section--last:has(.cards) {
  background-color: #ececea;
}

.cards {
  --card-strip: #1b1b1b;
  --card-strip-ink: #f2f2f0;
  --card-ink: rgba(0, 0, 0, 0.82);
  --card-muted: #6b6b69;
  display: grid;
  gap: 20px;
  padding-block: 8px 24px;
}

/* ---- Intro above the cards ---- */

.cards-intro > :first-child { margin-top: 0; }

/* Overview prose is written as ###### headings; set it as regular-weight reading text. */
.cards--overview .cards-intro h6 {
  font-weight: 400;
  font-size: 17px;
  line-height: 1.65;
  letter-spacing: 0;
  margin-top: 1.1em;
  max-width: 68ch;
}

/* An image on its own line in the intro (the banner above Week 1): same strip as the section headers, no title. */
.cards-intro p:has(> img:only-child) {
  position: relative;
  height: 240px;
  margin: 16px 0 0;
  overflow: hidden;
  background: #1b1b1b;
}
.cards-intro p:has(> img:only-child) img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* #### section headers between groups of weeks on the overview */
.cards-label h4 { margin: 12px 0 0; }
.cards-label p { margin: 0; }

/* With an image under the heading: a banner strip, title laid over the image in full color. */
.cards-label:has(img) {
  position: relative;
  display: flex;
  align-items: flex-end;
  min-height: 240px;
  margin-top: 16px;
  overflow: hidden;
  background: #1b1b1b;
}
.cards-label:has(img) img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
/* Only a soft shade along the bottom edge, so the white title stays readable. */
/* TA Guest Lectures (week11a.jpg): cropped so both faces show. */
.cards-label img.banner-faces { object-position: 50% 28%; }

.cards-label:has(img)::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.55), rgba(0, 0, 0, 0) 45%);
}
.cards-label:has(img) h4 {
  position: relative;
  z-index: 1;
  margin: 0;
  padding: 18px 22px;
  font-family: "Roboto", "Helvetica Neue", Arial, sans-serif;
  font-weight: 300;
  font-size: 30px;
  line-height: 1.15;
  letter-spacing: 0;
  color: #f2f2f0;
}

/* ---- Cards ---- */

.card {
  background: #fff;
  color: var(--card-ink);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08), 0 6px 18px rgba(0, 0, 0, 0.05);
}

.card-strip {
  background: var(--card-strip);
  color: var(--card-strip-ink);
  padding: 15px 22px 13px;
}
.card-strip h5,
.card-strip h6 {
  margin: 0;
  font-family: "Roboto", "Helvetica Neue", Arial, sans-serif;
  font-weight: 300;
  font-size: 20px;
  line-height: 1.3;
  letter-spacing: 0;
  color: inherit;
  text-wrap: balance;
}
.card-strip strong { font-weight: 400; }

.card-body {
  padding: 16px 22px 18px;
}
.card-body > :first-child { margin-top: 0; }
.card-body > :last-child { margin-bottom: 0; }
.card-body ul {
  margin: 0;
  padding-left: 1.15em;
}
.card-body li,
.card-body p {
  font-size: 16px;
  line-height: 1.6;
}
.card-body li + li { margin-top: 4px; }
.card-body a { color: inherit; }

/* Days with no readings (e.g. "NO CLASS") are just the strip, a touch lighter. */
.card--stripOnly .card-strip { background: #3a3a38; }

/* ---- Week pages: one card, one row per day ---- */

.weekCard .card-strip h5 { font-size: 22px; }

.weekCard-day {
  display: grid;
  grid-template-columns: 9.5em 1fr;
  border-top: 1px solid #e3e3e0;
}
.weekCard-day:first-child { border-top: 0; }

/* Shaded date cell */
.weekCard-date {
  background: #f3f3f1;
  padding: 16px 18px;
  display: grid;
  align-content: start;
  gap: 2px;
  font-family: "Roboto", "Helvetica Neue", Arial, sans-serif;
}
.weekCard-dayName {
  font-size: 12px;
  font-weight: 400;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--card-muted);
}
.weekCard-dayDate {
  font-size: 22px;
  font-weight: 300;
  line-height: 1.2;
  color: #111;
  font-variant-numeric: tabular-nums;
}

/* Content cell */
.weekCard-content {
  padding: 15px 22px 17px;
  display: grid;
  gap: 8px;
  align-content: start;
}
.weekCard-content > * { margin: 0; }
.weekCard-title {
  font-size: 17px;
  line-height: 1.4;
  font-weight: 700;
  letter-spacing: 0;
  color: #111;
}
.weekCard-content ul { margin: 0; padding-left: 1.15em; }
.weekCard-content li,
.weekCard-content p { font-size: 16px; line-height: 1.6; }
.weekCard-content li + li { margin-top: 4px; }
.weekCard-content a { color: inherit; }

/* Days with nothing under them (NO CLASS, cancelled): muted row */
.weekCard-day--quiet .weekCard-date { background: #e9e9e6; }
.weekCard-day--quiet .weekCard-content { background: #fafaf8; align-content: center; }
.weekCard-day--quiet .weekCard-title { font-weight: 400; color: var(--card-muted); }
.weekCard-day--quiet .weekCard-title strong { font-weight: 400; }

/* Narrow screens: date cell sits above the content */
@media (max-width: 560px) {
  .weekCard-day { grid-template-columns: 1fr; }
  .weekCard-date { display: flex; gap: 8px; align-items: baseline; padding: 10px 18px; }
  .weekCard-dayDate { font-size: 16px; }
}

/* ---- Overview: week cards stack in a single column at every width ---- */

.cards-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 20px;
}
.cards-grid:empty { display: none; }
