/* ==========================================================================
   programme.css: THE PROGRAMME ("where to play"), a cinema listing of all nine.
   Real <table>, rows laid out as grids (explicit ARIA roles keep table semantics).
   Scope: .prog-*
   ========================================================================== */

.prog-root { position: relative; }
.prog-sheet { position: relative; }

.prog-table {
  --pc-no: clamp(44px, 5vw, 76px);
  --pc-steam: clamp(170px, 15vw, 214px);
  --pc-itch: clamp(150px, 12.5vw, 178px);
  --pc-gap: clamp(14px, 2vw, 30px);
  --pc-listings: calc(var(--pc-steam) + var(--pc-itch) + 2 * var(--pc-gap));
  --tt:clamp(25px, 2.75vw, 40px);           /* title size */
  --tt-line: calc(var(--tt) * 1.08);         /* title first line, used to align the other cells */
  display: block;
  width: 100%;
  border-collapse: collapse;
  border-top: 3px solid var(--bone-2);
}
/* printed programme: a heavy rule and a hairline under it */
.prog-table::before {
  content: '';
  display: block;
  height: 1px;
  margin-top: 3px;
  background: var(--line-2);
}
.prog-table thead,
.prog-table tbody { display: block; }
.prog-table tr {
  display: grid;
  grid-template-columns: var(--pc-no) minmax(0, 1fr) var(--pc-steam) var(--pc-itch);
  column-gap: var(--pc-gap);
  align-items: start;
}
.prog-table th,
.prog-table td {
  display: block;
  text-align: left;
  font-weight: inherit;
  min-width: 0;
}

/* ── Column heads ───────────────────────────────────────────────────── */
.prog-head { padding: 14px 0 12px; }
.prog-table .prog-head th {
  display: flex;
  align-items: center;
  gap: .7em;
  font-family: var(--f-pixel);
  font-size: 11px;
  line-height: 1.2;
  letter-spacing: .28em;
  text-transform: uppercase;
  color: var(--fog);
}
.prog-head .ic { width: 14px; height: 14px; color: var(--bone-2); }
.prog-h-no { padding-left: 18px; }

/* ── Group subheads: "Now showing" / "Coming soon" ───────────────────── */
.prog-sub { padding: clamp(30px, 4.2vw, 54px) 0 14px; }
.prog-group:first-of-type .prog-sub { padding-top: clamp(20px, 2.4vw, 30px); }
.prog-table .prog-sub th {
  grid-column: 1 / -1;
  display: flex;
  align-items: baseline;
  gap: 14px;
  font-family: var(--f-pixel);
  font-size: 12px;
  line-height: 1.2;
  letter-spacing: .26em;
  text-transform: uppercase;
  color: var(--bone-2);
}
.prog-sub-en::before {
  content: '';
  display: inline-block;
  width: 8px; height: 8px;
  margin-right: 12px;
  background: var(--bone-2);
  transform: translateY(-1px);
}
[data-group="now"] .prog-sub-en::before { background: var(--seal); box-shadow: 0 0 12px rgba(217, 72, 44, .6); }
.prog-sub-jp { color: var(--seal-hot); letter-spacing: .14em; }
[data-group="soon"] .prog-sub-jp { color: var(--fog); }
.prog-sub-rule {
  flex: 1;
  min-width: 24px;
  height: 1px;
  background-image: linear-gradient(90deg, var(--line-2) 50%, transparent 0);
  background-size: 6px 1px;
  align-self: center;
}
.prog-sub-count { color: var(--fog); letter-spacing: .2em; }

/* ── Rows ───────────────────────────────────────────────────────────── */
.prog-table .prog-row {
  position: relative;
  isolation: isolate;
  padding: clamp(16px, 1.8vw, 24px) 0;
  border-top: 1px solid var(--line);
  -webkit-tap-highlight-color: transparent;
  /* arrow keys / d-pad bring the whole row into view, clear of the fixed bars */
  scroll-margin-block: 12px 28px;
}
@media (max-width: 860px) {
  .prog-table .prog-row { scroll-margin-bottom: calc(var(--thumb-h) + var(--safe-b) + 16px); }
}
.prog-group .prog-row:last-child { border-bottom: 1px solid var(--line); }

