/* Bla-Bla Media: a publisher's counter. Today's book lies face-out on a warm grey counter, its blurb and contents
   beside it; below, the shelf of 49 spines sits on planks. White cover stock, one band colour per title, black-line
   engravings; a book serif for everything that is read, a condensed grotesque for imprint lines. Light only: it is
   read at work, by day, like a catalogue. */

@font-face { font-family: "EB Garamond"; font-weight: 400; font-style: normal; font-display: swap; src: url(/assets/fonts/eb-garamond-latin-400-normal.woff2) format("woff2"); }
@font-face { font-family: "EB Garamond"; font-weight: 400; font-style: italic; font-display: swap; src: url(/assets/fonts/eb-garamond-latin-400-italic.woff2) format("woff2"); }
@font-face { font-family: "EB Garamond"; font-weight: 500; font-style: normal; font-display: swap; src: url(/assets/fonts/eb-garamond-latin-500-normal.woff2) format("woff2"); }
@font-face { font-family: "EB Garamond"; font-weight: 500; font-style: italic; font-display: swap; src: url(/assets/fonts/eb-garamond-latin-500-italic.woff2) format("woff2"); }
@font-face { font-family: "Archivo Narrow"; font-weight: 500; font-style: normal; font-display: swap; src: url(/assets/fonts/archivo-narrow-latin-500-normal.woff2) format("woff2"); }
@font-face { font-family: "Archivo Narrow"; font-weight: 600; font-style: normal; font-display: swap; src: url(/assets/fonts/archivo-narrow-latin-600-normal.woff2) format("woff2"); }

:root {
  color-scheme: light;
  --ground: #d3d0c8;      /* the counter: grey with a warm bias, never cream */
  --ground-deep: #c3bfb5; /* the shelf's back wall */
  --plank-c: #6f6355;     /* shelf planks */
  --paper: #fcfcfa;       /* cover stock */
  --ink: #1c1b19;
  --muted: #4b463f;
  --rule: rgb(28 27 25 / .22);
  --band: #a3192b;        /* set per title */
  --serif: "EB Garamond", "Iowan Old Style", Georgia, serif;
  --narrow: "Archivo Narrow", "Arial Narrow", "Helvetica Neue", sans-serif;
  --gutter: max(16px, env(safe-area-inset-left, 0px));
  --gutter-r: max(16px, env(safe-area-inset-right, 0px));
}

* { box-sizing: border-box; }
html { background: var(--ground); -webkit-text-size-adjust: 100%; }
body { margin: 0; color: var(--ink); font: 400 1.125rem/1.55 var(--serif); font-variant-numeric: oldstyle-nums; }
::selection { background: var(--band); color: var(--paper); }
a { color: inherit; text-decoration-thickness: 1px; text-underline-offset: .18em; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; }
.skip { position: absolute; left: var(--gutter); top: -4rem; background: var(--ink); color: var(--paper); padding: .5rem .8rem; font: 600 .85rem var(--narrow); }
.skip:focus { top: .5rem; }

/* imprint and navigation */
.masthead { display: flex; justify-content: space-between; align-items: center; gap: 1rem; padding: 1.1rem var(--gutter-r) 1.1rem var(--gutter); max-width: 76rem; margin: 0 auto; }
.imprint { display: inline-flex; align-items: center; gap: .55rem; text-decoration: none; font: 600 .95rem/1 var(--narrow); letter-spacing: .14em; text-transform: uppercase; }
.masthead nav { display: flex; gap: 1.4rem; font: 500 .9rem/1 var(--narrow); letter-spacing: .12em; text-transform: uppercase; }
.masthead nav a { text-decoration: none; padding: .5rem 0; }
.masthead nav a:hover { text-decoration: underline; }
.cover-mark { display: inline-grid; place-items: center; width: 1.6em; height: 1.6em; background: var(--ink); color: var(--paper); font: 500 1.05em/1 var(--serif); letter-spacing: 0; text-transform: none; }

