/* Pages for Konsool apps (/portals/, /tic80/), on top of /style.css: a film or a shot, the app,
   and a panel that puts it on a Konsool over USB (/konsool/install.js). */

.app .film {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 5 / 3;
  background: #000;
  border: 1px solid var(--rule);
  image-rendering: pixelated;
}
/* A YouTube film that loads only when played (video.js). */
.yt { position: relative; }
.yt .film { display: block; }
.yt iframe.film { border: 1px solid var(--rule); aspect-ratio: 16 / 9; height: auto; }
.yt img.film { aspect-ratio: 960 / 544; }
.yt-play {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  min-height: 48px;
  padding: 12px 24px;
  border: 1px solid var(--fg);
  background: rgba(0, 0, 0, 0.75);
  color: var(--fg);
  font: bold 14px/1 "Helvetica Neue", Helvetica, Arial, sans-serif;
  letter-spacing: 3px;
  text-transform: uppercase;
  cursor: pointer;
  transition: background-color 0.2s, color 0.2s;
}
.yt-play[hidden] { display: none; }
.yt-play small { display: block; margin-top: 6px; font-size: 10px; letter-spacing: 2px; color: var(--text); }
.yt-play:hover, .yt-play:focus-visible { background: var(--fg); color: var(--bg); }
.yt-play:hover small, .yt-play:focus-visible small { color: var(--bg); }
.yt-play:focus-visible { outline: 2px solid var(--cyan); outline-offset: 2px; }
/* A link with a note beside it reads as running text: underline it (WCAG 1.4.1). */
aside li:has(> small) > a { text-decoration: underline; text-decoration-color: var(--muted); text-underline-offset: 2px; }
aside li:has(> small) > a:hover, aside li:has(> small) > a:focus-visible { text-decoration-color: currentColor; }
.app .caption { margin: 8px 0 0; color: var(--muted); font-size: 12px; }

.app .lede { color: var(--fg); font-size: 16px; line-height: 1.6; margin-top: 24px; }

