/* Where They Stand: the charity's hub. The Bound Volume identity (brand/README.md): ink, paper and gilt for the
   charity, a cloth colour for each project, Source Serif 4 throughout. */

:root {
  color-scheme: light;
  --ink: #1C2427;
  --ink-muted: #42484D;
  --paper: #F5F0E3;
  --paper-light: #FBF8F0;
  --rule: #CDBF9C;
  --rule-faint: #DDD4BF;
  --gilt: #B08D3C;
  --gilt-text: #7A5C1C;
  --gilt-spine: #D9BC72;
  --spine-text: #F3E3B8;
  --green: #1D4535;
  --brown: #6E4A2A;
  --blue: #1F5F8B;
  --heather: #5E3F63;
  --serif: "Source Serif 4", Georgia, "Times New Roman", serif;
  --gutter: clamp(16px, 4vw, 56px);
}

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

body {
  margin: 0;
  background: var(--paper-light);
  color: var(--ink);
  font-family: var(--serif);
  font-size: clamp(1rem, 0.96rem + 0.2vw, 1.1rem);
  line-height: 1.5;
}

.page {
  max-inline-size: 72rem;
  margin-inline: auto;
  padding: clamp(24px, 5vw, 56px) var(--gutter) 48px;
}

a { color: var(--green); text-underline-offset: 0.15em; }
a:hover { color: var(--ink); text-decoration-thickness: 2px; }
:focus-visible { outline: 3px solid var(--blue); outline-offset: 3px; }

.skip {
  position: absolute;
  inset-inline-start: 8px;
  inset-block-start: -48px;
  padding: 8px 12px;
  background: var(--paper);
  border: 2px solid var(--ink);
  z-index: 10;
}
.skip:focus { inset-block-start: 8px; }

.visually-hidden {
  position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap;
}

/* ---- Masthead: the mark and the wordmark over a gilt rule ---- */

.masthead { display: flex; align-items: center; gap: clamp(12px, 2vw, 20px); }
.mark { inline-size: clamp(56px, 9vw, 84px); block-size: auto; flex: none; }
.wordmark { display: flex; flex-direction: column; gap: 8px; }
.wordmark span:first-child {
  font-size: clamp(1.45rem, 1rem + 2.4vw, 2.4rem);
  font-weight: 600;
  letter-spacing: 0.07em;
  line-height: 1;
}
.gilt-rule { block-size: 2px; background: var(--gilt); }

.lede {
  max-inline-size: 40em;
  margin: clamp(28px, 5vw, 48px) 0 12px;
  font-size: clamp(1.2rem, 1rem + 0.9vw, 1.6rem);
  line-height: 1.4;
}
.intro { max-inline-size: 40em; margin: 0 0 16px; color: var(--ink-muted); }
.status { margin: 0; font-style: italic; color: var(--ink-muted); }

.section-title {
  margin: clamp(40px, 6vw, 64px) 0 20px;
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--gilt-text);
}

/* ---- The two shelves ---- */

.shelves { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 30rem), 1fr)); gap: 24px; }

.shelf {
  background: var(--paper);
  border: 1px solid var(--rule-faint);
  padding: clamp(18px, 3vw, 28px);
}
.shelf__name {
  margin: 0 0 20px;
  padding-block-end: 8px;
  border-block-end: 1px solid var(--rule);
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--gilt-text);
}

.shelf__books {
  display: flex;
  align-items: flex-end;
  gap: clamp(8px, 1.5vw, 14px);
  block-size: clamp(250px, 26vw, 300px);
  padding-inline-start: clamp(12px, 3vw, 36px);
  border-block-end: 6px solid var(--ink);
  container-type: size;  /* the spines' names are sized to the shelf's height */
}
.spine {
  inline-size: clamp(52px, 7vw, 82px);
  display: flex;
  justify-content: center;
  align-items: center;
  position: relative;
  color: var(--spine-text);
  text-decoration: none;
  /* gilt bands at head and foot, as on a bound volume */
  background-image:
    linear-gradient(var(--gilt-spine), var(--gilt-spine)), linear-gradient(var(--gilt-spine), var(--gilt-spine)),
    linear-gradient(var(--gilt-spine), var(--gilt-spine));
  background-size: 100% 2px;
  background-repeat: no-repeat;
  background-position: 0 14px, 0 20px, 0 calc(100% - 14px);
}
.spine span {
  writing-mode: vertical-rl;
  /* each name fits its spine, between the gilt bands: --h is the spine's height (% of the shelf), --n its letters */
  font-size: min(1.2rem, calc((var(--h) * 1cqh - 64px) / (var(--n) * 0.76)));
  font-weight: 600;
  letter-spacing: 0.1em;
  white-space: nowrap;
}
a.spine:hover { color: #FFFFFF; filter: brightness(1.12); }
.spine--green { background-color: var(--green); }
.spine--brown { background-color: var(--brown); }
.spine--blue { background-color: var(--blue); }
.spine--heather { background-color: var(--heather); }
/* every volume the same height, as on a shelf of one edition */
.spine { --h: 100; --n: 17; block-size: calc(var(--h) * 1%); }
/* one size of lettering for the set, fitted to the longest name (21 letters) */
.spine { --n: 21; }
.spine--empty { block-size: 100%; border: 1.5px dashed #BBAE8B; background: none; }

.projects { list-style: none; margin: 24px 0 0; padding: 0; display: grid; gap: 20px; }
.project { display: grid; grid-template-columns: 40px 1fr; gap: 14px; align-items: start; }
.project__icon { inline-size: 40px; block-size: 40px; }
.project h4 { margin: 2px 0 4px; font-size: 1.35rem; font-weight: 600; line-height: 1.2; }
.project h4 a { color: var(--ink); text-decoration-color: var(--rule); }
.project h4 a:hover { text-decoration-color: currentColor; }
.project p { margin: 0 0 6px; color: var(--ink-muted); }
.project__url { font-size: 0.95rem; }

/* ---- How we work ---- */

.principles { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 17rem), 1fr)); gap: 24px; }
.principles div { border-block-start: 2px solid var(--gilt); padding-block-start: 12px; }
.principles h3 { margin: 0 0 6px; font-size: 1.25rem; font-weight: 600; }
.principles p { margin: 0; color: var(--ink-muted); }

.contact { margin: 0; }
.notfound { margin: clamp(28px, 5vw, 48px) 0 0; font-size: clamp(1.6rem, 1.2rem + 1.5vw, 2.4rem); font-weight: 600; }
.notfound + .lede { margin-block-start: 8px; }

.foot {
  margin-block-start: clamp(48px, 7vw, 72px);
  padding-block-start: 16px;
  border-block-start: 1px solid var(--rule);
  font-size: 0.95rem;
  color: var(--ink-muted);
}
.foot p { margin: 0 0 4px; }

@media (prefers-reduced-motion: no-preference) {
  a.spine { transition: filter 120ms ease; }
}
@media (forced-colors: active) {
  .spine { border: 1px solid CanvasText; forced-color-adjust: none; }
}