/* the counter: today's book and what's written about it */
.counter { max-width: 76rem; margin: 0 auto; padding: 1.5rem var(--gutter-r) 3.5rem var(--gutter);
  display: grid; grid-template-columns: minmax(16rem, 26rem) minmax(0, 1fr); grid-template-areas: "cover copy";
  column-gap: clamp(2rem, 5vw, 5rem); align-items: start; }
.counter-cover { grid-area: cover; perspective: 1400px; }
.counter-copy { grid-area: copy; min-width: 0; max-width: 40rem; }
.actions { display: flex; flex-wrap: wrap; align-items: center; gap: .75rem; margin: 0 0 2.2rem; }

/* the cover: a white book with a coloured title band, its proportions fixed, its type scaled to its own width */
.cover { container-type: inline-size; position: relative; aspect-ratio: 3 / 4; width: 100%; max-width: 100%;
  display: grid; grid-template-rows: auto minmax(0, 1fr) auto auto auto; background: var(--paper);
  border-top: 2.2cqi solid var(--band);
  box-shadow: 0 1px 1px rgb(0 0 0 / .12), 0 14px 28px -10px rgb(40 34 26 / .45), 0 30px 60px -30px rgb(40 34 26 / .35);
  transform: rotate(-1.4deg); transform-origin: 50% 90%; }
.cover::after { content: ""; position: absolute; inset: 0; pointer-events: none; background: linear-gradient(90deg, rgb(0 0 0 / .07), transparent 4%, transparent 96%, rgb(0 0 0 / .05)); }
.cover-tag { margin: 0; padding: 3.2cqi 7cqi 0; text-align: center; font: italic 400 4.3cqi/1.25 var(--serif); }
.cover-art { position: relative; min-height: 0; }
.cover-art img { position: absolute; top: 3cqi; left: 9cqi; width: calc(100% - 18cqi); height: calc(100% - 7cqi); object-fit: contain; mix-blend-mode: multiply; filter: contrast(1.05); }
.cover-band { background: var(--band); color: var(--paper); padding: 3.4cqi 6cqi 3.8cqi; }
.cover-title { display: block; font: 500 9.6cqi/.98 var(--serif); letter-spacing: -.01em; text-wrap: balance; }
.cover-series { margin: 0; padding: 2cqi 6cqi 0; text-align: right; font: italic 400 5.2cqi/1.1 var(--serif); }
.cover-imprint { display: flex; align-items: center; gap: 1.8cqi; margin: 0; padding: 3cqi 6cqi 3.4cqi; font: 600 3.4cqi/1 var(--narrow); letter-spacing: .16em; text-transform: uppercase; }
.cover-imprint .cover-mark { font-size: 4.6cqi; width: 1.45em; height: 1.45em; }

/* what's written about today's book */
.lead { margin: .2rem 0 .9rem; font: 400 clamp(2rem, 1.3rem + 2.6vw, 3.4rem)/1.04 var(--serif); letter-spacing: -.015em; text-wrap: balance; }
.lead em { font-style: italic; color: var(--band); }
.meta { margin: 0 0 1.8rem; font: 500 .85rem/1.4 var(--narrow); letter-spacing: .12em; text-transform: uppercase; color: var(--muted); font-variant-numeric: lining-nums tabular-nums; }
.blurb { margin: 0 0 2rem; padding: 1.1rem 0 1.2rem; border-block: 1px solid var(--rule); }
.blurb p { margin: 0; font: italic 400 clamp(1.3rem, 1.05rem + 1vw, 1.75rem)/1.3 var(--serif); text-wrap: pretty; }
.preface, .toc { margin: 0 0 1.6rem; }
.preface h2, .toc h2 { margin: 0 0 .45rem; font: 600 .82rem/1 var(--narrow); letter-spacing: .16em; text-transform: uppercase; }
.preface p { margin: 0; max-width: 62ch; }
.toc ol { list-style: none; margin: 0; padding: 0; display: grid; gap: .3rem; }
.toc li { display: grid; grid-template-columns: 1.6rem minmax(0, auto) minmax(1.5rem, 1fr) auto; align-items: end; gap: .5rem; }
.toc li::after { content: ""; grid-column: 3; grid-row: 1; border-bottom: 1.5px dotted rgb(28 27 25 / .45); transform: translateY(-.42em); }
.toc-n { align-self: start; padding-top: .3em; }
.toc-n { font: 500 .85rem/1 var(--narrow); color: var(--muted); font-variant-numeric: lining-nums tabular-nums; }
.toc-t { min-width: 0; }
.toc-p { grid-column: 4; font-variant-numeric: oldstyle-nums tabular-nums; }
.animal-note { margin: 0; font-size: 1rem; font-style: italic; color: var(--muted); text-wrap: pretty; }

