@font-face { font-family: "Bitter"; src: url("/assets/fonts/bitter.woff2") format("woff2-variations"); font-weight: 100 900; font-display: swap; }
@font-face { font-family: "Source Serif 4"; src: url("/assets/fonts/source-serif-4.woff2") format("woff2-variations"); font-weight: 200 900; font-display: swap; }
@font-face { font-family: "Source Serif 4"; src: url("/assets/fonts/source-serif-4-italic.woff2") format("woff2-variations"); font-weight: 200 900; font-style: italic; font-display: swap; }

/* Colours --ink, --accent and --wash are set per group from group.yaml */
:root {
  --paper: #ffffff;
  --text: #24233a;
  --text-soft: #55546b;
  --rule: #dcd9e6;
  --wide: 62rem;
  --measure: 36rem;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--text);
  font-family: "Source Serif 4", Georgia, serif;
  font-optical-sizing: auto;
  font-size: 1.1875rem;
  line-height: 1.65;
}
img { max-width: 100%; height: auto; display: block; }
a { color: var(--ink); text-underline-offset: 0.18em; }
a:hover { color: var(--accent); }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }
h1, h2, h3 { font-family: "Bitter", Georgia, serif; color: var(--ink); line-height: 1.2; }

.skip { position: absolute; left: 1rem; top: -4rem; background: var(--paper); padding: 0.5rem 0.75rem; z-index: 3; }
.skip:focus { top: 1rem; }

.preview-bar {
  background: var(--ink); color: #fff; text-align: center;
  font-size: 0.875rem; padding: 0.4rem 1rem;
}

/* Masthead */
.masthead {
  max-width: var(--wide); margin: 0 auto;
  padding: 1rem 1rem 0.5rem;
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.5rem 2rem;
}
.masthead__logo img { width: clamp(120px, 18vw, 160px); }
.masthead__nav ul { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 0.25rem 1.5rem; }
.masthead__nav a {
  font-family: "Bitter", Georgia, serif; font-weight: 500; font-size: 1.0625rem;
  text-decoration: none; color: var(--ink); padding: 0.25rem 0; border-bottom: 2px solid transparent;
}
.masthead__nav a:hover { border-bottom-color: var(--accent); color: var(--ink); }

/* Welcome */
.welcome { max-width: var(--wide); margin: 0 auto; padding: clamp(2rem, 6vw, 4rem) 1rem clamp(2.5rem, 6vw, 4rem); }
.welcome__heading { margin: 0 0 1.25rem; font-size: clamp(2.25rem, 6vw, 3.5rem); font-weight: 600; max-width: 18ch; }
.welcome__intro { margin: 0; max-width: var(--measure); font-size: clamp(1.25rem, 2.4vw, 1.4375rem); line-height: 1.55; }

/* Book shelf */
.shelf { background: var(--wash); padding: clamp(2.5rem, 6vw, 4.5rem) 1rem; }
.shelf__inner, .members-books { max-width: var(--wide); margin: 0 auto; }
.section-heading { margin: 0 0 2rem; font-size: 1.75rem; font-weight: 600; }

.book {
  display: grid; grid-template-columns: minmax(9rem, 15rem) 1fr; gap: clamp(1.5rem, 4vw, 3rem);
  align-items: start; padding: 0 0 clamp(2.5rem, 5vw, 3.5rem);
}
.book + .book { border-top: 1px solid var(--rule); padding-top: clamp(2.5rem, 5vw, 3.5rem); }
.book__cover img, .book__cover-empty {
  width: 100%;
  border-radius: 2px 4px 4px 2px;
  box-shadow: 0 1px 2px rgba(20, 18, 50, 0.25), 0 10px 24px -8px rgba(20, 18, 50, 0.35);
}
/* the hinge of a paperback, catching the light */
.book__cover { position: relative; }
.book__cover:not(:has(.book__cover-empty))::after {
  content: ""; position: absolute; inset: 0 auto 0 0; width: 7%;
  background: linear-gradient(90deg, rgba(0,0,0,0.12), rgba(255,255,255,0.18) 40%, rgba(0,0,0,0.04));
  border-radius: 2px 0 0 2px; pointer-events: none;
}
.book__title { margin: 0 0 0.75rem; font-size: clamp(1.5rem, 3vw, 1.875rem); font-weight: 600; }
.book__subtitle { display: block; font-size: 0.6em; font-weight: 400; color: var(--text-soft); margin-top: 0.3rem; }
.book__author { margin: -0.5rem 0 0.75rem; color: var(--text-soft); }
.book__lead { font-size: 1.25rem; font-style: italic; }
.book__text p { margin: 0 0 0.9rem; max-width: var(--measure); }
.book__meta { color: var(--text-soft); font-size: 1rem; }
.book__buy { list-style: none; margin: 1.5rem 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 0.75rem; }

