@import url('https://fonts.googleapis.com/css2?family=Newsreader:ital,opsz,wght@0,6..72,400;0,6..72,500;0,6..72,600;0,6..72,700&family=Hanken+Grotesk:wght@400;500;600;700;800&display=swap');

.shp-books{
  --shp-bg:#f7f4ef; --shp-ink:#15110e; --shp-ink-soft:#56504a; --shp-line:#dcd5c8;
  --shp-navy:#093a7d; --shp-navy-dk:#072c5e; --shp-cream-2:#efeae0; --shp-gold:#c9b27a;
  --shp-serif:"Newsreader",Georgia,serif; --shp-sans:"Hanken Grotesk",system-ui,sans-serif;
  background:var(--shp-bg); color:var(--shp-ink); font-family:var(--shp-sans);
  font-size:17px; line-height:1.55; -webkit-font-smoothing:antialiased;
}
.shp-books *{box-sizing:border-box;}
.shp-books a{color:inherit;text-decoration:none;}
.shp-books img{max-width:100%;display:block;}
/* Fluid rather than stepped. Stepping the gutter at a breakpoint made the cards jump
   WIDER as the viewport got narrower, because the padding dropped faster than the
   viewport did. Clamping keeps the measure shrinking continuously all the way down. */
.shp-wrap{max-width:1240px;margin:0 auto;padding:0 clamp(18px,4vw,32px);}

/* Hero */
.shp-hero{text-align:center;padding:64px 32px 22px;}
.shp-hero__eyebrow{font-weight:700;font-size:12.5px;letter-spacing:.18em;text-transform:uppercase;color:var(--shp-ink-soft);margin:0 0 18px;}
.shp-hero h1{font-family:var(--shp-serif);color:var(--shp-navy);font-weight:700;font-size:clamp(40px,6vw,72px);line-height:1.02;margin:0 auto;max-width:14ch;letter-spacing:-.01em;}
.shp-hero p{font-weight:700;font-size:clamp(17px,2vw,21px);line-height:1.42;color:var(--shp-ink);max-width:40ch;margin:20px auto 0;text-wrap:balance;}

/* Section head */
/* The theme's global section{overflow:hidden} would make this a scroll container and
   kill the sticky filter bar inside it. Clip horizontally (same protection against
   full-bleed overflow) but leave the vertical axis visible so sticky works. */
.shp-section{padding:34px 0 90px;overflow:clip visible;}
.shp-section--top{padding-top:56px;}
.shp-section__head{font-family:var(--shp-serif);font-weight:700;font-size:clamp(30px,4.4vw,50px);line-height:1.05;margin:0 0 18px;letter-spacing:-.01em;}
.shp-rule{height:1px;background:var(--shp-line);border:0;margin:0 0 28px;}

/* Controls */
/* The theme's global body{overflow-x:hidden} turns the body into a scroll container,
   which silently disables position:sticky for everything inside it. overflow-x:clip
   suppresses the same horizontal overflow WITHOUT creating that container, so the
   filter bar below can actually pin. Scoped to this template so the global behavior
   is untouched everywhere else. */
body.page-template-books{overflow-x:clip;}

/* The theme reserves 200px at >=1024px to clear its fixed header, but that header is
   only ~100px tall — leaving ~100px of dead space above the title that the design
   doesn't have (the design has no fixed header to clear at all). Reserve just the
   header height plus a small buffer; the section's own 56px supplies the designed gap.
   Scoped to this template, and only at the breakpoint where the overshoot was
   measured — narrower widths keep the theme's own value. */
@media(min-width:1024px){body.page-template-books{padding-top:106px;}}

/* Filters stay visible while scrolling a long catalog. The site header is
   position:fixed, so the pin offset is measured at runtime and published as
   --shp-sticky-top (see books.min.js) rather than hardcoded to a header height
   that changes with the subnav and across breakpoints. */