/* actions: things you do with a book */
.act { appearance: none; border: 1.5px solid var(--ink); background: transparent; color: var(--ink); cursor: pointer;
  min-height: 2.9rem; padding: .7rem 1.15rem; font: 600 .92rem/1 var(--narrow); letter-spacing: .12em; text-transform: uppercase;
  transition: transform .18s cubic-bezier(.2, .7, .2, 1), background-color .18s, color .18s; }
.act:hover { background: var(--ink); color: var(--paper); }
.act:active { transform: translateY(1px); }
.act-primary { background: var(--band); border-color: var(--band); color: var(--paper); }
.act-primary:hover { background: var(--paper); border-color: var(--ink); color: var(--ink); }
.act-note { font: 500 .9rem/1.3 var(--narrow); letter-spacing: .04em; color: var(--muted); min-height: 1.3em; }

/* the shelf: 49 spines standing on planks */
.shelf { background: var(--ground-deep); padding: 2.5rem 0 3.5rem; border-top: 1px solid var(--rule); }
.shelf-head, .spines { max-width: 76rem; margin: 0 auto; padding-left: var(--gutter); padding-right: var(--gutter-r); }
.shelf-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: .3rem 1.2rem; margin-bottom: 1.4rem; }
.shelf-next { margin-top: 3rem; }
.shelf-head h2 { margin: 0; font: 400 clamp(1.7rem, 1.3rem + 1.2vw, 2.3rem)/1 var(--serif); }
.shelf-head p { margin: 0; color: var(--muted); }
.spines { --row: 15rem; --plank: .6rem; --gap: 1.6rem; list-style: none; display: flex; flex-wrap: wrap; row-gap: calc(var(--plank) + var(--gap)); column-gap: 3px;
  /* each shelf: a soft contact shadow behind the books, the plank's lit top edge, its front face, the shadow it casts;
     the last shelf's plank is drawn on its own (::after), in the padding below the last row */
  position: relative; padding-bottom: var(--plank);
  background-image: repeating-linear-gradient(to bottom,
    transparent 0 calc(var(--row) - .6rem), rgb(40 34 26 / .16) var(--row),
    #9b8a75 var(--row) calc(var(--row) + .14rem),
    var(--plank-c) calc(var(--row) + .14rem) calc(var(--row) + var(--plank)),
    rgb(40 34 26 / .22) calc(var(--row) + var(--plank)), transparent calc(var(--row) + var(--plank) + .3rem) calc(var(--row) + var(--plank) + var(--gap)));
  background-origin: content-box; background-clip: padding-box; }
