/* Home hero: the tab switch and the "already printed" gallery. Loaded only on the front page. */

.cp-hero__stage {
  display: grid;
  gap: var(--cp-space-sm);
  min-width: 0;
}

/* Two tabs share the row and wrap their label: a strip that scrolls would be a scroller inside the page. */
.cp-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: var(--cp-space-2xs);
}

.cp-tab {
  flex: 1 1 auto;
  min-height: var(--cp-control-target-min);
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--cp-line);
  background: var(--cp-sheet);
  color: var(--cp-ink);
  font: 500 var(--cp-text-sm) / 1.2 var(--cp-font-body);
  cursor: pointer;
  transition: border-color var(--cp-duration) var(--cp-ease);
}

.cp-tab:hover {
  border-color: var(--cp-ink);
}

.cp-tab[aria-selected='true'] {
  border-color: var(--cp-ink);
  background: var(--cp-ink);
  color: var(--cp-sheet);
}

/* The panel that is not selected must not keep its box: `hidden` loses to `display: grid`. */
.cp-hero__stage [role='tabpanel'][hidden] {
  display: none;
}

/* home.js gives the incoming panel the height of the outgoing one; this panel fills it. */
/* :not([hidden]) — an id selector would otherwise beat the `hidden` attribute and show it always. */
#hero-panel-fresh:not([hidden]) {
  display: grid;
}

.cp-fresh {
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  border: var(--cp-frame) solid var(--cp-ink);
  background: var(--cp-ink);
  box-shadow: 6px 6px 0 var(--cp-ink);
}

.cp-fresh__main {
  position: relative;
  margin: 0;
  /* Natural shape when nothing is stretching it; the photo grows to fill a taller panel. */
  aspect-ratio: 7 / 6;
  min-height: 0;
  overflow: hidden;
  background: var(--cp-slot-dark);
}

.cp-fresh__image {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.cp-fresh__caption {
  position: absolute;
  inset: auto 0 0;
  padding: var(--cp-space-xl) var(--cp-space-sm) var(--cp-space-sm);
  background: linear-gradient(to top, rgb(0 0 0 / 0.72), transparent);
  color: var(--cp-sheet);
  font-size: var(--cp-text-md);
  font-weight: 600;
  line-height: 1.25;
}

.cp-fresh__strip {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 2px;
  margin: 2px 0 0;
  padding: 0;
  list-style: none;
}

.cp-fresh__thumb {
  display: block;
  width: 100%;
  aspect-ratio: 1;
  padding: 0;
  border: 0;
  outline-offset: -3px;
  background: var(--cp-slot-dark);
  cursor: pointer;
  opacity: 0.6;
  transition: opacity var(--cp-duration) var(--cp-ease);
}

.cp-fresh__thumb img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.cp-fresh__thumb:hover,
.cp-fresh__thumb[aria-pressed='true'] {
  opacity: 1;
}

.cp-fresh__thumb[aria-pressed='true'] {
  outline: 3px solid var(--cp-amber);
}
