/* ------------------------------------------------------------------------------
   «إصدارات المركز» — what the centre itself publishes, on the landing page.

   A shelf of covers at the book's own proportion (2:3). The work-sized picture of the first
   page fills a cover (never the thumbnail: at this size a 300px scan blurs), a thin gold
   plank carries it, and under the plank sit the title, the author and the year. A book the
   store sells wears «متوفر للشراء».

   Without scripting the shelf is an ordinary grid — auto-fill tracks, so one book stays one
   book and is never stretched across the row. With scripting a phone gets a strip that
   scrolls sideways and snaps book by book, and the books rise into place one after another
   the first time the shelf comes into view. The strip has no ends: publications.js draws
   copies of the row on either side, so it goes on in both directions, and a hairline bar
   under the books — the browser's own, narrowed to 3px — is the only hint that there is
   more. Every colour is a token, so both themes are the same rules.

   The record page's status badge and store button are NOT here: that page does not load this
   file, and they live in site.css with the rest of the record components.
   -------------------------------------------------------------------------- */
.pubs{
  --pub-gap:clamp(12px,1.5vw,20px);--pub-min:132px;
  /* the phone strip's scrollbar: a hairline that says there is more, never a heavy bar
     across the books (see the phone block below) */
  --pub-bar:rgba(20,28,36,.16);--pub-bar-hover:rgba(20,28,36,.3);
}
[data-theme="dark"] .pubs{--pub-bar:rgba(238,231,216,.18);--pub-bar-hover:rgba(238,231,216,.32)}
.pubs .section-head{max-inline-size:none}
/* the note under the shelf says where the covers come from: give it room to breathe */
.pubs .rail-note{margin-block-start:1.5rem}

.pub-shelf{
  list-style:none;margin:0;padding:8px 2px 2px;
  display:grid;gap:var(--pub-gap);
  grid-template-columns:repeat(auto-fill,minmax(var(--pub-min),1fr));
}
.pub-item{min-inline-size:0}
.pub-book{display:flex;flex-direction:column;block-size:100%;color:inherit;text-decoration:none;border-radius:4px}

/* ---- the book ---- */
.pub-cover{
  position:relative;display:block;aspect-ratio:2/3;overflow:hidden;
  border-start-start-radius:2px;border-start-end-radius:8px;
  border-end-end-radius:8px;border-end-start-radius:2px;
  background:var(--surface-2);
  box-shadow:0 1px 2px rgba(20,28,36,.14),0 10px 22px -12px rgba(20,28,36,.55),0 0 0 1px rgba(20,28,36,.07);
  transition:transform .45s var(--ease-out),box-shadow .45s var(--ease-out);
}
.pub-cover img{display:block;inline-size:100%;block-size:100%;object-fit:cover;object-position:50% 50%}
/* on the dark ground a black shadow is invisible: a hairline of gold keeps the book's edge */
[data-theme="dark"] .pub-cover{box-shadow:0 1px 2px rgba(0,0,0,.5),0 12px 26px -14px rgba(0,0,0,.8),0 0 0 1px rgba(230,196,119,.22)}
/* the fold of the spine, at the start edge of an Arabic book (the right, in an RTL page) */
.pub-cover::after{
  content:"";position:absolute;inset-block:0;inset-inline-start:0;inline-size:9px;z-index:1;
  background:linear-gradient(to left,rgba(9,15,21,.32),rgba(9,15,21,0));
  pointer-events:none;
}
.pub-blank{
  display:grid;place-items:center;inline-size:100%;block-size:100%;
  font-family:var(--font-display);font-size:3rem;line-height:1;color:var(--gold-600);
  background:linear-gradient(155deg,var(--gold-100),var(--surface-2));
  box-shadow:inset 0 0 0 1px var(--line);
}
.pub-badge{
  position:absolute;z-index:2;inset-block-start:9px;inset-inline-end:9px;
  font-family:var(--font-ui);font-size:11px;font-weight:700;line-height:1;
  padding:6px 10px;border-radius:var(--r-pill);white-space:nowrap;
  color:#211806;background:linear-gradient(180deg,var(--gold-300),var(--gold-400));
  box-shadow:0 3px 10px rgba(9,15,21,.3);
}