/* the art strip: a slice of the game's key art wipes in behind the row */
.prog-row::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: -1;
  /* the art shows through the gap between title and listings, and stays dark under the words */
  background:
    linear-gradient(90deg,
      rgba(12, 10, 8, .95) 0%,
      rgba(12, 10, 8, .82) 22%,
      rgba(12, 10, 8, .34) calc(100% - var(--pc-listings) - 150px),
      rgba(12, 10, 8, .62) calc(100% - var(--pc-listings) - 50px),
      rgba(12, 10, 8, .94) calc(100% - var(--pc-listings) + 12px),
      rgba(12, 10, 8, .96) 100%),
    var(--row-art, none) var(--row-focus, 50% 50%) / cover no-repeat,
    var(--ink-2);
  clip-path: inset(0 100% 0 0);
  transition: clip-path .75s var(--ease-out);
}
/* per-game accent edge */
.prog-row::after {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 3px;
  z-index: 1;
  background: var(--row-acc, var(--seal));
  transform: scaleY(0);
  transform-origin: top;
  transition: transform .5s var(--ease-out);
  pointer-events: none;
}

/* number column + the 1P cursor (beats the generic td display:block above) */
.prog-table .prog-no {
  display: flex;
  align-items: center;
  gap: 6px;
  height: var(--tt-line);
  font-family: var(--f-pixel);
  font-size: 14px;
  letter-spacing: .12em;
  color: var(--fog);
  transition: color .3s;
}
.prog-cursor {
  flex: none;
  width: 12px;
  font-size: 11px;
  color: var(--row-acc, var(--seal));
  opacity: 0;
  transform: translateX(-6px);
  transition: opacity .25s, transform .35s var(--ease-out);
}

/* title: stretched link covers the row; store chips sit above it */
.prog-game { position: static; }
.prog-line {
  display: flex;
  align-items: baseline;
  gap: .9em;
  min-height: var(--tt-line);
}
.prog-link {
  display: block;
  min-width: 0;
  color: var(--bone);
}
/* programme leader dots, from the title across to the listings */
.prog-leader {
  flex: 1 1 auto;
  min-width: 28px;
  height: 0;
  border-bottom: 2px dotted rgba(239, 230, 214, .16);
  transform: translateY(-.28em);
  transition: border-color .4s;
}
.prog-link::after {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 1;
}
.prog-link:focus-visible { outline: none; }
.prog-link:focus-visible::after { outline: 2px solid var(--gold); outline-offset: -2px; }
.prog-title {
  display: block;
  font-family: var(--f-display);
  font-weight: 800;
  font-size: var(--tt);
  line-height: 1.08;
  letter-spacing: -.005em;
  font-feature-settings: 'palt';
  transition: transform .5s var(--ease-out), color .3s;
}
.prog-jp {
  flex: none;
  font-family: var(--f-display);
  font-weight: 700;
  font-size: 12.5px;
  letter-spacing: .16em;
  white-space: nowrap;
  color: var(--fog-2);
  transition: color .3s;
}
.prog-genre {
  display: block;
  margin-top: 7px;
  font-size: 14.5px;
  line-height: 1.45;
  color: var(--fog);
  transition: color .3s;
}

