:root {
  --silver: #c0c0c0;
  --silver-lt: #dfdfdf;
  --highlight: #ffffff;
  --shadow: #808080;
  --shadow-dark: #000000;
  --text: #000000;
  --text-strong: #1a1a1a;
  --link: #0000ee;
  --note-bg: #ffffe1;
  --ui: "MS Sans Serif", Tahoma, Geneva, Arial, sans-serif;
  --doc: "Times New Roman", Times, Georgia, serif;
  --bevel-up: var(--highlight) var(--shadow) var(--shadow) var(--highlight);
  --bevel-down: var(--shadow) var(--highlight) var(--highlight) var(--shadow);
  --bevel-window: var(--highlight) var(--shadow-dark) var(--shadow-dark)
    var(--highlight);
  --drop-shadow: 1px 1px 0 var(--shadow-dark);
  --groove: 2px groove var(--highlight);
}

@font-face {
  font-family: "VT323";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("assets/vt323.woff2") format("woff2");
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  padding: 0 0 24px;
  font-family: var(--doc);
  font-size: 16px;
  line-height: 1.5;
  color: var(--text);
  background-color: var(--shadow);
  background-image: repeating-linear-gradient(
    0deg,
    rgba(0, 0, 0, 0.04) 0 1px,
    transparent 1px 3px
  );
}

a {
  color: var(--link);
}

.site-header,
main,
.viewer {
  width: 100%;
  max-width: 900px;
  margin: 16px auto 0;
  border: 2px solid;
  border-color: var(--bevel-window);
}

main,
.viewer {
  background: var(--silver);
  box-shadow:
    inset 1px 1px 0 var(--highlight),
    inset -1px -1px 0 var(--shadow);
}

.site-header {
  background: #d8d8d8;
}

.site-header .inner {
  padding: 8px 12px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 16px;
}

.brand {
  text-decoration: none;
}

.brand-logo {
  height: 34px;
  width: auto;
  vertical-align: middle;
  margin-right: 8px;
}

.brand .version {
  font-family: "VT323", "Courier New", monospace;
  font-size: 1.7rem;
  font-weight: 400;
  line-height: 1;
  color: var(--text-strong);
  margin-left: 2px;
  text-shadow: 1px 1px 0 var(--highlight);
}

