/* ==========================================================================
   publications.css — loaded after style.css.

   1. Brings the page in line with the rest of brunodavidgallery.com: the same
      typefaces (Urbanist for headings, Poppins for text, Roboto Condensed for
      the gallery name), the same sizes, light weights and hairline rules.
   2. The top of the library: the title and the "Selected publications" row of covers.
   3. The list: a bar with its heading, search and the artist menu, then every
      publication as a uniform tile with a caption underneath.
   ========================================================================== */

/* ── 1. The gallery site's type, colour and lines ───────────────────────── */
:root {
  --font-primary: 'Poppins', 'Helvetica Neue', Arial, sans-serif;
  --font-heading: 'Urbanist', 'Poppins', 'Helvetica Neue', Arial, sans-serif;
  --font-brand: 'Roboto Condensed', 'Arial Narrow', Arial, sans-serif;
  --color-bg: #ffffff;                        /* a white page; the gallery site itself is #fafafa */
  --color-text: #28282a;
  --color-text-muted: #6f6f72;
  --color-border: rgba(40, 40, 42, .13);      /* hairlines */
  --header-height: 76px;
  --site-text: .9rem;                         /* 14.4px, the site's text size */
  /* The page uses the width of the window, as the main site does, with that site's 3vw at each
     side (style.css had capped it at 1400px, which left wide bands of white on large screens). */
  --max-width: 2800px;
  --site-gutter: clamp(2rem, 3vw, 4.5rem);
}

/* Header, as on the gallery site: the name, this page as "/ PUBLICATIONS", and one link.
   Like the site's own header it has no rule under it and scrolls away with the page. */
#site-header { position: static; border-bottom: 0; }
.header-inner { gap: 0; padding: 0 var(--site-gutter); }
.site-title {
  font-family: var(--font-brand); font-weight: 700; font-size: clamp(1.3rem, 2.87vw, 1.875rem);
  letter-spacing: 1px; text-transform: uppercase; line-height: 1;
}
.site-nav { flex: 1 1 auto; gap: 0; overflow: visible; }
.nav-link {
  font-size: var(--site-text); font-weight: 400; letter-spacing: 0; text-transform: none;
  color: var(--color-text); padding: .5rem 0;
}
.nav-link::after { display: none; }
.nav-link--home {
  font-family: var(--font-brand); font-size: clamp(1.3rem, 2.87vw, 1.875rem); font-weight: 400;
  letter-spacing: 1px; text-transform: uppercase; line-height: 1; padding: 0 0 0 9px;
}
.nav-link--home::before { content: '/'; opacity: .45; margin-right: 9px; }
.nav-link--purchase { margin-left: auto; color: var(--color-text); }
.nav-link--purchase:hover, .nav-link--home:hover { color: var(--color-text); opacity: .6; }

/* Lighter weights elsewhere in the app (reader, messages). */
.reader-back { font-weight: 400; letter-spacing: .04em; }
.reader-title { font-family: var(--font-heading); font-weight: 500; font-size: 1rem; letter-spacing: 0; }
.related-title, .shortcuts-heading { font-family: var(--font-heading); font-weight: 500; letter-spacing: -.01em; }
.related-card-title { font-weight: 500; }
.loading-state, .no-results { font-size: var(--site-text); }

/* ── 2. The top of the library ──────────────────────────────────────────── */
/* The old hero wrapper steps aside: the section brings its own spacing. */
#hero-section { max-width: none; padding: 0; }

.sp {
  --sp-h: clamp(160px, 23.5vw, 400px);        /* height of a cover: about three across  */
  --sp-w: calc(var(--sp-h) * 1.294);          /* every cover is 11 x 8.5                */
  --sp-gap: clamp(1rem, 1.9vw, 1.75rem);
  --sp-caption: 4.1rem;                       /* room under a cover for its name        */
  color: var(--color-text);
}
.sp[hidden] { display: none; }
.sp-inner { max-width: var(--max-width, 1400px); margin: 0 auto; padding: 0 var(--site-gutter); }

