/* /u/<username>/<YYYY-MM> month summary page (docs/056-057) -- the web
   twin of the app's month summary page, in the site's own light/dark
   tokens (style.css). The header scene is laid out in 360-wide reference
   units: --u = 1/360 of the page's width, so the scene, text included,
   scales as a whole like in the app (docs/056 decision 18).
   style.css gives every <section> the homepage's 64px padding; like the
   other SSR pages, each section here sets its own. */

.ms-page {
  max-width: 720px;
  margin: 0 auto;
  container-type: inline-size;
}

/* ---- Header scene ---- */
.ms-scene {
  --u: calc(100cqw / 360);
  position: relative;
  width: 100%;
  margin-bottom: 0;
  padding: 0;
}
.ms-background,
.ms-foreground {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  object-fit: cover;
  pointer-events: none;
}
.ms-background { z-index: 0; }
.ms-foreground { z-index: 200; }
.ms-fade {
  position: absolute;
  left: 0;
  right: 0;
  pointer-events: none;
}
.ms-fade-top { top: 0; z-index: 1; background: linear-gradient(to bottom, var(--bg), transparent); }
.ms-fade-bottom { z-index: 210; background: linear-gradient(to bottom, transparent, var(--bg)); }
.ms-under { position: absolute; left: 0; right: 0; z-index: 210; background: var(--bg); }
.ms-cover {
  position: absolute;
  overflow: hidden;
  border-radius: calc(var(--u) * 8);
  background: var(--surface);
  box-shadow: 0 calc(var(--u) * 6) calc(var(--u) * 12) rgba(0, 0, 0, 0.54);
}
.ms-cover img { width: 100%; height: 100%; object-fit: cover; display: block; }

.ms-head {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 300;
  padding: calc(var(--u) * 12) calc(var(--u) * 16) 0;
  text-align: center;
}
/* A soft halo of the page colour under every header text: dark text on a
   dark corner of the picture (light theme) or the other way round. */
.ms-title,
.ms-subtitle,
.ms-arrow {
  text-shadow: 0 0 calc(var(--u) * 6) var(--bg), 0 0 calc(var(--u) * 14) var(--bg);
}
.ms-arrow .ms-icon { filter: drop-shadow(0 0 calc(var(--u) * 4) var(--bg)); }
.ms-title {
  margin: 0;
  font-family: 'Playfair Display', Georgia, serif;
  font-weight: 700;
  font-size: calc(var(--u) * 24);
  line-height: 1.2;
  color: var(--text-primary);
}
.ms-month-row {
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: calc(var(--u) * 6);
}
.ms-arrow {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: calc(var(--u) * 40);
  height: calc(var(--u) * 40);
  color: var(--text-primary);
}
.ms-arrow .ms-icon { width: calc(var(--u) * 24); height: calc(var(--u) * 24); fill: currentColor; }
.ms-arrow.is-disabled { opacity: 0.38; }
.ms-month {
  display: inline-flex;
  align-items: center;
  gap: calc(var(--u) * 8);
  padding: calc(var(--u) * 4) calc(var(--u) * 14);
  border: calc(var(--u) * 1) solid color-mix(in srgb, var(--primary) 60%, transparent);
  border-radius: calc(var(--u) * 24);
  background: color-mix(in srgb, var(--bg) 75%, transparent);
  font-size: calc(var(--u) * 14);
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
}
.ms-month .ms-icon { width: calc(var(--u) * 16); height: calc(var(--u) * 16); fill: var(--primary); }
.ms-subtitle {
  margin: calc(var(--u) * 4) 0 0;
  font-size: calc(var(--u) * 14);
  font-weight: 500;
  color: var(--text-primary);
}
.ms-share {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: calc(var(--u) * 24);
  height: calc(var(--u) * 24);
  margin-left: calc(var(--u) * -4);
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  cursor: pointer;
}
.ms-share .ms-icon { width: calc(var(--u) * 16); height: calc(var(--u) * 16); }
.ms-share.is-copied { background: color-mix(in srgb, var(--primary) 25%, transparent); }

/* ---- Sections under the scene ---- */
.ms-sections { padding: 0 16px 48px; position: relative; z-index: 400; }
.ms-icon { width: 18px; height: 18px; fill: var(--primary); flex: none; }
.ms-link { color: var(--primary); font-weight: 600; text-decoration: none; }

.ms-stats { display: flex; gap: 6px; padding: 0; }
.ms-tile {
  flex: 1 1 0;
  min-width: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 10px 3px;
  border-radius: 16px;
  border: 1px solid var(--border);
  background: var(--surface);
  text-align: center;
}
.ms-tile .ms-icon { width: 20px; height: 20px; }
.ms-tile strong {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: clamp(14px, 5.5cqw, 26px);
  margin-top: 4px;
}
.ms-tile span { font-size: clamp(8px, 2.9cqw, 12px); line-height: 1.2; color: var(--text-primary); }