nav.main-nav {
  margin-left: auto;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

nav.main-nav a {
  display: inline-block;
  padding: 4px 12px;
  font-family: var(--ui);
  font-size: 0.8rem;
  color: #000;
  text-decoration: none;
  background: var(--silver);
  border: 2px solid;
  border-color: var(--bevel-up);
}

nav.main-nav a:visited {
  color: #000;
}

nav.main-nav a:hover {
  background: var(--silver-lt);
}

nav.main-nav a:active,
nav.main-nav a.active {
  border-color: var(--bevel-down);
  background: var(--silver);
  padding: 5px 11px 3px 13px;
}

main {
  padding: 20px 24px 32px;
}

h1,
h2,
h3 {
  font-family: var(--doc);
  line-height: 1.2;
  color: var(--text-strong);
  text-shadow: 1px 1px 0 var(--highlight);
}

h1 {
  font-size: 1.9rem;
  margin: 0 0 0.4em;
  border-bottom: 3px double var(--shadow);
  padding-bottom: 6px;
}

h2 {
  font-size: 1.4rem;
  margin-top: 1.4em;
  border-bottom: var(--groove);
  padding-bottom: 4px;
}

h3 {
  font-size: 1.15rem;
}

p {
  margin: 0.8em 0;
}

hr {
  border: none;
  border-top: var(--groove);
  margin: 1.2em 0;
}

code {
  font-family: "Courier New", monospace;
  font-size: 0.9em;
  background: #fff;
  border: 1px solid var(--shadow);
  padding: 0 4px;
  color: #000080;
}

pre {
  background: var(--highlight);
  color: #000;
  padding: 12px;
  overflow-x: auto;
  border: 2px solid;
  border-color: var(--bevel-down);
}

pre code {
  background: none;
  border: none;
  padding: 0;
  color: #000;
}

.hero {
  display: grid;
  grid-template-columns: 1.1fr 1fr;
  gap: 24px;
  align-items: center;
  margin-bottom: 8px;
}

.lead {
  max-width: 66ch;
}

.hero .lead {
  font-size: 1.2rem;
}

.hero img,
.card .thumb {
  background: #000;
  border: 2px solid;
  border-color: var(--bevel-down);
}

.hero img {
  display: block;
  width: 100%;
  height: auto;
  border-width: 3px;
}

/* retro terminal badge */
.pill {
  display: inline-block;
  font-family: "VT323", var(--ui);
  font-size: 1rem;
  font-weight: normal;
  line-height: 1;
  vertical-align: middle;
  color: #8fae8f;
  background: #383838;
  border: 2px solid;
  border-color: var(--bevel-down);
  padding: 2px 8px 1px;
}

.pill--ticker {
  margin-bottom: 12px;
  max-width: 180px;
  overflow: hidden;
  white-space: nowrap;
}

.pill__track {
  display: inline-flex;
  /* loop the two identical copies */
  animation: pill-ticker 16s linear infinite;
}

@keyframes pill-ticker {
  from {
    transform: translateX(-50%);
  }
  to {
    transform: translateX(0);
  }
}

@media (prefers-reduced-motion: reduce) {
  .pill__track {
    animation: none;
  }
}

.pill--version {
  margin-left: 6px;
  /* lives inside an h3 so get rid of inherited heading shadow */
  text-shadow: none;
}

.btn-row {
  margin: 20px 0 4px;
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.btn,
.enable-btn,
.details-btn {
  font-family: var(--ui);
  font-weight: bold;
  text-decoration: none;
  color: #000;
  background: var(--silver);
  border: 2px solid;
  border-color: var(--bevel-up);
  box-shadow: var(--drop-shadow);
  cursor: pointer;
}

.btn {
  display: inline-block;
  font-size: 0.9rem;
  padding: 8px 18px;
}

.enable-btn,
.details-btn {
  font-size: 0.8rem;
  line-height: 1.15;
  padding: 5px 14px;
}

.btn:hover,
.enable-btn:hover,
.details-btn:hover {
  background: var(--silver-lt);
}

.btn:active,
.enable-btn:active,
.details-btn:active,
.enable-btn.open,
.btn.open {
  border-color: var(--bevel-down);
  box-shadow: none;
}

.btn:active {
  padding: 9px 17px 7px 19px;
}

.enable-btn:active,
.details-btn:active {
  padding: 6px 13px 4px 15px;
}

.callout {
  background: var(--note-bg);
  color: #000;
  border: 2px solid;
  border-color: var(--bevel-down);
  margin: 20px 0;
  padding: 12px 16px;
  font-size: 1rem;
  /* let an inner <pre> scroll instead of stretching the card (see .plugin-card) */
  min-width: 0;
}

.callout--construction {
  background: repeating-linear-gradient(
    45deg,
    #ffe9a8,
    #ffe9a8 12px,
    #fff4cc 12px,
    #fff4cc 24px
  );
}

.wilber-aside {
  display: flex;
  align-items: center;
  gap: 20px;
  margin: 24px 0;
}

/* speech bubble: a callout that takes the remaining row width, with a tail
   pointing right toward Wilber (outline triangle behind a note-bg triangle) */
.callout--speech {
  position: relative;
  flex: 1;
  margin: 0;
}

.callout--speech::before,
.callout--speech::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 100%;
  width: 0;
  height: 0;
  border-style: solid;
  transform: translateY(-50%);
}

.callout--speech::before {
  border-width: 9px 0 9px 18px;
  border-color: transparent transparent transparent var(--highlight);
}

.callout--speech::after {
  border-width: 7px 0 7px 14px;
  border-color: transparent transparent transparent var(--note-bg);
}

.wilber-aside .wilber {
  flex: none;
  width: 150px;
  height: auto;
  display: block;
}

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 20px;
  margin-top: 24px;
}