/* Same type and spacing as the "Exhibitions" title on the gallery site. */
.sp-title {
  margin: 0; padding-top: 60px;
  font-family: var(--font-heading); font-weight: 400; font-size: min(4rem, calc(3.6vw + 1rem));
  letter-spacing: -.02em; line-height: 1.056;
}
/* Section labels, as "CURRENT EXHIBITIONS" on the gallery site. */
.sp-label {
  margin: 0; font-family: var(--font-primary); font-size: 1.125rem; font-weight: 400;
  letter-spacing: 3px; line-height: 1.5; text-transform: uppercase;
}
.sp-label[hidden] { display: none; }
.sp-title + .sp-label { margin-top: 56px; }

/* The row itself: covers only, edge to edge, moved by selected.js with a transform. */
.sp-viewport {
  margin-top: calc(1.9rem - 12px); touch-action: pan-y;
  overflow: hidden; overflow: clip;           /* clip where supported: nothing here should ever scroll */
  -webkit-user-select: none; user-select: none; cursor: grab;
  min-height: calc(var(--sp-h) + var(--sp-caption) + 12px);   /* holds its place while covers load */
}
.sp-viewport[hidden] { display: none; }
.sp--dragging .sp-viewport { cursor: grabbing; }
.sp--dragging .sp-card { pointer-events: none; }
.sp-track {
  position: relative; display: flex; gap: var(--sp-gap); width: max-content;
  list-style: none; margin: 0; padding: 12px 0 0; will-change: transform;   /* room for the lift and the focus ring */
  opacity: 0; transition: opacity .7s ease;   /* fades in once selected.js has laid it out */
}
.sp--ready .sp-track { opacity: 1; }
.sp-item { flex: 0 0 var(--sp-w); width: var(--sp-w); }
.sp-card { display: block; color: inherit; text-decoration: none; -webkit-user-drag: none; }
.sp-cover {
  position: relative; display: block; width: var(--sp-w); height: var(--sp-h); overflow: hidden;
  background: #f1f0ed; transition: transform .6s cubic-bezier(.22, 1, .36, 1), box-shadow .6s ease;
}
.sp-cover img { position: absolute; inset: 0; width: 100%; height: 100%; max-width: none; object-fit: cover; }
/* a hairline so a white or pale cover keeps its edge against the white page */
.sp-cover::after { content: ''; position: absolute; inset: 0; box-shadow: inset 0 0 0 1px rgba(40, 40, 42, .08); pointer-events: none; }
.sp-card:hover .sp-cover, .sp-card:focus-visible .sp-cover {
  transform: translateY(-6px); box-shadow: 0 26px 34px -24px rgba(0, 0, 0, .45);
}
.sp-card:focus-visible { outline: none; }
.sp-card:focus-visible .sp-cover { outline: 1px solid var(--color-text); outline-offset: 3px; }
/* seen only if a cover will not load */
.sp-ph { position: absolute; inset: 0; display: none; flex-direction: column; justify-content: flex-end; gap: .3rem; padding: 1.25rem; }
.sp-cover.no-img .sp-ph { display: flex; }
.sp-ph span { font-size: .75rem; letter-spacing: .14em; text-transform: uppercase; }
.sp-ph b { font-family: var(--font-heading); font-size: 1.5rem; font-weight: 400; letter-spacing: -.02em; line-height: 1.1; }