.spines::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: var(--plank);
  background: linear-gradient(#9b8a75 0 .14rem, var(--plank-c) .14rem); box-shadow: 0 .3rem .35rem -.15rem rgb(40 34 26 / .3); }
.spines li { height: var(--row); display: flex; align-items: flex-end; }
.spine { --w: 2.9rem; position: relative; display: grid; grid-template-rows: auto 1fr auto; justify-items: center; width: var(--w); height: var(--h, 92%);
  background: var(--paper); color: var(--ink); text-decoration: none; overflow: hidden;
  box-shadow: inset 3px 0 2px -2px rgb(0 0 0 / .18), inset -4px 0 3px -2px rgb(0 0 0 / .2), 0 1px 0 rgb(0 0 0 / .2);
  transition: transform .28s cubic-bezier(.16, 1, .3, 1); }
.spines li:nth-child(3n) .spine { --w: 3.3rem; }
.spines li:nth-child(5n+1) .spine { --w: 2.6rem; }
.spine-acr { width: 100%; padding: .45rem 0 .4rem; background: var(--band); color: var(--paper); text-align: center; font: 600 .72rem/1 var(--narrow); letter-spacing: .02em; }
.spine-title { writing-mode: vertical-rl; transform: rotate(180deg); padding: .5rem .25rem; max-height: 100%; overflow: hidden; text-align: center; font: 500 .98rem/1.12 var(--serif); text-wrap: balance; }
.spine-m { font-size: .86rem; }
.spine-s { font-size: .76rem; }
.spine-mark { margin-bottom: .45rem; display: grid; place-items: center; width: 1.15rem; height: 1.15rem; background: var(--ink); color: var(--paper); font: 500 .7rem/1 var(--serif); }
.spine:hover, .spine:focus-visible { transform: translateY(-.7rem); }
.spine[aria-current="page"] { transform: translateY(-1.4rem); box-shadow: inset 3px 0 2px -2px rgb(0 0 0 / .18), inset -4px 0 3px -2px rgb(0 0 0 / .2), 0 0 0 2px var(--band); }

/* colophon and out-of-print pages */
.colophon { max-width: 44rem; margin: 0 auto; padding: 1.5rem var(--gutter-r) 3.5rem var(--gutter); }
.colophon h1 { font: 400 clamp(2rem, 1.4rem + 2vw, 3rem)/1.05 var(--serif); margin: .4rem 0 1rem; }
.colophon h2 { font: 600 .85rem/1 var(--narrow); letter-spacing: .16em; text-transform: uppercase; margin: 2rem 0 .6rem; }
.credits { padding-left: 1.1rem; columns: 2 18rem; column-gap: 2rem; }
.credits li { break-inside: avoid; margin-bottom: .2rem; font-size: 1rem; }

.foot { max-width: 76rem; margin: 0 auto; padding: 2rem var(--gutter-r) calc(2.5rem + env(safe-area-inset-bottom, 0px)) var(--gutter); font-size: .95rem; color: var(--muted); }
.foot p { margin: 0 0 .4rem; max-width: 70ch; }
.shelf + .foot { background: var(--ground-deep); max-width: none; }
.shelf + .foot p { max-width: 70ch; margin-left: max(0px, calc((100vw - 76rem) / 2)); }

@media (max-width: 760px) {
  .counter { grid-template-columns: minmax(0, 1fr); grid-template-areas: "cover" "copy"; padding-top: .5rem; }
  .counter-cover { width: min(100%, 22rem); margin: 0 auto 1.5rem; }
  .spines { --row: 11.5rem; }
  /* seven to a row: 49 titles fill seven full shelves */
  .spines { column-gap: 0; justify-content: space-between; }
  .spines li { width: calc(100% / 7); justify-content: center; }
  /* the AI shelf's twelve: six to a row */
  .spines-ai li { width: calc(100% / 6); }
  .spine, .spines li:nth-child(3n) .spine, .spines li:nth-child(5n+1) .spine { --w: min(2.9rem, calc(100% - 4px)); }
  .spine-title { font-size: .86rem; }
  .spine-m { font-size: .76rem; }
  .spine-s { font-size: .72rem; }
  /* the two actions as one even pair, full measure */
  .actions { display: grid; grid-template-columns: minmax(0, 1fr); }
  .act { width: 100%; }
  .act-note { text-align: center; }
  .masthead nav { gap: 1rem; }
}

@media (prefers-reduced-motion: reduce) {
  .spine, .act { transition: none; }
}
