/* Cabinhub News — "Continue where you left off" rail (frontend/js/reading.js).
   Part of the newsroom stylesheet set; tokens.css owns every colour, spacing
   and radius, so light and dark are the same rules.

   The brief: the stories this browser already opened, as a short rail above
   the feed. It must read as part of the paper — a standing head, a hairline,
   and one row of stories. No card shadow, no carousel, no count-in-a-circle.
   It is the reader's own history, so it is also quiet and dismissible: the
   two controls sit at the end of the head where a section's furniture lives. */

.cr-rail {
  max-width: var(--page);
  margin: 0 auto;
  padding: var(--sp-4) var(--pad-r) 0 var(--pad-l);
}

/* A rail with nothing in it takes no space at all: `hidden` is set by the
   module, and this rule keeps that true even for an engine that does not
   apply the attribute to a flex child. */
.cr-rail[hidden] { display: none; }

.cr-rail__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--sp-3);
  flex-wrap: wrap;
  border-bottom: 1px solid var(--rule);
  padding-bottom: var(--sp-2);
}

.cr-rail__title {
  margin: 0;
  font-family: var(--font-display);
  font-size: var(--fs-title);
  font-weight: 600;
  color: var(--ink);
}

.cr-rail__actions { display: flex; gap: var(--sp-2); }

/* Both controls are text, not chrome: a reader meets this rail twice a day
   and it must never look like something to operate. 44px hit box on touch. */
.cr-rail__btn {
  appearance: none;
  background: none;
  border: 0;
  padding: var(--sp-1) var(--sp-2);
  min-height: var(--tap);
  font-family: var(--font-ui);
  font-size: var(--fs-meta);
  color: var(--accent);
  cursor: pointer;
  border-radius: var(--r-xs);
}

.cr-rail__btn--quiet { color: var(--ink-faint); }

.cr-rail__btn:hover { color: var(--accent-hover); }

.cr-rail__btn:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

.cr-rail__note {
  margin: var(--sp-2) 0 0;
  font-family: var(--font-ui);
  font-size: var(--fs-micro);
  color: var(--ink-faint);
}

.cr-rail__list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr));
  gap: var(--sp-3) var(--sp-4);
  margin-top: var(--sp-3);
}

/* One story: the headline at reading size, the category and the publisher as
   a meta line. The whole cell is the link, so there is no nested control to
   tab through twice. */
.cr-rail__item {
  display: block;
  padding: var(--sp-2) 0;
  text-decoration: none;
  color: inherit;
  border-top: 1px solid var(--rule-soft);
}

.cr-rail__item:first-child { border-top: 0; }

.cr-rail__item:hover .cr-rail__headline { color: var(--accent); }

.cr-rail__item:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

.cr-rail__headline {
  display: block;
  font-family: var(--font-display);
  font-size: var(--fs-body);
  line-height: 1.3;
  color: var(--ink);
}

.cr-rail__meta {
  display: block;
  margin-top: var(--sp-1);
  font-family: var(--font-ui);
  font-size: var(--fs-micro);
  color: var(--ink-faint);
}

@media (max-width: 640px) {
  .cr-rail { padding-top: var(--sp-3); }
  .cr-rail__list { grid-template-columns: 1fr; }
}