.konsool {
  border: 1px solid var(--rule);
  padding: 20px 24px;
}
.konsool ol { margin: 0 0 16px; padding-left: 1.4em; }
.konsool ol li { margin-bottom: 4px; }
.konsool .apps { list-style: none; margin: 0 0 16px; padding: 0; }
.konsool .apps li { margin-bottom: 4px; }
.konsool .apps b { color: var(--fg); }
.konsool .apps span { color: var(--muted); }
.app .actions { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
.app .actions button, .chips button {
  min-height: 40px;
  padding: 8px 18px;
  border: 1px solid var(--cyan);
  background: transparent;
  color: var(--cyan);
  font: bold 12px/1 "Helvetica Neue", Helvetica, Arial, sans-serif;
  letter-spacing: 3px;
  text-transform: uppercase;
  cursor: pointer;
  transition: background-color 0.2s, color 0.2s;
}
.app .actions button:hover, .app .actions button:focus-visible { background: var(--cyan); color: var(--bg); }
.app .actions button.start { border-color: var(--lime); color: var(--lime); }
.app .actions button.start:hover, .app .actions button.start:focus-visible { background: var(--lime); color: var(--bg); }
.app .actions button.alt, .app .actions button.remove { border-color: var(--rule); color: var(--text); }
.app .actions button.alt:hover, .app .actions button.alt:focus-visible { background: var(--text); color: var(--bg); }
.app .actions button.remove:hover, .app .actions button.remove:focus-visible { background: #ff8a80; border-color: #ff8a80; color: var(--bg); }
.app .actions button:is(:disabled, [aria-disabled="true"]) { border-color: var(--rule); color: var(--muted); background: transparent; cursor: not-allowed; }
.app button:focus-visible { outline: 2px solid var(--fg); outline-offset: 2px; }
.app .progress { height: 4px; margin-top: 16px; background: var(--rule); }
.app .bar { height: 100%; width: 0; background: var(--cyan); transition: width 0.15s; }
.konsool .status { min-height: 1.5em; margin: 12px 0 0; }
.konsool .status.ok { color: var(--lime); }
.konsool .status.error { color: #ff8a80; }
.konsool .status.warn { color: #ff8a1c; }
.konsool .note { color: var(--muted); font-size: 12px; margin: 16px 0 0; }

/* Portals' stories: a card each. */
.stories { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 16px; margin: 16px 0; }
.story { border: 1px solid var(--rule); }
.story img { display: block; width: 100%; height: auto; aspect-ratio: 5 / 3; image-rendering: pixelated; }
.story h4 { margin: 12px 12px 4px; color: var(--fg); font-size: 14px; }
.story p { margin: 0 12px 12px; }
.story .meta { color: var(--lime); font-size: 11px; letter-spacing: 2px; text-transform: uppercase; }

.made { margin-top: 40px; color: var(--muted); font-size: 12px; font-style: italic; }

/* The store: /konsool/ */
.store { margin-top: 40px; }
.store > .konsool p { margin: 0 0 12px; }
.filters { display: grid; gap: 12px; margin: 32px 0 24px; }
.filters input {
  width: 100%;
  min-height: 40px;
  padding: 8px 12px;
  border: 1px solid var(--rule);
  background: #0a0a0a;
  color: var(--fg);
  font: 14px "Helvetica Neue", Helvetica, Arial, sans-serif;
}
.filters input:focus-visible { outline: 2px solid var(--cyan); outline-offset: 0; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chips[hidden] { display: none; }
.chips button {
  min-height: 32px;
  padding: 6px 10px;
  border-color: var(--rule);
  color: var(--text);
  font-size: 11px;
  letter-spacing: 2px;
}
.chips button[aria-pressed="true"] { border-color: var(--cyan); color: var(--cyan); }
.chips button:hover, .chips button:focus-visible { background: var(--cyan); border-color: var(--cyan); color: var(--bg); }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.card { display: flex; gap: 16px; padding: 16px; border: 1px solid var(--rule); }
.card[hidden] { display: none; }
.card .icon { flex: none; width: 64px; height: 64px; image-rendering: pixelated; }
.card .body { display: flex; flex-direction: column; gap: 6px; min-width: 0; flex: 1; }
.card .name { margin: 0; color: var(--fg); font-size: 14px; }
.card .facts { margin: 0; color: var(--muted); font-size: 12px; }
.card .about { margin: 0; overflow-wrap: anywhere; }
.card .name a { color: var(--fg); }
.card.lit { border-color: var(--cyan); box-shadow: 0 0 0 1px var(--cyan); }
.card .find {
  padding: 0;
  border: 0;
  background: none;
  color: var(--text);
  font: inherit;
  text-decoration: underline;
  text-decoration-color: var(--rule);
  text-underline-offset: 2px;
  cursor: pointer;
}
.card .find:hover, .card .find:focus-visible { color: var(--fg); text-decoration-color: currentColor; }
.card .more summary { color: var(--muted); font-size: 11px; letter-spacing: 2px; text-transform: uppercase; cursor: pointer; }
.card .more summary:hover, .card .more summary:focus-visible { color: var(--fg); }
.card .more dl { display: grid; grid-template-columns: auto 1fr; gap: 2px 12px; margin: 8px 0 0; font-size: 12px; }
.card .more dt { color: var(--muted); }
.card .more dd { margin: 0; overflow-wrap: anywhere; }
.card .more a { text-decoration: underline; text-decoration-color: var(--muted); text-underline-offset: 2px; }
.filters .note { margin: 0; color: var(--muted); font-size: 12px; }
.card .badge { margin: 0; color: var(--lime); font-size: 11px; letter-spacing: 2px; text-transform: uppercase; }
.card .badge.update { color: var(--cyan); }
.card .badge.newer { color: #ff8a1c; }
.card .actions { gap: 8px; margin-top: auto; padding-top: 8px; }
.card .actions button { min-height: 32px; padding: 6px 10px; font-size: 11px; letter-spacing: 2px; }
.card .progress { margin-top: 4px; }
.card .line { margin: 0; min-height: 1.5em; font-size: 12px; }
.card .line.ok { color: var(--lime); }
.card .line.error { color: #ff8a80; }

/* Arriving through the Konsool's screen from the front page: it switches on, as an old screen
   does, a bright line opening up (store.js sets the class). */
body.switch-on .page { animation: switch-on 0.7s cubic-bezier(0.2, 0.8, 0.2, 1) both; }
@keyframes switch-on {
  0% { transform: scale(1, 0.004); filter: brightness(6); opacity: 1; }
  45% { transform: scale(1, 0.004); filter: brightness(6); }
  100% { transform: none; filter: none; }
}

/* Arriving through the Portals icon: out of an orange portal (konsool.js). A black veil with an
   oval hole that grows, its rim glowing orange. */
@property --portal { syntax: "<number>"; inherits: false; initial-value: 0; }
.portal-in {
  --portal: 0;
  position: fixed;
  inset: 0;
  z-index: 10;
  pointer-events: none;
  background:
    radial-gradient(ellipse calc(var(--portal) * 90vmax) calc(var(--portal) * 130vmax) at 50% 50%,
      transparent 96%, #ff8a1c 97%, #ffb15c 98.5%, #000 100%);
}

@media (prefers-reduced-motion: reduce) {
  .portal-in { display: none; }
  body.switch-on .page { animation: none; }
  .app .bar, .app button { transition: none; }
}