.ms-featured {
  display: flex;
  gap: 8px;
  margin-top: 20px;
  padding: 12px;
  border-radius: 20px;
  border: 1.2px solid color-mix(in srgb, var(--primary) 70%, transparent);
  background: var(--surface);
  box-shadow: 0 0 24px color-mix(in srgb, var(--primary) 15%, transparent);
}
.ms-featured-book { flex: 7 1 0; min-width: 0; display: flex; flex-direction: column; gap: 8px; }
.ms-featured-label {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 18px;
  font-weight: 500;
  color: var(--primary);
}
.ms-featured-label .ms-icon { width: 20px; height: 20px; }
.ms-featured-row { display: flex; gap: 8px; align-items: flex-start; }
.ms-featured-cover { width: 64px; height: 96px; }
.ms-featured-info { min-width: 0; }
.ms-featured-info h3 {
  margin: 0;
  font-size: 14px;
  font-weight: 700;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.ms-book-author { margin: 2px 0 0; font-size: 11px; color: var(--text-secondary); }
.ms-quote { margin: 0; font-size: 11px; font-style: italic; }
.ms-activity {
  flex: 5 1 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
  padding: 8px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: var(--bg);
}
.ms-activity h3 {
  margin: 0 0 4px;
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 14px;
  font-weight: 500;
  color: var(--primary);
}
.ms-activity ul { list-style: none; margin: 0; padding: 0; }
.ms-activity li { display: flex; align-items: center; gap: 6px; padding: 2px 0; font-size: 11px; }
.ms-activity li .ms-icon { width: 14px; height: 14px; }
.ms-discussion { display: inline-flex; align-items: center; gap: 4px; margin-top: auto; padding-top: 6px; font-size: 12px; }
.ms-discussion .ms-icon { width: 14px; height: 14px; }

.ms-featured-cover,
.ms-card-cover {
  flex: none;
  overflow: hidden;
  border-radius: 8px;
  background: var(--border);
  box-shadow: 0 0 12px rgba(0, 0, 0, 0.4);
}
.ms-featured-cover img,
.ms-card-cover img { width: 100%; height: 100%; object-fit: cover; display: block; }

.ms-stars { position: relative; display: inline-block; font-size: 13px; letter-spacing: 1px; color: color-mix(in srgb, var(--text-secondary) 40%, transparent); }
.ms-stars-on { position: absolute; left: 0; top: 0; overflow: hidden; white-space: nowrap; color: var(--primary); }

.ms-avatars { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text-secondary); }
.ms-avatar-row { display: inline-flex; padding-left: 7px; }
.ms-avatar-row img,
.ms-avatar-none {
  width: 22px;
  height: 22px;
  margin-left: -7px;
  border-radius: 50%;
  border: 2px solid var(--surface);
  object-fit: cover;
  background: var(--primary-container);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.ms-avatar-none .ms-icon { width: 14px; height: 14px; }

.ms-books { padding: 0; }
.ms-books h2 {
  margin: 24px 0 10px;
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 22px;
}
.ms-book-row { display: flex; gap: 10px; overflow-x: auto; padding-bottom: 6px; }
.ms-card {
  flex: none;
  width: 115px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 8px;
  border-radius: 16px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-primary);
  text-decoration: none;
}
.ms-card-cover { width: 76px; height: 114px; margin: 0 auto 6px; }
.ms-card-title {
  font-size: 12.5px;
  font-weight: 600;
  line-height: 1.25;
  min-height: 2.5em; /* always two lines, so authors line up */
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.ms-card-bottom { margin-top: auto; padding-top: 6px; display: flex; flex-direction: column; gap: 6px; }
.ms-card-metrics { display: flex; gap: 8px; font-size: 11px; }
.ms-card-metrics span { display: inline-flex; align-items: center; gap: 3px; }
.ms-card-metrics .ms-icon { width: 12px; height: 12px; }

.ms-cta {
  display: flex;
  gap: 16px;
  align-items: center;
  margin-top: 24px;
  padding: 16px;
  border-radius: 20px;
  border: 1px solid color-mix(in srgb, var(--primary) 50%, transparent);
  background: var(--surface);
}
.ms-cta-icon { width: 40px; height: 40px; fill: var(--primary); flex: none; }
.ms-cta h2 { margin: 0; font-family: 'Playfair Display', Georgia, serif; font-size: 22px; }
.ms-cta p { margin: 4px 0 12px; font-size: 13px; color: var(--text-secondary); }

/* Wider than a phone: the book of the month gets the app's wide sizes. */
@container (min-width: 560px) {
  .ms-featured { gap: 16px; padding: 16px; }
  .ms-featured-label { font-size: 22px; }
  .ms-featured-cover { width: 120px; height: 180px; }
  .ms-featured-row { gap: 16px; }
  .ms-featured-info h3 { font-size: 20px; }
  .ms-book-author, .ms-quote { font-size: 13px; }
  .ms-stars { font-size: 18px; }
  .ms-activity { padding: 12px; }
  .ms-activity h3 { font-size: 17px; }
  .ms-activity li { font-size: 13px; padding: 4px 0; }
}