.card {
  display: flex;
  flex-direction: column;
  background: var(--silver);
  text-decoration: none;
  color: #000;
  border: 2px solid;
  border-color: var(--bevel-up);
  box-shadow: var(--drop-shadow);
}

.card:visited {
  color: #000;
}

.card:hover {
  background: var(--silver-lt);
}

.card:active {
  border-color: var(--bevel-down);
  box-shadow: none;
}

.card .thumb {
  aspect-ratio: 4 / 2;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  margin: 6px 6px 0;
}

.card .thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.card .body {
  padding: 12px 16px 16px;
  display: flex;
  flex-direction: column;
  flex: 1;
}

.card h3 {
  margin: 0 0 6px;
  font-size: 1.15rem;
  color: var(--text-strong);
}

.card p {
  margin: 0 0 12px;
  font-size: 1rem;
  flex: 1;
}

.card .author {
  font-family: var(--ui);
  font-size: 0.8rem;
  color: #000;
  border-top: var(--groove);
  padding-top: 8px;
}

.cards.plugin-list {
  grid-template-columns: 1fr;
}

.plugin-card {
  cursor: default;
  scroll-margin-top: 16px;
  /* allow the card to shrink below a wide <pre> content width (grid item) */
  min-width: 0;
}

.plugin-card:hover {
  background: var(--silver);
}

.plugin-card:active {
  border-color: var(--bevel-up);
  box-shadow: var(--drop-shadow);
}

.plugin-card .body {
  padding: 16px;
  /* same: let the flex/grid child shrink so the inner <pre> can scroll */
  min-width: 0;
}

.plugin-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: var(--groove);
}

.src-link {
  margin-right: auto;
  font-family: var(--ui);
  font-size: 0.8rem;
  color: var(--link);
}

.callout--help {
  margin: 12px 0 0;
}

.callout--help p {
  margin: 0 0 8px;
}

.callout--help pre {
  margin: 8px 0;
}

.callout--help .enable-note {
  margin: 8px 0 0;
  color: var(--text-strong);
}

.callout--prompt {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px 16px;
}

.callout--prompt p {
  margin: 0;
  flex: 1;
}

.callout--prompt .guide-btn {
  flex: none;
}

.callout--guide h3 {
  margin: 1.2em 0 0.4em;
  font-size: 1rem;
}

.callout--guide h3:first-of-type {
  margin-top: 0.6em;
}

/* On wide viewports, split each card into two columns:
   title + description on the left, author + source + buttons on the
   right*/
@media (min-width: 721px) {
  .plugin-card .body {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 240px;
    grid-template-areas:
      "title  author"
      "desc   actions"
      "help   help";
    column-gap: 24px;
    align-items: start;
  }

  .plugin-card h3 {
    grid-area: title;
  }

  .plugin-card .body > p {
    grid-area: desc;
  }

  .plugin-card .author {
    grid-area: author;
    border-top: none;
    padding-top: 0;
  }

  .plugin-card .plugin-actions {
    grid-area: actions;
    flex-direction: column;
    align-items: flex-start;
  }

  .plugin-card .plugin-actions .src-link {
    margin-right: 0;
  }

  .plugin-card .callout--help {
    grid-area: help;
  }
}

/* Masonry-ish gallery: CSS columns keep each image at its native aspect
   ratio with minimal gaps */
.gallery-grid {
  column-count: 5;
  column-gap: 8px;
  margin-top: 20px;
}

.gallery-status {
  font-family: var(--ui);
  font-size: 0.8rem;
  color: var(--text-strong);
}

.gallery-card {
  margin: 0 0 8px;
  /* never split an image across two columns */
  break-inside: avoid;
}

.gallery-trigger {
  display: block;
  width: 100%;
  padding: 0;
  margin: 0;
  border: 2px solid;
  border-color: var(--bevel-down);
  background: #000;
  cursor: pointer;
  font: inherit;
}

.gallery-trigger img {
  display: block;
  width: 100%;
  height: auto;
}

.gallery-trigger:hover {
  border-color: var(--bevel-up);
}