/* The name of a cover: there only while the cover is pointed at, or has keyboard focus. */
.sp-caption {
  display: block; height: var(--sp-caption); padding-top: 1rem; overflow: hidden;
  opacity: 0; transform: translateY(-5px);
  transition: opacity .3s ease, transform .5s cubic-bezier(.22, 1, .36, 1);
}
.sp-card:hover .sp-caption, .sp-card:focus-visible .sp-caption { opacity: 1; transform: none; transition-delay: .08s; }
.sp-name {
  display: block; font-family: var(--font-heading); font-size: 1.2rem; font-weight: 400;
  letter-spacing: -.02em; line-height: 1.2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.sp-sub {
  display: block; margin-top: .3rem; font-size: var(--site-text); line-height: 1.5; color: var(--color-text-muted);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* ── 3. The list ────────────────────────────────────────────────────────── */
/* Its bar: the heading, with search and the artist menu beside it, between two
   hairlines. It stays at the top of the window while the list is scrolled, so
   both are always to hand. The space the cover names appear in is most of the
   gap above it; .list-top is the rest. */
.list-top { height: 1.25rem; }
.list-bar { position: sticky; top: 0; z-index: 50; background: var(--color-bg); }
.list-bar-inner { max-width: var(--max-width, 1400px); margin: 0 auto; padding: 0 var(--site-gutter); }
.list-bar-row {
  display: flex; align-items: center; justify-content: space-between; gap: 2rem; min-height: 4.25rem;
  border-top: 1px solid var(--color-border); border-bottom: 1px solid var(--color-border);
}
.list-tools { display: flex; align-items: center; gap: 2.25rem; min-width: 0; }
.list-tools .search-input, .list-tools .sort-select {
  -webkit-appearance: none; appearance: none; height: 2.5rem; border: 0; border-radius: 0;
  font-family: var(--font-primary); font-size: var(--site-text); color: var(--color-text);
}
.list-tools .search-input {
  width: 13rem; padding: 0 0 0 1.75rem;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 16 16' fill='none' stroke='%2328282a' stroke-width='1.1' stroke-linecap='round'%3E%3Ccircle cx='7' cy='7' r='4.6'/%3E%3Cpath d='M10.6 10.6 14 14'/%3E%3C/svg%3E") no-repeat left center / 1rem;
}
.list-tools .search-input::placeholder { color: var(--color-text-muted); opacity: 1; }
/* library.js keeps the menu as wide as the name it shows, so its arrow sits beside the text */
.list-tools .sort-select { min-width: 0; max-width: 17rem; padding: 0 1.4rem 0 0; background-position: right 2px center; text-overflow: ellipsis; }
/* the one in use gets a line under it, in place of the browser's outline */
.list-tools .search-input:focus-visible, .list-tools .sort-select:focus-visible { outline: none; }
.list-tools .search-input:focus, .list-tools .sort-select:focus-visible { box-shadow: inset 0 -1px 0 var(--color-text); }
/* the small cross that clears a search */
.list-tools .search-input::-webkit-search-cancel-button {
  -webkit-appearance: none; appearance: none; width: .8rem; height: .8rem; margin-left: .4rem; cursor: pointer; opacity: .55;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12' fill='none' stroke='%2328282a' stroke-width='1.1' stroke-linecap='round'%3E%3Cpath d='M2 2l8 8M10 2l-8 8'/%3E%3C/svg%3E") no-repeat center / contain;
}

/* A search may leave only a few results. The list keeps at least a window's height, so the
   bar can stay at the top with those results under it (see _showResultsFromTop in library.js). */
.list-body { min-height: 100vh; }
#catalog-grid.catalog-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 3.25rem 1.75rem;
  padding: 2.25rem var(--site-gutter) 4rem;
}
#catalog-grid .catalog-card { min-width: 0; }
#catalog-grid .card-image-wrap {
  aspect-ratio: 1 / 1; display: grid; place-items: center; padding: 12%; margin-bottom: 1rem; background: #f1f0ed;
}
#catalog-grid .card-image-wrap .cover-img {
  width: 100%; height: auto;
  box-shadow: 0 1px 1px rgba(0, 0, 0, .05), 0 14px 24px -14px rgba(0, 0, 0, .45);
  transition: opacity .4s ease, transform .5s cubic-bezier(.22, 1, .36, 1), box-shadow .5s ease;
}
#catalog-grid .catalog-card:hover .card-image-wrap .cover-img {
  transform: translateY(-6px);
  box-shadow: 0 1px 1px rgba(0, 0, 0, .05), 0 24px 30px -18px rgba(0, 0, 0, .45);
}
#catalog-grid .card-cover-placeholder { background-color: #f1f0ed !important; }
#catalog-grid .catalog-card:hover .card-cover-placeholder { transform: none; }
#catalog-grid .placeholder-title { font-family: var(--font-heading); font-weight: 400; }
#catalog-grid .catalog-card:focus-visible { outline: 1px solid var(--color-text); outline-offset: 6px; }
#catalog-grid .card-artist {
  margin: 0 0 .2rem; font-family: var(--font-heading); font-size: 1.125rem; font-weight: 400;
  letter-spacing: -.02em; line-height: 1.25; text-transform: none; color: var(--color-text);
}
#catalog-grid .card-title {
  margin: 0; font-size: var(--site-text); font-weight: 400; font-style: normal; letter-spacing: 0;
  line-height: 1.5; color: var(--color-text-muted);
}
#catalog-grid .catalog-card:hover .card-title { text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 4px; }
/* a long unbroken title ("Strats/DADADADA/Complications") must wrap, not widen the page */
#catalog-grid .card-artist, #catalog-grid .card-title { overflow-wrap: anywhere; }
.no-results { padding: 3rem var(--site-gutter) 6rem; color: var(--color-text-muted); }

