/* /in-review — Year in Review hub (lib/templates/in-review.js). Linked from
   that page only. The year cards borrow the homepage "Previously On" card:
   same box, same maroon Cartridge Soft chip on the top edge, same lists. */

.in-review {
  --ir-maroon: #9c374c;
  --ir-up: #2f7d4f;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .in-review { --ir-up: #4fb07a; }
}
[data-theme="dark"] .in-review { --ir-up: #4fb07a; }

.ir-intro {
  font-size: 1.05rem;
}

.ir-delta {
  font-size: 0.75em;
  font-weight: 600;
  margin-left: 0.15em;
  white-space: nowrap;
}
.ir-delta--up { color: var(--ir-up); }
.ir-delta--down, .ir-delta--flat { color: var(--text-muted); }
.ir-sep { color: var(--text-muted); margin: 0 0.25em; }

/* --- Totals ------------------------------------------------------------------ */
.ir-totals {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.75rem;
  margin: 1.5rem 0 2rem;
}
.ir-totals > div {
  background: var(--callout-bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.75rem 0.9rem 0.65rem;
  display: flex;
  flex-direction: column-reverse;
  justify-content: flex-end; /* the top, in a reversed column: numbers line up */
}
.ir-totals dt {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin: 0.15rem 0 0;
}
.ir-totals dd {
  margin: 0;
  font-family: 'Cartridge Soft', monospace;
  font-size: 1.9rem;
  line-height: 1;
  color: var(--text);
}

/* --- Year picker ------------------------------------------------------------- */
.ir-years {
  display: flex;
  gap: 0.5rem;
  margin: 0 0 0.5rem;
  padding: 0.2rem 0.1rem 0.4rem;
  overflow-x: auto;
  scroll-snap-type: x proximity;
  scrollbar-width: thin;
}
.ir-year {
  flex: 1 0 4.6rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
  padding: 0.6rem 0.3rem 0.55rem;
  background: var(--callout-bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text);
  text-decoration: none;
  scroll-snap-align: center;
  transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}
a.ir-year:hover {
  border-color: var(--ir-maroon);
  color: var(--text);
}
.ir-year:focus-visible {
  outline: 2px solid var(--link);
  outline-offset: 2px;
}
.ir-year[aria-current="true"] {
  background: var(--ir-maroon);
  border-color: var(--ir-maroon);
  color: #fff;
}
.ir-year-num {
  font-family: 'Cartridge', sans-serif;
  font-weight: 700;
  font-size: 1.25rem;
  line-height: 1;
}
.ir-year-word {
  font-family: 'Cartridge Soft', monospace;
  font-size: 0.72rem;
  line-height: 1;
  color: var(--text-muted);
}
.ir-year[aria-current="true"] .ir-year-word { color: rgba(255, 255, 255, 0.85); }
/* The year still under way: a promise, not a link */
.ir-year--next {
  background: transparent;
  border-style: dashed;
  color: var(--text-muted);
}

/* --- Year card (after .feed-prev-on) ----------------------------------------- */
.ir-card {
  position: relative;
  margin: 1.75rem 0 1.5rem;
  background: var(--callout-bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1.5rem 1.5rem 1.15rem;
  scroll-margin-top: calc(var(--anchor-offset) + 1rem);
}
.ir-card[hidden] { display: none; }
.ir-js .ir-card { animation: ir-card-in 0.2s ease both; }
@keyframes ir-card-in {
  from { opacity: 0; transform: translateY(4px); }
}
@media (prefers-reduced-motion: reduce) {
  .ir-js .ir-card { animation: none; }
}

.page-content .ir-card-chip {
  position: absolute;
  top: -0.85em;
  left: 1.25rem;
  margin: 0;
  font-family: 'Cartridge Soft', monospace;
  font-size: 1rem;
  font-weight: 400;
  line-height: normal;
  letter-spacing: 0.02em;
  color: #fff;
  background: var(--ir-maroon);
  padding: 0.2em 0.75em 0.15em;
  border-radius: 4px;
  z-index: 1;
}

.ir-card-desc {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.85rem;
}

.ir-quote {
  margin: 0.85rem 0 1rem;
  padding: 0;
  border: none;
  font-size: 1.15rem;
  font-style: italic;
  color: var(--text);
}
.ir-quote p { margin: 0; }
.ir-quote p::before { content: '“'; }
.ir-quote p::after { content: '”'; }

.ir-card-stats {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem 1rem;
}
.ir-card-stats p {
  margin: 0;
  font-size: 0.9rem;
  color: var(--text-secondary);
}
.ir-card-stats strong { color: var(--text); }
.ir-read {
  display: inline-block;
  padding: 0.4rem 0.85rem;
  border-radius: 6px;
  background: var(--ir-maroon);
  color: #fff;
  font-size: 0.85rem;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
}
.ir-read:hover { color: #fff; filter: brightness(1.1); }

.ir-lists {
  display: grid;
  grid-template-columns: 1.35fr 1fr;
  gap: 1.75rem;
  margin-top: 1.15rem;
  padding-top: 0.9rem;
  border-top: 1px solid var(--border-light);
}
.ir-list-title {
  margin: 0 0 0.2rem;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
}
/* The Previously On list, under its own names (its script fills every
   .previously-on-list on the page) */
.ir-items {
  list-style: none;
  padding: 0;
  margin: 0;
}
.ir-item {
  padding: 0.35rem 0;
  border-bottom: 1px solid var(--border-light);
  line-height: 1.35;
}
.ir-item:last-child { border-bottom: none; }
.ir-item a {
  display: block;
  font-weight: 600;
  font-size: 0.88rem;
  text-decoration: none;
  color: var(--link);
}
.ir-item a:hover { text-decoration: underline; }
.ir-item-meta {
  display: block;
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 0.1rem;
}
/* A highlight is a heading's worth of inline text — "[[Chapter Select]]
   (duh)", or two links joined by "and" — so its links stay inline. */
.ir-hl {
  font-size: 0.88rem;
  color: var(--text-muted);
}
.ir-item.ir-hl a { display: inline; }
.ir-more {
  display: inline-block;
  margin-top: 0.35rem;
  font-size: 0.78rem;
  font-weight: 600;
  text-decoration: none;
}
.ir-more:hover { text-decoration: underline; }

/* --- Games shelf ------------------------------------------------------------ */
.ir-games {
  margin-top: 1.15rem;
  padding-top: 0.9rem;
  border-top: 1px solid var(--border-light);
}
.ir-game-shelf {
  list-style: none;
  margin: 0.45rem 0 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 1rem 0.85rem;
}
.ir-game { margin: 0; }
.ir-game > a, .ir-game > span {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.45rem;
  text-decoration: none;
  color: var(--text);
}
/* Whole box art at its own aspect ratio in a fixed footprint, bottoms lined
   up like a shelf; shadow and radius sit on the art itself (as on the Game of
   the Day cover). */
.ir-game-art {
  position: relative;
  width: 100%;
  height: 8.25rem;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}
.ir-game-art img {
  display: block;
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  border-radius: 4px;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.35);
  transition: transform 0.15s ease;
}
.ir-game > a:hover .ir-game-art img { transform: translateY(-3px); }
/* Not in the Game Library yet: a plain case-shaped tile */
.ir-game-none {
  width: 78%;
  height: 100%;
  box-sizing: border-box;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-light);
  color: var(--text-muted);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.12);
  transition: transform 0.15s ease;
}
.ir-game-none svg { width: 38%; height: auto; opacity: 0.45; }
.ir-game > a:hover .ir-game-none { transform: translateY(-3px); }
.ir-game-rank {
  position: absolute;
  top: -0.45rem;
  left: -0.1rem;
  min-width: 1.6rem;
  height: 1.6rem;
  padding: 0 0.2rem;
  box-sizing: border-box;
  border-radius: 999px;
  background: var(--ir-maroon);
  color: #fff;
  font-family: 'Cartridge Soft', monospace;
  font-size: 0.85rem;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  transform: rotate(-8deg);
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.3);
  z-index: 1;
}
.ir-game-title {
  font-size: 0.75rem;
  font-weight: 600;
  line-height: 1.25;
  text-align: center;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.ir-game > a .ir-game-title { color: var(--link); }
.ir-game > a:hover .ir-game-title { text-decoration: underline; }
.ir-game--noart .ir-game-title { color: var(--text-secondary); }

/* --- Small screens ----------------------------------------------------------- */
@media (max-width: 640px) {
  .ir-totals { gap: 0.5rem; }
  .ir-totals > div { padding: 0.65rem 0.7rem 0.55rem; }
  .ir-totals dd { font-size: 1.4rem; }
  .ir-card { padding: 1.4rem 1rem 1rem; }
  .page-content .ir-card-chip { left: 0.85rem; font-size: 0.92rem; }
  .ir-lists { grid-template-columns: 1fr; gap: 1rem; }
  /* A sideways-scrolling shelf rather than a tall stack of rows */
  .ir-game-shelf {
    display: flex;
    overflow-x: auto;
    scroll-snap-type: x proximity;
    margin-right: -1rem;
    padding: 0.5rem 1rem 0.35rem 0.15rem;
    gap: 0.85rem;
  }
  .ir-game { flex: 0 0 5.75rem; scroll-snap-align: start; }
  .ir-game-art { height: 7.25rem; }
}
