/* Editorial on the home page as a bookshop shelf (7 Nov 2026): each article is a flat printed cover in one field of
   Ella's palette with type in a second colour, the chrome mark small in a corner. Covers differ a little in height
   and stand on one baseline; the title and its category sit underneath. Five across on laptops, two on phones. */
.shelf {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: clamp(36px, 4vw, 56px) clamp(18px, 2.2vw, 32px);
  align-items: end;
  margin-top: clamp(32px, 4.6vw, 64px);
  padding-bottom: clamp(24px, 3vw, 40px);
}
.bk {
  display: flex;
  flex-direction: column;
  color: #EDEDEA;
  text-decoration: none;
}
.bk__wrap { display: flex; align-items: flex-end; }
.bk:hover .bk__c,
.bk:focus-visible .bk__c { transform: translateY(-8px); box-shadow: 0 1px 2px rgba(0, 0, 0, .35), 0 24px 40px rgba(0, 0, 0, .55); }
.bk:focus-visible { outline: none; }
.bk__t {
  margin-top: 16px;
  font-family: var(--display, "Newsreader", serif);
  font-size: clamp(14px, 1.15vw, 16px);
  line-height: 1.3;
}
.bk__k {
  margin-top: 4px;
  font-size: 12.5px;
  line-height: 1.35;
  color: #8f8f8a;
}
@media (max-width: 1024px) {
  .shelf { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 760px) {
  .shelf { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 32px 14px; }
  .bk__t { margin-top: 12px; font-size: 14px; }
  .bk__k { font-size: 11.5px; }
}
@media (prefers-reduced-motion: reduce) {
  .bk__c { transition: none; }
}

/* Captions on one line: every cover stands in a slot as tall as the tallest cover, so the covers share a baseline
   and every title starts at the same height, however many lines the one beside it takes */
.shelf { align-items: start; }
.bk__wrap { aspect-ratio: 1 / 1.42; }

/* Shelf, third pass (7 Nov): a grid of quiet cells, each with a small book standing in the middle and its title and
   category underneath; choosing one opens the panel on the right. No lines: the cells are set apart by tone. */
.shelf {
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 3px;
  align-items: stretch;
  padding-bottom: 0;
}
.bk {
  background: #121212;
  padding: clamp(28px, 3.4vw, 48px) clamp(14px, 1.4vw, 20px) clamp(14px, 1.3vw, 18px);
  justify-content: space-between;
  transition: background .35s ease;
}
.bk:hover, .bk.is-on { background: #1A1A1A; }
.bk__wrap { width: 62%; margin: 0 auto; }
.bk__t { margin-top: clamp(28px, 3vw, 44px); font-size: 13px; line-height: 1.3; }
.bk__k { font-size: 11.5px; }
.bk:hover .bk__c, .bk:focus-visible .bk__c, .bk.is-on .bk__c { transform: translateY(-6px); }

/* The panel */
.shp {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  z-index: 1000;
  width: min(38vw, 560px);
  display: flex;
  flex-direction: column;
  padding: 20px clamp(20px, 2.2vw, 32px) 24px;
  box-sizing: border-box;
  overflow-y: auto;
  background: var(--pbg, #0513B1);
  color: var(--pfg, #BFDC1E);
  transform: translateX(100%);
  transition: transform .55s cubic-bezier(.2, .7, .2, 1), background-color .45s ease, color .45s ease;
  box-shadow: -30px 0 60px rgba(0, 0, 0, .35);
}
.shp.is-in { transform: none; }
.shp[hidden] { display: none; }
.shp button { appearance: none; border: 0; background: none; color: inherit; font: inherit; cursor: pointer; padding: 0; }
.shp__bar { display: grid; grid-template-columns: 40px 1fr 40px; align-items: center; font-size: 13px; }
.shp__x {
  width: 36px; height: 36px; font-size: 20px; line-height: 1;
  background: color-mix(in srgb, currentColor 14%, transparent) !important;
  transition: background .25s ease;
}
.shp__x:hover { background: color-mix(in srgb, currentColor 26%, transparent) !important; }
.shp__lab { text-align: center; font-family: var(--display, "Newsreader", serif); font-style: italic; font-size: 15px; }
.shp__n { text-align: right; font-size: 12px; opacity: .75; }
.shp__stage {
  flex: 1 1 auto;
  min-height: 300px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 24px 0 18px;
}
.shp__arr { font-size: 38px; line-height: 1; width: 32px; height: 48px; opacity: .8; transition: opacity .2s ease, transform .2s ease; }
.shp__arr:hover { opacity: 1; }
.shp__arr--l:hover { transform: translateX(-3px); }
.shp__arr--r:hover { transform: translateX(3px); }
.shp__book { width: min(64%, 320px); }
.shp__book.is-in { animation: shp-in .55s cubic-bezier(.2, .7, .2, 1) both; }
@keyframes shp-in { from { opacity: 0; transform: translateY(14px) scale(.97); } to { opacity: 1; transform: none; } }
.shp__dots { display: flex; justify-content: center; gap: 7px; }
.shp__dot { width: 7px; height: 7px; border-radius: 99px; background: currentColor !important; opacity: .35; transition: width .3s ease, opacity .3s ease; }
.shp__dot.is-on { width: 20px; opacity: 1; }
.shp__tx { text-align: center; padding: 26px 4% 0; }
.shp__t { margin: 0; font-family: var(--display, "Newsreader", serif); font-size: clamp(24px, 2.2vw, 32px); line-height: 1.1; }
.shp__d { margin: 12px auto 0; max-width: 30em; font-size: 15px; line-height: 1.5; }
.shp__go { display: inline-block; margin-top: 18px; color: inherit; text-decoration: none; font-size: 14px; }
.shp__go i { font-style: normal; display: inline-block; transition: transform .25s ease; }
.shp__go:hover i { transform: translateX(4px); }
.shp__k { margin: auto 0 0; padding-top: 22px; text-align: center; font-size: 12px; opacity: .75; }

@media (max-width: 1024px) {
  .shelf { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .shp { width: min(60vw, 520px); }
}
@media (max-width: 760px) {
  .shelf { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 3px; }
  .bk__wrap { width: 70%; }
  .shp { width: 100%; }
}
@media (prefers-reduced-motion: reduce) {
  .shp, .shp__book.is-in { transition: none; animation: none; }
}
.shp__arr { font-size: 54px; font-weight: 300; width: 36px; height: 64px; }

/* While the panel is open the Editorial section makes room for it on the right, and the books re-flow into three
   columns beside it, so the panel never covers the shelf */
#rep, .shelf { transition: margin-right .55s cubic-bezier(.2, .7, .2, 1); }
html.shp-open .shelf { grid-template-columns: repeat(3, minmax(0, 1fr)); }
@media (max-width: 1024px) { html.shp-open .shelf { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* Hardcover mockups (7 Nov), after Ella's reference: each book stands in a studio sweep that runs from near black
   to its own colour, turned a little so the cloth spine shows on the left with the title down it, a linen weave
   across the boards and a soft shadow where it meets the floor */
.bk {
  background: linear-gradient(180deg, #0B0B0B 0%, #0B0B0B 30%, color-mix(in srgb, var(--pbg) 72%, #0B0B0B) 100%);
  transition: filter .35s ease;
}
.bk:hover, .bk.is-on { background: linear-gradient(180deg, #0B0B0B 0%, #0B0B0B 22%, color-mix(in srgb, var(--pbg) 88%, #0B0B0B) 100%); }
.bk__k { color: color-mix(in srgb, #EDEDEA 70%, transparent); }
.bk__wrap { perspective: 1100px; perspective-origin: 50% 40%; }
.bk:hover .bk3, .bk.is-on .bk3, .bk:focus-visible .bk3 { transform: rotateY(16deg) translateY(-6px); }
.bk:hover .bk__c, .bk:focus-visible .bk__c, .bk.is-on .bk__c { transform: none; }
/* the panel shows the same book, larger, in its own studio sweep */
.shp { background: linear-gradient(180deg, color-mix(in srgb, var(--pbg, #0513B1) 30%, #050505) 0%, var(--pbg, #0513B1) 78%); }
.shp__book { width: min(60%, 300px); perspective: 1400px; perspective-origin: 50% 40%; }
.shp__book .bk3 { transform: rotateY(22deg); }
.shp__book .bk3::after { filter: blur(14px); }
/* turned further and thicker, so the spine reads as in the reference */
.bk:hover .bk3, .bk.is-on .bk3, .bk:focus-visible .bk3 { transform: rotateY(26deg) translateY(-6px); }
.shp__book .bk3 { transform: rotateY(32deg); }
/* no studio sweep behind the books (Ella, 7 Nov): the cells stay quiet dark, the book alone carries the colour */
.bk, .bk:hover, .bk.is-on { background: #121212; }
.bk:hover, .bk.is-on { background: #1A1A1A; }
.bk__k { color: #8f8f8a; }
.shp { background: var(--pbg, #0513B1); }

/* Previous and next swoosh the books sideways: the current book flies out one side as the next flies in from the other */
.shp { overflow-x: hidden; }
.shp__book { position: relative; }
.shp__book .bk3.is-old { position: absolute; left: 0; top: 0; width: 100%; pointer-events: none; }
.shp__book .swo-out-l { animation: swo-out-l .6s cubic-bezier(.6, 0, .3, 1) both; }
.shp__book .swo-out-r { animation: swo-out-r .6s cubic-bezier(.6, 0, .3, 1) both; }
.shp__book .swo-in-r { animation: swo-in-r .6s cubic-bezier(.6, 0, .3, 1) both; }
.shp__book .swo-in-l { animation: swo-in-l .6s cubic-bezier(.6, 0, .3, 1) both; }
@keyframes swo-out-l { from { transform: rotateY(32deg); opacity: 1; } to { transform: translateX(-140%) rotateY(50deg); opacity: 0; } }
@keyframes swo-out-r { from { transform: rotateY(32deg); opacity: 1; } to { transform: translateX(140%) rotateY(14deg); opacity: 0; } }
@keyframes swo-in-r { from { transform: translateX(140%) rotateY(14deg); opacity: 0; } to { transform: rotateY(32deg); opacity: 1; } }
@keyframes swo-in-l { from { transform: translateX(-140%) rotateY(50deg); opacity: 0; } to { transform: rotateY(32deg); opacity: 1; } }
@media (prefers-reduced-motion: reduce) {
  .shp__book .swo-out-l, .shp__book .swo-out-r, .shp__book .swo-in-r, .shp__book .swo-in-l { animation-duration: .01s; }
}

/* Editorial sits straight on the page's black (Ella, 7 Nov): no grey panel behind the section, the heading and
   shelf aligned with the other sections; book titles set upright, no italics */
#rep { background: transparent; border-radius: 0; padding-left: 0; padding-right: 0; }
.bk__t i, .shp__t i { font-style: normal; }

/* Six books, larger: three across in two rows (two across while the panel is open, two on phones) */
.shelf { grid-template-columns: repeat(3, minmax(0, 1fr)); }
html.shp-open .shelf { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.bk { padding: clamp(40px, 4.4vw, 64px) clamp(18px, 1.8vw, 26px) clamp(16px, 1.5vw, 22px); }
.bk__wrap { width: 54%; }
.bk__t { font-size: 15px; }
.bk__k { font-size: 12.5px; }
@media (max-width: 760px) {
  .shelf, html.shp-open .shelf { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .bk__wrap { width: 70%; }
  .bk__t { font-size: 13.5px; }
}
.bk { justify-content: flex-start; }

/* Swoosh, fixed (7 Nov): a pure slide with no fade, because fading flattens the 3D book and its spine vanished
   until it landed; the stage clips the books as they leave, and both move at once from the first frame */
.shp__stage { overflow: hidden; }
.shp__book .swo-out-l, .shp__book .swo-out-r, .shp__book .swo-in-r, .shp__book .swo-in-l {
  animation-duration: .55s;
  animation-timing-function: cubic-bezier(.3, .6, .2, 1);
}
@keyframes swo-out-l { from { transform: rotateY(32deg); } to { transform: translateX(-190%) rotateY(32deg); } }
@keyframes swo-out-r { from { transform: rotateY(32deg); } to { transform: translateX(190%) rotateY(32deg); } }
@keyframes swo-in-r { from { transform: translateX(190%) rotateY(32deg); } to { transform: rotateY(32deg); } }
@keyframes swo-in-l { from { transform: translateX(-190%) rotateY(32deg); } to { transform: rotateY(32deg); } }

/* Editorial heading on the shelf's grid (7 Nov): the title across the first two book columns, the two short
   paragraphs stacked in the third, all three starting on one top line and lined up with the captions below */
.rep__head {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  column-gap: 3px;
  row-gap: 24px;
  align-items: start;
}
.rep .rep__title { grid-column: 1 / 3; padding: 0 clamp(18px, 1.8vw, 26px); font-size: clamp(44px, 5vw, 76px); line-height: .98; }
.rep__cols {
  grid-column: 3;
  grid-template-columns: minmax(0, 1fr);
  gap: 14px;
  padding: .55em clamp(18px, 1.8vw, 26px) 0;
}
.rep__cols p { font-size: 15px; line-height: 1.6; }
html.shp-open .rep__head { grid-template-columns: minmax(0, 1fr); }
html.shp-open .rep .rep__title, html.shp-open .rep__cols { grid-column: 1; }
html.shp-open .rep__cols { grid-template-columns: 1fr 1fr; gap: 24px; }
@media (max-width: 1024px) {
  .rep__head { grid-template-columns: minmax(0, 1fr); }
  .rep .rep__title, .rep__cols { grid-column: 1; }
  .rep__cols { grid-template-columns: 1fr 1fr; gap: 24px; }
}
@media (max-width: 760px) {
  .rep .rep__title, .rep__cols { padding-left: 0; padding-right: 0; }
  .rep__cols { grid-template-columns: minmax(0, 1fr); gap: 12px; }
}

/* the panel takes sideways swipes itself (js/shelf.js); vertical scrolling inside it stays with the browser */
.shp { touch-action: pan-y; }

/* Big desktops (8 Nov): the panel takes half the screen, and the Editorial section moves into the other half
   (js/shelf.js already moves the shelf clear of it); the cover and its words grow with the panel */
@media (min-width: 1600px) {
  .shp { width: 50vw; padding: 24px clamp(24px, 2.6vw, 56px) 28px; }
  .shp__book { width: min(56%, 44vh, 600px); }
  .shp__t { font-size: clamp(28px, 2.4vw, 52px); }
  .shp__d { font-size: clamp(15px, 1vw, 21px); max-width: 32em; }
  .shp__go { font-size: clamp(14px, .9vw, 19px); }
  .shp__lab { font-size: clamp(15px, 1vw, 20px); }
  .shp__n, .shp__k { font-size: clamp(12px, .8vw, 16px); }
}

/* Big desktops (8 Nov): the cover and its words sit together in the middle of the panel, not pushed to the bottom */
@media (min-width: 1600px) {
  .shp__stage { flex: 0 0 auto; margin-top: auto; padding: 36px 0 28px; }
  /* the standing book is sized by the screen height so it always fits whole inside the panel (8 Nov fix: it was clipped) */
  .shp__book { width: min(46%, 34vh, 520px); }
  .shp__k { margin: 0 0 auto; padding-top: 26px; }
}
/* Big desktop: the Editorial intro reads as one composition. Title on the left half; the two paragraphs side by side
   on the right half at the standard body size, top-aligned with the title. */
@media (min-width: 1600px) {
  html:not(.shp-open) .rep__head { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); column-gap: clamp(48px, 4vw, 140px); align-items: start; }
  html:not(.shp-open) .rep .rep__title { grid-column: 1; }
  html:not(.shp-open) .rep__cols { grid-column: 2; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: clamp(28px, 2.4vw, 72px); padding-top: .9em; }
  .rep__cols p { font-size: clamp(17px, .82vw, 24px); line-height: 1.6; margin: 0; }
}

/* The sub-headline under each title, so a short title like "Bigger Than Us" says what the article is about (12 Nov) */
.bk__d { display: block; margin-top: 6px; font-family: var(--display, "Newsreader", serif); font-size: 13px; line-height: 1.4; color: #b9b9b4; }
.bk__d + .bk__k { margin-top: 8px; }
@media (max-width: 760px) { .bk__d { font-size: 12.5px; } }

/* Phone pop-up template (13 Nov, from Ella's Editorial layout): headline, the standing book, category, the article's
   opening line, "From the article" and a line from it, then the link. Same opening, swipes and per-book background. */
.shp__head, .shp__cat, .shp__q, .shp__al, .shp__a { display: none; }
@media (max-width: 760px) {
  .shp.has-lines { padding-top: 14px; }
  .shp.has-lines .shp__lab { visibility: hidden; }
  .shp.has-lines .shp__head { display: block; order: 1; margin: 6px 0 0; text-align: center; font-family: var(--display, "Newsreader", serif); font-weight: 300; font-size: clamp(30px, 9vw, 40px); line-height: 1.08; letter-spacing: -.005em; }
  .shp.has-lines .shp__head i { font-style: italic; }
  .shp.has-lines .shp__bar { order: 0; }
  .shp.has-lines .shp__stage { order: 2; margin-top: 18px; justify-content: center; }
  .shp.has-lines .shp__book { width: min(68%, 300px); margin: 0 auto; }
  .shp.has-lines .shp__arr, .shp.has-lines .shp__dots, .shp.has-lines .shp__k, .shp.has-lines .shp__t, .shp.has-lines .shp__d { display: none; }
  .shp.has-lines .shp__tx { order: 3; text-align: left; padding: 22px 2px 6px; }
  .shp.has-lines .shp__cat { display: block; margin: 0 0 14px; font-size: 12px; letter-spacing: .16em; text-transform: uppercase; opacity: .7; }
  .shp.has-lines .shp__q { display: block; margin: 0; font-family: var(--display, "Newsreader", serif); font-weight: 300; font-size: clamp(25px, 7.4vw, 31px); line-height: 1.2; }
  .shp.has-lines .shp__al { display: block; margin: 26px 0 10px; font-size: 12px; letter-spacing: .16em; text-transform: uppercase; opacity: .7; }
  .shp.has-lines .shp__a { display: block; margin: 0; font-size: 15px; line-height: 1.6; opacity: .78; }
  .shp.has-lines .shp__go { margin-top: 22px; font-size: 13px; letter-spacing: .14em; text-transform: uppercase; }
  .shp.has-lines .shp__cat i, .shp.has-lines .shp__q i { font-style: normal; }
}

/* less crowded (13 Nov): no headline in the pop-up (it sits above the shelf already), more air between the parts */
@media (max-width: 760px) {
  .shp.has-lines .shp__head { display: none; }
  .shp.has-lines .shp__stage { margin-top: 34px; }
  .shp.has-lines .shp__book { width: min(62%, 280px); }
  .shp.has-lines .shp__tx { padding-top: 40px; }
  .shp.has-lines .shp__cat { margin-bottom: 18px; }
  .shp.has-lines .shp__q { font-size: clamp(24px, 7vw, 29px); line-height: 1.25; }
  .shp.has-lines .shp__al { margin: 38px 0 12px; }
  .shp.has-lines .shp__go { margin-top: 32px; }
  .shp.has-lines { padding-bottom: 44px; }
}

/* One phone screen, no scrolling (13 Nov, Ella: "need to scroll to read the article, wrong"). The pop-up is exactly the
   screen's height; the book and the words are sized from that height so all of it fits, and the book is never clipped. */
@media (max-width: 760px) {
  /* the panel is pinned top and bottom, so it always covers the whole screen as Safari's bars grow and shrink */
  .shp.has-lines { top: 0; bottom: 0; height: auto; min-height: 100%; overflow: hidden; padding: 2svh 6vw 3svh; }
  .shp.has-lines .shp__bar { flex: none; }
  .shp.has-lines .shp__stage { flex: none; min-height: 0; overflow: visible; margin-top: 1.5svh; padding: 1.5svh 0 0; }
  .shp.has-lines .shp__book { width: min(46vw, 23svh, 260px); cursor: pointer; }
  .shp.has-lines .shp__tx { flex: none; padding: 4svh 2px 0; }
  .shp.has-lines .shp__cat { margin-bottom: 1.6svh; font-size: min(12px, 1.5svh); }
  .shp.has-lines .shp__q { font-size: min(7vw, 3.4svh, 29px); line-height: 1.22; }
  .shp.has-lines .shp__al { margin: 3.4svh 0 1.2svh; font-size: min(12px, 1.5svh); }
  .shp.has-lines .shp__a { font-size: min(15px, 1.95svh); line-height: 1.55; }
  .shp.has-lines .shp__go { margin-top: 3svh; font-size: min(13px, 1.7svh); }
}

/* Phone home shelf: no category under each book (13 Nov); the pop-up still shows it */
@media (max-width: 760px) { #repDesk .bk__k { display: none; } }