/* the shelf plank: a hairline of gold under each book, the width of the book */
.pub-plank{
  display:block;block-size:2px;margin-block:9px 11px;border-radius:2px;
  background:linear-gradient(to left,transparent,var(--gold-400) 16%,var(--gold-400) 84%,transparent);
  opacity:.45;
}

/* ---- what the book is ---- */
.pub-text{display:block;min-inline-size:0}
.pub-title{
  display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden;
  min-block-size:2.9em;                      /* two lines' room, so the years line up across the shelf */
  font-family:var(--font-display);font-weight:700;line-height:1.45;
  font-size:clamp(1rem,.96rem + .18vw,1.12rem);color:var(--ink);
  transition:color .25s;
}
.pub-byline{
  display:block;margin-block-start:3px;font-family:var(--font-ui);font-size:12.5px;line-height:1.55;
  color:var(--muted-2);overflow:hidden;text-overflow:ellipsis;white-space:nowrap;
}
.pub-year{
  display:block;margin-block-start:2px;font-family:var(--font-ui);font-size:12px;font-weight:700;
  color:var(--gold-600);font-variant-numeric:tabular-nums;
}

/* ---- the calm part: a lift on hover, a rise on arrival ---- */
.pub-book:hover .pub-cover,.pub-book:focus-visible .pub-cover{
  transform:translateY(-4px);
  box-shadow:0 2px 4px rgba(20,28,36,.16),0 18px 30px -14px rgba(20,28,36,.6),0 0 0 1px rgba(212,169,79,.45);
}
.pub-book:hover .pub-title{color:var(--gold-700)}
.pub-book:focus-visible{outline:2px solid var(--gold-400);outline-offset:5px}

@keyframes pub-rise{from{opacity:0;transform:translateY(14px)}to{opacity:1;transform:none}}
.js .pub-shelf.is-in .pub-item{
  animation:pub-rise .7s var(--ease-out) both;
  animation-delay:calc(var(--i,0) * 60ms);
}
/* a copy drawn for the endless strip (publications.js) is not a new arrival: it must not rise
   again when the shelf comes into view, nor wait for the scroll-in fade that never comes */
.js .pub-shelf.is-in .pub-item[data-pub-clone]{animation:none}

/* ---- a phone with scripting: the shelf becomes a strip that snaps book by book ---- */
@media (max-width:719.98px){
  /* the strip loops (publications.js), so a full browser bar would only report the endless
     copies; this is the browser's own bar narrowed to a 3px thumb — no track, no arrows,
     no trough. Firefox cannot be drawn that narrowly and gets its thinnest bar instead. */
  .js .pub-shelf{
    display:flex;gap:14px;overflow-x:auto;overflow-y:hidden;
    overscroll-behavior-inline:contain;scroll-snap-type:x mandatory;
    padding-block:6px 10px;
    -webkit-overflow-scrolling:touch;
  }
  .js .pub-shelf::-webkit-scrollbar{height:3px;background:transparent}
  .js .pub-shelf::-webkit-scrollbar-track{background:transparent}
  .js .pub-shelf::-webkit-scrollbar-thumb{background:var(--pub-bar);border-radius:99px}
  .js .pub-shelf::-webkit-scrollbar-thumb:hover{background:var(--pub-bar-hover)}
  .js .pub-shelf::-webkit-scrollbar-corner{background:transparent}
  @supports (-moz-appearance:none){
    .js .pub-shelf{scrollbar-width:thin;scrollbar-color:var(--pub-bar) transparent}
  }
  .js .pub-item{flex:0 0 min(46vw,164px);scroll-snap-align:start}
  .js .pub-book{block-size:auto}
  .js .pub-plank{margin-block:8px 10px}
}

@media (prefers-reduced-motion:reduce){
  .js .pub-shelf.is-in .pub-item{animation:none}
  .pub-cover{transition:none}
  .pub-book:hover .pub-cover{transform:none}
}

/* a book with no cover on the shelf wears the centre's logo, not its first letter */
.pub-blank{
  background:url("../img/logo-full-sm.png") center / min(62%,150px) auto no-repeat,linear-gradient(155deg,var(--gold-100),var(--surface-2));
  font-size:0;color:transparent;
}