.button {
  display: inline-block; font-family: "Bitter", Georgia, serif; font-weight: 600; font-size: 1rem;
  padding: 0.7rem 1.2rem; border-radius: 4px; text-decoration: none;
  border: 2px solid var(--ink); color: var(--ink); background: transparent;
}
.button:hover { border-color: var(--accent); color: var(--accent); }
.button--primary { background: var(--ink); color: #fff; }
.button--primary:hover { background: var(--accent); border-color: var(--accent); color: #fff; }

/* A book the group still has to supply details for (preview only) */
.book__cover-empty {
  display: grid; place-items: center;
  border: 2px dashed var(--rule); box-shadow: none; background: rgba(255,255,255,0.6);
  color: var(--text-soft); font-size: 0.9375rem;
}
.book--placeholder .book__title { color: var(--text-soft); }
.book__note { color: var(--text-soft); font-style: italic; }
/* Text written for the group that they have not yet signed off (preview only) */
.book__draft { border-left: 4px solid var(--accent); padding: 0.25rem 0 0.25rem 1.25rem; margin: 0 0 1rem; }
.book__draft-label {
  display: inline-block; margin: 0 0 0.75rem !important;
  font-family: "Bitter", Georgia, serif; font-size: 0.875rem; font-weight: 600;
  color: var(--accent); background: #fff; border: 1px solid var(--accent); border-radius: 3px; padding: 0.15rem 0.5rem;
}

/* Charity */
.charity { max-width: var(--wide); margin: 0 auto; padding: 2rem 1rem; border-bottom: 1px solid var(--rule); }
.charity p { margin: 0; max-width: 44rem; }

.members-books { padding: clamp(2.5rem, 6vw, 4rem) 1rem 1rem; }

/* Footer */
.footer { background: var(--ink); color: #fff; margin-top: 3rem; }
.footer__inner { max-width: var(--wide); margin: 0 auto; padding: 2.5rem 1rem; }
.footer a { color: #fff; }
.footer a:hover { color: #ffd9df; }
.footer__invite { margin: 0 0 1rem; font-size: 1.25rem; }
.footer__social { list-style: none; margin: 0 0 1.5rem; padding: 0; display: flex; gap: 1.5rem; }
.footer__small { margin: 0; font-size: 0.9375rem; opacity: 0.8; }
.footer :focus-visible { outline-color: #fff; }

@media (max-width: 40rem) {
  .book { grid-template-columns: 1fr; }
  .book__cover { max-width: 13rem; }
  .masthead { justify-content: center; text-align: center; }
  .masthead__nav ul { justify-content: center; }
}

/* Current page in the menu */
.masthead__nav a[aria-current="page"] { border-bottom-color: var(--accent); }

/* Inner pages */
.page-head { max-width: var(--wide); margin: 0 auto; padding: clamp(2rem, 5vw, 3.5rem) 1rem clamp(1.5rem, 4vw, 2.5rem); }
.page-head__title { margin: 0 0 1rem; font-size: clamp(2.25rem, 6vw, 3.25rem); font-weight: 600; }
.page-head__intro { margin: 0; max-width: var(--measure); color: var(--text-soft); }

.prose { max-width: var(--wide); margin: 0 auto; padding: 0 1rem 2.5rem; }
.prose p { max-width: var(--measure); margin: 0 0 1.1rem; }
.prose__lead { font-size: clamp(1.25rem, 2.4vw, 1.4375rem); line-height: 1.55; }
.prose__links { list-style: none; padding: 0; margin: 2rem 0 0; display: flex; flex-wrap: wrap; gap: 0.75rem; }
.section-heading--small { font-size: 1.375rem; margin: 2.5rem 0 0.75rem; }
.contact__email { font-size: 1.375rem; }
.contact__social { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 1.5rem; }

/* Book contents and forewords (books page) */
.book__subhead { font-family: "Bitter", Georgia, serif; color: var(--ink); font-size: 1.125rem; font-weight: 600; margin: 2rem 0 0.5rem; }
.book__contents { margin: 0; padding-left: 1.6rem; max-width: var(--measure); }
.book__contents li { margin: 0 0 0.25rem; }
.book__story { font-style: italic; }
.book__story-author { color: var(--text-soft); }
.book__story-author::before { content: "by "; }
.book__contributors { max-width: var(--measure); }
.book__more { margin-top: 1rem; font-size: 1rem; }
.book__foreword { margin-top: 1.5rem; max-width: var(--measure); border-top: 1px solid var(--rule); padding-top: 1rem; }
.book__foreword summary {
  cursor: pointer; font-family: "Bitter", Georgia, serif; font-weight: 600; color: var(--ink);
  list-style-position: outside;
}
.book__foreword summary:hover { color: var(--accent); }
.book__foreword[open] summary { margin-bottom: 1rem; }
.book__foreword p { font-size: 1.0625rem; }

/* Writers */
.writers { max-width: var(--wide); margin: 0 auto; padding: 0 1rem 2rem; }
.writers__list { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 26rem), 1fr)); gap: 2.5rem 3rem; }
.writer { display: grid; grid-template-columns: 7.5rem 1fr; gap: 1.25rem; align-items: start; }
.writer__photo { width: 7.5rem; height: 7.5rem; border-radius: 50%; object-fit: cover; }
.writer__photo--empty {
  display: grid; place-items: center; background: var(--wash); border: 2px dashed var(--rule);
  font-family: "Bitter", Georgia, serif; font-size: 2.5rem; color: var(--text-soft);
}
.writer__name { margin: 0.25rem 0 0.5rem; font-size: 1.375rem; font-weight: 600; }
.writer__text p { margin: 0 0 0.75rem; font-size: 1.0625rem; }
.writer__books { list-style: none; margin: 0; padding: 0.75rem 0 0; border-top: 1px solid var(--rule); font-size: 0.9375rem; color: var(--text-soft); }
.writer__books li { margin: 0 0 0.3rem; }
.writer--to-come .writer__name { color: var(--text-soft); }
.writers__credit { margin: 3rem 0 0; font-size: 0.9375rem; color: var(--text-soft); }

@media (max-width: 30rem) {
  .writer { grid-template-columns: 5rem 1fr; }
  .writer__photo { width: 5rem; height: 5rem; }
}

/* Book titles link to their own page */
.book__title a { color: inherit; text-decoration: none; }
.book__title a:hover { color: var(--accent); text-decoration: underline; text-decoration-thickness: 2px; }

/* Books drop-down in the menu: opens on hover or keyboard focus */
.has-sub { position: relative; }
.sub {
  position: absolute; right: -1rem; top: 100%; z-index: 5;
  list-style: none; margin: 0; padding: 0.5rem 0;
  min-width: 22rem; background: var(--paper);
  border: 1px solid var(--rule); border-radius: 4px;
  box-shadow: 0 12px 28px -10px rgba(20, 18, 50, 0.3);
  display: none;
}
.masthead__nav .sub { display: none; flex-direction: column; gap: 0; }
.masthead__nav .has-sub:hover .sub, .masthead__nav .has-sub:focus-within .sub { display: block; }
.masthead__nav .sub a {
  display: block; padding: 0.5rem 1rem; border-bottom: 0;
  font-weight: 400; font-size: 1rem; line-height: 1.35;
}
.masthead__nav .sub a:hover, .masthead__nav .sub a[aria-current="page"] { background: var(--wash); color: var(--ink); }
.masthead__nav .sub a[aria-current="page"] { font-weight: 600; }
/* a hover bridge so the menu doesn't close in the gap below "Books" */
.has-sub::after { content: ""; position: absolute; left: 0; right: 0; top: 100%; height: 0.6rem; }
@media (hover: none), (max-width: 40rem) {
  .sub { display: none !important; }   /* on phones, "Books" opens the books page instead */
}

/* An individual book's page */
.crumbs { max-width: var(--wide); margin: 0 auto; padding: 1.5rem 1rem 0; font-size: 1rem; }
.crumbs a::before { content: "‹ "; }
.book-page {
  max-width: var(--wide); margin: 0 auto; padding: 1.5rem 1rem 3rem;
  display: grid; grid-template-columns: minmax(12rem, 20rem) 1fr; gap: clamp(1.5rem, 5vw, 3.5rem); align-items: start;
}
.book-page__cover { position: sticky; top: 1.5rem; }
.book-page__cover img, .book-page__cover .book__cover-empty {
  width: 100%; border-radius: 2px 4px 4px 2px;
  box-shadow: 0 1px 2px rgba(20, 18, 50, 0.25), 0 14px 30px -10px rgba(20, 18, 50, 0.4);
}
.book-page__title { margin: 0 0 1rem; font-size: clamp(2rem, 5vw, 2.75rem); font-weight: 600; }
.book-page__text > p, .book-page__text .book__draft p { max-width: var(--measure); margin: 0 0 1rem; }
.book-page__subhead { margin: 2.5rem 0 0.75rem; font-size: 1.375rem; font-weight: 600; }
.book-page__foreword { max-width: var(--measure); padding-left: 1.25rem; border-left: 3px solid var(--wash); }
.book-page__foreword p { margin: 0 0 1rem; font-size: 1.0625rem; }
.book-page__foreword-by { font-style: italic; color: var(--text-soft); }
.book-page__charity { margin-top: 2.5rem !important; padding-top: 1.25rem; border-top: 1px solid var(--rule); color: var(--text-soft); }
@media (max-width: 40rem) {
  .book-page { grid-template-columns: 1fr; }
  .book-page__cover { position: static; max-width: 14rem; }
}