.shp-controls{display:flex;flex-wrap:wrap;align-items:center;justify-content:space-between;gap:18px;position:sticky;top:var(--shp-sticky-top,0px);z-index:20;background:var(--shp-bg);padding:14px 0;margin-bottom:0;}
.shp-controls::after{content:"";position:absolute;left:0;right:0;bottom:0;height:1px;background:var(--shp-line);opacity:0;transition:opacity .16s;}
.shp-controls.is-stuck::after{opacity:1;}
.shp-chips{display:flex;flex-wrap:wrap;gap:10px;}
.shp-chip{font-family:var(--shp-sans);font-weight:600;font-size:14px;letter-spacing:.01em;padding:9px 17px;border-radius:999px;border:1.5px solid var(--shp-line);background:transparent;color:var(--shp-ink);cursor:pointer;transition:all .16s;line-height:1;display:inline-flex;align-items:center;gap:8px;}
.shp-chip:hover{border-color:var(--shp-navy);color:var(--shp-navy);}
.shp-chip[aria-pressed="true"]{background:var(--shp-navy);border-color:var(--shp-navy);color:#fff;}
.shp-chip__n{font-size:12px;font-weight:700;opacity:.7;}
.shp-chip[aria-pressed="true"] .shp-chip__n{opacity:.85;}
/* Topic bar: a secondary filter axis, so it takes its own full-width row under the
   type chips and sits a step down in weight rather than competing with them. */
.shp-chips--topic{flex-basis:100%;width:100%;gap:8px;padding-top:14px;border-top:1px solid var(--shp-line);}
.shp-chips--topic .shp-chip{font-size:13px;font-weight:500;padding:7px 14px;}
.shp-toolset{display:flex;align-items:center;gap:12px;}
.shp-search{position:relative;display:flex;align-items:center;}
.shp-search svg{position:absolute;left:13px;width:16px;height:16px;stroke:var(--shp-ink-soft);fill:none;stroke-width:1.8;pointer-events:none;}
.shp-search input{font-family:var(--shp-sans);font-size:14.5px;padding:10px 14px 10px 36px;width:230px;border:1.5px solid var(--shp-line);border-radius:999px;background:#fff;color:var(--shp-ink);outline:none;transition:border-color .15s;}
.shp-search input:focus{border-color:var(--shp-navy);}
.shp-search input::placeholder{color:#9b948b;}
.shp-sortwrap{position:relative;}
.shp-sortwrap select{font-family:var(--shp-sans);font-weight:600;font-size:14px;color:var(--shp-ink);padding:10px 36px 10px 16px;border:1.5px solid var(--shp-line);border-radius:999px;background:#fff;cursor:pointer;outline:none;appearance:none;}
.shp-sortwrap::after{content:"";position:absolute;right:15px;top:50%;width:7px;height:7px;border-right:2px solid var(--shp-ink-soft);border-bottom:2px solid var(--shp-ink-soft);transform:translateY(-65%) rotate(45deg);pointer-events:none;}
.shp-count{font-size:14px;color:var(--shp-ink-soft);margin:6px 0 26px;}
.shp-count b{color:var(--shp-ink);font-weight:700;}

/* Grid + cards */
/* The cards have no border, only a shadow, so on cream covers that shadow IS the card's
   visible edge. Sitting flush with .shp-section's clip box cut it off the first and last
   card in every row. Insetting the grid gives the row breathing room and puts the outer
   shadows back inside the clip box. Heading, rule and controls stay on the wrap's edge. */
.shp-grid{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:30px 30px;padding:0 clamp(0px,2vw,28px);}
.shp-card{display:flex;flex-direction:column;height:100%;}
.shp-card__coverlink{display:block;position:relative;flex-shrink:0;border-radius:7px;overflow:hidden;box-shadow:0 1px 2px rgba(0,0,0,.12),0 14px 30px -12px rgba(0,0,0,.32);transition:transform .22s ease,box-shadow .22s ease;}
/* Both drop shadows are offset downward, so the top edge gets none of them and a cream
   cover dissolves into the cream page. An inset shadow on the link itself would paint
   under the cover image; a pseudo-element ring paints over it. */
.shp-card__coverlink::after{content:"";position:absolute;inset:0;border-radius:inherit;box-shadow:inset 0 0 0 1px rgba(21,17,14,.06);pointer-events:none;}
.shp-card:hover .shp-card__coverlink{transform:translateY(-4px);box-shadow:0 2px 4px rgba(0,0,0,.14),0 22px 40px -14px rgba(0,0,0,.42);}
.shp-card__title{font-family:var(--shp-serif);font-weight:700;font-size:21px;line-height:1.18;margin:18px 0 0;letter-spacing:-.005em;flex-shrink:0;}
.shp-card__title a:hover{color:var(--shp-navy);}
.shp-card__meta{display:flex;flex-direction:column;gap:2px;margin:12px 0 0;font-size:14.5px;flex-shrink:0;}
.shp-card__imprint{color:var(--shp-ink);}
.shp-card__fmt{color:var(--shp-ink-soft);}
.shp-card__price{color:var(--shp-ink);font-weight:700;margin-top:4px;}
.shp-card__actions{display:grid;grid-template-columns:1fr 1fr;gap:11px;margin-top:auto;padding-top:16px;}
.shp-btn{font-family:var(--shp-sans);font-weight:600;font-size:14px;text-align:center;padding:12px 10px;border-radius:4px;cursor:pointer;transition:all .15s;line-height:1;border:1.5px solid var(--shp-navy);}
.shp-btn--primary{background:var(--shp-navy);color:#fff;}
.shp-btn--primary:hover{background:var(--shp-navy-dk);border-color:var(--shp-navy-dk);}
.shp-btn--ghost{background:transparent;color:var(--shp-navy);}
.shp-btn--ghost:hover{background:var(--shp-navy);color:#fff;}
.shp-empty{grid-column:1/-1;text-align:center;padding:60px 0;color:var(--shp-ink-soft);font-size:18px;}

/* Faux covers */
.shp-cover{position:relative;aspect-ratio:2/3;display:flex;flex-direction:column;align-items:center;justify-content:center;text-align:center;padding:16% 13% 13%;overflow:hidden;background:var(--shp-navy);color:#f3ede0;}
.shp-cover--img{padding:0;background:#e9e3d8;}
.shp-cover--img img{width:100%;height:100%;object-fit:cover;display:block;}
.shp-cover::before{content:"";position:absolute;inset:0;width:9px;background:linear-gradient(90deg,rgba(255,255,255,.16),rgba(255,255,255,0) 60%);}
.shp-cover--img::before{display:none;}
.shp-cover__title{font-family:var(--shp-serif);font-weight:600;font-size:18px;line-height:1.18;letter-spacing:.005em;text-wrap:balance;}
.shp-cover__rule{width:34px;height:1px;background:var(--shp-gold);opacity:.85;}
.shp-cover__rule--top{margin-bottom:16px;}
.shp-cover__rule--bot{margin-top:16px;}
.shp-cover__imprint{position:absolute;bottom:8.5%;left:0;right:0;font-family:var(--shp-sans);font-weight:600;font-size:9.5px;letter-spacing:.18em;text-transform:uppercase;opacity:.72;}
.shp-cover--ebook{background:var(--shp-cream-2);color:var(--shp-navy);}
.shp-cover--ebook .shp-cover__rule{background:var(--shp-navy);opacity:.5;}
.shp-cover--ebook .shp-cover__imprint{opacity:.6;}
.shp-cover__ribbon{position:absolute;top:12px;right:-30px;transform:rotate(45deg);background:var(--shp-navy);color:#fff;font-family:var(--shp-sans);font-weight:700;font-size:9px;letter-spacing:.14em;text-transform:uppercase;padding:4px 34px;}
.shp-cover--booklet{justify-content:flex-start;padding:22% 12% 13%;background:#1f5a8f;}
.shp-cover__d6{font-family:var(--shp-sans);font-weight:800;font-size:21px;letter-spacing:.02em;color:#fff;line-height:1;}
.shp-cover__six{font-size:26px;}
.shp-cover__d6year{font-family:var(--shp-serif);font-style:italic;font-weight:500;font-size:16px;color:rgba(255,255,255,.9);margin-top:10px;}

/* Load more */
.shp-more{display:flex;justify-content:center;margin-top:42px;}
.shp-more .shp-btn{min-width:200px;justify-content:center;}
.shp-more__n{opacity:.65;font-weight:600;margin-left:2px;}

/* Responsive */
@media(max-width:1080px){.shp-grid{grid-template-columns:repeat(3,minmax(0,1fr));}}
@media(max-width:820px){
  /* Controls stack into a tall column here; pinning that would eat most of a phone
     viewport, so it scrolls away instead. */
  .shp-controls{position:static;}
  .shp-grid{grid-template-columns:repeat(2,minmax(0,1fr));}
  .shp-controls{flex-direction:column;align-items:stretch;}
  .shp-toolset{justify-content:space-between;}
  .shp-search input{width:100%;}
}
/* Win over the theme's global a{color:#053b83;text-decoration:underline} on the card buttons */
.shp-card__actions a.shp-btn{text-decoration:none !important;}
.shp-card__actions a.shp-btn--primary,.shp-card__actions a.shp-btn--primary:hover,.shp-card__actions a.shp-btn--primary:focus{color:#fff !important;}
.shp-card__actions a.shp-btn--ghost,.shp-card__actions a.shp-btn--ghost:focus{color:var(--shp-navy) !important;}
.shp-card__actions a.shp-btn--ghost:hover{color:#fff !important;}

/* Below the desktop breakpoint the theme reserves 150px of body padding for its
   position:fixed header, but that header measures 92px at every width from 375 to
   1023 — so 58px of the gap above the title is reserving space for nothing. Same
   problem the min-width:1024px rule above already fixes for desktop; the mobile
   breakpoints were left alone at the time because the header height had not been
   measured. It has now: 92px, consistently. 98 leaves the same small clearance the
   desktop value does. */
@media(max-width:1023px){
  body.page-template-books{padding-top:98px;}
}

/* `1fr` is shorthand for `minmax(auto,1fr)`, and that `auto` lets a column grow past
   its equal share when an item inside will not shrink — which is why the two mobile
   columns came out 170px and 149px against a declared `1fr 1fr`. Every grid rule above
   uses minmax(0,1fr) now so the columns stay equal whatever the content.

   Section padding trimmed to the design's 34px on mobile (it sets .section
   padding:34px 0 90px). 56px is kept from the desktop breakpoint up. */
@media(max-width:1023px){
  .shp-section--top{padding-top:34px;}
}

/* Two-up cards are 160px wide on a 375px screen, which leaves each button 74px — not
   enough for "Learn More" on one line, so both wrapped and came out 54px tall against
   the design's ~38px, with "Buy" sitting alone in an oversized box beside it. The
   design sets these side by side with no mobile override; it was drawn on a desktop
   canvas. Stacking keeps the labels and removes the wrap for ~12px of card height. */
@media(max-width:520px){
  .shp-card__actions{grid-template-columns:minmax(0,1fr);gap:8px;}
}