/* platform cells */
.prog-steam, .prog-itch {
  padding-top: max(0px, calc((var(--tt-line) - 28px) / 2));
}
.prog-chip {
  gap: .55em;
  padding: 6px 10px 5px;
  font-size: 12px;
  line-height: 1.2;
}
.prog-chip .ic { width: 14px; height: 14px; }
.prog-chip .prog-ext { width: 11px; height: 11px; opacity: .72; margin-left: -.1em; }
a.prog-chip {
  position: relative;
  z-index: 2;
  transition: background-color .2s, color .2s, border-color .2s, transform .16s var(--ease-out), box-shadow .16s var(--ease-out);
}
/* invisible 44px+ hit area around the small chip */
a.prog-chip::before {
  content: '';
  position: absolute;
  inset: -10px -8px;
}
a.prog-chip:active { transform: translate(1px, 1px); }
@media (hover: hover) {
  a.chip--out.prog-chip:hover { background: var(--seal); border-color: var(--seal); color: #fff7ee; transform: translate(-1px, -1px); box-shadow: 3px 3px 0 rgba(0, 0, 0, .55); }
  a.chip--wish.prog-chip:hover { background: var(--gold); border-color: var(--gold); color: #1a1206; transform: translate(-1px, -1px); box-shadow: 3px 3px 0 rgba(0, 0, 0, .55); }
}
a.prog-chip:focus-visible { outline-offset: 4px; }
/* nine identical itch.io chips: keep the itch colour but let red stay the "Out now" signal */
.prog-itch .chip--itch {
  border-color: rgba(255, 122, 122, .4);
  background: transparent;
  color: rgba(255, 138, 128, .86);
}
.prog-when {
  display: block;
  margin-top: 9px;
  font-family: var(--f-pixel);
  font-size: 12px;
  letter-spacing: .14em;
  color: var(--fog);
}
.prog-row[data-status="out"] .prog-when { color: var(--bone-2); }

/* split-flap word: fixed-width cells so flicking letters never move anything */
.prog-flap {
  display: inline-flex;
  letter-spacing: 0;
}
.pf-c {
  display: inline-block;
  width: calc(1ch + .14em);
  text-align: center;
}
.is-flapping .prog-chip { transition: none; }

/* ── Active row: hover (mouse) and focus (keyboard, controller) ──────── */
.prog-row:focus-within::before { clip-path: inset(0); }
.prog-row:focus-within::after { transform: scaleY(1); }
.prog-row:focus-within .prog-cursor { opacity: 1; transform: none; }
.prog-row:focus-within .prog-no { color: var(--bone); }
.prog-row:focus-within .prog-title { transform: translateX(8px); }
.prog-row:focus-within .prog-jp { color: var(--bone-2); }
.prog-row:focus-within .prog-genre { color: var(--bone-2); }
.prog-row:focus-within .prog-leader { border-color: rgba(239, 230, 214, .38); }
@media (hover: hover) {
  .prog-row:hover::before { clip-path: inset(0); }
  .prog-row:hover::after { transform: scaleY(1); }
  .prog-row:hover .prog-cursor { opacity: 1; transform: none; }
  .prog-row:hover .prog-no { color: var(--bone); }
  .prog-row:hover .prog-title { transform: translateX(8px); }
  .prog-row:hover .prog-jp { color: var(--bone-2); }
  .prog-row:hover .prog-genre { color: var(--bone-2); }
  .prog-row:hover .prog-leader { border-color: rgba(239, 230, 214, .38); }
}
/* touch: a pressed state so the row answers the finger */
.prog-row:active::before { clip-path: inset(0); transition-duration: .25s; }

/* ── Footnote ───────────────────────────────────────────────────────── */
.prog-note {
  display: flex;
  gap: .7em;
  margin-top: 22px;
  font-size: 13.5px;
  line-height: 1.55;
  color: var(--fog);
}
.prog-note-mark { color: var(--seal-hot); flex: none; }

/* ── iPad portrait and small laptops ─────────────────────────────────── */
@media (max-width: 1024px) {
  /* narrower listing columns so every title (Carter Mining Company too) stays on one line */
  .prog-table { --pc-steam: 150px; --pc-itch: 140px; }
  .prog-jp { display: none; }
  .prog-genre { font-size: 14px; }
}
@media (max-width: 800px) and (min-width: 700px) {
  .prog-leader { display: none; }
}

/* ── Phones: stacked rows, no horizontal scrolling ───────────────────── */
@media (max-width: 699px) {
  .prog-table { --tt: 25px; border-top-width: 2px; }
  .prog-table tr { grid-template-columns: minmax(0, 1fr); }
  /* keep the column heads for screen readers, hide them visually */
  .prog-table .prog-head {
    position: absolute;
    width: 1px; height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
  }
  .prog-sub { padding: 30px 0 12px; }
  .prog-table .prog-sub th { font-size: 11px; gap: 10px; letter-spacing: .22em; }
  .prog-sub-en::before { margin-right: 9px; }
  .prog-table .prog-row {
    grid-template-columns: 26px minmax(0, 1fr) minmax(0, 1fr);
    grid-template-areas:
      "no game game"
      ".  steam itch";
    column-gap: 12px;
    row-gap: 14px;
    padding: 20px 0 22px;
  }
  .prog-no { grid-area: no; font-size: 12px; }
  .prog-cursor { display: none; }
  .prog-game { grid-area: game; }
  .prog-steam { grid-area: steam; padding-top: 0; }
  .prog-itch { grid-area: itch; padding-top: 0; }
  .prog-steam::before, .prog-itch::before {
    content: attr(data-label);
    content: attr(data-label) / '';
    display: block;
    margin-bottom: 7px;
    font-family: var(--f-pixel);
    font-size: 10px;
    letter-spacing: .24em;
    text-transform: uppercase;
    color: var(--fog-2);
  }
  .prog-genre { font-size: 14px; margin-top: 5px; }
  .prog-leader { display: none; }
  .prog-row::before {
    background:
      linear-gradient(rgba(12, 10, 8, .84), rgba(12, 10, 8, .84)),
      var(--row-art, none) var(--row-focus, 50% 50%) / cover no-repeat,
      var(--ink-2);
  }
  .prog-chip { padding: 6px 9px 5px; font-size: 11.5px; }
  .prog-when { margin-top: 7px; font-size: 11px; }
  .prog-row:focus-within .prog-title { transform: none; }
  .prog-note { font-size: 13px; }
}
@media (max-width: 359px) {
  .prog-table .prog-row { grid-template-columns: 22px minmax(0, 1fr) minmax(0, 1fr); column-gap: 8px; }
  .prog-chip .prog-ext { display: none; }
}

.prog-sub-count, .prog-note { display: none !important; }
