/* ==========================================================================
   Folder card  —  a cover, a title, a date, and what opening it does
   --------------------------------------------------------------------------
   Shared. Loaded by the NSS and NCC pages (their Reports and Gallery tabs,
   and includes/album_folders.html) and by Alumni, whose document tabs were a
   heading over a lone Download button.

   It lived in student-life.css until Alumni needed it, which would have made
   a file named for two Student Life pages the home of a component three
   other things depend on. Moving it was cheaper than either copying it or
   loading that whole file somewhere it does not belong.

   ONE CARD, TWO JOBS. A card that opens a document is an <a>; one that
   reveals something on the page is a <button>. They look identical because
   to a reader they are the same thing: a folder with a date on it.
   ========================================================================== */

/* An author `display` beats the browser's own [hidden] rule whatever the
   specificity, so a grid that the script hides stays on screen without this.
   The same trap is already handled at .faq-item__a and .viewer in main.css. */
.sl-folders[hidden] { display: none; }

.sl-folders {
  display: grid;
  /* auto-fill, not auto-fit: with two reports, auto-fit would stretch them
     across the full 1240px and a document cover would be the size of a
     poster. This leaves the empty columns empty. */
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 20px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.sl-folder {
  position: relative;
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100%;
  overflow: hidden;                /* so the cover takes the card's corners */
  /* Both of these are for the album cards, which are <button>s: a button
     carries its own border and padding, and without zeroing them the cover
     sits inset from the card by a few pixels on three sides. */
  padding: 0;
  border: 0;
  border-radius: var(--radius);
  background: var(--paper);
  box-shadow: var(--shadow-xs);
  text-align: left;
  text-decoration: none;
  cursor: pointer;
  transition: transform .18s ease, box-shadow .18s ease;
}
.sl-folder:hover { transform: translateY(-3px); box-shadow: var(--shadow-sm); }
.sl-folder:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
/* Nothing to open, so nothing that suggests it can be. */
.sl-folder--pending { cursor: default; }
.sl-folder--pending:hover { transform: none; box-shadow: var(--shadow-xs); }

/* The stacked edge above an album's cover: "there are more underneath". Only
   on albums - a report is one document, not a pile. */
.sl-folder__stack {
  display: block;
  height: 6px;
  margin: 0 10px;
  border-radius: var(--radius) var(--radius) 0 0;
  background: rgb(var(--accent-rgb) / 45%);
}

.sl-folder__frame {
  display: block;
  position: relative;
  background: var(--page-alt);
}
.sl-folder__frame img {
  display: block;
  width: 100%;
  height: auto;
  /* Every cover is cropped to the same shape whatever is supplied, so a
     portrait page and a landscape photograph cannot break the row. Documents
     are cropped from the top, where their title is. */
  aspect-ratio: 4 / 3;
  object-fit: cover;
  object-position: center top;
}
/* A report whose PDF has not been collected yet, or one with no cover. */
.sl-folder__blank {
  display: flex;
  align-items: center;
  justify-content: center;
  aspect-ratio: 4 / 3;
  background: rgb(var(--accent-rgb) / 10%);
}
.sl-folder__blank svg { fill: var(--accent-deep); opacity: .55; }

.sl-folder__body {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  align-items: flex-start;
  gap: 5px;
  padding: 14px 16px 16px;
}
.sl-folder__title {
  color: var(--ink);
  font-size: 1rem;
  font-weight: 800;
  line-height: 1.35;
}
.sl-folder__date {
  color: var(--muted);
  font-size: .84rem;
  line-height: 1.5;
}
/* Pushed to the bottom so the cue lines up across a row whatever length the
   titles above it are. */
.sl-folder__cue {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin-top: auto;
  padding-top: 10px;
  color: var(--accent-deep);
  font-size: .8rem;
  font-weight: 700;
}
.sl-folder__cue svg { fill: currentColor; }
.sl-folder__cue--pending {
  color: var(--muted);
  font-weight: 400;
  font-style: italic;
}

@media (prefers-reduced-motion: reduce) {
  .sl-folder { transition: none; }
  .sl-folder:hover { transform: none; }
}


@media (max-width: 575.98px) {
  .sl-folders { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .sl-folder__body { padding: 11px 12px 13px; }
  .sl-folder__title { font-size: .9rem; }
  .sl-folder__date { font-size: .78rem; }
}
