/* Cover cards: one system for design case studies and built products.
   Each section is a single row that scrolls sideways and runs off the right edge
   of the page, so the next card is always in view as a cue to keep going. */

.cover-grid {
  display: grid;
  grid-auto-columns: clamp(300px, 36vw, 520px);
  grid-auto-flow: column;
  gap: clamp(14px, 1.6vw, 24px);
  /* Bleed to the page edges while the first card stays on the content margin. */
  margin: clamp(24px, 3vw, 40px) calc(-1 * var(--pad-x)) 0;
  padding: 6px var(--pad-x) 22px;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scroll-padding-inline: var(--pad-x);
  scroll-snap-type: x proximity;
  /* The arrows and the card running off the edge show the way; the bar itself is not drawn. */
  scrollbar-width: none;
}
.cover-grid::-webkit-scrollbar { display: none; }
/* On screens wider than the page column the row stays inside the column: three whole cards,
   their edges in line with the heading and the arrows. */
@media (min-width: 1440px) {
  .cover-grid {
    grid-auto-columns: calc((100% - 48px) / 3);
    gap: 24px;
    /* 4px of room so a focus ring on the first or last card is not cut off. */
    margin-inline: -4px;
    padding-inline: 4px;
    scroll-padding-inline: 4px;
  }
}
/* A mouse can drag the rail; snapping waits until the drag ends. */
@media (hover: hover) {
  .cover-grid { cursor: grab; }
  .cover-grid.is-dragging { cursor: grabbing; scroll-snap-type: none; user-select: none; -webkit-user-select: none; }
  .cover-grid.is-dragging .cover-card { pointer-events: none; }
}
.cover-grid:focus-visible { outline: 3px solid var(--accent); outline-offset: -3px; }

/* Arrows for stepping through a rail with a mouse. */
.rail-arrows { display: flex; gap: 8px; margin-left: auto; }
.rail-arrows[hidden] { display: none; }
.rail-arrows button {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: transparent;
  color: var(--bone);
  font: 400 18px/1 var(--sans);
  cursor: pointer;
  transition: background-color .25s ease, color .25s ease, border-color .25s ease, opacity .25s ease;
}
.rail-arrows button:hover:not(:disabled) { border-color: var(--bone); background: var(--bone); color: var(--ink); }
.rail-arrows button:disabled { cursor: default; opacity: .35; }
.rail-arrows button:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }

.cover-card {
  display: flex;
  flex-direction: column;
  scroll-snap-align: start;
  padding: 8px 8px 18px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--ink-2);
  color: var(--bone);
  text-decoration: none;
  transition: transform .5s var(--ease), box-shadow .5s var(--ease), border-color .3s ease;
}
.cover-card[hidden] { display: none; }

.cover-media {
  position: relative;
  overflow: hidden;
  aspect-ratio: 3 / 2;
  border-radius: 13px;
  background: var(--ink-3);
}
.cover-media img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform .8s var(--ease);
}

.cover-pill {
  position: absolute;
  top: 10px;
  left: 10px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(255, 252, 246, .94);
  color: #2e2927;
  font: 500 12px/1 var(--sans);
  letter-spacing: .01em;
}
.cover-pill.is-live::before,
.cover-pill.is-building::before {
  content: '';
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #2f8f5b;
}
.cover-pill.is-building::before { background: #d98a1f; }

.cover-body {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 8px;
  padding: 16px 10px 0;
}
.cover-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.cover-head h3 {
  margin: 0;
  color: var(--bone);
  font: 500 clamp(20px, 1.7vw, 24px)/1.15 var(--sans);
  letter-spacing: -.02em;
}
.cover-arrow {
  display: grid;
  flex: none;
  place-items: center;
  width: 30px;
  height: 30px;
  border: 1px solid var(--line);
  border-radius: 50%;
  color: var(--bone);
  font-size: 14px;
  line-height: 1;
  transition: background-color .3s ease, color .3s ease, border-color .3s ease, transform .5s var(--ease);
}
.cover-blurb {
  display: -webkit-box;
  overflow: hidden;
  margin: 0;
  color: var(--bone-dim);
  font: 400 16px/1.5 var(--sans);
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-clamp: 2;
}
/* Tags stay in the card so search can find them, but are not drawn. */
.cover-tags { display: none; }
/* The whole card is the link; the call to action is read out but not drawn. */
.cover-cta {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.cover-card:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 3px;
}
@media (hover: hover) {
  .cover-card:hover {
    box-shadow: 0 22px 36px -26px rgba(75, 42, 37, .5);
    transform: translateY(-3px);
  }
  .cover-card:hover .cover-media img { transform: scale(1.03); }
  .cover-card:hover .cover-arrow { transform: rotate(45deg); }
}

@media (max-width: 760px) {
  .cover-grid { grid-auto-columns: 78vw; gap: 12px; }
  .cover-arrow { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .cover-card,
  .cover-media img,
  .cover-arrow { transition: none; }
  .cover-card:hover { transform: none; }
  .cover-card:hover .cover-media img { transform: none; }
}