.art-viewer {
  max-width: min(90vw, 900px);
  max-height: 90vh;
  padding: 0;
  background: var(--silver);
  border: 2px solid;
  border-color: var(--bevel-window);
  box-shadow: 4px 4px 0 var(--shadow-dark);
}

/* Scope display to the open state; Otherwise the dialog would always be shown
   even if not opened as it would overwrite the browser default */
.art-viewer[open] {
  display: flex;
  flex-direction: column;
}

/* lock background scroll while the dialog is open */
body:has(.art-viewer[open]) {
  overflow: hidden;
}

.art-viewer::backdrop {
  background: rgba(0, 0, 0, 0.6);
}

.art-viewer-titlebar {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 8px;
  padding: 4px 0;
  border-bottom: 1px solid var(--highlight);
  color: #000;
  font-family: var(--ui);
  font-size: 0.8rem;
  font-weight: bold;
  text-align: center;
}

.art-viewer-close {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 1.4rem;
  height: 1.4rem;
  padding: 0;
  background: var(--silver);
  border: 2px solid;
  border-color: var(--bevel-up);
  color: #000;
  font-family: var(--ui);
  font-size: 0.8rem;
  line-height: 1;
  cursor: pointer;
}

.art-viewer-close:active {
  border-color: var(--bevel-down);
}

.art-viewer-body {
  display: flex;
  flex-direction: column;
  min-height: 0;
  margin: 0;
  padding: 12px;
  gap: 12px;
}

.art-viewer-img {
  display: block;
  margin: 0 auto;
  min-width: min(260px, 80vw);
  max-width: 100%;
  max-height: 70vh;
  background: #000;
  border: 2px solid;
  border-color: var(--bevel-down);
}

.art-viewer-info {
  max-width: 66ch;
  margin: 0 auto;
  overflow-y: auto;
  font-family: var(--ui);
  font-size: 0.8rem;
  color: #000;
}

.gallery-caption {
  margin: 4px 0 8px;
  padding-left: 8px;
  border-left: 2px solid var(--highlight);
  font-family: var(--doc);
  font-size: 0.8rem;
  font-style: italic;
  color: var(--text-strong);
}

/* wrap the caption in curly quotes */
.gallery-caption::before {
  content: "“";
}

.gallery-caption::after {
  content: "”";
}

.gallery-meta {
  margin: 0;
}

@media (max-width: 720px) {
  .gallery-grid {
    column-count: 3;
  }

  .callout--prompt {
    flex-direction: column;
    align-items: flex-start;
  }
}

@media (max-width: 460px) {
  .gallery-grid {
    column-count: 2;
  }
}

body.viewer-page {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.viewer {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 16px 16px 20px;
}

.viewer-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 16px;
  margin-bottom: 12px;
  font-family: var(--ui);
}

.viewer-bar h1 {
  margin: 0;
  border: none;
  padding: 0;
}

.viewer-bar a.back {
  font-size: 0.8rem;
  color: var(--link);
}

.viewer-frame {
  flex: 1;
  min-height: 70vh;
  width: 100%;
  background: var(--silver);
  border: 2px solid;
  border-color: var(--bevel-down);
}

.source-note {
  margin: 12px 0 0;
  font-family: var(--ui);
  font-size: 0.8rem;
  color: var(--text-strong);
}

.source-note a {
  word-break: break-all;
}

.site-footer a,
.site-footer a:visited {
  color: #ffffff;
}

.site-footer a:hover {
  color: #dddddd;
}

.site-footer {
  width: 100%;
  max-width: 900px;
  margin: 16px auto 0;
  padding: 8px 12px;
  font-family: var(--ui);
  font-size: 0.8rem;
  text-align: center;
  color: #ffffff;
  text-shadow: 1px 1px 0 #000;
}

.site-footer .gbg {
  display: block;
  margin: 8px auto 0;
  image-rendering: pixelated;
}

@media (max-width: 720px) {
  .hero {
    grid-template-columns: 1fr;
  }

  nav.main-nav {
    margin-left: 0;
    width: 100%;
  }

  .wilber-aside .wilber {
    width: 110px;
  }
}
