/* ==========================================================================
   FUNDER — gallery view (גלריה)
   --------------------------------------------------------------------------
   The printed issues, as a sixth state of the homepage view switch.

   It behaves like the other non-editorial views: the magazine composition
   and the sidebar step aside and the gallery takes the column. Those rules
   live here rather than in 12-chrono.css so that adding a view means adding
   a file, not editing four selector lists.

   The grid is `auto-fill` on a minimum cover width rather than a fixed
   column count, so the same declaration serves 320px and 1920px: covers
   stay between 140 and ~200px wide and the row simply holds more of them on
   a wide screen. That is also why there is no breakpoint in this file.
   ========================================================================== */

/* View switching moved to 29-views.css, which owns it for all six modes.
   Repeating the hide-list here was how כתבות במוקד ended up rendering
   under the gallery: a list of things to hide cannot know about a block
   added to the page later. */

/* The view's own container is hidden by the `hidden` attribute, which
   fn-gallery.js owns, so there is no CSS rule to keep in step with it. */
.fn-ui .fn-gallery[hidden] {
  display: none;
}

.fn-ui .fn-gallery {
  margin: 0 0 var(--fn-space-8);
}

.fn-ui .fn-gallery__grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 20px 16px;
  align-items: start;
}

.fn-ui .fn-gallery__item {
  display: flex;
  flex-direction: column;
  gap: 8px;
  text-decoration: none;
  color: inherit;
  -webkit-tap-highlight-color: transparent;
}

.fn-ui .fn-gallery__item:hover,
.fn-ui .fn-gallery__item:focus {
  text-decoration: none;
  color: inherit;
}

.fn-ui .fn-gallery__item:focus-visible {
  outline: var(--fn-focus-width) solid var(--fn-focus);
  outline-offset: 3px;
  border-radius: 4px;
}

/* The cover plate. aspect-ratio plus the img's own width/height means the
   grid reaches its final geometry before any image loads — opening the view
   must not reflow once twelve covers arrive. */
.fn-ui .fn-gallery__cover {
  position: relative;
  display: block;
  width: 100%;
  aspect-ratio: 3 / 4;
  border-radius: var(--fn-bubble-radius, 14px) var(--fn-bubble-radius, 14px) 0 0;
  overflow: hidden;
  background: var(--fn-bubble-skeleton, var(--fn-bg-sunken));
  box-shadow: 0 10px 28px -18px rgba(14, 20, 16, 0.55);
  line-height: 0;
  transition: transform var(--fn-dur-fast) var(--fn-ease),
              box-shadow var(--fn-dur-fast) var(--fn-ease);
}

:root[data-fn-theme="dark"] .fn-ui .fn-gallery__cover {
  box-shadow: 0 12px 30px -16px rgba(0, 0, 0, 0.75);
}

.fn-ui .fn-gallery__item:hover .fn-gallery__cover {
  transform: translateY(-2px);
  box-shadow: 0 16px 34px -18px rgba(14, 20, 16, 0.62);
}

.fn-ui .fn-gallery__img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center top;
}

.fn-ui .fn-gallery__img.is-broken {
  display: none;
}

/* A cover the CDN will not serve keeps its plate and shows the issue name,
   rather than a browser's broken-image glyph. */
.fn-ui .fn-gallery__fallback {
  display: none;
  position: absolute;
  inset: 0;
  align-items: flex-end;
  padding: 10px;
  font-size: 12px;
  font-weight: var(--fn-fw-bold);
  line-height: 1.25;
  color: var(--fn-text-2);
  text-align: start;
}

.fn-ui .fn-gallery__img.is-broken + .fn-gallery__fallback {
  display: flex;
}

.fn-ui .fn-gallery__label {
  font-size: var(--fn-fs-sm);
  font-weight: var(--fn-fw-medium);
  line-height: 1.3;
  color: var(--fn-text-2);
  text-align: center;
  transition: color var(--fn-dur-fast) var(--fn-ease);
}

.fn-ui .fn-gallery__item:hover .fn-gallery__label {
  color: var(--fn-interactive-ink);
}

/* The last tile is the way out to the full archive. It is deliberately a
   tile and not a button: it belongs to the same row of covers, so it is
   where a reader who has reached the end of twelve issues is already
   looking. */
.fn-ui .fn-gallery__cover--archive {
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--fn-bubble-radius, 14px);
  border: 1px dashed var(--fn-border-strong);
  background: transparent;
  box-shadow: none;
}

.fn-ui .fn-gallery__cover--archive::after {
  content: "";
  width: 22px;
  height: 22px;
  border-top: 2px solid var(--fn-interactive);
  border-left: 2px solid var(--fn-interactive);
  transform: rotate(-45deg);
  margin-inline-start: 6px;
}

.fn-ui .fn-gallery__item--archive:hover .fn-gallery__cover--archive {
  border-color: var(--fn-interactive);
  transform: none;
  box-shadow: none;
}

.fn-ui .fn-gallery__status {
  margin: var(--fn-space-4) 0 0;
  color: var(--fn-text-3);
  font-size: var(--fn-fs-base);
  text-align: center;
}

.fn-ui .fn-gallery__status[hidden] {
  display: none;
}

/* The archive page sits the same covers inside the list deck. The homepage
   gallery is not in a deck, so this inset does not move it. */
.fn-ui .fn-list-deck > .fn-gallery {
  margin: 0;
  padding: 16px;
}

@media (max-width: 767px) {
  .fn-ui .fn-list-deck > .fn-gallery {
    padding: 12px;
  }

  .fn-ui .fn-gallery {
    padding-inline: var(--fn-bubble-gutter, 12px);
  }

  .fn-ui .fn-gallery__grid {
    grid-template-columns: repeat(auto-fill, minmax(104px, 1fr));
    gap: 16px 12px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .fn-ui .fn-gallery__cover,
  .fn-ui .fn-gallery__item:hover .fn-gallery__cover {
    transition: none;
    transform: none;
  }
}