/* ── Touch screens ──────────────────────────────────────────────────────── */
/* No pointer to rest on a cover: no names in the row, and the gap closes up.
   Text you type into is 16px, so an iPhone does not zoom the page on focus. */
@media (hover: none) {
  .sp { --sp-caption: 0rem; }
  .sp-caption { display: none; }
  .list-top { height: 3.25rem; }
  .list-tools .search-input, .list-tools .sort-select { font-size: 1rem; }
}

/* ── Wider and narrower screens ─────────────────────────────────────────── */
/* More columns on wide screens, so the tiles keep their size instead of growing. */
@media (min-width: 1600px) {
  #catalog-grid.catalog-grid { grid-template-columns: repeat(5, minmax(0, 1fr)); }
}
@media (min-width: 2100px) {
  #catalog-grid.catalog-grid { grid-template-columns: repeat(6, minmax(0, 1fr)); }
}
@media (max-width: 1024px) {
  #catalog-grid.catalog-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 768px) {
  :root { --site-gutter: 1rem; }
  .header-inner { padding: .9rem var(--site-gutter) .3rem; column-gap: .75rem; row-gap: .35rem; }
  .site-title { flex: 1 1 auto; font-size: clamp(1.05rem, 5.1vw, 1.3rem); }   /* the name and the link share a line down to 360px */
  .site-nav { flex: 0 0 auto; }
  .nav-link--purchase { margin: 0; padding: .25rem 0; font-size: .78rem; }
  .sp-title { padding-top: 36px; }
  .sp-title + .sp-label { margin-top: 34px; }
  .sp-label { font-size: .95rem; letter-spacing: 2.5px; }
  .sp-viewport { margin-top: calc(1.4rem - 12px); }
  /* The list bar: the heading on one line, the tools on the next. Scrolled, the
     heading tucks away above the window and only the tools stay. */
  .list-bar { top: calc(-3.25rem - 1px); }
  .list-bar-row { display: block; min-height: 0; }
  .list-bar-label { display: flex; align-items: center; height: 3.25rem; }
  .list-tools { gap: 1rem; height: 3.25rem; }
  .list-tools .search-input { flex: 1 1 0; width: auto; min-width: 0; }       /* search takes what the menu leaves */
  .list-tools #artist-filter { display: block; flex: 0 0 auto; min-width: 0; max-width: 55%; }
  #catalog-grid.catalog-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 2.25rem 1rem; padding: 1.5rem var(--site-gutter) 3rem; }
  #catalog-grid .card-artist { font-size: 1.05rem; }
}

@media (prefers-reduced-motion: reduce) {
  .sp-track, .sp-cover, .sp-caption, #catalog-grid .card-image-wrap .cover-img { transition: none; }
}
